This commit is contained in:
shilixia 2021-03-19 09:14:54 +08:00
commit cebb962975
9 changed files with 558 additions and 307 deletions

8
client/src/api/todos.js Normal file
View File

@ -0,0 +1,8 @@
import request from '@/utils/request'
export function getRecordtodos() {
return request({
url: '/supervision/record/todos/',
method: 'get'
})
}

View File

@ -19,9 +19,9 @@
首页
</el-dropdown-item>
</router-link>
<router-link to="/changepassword">
<router-link to="/myinfo">
<el-dropdown-item divided>
修改密码
个人中心
</el-dropdown-item>
</router-link>
<!-- <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">

View File

@ -46,7 +46,21 @@ export const constantRoutes = [
component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'dashboard' }
}]
}
},
{
path: '/myinfo',
component: Layout,
redirect: '/myinfo',
hidden: true,
children: [
{
path: '',
name: 'ChangePassword',
component: () => import('@/views/system/changepassword'),
meta: { title: '修改密码', noCache: true, icon: '', perms: [] },
},
]
},
]
/**
@ -89,8 +103,8 @@ export const asyncRoutes = [
}
]
}
,
{
,
{
path: '/inspection',
component: Layout,
redirect: '/inspection',
@ -100,13 +114,13 @@ export const asyncRoutes = [
component: () => import('@/views/ability/inspection'),
meta: { title: '检验能力', icon: 'table', perms: ['inspection_view'] }
}]
},
},
{
{
path: '/supervision',
component: Layout,
redirect: '/supervision/task',
name:'Supervision',
name: 'Supervision',
meta: { title: '日常监督', icon: 'table', perms: ['supervision'] },
children: [
{
@ -143,7 +157,7 @@ export const asyncRoutes = [
hidden: true
},
]
},
},
{
path: '/system',
@ -241,23 +255,7 @@ export const asyncRoutes = [
}
]
},
{
path: 'changepassword',
component: Layout,
redirect: 'changepassword',
name: 'ChangePW',
meta: { title: '修改密码', icon: 'tree' },
hidden:true,
children: [
{
path: '',
name: 'ChangePassword',
component: () => import('@/views/system/changepassword'),
meta: { title: '修改密码', noCache: true, icon: '', perms:[]},
hidden: true
},
]
}
{ path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({

View File

@ -95,16 +95,29 @@ const actions = {
return new Promise((resolve, reject) => {
getInfo(state.token).then(response => {
const { data } = response
if(data){
const { perms, name, avatar } = data
// perms must be a non-empty array
if (!perms || perms.length <= 0) {
reject('没有任何权限!')
}
commit('SET_PERMS', perms)
commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)
}else{
getInfo(state.token).then(res=>{
const { data } = response
if (!perms || perms.length <= 0) {
reject('没有任何权限!')
}
commit('SET_PERMS', perms)
commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)
})
}

View File

@ -58,6 +58,27 @@
<div slot="header" class="clearfix">
<span>待办任务提醒</span>
</div>
<div class="litem" @click="goto('toup')">
<el-link class="desc">
您有
<span style="color:red">{{todos.toup}}</span>
条记录待上报
</el-link>
</div>
<div class="litem">
<el-link class="desc" @click="goto('tozg')">
您有
<span style="color:red">{{todos.tozg}}</span>
条记录待整改
</el-link>
</div>
<div class="litem" @click="goto('uped')">
<el-link class="desc" v-if="todos.toconfirm">
您有
<span style="color:red">{{todos.toconfirm}}</span>
条记录待确认
</el-link>
</div>
</el-card>
</el-col>
</el-row>
@ -66,7 +87,7 @@
<script>
import { mapGetters } from 'vuex'
import { getRecordtodos } from "@/api/todos"
export default {
name: 'Dashboard',
computed: {
@ -75,15 +96,40 @@ export default {
'perms'
])
},
data(){
return {
todos:{}
}
},
created(){
this.gettodos()
},
methods:{
toPath(val) {
this.$router.push({path:val})
},
gettodos() {
getRecordtodos().then(res=>{
this.todos = res.data
})
},
goto(tab){
this.$router.push({name: "Report", params: { tab: tab }, })
}
}
}
</script>
<style lang="scss" scoped>
.litem {
margin-bottom: 4px;
.desc {
color: rgba(0, 0, 0, 0.65);
font-weight: bold;
font-size: 16px;
}
}
.dashboard {
&-container {
margin: 10px;

View File

@ -113,13 +113,64 @@
<el-table-column label="上报文件">
<template slot-scope="scope" v-if="scope.row.files">
<el-link v-if="scope.row.files.length>1">{{scope.row.files.length}}个文件</el-link>
<el-link v-if="scope.row.files.length>1" @click="handleRecord({action:'view', record:scope.row})">
<span style="color:red">{{scope.row.files.length}}</span>
个文件</el-link>
<div v-else v-for="item in scope.row.files_" v-bind:key="item.id">
<el-link :href="item.path" target="_blank" type="primary">{{ item.name }}</el-link>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px" fixed="right">
<template slot-scope="scope">
<el-button
v-if="
scope.row.state == '待上报' &&
checkPermission(['record_update'])
"
type="primary"
size="small"
@click="handleRecord({action:'update', record:scope.row})"
>编辑</el-button
>
<el-button
v-if="
(scope.row.state == '待上报' || scope.row.state == '待整改')&&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="handleRecord({action:'up', record:scope.row})"
>上报</el-button
>
<el-button
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_confirm'])
"
type="primary"
size="small"
@click="handleRecord({action:'confirm', record:scope.row})"
>确认</el-button
>
<el-button
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_reject'])
"
type="danger"
size="small"
@click="handleRecord({action:'reject', record:scope.row})"
>驳回</el-button
>
<el-button
v-if="checkPermission(['record_view'])"
size="small"
@click="handleRecord({action:'view', record:scope.row})"
>查看</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="recordList.count > 0"
@ -129,7 +180,14 @@
@pagination="getList"
/>
</el-card>
<el-drawer title="记录" :visible.sync="drawer" :with-header="false">
<recorddo
ref="recorddo"
:data="data"
@handleDo="handleDo"
v-if="drawer"
></recorddo>
</el-drawer>
</div>
</template>
<script>
@ -138,11 +196,12 @@ import {getRecordList} from "@/api/record";
import { genTree } from "@/utils";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import recorddo from "@/views/supervision/recorddo";
const defaultrecord = {
name: ""
};
export default {
components: { Pagination },
components: { Pagination, recorddo },
data() {
return {
record: defaultrecord,
@ -151,6 +210,7 @@ export default {
},
orgData: [],
drawer:false,
stateOptions: [
{ key: "待上报", name: "待上报" },
{ key: "已上报", name: "已上报" },
@ -205,6 +265,7 @@ export default {
this.getOrgList();
},
methods: {
checkPermission,
getList(){
getRecordList(this.listQuery).then((response)=>{
@ -239,7 +300,10 @@ export default {
this.getList();
},
handleRecord(data){
this.data = data;
this.drawer = true;
},
},
};

View File

@ -1,53 +1,42 @@
<template>
<div class="app-container">
<el-card
style="margin-top: 10px"
>
<el-card style="margin-top: 10px">
<el-row>
<el-button type="primary" @click="centerDialogVisible = true" plain>主动上报</el-button>
<el-button type="primary" @click="centerDialogVisible = true" plain
>主动上报</el-button
>
<el-dialog
title="提示"
:visible.sync="centerDialogVisible"
width="50%"
center>
center
>
<el-transfer
v-model="contents"
:data="contentOptions"
:titles="['材料清单', '选择的清单']"
:props="{ key : 'id' , label: 'name' }"
:props="{ key: 'id', label: 'name' }"
/>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="contentup()">确认</el-button>
</span>
</el-dialog>
</el-dialog>
</el-row>
</el-card>
<el-card
style="margin-top: 10px"
>
<el-card style="margin-top: 10px">
<el-row>
<el-col :span="24">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="待上报" name="first" lazy>
</el-tab-pane>
<el-tab-pane label="已上报" name="second" lazy>
</el-tab-pane>
<el-tab-pane label="待整改" name="third" lazy>
</el-tab-pane>
<el-tab-pane label="已确认" name="forth" lazy>
</el-tab-pane>
<el-tab-pane label="待上报" name="toup" lazy> </el-tab-pane>
<el-tab-pane label="已上报" name="uped" lazy> </el-tab-pane>
<el-tab-pane label="待整改" name="tozg" lazy> </el-tab-pane>
<el-tab-pane label="已确认" name="confirmed" lazy> </el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</el-row>
<el-table
v-loading="listLoading"
:data="recordList"
:data="recordList.results"
border
fit
stripe
@ -61,64 +50,100 @@
}}</template>
</el-table-column>
<el-table-column label="材料">
<template slot-scope="scope">{{
scope.row.content_.name
}}</template>
<template slot-scope="scope">{{ scope.row.content_.name }}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<el-tag type="danger" v-if="scope.row.state == '待上报'">{{ scope.row.state }}</el-tag>
<el-tag type="warning" v-else-if="scope.row.state == '待整改'">{{ scope.row.state }}</el-tag>
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{ scope.row.state }}</el-tag>
<el-tag v-else-if="scope.row.state == '已上报'">{{ scope.row.state }}</el-tag>
<el-tag type="danger" v-if="scope.row.state == '待上报'">{{
scope.row.state
}}</el-tag>
<el-tag type="warning" v-else-if="scope.row.state == '待整改'">{{
scope.row.state
}}</el-tag>
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{
scope.row.state
}}</el-tag>
<el-tag v-else-if="scope.row.state == '已上报'">{{
scope.row.state
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="上报情况">
<template slot-scope="scope"
v-if="scope.row.up_user_">{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template
<template slot-scope="scope" v-if="scope.row.up_user_"
>{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template
>
</el-table-column>
<el-table-column label="上报文件">
<template slot-scope="scope" v-if="scope.row.files">
<el-link v-if="scope.row.files.length>1" @click="handleRecord({action:'view', record:scope.row})">
<span style="color:red">{{scope.row.files.length}}</span>
个文件</el-link>
<div v-else v-for="item in scope.row.files_" v-bind:key="item.id">
<el-link :href="item.path" target="_blank" type="primary">{{ item.name }}</el-link>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
v-if="scope.row.state == '待上报' && checkPermission(['record_update'])"
v-if="
scope.row.state == '待上报' &&
checkPermission(['record_update'])
"
type="primary"
size="small"
@click="handleUpdate(scope)"
@click="handleRecord({action:'update', record:scope.row})"
>编辑</el-button
>
<el-button
v-if="scope.row.state == '待上报' && checkPermission(['record_up'])"
v-if="
(scope.row.state == '待上报' || scope.row.state == '待整改')
&&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="handleUp(scope)"
@click="handleRecord({action:'up', record:scope.row})"
>上报</el-button
>
<el-button
v-if="scope.row.state == '已提交' && checkPermission(['record_confirm'])"
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_confirm'])
"
type="primary"
size="small"
@click="handleConfirm(scope)"
@click="handleRecord({action:'confirm', record:scope.row})"
>确认</el-button
>
<el-button
v-if="scope.state == '已提交' && checkPermission(['record_reject'])"
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_reject'])
"
type="danger"
size="small"
@click="handleReject(scope)"
@click="handleRecord({action:'reject', record:scope.row})"
>驳回</el-button
>
<el-button
v-if="checkPermission(['record_view'])"
size="small"
@click="handleView(scope)"
@click="handleRecord({action:'view', record:scope.row})"
>查看</el-button
>
</template>
</el-table-column>
</el-table>
</el-card>
<pagination
v-show="recordList.count > 0"
:total="recordList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getRecordList"
/>
</el-card>
<el-drawer title="记录" :visible.sync="drawer" :with-header="false">
<recorddo
@ -131,7 +156,7 @@
</div>
</template>
<script>
import { getRecordList,createself } from "@/api/record";
import { getRecordList, createself } from "@/api/record";
import { getContentList } from "@/api/content";
import Pagination from "@/components/Pagination";
@ -144,54 +169,66 @@ export default {
return {
centerDialogVisible: false,
dialogVisible: false,
activeName: "first",
state:"待上报",
can_doself:true,
activeName: "toup",
state: "待上报",
can_doself: true,
contents: [],
contentOptions: [],
contents: [],
depts: [],
listLoading: false,
recordList: [],
listQuery: {
page: 1,
page_size: 20,
},
recordList: {
count:0
},
now: {},
drawer: false,
};
},
created() {
this.getTab();
this.getContentList();
this.getRecordList();
},
methods: {
checkPermission,
getRecordList(){
getRecordList({state:this.state}).then((res) => {
getTab() {
if (this.$route.params.tab) {
this.activeName = this.$route.params.tab;
this.handleClick({name:this.activeName})
}
},
getRecordList() {
getRecordList({ state: this.state }).then((res) => {
this.listLoading = false;
this.recordList = res.data.results;
this.recordList = res.data;
});
},
getContentList() {
getContentList({can_doself:this.can_doself}).then(res=>{
this.contentOptions = res.data
})
getContentList({ can_doself: this.can_doself }).then((res) => {
this.contentOptions = res.data;
});
},
handleClick(tab, event) {
switch (tab.name) {
case "first":
this.state="待上报";
case "toup":
this.state = "待上报";
this.getRecordList();
break;
case "second":
this.state="已上报";
case "uped":
this.state = "已上报";
this.getRecordList();
break;
case "third":
this.state="待整改";
case "tozg":
this.state = "待整改";
this.getRecordList();
break;
case "forth":
this.state="已确认";
case "confirmed":
this.state = "已确认";
this.getRecordList();
break;
}
@ -224,37 +261,17 @@ export default {
this.drawer = false;
this.getRecordList();
},
handleView(scope) {
this.data = {
action: "view",
record: scope.row,
};
handleRecord(data){
this.data = data;
this.drawer = true;
},
handleReject(scope) {
this.data = {
action: "reject",
record: scope.row,
};
this.drawer = true;
},
handleConfirm(scope) {
this.data = {
action: "reject",
record: scope.row,
};
this.drawer = true;
},
contentup(){
console.log(this.contents)
if(this.contents.length>0){
createself({contents:this.contents}
).then((res) => {
this.centerDialogVisible = false
contentup() {
if (this.contents.length > 0) {
createself({ contents: this.contents }).then((res) => {
this.centerDialogVisible = false;
});
}else{
this.$message.error('请选择清单!')
} else {
this.$message.error("请选择清单!");
}
},
},

View File

@ -33,16 +33,22 @@
<div style="margin-bottom: 6px">
<span class="term">任务状态</span>
<span class="desc">
<el-tag v-if="task.state=='创建中'" type="warning">{{task.state}}</el-tag>
<el-tag v-else-if="task.state=='执行中'" type="primary">{{task.state}}</el-tag>
<el-tag v-else type="success">{{task.state}}</el-tag>
<el-tag v-if="task.state == '创建中'" type="warning">{{
task.state
}}</el-tag>
<el-tag v-else-if="task.state == '执行中'" type="primary">{{
task.state
}}</el-tag>
<el-tag v-else type="success">{{ task.state }}</el-tag>
</span>
</div>
</el-col>
<el-col :span="8">
<div style="margin-bottom: 6px">
<span class="term">上报/确认率</span>
<span class="desc"> {{ task.up_rate }}% -- {{task.confirm_rate}}%</span>
<span class="desc">
{{ task.up_rate }}% -- {{ task.confirm_rate }}%</span
>
</div>
</el-col>
<el-col :span="8">
@ -81,7 +87,9 @@
v-bind:key="item.id"
@click="chosecontent(item)"
>
<el-link type="primary">{{index+1}}-{{ item.name }}</el-link>
<el-link type="primary"
>{{ index + 1 }}-{{ item.name }}</el-link
>
</div>
</el-card>
</el-col>
@ -90,9 +98,9 @@
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div style="margin-bottom:6px">
<div style="margin-bottom: 6px">
当前选择
<span style="color:red">{{nowcontent.name}}</span>
<span style="color: red">{{ nowcontent.name }}</span>
</div>
<el-table
v-loading="listLoading"
@ -110,20 +118,67 @@
}}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope"><el-tag type="danger" v-if="scope.row.state == '待上报'">{{ scope.row.state }}</el-tag>
<el-tag type="warning" v-else-if="scope.row.state == '待整改'">{{ scope.row.state }}</el-tag>
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{ scope.row.state }}</el-tag>
<el-tag v-else-if="scope.row.state == '已上报'">{{ scope.row.state }}</el-tag></template>
<template slot-scope="scope"
><el-tag
type="danger"
v-if="scope.row.state == '待上报'"
>{{ scope.row.state }}</el-tag
>
<el-tag
type="warning"
v-else-if="scope.row.state == '待整改'"
>{{ scope.row.state }}</el-tag
>
<el-tag
type="success"
v-else-if="scope.row.state == '已确认'"
>{{ scope.row.state }}</el-tag
>
<el-tag v-else-if="scope.row.state == '已上报'">{{
scope.row.state
}}</el-tag></template
>
</el-table-column>
<el-table-column label="上报情况">
<template slot-scope="scope"
v-if="scope.row.up_user_">{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template
<template slot-scope="scope" v-if="scope.row.up_user_"
>{{ scope.row.up_user_.name }}/{{
scope.row.up_date
}}</template
>
</el-table-column>
<el-table-column label="文件">
<template slot-scope="scope"> </template>
<template slot-scope="scope" v-if="scope.row.files">
<el-link
v-if="scope.row.files.length > 1"
@click="
handleRecord({ action: 'view', record: scope.row })
"
>
<span style="color: red">{{
scope.row.files.length
}}</span>
个文件</el-link
>
<div
v-else
v-for="item in scope.row.files_"
v-bind:key="item.id"
>
<el-link
:href="item.path"
target="_blank"
type="primary"
>{{ item.name }}</el-link
>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px" fixed="right">
<el-table-column
align="center"
label="操作"
width="220px"
fixed="right"
>
<template slot-scope="scope">
<el-button
v-if="
@ -132,17 +187,22 @@
"
type="primary"
size="small"
@click="handleRecord({action:'update', record:scope.row})"
@click="
handleRecord({ action: 'update', record: scope.row })
"
>编辑</el-button
>
<el-button
v-if="
(scope.row.state == '待上报' || scope.row.state == '待整改')&&
(scope.row.state == '待上报' ||
scope.row.state == '待整改') &&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="handleRecord({action:'up', record:scope.row})"
@click="
handleRecord({ action: 'up', record: scope.row })
"
>上报</el-button
>
<el-button
@ -152,7 +212,9 @@
"
type="primary"
size="small"
@click="handleRecord({action:'confirm', record:scope.row})"
@click="
handleRecord({ action: 'confirm', record: scope.row })
"
>确认</el-button
>
<el-button
@ -162,13 +224,17 @@
"
type="danger"
size="small"
@click="handleRecord({action:'reject', record:scope.row})"
@click="
handleRecord({ action: 'reject', record: scope.row })
"
>驳回</el-button
>
<el-button
v-if="checkPermission(['record_view'])"
size="small"
@click="handleRecord({action:'view', record:scope.row})"
@click="
handleRecord({ action: 'view', record: scope.row })
"
>查看</el-button
>
</template>
@ -190,7 +256,9 @@
v-bind:key="item.id"
@click="chosedept(item)"
>
<el-link type="primary">{{index+1}}-{{ item.name }}</el-link>
<el-link type="primary"
>{{ index + 1 }}-{{ item.name }}</el-link
>
</div>
</el-card>
</el-col>
@ -199,9 +267,9 @@
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div style="margin-bottom:6px">
<div style="margin-bottom: 6px">
当前选择
<span style="color:red">{{nowdept.name}}</span>
<span style="color: red">{{ nowdept.name }}</span>
</div>
<el-table
v-loading="listLoading"
@ -220,23 +288,40 @@
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<el-tag type="danger" v-if="scope.row.state == '待上报'">{{ scope.row.state }}</el-tag>
<el-tag type="warning" v-else-if="scope.row.state == '待整改'">{{ scope.row.state }}</el-tag>
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{ scope.row.state }}</el-tag>
<el-tag v-else-if="scope.row.state == '已上报'">{{ scope.row.state }}</el-tag>
<el-tag
type="danger"
v-if="scope.row.state == '待上报'"
>{{ scope.row.state }}</el-tag
>
<el-tag
type="warning"
v-else-if="scope.row.state == '待整改'"
>{{ scope.row.state }}</el-tag
>
<el-tag
type="success"
v-else-if="scope.row.state == '已确认'"
>{{ scope.row.state }}</el-tag
>
<el-tag v-else-if="scope.row.state == '已上报'">{{
scope.row.state
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="上报情况">
<template slot-scope="scope"
v-if="scope.row.up_user_">{{ scope.row.up_user }}/{{ scope.row.up_date }}</template
<template slot-scope="scope" v-if="scope.row.up_user_"
>{{ scope.row.up_user }}/{{ scope.row.up_date }}</template
>
</el-table-column>
<el-table-column label="文件">
<template slot-scope="scope">
</template>
<template slot-scope="scope"> </template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px" fixed="right">
<el-table-column
align="center"
label="操作"
width="220px"
fixed="right"
>
<template slot-scope="scope">
<el-button
v-if="
@ -245,18 +330,22 @@
"
type="primary"
size="small"
@click="handleRecord({action:'update', record:scope.row})"
@click="
handleRecord({ action: 'update', record: scope.row })
"
>编辑</el-button
>
<el-button
v-if="
(scope.row.state == '待上报' || scope.row.state == '待整改')
&&
(scope.row.state == '待上报' ||
scope.row.state == '待整改') &&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="handleRecord({action:'up', record:scope.row})"
@click="
handleRecord({ action: 'up', record: scope.row })
"
>上报</el-button
>
<el-button
@ -266,7 +355,9 @@
"
type="primary"
size="small"
@click="handleRecord({action:'confirm', record:scope.row})"
@click="
handleRecord({ action: 'confirm', record: scope.row })
"
>确认</el-button
>
<el-button
@ -276,13 +367,17 @@
"
type="danger"
size="small"
@click="handleRecord({action:'reject', record:scope.row})"
@click="
handleRecord({ action: 'reject', record: scope.row })
"
>驳回</el-button
>
<el-button
v-if="checkPermission(['record_view'])"
size="small"
@click="handleRecord({action:'view', record:scope.row})"
@click="
handleRecord({ action: 'view', record: scope.row })
"
>查看</el-button
>
</template>
@ -302,7 +397,12 @@
>
<taskinit ref="taskinit" @handleChose="chooseComplete"></taskinit>
</el-dialog>
<el-drawer title="记录" :visible.sync="drawer" :with-header="false" size="40%">
<el-drawer
title="记录"
:visible.sync="drawer"
:with-header="false"
size="40%"
>
<recorddo
ref="recorddo"
:data="data"
@ -349,8 +449,8 @@ export default {
listLoading: false,
recordList1: [],
recordList2: [],
nowcontent:{},
nowdept:{},
nowcontent: {},
nowdept: {},
drawer: false,
data: {},
};
@ -387,7 +487,10 @@ export default {
gettaskcontents(this.task.id).then((res) => {
this.contents = res.data;
this.listLoading = true;
this.nowcontent = {id:this.contents[0].id, name:this.contents[0].name}
this.nowcontent = {
id: this.contents[0].id,
name: this.contents[0].name,
};
getRecordList({
pageoff: true,
content: this.contents[0].id,
@ -404,11 +507,11 @@ export default {
});
},
chosecontent(item) {
this.nowcontent = item
this.nowcontent = item;
var data = {
pageoff: true,
task: this.task.id,
content:item.id
content: item.id,
};
this.listLoading = true;
getRecordList(data).then((res) => {
@ -417,11 +520,11 @@ export default {
});
},
chosedept(item) {
this.nowdept = item
this.nowdept = item;
var data = {
pageoff: true,
task: this.task.id,
belong_dept:item.id
belong_dept: item.id,
};
this.listLoading = true;
getRecordList(data).then((res) => {
@ -429,17 +532,17 @@ export default {
this.recordList2 = res.data;
});
},
handleRecord(data){
handleRecord(data) {
this.data = data;
this.drawer = true;
},
handleDo(data) {
this.drawer = false;
this.gettask()
if(this.activeName == 'contenttab'){
this.chosecontent(this.nowcontent)
}else if(this.activeName == 'depttab'){
this.chosedept(this.nowdept)
this.gettask();
if (this.activeName == "contenttab") {
this.chosecontent(this.nowcontent);
} else if (this.activeName == "depttab") {
this.chosedept(this.nowdept);
}
},
},

View File

@ -152,14 +152,16 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
上报
"""
obj = self.get_object()
if obj.state == '待上报' or obj.state == '待整改':
if 'files' in request.data:
if obj.state in ['待整改','待上报']:
if 'files' in request.data and len(request.data['files'])==0:
if request.data.get('noteb', None) and request.data.get('is_yes', True):
pass
else:
return Response('请上传文件或选择不适用并填写上报说明', status=status.HTTP_400_BAD_REQUEST)
obj.is_yes = request.data.get('is_yes')
obj.files.clear()
obj.files.add(*request.data['files'])
if request.data.get('noteb', None):
obj.noteb = request.data['noteb']
if request.data.get('is_yes', True):
obj.is_yes = request.data.get('is_yes')
obj.state = '已上报'
obj.up_user = request.user
obj.up_date = timezone.now()