@@ -145,6 +145,7 @@ | |||
<el-col :span="4" class="title"> 牵头部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
@select="changePrincipal($event, 'leader')" | |||
v-model="form.leaderDept" | |||
:options="formatDep" | |||
placeholder="请选择牵头部门" | |||
@@ -185,7 +186,7 @@ | |||
/> | |||
</el-col> | |||
</el-row> | |||
<div class="leader"> | |||
<div class="leader"> | |||
<span | |||
class="el-icon-circle-plus-outline add" | |||
@click="addDept('other')" | |||
@@ -204,7 +205,7 @@ | |||
<el-col :span="4" class="title"> 其他牵头部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
@change="changePrincipal" | |||
@select="changePrincipal($event, 'other',index)" | |||
v-model="form.otherDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择其他牵头部门" | |||
@@ -266,6 +267,7 @@ | |||
<el-col :span="4" class="title">配合部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
@select="changePrincipal($event, 'cooperate',index)" | |||
v-model="form.cooperateDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择配合部门" | |||
@@ -289,7 +291,7 @@ | |||
<treeselect | |||
v-model="form.cooperatePrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择牵头部门责任领导" | |||
placeholder="请选择配合部门责任领导" | |||
:defaultExpandLevel="1" | |||
:normalizer=" | |||
(d) => { | |||
@@ -375,8 +377,23 @@ export default { | |||
}, | |||
}, | |||
methods: { | |||
changePrincipal(){ | |||
console.log(this.department) | |||
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)) | |||
} | |||
if(type=="cooperate"){ | |||
this.$set(this.form.cooperatePrincipal,index,parseInt(nameId)) | |||
} | |||
if(type=='leader'){ | |||
this.$set(this.form,'leaderPrincipal',parseInt(nameId)) | |||
} | |||
}, | |||
addDept(type) { | |||
if (type == "other") { | |||
@@ -389,7 +406,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); | |||
@@ -449,7 +465,6 @@ export default { | |||
}, | |||
save() { | |||
let form = JSON.parse(JSON.stringify(this.form)); | |||
console.log(form) | |||
form.cooperateDept = form.cooperateDept && form.cooperateDept.join(","); | |||
// form.leaderDept = form.leaderDept && form.leaderDept.join(","); | |||
// form.leaderPrincipal = |
@@ -137,10 +137,11 @@ | |||
></el-input | |||
></el-col> | |||
</el-row> | |||
<el-row> | |||
<el-row> | |||
<el-col :span="4" class="title"> 牵头部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
@select="changePrincipal($event, 'leader')" | |||
v-model="form.leaderDept" | |||
:options="formatDep" | |||
placeholder="请选择牵头部门" | |||
@@ -200,6 +201,7 @@ | |||
<el-col :span="4" class="title"> 其他牵头部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
@select="changePrincipal($event, 'other',index)" | |||
v-model="form.otherDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择其他牵头部门" | |||
@@ -261,6 +263,7 @@ | |||
<el-col :span="4" class="title">配合部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
@select="changePrincipal($event, 'cooperate',index)" | |||
v-model="form.cooperateDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择配合部门" | |||
@@ -284,7 +287,7 @@ | |||
<treeselect | |||
v-model="form.cooperatePrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择牵头部门责任领导" | |||
placeholder="请选择配合部门责任领导" | |||
:defaultExpandLevel="1" | |||
:normalizer=" | |||
(d) => { | |||
@@ -368,8 +371,44 @@ export default { | |||
}, | |||
}, | |||
methods: { | |||
addOtherleader() { | |||
console.log(this.form); | |||
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)) | |||
} | |||
if(type=="cooperate"){ | |||
this.$set(this.form.cooperatePrincipal,index,parseInt(nameId)) | |||
} | |||
if(type=='leader'){ | |||
this.$set(this.form,'leaderPrincipal',parseInt(nameId)) | |||
} | |||
}, | |||
addDept(type) { | |||
if (type == "other") { | |||
this.form.otherDept.push(undefined); | |||
this.form.otherPrincipal.push(undefined); | |||
} | |||
if (type == "cooperate") { | |||
this.form.cooperateDept.push(undefined); | |||
this.form.cooperatePrincipal.push(undefined); | |||
} | |||
}, | |||
deleteDept(index, type) { | |||
console.log(index, type); | |||
if (type == "other") { | |||
this.form.otherDept.splice(index, 1); | |||
this.form.otherPrincipal.splice(index, 1); | |||
} | |||
if (type == "cooperate") { | |||
this.form.cooperateDept.splice(index, 1); | |||
this.form.cooperatePrincipal.splice(index, 1); | |||
} | |||
}, | |||
updateParams(data) { | |||
this.searchParams = data; |
@@ -292,7 +292,7 @@ | |||
<treeselect | |||
v-model="form.cooperatePrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择牵头部门责任领导" | |||
placeholder="请选择配合部门责任领导" | |||
:defaultExpandLevel="1" | |||
:normalizer=" | |||
(d) => { | |||
@@ -483,7 +483,6 @@ export default { | |||
}, | |||
save() { | |||
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(","); |