瀏覽代碼

合并

master
YF-yuan 3 年之前
父節點
當前提交
2fe7f9b377
共有 2 個文件被更改,包括 111 次插入34 次删除
  1. +71
    -17
      src/views/second/segmentation/contentDetail.vue
  2. +40
    -17
      src/views/second/taskSummary/reward.vue

+ 71
- 17
src/views/second/segmentation/contentDetail.vue 查看文件

@@ -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;
});
}
},

+ 40
- 17
src/views/second/taskSummary/reward.vue 查看文件

@@ -146,7 +146,7 @@
<el-col :span="4" class="title"> 牵头部门: </el-col>
<el-col :span="7">
<treeselect
@select="changePrincipal($event, 'leader')"
@input="changePrincipal($event, 'leader')"
v-model="form.leaderDept"
:options="formatDep"
placeholder="请选择牵头部门"
@@ -206,7 +206,7 @@
<el-col :span="4" class="title"> 其他牵头部门: </el-col>
<el-col :span="7">
<treeselect
@select="changePrincipal($event, 'other',index)"
@input="changePrincipal($event, 'other')"
v-model="form.otherDept[index]"
:options="formatDep"
placeholder="请选择其他牵头部门"
@@ -268,7 +268,7 @@
<el-col :span="4" class="title">配合部门: </el-col>
<el-col :span="7">
<treeselect
@select="changePrincipal($event, 'cooperate',index)"
@input="changePrincipal($event, 'cooperate')"
v-model="form.cooperateDept[index]"
:options="formatDep"
placeholder="请选择配合部门"
@@ -378,22 +378,45 @@ export default {
},
},
methods: {
changePrincipal(e, type,index) {
let nameId;
this.department.forEach(item=>{
if(item.id==e.id){
nameId=item.principal;
return;
}
})
if(type=="other"){
this.$set(this.form.otherPrincipal,index,parseInt(nameId))
changePrincipal(e, type, index) {
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"){
this.$set(this.form.cooperatePrincipal,index,parseInt(nameId))
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'){
this.$set(this.form,'leaderPrincipal',parseInt(nameId))
if (type == "leader") {
let nameId;
let id = this.form.leaderDept;
this.department.forEach((item) => {
if (item.id == e.id) {
nameId = item.principal;
return;
}
});
this.$set(this.form, "leaderPrincipal", parseInt(nameId));
}
},
addDept(type) {

Loading…
取消
儲存