xiaodai2022 2 years ago
parent
commit
88d550c3f4

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


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


+ 2 - 2
src/utils/validate.js

@@ -396,9 +396,9 @@ export function accMul(arg1, arg2) {
 }
 
 export function isSpecialSymbol(s) {
-  console.log(s);
+  // console.log(s);
   const str = (s ?? "").replace(/\\|\/|\*|\"|\'|\<|\>|\{|\}|\[|\]|\:|\.|\^|\$|\!|\~|\`|\|/g, "");
-  console.log(str);
+  // console.log(str);
   const pattern = new RegExp("[`~!@#$^&*()=|{}':;',.<>/?]");
   let specialStr = "";
   for (let i = 0; i < str.length; i++) {

+ 22 - 13
src/views/purchaseIn/workbench/columns.js

@@ -112,33 +112,42 @@ const listCol = [
 ];
 
 const validate_num = (rule, value, callback) => {
+  const { required } = rule;
+  if (required) {
   if (value === "") {
     callback(new Error("不能为空!"));
   } else {
     callback();
+  }}else{
+    callback();
   }
 };
 const validate_num_0 = (rule, value, callback) => {
-  if (value === "") {
-    callback(new Error("不能为空!"));
-  } else if (
-    value === "0" ||
-    value === "0." ||
-    value === "0.0" ||
-    value === "0.00" ||
-    value === "0.000"
-  ) {
-    callback(new Error("不能为零!"));
+  const { required } = rule;
+  if (required) {
+    if (value === "") {
+      callback(new Error("不能为空!"));
+    } else if (
+      value === "0" ||
+      value === "0." ||
+      value === "0.0" ||
+      value === "0.00" ||
+      value === "0.000"
+    ) {
+      callback(new Error("不能为零!"));
+    } else {
+      callback();
+    }
   } else {
     callback();
   }
 };
 const validate_desc = (rule, value, callback) => {
   const { required } = rule;
-  console.log(required, value);
-  if (required && value === "") {
+  let str = value ?? "";
+  if (required && str === "") {
     callback(new Error("不能为空!"));
-  } else if (value.length > 0 && isSpecialSymbol(value)) {
+  } else if (isSpecialSymbol(str)) {
     callback(new Error("不能使用英文特殊字符!"));
   } else {
     callback();

+ 13 - 5
src/views/purchaseIn/workbench/components/baseForm.vue

@@ -2,7 +2,7 @@
   <el-form
     :model="ruleForm"
     status-icon
-    :rules="rulesThis"
+    :rules="rules"
     ref="ruleForm"
     :size="'mini'"
     v-loading="loading"
@@ -816,7 +816,7 @@ export default {
       this.setrules();
       this.loading = false;
     },
-
+    //计算价格
     computedCost() {
       const { num } = this.askItem;
       const {
@@ -982,7 +982,15 @@ export default {
         this.$message.warning("上传图片不能超过10张");
         return;
       }
+
+      // for (let key in this.ruleForm) {
+      //   console.log(this.rulesThis[key]);
+      //   console.log(
+      //     key + "---" + this.rulesThis[key][0].required + "-----" + this.ruleForm[key]
+      //   );
+      // }
       await this.$refs.ruleForm.validate(async (valid) => {
+        console.log(valid);
         if (valid) {
           if (!this.loading) {
             this.loading = true;
@@ -1049,7 +1057,7 @@ export default {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
           this.spec_tableData = [];
-          console.log(this.askItem);
+          // console.log(this.askItem);
           this.is_noble = false;
           const { can_id_arr, is_gold_price } = this.askItem;
           can_id_arr.forEach((e, index) => {
@@ -1159,11 +1167,11 @@ export default {
     setrules() {
       let list1 = ["noble_weight", "is_gold_price", "is_diff"];
       for (let i = 0; i < list1.length; i++) {
-        this.rules[list1[i]][0].required = this.is_noble;
+        this.rulesThis[list1[i]][0].required = this.is_noble;
       }
       let list2 = ["metal_id", "config", "other_config"];
       for (let i = 0; i < list2.length; i++) {
-        this.rules[list2[i]][0].required = this.pid === "6";
+        this.rulesThis[list2[i]][0].required = this.pid === "6";
       }
     },
     is_gold_price_change() {

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