heyang hai 1 ano
pai
achega
aece7b1608
Modificáronse 1 ficheiros con 11 adicións e 7 borrados
  1. 11 7
      src/views/safetyCheck/equipmentConfig/index.vue

+ 11 - 7
src/views/safetyCheck/equipmentConfig/index.vue

@@ -167,11 +167,9 @@ export default {
       rules: {
         joinCheckOpList: [
           { required: true, message: "请选择", trigger: "change" },
-          { required: true, message: "请选择", validator: this.spaceJudgment, trigger: "change" },
         ],
         joinHazardReid: [
-          { required: true, message: "请输入检查项目内容", trigger: "change" },
-          { required: true, message: "请输入检查项目内容", validator: this.spaceJudgment, trigger: "change" },
+          { required: true, message: "请输入检查项目内容", trigger: "change" }
         ],
       },
 
@@ -190,12 +188,9 @@ export default {
       let _this=this;
       if(doType=='add'){//新增
         this.isDetail=false;
+        this.resetForm('addDialogForm');
         this.$set(this,'addDialogType',true);
         this.$set(this,'addDialogTitle','新增检查项');
-        this.$set(this,'addDialogForm',{
-          joinHazardReid:'',
-          joinCheckOpList:[],
-        });
         this.inspectContentList()//检查内容
         this.$nextTick(function () {
           //Dom更新完毕
@@ -203,6 +198,7 @@ export default {
         });
       }else if(doType=='detail'){//详情
         this.isDetail=true;
+        this.resetForm('addDialogForm')
         this.$set(this,'addDialogType',true);
         this.$set(this,'addDialogTitle','编辑检查项');
         this.getInfo(row.id)
@@ -213,6 +209,7 @@ export default {
         });
       }else if(doType=='edit'){//编辑
         this.isDetail=false;
+        this.resetForm('addDialogForm')
         this.$set(this,'addDialogType',true);
         this.$set(this,'addDialogTitle','编辑检查项');
         this.getInfo(row.id)
@@ -237,6 +234,13 @@ export default {
         }).catch(() => {});
       }
     },
+    resetForm(formName) {
+      if (this.$refs[formName]!==undefined) {
+        // 清除表单内容和清除表单验证消息
+        this.$refs[formName].resetFields();
+      }
+    },
+
     //添加页面关闭
     addDialogOff(){
       this.$set(this,'addDialogType',false);