|
|
@@ -125,6 +125,7 @@ |
|
|
|
> |
|
|
|
<el-form |
|
|
|
:model="form" |
|
|
|
ref="form" |
|
|
|
label-width="120px" |
|
|
|
@keyup.enter.native="save" |
|
|
|
@submit.native.prevent |
|
|
@@ -159,10 +160,10 @@ |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="分值:" prop="points"> |
|
|
|
<el-input placeholder="请输入分值" v-model="form.points"></el-input> |
|
|
|
<el-input placeholder="请输入分值" type="number" v-model="form.points"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="得分:" prop="score"> |
|
|
|
<el-input placeholder="请输入得分" v-model="form.score"></el-input> |
|
|
|
<el-input placeholder="请输入得分" type="number" v-model="form.score"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="第一牵头部门:" prop="leaderDept"> |
|
|
|
<treeselect |
|
|
@@ -185,7 +186,7 @@ |
|
|
|
" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="其他牵头部门:" prop="leaderDept"> |
|
|
|
<el-form-item label="其他牵头部门:" prop="otherDept"> |
|
|
|
<treeselect |
|
|
|
v-model="form.otherDept" |
|
|
|
:disable-branch-nodes="true" |
|
|
@@ -269,6 +270,29 @@ export default { |
|
|
|
{ id: 2, quota: "重点任务" }, |
|
|
|
{ id: 3, quota: "加减分考核" }, |
|
|
|
], |
|
|
|
rules: { |
|
|
|
categoryId: [ |
|
|
|
{ required: true, message: '请选择产品链名称', trigger: 'blur' }, |
|
|
|
], |
|
|
|
type: [ |
|
|
|
{ required: true, message: '请选择考核指标', trigger: 'blur' } |
|
|
|
], |
|
|
|
content: [ |
|
|
|
{ type: 'string', required: true, message: '请输入考核内容', trigger: 'change' } |
|
|
|
], |
|
|
|
points: [ |
|
|
|
{ required: true, message: '请输入分值', trigger: 'change' } |
|
|
|
], |
|
|
|
score: [ |
|
|
|
{ required: true, message: '请输入得分', trigger: 'change' } |
|
|
|
], |
|
|
|
leaderDept: [ |
|
|
|
{ required: true, message: '请选择第一牵头部门', trigger: 'blur' } |
|
|
|
], |
|
|
|
cooperateDept: [ |
|
|
|
{ required: true, message: '请选择配合部门', trigger: 'blur' } |
|
|
|
] |
|
|
|
} |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
@@ -347,94 +371,104 @@ export default { |
|
|
|
this.dialogTitle = title; |
|
|
|
}, |
|
|
|
save(type) { |
|
|
|
let params = [ |
|
|
|
"categoryId", |
|
|
|
"type", |
|
|
|
"content", |
|
|
|
"points", |
|
|
|
"score", |
|
|
|
"leaderDept", |
|
|
|
"cooperateDept", |
|
|
|
]; |
|
|
|
let form = JSON.parse(JSON.stringify(this.form)); |
|
|
|
for (let key of params) { |
|
|
|
if (!form[key]) { |
|
|
|
if (form[key] != 0) { |
|
|
|
this.$message({ |
|
|
|
type: "warning", |
|
|
|
message: "请完善信息", |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (Array.isArray(form[key])) { |
|
|
|
if (form[key].length == 0) { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
let form = JSON.parse(JSON.stringify(this.form)); |
|
|
|
try { |
|
|
|
console.log(form); |
|
|
|
form.otherDept = form.otherDept.join(","); |
|
|
|
form.cooperateDept = form.cooperateDept.join(","); |
|
|
|
} catch (e) { |
|
|
|
debugger; |
|
|
|
this.$message({ |
|
|
|
type: "warning", |
|
|
|
message: "请完善信息", |
|
|
|
}); |
|
|
|
this.$message({ type: "warning", message: "请完善信息" }); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (key == "points" || key == "score") { |
|
|
|
if (parseInt(form[key]) !== parseInt(form[key])) { |
|
|
|
this.$message({ |
|
|
|
type: "warning", |
|
|
|
message: "分数类请输入数字", |
|
|
|
}); |
|
|
|
return; |
|
|
|
form.completion = "暂无"; |
|
|
|
if (this.action == "edit") { |
|
|
|
api |
|
|
|
.edit(form) |
|
|
|
.then((res) => { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message: "修改考核目标内容成功", |
|
|
|
}); |
|
|
|
this.showEdit = false; |
|
|
|
this.getList(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
this.$message.error("修改考核目标内容失败"); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if (typeof form[key] == "string" && !form[key].trim()) { |
|
|
|
debugger; |
|
|
|
if (this.action == "add") { |
|
|
|
api |
|
|
|
.add(form) |
|
|
|
.then((res) => { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message: "添加考核目标内容成功", |
|
|
|
}); |
|
|
|
this.showEdit = false; |
|
|
|
this.getList(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
this.$message.error("添加考核目标内容失败"); |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message({ |
|
|
|
type: "warning", |
|
|
|
message: "请完善信息", |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
console.log(form); |
|
|
|
form.otherDept = form.otherDept.join(","); |
|
|
|
form.cooperateDept = form.cooperateDept.join(","); |
|
|
|
} catch (e) { |
|
|
|
debugger; |
|
|
|
this.$message({ type: "warning", message: "请完善信息" }); |
|
|
|
return; |
|
|
|
} |
|
|
|
form.completion = "暂无"; |
|
|
|
if (this.action == "edit") { |
|
|
|
api |
|
|
|
.edit(form) |
|
|
|
.then((res) => { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message: "修改考核目标内容成功", |
|
|
|
}); |
|
|
|
this.showEdit = false; |
|
|
|
this.getList(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
this.$message.error("修改考核目标内容失败"); |
|
|
|
}); |
|
|
|
} |
|
|
|
if (this.action == "add") { |
|
|
|
api |
|
|
|
.add(form) |
|
|
|
.then((res) => { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message: "添加考核目标内容成功", |
|
|
|
}); |
|
|
|
this.showEdit = false; |
|
|
|
this.getList(); |
|
|
|
type: "error", |
|
|
|
message: "请检查表单信息是否符合规则", |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
this.$message.error("添加考核目标内容失败"); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
// let params = [ |
|
|
|
// "categoryId", |
|
|
|
// "type", |
|
|
|
// "content", |
|
|
|
// "points", |
|
|
|
// "score", |
|
|
|
// "leaderDept", |
|
|
|
// "cooperateDept", |
|
|
|
// ]; |
|
|
|
// for (let key of params) { |
|
|
|
// if (!form[key]) { |
|
|
|
// if (form[key] != 0) { |
|
|
|
// this.$message({ |
|
|
|
// type: "warning", |
|
|
|
// message: "请完善信息", |
|
|
|
// }); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if (Array.isArray(form[key])) { |
|
|
|
// if (form[key].length == 0) { |
|
|
|
// debugger; |
|
|
|
// this.$message({ |
|
|
|
// type: "warning", |
|
|
|
// message: "请完善信息", |
|
|
|
// }); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if (key == "points" || key == "score") { |
|
|
|
// if (parseInt(form[key]) !== parseInt(form[key])) { |
|
|
|
// this.$message({ |
|
|
|
// type: "warning", |
|
|
|
// message: "分数类请输入数字", |
|
|
|
// }); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if (typeof form[key] == "string" && !form[key].trim()) { |
|
|
|
// debugger; |
|
|
|
// this.$message({ |
|
|
|
// type: "warning", |
|
|
|
// message: "请完善信息", |
|
|
|
// }); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |