|
|
@@ -137,6 +137,7 @@ |
|
|
|
<el-table-column label="牵头部门" align="center" width="180"> |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<treeselect |
|
|
|
@input="changePrincipal($event, 'leader')" |
|
|
|
v-if="row.edit || row.add" |
|
|
|
v-model="form.leaderDept" |
|
|
|
:options="formatDep" |
|
|
@@ -191,8 +192,9 @@ |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<treeselect |
|
|
|
v-if="row.edit || row.add" |
|
|
|
@input="changePrincipal($event, 'other')" |
|
|
|
:multiple="true" |
|
|
|
v-model="form.leaderDept" |
|
|
|
v-model="form.otherDept" |
|
|
|
:options="formatDep" |
|
|
|
placeholder="请选择其他牵头部门" |
|
|
|
:defaultExpandLevel="1" |
|
|
@@ -220,7 +222,7 @@ |
|
|
|
:disabled="true" |
|
|
|
v-if="row.edit || row.add" |
|
|
|
:multiple="true" |
|
|
|
v-model="form.leaderPrincipal" |
|
|
|
v-model="form.otherPrincipal" |
|
|
|
:options="principalList" |
|
|
|
placeholder="请选择牵头部门责任领导" |
|
|
|
:defaultExpandLevel="1" |
|
|
@@ -245,6 +247,7 @@ |
|
|
|
<el-table-column label="配合部门" align="center" width="180"> |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<treeselect |
|
|
|
@input="changePrincipal($event, 'cooperate')" |
|
|
|
v-if="row.edit || row.add" |
|
|
|
:multiple="true" |
|
|
|
v-model="form.cooperateDept" |
|
|
@@ -376,7 +379,7 @@ export default { |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...mapGetters(["formatDep", "principalList"]), |
|
|
|
...mapGetters(["formatDep", "principalList", "department"]), |
|
|
|
detailList() { |
|
|
|
let that = this; |
|
|
|
return this.data[map[this.type]]; |
|
|
@@ -395,6 +398,47 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
changePrincipal(e, type) { |
|
|
|
if (type == "other") { |
|
|
|
let eventId = e.id; |
|
|
|
let depts = this.form.otherDept; |
|
|
|
|
|
|
|
let nameIds = []; |
|
|
|
depts.forEach((dept) => { |
|
|
|
this.department.forEach((item) => { |
|
|
|
if (item.id == dept) { |
|
|
|
nameIds.push(parseInt(item.principal)); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.$set(this.form, "otherPrincipal", nameIds); |
|
|
|
} |
|
|
|
if (type == "cooperate") { |
|
|
|
let eventId = e.id; |
|
|
|
let depts = this.form.cooperateDept; |
|
|
|
let nameIds = []; |
|
|
|
depts.forEach((dept) => { |
|
|
|
this.department.forEach((item) => { |
|
|
|
console.log(item, dept); |
|
|
|
if (item.id == dept) { |
|
|
|
nameIds.push(parseInt(item.principal)); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.$set(this.form, "cooperatePrincipal", nameIds); |
|
|
|
} |
|
|
|
if (type == "leader") { |
|
|
|
let nameId; |
|
|
|
let id=this.form.leaderDept; |
|
|
|
this.department.forEach((item) => { |
|
|
|
if (item.id == id) { |
|
|
|
nameId = item.principal; |
|
|
|
return; |
|
|
|
} |
|
|
|
}); |
|
|
|
this.$set(this.form, "leaderPrincipal", parseInt(nameId)); |
|
|
|
} |
|
|
|
}, |
|
|
|
getApi() { |
|
|
|
switch (parseInt(this.type)) { |
|
|
|
case 1: |
|
|
@@ -442,27 +486,34 @@ export default { |
|
|
|
let form = JSON.parse( |
|
|
|
JSON.stringify(this.data[map[this.type]][index]) |
|
|
|
); |
|
|
|
form.leaderDept = form.leaderDept |
|
|
|
// form.leaderDept = form.leaderDept |
|
|
|
// .split(",") |
|
|
|
// .map((item) => parseInt(item)); |
|
|
|
form.cooperateDept = form.cooperateDept |
|
|
|
.split(",") |
|
|
|
.map((item) => parseInt(item)); |
|
|
|
form.cooperateDept = form.cooperateDept |
|
|
|
// form.leaderPrincipal = form.leaderPrincipal |
|
|
|
// .split(",") |
|
|
|
// .map((item) => parseInt(item)); |
|
|
|
form.cooperatePrincipal = form.cooperatePrincipal |
|
|
|
.split(",") |
|
|
|
.map((item) => parseInt(item)); |
|
|
|
form.leaderPrincipal = form.leaderPrincipal |
|
|
|
form.otherDept = form.otherDept |
|
|
|
.split(",") |
|
|
|
.map((item) => parseInt(item)); |
|
|
|
form.cooperatePrincipal = form.cooperatePrincipal |
|
|
|
form.otherPrincipal = form.otherPrincipal |
|
|
|
.split(",") |
|
|
|
.map((item) => parseInt(item)); |
|
|
|
console.log(form); |
|
|
|
this.form = form; |
|
|
|
this.$set(this.data[map[this.type]][index], "edit", true); |
|
|
|
} |
|
|
|
this.reducing=true |
|
|
|
}else{ |
|
|
|
this.reducing = true; |
|
|
|
} else { |
|
|
|
this.$message({ |
|
|
|
type:"warning", |
|
|
|
message:"请先完成当前操作" |
|
|
|
}) |
|
|
|
type: "warning", |
|
|
|
message: "请先完成当前操作", |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
close() { |
|
|
@@ -472,11 +523,14 @@ export default { |
|
|
|
this.allLoading = true; |
|
|
|
let form = this.form; |
|
|
|
form.cooperateDept = form.cooperateDept && form.cooperateDept.join(","); |
|
|
|
form.leaderDept = form.leaderDept && form.leaderDept.join(","); |
|
|
|
form.leaderPrincipal = |
|
|
|
form.leaderPrincipal && form.leaderPrincipal.join(","); |
|
|
|
// form.leaderDept = form.leaderDept && form.leaderDept.join(","); |
|
|
|
// form.leaderPrincipal = |
|
|
|
// form.leaderPrincipal && form.leaderPrincipal.join(","); |
|
|
|
form.cooperatePrincipal = |
|
|
|
form.cooperatePrincipal && form.cooperatePrincipal.join(","); |
|
|
|
form.otherDept = form.otherDept && form.otherDept.join(","); |
|
|
|
form.otherPrincipal = |
|
|
|
form.otherPrincipal && form.otherPrincipal.join(","); |
|
|
|
if (data.edit) { |
|
|
|
this.getApi() |
|
|
|
.editItem(form) |
|
|
@@ -491,7 +545,7 @@ export default { |
|
|
|
this.$message.error("修改小项内容失败"); |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
this.reducing=false |
|
|
|
this.reducing = false; |
|
|
|
this.allLoading = false; |
|
|
|
this.form = {}; |
|
|
|
}); |
|
|
@@ -529,7 +583,7 @@ export default { |
|
|
|
.finally(() => { |
|
|
|
this.allLoading = false; |
|
|
|
this.form = {}; |
|
|
|
this.reducing=false |
|
|
|
this.reducing = false; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |