戴艳蓉 3 years ago
parent
commit
f54ff93e85

File diff suppressed because it is too large
+ 0 - 0
dist/static/js/0.js


+ 8 - 6
src/views/goodStore/goodsCost/columns.js

@@ -117,21 +117,23 @@ const listCol = [
   },
 ]
 const validate_num = (rule, value, callback) => {
-  if (value === "") {
+  const { required } = rule
+  if (required && value === "") {
     callback(new Error("不能为空!"));
   } else {
     callback();
   }
 };
 const validate_num_0 = (rule, value, callback) => {
-  if (value === "") {
+  const { required } = rule
+  if (required && value === "") {
     callback(new Error("不能为空!"));
-  } else if (value === "0" ||
+  } else if (required && (value === "0" ||
     value === "0." ||
     value === "0.0" ||
     value === "0.00" ||
     value === "0.000"
-  ) {
+  )) {
     callback(new Error("不能为零!"));
   } else {
     callback();
@@ -251,14 +253,14 @@ const rules = {
   moq: [
     {
       required: true,
-      validator: validate_num_0,
+      validator: validate_num,
       trigger: "blur",
     },
   ],
   customized: [
     {
       required: true,
-      validator: validate_num_0,
+      validator: validate_num,
       trigger: "blur",
     },
   ],

+ 15 - 9
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -1129,7 +1129,7 @@ export default {
       this.resetFormData();
       this.rulesThis = this.rules;
       await this.resetForm();
-
+      this.good_type_change();
       this.loading = false;
     },
     number_change(e, key) {
@@ -1153,6 +1153,8 @@ export default {
       this.ladder_tableData.splice(index, 1);
     },
     async submitForm() {
+      this.sch_is_noble();
+      this.good_type_change();
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
           this.loading = true;
@@ -1242,6 +1244,7 @@ export default {
             this.$emit("refresh", { spuCode: spuCode });
           }
         } else {
+          console.log(valid);
           console.log("error submit!!");
           return false;
         }
@@ -1557,11 +1560,11 @@ export default {
               }
             });
           }
-          let exclusiveList=[]
-          if(exclusive&&exclusive.length>0){
-            exclusive.forEach((a,ai)=>{
-              exclusiveList.push(a.id)
-            })
+          let exclusiveList = [];
+          if (exclusive && exclusive.length > 0) {
+            exclusive.forEach((a, ai) => {
+              exclusiveList.push(a.id);
+            });
           }
           this.is_noble = isok;
           this.sch_is_noble();
@@ -1656,7 +1659,6 @@ export default {
             config: config ? config.split(",") : [],
             other_config: other_config || "",
           };
-          this.good_type_change();
         }
       });
     },
@@ -1670,7 +1672,9 @@ export default {
         "other_config",
       ];
       for (let i = 0; i < list.length; i++) {
-        this.rulesThis[list[i]].required = this.is_noble;
+        this.rulesThis[list[i]][0].required = this.is_noble;
+        console.log(list[i] + "===" + this.rulesThis[list[i]][0].required);
+        this.$refs.ruleForm.validateField(list[i]);
       }
     },
     setModel(model, type) {
@@ -1847,7 +1851,9 @@ export default {
     good_type_change() {
       let list = ["moq", "customized"];
       for (let i = 0; i < list.length; i++) {
-        this.rulesThis[list[i]].required = this.ruleForm.good_type === "1";
+        this.rulesThis[list[i]][0].required = this.ruleForm.good_type === "1";
+        console.log(list[i] + "===" + this.rulesThis[list[i]][0].required);
+        this.$refs.ruleForm.validateField(list[i]);
       }
     },
     //图片上传失败

Some files were not shown because too many files changed in this diff