From f8cb4519363640a36cf5c5818f7f647ad13b507f Mon Sep 17 00:00:00 2001
From: lyfO_o <764716047@qq.com>
Date: 星期六, 02 四月 2022 10:29:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'remotes/origin/shf' into master

---
 src/views/safetyproduction/reviewXG.vue |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/views/safetyproduction/reviewXG.vue b/src/views/safetyproduction/reviewXG.vue
index 838d985..572ea86 100644
--- a/src/views/safetyproduction/reviewXG.vue
+++ b/src/views/safetyproduction/reviewXG.vue
@@ -151,8 +151,8 @@
     </div>
 
     <el-dialog title="扣分详情" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
-      <el-form ref="form" :model="formInline" label-width="54px">
-        <el-form-item label="说明">
+      <el-form ref="form" :rules="rules" :model="formInline" label-width="54px">
+        <el-form-item label="说明" prop="name">
           <el-input v-model="formInline.name"></el-input>
         </el-form-item>
         <el-form-item label="备注">
@@ -171,7 +171,7 @@
         <el-button type="primary" class="btns" @click="listAdd"
           >确 定</el-button
         >
-        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button @click="bacQx">取 消</el-button>
       </span>
     </el-dialog>
   </div>
@@ -192,11 +192,14 @@
         name: "",
         remark: "",
       },
+        rules: {
+        name: [
+          { required: true, message: "说明不能为空", trigger: "change" },
+        ],}
     };
   },
   created() {
     this.id = this.$route.query.id;
-    console.log('tagee',this.$route.query)
     this.safeT(this.id);
   },
   methods: {
@@ -208,6 +211,9 @@
       });
     },
     coAdd(val, type) {
+       this.$nextTick(() => {
+        this.$refs["form"].clearValidate();
+      });
       this.titleN = type;
       if (type == "新增") {
         this.dialogVisible = true;
@@ -224,6 +230,8 @@
       }
     },
     listAdd() {
+       this.$refs["form"].validate((valid) => {
+        if (valid) {
       if (this.titleN == "新增") {
         this.form.deductionList.push(this.formInline);
         this.dialogVisible = false;
@@ -232,6 +240,8 @@
         this.form.deductionList[this.index].space = this.formInline.space;
         this.dialogVisible = false;
       }
+          }
+      });
     },
     listDel(val) {
       var i = this.form.deductionList.findIndex(
@@ -241,7 +251,6 @@
     },
        safetyInspectionItemA() {
         safetyInspectionItemMod(this.form).then((res) => {
-          console.log(res)
           if (res.data.code == 200) {
             this.$notify({
               type: "success",
@@ -265,6 +274,10 @@
               path:"/new"
             })
     },
+    bacQx(){
+      this.dialogVisible = false;
+    this.safeT(this.id);
+    },
     handleClick() {
       this.dialogVisible = true;
     },

--
Gitblit v1.9.2