Browse Source

履职、检查项编辑未校验

jiawuxian 2 years ago
parent
commit
3d3a15e14f

+ 14 - 5
src/views/resumption/ruleManager/dialog.editItem.vue

@@ -115,11 +115,20 @@ export default {
     },
     async onSubmit() {
       this.formData.ruleId = this.rule.id;
-      await update(this.formData).then((v) => {
-        console.log(v);
-        this.formData = this.reset();
-        this.dialogVisible = false;
-        this.$emit("success");
+
+      this.$refs.form.validate((isValidate) => {
+        if (!isValidate) {
+          return;
+        }
+        if(!this.formData.pointDtoList || this.formData.pointDtoList.length==0){
+          this.$message.warning("履职内容不能为空!");
+          return;
+        }
+        update(this.formData).then((v) => {
+          this.formData = this.reset();
+          this.dialogVisible = false;
+          this.$emit("success");
+        });
       });
     },
     onclose() {

+ 16 - 6
src/views/safetycheck/ruleManager/dialog.editItem.vue

@@ -29,7 +29,9 @@
         <div class="box">
           <p>检查内容</p>
           <div style="margin-bottom: 10px">
-            <el-button type="primary" @click="onEdit(-1)">新增检查内容</el-button>
+            <el-button type="primary" @click="onEdit(-1)"
+              >新增检查内容</el-button
+            >
           </div>
           <el-table :data="formData.pointDtoList" border style="width: 100%">
             <el-table-column prop="name" label="检查内容"> </el-table-column>
@@ -115,11 +117,19 @@ export default {
     },
     async onSubmit() {
       this.formData.ruleId = this.rule.id;
-      await update(this.formData).then((v) => {
-        console.log(v);
-        this.formData = this.reset();
-        this.dialogVisible = false;
-        this.$emit("success");
+      this.$refs.form.validate((isValidate) => {
+        if (!isValidate) {
+          return;
+        }
+        if(!this.formData.pointDtoList || this.formData.pointDtoList.length==0){
+          this.$message.warning("检查内容不能为空!");
+          return;
+        }
+        update(this.formData).then((v) => {
+          this.formData = this.reset();
+          this.dialogVisible = false;
+          this.$emit("success");
+        });
       });
     },
     onclose() {

+ 1 - 1
src/views/safetycheck/ruleManager/index.vue

@@ -81,7 +81,7 @@
               >新 增</el-button
             >
             <!-- <el-button
-              type="primary"
+              type="primary".
               @click="onSelect()"
               >选择</el-button
             > -->