@@ -119,7 +119,6 @@ | |||
layout="total, prev, pager, next, jumper" | |||
:pager-count="5" | |||
class="ele-pagination-circle" | |||
:flat="true" | |||
@current-change="getDataList()" | |||
/> | |||
<el-dialog | |||
@@ -147,7 +146,6 @@ | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.leaderDept" | |||
:flat="true" | |||
:options="formatDep" | |||
placeholder="请选择牵头部门" | |||
:defaultExpandLevel="2" | |||
@@ -188,15 +186,26 @@ | |||
</el-col> | |||
</el-row> | |||
<div class="leader"> | |||
<span class="el-icon-circle-plus-outline add" @click="addOtherleader"></span> | |||
<div style="position:relative;"> | |||
<span class="el-icon-remove-outline delete"></span> | |||
<span | |||
class="el-icon-circle-plus-outline add" | |||
@click="addDept('other')" | |||
></span> | |||
<div | |||
style="position: relative" | |||
v-for="(item, index) of form.otherDept" | |||
:key="index" | |||
> | |||
<span | |||
class="el-icon-remove-outline delete" | |||
style="z-index: 10" | |||
@click="deleteDept(index, 'other')" | |||
></span> | |||
<el-row> | |||
<el-col :span="4" class="title"> 其他牵头部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.otherDept" | |||
:flat="true" | |||
@change="changePrincipal" | |||
v-model="form.otherDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择其他牵头部门" | |||
:defaultExpandLevel="2" | |||
@@ -217,7 +226,7 @@ | |||
<el-col :span="4" class="title"> 责任领导: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.otherPrincipal" | |||
v-model="form.otherPrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择其他牵头部门责任领导" | |||
:defaultExpandLevel="1" | |||
@@ -239,15 +248,25 @@ | |||
</div> | |||
</div> | |||
<div class="cooperate"> | |||
<span class="el-icon-circle-plus-outline add"></span> | |||
<div style="position:relative;"> | |||
<span class="el-icon-remove-outline delete"></span> | |||
<span | |||
class="el-icon-circle-plus-outline add" | |||
@click="addDept('cooperate')" | |||
></span> | |||
<div | |||
style="position: relative" | |||
v-for="(item, index) of form.cooperateDept" | |||
:key="index" | |||
> | |||
<span | |||
class="el-icon-remove-outline delete" | |||
style="z-index: 10" | |||
@click="deleteDept(index, 'cooperate')" | |||
></span> | |||
<el-row> | |||
<el-col :span="4" class="title">配合部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.leaderDept" | |||
:flat="true" | |||
v-model="form.cooperateDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择配合部门" | |||
:defaultExpandLevel="2" | |||
@@ -268,7 +287,7 @@ | |||
<el-col :span="4" class="title"> 责任领导: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.leaderPrincipal" | |||
v-model="form.cooperatePrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择牵头部门责任领导" | |||
:defaultExpandLevel="1" | |||
@@ -346,7 +365,7 @@ export default { | |||
this.$store.dispatch("base/getPrincipalList"); | |||
}, | |||
computed: { | |||
...mapGetters(["formatDep", "principalList"]), | |||
...mapGetters(["formatDep", "principalList","department"]), | |||
}, | |||
filters: { | |||
formatList(val) { | |||
@@ -356,8 +375,29 @@ export default { | |||
}, | |||
}, | |||
methods: { | |||
addOtherleader() { | |||
console.log(this.form); | |||
changePrincipal(){ | |||
console.log(this.department) | |||
}, | |||
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; | |||
@@ -389,28 +429,36 @@ export default { | |||
edit(row) { | |||
this.showEdit = true; | |||
let form = JSON.parse(JSON.stringify(row)); | |||
form.leaderDept = form.leaderDept | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
// form.leaderDept = form.leaderDept | |||
// .split(",") | |||
// .map((item) => parseInt(item)); | |||
form.cooperateDept = form.cooperateDept | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.leaderPrincipal = form.leaderPrincipal | |||
// form.leaderPrincipal = form.leaderPrincipal | |||
// .split(",") | |||
// .map((item) => parseInt(item)); | |||
form.cooperatePrincipal = form.cooperatePrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.cooperatePrincipal = form.cooperatePrincipal | |||
form.otherDept = form.otherDept.split(",").map((item) => parseInt(item)); | |||
form.otherPrincipal = form.otherPrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
this.form = form; | |||
}, | |||
save() { | |||
let form = this.form; | |||
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 = | |||
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.join(","); | |||
form.otherDept = form.otherDept && form.otherDept.join(","); | |||
form.otherPrincipal = | |||
form.otherPrincipal && form.otherPrincipal.join(","); | |||
editApi | |||
.editItem(Object.assign({}, form)) | |||
.then((res) => { |
@@ -52,7 +52,7 @@ | |||
align="center" | |||
prop="leaderUnit" | |||
></el-table-column> | |||
<el-table-column label="牵头部门" width="130" align="center"> | |||
<el-table-column label="牵头部门" width="130" align="center"> | |||
<template slot-scope="{ row }"> | |||
<pre>{{ row.leaderDeptList | formatList }}</pre> | |||
</template> | |||
@@ -117,10 +117,10 @@ | |||
@current-change="getDataList()" | |||
/> | |||
</el-card> | |||
<el-dialog | |||
<el-dialog | |||
title="编辑考核内容" | |||
:visible.sync="showEdit" | |||
width="650px" | |||
width="675px" | |||
custom-class="ele-dialog-form" | |||
:lock-scroll="false" | |||
:destroy-on-close="true" | |||
@@ -142,7 +142,6 @@ | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.leaderDept" | |||
:flat="true" | |||
:options="formatDep" | |||
placeholder="请选择牵头部门" | |||
:defaultExpandLevel="2" | |||
@@ -182,16 +181,26 @@ | |||
/> | |||
</el-col> | |||
</el-row> | |||
<div class="leader"> | |||
<span class="el-icon-circle-plus-outline add" @click="addOtherleader"></span> | |||
<div style="position:relative;"> | |||
<span class="el-icon-remove-outline delete"></span> | |||
<div class="leader"> | |||
<span | |||
class="el-icon-circle-plus-outline add" | |||
@click="addDept('other')" | |||
></span> | |||
<div | |||
style="position: relative" | |||
v-for="(item, index) of form.otherDept" | |||
:key="index" | |||
> | |||
<span | |||
class="el-icon-remove-outline delete" | |||
style="z-index: 10" | |||
@click="deleteDept(index, 'other')" | |||
></span> | |||
<el-row> | |||
<el-col :span="4" class="title"> 其他牵头部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.otherDept" | |||
:flat="true" | |||
v-model="form.otherDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择其他牵头部门" | |||
:defaultExpandLevel="2" | |||
@@ -212,7 +221,7 @@ | |||
<el-col :span="4" class="title"> 责任领导: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.otherPrincipal" | |||
v-model="form.otherPrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择其他牵头部门责任领导" | |||
:defaultExpandLevel="1" | |||
@@ -234,57 +243,72 @@ | |||
</div> | |||
</div> | |||
<div class="cooperate"> | |||
<span class="el-icon-circle-plus-outline add"></span> | |||
<el-row> | |||
<el-col :span="4" class="title">配合部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.leaderDept" | |||
:flat="true" | |||
:options="formatDep" | |||
placeholder="请选择配合部门" | |||
:defaultExpandLevel="2" | |||
:normalizer=" | |||
(d) => { | |||
return { | |||
id: d.id, | |||
label: d.name, | |||
children: | |||
d.children && d.children.length > 0 | |||
? d.children | |||
: undefined, | |||
}; | |||
} | |||
" | |||
/> | |||
</el-col> | |||
<el-col :span="4" class="title"> 责任领导: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.leaderPrincipal" | |||
:options="principalList" | |||
placeholder="请选择牵头部门责任领导" | |||
:defaultExpandLevel="1" | |||
:normalizer=" | |||
(d) => { | |||
return { | |||
id: d.id, | |||
label: d.realname, | |||
children: | |||
d.children && d.children.length > 0 | |||
? d.children | |||
: undefined, | |||
}; | |||
} | |||
" | |||
/> | |||
</el-col> | |||
</el-row> | |||
<el-row> | |||
<el-col :span="4" class="title">分值:</el-col> | |||
<el-col :span="7"><el-input placeholder="请输入分值" v-model="form.points"></el-input></el-col> | |||
</el-row> | |||
<span | |||
class="el-icon-circle-plus-outline add" | |||
@click="addDept('cooperate')" | |||
></span> | |||
<div | |||
style="position: relative" | |||
v-for="(item, index) of form.cooperateDept" | |||
:key="index" | |||
> | |||
<span | |||
class="el-icon-remove-outline delete" | |||
style="z-index: 10" | |||
@click="deleteDept(index, 'cooperate')" | |||
></span> | |||
<el-row> | |||
<el-col :span="4" class="title">配合部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.cooperateDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择配合部门" | |||
:defaultExpandLevel="2" | |||
:normalizer=" | |||
(d) => { | |||
return { | |||
id: d.id, | |||
label: d.name, | |||
children: | |||
d.children && d.children.length > 0 | |||
? d.children | |||
: undefined, | |||
}; | |||
} | |||
" | |||
/> | |||
</el-col> | |||
<el-col :span="4" class="title"> 责任领导: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.cooperatePrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择牵头部门责任领导" | |||
:defaultExpandLevel="1" | |||
:normalizer=" | |||
(d) => { | |||
return { | |||
id: d.id, | |||
label: d.realname, | |||
children: | |||
d.children && d.children.length > 0 | |||
? d.children | |||
: undefined, | |||
}; | |||
} | |||
" | |||
/> | |||
</el-col> | |||
</el-row> | |||
</div> | |||
</div> | |||
<el-row> | |||
<el-col :span="4" class="title">分值:</el-col> | |||
<el-col :span="7" | |||
><el-input placeholder="请输入分值" v-model="form.points"></el-input | |||
></el-col> | |||
</el-row> | |||
<div slot="footer"> | |||
<el-button type="primary" @click="save">确定</el-button> | |||
<el-button @click="showEdit = false">取消</el-button> | |||
@@ -300,7 +324,7 @@ import Treeselect from "@riophae/vue-treeselect"; | |||
import { mapGetters } from "vuex"; | |||
import api from "@/api/second/taskSummary"; | |||
import { mergeSpan } from "@/utils/mixin"; | |||
import editApi from "@/api/second/segmentation/constraint" | |||
import editApi from "@/api/second/segmentation/constraint"; | |||
export default { | |||
components: { | |||
search, | |||
@@ -334,7 +358,7 @@ export default { | |||
this.$store.dispatch("base/getPrincipalList"); | |||
}, | |||
computed: { | |||
...mapGetters(["formatDep", "principalList" ]), | |||
...mapGetters(["formatDep", "principalList"]), | |||
}, | |||
filters: { | |||
formatList(val) { | |||
@@ -376,75 +400,92 @@ export default { | |||
edit(row) { | |||
this.showEdit = true; | |||
let form = JSON.parse(JSON.stringify(row)); | |||
form.leaderDept = form.leaderDept | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.cooperateDept = form.cooperateDept | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.leaderPrincipal = form.leaderPrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.cooperatePrincipal = form.cooperatePrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
this.form = form; | |||
// form.leaderDept = form.leaderDept | |||
// .split(",") | |||
// .map((item) => parseInt(item)); | |||
form.cooperateDept = form.cooperateDept | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
// form.leaderPrincipal = form.leaderPrincipal | |||
// .split(",") | |||
// .map((item) => parseInt(item)); | |||
form.cooperatePrincipal = form.cooperatePrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.otherDept = form.otherDept.split(",").map((item) => parseInt(item)); | |||
form.otherPrincipal = form.otherPrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
this.form = form; | |||
}, | |||
save() { | |||
let form = this.form; | |||
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 = | |||
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.join(","); | |||
editApi.editItem(Object.assign({}, form)) | |||
.then((res)=> { | |||
this.showEdit = false; | |||
this.$message({ | |||
type:'success', | |||
message: '编辑成功' | |||
form.otherDept = form.otherDept && form.otherDept.join(","); | |||
form.otherPrincipal = | |||
form.otherPrincipal && form.otherPrincipal.join(","); | |||
editApi | |||
.editItem(Object.assign({}, form)) | |||
.then((res) => { | |||
this.showEdit = false; | |||
this.$message({ | |||
type: "success", | |||
message: "提交申请成功", | |||
}); | |||
this.getDataList(); | |||
}) | |||
this.getDataList() | |||
}) | |||
.catch((e)=>{ | |||
this.showEdit = false; | |||
this.$message({ | |||
type:'error', | |||
message: '编辑失败' | |||
.catch((e) => { | |||
this.showEdit = false; | |||
this.$message({ | |||
type: "error", | |||
message: "提交申请失败", | |||
}); | |||
}) | |||
}) | |||
.finally(() => { | |||
this.form = {} | |||
this.loading = false; | |||
}); | |||
.finally(() => { | |||
this.form = {}; | |||
this.loading = false; | |||
}); | |||
}, | |||
}, | |||
}; | |||
</script> | |||
<style scoped> | |||
.el-row { | |||
margin-bottom: 20px; | |||
display: flex; | |||
align-content: center; | |||
} | |||
.el-col { | |||
text-align: right; | |||
} | |||
.title { | |||
margin-right: 10px; | |||
line-height: 36px; | |||
} | |||
.leader, | |||
.cooperate { | |||
position: relative; | |||
} | |||
.add { | |||
font-size: 20px; | |||
position: absolute; | |||
right: 0px; | |||
top: 8px; | |||
color:#4d9efc; | |||
} | |||
.el-row { | |||
margin-bottom: 20px; | |||
display: flex; | |||
align-content: center; | |||
} | |||
.el-col { | |||
text-align: right; | |||
} | |||
.title { | |||
margin-right: 10px; | |||
line-height: 36px; | |||
} | |||
.leader, | |||
.cooperate { | |||
position: relative; | |||
} | |||
.add { | |||
font-size: 20px; | |||
position: absolute; | |||
left: -10px; | |||
transform: translateX(-50%); | |||
top: 8px; | |||
color: #4d9efc; | |||
} | |||
.delete { | |||
font-size: 20px; | |||
position: absolute; | |||
right: 0; | |||
top: 8px; | |||
color: #fa4953; | |||
} | |||
</style> |
@@ -122,10 +122,10 @@ | |||
:flat="true" | |||
@current-change="getDataList()" | |||
/> | |||
<el-dialog | |||
<el-dialog | |||
title="编辑考核内容" | |||
:visible.sync="showEdit" | |||
width="650px" | |||
width="675px" | |||
custom-class="ele-dialog-form" | |||
:lock-scroll="false" | |||
:destroy-on-close="true" | |||
@@ -146,8 +146,8 @@ | |||
<el-col :span="4" class="title"> 牵头部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
@select="changePrincipal($event, 'leader')" | |||
v-model="form.leaderDept" | |||
:flat="true" | |||
:options="formatDep" | |||
placeholder="请选择牵头部门" | |||
:defaultExpandLevel="2" | |||
@@ -188,15 +188,26 @@ | |||
</el-col> | |||
</el-row> | |||
<div class="leader"> | |||
<span class="el-icon-circle-plus-outline add" @click="addOtherleader"></span> | |||
<div style="position:relative;"> | |||
<span class="el-icon-remove-outline delete"></span> | |||
<span | |||
class="el-icon-circle-plus-outline add" | |||
@click="addDept('other')" | |||
></span> | |||
<div | |||
style="position: relative" | |||
v-for="(item, index) of form.otherDept" | |||
:key="index" | |||
> | |||
<span | |||
class="el-icon-remove-outline delete" | |||
style="z-index: 10" | |||
@click="deleteDept(index, 'other')" | |||
></span> | |||
<el-row> | |||
<el-col :span="4" class="title"> 其他牵头部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.otherDept" | |||
:flat="true" | |||
@select="changePrincipal($event, 'other',index)" | |||
v-model="form.otherDept[index]" | |||
:options="formatDep" | |||
placeholder="请选择其他牵头部门" | |||
:defaultExpandLevel="2" | |||
@@ -217,7 +228,7 @@ | |||
<el-col :span="4" class="title"> 责任领导: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.otherPrincipal" | |||
v-model="form.otherPrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择其他牵头部门责任领导" | |||
:defaultExpandLevel="1" | |||
@@ -239,57 +250,73 @@ | |||
</div> | |||
</div> | |||
<div class="cooperate"> | |||
<span class="el-icon-circle-plus-outline add"></span> | |||
<el-row> | |||
<el-col :span="4" class="title">配合部门: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.leaderDept" | |||
:flat="true" | |||
:options="formatDep" | |||
placeholder="请选择配合部门" | |||
:defaultExpandLevel="2" | |||
:normalizer=" | |||
(d) => { | |||
return { | |||
id: d.id, | |||
label: d.name, | |||
children: | |||
d.children && d.children.length > 0 | |||
? d.children | |||
: undefined, | |||
}; | |||
} | |||
" | |||
/> | |||
</el-col> | |||
<el-col :span="4" class="title"> 责任领导: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.leaderPrincipal" | |||
:options="principalList" | |||
placeholder="请选择牵头部门责任领导" | |||
:defaultExpandLevel="1" | |||
:normalizer=" | |||
(d) => { | |||
return { | |||
id: d.id, | |||
label: d.realname, | |||
children: | |||
d.children && d.children.length > 0 | |||
? d.children | |||
: undefined, | |||
}; | |||
} | |||
" | |||
/> | |||
</el-col> | |||
</el-row> | |||
<el-row> | |||
<el-col :span="4" class="title">分值:</el-col> | |||
<el-col :span="7"><el-input placeholder="请输入分值" v-model="form.points"></el-input></el-col> | |||
</el-row> | |||
<span | |||
class="el-icon-circle-plus-outline add" | |||
@click="addDept('cooperate')" | |||
></span> | |||
<div | |||
style="position: relative" | |||
v-for="(item, index) of form.cooperateDept" | |||
:key="index" | |||
> | |||
<span | |||
class="el-icon-remove-outline delete" | |||
style="z-index: 10" | |||
@click="deleteDept(index, 'cooperate')" | |||
></span> | |||
<el-row> | |||
<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="请选择配合部门" | |||
:defaultExpandLevel="2" | |||
:normalizer=" | |||
(d) => { | |||
return { | |||
id: d.id, | |||
label: d.name, | |||
children: | |||
d.children && d.children.length > 0 | |||
? d.children | |||
: undefined, | |||
}; | |||
} | |||
" | |||
/> | |||
</el-col> | |||
<el-col :span="4" class="title"> 责任领导: </el-col> | |||
<el-col :span="7"> | |||
<treeselect | |||
v-model="form.cooperatePrincipal[index]" | |||
:options="principalList" | |||
placeholder="请选择牵头部门责任领导" | |||
:defaultExpandLevel="1" | |||
:normalizer=" | |||
(d) => { | |||
return { | |||
id: d.id, | |||
label: d.realname, | |||
children: | |||
d.children && d.children.length > 0 | |||
? d.children | |||
: undefined, | |||
}; | |||
} | |||
" | |||
/> | |||
</el-col> | |||
</el-row> | |||
</div> | |||
</div> | |||
<el-row> | |||
<el-col :span="4" class="title">分值:</el-col> | |||
<el-col :span="7" | |||
><el-input placeholder="请输入分值" v-model="form.points"></el-input | |||
></el-col> | |||
</el-row> | |||
<div slot="footer"> | |||
<el-button type="primary" @click="save">确定</el-button> | |||
<el-button @click="showEdit = false">取消</el-button> | |||
@@ -341,7 +368,7 @@ export default { | |||
this.$store.dispatch("base/getPrincipalList"); | |||
}, | |||
computed: { | |||
...mapGetters(["formatDep", "principalList" ]), | |||
...mapGetters(["formatDep", "principalList", "department"]), | |||
}, | |||
filters: { | |||
formatList(val) { | |||
@@ -351,8 +378,45 @@ export default { | |||
}, | |||
}, | |||
methods: { | |||
addOtherleader() { | |||
console.log(this.form); | |||
changePrincipal(e, type,index) { | |||
let nameId; | |||
console.log(this.department,e) | |||
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; | |||
@@ -381,77 +445,94 @@ export default { | |||
}); | |||
}, | |||
edit(row) { | |||
this.showEdit = true | |||
this.showEdit = true; | |||
let form = JSON.parse(JSON.stringify(row)); | |||
form.leaderDept = form.leaderDept | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.cooperateDept = form.cooperateDept | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.leaderPrincipal = form.leaderPrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.cooperatePrincipal = form.cooperatePrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
this.form = form; | |||
// form.leaderDept = form.leaderDept | |||
// .split(",") | |||
// .map((item) => parseInt(item)); | |||
form.cooperateDept = form.cooperateDept | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
// form.leaderPrincipal = form.leaderPrincipal | |||
// .split(",") | |||
// .map((item) => parseInt(item)); | |||
form.cooperatePrincipal = form.cooperatePrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
form.otherDept = form.otherDept.split(",").map((item) => parseInt(item)); | |||
form.otherPrincipal = form.otherPrincipal | |||
.split(",") | |||
.map((item) => parseInt(item)); | |||
this.form = form; | |||
}, | |||
save() { | |||
let form = this.form; | |||
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 = | |||
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.join(","); | |||
editApi.editItem(Object.assign({}, form)) | |||
.then((res)=> { | |||
this.showEdit = false; | |||
this.$message({ | |||
type:'success', | |||
message: '编辑成功' | |||
form.otherDept = form.otherDept && form.otherDept.join(","); | |||
form.otherPrincipal = | |||
form.otherPrincipal && form.otherPrincipal.join(","); | |||
editApi | |||
.editItem(Object.assign({}, form)) | |||
.then((res) => { | |||
this.showEdit = false; | |||
this.$message({ | |||
type: "success", | |||
message: "提交申请成功", | |||
}); | |||
this.getDataList(); | |||
}) | |||
this.getDataList() | |||
}) | |||
.catch((e)=>{ | |||
this.showEdit = false; | |||
this.$message({ | |||
type:'error', | |||
message: '编辑失败' | |||
.catch((e) => { | |||
this.showEdit = false; | |||
this.$message({ | |||
type: "error", | |||
message: "提交申请失败", | |||
}); | |||
}) | |||
}) | |||
.finally(() => { | |||
this.form = {} | |||
this.loading = false; | |||
}); | |||
} | |||
} | |||
.finally(() => { | |||
this.form = {}; | |||
this.loading = false; | |||
}); | |||
}, | |||
}, | |||
}; | |||
</script> | |||
<style scoped> | |||
.el-row { | |||
margin-bottom: 20px; | |||
display: flex; | |||
align-content: center; | |||
} | |||
.el-col { | |||
text-align: right; | |||
} | |||
.title { | |||
margin-right: 10px; | |||
line-height: 36px; | |||
} | |||
.leader, | |||
.cooperate { | |||
position: relative; | |||
} | |||
.add { | |||
font-size: 20px; | |||
position: absolute; | |||
right: 0px; | |||
top: 8px; | |||
color:#4d9efc; | |||
} | |||
.el-row { | |||
margin-bottom: 20px; | |||
display: flex; | |||
align-content: center; | |||
} | |||
.el-col { | |||
text-align: right; | |||
} | |||
.title { | |||
margin-right: 10px; | |||
line-height: 36px; | |||
} | |||
.leader, | |||
.cooperate { | |||
position: relative; | |||
} | |||
.add { | |||
font-size: 20px; | |||
position: absolute; | |||
left: -10px; | |||
transform: translateX(-50%); | |||
top: 8px; | |||
color: #4d9efc; | |||
} | |||
.delete { | |||
font-size: 20px; | |||
position: absolute; | |||
right: 0; | |||
top: 8px; | |||
color: #fa4953; | |||
} | |||
</style> |