|
|
@@ -67,13 +67,17 @@ |
|
|
|
<div class="segmentation" style="margin-top: 30px"> |
|
|
|
<div class="title"> |
|
|
|
<span>分项信息</span> |
|
|
|
<el-button type="primary" size="small" style="margin-right: 50px" |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
size="small" |
|
|
|
style="margin-right: 50px" |
|
|
|
@click="change('add')" |
|
|
|
>添加</el-button |
|
|
|
> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-table |
|
|
|
:data="dataDetail" |
|
|
|
:data="detailList" |
|
|
|
border |
|
|
|
highlight-current-row |
|
|
|
v-loading="tableLoading" |
|
|
@@ -89,43 +93,83 @@ |
|
|
|
align="center" |
|
|
|
min-width="150" |
|
|
|
max-width="200" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="分值" |
|
|
|
align="center" |
|
|
|
width="80" |
|
|
|
></el-table-column> |
|
|
|
> |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<el-input |
|
|
|
type="textarea" |
|
|
|
placeholder="请输入小项内容" |
|
|
|
v-model="form.itemContent" |
|
|
|
v-if="row.edit || row.add" |
|
|
|
></el-input> |
|
|
|
<span v-else>{{ row.itemContent }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="分值" align="center" width="80"> |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<el-input |
|
|
|
placeholder="请输入分值" |
|
|
|
v-if="row.edit || row.add" |
|
|
|
v-model="form.points" |
|
|
|
></el-input> |
|
|
|
<span v-else>{{ row.points }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="牵头部门" align="center" width="180"> |
|
|
|
<treeselect |
|
|
|
:multiple="true" |
|
|
|
v-model="dataDetail.leaderDept" |
|
|
|
:options="formatDep" |
|
|
|
placeholder="请选择牵头部门" |
|
|
|
:defaultExpandLevel="1" |
|
|
|
:normalizer=" |
|
|
|
(d) => { |
|
|
|
return { |
|
|
|
id: d.id, |
|
|
|
label: d.name, |
|
|
|
children: |
|
|
|
d.children && d.children.length > 0 |
|
|
|
? d.children |
|
|
|
: undefined, |
|
|
|
}; |
|
|
|
} |
|
|
|
" |
|
|
|
/> |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<treeselect |
|
|
|
v-if="row.edit || row.add" |
|
|
|
:multiple="true" |
|
|
|
v-model="form.leaderDept" |
|
|
|
:options="formatDep" |
|
|
|
placeholder="请选择牵头部门" |
|
|
|
:defaultExpandLevel="1" |
|
|
|
:normalizer=" |
|
|
|
(d) => { |
|
|
|
return { |
|
|
|
id: d.id, |
|
|
|
label: d.name, |
|
|
|
children: |
|
|
|
d.children && d.children.length > 0 |
|
|
|
? d.children |
|
|
|
: undefined, |
|
|
|
}; |
|
|
|
} |
|
|
|
" |
|
|
|
/> |
|
|
|
<span v-else>{{ row.leaderDeptList | formatList }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="责任领导" align="center" width="180"> |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<treeselect |
|
|
|
v-if="row.edit || row.add" |
|
|
|
:multiple="true" |
|
|
|
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, |
|
|
|
}; |
|
|
|
} |
|
|
|
" |
|
|
|
/> |
|
|
|
<span v-else>{{ row.leaderPrincipalList | formatList }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="责任领导" |
|
|
|
align="center" |
|
|
|
width="100" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column label="配合部门" align="center" width="180"> |
|
|
|
<template> |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<treeselect |
|
|
|
v-if="row.edit || row.add" |
|
|
|
:multiple="true" |
|
|
|
v-model="dataDetail.cooperateDept" |
|
|
|
v-model="form.cooperateDept" |
|
|
|
:options="formatDep" |
|
|
|
placeholder="请选择配合部门" |
|
|
|
:defaultExpandLevel="1" |
|
|
@@ -142,23 +186,73 @@ |
|
|
|
} |
|
|
|
" |
|
|
|
/> |
|
|
|
<span v-else>{{ row.cooperateDeptList | formatList }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="责任领导" |
|
|
|
align="center" |
|
|
|
width="100" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column label="操作" align="center" width="150"> |
|
|
|
<template> |
|
|
|
<el-button type="primary" size="small">编辑</el-button> |
|
|
|
<el-button type="danger" size="small">删除</el-button> |
|
|
|
<el-table-column label="责任领导" align="center" width="180"> |
|
|
|
<template slot-scope="{ row }"> |
|
|
|
<treeselect |
|
|
|
v-if="row.edit || row.add" |
|
|
|
:multiple="true" |
|
|
|
v-model="form.cooperatePrincipal" |
|
|
|
:options="principalList" |
|
|
|
placeholder="请选择配合部门责任领导" |
|
|
|
:defaultExpandLevel="1" |
|
|
|
:normalizer=" |
|
|
|
(d) => { |
|
|
|
return { |
|
|
|
id: d.id, |
|
|
|
label: d.realname, |
|
|
|
children: |
|
|
|
d.children && d.children.length > 0 |
|
|
|
? d.children |
|
|
|
: undefined, |
|
|
|
}; |
|
|
|
} |
|
|
|
" |
|
|
|
/> |
|
|
|
<span v-else>{{ |
|
|
|
row.cooperatePrincipalList | formatList |
|
|
|
}}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" align="center" width="135"> |
|
|
|
<template slot-scope="{ row, $index }"> |
|
|
|
<el-link |
|
|
|
v-if="row.add || row.edit" |
|
|
|
@click="add(row)" |
|
|
|
icon="el-icon-edit" |
|
|
|
type="primary" |
|
|
|
:underline="false" |
|
|
|
>保存</el-link |
|
|
|
> |
|
|
|
<template v-else> |
|
|
|
<el-link |
|
|
|
@click="change('edit', $index)" |
|
|
|
icon="el-icon-edit" |
|
|
|
type="primary" |
|
|
|
:underline="false" |
|
|
|
>编辑</el-link |
|
|
|
> |
|
|
|
<el-popconfirm |
|
|
|
title="确定要删除此表格?" |
|
|
|
@confirm="remove(row.id)" |
|
|
|
class="ele-action" |
|
|
|
> |
|
|
|
<el-link |
|
|
|
slot="reference" |
|
|
|
icon="el-icon-delete" |
|
|
|
type="danger" |
|
|
|
:underline="false" |
|
|
|
>删除</el-link |
|
|
|
> |
|
|
|
</el-popconfirm> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
<div slot="footer" class="footer"> |
|
|
|
<el-button type="primary" @click="save">确定</el-button> |
|
|
|
<el-button @click="close">取消</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@@ -173,6 +267,11 @@ import basicTableApi from "@/api/second/segmentation/basicTable"; |
|
|
|
import rewardApi from "@/api/second/segmentation/reward"; |
|
|
|
import constraintApi from "@/api/second/segmentation/constraint"; |
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
let map = { |
|
|
|
1: "taskItemList", |
|
|
|
2: "specialPowerItemList", |
|
|
|
3: "rigidityConstraintItemList", |
|
|
|
}; |
|
|
|
export default { |
|
|
|
props: { |
|
|
|
id: { |
|
|
@@ -188,16 +287,23 @@ export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
data: {}, |
|
|
|
dataDetail: [], |
|
|
|
// dataDetail: {}, |
|
|
|
allLoading: false, |
|
|
|
tableLoading: false, |
|
|
|
form: {}, |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...mapGetters(["formatDep"]), |
|
|
|
...mapGetters(["formatDep", "principalList"]), |
|
|
|
detailList() { |
|
|
|
let that = this; |
|
|
|
return this.data[map[this.type]]; |
|
|
|
}, |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.getData(); |
|
|
|
this.$store.dispatch("base/getDepartment", 1); |
|
|
|
this.$store.dispatch("base/getPrincipalList"); |
|
|
|
}, |
|
|
|
filters: { |
|
|
|
formatList(val) { |
|
|
@@ -243,12 +349,112 @@ export default { |
|
|
|
this.tableLoading = false; |
|
|
|
}); |
|
|
|
}, |
|
|
|
save() { |
|
|
|
this.$router.back(-1); |
|
|
|
change(type, index) { |
|
|
|
if (type == "add") { |
|
|
|
let data = this.data; |
|
|
|
data[map[this.type]].push({ add: true }); |
|
|
|
} |
|
|
|
if (type == "edit") { |
|
|
|
console.log(this.formatDep, this.principalList); |
|
|
|
let form = JSON.parse(JSON.stringify(this.data[map[this.type]][index])); |
|
|
|
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; |
|
|
|
this.$set(this.data[map[this.type]][index], "edit", true); |
|
|
|
} |
|
|
|
}, |
|
|
|
close() { |
|
|
|
this.$router.back(-1); |
|
|
|
}, |
|
|
|
add(data) { |
|
|
|
this.allLoading = true; |
|
|
|
let form = this.form; |
|
|
|
form.cooperateDept = form.cooperateDept && form.cooperateDept.join(","); |
|
|
|
form.leaderDept = form.leaderDept && form.leaderDept.join(","); |
|
|
|
form.leaderPrincipal = |
|
|
|
form.leaderPrincipal && form.leaderPrincipal.join(","); |
|
|
|
form.cooperatePrincipal = |
|
|
|
form.cooperatePrincipal && form.cooperatePrincipal.join(","); |
|
|
|
if (data.edit) { |
|
|
|
this.getApi() |
|
|
|
.editItem(form) |
|
|
|
.then((res) => { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message: "修改小项内容成功", |
|
|
|
}); |
|
|
|
this.getData(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
this.$message.error("修改小项内容失败"); |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
this.allLoading = false; |
|
|
|
this.form = {}; |
|
|
|
}); |
|
|
|
} |
|
|
|
if (data.add) { |
|
|
|
let obj = {}; |
|
|
|
switch (parseInt(this.type)) { |
|
|
|
case 1: |
|
|
|
obj["basicTaskId"] = this.id; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
obj["specialPowerId"] = this.id; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
obj["rigidityConstraintId"] = this.id; |
|
|
|
break; |
|
|
|
} |
|
|
|
this.getApi() |
|
|
|
.addItem(Object.assign({}, form, obj)) |
|
|
|
.then((res) => { |
|
|
|
console.log(res.data.code); |
|
|
|
if (res.data.code === 0) { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message: "添加小项内容成功", |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.$message.error("添加小项内容失败"); |
|
|
|
} |
|
|
|
this.getData(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
this.$message.error("添加小项内容失败"); |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
this.allLoading = false; |
|
|
|
this.form = {}; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
remove(id) { |
|
|
|
this.allLoading = true; |
|
|
|
this.getApi() |
|
|
|
.deleteItem(id) |
|
|
|
.then((res) => { |
|
|
|
this.$message({ type: "success", message: "删除小项成功" }); |
|
|
|
this.getData(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
console.log(e); |
|
|
|
this.$message.error("删除小项失败"); |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
this.allLoading = false; |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |