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

<el-col :span="4" class="title"> 牵头部门: </el-col> <el-col :span="4" class="title"> 牵头部门: </el-col>
<el-col :span="7"> <el-col :span="7">
<treeselect <treeselect
@select="changePrincipal($event, 'leader')"
@input="changePrincipal($event, 'leader')"
v-model="form.leaderDept" v-model="form.leaderDept"
:options="formatDep" :options="formatDep"
placeholder="请选择牵头部门" placeholder="请选择牵头部门"
<el-col :span="4" class="title"> 其他牵头部门: </el-col> <el-col :span="4" class="title"> 其他牵头部门: </el-col>
<el-col :span="7"> <el-col :span="7">
<treeselect <treeselect
@select="changePrincipal($event, 'other',index)"
@input="changePrincipal($event, 'other',index)"
v-model="form.otherDept[index]" v-model="form.otherDept[index]"
:options="formatDep" :options="formatDep"
placeholder="请选择其他牵头部门" placeholder="请选择其他牵头部门"
<el-col :span="4" class="title">配合部门: </el-col> <el-col :span="4" class="title">配合部门: </el-col>
<el-col :span="7"> <el-col :span="7">
<treeselect <treeselect
@select="changePrincipal($event, 'cooperate',index)"
@input="changePrincipal($event, 'cooperate')"
v-model="form.cooperateDept[index]" v-model="form.cooperateDept[index]"
:options="formatDep" :options="formatDep"
placeholder="请选择配合部门" placeholder="请选择配合部门"
}, },
}, },
methods: { 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) { addDept(type) {

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

<el-col :span="4" class="title"> 牵头部门: </el-col> <el-col :span="4" class="title"> 牵头部门: </el-col>
<el-col :span="7"> <el-col :span="7">
<treeselect <treeselect
@select="changePrincipal($event, 'leader')"
@input="changePrincipal($event, 'leader')"
v-model="form.leaderDept" v-model="form.leaderDept"
:options="formatDep" :options="formatDep"
placeholder="请选择牵头部门" placeholder="请选择牵头部门"
<el-col :span="4" class="title"> 其他牵头部门: </el-col> <el-col :span="4" class="title"> 其他牵头部门: </el-col>
<el-col :span="7"> <el-col :span="7">
<treeselect <treeselect
@select="changePrincipal($event, 'other', index)"
@input="changePrincipal($event, 'other')"
v-model="form.otherDept[index]" v-model="form.otherDept[index]"
:options="formatDep" :options="formatDep"
placeholder="请选择其他牵头部门" placeholder="请选择其他牵头部门"
<el-col :span="4" class="title">配合部门: </el-col> <el-col :span="4" class="title">配合部门: </el-col>
<el-col :span="7"> <el-col :span="7">
<treeselect <treeselect
@select="changePrincipal($event, 'cooperate', index)"
@input="changePrincipal($event, 'cooperate')"
v-model="form.cooperateDept[index]" v-model="form.cooperateDept[index]"
:options="formatDep" :options="formatDep"
placeholder="请选择配合部门" placeholder="请选择配合部门"
this.$store.dispatch("base/getPrincipalList"); this.$store.dispatch("base/getPrincipalList");
}, },
computed: { computed: {
...mapGetters(["formatDep", "principalList"]),
...mapGetters(["formatDep", "principalList", "department"]),
}, },
filters: { filters: {
formatList(val) { formatList(val) {
}, },
}, },
methods: { 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") { 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") { 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") { 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) { addDept(type) {
} }
}, },
deleteDept(index, type) { deleteDept(index, type) {
console.log(index, type);
if (type == "other") { if (type == "other") {
this.form.otherDept.splice(index, 1); this.form.otherDept.splice(index, 1);
this.form.otherPrincipal.splice(index, 1); this.form.otherPrincipal.splice(index, 1);
save() { save() {
this.loading=true; this.loading=true;
let form = JSON.parse(JSON.stringify(this.form)); let form = JSON.parse(JSON.stringify(this.form));
console.log(form);
form.cooperateDept = form.cooperateDept && form.cooperateDept.join(","); form.cooperateDept = form.cooperateDept && form.cooperateDept.join(",");
form.cooperatePrincipal = form.cooperatePrincipal =
form.cooperatePrincipal && form.cooperatePrincipal.join(","); form.cooperatePrincipal && form.cooperatePrincipal.join(",");

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

let nameIds = []; let nameIds = [];
depts.forEach((dept) => { depts.forEach((dept) => {
this.department.forEach((item) => { this.department.forEach((item) => {
console.log(item, dept);
if (item.id == dept) { if (item.id == dept) {
nameIds.push(parseInt(item.principal)); nameIds.push(parseInt(item.principal));
} }
return; return;
} }
}); });
this.$set(this.form, "leaderPrincipal", parseInt(nameId));
this.$set(this.form, "leaderPrincipal", nameId&&parseInt(nameId));
} }
}, },
addDept(type) { addDept(type) {
} }
}, },
deleteDept(index, type) { deleteDept(index, type) {
console.log(index, type);
if (type == "other") { if (type == "other") {
this.form.otherDept.splice(index, 1); this.form.otherDept.splice(index, 1);
this.form.otherPrincipal.splice(index, 1); this.form.otherPrincipal.splice(index, 1);

Loading…
Cancel
Save