yonghu
This commit is contained in:
parent
f99669e999
commit
cb9ff64b0e
|
@ -44,6 +44,13 @@
|
|||
<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.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="巡查开始日期">
|
||||
<template slot-scope="scope">{{ scope.row.start_date }}</template>
|
||||
</el-table-column>
|
||||
|
|
|
@ -45,19 +45,18 @@
|
|||
|
||||
<el-card style="margin-top: 2px">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>子任务列表</span>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||
>创建子任务</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" />
|
||||
|
@ -125,52 +124,7 @@
|
|||
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"
|
||||
|
@ -182,27 +136,64 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<el-dialog
|
||||
<el-dialog
|
||||
: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"
|
||||
width="70%"
|
||||
>
|
||||
<taskinit ref="taskinit" @handleChose="chooseComplete" ></taskinit>
|
||||
<orginit ref="leaderinit" @handleChose="chooseComplete" ></orginit>
|
||||
</el-dialog>
|
||||
<el-drawer
|
||||
title="记录"
|
||||
:visible.sync="drawer"
|
||||
:with-header="false"
|
||||
size="40%"
|
||||
<!--人员弹框-->
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisibless"
|
||||
:title="选择组织"
|
||||
:close-on-click-modal="false"
|
||||
width="70%"
|
||||
>
|
||||
<recorddo
|
||||
ref="recorddo"
|
||||
:data="data"
|
||||
@handleDo="handleDo"
|
||||
v-if="drawer"
|
||||
></recorddo>
|
||||
</el-drawer>
|
||||
<leaderinit ref="leaderinit" @handleChose="chooseComplete" ></leaderinit>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<style >
|
||||
|
@ -225,130 +216,101 @@
|
|||
</style>
|
||||
<script>
|
||||
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 taskinit from "@/views/supervision/taskinit";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import recorddo from "@/views/supervision/recorddo";
|
||||
|
||||
const defaulttask = {
|
||||
name: "",
|
||||
};
|
||||
export default {
|
||||
components: { Pagination, taskinit, recorddo },
|
||||
components: { Pagination,orginit,leaderinit},
|
||||
|
||||
data() {
|
||||
return {
|
||||
task: { id: 0 },
|
||||
|
||||
dialogVisibles: false,
|
||||
dialogVisibless: false,
|
||||
inspecttask: defaulttask,
|
||||
dialogVisible: false,
|
||||
activeName: "contenttab",
|
||||
contents: [],
|
||||
depts: [],
|
||||
listLoading: false,
|
||||
listLoading2: false,
|
||||
recordList: [],
|
||||
nowcontent: {},
|
||||
nowdept: {},
|
||||
drawer: false,
|
||||
listLoading: true,
|
||||
typeOptions:[],
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
data: {},
|
||||
taskdeptall: [],
|
||||
listQuery:{},
|
||||
selectRecords:[],
|
||||
dgaction:{
|
||||
action:'init',
|
||||
name:'初始化任务'
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.task.id = this.$route.params.id;
|
||||
this.getinspecttask();
|
||||
this.getTypeAll();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
getinspecttask() {
|
||||
getinspecttask(this.task.id).then((res) => {
|
||||
this.task = res.data;
|
||||
if (this.task.state == "创建中") {
|
||||
this.dialogVisible = true;
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
getTypeAll() {
|
||||
getUserList().then((res) => {
|
||||
this.typeOptions = genTree(res.data.results);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
chooseComplete(data) {
|
||||
this.dialogVisible = false;
|
||||
if(this.dgaction.action == 'init'){
|
||||
const rLoading = this.openLoading("正在初始化任务,请稍等...");
|
||||
initinspecttask(this.task.id, data).then((res) => {
|
||||
rLoading.close();
|
||||
this.$message.success("成功");
|
||||
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();});
|
||||
}
|
||||
|
||||
Createmember()
|
||||
{
|
||||
|
||||
this.dialogVisibless = true;
|
||||
},
|
||||
CreatOrg()
|
||||
{
|
||||
this.dialogVisibles = true;
|
||||
},
|
||||
starttask() {
|
||||
this.$confirm("确认发布任务吗?", "提示")
|
||||
.then(async () => {
|
||||
await starttask(this.task.id);
|
||||
location.reload();
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
handleCreate() {
|
||||
this.inspecttask = Object.assign({}, defaulttask);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleRecord(data) {
|
||||
this.data = data;
|
||||
this.drawer = true;
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
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>
|
|
@ -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>
|
|
@ -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>
|
Loading…
Reference in New Issue