This commit is contained in:
shilixia 2021-04-13 10:52:33 +08:00
parent f99669e999
commit cb9ff64b0e
4 changed files with 258 additions and 163 deletions

View File

@ -44,6 +44,13 @@
<el-table-column label="任务名"> <el-table-column label="任务名">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="执行单位">
<template slot-scope="scope">{{ scope.row.dept_count }}</template>
</el-table-column>
<el-table-column label="子任务数">
<template slot-scope="scope">{{ scope.row.subtask_count }}</template>
</el-table-column>
<el-table-column label="巡查开始日期"> <el-table-column label="巡查开始日期">
<template slot-scope="scope">{{ scope.row.start_date }}</template> <template slot-scope="scope">{{ scope.row.start_date }}</template>
</el-table-column> </el-table-column>

View File

@ -45,19 +45,18 @@
<el-card style="margin-top: 2px"> <el-card style="margin-top: 2px">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>子任务列表</span> <el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>创建子任务</el-button
>
</div> </div>
<el-table <el-table
v-loading="listLoading2"
:data="recordList"
border border
fit fit
stripe stripe
highlight-current-row highlight-current-row
max-height="400px" max-height="400px"
style="margin-top:2px" style="margin-top:2px"
@selection-change="handleSelectRecords"
> >
<el-table-column type="selection" align="center" width="55" /> <el-table-column type="selection" align="center" width="55" />
<el-table-column label="序号" type="index" align="center" width="55" /> <el-table-column label="序号" type="index" align="center" width="55" />
@ -125,52 +124,7 @@
fixed="right" fixed="right"
> >
<template slot-scope="scope"> <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 <el-link
v-if="checkPermission(['record_delete'])" v-if="checkPermission(['record_delete'])"
type="danger" type="danger"
@ -182,27 +136,64 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
<el-dialog <el-dialog
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:title="dgaction.name" :title="dialogType === 'edit' ? '编辑任务' : '新增任务'"
>
<el-form
ref="Form"
:model="inspecttask"
label-width="80px"
label-position="right"
>
<el-form-item label="子任务名" prop="name">
<el-input v-model="inspecttask.name" placeholder="子任务名" />
</el-form-item>
<el-form-item label="选择组长" prop="leader">
<el-cascader
v-model="inspecttask.leader"
:options="typeOptions"
:props="{ emitPath: false }"
clearable
style="width: 100%"
></el-cascader>
</el-form-item>
<el-form-item label="选择组员" prop="member">
<el-input v-model="inspecttask.member" placeholder="选择组员" >
<el-button icon="el-icon-search" slot="append" @click="Createmember"></el-button>
</el-input>
</el-form-item>
<el-form-item label="选择组织" prop="leader">
<el-input v-model="inspecttask.leader" placeholder="选择组织" >
<el-button icon="el-icon-search" slot="append" @click="CreatOrg"></el-button>
</el-input>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
<!--组织弹框-->
<el-dialog
:visible.sync="dialogVisibles"
:title="选择组织"
:close-on-click-modal="false" :close-on-click-modal="false"
width="70%" width="70%"
> >
<taskinit ref="taskinit" @handleChose="chooseComplete" ></taskinit> <orginit ref="leaderinit" @handleChose="chooseComplete" ></orginit>
</el-dialog> </el-dialog>
<el-drawer <!--人员弹框-->
title="记录" <el-dialog
:visible.sync="drawer" :visible.sync="dialogVisibless"
:with-header="false" :title="选择组织"
size="40%" :close-on-click-modal="false"
width="70%"
> >
<recorddo <leaderinit ref="leaderinit" @handleChose="chooseComplete" ></leaderinit>
ref="recorddo" </el-dialog>
:data="data"
@handleDo="handleDo"
v-if="drawer"
></recorddo>
</el-drawer>
</div> </div>
</template> </template>
<style > <style >
@ -225,130 +216,101 @@
</style> </style>
<script> <script>
import { getinspecttask, initinspecttask, appendinspecttask } from "@/api/inspectTask"; import { getinspecttask, initinspecttask, appendinspecttask } from "@/api/inspectTask";
import { getRecordList, updateRecords } from "@/api/record"; import orginit from "@/views/qualityinspect/orginit";
import leaderinit from "@/views/qualityinspect/leaderinit";
import {
getUserList
} from "@/api/user";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
import taskinit from "@/views/supervision/taskinit";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import recorddo from "@/views/supervision/recorddo";
const defaulttask = {
name: "",
};
export default { export default {
components: { Pagination, taskinit, recorddo }, components: { Pagination,orginit,leaderinit},
data() { data() {
return { return {
task: { id: 0 }, task: { id: 0 },
dialogVisibles: false,
dialogVisibless: false,
inspecttask: defaulttask,
dialogVisible: false, dialogVisible: false,
activeName: "contenttab", listLoading: true,
contents: [], typeOptions:[],
depts: [], dialogVisible: false,
listLoading: false, dialogType: "new",
listLoading2: false,
recordList: [],
nowcontent: {},
nowdept: {},
drawer: false,
data: {}, data: {},
taskdeptall: [],
listQuery:{}, listQuery:{},
selectRecords:[],
dgaction:{
action:'init',
name:'初始化任务'
}
}; };
}, },
created() { created() {
this.task.id = this.$route.params.id; this.task.id = this.$route.params.id;
this.getinspecttask(); this.getinspecttask();
this.getTypeAll();
}, },
methods: { methods: {
checkPermission, checkPermission,
getinspecttask() { getinspecttask() {
getinspecttask(this.task.id).then((res) => { getinspecttask(this.task.id).then((res) => {
this.task = res.data; this.task = res.data;
if (this.task.state == "创建中") {
this.dialogVisible = true; });
} },
getTypeAll() {
getUserList().then((res) => {
this.typeOptions = genTree(res.data.results);
}); });
}, },
Createmember()
chooseComplete(data) { {
this.dialogVisible = false;
if(this.dgaction.action == 'init'){ this.dialogVisibless = true;
const rLoading = this.openLoading("正在初始化任务,请稍等..."); },
initinspecttask(this.task.id, data).then((res) => { CreatOrg()
rLoading.close(); {
this.$message.success("成功"); this.dialogVisibles = true;
this.$router.go(0);
}).catch(e=>{rLoading.close();});
}else if(this.dgaction.action == 'append'){
const rLoading = this.openLoading("正在追加任务,请稍等...");
appendinspecttask(this.task.id, data).then((res) => {
rLoading.close();
this.$message.success("成功");
this.$router.go(0);
}).catch(e=>{rLoading.close();});
}
}, },
starttask() { handleCreate() {
this.$confirm("确认发布任务吗?", "提示") this.inspecttask = Object.assign({}, defaulttask);
.then(async () => { this.dialogType = "new";
await starttask(this.task.id); this.dialogVisible = true;
location.reload(); this.$nextTick(() => {
this.$message.success("成功"); this.$refs["Form"].clearValidate();
}) });
.catch((err) => {
console.error(err);
});
}, },
handleRecord(data) { async confirm(form) {
this.data = data; this.$refs[form].validate((valid) => {
this.drawer = true; if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateinspecttask(this.inspecttask.id, this.inspecttask).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createinspecttask(this.inspecttask).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
// this.$router.push({name: "Taskdo", params: { id: res.data.id }, })
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
}, },
handleDo(data) {
this.drawer = false;
this.gettask();
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> </script>

View File

@ -0,0 +1,63 @@
<template>
<div>
<div style="margin-top:6px">
<el-transfer
v-model="depts"
:data="userOptions"
:titles="['组员列表', '选择的组员']"
:props="{ key : 'id' , label: 'name' }"
>
<span slot-scope="{ option }">{{ option.sort }} - {{ option.name }}</span>
</el-transfer>
</div>
<div style="text-align: right">
<el-button type="primary" @click="confirm()">确认</el-button>
</div>
</div>
</template>
<style lang="scss">
.el-transfer-panel {
width: 470px;
}
.el-transfer__buttons {
padding: 0 2px;
.el-button {
display: block;
}
}
</style>
<script>
import { getUserList } from "@/api/user";
export default {
name: "leaderinit",
data() {
return {
depts: [],
userOptions: [],
};
},
created() {
this.getUserList();
},
methods: {
getUserList() {
getUserList().then((res) => {
this.userOptions = res.data.results;
});
},
confirm(){
if( this.depts.length>0){
var data = {
depts:this.depts
}
this.$emit('handleChose', data)
}else{
this.$message.error('请选择单位!')
}
}
},
};
</script>

View File

@ -0,0 +1,63 @@
<template>
<div>
<div style="margin-top:6px">
<el-transfer
v-model="depts"
:data="deptOptions"
:titles="['单位列表', '选择的单位']"
:props="{ key : 'id' , label: 'name' }"
>
<span slot-scope="{ option }">{{ option.sort }} - {{ option.name }}</span>
</el-transfer>
</div>
<div style="text-align: right">
<el-button type="primary" @click="confirm()">确认</el-button>
</div>
</div>
</template>
<style lang="scss">
.el-transfer-panel {
width: 470px;
}
.el-transfer__buttons {
padding: 0 2px;
.el-button {
display: block;
}
}
</style>
<script>
import { getOrgList } from "@/api/org";
export default {
name: "leaderinit",
data() {
return {
depts: [],
deptOptions: [],
};
},
created() {
this.getOrgList();
},
methods: {
getOrgList() {
getOrgList({can_supervision:true}).then((res) => {
this.deptOptions = res.data;
});
},
confirm(){
if( this.depts.length>0){
var data = {
depts:this.depts
}
this.$emit('handleChose', data)
}else{
this.$message.error('请选择单位!')
}
}
},
};
</script>