|
@@ -24,6 +24,13 @@
|
|
|
clearable
|
|
clearable
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item prop="sort" label="检查项排序">
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="formData.sort"
|
|
|
|
|
+ :min="1"
|
|
|
|
|
+ controls-position="right"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="box">
|
|
<div class="box">
|
|
@@ -34,6 +41,12 @@
|
|
|
>
|
|
>
|
|
|
</div>
|
|
</div>
|
|
|
<el-table :data="formData.pointDtoList" border style="width: 100%">
|
|
<el-table :data="formData.pointDtoList" border style="width: 100%">
|
|
|
|
|
+ <el-table-column width="120"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ prop="sort"
|
|
|
|
|
+ label="检查内容序号"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column align="center" prop="name" label="检查内容">
|
|
<el-table-column align="center" prop="name" label="检查内容">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<div style="white-space: pre-wrap">
|
|
<div style="white-space: pre-wrap">
|
|
@@ -57,7 +70,7 @@
|
|
|
>
|
|
>
|
|
|
<el-popconfirm
|
|
<el-popconfirm
|
|
|
title="是否删除检查内容"
|
|
title="是否删除检查内容"
|
|
|
- @confirm="delitem(scope.$index)"
|
|
|
|
|
|
|
+ @confirm="delitem(scope.$index,scope.row)"
|
|
|
style="margin-left: 20px"
|
|
style="margin-left: 20px"
|
|
|
>
|
|
>
|
|
|
<el-button slot="reference" type="text" size="mini"
|
|
<el-button slot="reference" type="text" size="mini"
|
|
@@ -79,6 +92,7 @@
|
|
|
ref="editDialog"
|
|
ref="editDialog"
|
|
|
@submit="onPointSubmit"
|
|
@submit="onPointSubmit"
|
|
|
:rule="rule"
|
|
:rule="rule"
|
|
|
|
|
+ :sort-number-list="this.sortNumberList"
|
|
|
v-bind="$attrs"
|
|
v-bind="$attrs"
|
|
|
></EditPoint>
|
|
></EditPoint>
|
|
|
</div>
|
|
</div>
|
|
@@ -87,7 +101,7 @@
|
|
|
<script>
|
|
<script>
|
|
|
import { mapState, mapMutations } from "vuex";
|
|
import { mapState, mapMutations } from "vuex";
|
|
|
import EditPoint from "./dialog.editPoint.vue";
|
|
import EditPoint from "./dialog.editPoint.vue";
|
|
|
-import { get, update } from "@/api/safetycheck/ruleManager.js";
|
|
|
|
|
|
|
+import { get, update, hasSameSort } from "@/api/safetycheck/ruleManager.js";
|
|
|
import MessageEx from "@/components/message/messageex.js";
|
|
import MessageEx from "@/components/message/messageex.js";
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
@@ -96,7 +110,9 @@ export default {
|
|
|
formData: this.reset(),
|
|
formData: this.reset(),
|
|
|
formDataRules: {
|
|
formDataRules: {
|
|
|
name: [{ required: true, message: "请输入检查项" }],
|
|
name: [{ required: true, message: "请输入检查项" }],
|
|
|
|
|
+ sort: [{ required: true, message: "请输入检查项排序" }],
|
|
|
},
|
|
},
|
|
|
|
|
+ sortNumberList:[]
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
props: {
|
|
props: {
|
|
@@ -116,12 +132,21 @@ export default {
|
|
|
name: null,
|
|
name: null,
|
|
|
ruleId: null,
|
|
ruleId: null,
|
|
|
pointDtoList: [],
|
|
pointDtoList: [],
|
|
|
|
|
+ sort: null
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async show(id) {
|
|
async show(id) {
|
|
|
|
|
+ this.sortNumberList = [];
|
|
|
const data = id ? (await get(id)).data : this.reset();
|
|
const data = id ? (await get(id)).data : this.reset();
|
|
|
this.formData = data;
|
|
this.formData = data;
|
|
|
|
|
+ if (this.formData.pointDtoList && this.formData.pointDtoList.length > 0){
|
|
|
|
|
+ this.formData.pointDtoList.forEach((item) => {
|
|
|
|
|
+ if (item.sort){
|
|
|
|
|
+ this.sortNumberList.push(item.sort)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
this.dialogVisible = true;
|
|
this.dialogVisible = true;
|
|
|
},
|
|
},
|
|
|
// 事件
|
|
// 事件
|
|
@@ -141,11 +166,19 @@ export default {
|
|
|
MessageEx.info("检查内容不能为空!");
|
|
MessageEx.info("检查内容不能为空!");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- update(this.formData).then((v) => {
|
|
|
|
|
- let isAdd = this.formData.id == null || this.formData.id == 0;
|
|
|
|
|
- this.formData = this.reset();
|
|
|
|
|
- this.dialogVisible = false;
|
|
|
|
|
- this.$emit("success", isAdd);
|
|
|
|
|
|
|
+ hasSameSort({ruleId:this.rule.id,sort:this.formData.sort}).then((res) => {
|
|
|
|
|
+ if (res.data && res.data === true) {
|
|
|
|
|
+ //有相同排序号
|
|
|
|
|
+ MessageEx.info("已存在相同检查项排序号: " + this.formData.sort + ",请重新输入!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ update(this.formData).then((v) => {
|
|
|
|
|
+ let isAdd = this.formData.id == null || this.formData.id == 0;
|
|
|
|
|
+ this.formData = this.reset();
|
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
|
+ this.$emit("success", isAdd);
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -153,7 +186,7 @@ export default {
|
|
|
this.dataVisible = false;
|
|
this.dataVisible = false;
|
|
|
},
|
|
},
|
|
|
onEdit(index, row) {
|
|
onEdit(index, row) {
|
|
|
- this.$refs.editDialog.show(index, { ...row });
|
|
|
|
|
|
|
+ this.$refs.editDialog.show(index, { ...row },true);
|
|
|
},
|
|
},
|
|
|
onPointSubmit(index, point) {
|
|
onPointSubmit(index, point) {
|
|
|
if (index >= 0) {
|
|
if (index >= 0) {
|
|
@@ -161,9 +194,13 @@ export default {
|
|
|
} else {
|
|
} else {
|
|
|
this.formData.pointDtoList.push(point);
|
|
this.formData.pointDtoList.push(point);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!this.sortNumberList.includes(point.sort)){
|
|
|
|
|
+ this.sortNumberList.push(point.sort);
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
- delitem(val) {
|
|
|
|
|
|
|
+ delitem(val,row) {
|
|
|
this.formData.pointDtoList.splice(val, 1);
|
|
this.formData.pointDtoList.splice(val, 1);
|
|
|
|
|
+ this.sortNumberList = this.sortNumberList.filter(item => item !== row.sort)
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
mounted() {},
|
|
mounted() {},
|