按要求修改

This commit is contained in:
caoqianming 2021-03-30 17:30:08 +08:00
parent 1c6ed2bfb9
commit 0351b6a7a4
22 changed files with 1417 additions and 644 deletions

View File

@ -34,6 +34,14 @@ export function updateRecord(id, data) {
data
})
}
export function updateRecords(data) {
return request({
url: '/supervision/record/updates/',
method: 'put',
data
})
}
export function createself(data) {
return request({
url: `/supervision/record/createself/`,

View File

@ -68,4 +68,18 @@ export function starttask(id) {
url: `/supervision/task/${id}/start/`,
method: 'put'
})
}
export function closetask(id) {
return request({
url: `/supervision/task/${id}/close/`,
method: 'put'
})
}
export function gettaskdeptall(id) {
return request({
url: `/supervision/task/${id}/deptall/`,
method: 'get'
})
}

View File

@ -5,55 +5,63 @@
>新增</el-button
>
</el-card>
<el-card
style="margin-top: 10px"
>
<el-table
v-loading="listLoading"
:data="contentList"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="详情">
<template slot-scope="scope">{{ scope.row.desc }}</template>
</el-table-column>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="contentList"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="详情">
<template slot-scope="scope">{{ scope.row.desc }}</template>
</el-table-column>
<el-table-column label="材料类型">
<template slot-scope="scope">{{ scope.row.type_ }}</template>
</el-table-column>
<el-table-column align="center" label="是否可主动报送">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.can_doself"></el-tag>
<el-table-column label="材料类型">
<template slot-scope="scope">{{ scope.row.type_ }}</template>
</el-table-column>
<el-table-column label="排序号">
<template slot-scope="scope">{{ scope.row.sortnum }}</template>
</el-table-column>
<el-table-column align="center" label="是否可主动报送">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.can_doself"></el-tag>
</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="操作" width="200px" fixed="right">
<template slot-scope="scope">
<el-button
:disabled="!checkPermission(['content'])"
type="primary"
size="small"
icon="el-icon-edit"
@click="handleEdit(scope)"
/>
<el-button
:disabled="!checkPermission(['content'])"
type="danger"
size="small"
icon="el-icon-delete"
@click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
</el-card>
<el-table-column
align="center"
label="操作"
width="200px"
fixed="right"
>
<template slot-scope="scope">
<el-button
:disabled="!checkPermission(['content'])"
type="primary"
size="small"
icon="el-icon-edit"
@click="handleEdit(scope)"
/>
<el-button
:disabled="!checkPermission(['content'])"
type="danger"
size="small"
icon="el-icon-delete"
@click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑资料' : '新增资料'"
@ -68,13 +76,13 @@
<el-form-item label="名称" prop="name">
<el-input v-model="Content.name" placeholder="名称" />
</el-form-item>
<el-form-item label="材料类型" prop="type" >
<el-form-item label="材料类型" prop="type">
<el-cascader
v-model = "Content.type"
v-model="Content.type"
:options="typeOptions"
:props="{ emitPath : false , }"
:props="{ emitPath: false }"
clearable
style="width:100%"
style="width: 100%"
></el-cascader>
</el-form-item>
@ -86,9 +94,19 @@
placeholder="详情"
/>
</el-form-item>
<el-form-item label="是否可主动报送" prop="can_doself" label-width="120px">
<el-switch v-model="Content.can_doself" ></el-switch>
<el-form-item label="排序" prop="sort">
<el-input-number
v-model="Content.sortnum"
:min="1"
:max="999"
></el-input-number>
</el-form-item>
<el-form-item
label="是否可主动报送"
prop="can_doself"
label-width="120px"
>
<el-switch v-model="Content.can_doself"></el-switch>
</el-form-item>
</el-form>
<div style="text-align: right">

View File

@ -3,8 +3,8 @@
<el-card>
<div>
<el-input
v-model="listQuery.content_name"
placeholder="材料名称"
v-model="listQuery.search"
placeholder="搜索"
style="width: 140px"
@keyup.enter.native="handleFilter"
/>
@ -81,7 +81,8 @@
>
</div>
<div style="margin-top: 10px">
<el-button type="primary" @click="centerDialogVisible = true" >主动上报</el-button
<el-checkbox v-model="listQuery.only" @change="showOnly">只显示本司</el-checkbox>
<el-button type="primary" @click="centerDialogVisible = true" style="margin-left:4px">主动上报</el-button
>
<el-dialog
title="主动报送"
@ -110,7 +111,7 @@
stripe
highlight-current-row
max-height="600"
:default-sort="{ prop: 'date', order: 'descending' }"
@sort-change="changeTableSort"
>
<el-table-column type="index" width="50" />
@ -128,10 +129,10 @@
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column label="材料名称">
<template slot-scope="scope">{{ scope.row.content_.name }}</template>
<el-table-column label="材料名称" sortable='custom' prop="content__sortnum">
<template slot-scope="scope">{{ scope.row.content_name }}</template>
</el-table-column>
<el-table-column label="报送要求">
<el-table-column label="报送要求/备注">
<template slot-scope="scope">{{ scope.row.note }}</template>
</el-table-column>
<el-table-column label="上报情况">
@ -142,7 +143,7 @@
<el-table-column label="上报说明">
<template slot-scope="scope">{{ scope.row.noteb }}</template>
</el-table-column>
<el-table-column label="上报单位">
<el-table-column label="上报单位" sortable='custom' prop="belong_dept__sort">
<template slot-scope="scope">{{
scope.row.belong_dept_.name
}}</template>
@ -182,7 +183,6 @@
<el-table-column
align="center"
label="操作"
width="220px"
fixed="right"
>
<template slot-scope="scope">
@ -344,6 +344,7 @@ export default {
listQuery: {
page: 1,
page_size: 20,
only: true
},
listLoading: false,
dialogVisible: false,
@ -392,7 +393,7 @@ export default {
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
page_size: 20
};
this.getList();
},
@ -411,6 +412,17 @@ export default {
});
},
showOnly(val) {
this.getList()
},
changeTableSort (val) {
if(val.order == 'ascending'){
this.listQuery.ordering = val.prop
}else{
this.listQuery.ordering = '-' + val.prop
}
this.getList()
},
contentup() {
if (this.contents.length > 0) {
createself({ contents: this.contents }).then((res) => {

View File

@ -2,8 +2,12 @@
<div class="app-container">
<div class="ma">上报记录</div>
<div class="ma">
<span class="term">清单内容</span>
<span class="desc">{{ record.content_.name }}</span>
<span class="term">材料内容</span>
<span class="desc">{{ record.content_name }}</span>
</div>
<div class="ma" v-if="record.content_desc">
<span class="term">材料详情</span>
<span class="desc">{{ record.content_desc }}</span>
</div>
<div class="ma">
<span class="term">上报状态</span>
@ -19,7 +23,7 @@
<span class="desc">{{ record.task_.end_date }}</span>
</div>
<div class="ma" v-if="record.task_">
<span class="term">报送要求</span>
<span class="term">报送要求/备注</span>
<el-input
v-model="record.note"
placeholder=""
@ -73,7 +77,7 @@
<el-button size="small" type="primary">上传文件</el-button>
<template #tip>
<div class="el-upload__tip">
可上传pdf,word,ppt,excel,图片文件,大小不超过20M
可上传pdf,word,ppt,excel,图片文件,大小不超过50M
</div>
</template>
</el-upload>
@ -172,9 +176,9 @@ export default {
fileList.splice(index, 1);
},
beforeUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 20;
const isLt2M = file.size / 1024 / 1024 < 50;
if (!isLt2M) {
this.$message.error("单文件不能超过20MB!");
this.$message.error("单文件不能超过50MB!");
}
return isLt2M;
},

View File

@ -50,7 +50,7 @@
}}</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">

View File

@ -54,9 +54,9 @@
<el-table-column label="截止日期">
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column label="上报率/确认率">
<!-- <el-table-column label="上报率/确认率">
<template slot-scope="scope">{{ scope.row.up_rate }}%/{{scope.row.confirm_rate}}%</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="任务备注">
<template slot-scope="scope">{{ scope.row.note }}</template>
@ -68,23 +68,24 @@
width="220px"
>
<template slot-scope="scope">
<el-button
<el-link
type="primary"
:disabled="!checkPermission(['task_view'])"
size="small"
v-if="checkPermission(['task_view'])"
@click="handleDo(scope)"
>执行</el-button>
<el-button
:disabled="!checkPermission(['task_update'])"
size="small"
>执行</el-link>
<el-link
v-if="checkPermission(['task_update'])"
@click="handleEdit(scope)"
>编辑</el-button>
<el-button
:disabled="!checkPermission(['task_delete'])"
>编辑</el-link>
<el-link
v-if="checkPermission(['task_close']) && scope.row.state!='已关闭'"
@click="handleClose(scope)"
>关闭</el-link>
<el-link
v-if="checkPermission(['task_delete'])"
type="danger"
size="small"
@click="handleDelete(scope)"
>删除</el-button>
>删除</el-link>
</template>
</el-table-column>
</el-table>
@ -138,7 +139,7 @@
</div>
</template>
<script>
import { gettasklist, createtask, deletetask, updatetask } from "@/api/task";
import { gettasklist, createtask, deletetask, updatetaskm, closetask } from "@/api/task";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulttask = {
@ -232,6 +233,21 @@ export default {
console.error(err);
});
},
handleClose(scope) {
this.$confirm("确认关闭该任务吗?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
await closetask(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {

View File

@ -33,24 +33,32 @@
<div style="margin-bottom: 6px">
<span class="term">任务状态</span>
<span class="desc">
<el-tag effect="plain" v-if="task.state == '创建中'" type="warning">{{
<el-tag
effect="plain"
v-if="task.state == '创建中'"
type="warning"
>{{ task.state }}</el-tag
>
<el-tag
effect="plain"
v-else-if="task.state == '执行中'"
type="primary"
>{{ task.state }}</el-tag
>
<el-tag effect="plain" v-else type="success">{{
task.state
}}</el-tag>
<el-tag effect="plain" v-else-if="task.state == '执行中'" type="primary">{{
task.state
}}</el-tag>
<el-tag effect="plain" v-else type="success">{{ task.state }}</el-tag>
</span>
</div>
</el-col>
<el-col :span="8">
<!-- <el-col :span="8">
<div style="margin-bottom: 6px">
<span class="term">上报/确认率</span>
<span class="desc">
{{ task.up_rate }}% -- {{ task.confirm_rate }}%</span
>
</div>
</el-col>
</el-col> -->
<el-col :span="8">
<div style="margin-bottom: 6px">
<span class="term">备注</span>
@ -73,380 +81,172 @@
size="small"
>发布任务</el-button
>
<el-button type="primary" @click="handleUp1" size="small" v-if="checkPermission(['task_update'])">按材料批量修改备注</el-button>
</div>
</div>
</el-card>
<el-card style="margin-top: 2px">
<div slot="header" class="clearfix">
<span>执行部门</span>
</div>
<el-table
v-loading="listLoading"
:data="taskdeptall"
border
fit
stripe
highlight-current-row
max-height="300px"
@row-click="clickRow"
>
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="公司名称">
<template slot-scope="scope" v-if="scope.row.dept_">{{
scope.row.dept_.name
}}</template>
</el-table-column>
<el-table-column label="上报率">
<template slot-scope="scope"> {{ scope.row.up_rate }}% </template>
</el-table-column>
<el-table-column label="确认率">
<template slot-scope="scope">
{{ scope.row.confirm_rate }}%
</template>
</el-table-column>
</el-table>
</el-card>
<el-card style="margin-top: 2px">
<div slot="header" class="clearfix">
<span>执行详情</span>
</div>
<el-tabs v-model="activeName">
<el-tab-pane label="按清单" name="contenttab" lazy>
<el-row :gutter="10">
<el-col :span="4">
<el-card
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div
v-for="(item, index) in contents"
v-bind:key="item.id"
@click="chosecontent(item)"
style="margin-top:2px"
>
<el-link type="primary"
>{{ index + 1 }}-{{ item.name }}</el-link
>
</div>
</el-card>
</el-col>
<el-col :span="20">
<el-card
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div style="margin-bottom: 6px">
当前选择
<span style="color: red">{{ nowcontent.name }}</span>
</div>
<el-table
v-loading="listLoading"
:data="recordList1"
border
fit
stripe
highlight-current-row
max-height="600px"
>
<el-table-column label="序号" type="index" align="center" />
<el-table-column label="单位">
<template slot-scope="scope">{{
scope.row.belong_dept_.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 == '待发布'"
>{{ 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
>
</el-table-column>
<el-table-column label="报送要求">
<div>
<el-button type="primary" @click="handleUp2" size="small" v-if="checkPermission(['task_update'])">批量修改备注</el-button>
</div>
<el-table
v-loading="listLoading2"
:data="recordList"
border
fit
stripe
highlight-current-row
max-height="400px"
style="margin-top:2px"
@selection-change="handleSelectRecords"
>
<el-table-column type="selection" align="center" width="55" />
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="材料">
<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 == '待发布'
"
>{{ 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">{{ scope.row.note }}</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="操作"
width="240px"
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="
(scope.row.state == '待上报'||scope.row.state=='待发布' )&&
checkPermission(['record_update'])
"
type="warning"
size="small"
@click="
handleRecord({ action: 'update', record: scope.row })
"
>编辑</el-link
>
<el-link
v-if="
(scope.row.state == '待上报' ||
scope.row.state == '待整改') &&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="
handleRecord({ action: 'up', record: scope.row })
"
>上报</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_confirm'])
"
type="success"
size="small"
@click="
handleRecord({ action: 'confirm', record: scope.row })
"
>确认</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_reject'])
"
type="danger"
size="small"
@click="
handleRecord({ action: 'reject', record: scope.row })
"
>驳回</el-link
>
<el-link
v-if="checkPermission(['record_view'])"
size="small"
@click="
handleRecord({ action: 'view', record: scope.row })
"
>查看</el-link
>
<el-link
v-if="checkPermission(['record_delete'])"
type="danger"
size="small"
@click="
handleRecord({ action: 'delete', record: scope.row })
"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="按单位" name="depttab" lazy>
<el-row :gutter="10">
<el-col :span="4">
<el-card
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div
v-for="(item, index) in depts"
v-bind:key="item.id"
@click="chosedept(item)"
style="margin-top:2px"
>
<el-link type="primary"
>{{ index + 1 }}-{{ item.name }}</el-link
>
</div>
</el-card>
</el-col>
<el-col :span="20">
<el-card
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div style="margin-bottom: 6px">
当前选择
<span style="color: red">{{ nowdept.name }}</span>
</div>
<el-table
v-loading="listLoading"
:data="recordList2"
border
fit
stripe
highlight-current-row
max-height="600px"
>
<el-table-column label="序号" type="index" align="center" />
<el-table-column label="材料">
<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 == '待发布'"
>{{ 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
>
</el-table-column>
<el-table-column label="报送要求">
<template slot-scope="scope">{{ scope.row.note }}</template>
<el-table-column label="上报情况">
<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="操作"
width="240px"
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="
(scope.row.state == '待上报'||scope.row.state=='待发布' )&&
checkPermission(['record_update'])
"
type="warning"
size="small"
@click="
handleRecord({ action: 'update', record: scope.row })
"
>编辑</el-link
>
<el-link
v-if="
(scope.row.state == '待上报' ||
scope.row.state == '待整改') &&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="
handleRecord({ action: 'up', record: scope.row })
"
>上报</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_confirm'])
"
type="success"
size="small"
@click="
handleRecord({ action: 'confirm', record: scope.row })
"
>确认</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_reject'])
"
type="danger"
size="small"
@click="
handleRecord({ action: 'reject', record: scope.row })
"
>驳回</el-link
>
<el-link
v-if="checkPermission(['record_view'])"
size="small"
@click="
handleRecord({ action: 'view', record: scope.row })
"
>查看</el-link
>
<el-link
v-if="checkPermission(['record_delete'])"
type="danger"
size="small"
@click="
handleRecord({ action: 'delete', record: scope.row })
"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
<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="操作"
width="240px"
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="
(scope.row.state == '待上报' || scope.row.state == '待发布') &&
checkPermission(['record_update'])
"
type="warning"
size="small"
@click="handleRecord({ action: 'update', record: scope.row })"
>编辑</el-link
>
<el-link
v-if="
(scope.row.state == '待上报' || scope.row.state == '待整改') &&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="handleRecord({ action: 'up', record: scope.row })"
>上报</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_confirm'])
"
type="success"
size="small"
@click="handleRecord({ action: 'confirm', record: scope.row })"
>确认</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_reject'])
"
type="danger"
size="small"
@click="handleRecord({ action: 'reject', record: scope.row })"
>驳回</el-link
>
<el-link
v-if="checkPermission(['record_view'])"
size="small"
@click="handleRecord({ action: 'view', record: scope.row })"
>查看</el-link
>
<el-link
v-if="checkPermission(['record_delete'])"
type="danger"
size="small"
@click="handleRecord({ action: 'delete', record: scope.row })"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
title="初始化任务"
@ -487,11 +287,10 @@
cursor: pointer;
color: #409eff;
}
</style>
<script>
import { gettask, inittask, gettaskcontents, gettaskdepts, starttask } from "@/api/task";
import { getRecordList } from "@/api/record";
import { gettask, inittask, gettaskdeptall, starttask } from "@/api/task";
import { getRecordList, updateRecords } from "@/api/record";
import Pagination from "@/components/Pagination";
import taskinit from "@/views/supervision/taskinit";
import checkPermission from "@/utils/permission";
@ -506,19 +305,21 @@ export default {
contents: [],
depts: [],
listLoading: false,
recordList1: [],
recordList2: [],
listLoading2: false,
recordList: [],
nowcontent: {},
nowdept: {},
drawer: false,
data: {},
taskdeptall: [],
listQuery:{},
selectRecords:[]
};
},
created() {
this.task.id = this.$route.params.id;
this.gettask();
this.gettaskcontents();
this.gettaskdepts();
this.gettaskdeptall();
},
methods: {
checkPermission,
@ -530,6 +331,17 @@ export default {
}
});
},
gettaskdeptall() {
this.listLoading = true;
gettaskdeptall(this.task.id)
.then((res) => {
this.listLoading = false;
this.taskdeptall = res.data;
})
.catch((e) => {
this.listLoading = false;
});
},
init() {
this.dialogVisible = true;
},
@ -542,70 +354,17 @@ export default {
this.$router.go(0);
});
},
gettaskcontents() {
gettaskcontents(this.task.id).then((res) => {
this.contents = res.data;
if(this.contents[0]){
this.listLoading = true;
this.nowcontent = {
id: this.contents[0].id,
name: this.contents[0].name,
};
getRecordList({
pageoff: true,
content: this.contents[0].id,
task: this.task.id,
}).then((res) => {
this.listLoading = false;
this.recordList1 = res.data;
});
}
});
},
starttask(){
starttask() {
this.$confirm("确认发布任务吗?", "提示")
.then(async () => {
await starttask(this.task.id);
this.$message.success("成功");
location.reload();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
gettaskdepts() {
gettaskdepts(this.task.id).then((res) => {
this.depts = res.data;
});
},
chosecontent(item) {
this.nowcontent = item;
var data = {
pageoff: true,
task: this.task.id,
content: item.id,
};
this.listLoading = true;
getRecordList(data).then((res) => {
this.listLoading = false;
this.recordList1 = res.data;
});
},
chosedept(item) {
this.nowdept = item;
var data = {
pageoff: true,
task: this.task.id,
belong_dept: item.id,
};
this.listLoading = true;
getRecordList(data).then((res) => {
this.listLoading = false;
this.recordList2 = res.data;
});
},
handleRecord(data) {
this.data = data;
this.drawer = true;
@ -613,12 +372,47 @@ export default {
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.gettaskdeptall();
this.getRecordList();
},
getRecordList() {
getRecordList(this.listQuery)
.then((res) => {
this.listLoading2 = false;
this.recordList = res.data;
})
.catch((e) => {
this.listLoading2 = false;
});
},
clickRow(row, col, e) {
this.listLoading2 = true;
this.listQuery = { pageoff: true, task: row.task, belong_dept: row.dept }
this.getRecordList();
},
handleSelectRecords(val){
let selects = [];
for (var i = 0; i < val.length; i++) {
selects.push(val[i].id);
}
this.selectRecords = selects;
},
handleUp2(){
if (this.selectRecords.length) {
this.$prompt('请输入备注内容', '提示').then(({ value }) => {
updateRecords({note:value, ids:this.selectRecords}).then(res=>{
this.$message.success('成功')
this.getRecordList();
})
}).catch(() => {
});
} else {
this.$message({
message: "请先选择",
type: "warning",
});
}
}
},
};
</script>

View File

@ -0,0 +1,624 @@
<template>
<div class="app-container">
<el-card>
<div slot="header" class="clearfix">
<span>任务详情</span>
</div>
<div style="margin-left: 10px; margin-right: 10px">
<el-row :gutter="20">
<el-col :span="8">
<div style="margin-bottom: 6px">
<span class="term">任务名称</span>
<span class="desc"> {{ task.name }}</span>
</div>
</el-col>
<el-col :span="8">
<div style="margin-bottom: 6px">
<span class="term">截止日期</span>
<span class="desc"> {{ task.end_date }}</span>
</div>
</el-col>
<el-col :span="8">
<div style="margin-bottom: 6px">
<span class="term">创建人</span>
<span class="desc" v-if="task.create_by_">
{{ task.create_by_.name }}/</span
>
<span class="desc" v-if="task.belong_dept_">{{
task.belong_dept_.name
}}</span>
</div>
</el-col>
<el-col :span="8">
<div style="margin-bottom: 6px">
<span class="term">任务状态</span>
<span class="desc">
<el-tag effect="plain" v-if="task.state == '创建中'" type="warning">{{
task.state
}}</el-tag>
<el-tag effect="plain" v-else-if="task.state == '执行中'" type="primary">{{
task.state
}}</el-tag>
<el-tag effect="plain" 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
>
</div>
</el-col>
<el-col :span="8">
<div style="margin-bottom: 6px">
<span class="term">备注</span>
<span class="desc"> {{ task.note }}</span>
</div>
</el-col>
</el-row>
<div style="margin-top: 4px">
<el-button
type="primary"
@click="init()"
v-if="task.state == '创建中'"
size="small"
>初始化任务</el-button
>
<el-button
type="primary"
@click="starttask()"
v-if="task.state == '待发布'"
size="small"
>发布任务</el-button
>
</div>
</div>
</el-card>
<el-card style="margin-top: 2px">
<div slot="header" class="clearfix">
<span>执行详情</span>
</div>
<el-tabs v-model="activeName">
<el-tab-pane label="按清单" name="contenttab" lazy>
<el-row :gutter="10">
<el-col :span="4">
<el-card
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div
v-for="(item, index) in contents"
v-bind:key="item.id"
@click="chosecontent(item)"
style="margin-top:2px"
>
<el-link type="primary"
>{{ index + 1 }}-{{ item.name }}</el-link
>
</div>
</el-card>
</el-col>
<el-col :span="20">
<el-card
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div style="margin-bottom: 6px">
当前选择
<span style="color: red">{{ nowcontent.name }}</span>
</div>
<el-table
v-loading="listLoading"
:data="recordList1"
border
fit
stripe
highlight-current-row
max-height="600px"
>
<el-table-column label="序号" type="index" align="center" />
<el-table-column label="单位">
<template slot-scope="scope">{{
scope.row.belong_dept_.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 == '待发布'"
>{{ 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
>
</el-table-column>
<el-table-column label="报送要求/备注">
<template slot-scope="scope">{{ scope.row.note }}</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="操作"
width="240px"
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="
(scope.row.state == '待上报'||scope.row.state=='待发布' )&&
checkPermission(['record_update'])
"
type="warning"
size="small"
@click="
handleRecord({ action: 'update', record: scope.row })
"
>编辑</el-link
>
<el-link
v-if="
(scope.row.state == '待上报' ||
scope.row.state == '待整改') &&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="
handleRecord({ action: 'up', record: scope.row })
"
>上报</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_confirm'])
"
type="success"
size="small"
@click="
handleRecord({ action: 'confirm', record: scope.row })
"
>确认</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_reject'])
"
type="danger"
size="small"
@click="
handleRecord({ action: 'reject', record: scope.row })
"
>驳回</el-link
>
<el-link
v-if="checkPermission(['record_view'])"
size="small"
@click="
handleRecord({ action: 'view', record: scope.row })
"
>查看</el-link
>
<el-link
v-if="checkPermission(['record_delete'])"
type="danger"
size="small"
@click="
handleRecord({ action: 'delete', record: scope.row })
"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="按单位" name="depttab" lazy>
<el-row :gutter="10">
<el-col :span="4">
<el-card
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div
v-for="(item, index) in depts"
v-bind:key="item.id"
@click="chosedept(item)"
style="margin-top:2px"
>
<el-link type="primary"
>{{ index + 1 }}-{{ item.name }}</el-link
>
</div>
</el-card>
</el-col>
<el-col :span="20">
<el-card
shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto"
>
<div style="margin-bottom: 6px">
当前选择
<span style="color: red">{{ nowdept.name }}</span>
</div>
<el-table
v-loading="listLoading"
:data="recordList2"
border
fit
stripe
highlight-current-row
max-height="600px"
>
<el-table-column label="序号" type="index" align="center" />
<el-table-column label="材料">
<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 == '待发布'"
>{{ 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
>
</el-table-column>
<el-table-column label="报送要求/备注">
<template slot-scope="scope">{{ scope.row.note }}</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="操作"
width="240px"
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="
(scope.row.state == '待上报'||scope.row.state=='待发布' )&&
checkPermission(['record_update'])
"
type="warning"
size="small"
@click="
handleRecord({ action: 'update', record: scope.row })
"
>编辑</el-link
>
<el-link
v-if="
(scope.row.state == '待上报' ||
scope.row.state == '待整改') &&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="
handleRecord({ action: 'up', record: scope.row })
"
>上报</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_confirm'])
"
type="success"
size="small"
@click="
handleRecord({ action: 'confirm', record: scope.row })
"
>确认</el-link
>
<el-link
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_reject'])
"
type="danger"
size="small"
@click="
handleRecord({ action: 'reject', record: scope.row })
"
>驳回</el-link
>
<el-link
v-if="checkPermission(['record_view'])"
size="small"
@click="
handleRecord({ action: 'view', record: scope.row })
"
>查看</el-link
>
<el-link
v-if="checkPermission(['record_delete'])"
type="danger"
size="small"
@click="
handleRecord({ action: 'delete', record: scope.row })
"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
title="初始化任务"
:close-on-click-modal="false"
width="70%"
>
<taskinit ref="taskinit" @handleChose="chooseComplete"></taskinit>
</el-dialog>
<el-drawer
title="记录"
:visible.sync="drawer"
:with-header="false"
size="40%"
>
<recorddo
ref="recorddo"
:data="data"
@handleDo="handleDo"
v-if="drawer"
></recorddo>
</el-drawer>
</div>
</template>
<style >
.term {
color: rgba(0, 0, 0, 0.85);
font-weight: bold;
font-size: 16px;
}
.desc {
color: rgba(0, 0, 0, 0.65);
font-weight: bold;
font-size: 16px;
}
.litem {
margin-bottom: 4px;
margin-left: 2px;
cursor: pointer;
color: #409eff;
}
</style>
<script>
import { gettask, inittask, gettaskcontents, gettaskdepts, starttask } from "@/api/task";
import { getRecordList } from "@/api/record";
import Pagination from "@/components/Pagination";
import taskinit from "@/views/supervision/taskinit";
import checkPermission from "@/utils/permission";
import recorddo from "@/views/supervision/recorddo";
export default {
components: { Pagination, taskinit, recorddo },
data() {
return {
task: { id: 0 },
dialogVisible: false,
activeName: "contenttab",
contents: [],
depts: [],
listLoading: false,
recordList1: [],
recordList2: [],
nowcontent: {},
nowdept: {},
drawer: false,
data: {},
};
},
created() {
this.task.id = this.$route.params.id;
this.gettask();
this.gettaskcontents();
this.gettaskdepts();
},
methods: {
checkPermission,
gettask() {
gettask(this.task.id).then((res) => {
this.task = res.data;
if (this.task.state == "创建中") {
this.dialogVisible = true;
}
});
},
init() {
this.dialogVisible = true;
},
chooseComplete(data) {
this.dialogVisible = false;
const rLoading = this.openLoading("正在初始化任务,请稍等...");
inittask(this.task.id, data).then((res) => {
rLoading.close();
this.$message.success("成功");
this.$router.go(0);
});
},
gettaskcontents() {
gettaskcontents(this.task.id).then((res) => {
this.contents = res.data;
if(this.contents[0]){
this.listLoading = true;
this.nowcontent = {
id: this.contents[0].id,
name: this.contents[0].name,
};
getRecordList({
pageoff: true,
content: this.contents[0].id,
task: this.task.id,
}).then((res) => {
this.listLoading = false;
this.recordList1 = res.data;
});
}
});
},
starttask(){
this.$confirm("确认发布任务吗?", "提示")
.then(async () => {
await starttask(this.task.id);
this.$message.success("成功");
location.reload();
})
.catch((err) => {
console.error(err);
});
},
gettaskdepts() {
gettaskdepts(this.task.id).then((res) => {
this.depts = res.data;
});
},
chosecontent(item) {
this.nowcontent = item;
var data = {
pageoff: true,
task: this.task.id,
content: item.id,
};
this.listLoading = true;
getRecordList(data).then((res) => {
this.listLoading = false;
this.recordList1 = res.data;
});
},
chosedept(item) {
this.nowdept = item;
var data = {
pageoff: true,
task: this.task.id,
belong_dept: item.id,
};
this.listLoading = true;
getRecordList(data).then((res) => {
this.listLoading = false;
this.recordList2 = res.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);
}
},
},
};
</script>

View File

@ -52,7 +52,7 @@ export default {
},
methods: {
getOrgList() {
getOrgList({ pid: 1 }).then((res) => {
getOrgList({can_supervision:true}).then((res) => {
this.deptOptions = res.data;
});
},

View File

@ -1,19 +1,26 @@
<template>
<div class="app-container">
<div style="margin-top:10px">
<div style="margin-top: 10px">
<el-input
v-model="search"
placeholder="输入部门名称进行搜索"
style="width: 200px;"
style="width: 200px"
class="filter-item"
@keyup.native="handleFilter"
/>
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleAdd"
>新增</el-button
>
</div>
<el-table
v-loading="listLoading"
:data="tableData.filter(data => !search || data.name.toLowerCase().includes(search.toLowerCase()))"
style="width: 100%;margin-top:10px;"
:data="
tableData.filter(
(data) =>
!search || data.name.toLowerCase().includes(search.toLowerCase())
)
"
style="width: 100%; margin-top: 10px"
border
fit
stripe
@ -21,21 +28,29 @@
max-height="600"
row-key="id"
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column type="index" width="50" />
<el-table-column label="组织名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="创建日期">
<el-table-column label="组织类型">
<template slot-scope="scope">{{ scope.row.type }}</template>
</el-table-column>
<el-table-column label="配置">
<template slot-scope="scope">
<span>{{ scope.row.create_time }}</span>
<el-tag v-if="scope.row.can_supervision">可监督</el-tag>
</template>
</el-table-column>
<el-table-column label="排序">
<template slot-scope="scope">
{{ scope.row.sort }}
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
v-if="scope.row.type==='部门'"
v-if="scope.row.name != '国检集团'"
type="primary"
size="small"
icon="el-icon-edit"
@ -43,7 +58,7 @@
@click="handleEdit(scope)"
/>
<el-button
v-if="scope.row.type==='部门'"
v-if="scope.row.name != '国检集团'"
type="danger"
size="small"
icon="el-icon-delete"
@ -54,20 +69,51 @@
</el-table-column>
</el-table>
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑部门':'新增部门'">
<el-form ref="Form" :model="org" label-width="80px" label-position="right" :rules="rule1">
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑部门' : '新增部门'"
>
<el-form
ref="Form"
:model="org"
label-width="80px"
label-position="right"
:rules="rule1"
>
<el-form-item label="名称" prop="name">
<el-input v-model="org.name" placeholder="名称" />
</el-form-item>
<el-form-item label="上级部门" prop="pid">
<treeselect v-model="org.pid" :multiple="false" :options="tableData" placeholder="父级"/>
<el-form-item label="上级组织" prop="pid">
<treeselect
v-model="org.pid"
:multiple="false"
:options="tableData"
placeholder="父级"
/>
</el-form-item>
<el-form-item label="组织类型" prop="type">
<el-select v-model="org.type" placeholder="请选择">
<el-option
v-for="item in DeptTypeoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="配置" prop="can_supervision">
<el-checkbox v-model="org.can_supervision">可监督</el-checkbox>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number v-model="org.sort" :min="1" :max="10" ></el-input-number>
<el-input-number
v-model="org.sort"
:min="1"
:max="10"
></el-input-number>
</el-form-item>
</el-form>
<div style="text-align:right;">
<el-button type="danger" @click="dialogVisible=false">取消</el-button>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmOrg('Form')">确认</el-button>
</div>
</el-dialog>
@ -75,120 +121,130 @@
</template>
<script>
import { getOrgAll, createOrg, deleteOrg, updateOrg } from '@/api/org'
import { genTree } from '@/utils'
import checkPermission from '@/utils/permission'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getOrgAll, createOrg, deleteOrg, updateOrg } from "@/api/org";
import { genTree } from "@/utils";
import checkPermission from "@/utils/permission";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
const defaultOrg = {
id: null,
name: '',
name: "",
pid: null,
sort:1
}
sort: 1,
};
export default {
components: { Treeselect },
data() {
return {
org: {
id: '',
name: '',
pid: ''
id: "",
name: "",
pid: "",
},
search: '',
search: "",
tableData: [],
orgList: [],
listLoading: true,
dialogVisible: false,
dialogType: 'new',
dialogType: "new",
rule1: {
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
pid: [{ required: true, message: '请选择上级', trigger: 'change' }]
}
}
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
pid: [{ required: true, message: "请选择上级", trigger: "change" }],
},
DeptTypeoptions: [
{
value: "公司",
label: "公司",
},
{
value: "部门",
label: "部门",
},
],
};
},
computed: {},
created() {
this.getList()
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true
getOrgAll().then(response => {
this.orgList = response.data
const data = genTree(response.data)
this.tableData = data
this.listLoading = false
})
this.listLoading = true;
getOrgAll().then((response) => {
this.orgList = response.data;
const data = genTree(response.data);
this.tableData = data;
this.listLoading = false;
});
},
resetFilter() {
this.getList()
this.getList();
},
handleFilter() {
const newData = this.orgList.filter(
data =>
(data) =>
!this.search ||
data.name.toLowerCase().includes(this.search.toLowerCase())
)
this.tableData = genTree(newData)
);
this.tableData = genTree(newData);
},
handleAdd() {
this.org = Object.assign({}, defaultOrg)
this.dialogType = 'new'
this.dialogVisible = true
this.org = Object.assign({}, defaultOrg);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs['Form'].clearValidate()
})
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.org = Object.assign({}, scope.row) // copy obj
this.dialogType = 'edit'
this.dialogVisible = true
this.org = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs['Form'].clearValidate()
})
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm('确认删除?', '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'error'
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async() => {
await deleteOrg(scope.row.id)
this.getList()
this.$message.success('成功')
})
.catch(err => {
console.error(err)
.then(async () => {
await deleteOrg(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirmOrg(form) {
this.$refs[form].validate(valid => {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === 'edit'
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateOrg(this.org.id, this.org).then(() => {
this.getList()
this.dialogVisible = false
this.$message.success('成功')
})
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
});
} else {
createOrg(this.org).then(res => {
createOrg(this.org).then((res) => {
// this.org = res.data
// this.tableData.unshift(this.org)
this.getList()
this.dialogVisible = false
this.$message.success('成功')
})
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
});
}
} else {
return false
return false;
}
})
}
}
}
});
},
},
};
</script>

View File

@ -0,0 +1,35 @@
# Generated by Django 3.0.5 on 2021-03-30 02:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('supervision', '0010_auto_20210323_1425'),
]
operations = [
migrations.AddField(
model_name='record',
name='content_desc',
field=models.TextField(blank=True, null=True, verbose_name='材料详情'),
),
migrations.AddField(
model_name='record',
name='content_name',
field=models.CharField(default='', max_length=100, verbose_name='材料名称'),
preserve_default=False,
),
migrations.AlterField(
model_name='record',
name='content',
field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='record_content', to='supervision.Content', verbose_name='材料内容ID'),
),
migrations.AlterField(
model_name='record',
name='note',
field=models.TextField(blank=True, null=True, verbose_name='上报要求'),
),
]

View File

@ -0,0 +1,29 @@
# Generated by Django 3.0.5 on 2021-03-30 03:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('system', '0008_auto_20210311_0919'),
('supervision', '0011_auto_20210330_1020'),
]
operations = [
migrations.CreateModel(
name='TaskDept',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('up_rate', models.IntegerField(default=0, verbose_name='上报率')),
('confirm_rate', models.IntegerField(default=0, verbose_name='确认率')),
('dept', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='taskdept_dept', to='system.Organization', verbose_name='关联公司')),
('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='taskdept_task', to='supervision.Task', verbose_name='关联任务')),
],
options={
'verbose_name': '任务部门视图',
'verbose_name_plural': '任务部门视图',
},
),
]

View File

@ -0,0 +1,29 @@
# Generated by Django 3.0.5 on 2021-03-30 04:00
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('supervision', '0012_taskdept'),
]
operations = [
migrations.AddField(
model_name='taskdept',
name='create_time',
field=models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间'),
),
migrations.AddField(
model_name='taskdept',
name='is_deleted',
field=models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记'),
),
migrations.AddField(
model_name='taskdept',
name='update_time',
field=models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间'),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 3.0.5 on 2021-03-30 07:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('supervision', '0013_auto_20210330_1200'),
]
operations = [
migrations.AddField(
model_name='content',
name='sortnum',
field=models.IntegerField(default=1, verbose_name='排序号'),
),
migrations.AlterField(
model_name='task',
name='state',
field=models.CharField(choices=[('创建中', '创建中'), ('待发布', '待发布'), ('执行中', '执行中'), ('已关闭', '已关闭')], default='创建中', max_length=50, verbose_name='任务状态'),
),
]

View File

@ -11,6 +11,7 @@ class Content(CommonAModel):
desc = models.TextField('详情', null=True, blank=True)
type = models.ForeignKey(Dict, verbose_name='材料类型', on_delete= models.DO_NOTHING)
can_doself = models.BooleanField('可随时主动报送', default=False)
sortnum = models.IntegerField('排序号', default=1)
class Meta:
verbose_name = '报送清单'
@ -25,7 +26,7 @@ class Task(CommonBModel):
('创建中', '创建中'),
('待发布', '待发布'),
('执行中', '执行中'),
('完成', '已完成'),
('关闭', '已关闭'),
)
name = models.CharField('名称', max_length=100)
end_date = models.DateField('截止时间', null=True, blank=True)
@ -40,6 +41,16 @@ class Task(CommonBModel):
verbose_name_plural = verbose_name
class TaskDept(BaseModel):
task = models.ForeignKey(Task, verbose_name='关联任务', on_delete=models.CASCADE, related_name='taskdept_task')
dept = models.ForeignKey(Organization, verbose_name='关联公司', on_delete=models.CASCADE, related_name='taskdept_dept')
up_rate = models.IntegerField('上报率', default=0)
confirm_rate = models.IntegerField('确认率', default=0)
class Meta:
verbose_name = '任务部门视图'
verbose_name_plural = verbose_name
class Record(CommonBModel):
"""
上报记录
@ -51,7 +62,9 @@ class Record(CommonBModel):
('已确认', '已确认'),
('待整改', '待整改')
)
content = models.ForeignKey(Content, verbose_name='材料内容', on_delete=models.DO_NOTHING, related_name='record_content')
content = models.ForeignKey(Content, verbose_name='材料内容ID', on_delete=models.DO_NOTHING, related_name='record_content')
content_name = models.CharField('材料名称', max_length=100)
content_desc = models.TextField('材料详情', null=True, blank=True)
task = models.ForeignKey(Task, verbose_name='关联任务', null=True, blank=True, on_delete=models.SET_NULL, related_name='record_task')
is_self = models.BooleanField('是否主动报送', default=False)
up_date = models.DateField('上报时间', null=True, blank=True)
@ -59,7 +72,7 @@ class Record(CommonBModel):
end_date = models.DateField('截止时间', null=True, blank=True)
state = models.CharField('记录状态', max_length=50, choices=state_choices, default='待上报')
is_yes = models.BooleanField('是否适用', default=True)
note = models.TextField('上报备注', null=True, blank=True)
note = models.TextField('上报要求', null=True, blank=True)
noteb = models.TextField('上报说明', null=True, blank=True)
files = models.ManyToManyField(File, verbose_name="关联文件")
class Meta:

View File

@ -39,7 +39,6 @@ class TaskListSerializer(serializers.ModelSerializer):
class RecordSerializer(serializers.ModelSerializer):
task_ = TaskListSerializer(source='task')
content_=ContentListSerializer(source='content')
belong_dept_ = OrganizationSimpleSerializer(source='belong_dept', read_only=True)
files_ = FileSimpleSerializer(source='files', many=True, read_only=True)
up_user_ = UserSimpleSerializer(source='up_user', read_only = True)
@ -63,3 +62,10 @@ class TaksDetailSerializer(serializers.ModelSerializer):
class Meta:
model = Task
fields = '__all__'
class TaskDeptSerializer(serializers.ModelSerializer):
dept_ = OrganizationSimpleSerializer(source='dept', read_only=True)
class Meta:
model = TaskDept
fields = '__all__'

View File

@ -1,23 +1,25 @@
from django.conf import settings
from django.core.cache import cache
from django.db.models import Count, Q
from django.db.models.query import QuerySet
from django.shortcuts import render
from django.utils import timezone
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.mixins import ListModelMixin
from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet, ModelViewSet
from utils.pagination import PageOrNot
from apps.system.mixins import CreateUpdateCustomMixin
from apps.system.models import Organization
from apps.system.permission import get_permission_list, has_permission
from apps.system.permission_data import RbacFilterSet
from .filters import RecordFilter
from .models import *
from .serializers import *
from rest_framework.decorators import action
from django.conf import settings
from rest_framework import status
from rest_framework.response import Response
from apps.system.models import Organization
from django.db.models import Count
from utils.pagination import PageOrNot
from apps.system.mixins import CreateUpdateCustomMixin
from apps.system.permission_data import RbacFilterSet
from django.utils import timezone
from .filters import RecordFilter
from django.db.models.query import QuerySet
from django.core.cache import cache
from apps.system.permission import get_permission_list, has_permission
from django.db.models import Q
# Create your views here.
class ContentViewSet(CreateUpdateCustomMixin, ModelViewSet):
@ -50,6 +52,7 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
def destroy(self, request, *args, **kwargs):
instance = self.get_object()
instance.delete()
TaskDept.objects.filter(task=instance).delete()
Record.objects.filter(task=instance).delete()
return Response(status=status.HTTP_204_NO_CONTENT)
@ -63,16 +66,25 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
contents = request.data['contents']
if depts and contents:
record_list = []
taskdept_list = []
for m in depts:
xdata = {}
xdata['task'] = obj
xdata['dept'] = Organization.objects.get(pk=m)
taskdept_list.append(TaskDept(**xdata))
for n in contents:
data={}
data['content'] = Content.objects.get(pk=n)
content = Content.objects.get(pk=n)
data['content'] = content
data['content_name'] = content.name
data['content_desc'] = content.desc
data['belong_dept'] = Organization.objects.get(pk=m)
data['task'] = obj
data['end_date'] = obj.end_date
data['create_by'] = request.user
data['state'] = '待发布'
record_list.append(Record(**data))
TaskDept.objects.bulk_create(taskdept_list)
Record.objects.bulk_create(record_list)
obj.state = '待发布'
obj.save()
@ -109,21 +121,50 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
Record.objects.filter(task=obj).update(state='待上报')
return Response(status=status.HTTP_200_OK)
return Response('任务状态错误', status=status.HTTP_400_BAD_REQUEST)
@action(methods=['get'], detail=True, perms_map = {'get':'*'})
def deptall(self, request, *args, **kwargs):
obj = self.get_object()
serializer = TaskDeptSerializer(TaskDept.objects.filter(task=obj).order_by('dept__sort'), many=True)
return Response(serializer.data)
@action(methods=['put'], detail=True, perms_map = {'put':'task_close'})
def close(self, request, *args, **kwargs):
"""
关闭任务
"""
obj = self.get_object()
if obj.state == '执行中':
obj.state = '已关闭'
obj.save()
return Response(status=status.HTTP_200_OK)
return Response('任务状态错误', status=status.HTTP_400_BAD_REQUEST)
def cal_task_rate(task):
def cal_task_rate(task, dept):
"""
计算任务上报率, 确认率
传入任务及公司
"""
objs = Record.objects.filter(task=task)
if objs.exists():
count = objs.count()
up_rate = objs.filter(state__in=['已确认','已上报']).count()/count
confirm_rate = objs.filter(state='已确认').count()/count
task.up_rate = int(up_rate*100)
task.confirm_rate = int(confirm_rate*100)
if task.confirm_rate == 100:
task.state ='已完成'
task.save()
# if objs.exists():
# count = objs.count()
# up_rate = objs.filter(state__in=['已确认','已上报']).count()/count
# confirm_rate = objs.filter(state='已确认').count()/count
# task.up_rate = int(up_rate*100)
# task.confirm_rate = int(confirm_rate*100)
# if task.confirm_rate == 100:
# task.state ='已完成'
# task.save()
objs = Record.objects.filter(task=task).filter(belong_dept=dept)
count = objs.count()
up_rate = objs.filter(state__in=['已确认','已上报']).count()/count
confirm_rate = objs.filter(state='已确认').count()/count
instance = TaskDept.objects.get(task=task,dept=dept)
instance.up_rate = int(up_rate*100)
instance.confirm_rate = int(confirm_rate*100)
instance.save()
from utils.queryset import get_child_queryset2
class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelViewSet):
perms_map = {'get': '*', 'post': 'record_create',
@ -131,9 +172,33 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
queryset = Record.objects.all()
serializer_class = RecordSerializer
search_fields = ['content__name','task__name']
ordering = ['-create_time']
ordering_fields = ['content__sortnum', 'belong_dept__sort']
ordering = ['content__sortnum', '-create_time']
filter_class = RecordFilter # 过滤类
def get_queryset(self):
queryset = self.queryset
if hasattr(self.get_serializer_class(), 'setup_eager_loading'):
queryset = self.get_serializer_class().setup_eager_loading(queryset)
if self.request.user.is_superuser:
pass
if hasattr(queryset.model, 'belong_dept'):
user = self.request.user
roles = user.roles
data_range = roles.values_list('datas', flat=True)
if '全部' in data_range:
pass
elif '本级及以下' in data_range:
belong_depts = get_child_queryset2(user.dept)
queryset = queryset.filter(belong_dept__in = belong_depts)
elif '本级' in data_range:
queryset = queryset.filter(belong_dept = user.dept)
if not self.request.query_params.get('pageoff', None):
queryset = queryset.exclude(state='待发布')
if self.request.query_params.get('only', None) == 'true':
queryset = queryset.filter(belong_dept = user.dept)
return queryset
@action(methods=['get'], detail=False, perms_map = {'get':'*'})
def todos(self, request, *args, **kwargs):
ret={}
@ -151,6 +216,13 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
instance.save()
return Response(status=status.HTTP_200_OK)
@action(methods=['put'], detail=False, perms_map = {'post':'record_update'})
def updates(self, request, *args, **kwargs):
ids = request.data.get('ids')
note = request.data.get('note', None)
Record.objects.filter(pk__in=ids).update(note=note)
return Response(status=status.HTTP_200_OK)
@action(methods=['post'], detail=False, perms_map = {'post':'record_createself'})
def createself(self, request, *args, **kwargs):
contents = request.data['contents']
@ -167,9 +239,11 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
上报
"""
obj = self.get_object()
if obj.task and obj.task.state == '已关闭':
return Response('该任务已关闭,无法上报', status=status.HTTP_400_BAD_REQUEST)
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):
if 'files' in request.data and (not request.data['files']):
if request.data.get('noteb', None) and (not request.data.get('is_yes', True)):
pass
else:
return Response('请上传文件或选择不适用并填写上报说明', status=status.HTTP_400_BAD_REQUEST)
@ -182,7 +256,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
obj.up_date = timezone.now()
obj.save()
if obj.task:
cal_task_rate(obj.task)
cal_task_rate(obj.task, obj.belong_dept)
return Response(status=status.HTTP_200_OK)
return Response('记录状态错误', status=status.HTTP_400_BAD_REQUEST)
@ -198,7 +272,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
obj.state = '待整改'
obj.save()
if obj.task:
cal_task_rate(obj.task)
cal_task_rate(obj.task, obj.belong_dept)
return Response(status=status.HTTP_200_OK)
else:
return Response('请填写备注', status=status.HTTP_400_BAD_REQUEST)
@ -214,7 +288,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
obj.state = '已确认'
obj.save()
if obj.task:
cal_task_rate(obj.task)
cal_task_rate(obj.task, obj.belong_dept)
return Response(status=status.HTTP_200_OK)
return Response('记录状态错误', status=status.HTTP_400_BAD_REQUEST)

View File

@ -0,0 +1,18 @@
# Generated by Django 3.0.5 on 2021-03-30 08:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system', '0008_auto_20210311_0919'),
]
operations = [
migrations.AddField(
model_name='organization',
name='can_supervision',
field=models.BooleanField(default=False, verbose_name='是否可监督'),
),
]

View File

@ -65,6 +65,7 @@ class Organization(SoftModel):
pid = models.ForeignKey('self', null=True, blank=True,
on_delete=models.SET_NULL, verbose_name='')
sort = models.IntegerField('排序', default=1)
can_supervision = models.BooleanField('是否可监督', default=False)
class Meta:
verbose_name = '组织架构'
verbose_name_plural = verbose_name

View File

@ -70,8 +70,7 @@ class OrganizationSerializer(serializers.ModelSerializer):
"""
组织架构序列化
"""
type = serializers.ChoiceField(
choices=Organization.organization_type_choices, default='部门')
type = serializers.ChoiceField(choices=Organization.organization_type_choices, default='部门')
class Meta:
model = Organization

View File

@ -198,7 +198,7 @@ class OrganizationViewSet(PageOrNot,ModelViewSet):
serializer_class = OrganizationSerializer
pagination_class = None
search_fields = ['name']
filterset_fields = ['pid','name']
filterset_fields = ['pid','name', 'type','can_supervision']
ordering_fields = ['sort']
ordering = ['sort', 'pk']