<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')" | |||||
v-model="form.leaderDept" | v-model="form.leaderDept" | ||||
:options="formatDep" | :options="formatDep" | ||||
placeholder="请选择牵头部门" | placeholder="请选择牵头部门" | ||||
/> | /> | ||||
</el-col> | </el-col> | ||||
</el-row> | </el-row> | ||||
<div class="leader"> | |||||
<div class="leader"> | |||||
<span | <span | ||||
class="el-icon-circle-plus-outline add" | class="el-icon-circle-plus-outline add" | ||||
@click="addDept('other')" | @click="addDept('other')" | ||||
<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 | ||||
@change="changePrincipal" | |||||
@select="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)" | |||||
v-model="form.cooperateDept[index]" | v-model="form.cooperateDept[index]" | ||||
:options="formatDep" | :options="formatDep" | ||||
placeholder="请选择配合部门" | placeholder="请选择配合部门" | ||||
<treeselect | <treeselect | ||||
v-model="form.cooperatePrincipal[index]" | v-model="form.cooperatePrincipal[index]" | ||||
:options="principalList" | :options="principalList" | ||||
placeholder="请选择牵头部门责任领导" | |||||
placeholder="请选择配合部门责任领导" | |||||
:defaultExpandLevel="1" | :defaultExpandLevel="1" | ||||
:normalizer=" | :normalizer=" | ||||
(d) => { | (d) => { | ||||
}, | }, | ||||
}, | }, | ||||
methods: { | 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) { | addDept(type) { | ||||
if (type == "other") { | if (type == "other") { | ||||
} | } | ||||
}, | }, | ||||
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() { | ||||
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.leaderDept = form.leaderDept && form.leaderDept.join(","); | // form.leaderDept = form.leaderDept && form.leaderDept.join(","); | ||||
// form.leaderPrincipal = | // form.leaderPrincipal = |
></el-input | ></el-input | ||||
></el-col> | ></el-col> | ||||
</el-row> | </el-row> | ||||
<el-row> | |||||
<el-row> | |||||
<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')" | |||||
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)" | |||||
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)" | |||||
v-model="form.cooperateDept[index]" | v-model="form.cooperateDept[index]" | ||||
:options="formatDep" | :options="formatDep" | ||||
placeholder="请选择配合部门" | placeholder="请选择配合部门" | ||||
<treeselect | <treeselect | ||||
v-model="form.cooperatePrincipal[index]" | v-model="form.cooperatePrincipal[index]" | ||||
:options="principalList" | :options="principalList" | ||||
placeholder="请选择牵头部门责任领导" | |||||
placeholder="请选择配合部门责任领导" | |||||
:defaultExpandLevel="1" | :defaultExpandLevel="1" | ||||
:normalizer=" | :normalizer=" | ||||
(d) => { | (d) => { | ||||
}, | }, | ||||
}, | }, | ||||
methods: { | 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) { | updateParams(data) { | ||||
this.searchParams = data; | this.searchParams = data; |
<treeselect | <treeselect | ||||
v-model="form.cooperatePrincipal[index]" | v-model="form.cooperatePrincipal[index]" | ||||
:options="principalList" | :options="principalList" | ||||
placeholder="请选择牵头部门责任领导" | |||||
placeholder="请选择配合部门责任领导" | |||||
:defaultExpandLevel="1" | :defaultExpandLevel="1" | ||||
:normalizer=" | :normalizer=" | ||||
(d) => { | (d) => { | ||||
}, | }, | ||||
methods: { | methods: { | ||||
changePrincipal(e, type,index) { | changePrincipal(e, type,index) { | ||||
let nameId; | |||||
console.log(this.department,e) | |||||
let nameId; | |||||
this.department.forEach(item=>{ | this.department.forEach(item=>{ | ||||
if(item.id==e.id){ | if(item.id==e.id){ | ||||
nameId=item.principal; | nameId=item.principal; | ||||
}, | }, | ||||
save() { | save() { | ||||
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.leaderDept = form.leaderDept && form.leaderDept.join(","); | // form.leaderDept = form.leaderDept && form.leaderDept.join(","); | ||||
// form.leaderPrincipal = | // form.leaderPrincipal = |