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> </el-dropdown-item>
</router-link> </router-link>
<router-link to="/changepassword"> <router-link to="/myinfo">
<el-dropdown-item divided> <el-dropdown-item divided>
修改密码 个人中心
</el-dropdown-item> </el-dropdown-item>
</router-link> </router-link>
<!-- <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/"> <!-- <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'), component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'dashboard' } 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', path: '/inspection',
component: Layout, component: Layout,
redirect: '/inspection', redirect: '/inspection',
@ -100,13 +114,13 @@ export const asyncRoutes = [
component: () => import('@/views/ability/inspection'), component: () => import('@/views/ability/inspection'),
meta: { title: '检验能力', icon: 'table', perms: ['inspection_view'] } meta: { title: '检验能力', icon: 'table', perms: ['inspection_view'] }
}] }]
}, },
{ {
path: '/supervision', path: '/supervision',
component: Layout, component: Layout,
redirect: '/supervision/task', redirect: '/supervision/task',
name:'Supervision', name: 'Supervision',
meta: { title: '日常监督', icon: 'table', perms: ['supervision'] }, meta: { title: '日常监督', icon: 'table', perms: ['supervision'] },
children: [ children: [
{ {
@ -143,7 +157,7 @@ export const asyncRoutes = [
hidden: true hidden: true
}, },
] ]
}, },
{ {
path: '/system', path: '/system',
@ -241,23 +255,7 @@ export const asyncRoutes = [
} }
] ]
}, },
{ { path: '*', redirect: '/404', hidden: true }
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
},
]
}
] ]
const createRouter = () => new Router({ const createRouter = () => new Router({

View File

@ -95,16 +95,29 @@ const actions = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo(state.token).then(response => { getInfo(state.token).then(response => {
const { data } = response const { data } = response
if(data){
const { perms, name, avatar } = data const { perms, name, avatar } = data
// perms must be a non-empty array // perms must be a non-empty array
if (!perms || perms.length <= 0) { if (!perms || perms.length <= 0) {
reject('没有任何权限!') reject('没有任何权限!')
} }
commit('SET_PERMS', perms) commit('SET_PERMS', perms)
commit('SET_NAME', name) commit('SET_NAME', name)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
resolve(data) 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"> <div slot="header" class="clearfix">
<span>待办任务提醒</span> <span>待办任务提醒</span>
</div> </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-card>
</el-col> </el-col>
</el-row> </el-row>
@ -66,7 +87,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getRecordtodos } from "@/api/todos"
export default { export default {
name: 'Dashboard', name: 'Dashboard',
computed: { computed: {
@ -75,15 +96,40 @@ export default {
'perms' 'perms'
]) ])
}, },
data(){
return {
todos:{}
}
},
created(){
this.gettodos()
},
methods:{ methods:{
toPath(val) { toPath(val) {
this.$router.push({path: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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.litem {
margin-bottom: 4px;
.desc {
color: rgba(0, 0, 0, 0.65);
font-weight: bold;
font-size: 16px;
}
}
.dashboard { .dashboard {
&-container { &-container {
margin: 10px; margin: 10px;

View File

@ -113,13 +113,64 @@
<el-table-column label="上报文件"> <el-table-column label="上报文件">
<template slot-scope="scope" v-if="scope.row.files"> <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"> <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> <el-link :href="item.path" target="_blank" type="primary">{{ item.name }}</el-link>
</div> </div>
</template> </template>
</el-table-column> </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> </el-table>
<pagination <pagination
v-show="recordList.count > 0" v-show="recordList.count > 0"
@ -129,7 +180,14 @@
@pagination="getList" @pagination="getList"
/> />
</el-card> </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> </div>
</template> </template>
<script> <script>
@ -138,11 +196,12 @@ import {getRecordList} from "@/api/record";
import { genTree } from "@/utils"; import { genTree } from "@/utils";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import recorddo from "@/views/supervision/recorddo";
const defaultrecord = { const defaultrecord = {
name: "" name: ""
}; };
export default { export default {
components: { Pagination }, components: { Pagination, recorddo },
data() { data() {
return { return {
record: defaultrecord, record: defaultrecord,
@ -151,6 +210,7 @@ export default {
}, },
orgData: [], orgData: [],
drawer:false,
stateOptions: [ stateOptions: [
{ key: "待上报", name: "待上报" }, { key: "待上报", name: "待上报" },
{ key: "已上报", name: "已上报" }, { key: "已上报", name: "已上报" },
@ -205,6 +265,7 @@ export default {
this.getOrgList(); this.getOrgList();
}, },
methods: { methods: {
checkPermission,
getList(){ getList(){
getRecordList(this.listQuery).then((response)=>{ getRecordList(this.listQuery).then((response)=>{
@ -239,7 +300,10 @@ export default {
this.getList(); this.getList();
}, },
handleRecord(data){
this.data = data;
this.drawer = true;
},
}, },
}; };

View File

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

View File

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

View File

@ -152,14 +152,16 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
上报 上报
""" """
obj = self.get_object() obj = self.get_object()
if obj.state == '待上报' or obj.state == '待整改': if obj.state in ['待整改','待上报']:
if 'files' in request.data: 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.clear()
obj.files.add(*request.data['files']) obj.files.add(*request.data['files'])
if request.data.get('noteb', None):
obj.noteb = request.data['noteb'] obj.noteb = request.data['noteb']
if request.data.get('is_yes', True):
obj.is_yes = request.data.get('is_yes')
obj.state = '已上报' obj.state = '已上报'
obj.up_user = request.user obj.up_user = request.user
obj.up_date = timezone.now() obj.up_date = timezone.now()