Browse Source

xiugai1

master
yangzhou-cyber 3 years ago
parent
commit
0832a917da
3 changed files with 77 additions and 37 deletions
  1. +39
    -17
      src/views/second/taskSummary/basicTable.vue
  2. +37
    -17
      src/views/second/taskSummary/constraint.vue
  3. +1
    -3
      src/views/second/taskSummary/reward.vue

+ 39
- 17
src/views/second/taskSummary/basicTable.vue View File

@@ -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',index)"
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,44 @@ 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) => {
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 == id) {
nameId = item.principal;
return;
}
});
this.$set(this.form, "leaderPrincipal", nameId&&parseInt(nameId));
}
},
addDept(type) {

+ 37
- 17
src/views/second/taskSummary/constraint.vue View File

@@ -138,7 +138,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="请选择牵头部门"
@@ -198,7 +198,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="请选择其他牵头部门"
@@ -260,7 +260,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="请选择配合部门"
@@ -358,7 +358,7 @@ export default {
this.$store.dispatch("base/getPrincipalList");
},
computed: {
...mapGetters(["formatDep", "principalList"]),
...mapGetters(["formatDep", "principalList", "department"]),
},
filters: {
formatList(val) {
@@ -368,22 +368,44 @@ export default {
},
},
methods: {
changePrincipal(e, type, index) {
let nameId;
this.department.forEach((item) => {
if (item.id == e.id) {
nameId = item.principal;
return;
}
});
changePrincipal(e, type) {
if (type == "other") {
this.$set(this.form.otherPrincipal, index, parseInt(nameId));
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));
let eventId = e.id;
let depts = this.form.cooperateDept;
let nameIds = [];
depts.forEach((dept) => {
this.department.forEach((item) => {
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));
let nameId;
let id = this.form.leaderDept;
this.department.forEach((item) => {
if (item.id == id) {
nameId = item.principal;
return;
}
});
this.$set(this.form, "leaderPrincipal", nameId&&parseInt(nameId));
}
},
addDept(type) {
@@ -397,7 +419,6 @@ export default {
}
},
deleteDept(index, type) {
console.log(index, type);
if (type == "other") {
this.form.otherDept.splice(index, 1);
this.form.otherPrincipal.splice(index, 1);
@@ -458,7 +479,6 @@ export default {
save() {
this.loading=true;
let form = JSON.parse(JSON.stringify(this.form));
console.log(form);
form.cooperateDept = form.cooperateDept && form.cooperateDept.join(",");
form.cooperatePrincipal =
form.cooperatePrincipal && form.cooperatePrincipal.join(",");

+ 1
- 3
src/views/second/taskSummary/reward.vue View File

@@ -396,7 +396,6 @@ export default {
let nameIds = [];
depts.forEach((dept) => {
this.department.forEach((item) => {
console.log(item, dept);
if (item.id == dept) {
nameIds.push(parseInt(item.principal));
}
@@ -413,7 +412,7 @@ export default {
return;
}
});
this.$set(this.form, "leaderPrincipal", parseInt(nameId));
this.$set(this.form, "leaderPrincipal", nameId&&parseInt(nameId));
}
},
addDept(type) {
@@ -427,7 +426,6 @@ export default {
}
},
deleteDept(index, type) {
console.log(index, type);
if (type == "other") {
this.form.otherDept.splice(index, 1);
this.form.otherPrincipal.splice(index, 1);

Loading…
Cancel
Save