Browse Source

修改

master
yangzhou-cyber 3 years ago
parent
commit
e869d4f7b7
2 changed files with 120 additions and 86 deletions
  1. +1
    -1
      src/config/setting.js
  2. +119
    -85
      src/views/chain/assessmentContent.vue

+ 1
- 1
src/config/setting.js View File

@@ -4,8 +4,8 @@
export default {
version: '1.0',
name: 'JNDZ考核管理系统', // 项目名称
// baseURL: 'http://121.40.249.52:9031/api/', // 接口地址
baseURL: 'http://47.98.157.120:9031/api/', // 接口地址
// baseURL: 'http://47.98.157.120:9031/api/', // 接口地址
// baseURL: 'http://127.0.0.1:9031/api/', // 接口地址
whiteList: ['/login', '/forget'], // 路由白名单(不需要登录的)
keepAliveList: [], // 需要缓存的组件名称

+ 119
- 85
src/views/chain/assessmentContent.vue View File

@@ -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: {

Loading…
Cancel
Save