YF-yuan 3 lat temu
rodzic
commit
2fe7f9b377
2 zmienionych plików z 111 dodań i 34 usunięć
  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 Wyświetl plik

<el-table-column label="牵头部门" align="center" width="180"> <el-table-column label="牵头部门" align="center" width="180">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<treeselect <treeselect
@input="changePrincipal($event, 'leader')"
v-if="row.edit || row.add" v-if="row.edit || row.add"
v-model="form.leaderDept" v-model="form.leaderDept"
:options="formatDep" :options="formatDep"
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<treeselect <treeselect
v-if="row.edit || row.add" v-if="row.edit || row.add"
@input="changePrincipal($event, 'other')"
:multiple="true" :multiple="true"
v-model="form.leaderDept"
v-model="form.otherDept"
:options="formatDep" :options="formatDep"
placeholder="请选择其他牵头部门" placeholder="请选择其他牵头部门"
:defaultExpandLevel="1" :defaultExpandLevel="1"
:disabled="true" :disabled="true"
v-if="row.edit || row.add" v-if="row.edit || row.add"
:multiple="true" :multiple="true"
v-model="form.leaderPrincipal"
v-model="form.otherPrincipal"
:options="principalList" :options="principalList"
placeholder="请选择牵头部门责任领导" placeholder="请选择牵头部门责任领导"
:defaultExpandLevel="1" :defaultExpandLevel="1"
<el-table-column label="配合部门" align="center" width="180"> <el-table-column label="配合部门" align="center" width="180">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<treeselect <treeselect
@input="changePrincipal($event, 'cooperate')"
v-if="row.edit || row.add" v-if="row.edit || row.add"
:multiple="true" :multiple="true"
v-model="form.cooperateDept" v-model="form.cooperateDept"
}; };
}, },
computed: { computed: {
...mapGetters(["formatDep", "principalList"]),
...mapGetters(["formatDep", "principalList", "department"]),
detailList() { detailList() {
let that = this; let that = this;
return this.data[map[this.type]]; return this.data[map[this.type]];
}, },
}, },
methods: { 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() { getApi() {
switch (parseInt(this.type)) { switch (parseInt(this.type)) {
case 1: case 1:
let form = JSON.parse( let form = JSON.parse(
JSON.stringify(this.data[map[this.type]][index]) 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(",") .split(",")
.map((item) => parseInt(item)); .map((item) => parseInt(item));
form.cooperateDept = form.cooperateDept
// form.leaderPrincipal = form.leaderPrincipal
// .split(",")
// .map((item) => parseInt(item));
form.cooperatePrincipal = form.cooperatePrincipal
.split(",") .split(",")
.map((item) => parseInt(item)); .map((item) => parseInt(item));
form.leaderPrincipal = form.leaderPrincipal
form.otherDept = form.otherDept
.split(",") .split(",")
.map((item) => parseInt(item)); .map((item) => parseInt(item));
form.cooperatePrincipal = form.cooperatePrincipal
form.otherPrincipal = form.otherPrincipal
.split(",") .split(",")
.map((item) => parseInt(item)); .map((item) => parseInt(item));
console.log(form);
this.form = form; this.form = form;
this.$set(this.data[map[this.type]][index], "edit", true); this.$set(this.data[map[this.type]][index], "edit", true);
} }
this.reducing=true
}else{
this.reducing = true;
} else {
this.$message({ this.$message({
type:"warning",
message:"请先完成当前操作"
})
type: "warning",
message: "请先完成当前操作",
});
} }
}, },
close() { close() {
this.allLoading = true; this.allLoading = true;
let form = this.form; let form = this.form;
form.cooperateDept = form.cooperateDept && form.cooperateDept.join(","); 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 && form.cooperatePrincipal.join(","); form.cooperatePrincipal && form.cooperatePrincipal.join(",");
form.otherDept = form.otherDept && form.otherDept.join(",");
form.otherPrincipal =
form.otherPrincipal && form.otherPrincipal.join(",");
if (data.edit) { if (data.edit) {
this.getApi() this.getApi()
.editItem(form) .editItem(form)
this.$message.error("修改小项内容失败"); this.$message.error("修改小项内容失败");
}) })
.finally(() => { .finally(() => {
this.reducing=false
this.reducing = false;
this.allLoading = false; this.allLoading = false;
this.form = {}; this.form = {};
}); });
.finally(() => { .finally(() => {
this.allLoading = false; this.allLoading = false;
this.form = {}; this.form = {};
this.reducing=false
this.reducing = false;
}); });
} }
}, },

+ 40
- 17
src/views/second/taskSummary/reward.vue Wyświetl plik

<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="请选择配合部门"
}, },
}, },
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) => {
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) { addDept(type) {

Ładowanie…
Anuluj
Zapisz