qms/src/views/modules/code/components/startEightGrade-add.vue
2023-06-30 11:14:09 +08:00

209 lines
4.4 KiB
Vue

<!--
* @Author: zwq
* @Date: 2023-06-29 14:12:48
* @LastEditors: zwq
* @LastEditTime: 2023-06-30 10:58:16
* @Description:
-->
<template>
<base-table border show-summary :table-props="tableProps" :table-data="tableData" @emitFun="inputChange" />
</template>
<script>
import basicAdd from "@/mixins/basic-add";
import selectMember from "./selectMember";
import i18n from "@/i18n";
const tableProps = [
{
prop: "stepName",
label: i18n.t("disqualification.step"),
align: "center",
},
{
prop: "desc",
label: "打分项",
align: "center",
},
{
prop: "gradeList",
label: "打分",
align: "center",
subcomponent: selectMember,
},
{
prop: "grade",
label: "分数",
align: "center",
},
];
const gradeList = [
{ id: 1, username: "优" },
{ id: 2, username: "良" },
{ id: 3, username: "差" },
];
const score = [10, 8, 0];
export default {
components: {
selectMember,
},
mixins: [basicAdd],
data() {
return {
urlOptions: {
submitURL: "/code/startEightDisciplinePreliminaryAnalysis/",
},
tableProps,
score,
visible: false,
tableData: [
{
stepName: "D1",
step: 1,
desc: "初步分析",
roleList: gradeList,
},
{
stepName: "D2",
step: 2,
desc: "创建团队",
roleList: gradeList,
},
{
stepName: "D3",
step: 3,
desc: "临时处理措施",
roleList: gradeList,
},
{
stepName: "D4",
step: 4,
desc: "根本原因分析",
roleList: gradeList,
},
{
stepName: "D5",
step: 5,
desc: "纠正措施描述",
roleList: gradeList,
},
{
stepName: "D6",
step: 6,
desc: "有效性验证",
roleList: gradeList,
},
{
stepName: "D7",
step: 7,
desc: "预防再发生",
roleList: gradeList,
},
{
stepName: "D8",
step: 8,
desc: "总结与经验分享",
roleList: gradeList,
},
],
id: "",
};
},
computed: {
dataRule() {
return {
// description: [{ required: true, message: this.$t("validate.required"), trigger: "blur" }],
};
},
},
methods: {
init(id) {
this.id = id;
this.visible = true;
this.$nextTick(() => {});
},
inputChange(data) {
switch (data.sType) {
case 1:
this.tableData[data._pageIndex - 1][data.prop] = data[data.prop];
break;
case 2:
this.tableData[data._pageIndex - 1].gradeStatus = data.string
? data.string.split("+")[0]
: "";
if (this.tableData[data._pageIndex - 1].gradeStatus) {
this.$set(
this.tableData[data._pageIndex - 1],
'grade',
this.score[this.tableData[data._pageIndex - 1].gradeStatus - 1]
);
}
break;
default:
console.log(val);
}
},
formClear() {},
// 表单提交
dataFormSubmit() {
this.tableData.forEach((item) => {
item.startEightDisciplineId = this.id;
});
this.$http.post("/code/startEightGrade/save/list", this.tableData)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$message({
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.visible = false;
this.$emit("refreshDataList");
},
});
});
},
},
};
</script>
<style lang="scss">
.mod-sys__menu {
.menu-list,
.icon-list {
.el-input__inner,
.el-input__suffix {
cursor: pointer;
}
}
&-icon-popover {
width: 458px;
overflow: hidden;
}
&-icon-inner {
width: 478px;
max-height: 258px;
overflow-x: hidden;
overflow-y: auto;
}
&-icon-list {
width: 458px;
padding: 0;
margin: -8px 0 0 -8px;
> .el-button {
padding: 8px;
margin: 8px 0 0 8px;
> span {
display: inline-block;
vertical-align: middle;
width: 18px;
height: 18px;
font-size: 18px;
}
}
}
}
</style>