From a49ae63a6f96d10b8ec9fa479a0c28c5df4537e7 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期四, 31 三月 2022 16:45:59 +0800
Subject: [PATCH] fix

---
 src/views/safetyproduction/checklist.vue |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/views/safetyproduction/checklist.vue b/src/views/safetyproduction/checklist.vue
index 58f8c18..6cf3e28 100644
--- a/src/views/safetyproduction/checklist.vue
+++ b/src/views/safetyproduction/checklist.vue
@@ -16,7 +16,7 @@
               </el-col>
               <el-col :span="11" :offset="1" style="white-space: nowrap">
                 <el-form-item size="mini">
-                  <el-button type="primary" class="btns" @click="find" size="mini"
+                  <el-button type="primary" class="btns"  size="mini"
                     >搜索</el-button
                   >
                   <el-button
@@ -47,18 +47,18 @@
             <el-col :span="2">
               <p class="titles">标准化要求:</p>
             </el-col>
-            <el-col :span="18">
+            <el-col :span="20">
               <p class="titles-type">
                 {{ item.standardizationRequirements }}
               </p>
             </el-col>
-            <el-col :span="2"
+            <el-col :span="1"
               ><p class="btnXG" @click="safetyInspectionItemC(item.id, '修改')">
                 修改
               </p></el-col
             >
-            <el-col :span="2"
-              ><p class="btnXG" @click="safetyInspectionItemDel(item.id)">
+            <el-col :span="1"
+              ><p class="btnXG" style="color:red;" @click="safetyInspectionItemDel(item.id)">
                 删除
               </p></el-col
             >
@@ -266,9 +266,9 @@
       </div>
     </div>
 
-    <el-dialog :title="titleN" :visible.sync="dialogVisible" width="30%">
-      <el-form ref="form" :model="formInline" label-width="80px">
-        <el-form-item label="名称">
+    <el-dialog :title="titleN" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
+      <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() {
@@ -435,6 +439,9 @@
       }
     },
     coAdd(val, type) {
+       this.$nextTick(() => {
+        this.$refs["form"].clearValidate();
+      });
       this.titleN = type;
       if (type == "新增") {
         this.dialogVisible = true;
@@ -451,6 +458,8 @@
       }
     },
     listAdd() {
+        this.$refs["form"].validate((valid) => {
+        if (valid) {
       if (this.titleN == "新增") {
         this.form.deductionList.push(this.formInline);
         this.dialogVisible = false;
@@ -459,6 +468,8 @@
         this.form.deductionList[this.index].space = this.formInline.space;
         this.dialogVisible = false;
       }
+         }
+      });
     },
     listDel(val) {
       var i = this.form.deductionList.findIndex(
@@ -481,6 +492,9 @@
         }
       });
     },
+    listCel(){
+      this.dialogVisible = false;
+    },
     btnsQX() {
       this.show = true;
     },

--
Gitblit v1.9.2