From ea20ca083f7e5a5d2ed7521f3a75209d4516f6c7 Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: Fri, 01 Apr 2022 16:09:33 +0800
Subject: [PATCH] 自查清单
---
src/views/safetyproduction/checklist.vue | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/src/views/safetyproduction/checklist.vue b/src/views/safetyproduction/checklist.vue
index 7c44497..9dc6c1b 100644
--- a/src/views/safetyproduction/checklist.vue
+++ b/src/views/safetyproduction/checklist.vue
@@ -267,8 +267,8 @@
</div>
<el-dialog :title="titleN" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
- <el-form ref="form" :model="formInline" label-width="80px">
- <el-form-item label="名称">
+ <el-form ref="form" :rules="rules" :model="formInline" label-width="80px">
+ <el-form-item label="名称" prop="name">
<el-input v-model="formInline.name"></el-input>
</el-form-item>
<el-form-item label="说明">
@@ -280,7 +280,7 @@
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
+ <el-button @click="listCel">取 消</el-button>
<el-button type="primary" class="btns" @click="listAdd"
>确 定</el-button
>
@@ -336,6 +336,10 @@
children: "children",
label: "label",
},
+ rules: {
+ name: [
+ { required: true, message: "名称不能为空", trigger: "change" },
+ ],}
};
},
created() {
@@ -353,15 +357,12 @@
},
beforTree() {
safetyInspectionItemTree().then((res) => {
- console.log(res);
this.tree = res.data.result;
});
},
safetyInspectionItemL(data) {
- // console.log(data)
this.listQuery.filter.elementB = data.value;
safetyInspectionItemList(this.listQuery).then((res) => {
- // console.log(res.data.result.records);
this.list = res.data.result.records;
});
},
@@ -382,7 +383,6 @@
} else {
this.disabled = true;
var i = this.list.findIndex((item) => item.id == id);
- console.log(id);
this.form = this.list[i];
}
},
@@ -447,10 +447,15 @@
this.index = this.form.deductionList.findIndex(
(item) => item.name == val.name
);
- this.formInline = val;
+ this.formInline=JSON.parse(JSON.stringify(val));
}
+ this.$nextTick(() => {
+ this.$refs["form"].clearValidate();
+ });
},
listAdd() {
+ this.$refs["form"].validate((valid) => {
+ if (valid) {
if (this.titleN == "新增") {
this.form.deductionList.push(this.formInline);
this.dialogVisible = false;
@@ -459,6 +464,8 @@
this.form.deductionList[this.index].space = this.formInline.space;
this.dialogVisible = false;
}
+ }
+ });
},
listDel(val) {
var i = this.form.deductionList.findIndex(
@@ -480,6 +487,9 @@
});
}
});
+ },
+ listCel(){
+ this.dialogVisible = false;
},
btnsQX() {
this.show = true;
@@ -558,4 +568,4 @@
background-color: #034ea2;
border: 1px solid #034ea2;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.2