Prechádzať zdrojové kódy

feature_20250926_数字题型&单行文本题型

zhujindu 1 mesiac pred
rodič
commit
6f67236abd
1 zmenil súbory, kde vykonal 71 pridanie a 40 odobranie
  1. 71 40
      src/views/deviceWithin/addStoreVisit.vue

+ 71 - 40
src/views/deviceWithin/addStoreVisit.vue

@@ -3997,22 +3997,24 @@ export default {
         let maxValue = item.collectionOptionList[0].maxValue;
         if (maxValue && maxValue != '') {
           if (value > Number(maxValue)) {
-            this.$set(itemData, 'ruleMessage', '最大输入值为:' + maxValue);
-            this.$set(itemData, 'answerValue', '');
-            this.$toast('输入内容不合法');
+            this.$set(itemData, 'ruleMessage', '最大值为:' + maxValue);
+            // this.$set(itemData, 'answerValue', '');
+            // this.$toast('输入内容不合法');
+            return;
           }
         }
         //最小值
         let minValue = item.collectionOptionList[0].minValue;
         if (minValue && minValue != '') {
           if (value < Number(minValue)) {
-            this.$set(itemData, 'ruleMessage', '最小输入值为:' + minValue);
-            this.$set(itemData, 'answerValue', '');
-            this.$toast('输入内容不合法');
+            this.$set(itemData, 'ruleMessage', '最小值为:' + minValue);
+            // this.$set(itemData, 'answerValue', '');
+            // this.$toast('输入内容不合法');
+            return;
           }
         }
       } else {
-        this.$set(itemData, 'ruleMessage', '请输入数字');
+        // this.$set(itemData, 'ruleMessage', '请输入数字');
       }
     },
     // dhwb 单行文本校验
@@ -4033,9 +4035,9 @@ export default {
         let maxValue = item.collectionOptionList[0].maxValue;
         if (maxValue && maxValue != '') {
           if (value.length > Number(maxValue)) {
-            this.$set(itemData, 'answerValue', '');
-            this.$set(itemData, 'ruleMessage', '最大输入值为:' + maxValue);
-            this.$toast('输入内容不合法');
+            // this.$set(itemData, 'answerValue', '');
+            this.$set(itemData, 'ruleMessage', '最大字数为:' + maxValue);
+            // this.$toast('输入内容不合法');
             return;
           }
         }
@@ -4043,9 +4045,9 @@ export default {
         let minValue = item.collectionOptionList[0].minValue;
         if (minValue && minValue != '') {
           if (value.length < Number(minValue)) {
-            this.$set(itemData, 'answerValue', '');
-            this.$set(itemData, 'ruleMessage', '最小输入值为:' + minValue);
-            this.$toast('输入内容不合法');
+            // this.$set(itemData, 'answerValue', '');
+            this.$set(itemData, 'ruleMessage', '最小字数为:' + minValue);
+            // this.$toast('输入内容不合法');
             return;
           }
         }
@@ -4053,15 +4055,15 @@ export default {
         let leastOneChinese = item.collectionOptionList[0].leastOneChinese;
         if (leastOneChinese == '1') {
           if (!/[\u4e00-\u9fa5]/.test(value)) {
-            this.$set(itemData, 'answerValue', '');
+            // this.$set(itemData, 'answerValue', '');
             this.$set(itemData, 'ruleMessage', '至少有一个汉字');
-            this.$toast('输入内容不合法,至少有一个汉字');
+            // this.$toast('输入内容不合法,至少有一个汉字');
             return;
           }
         }
         this.$set(itemData, 'ruleMessage', '');
       } else {
-        this.$set(itemData, 'ruleMessage', '请输入至少有一个汉字');
+        // this.$set(itemData, 'ruleMessage', '请输入至少有一个汉字');
       }
     },
     // 且只可输入:汉字、数字、字母、标点符号, 特殊字符:空格、换行、表情等不可输入
@@ -4201,14 +4203,14 @@ export default {
                 }
               }
             }
-            // dhwb 初始化内容校验
-            if (collectionItemLists[q].answerType == 'dhwb') {
-              this.DHWBsizeComparison(collectionItemLists[q], 'A');
-            }
-            // sz 初始化内容校验
-            if (collectionItemLists[q].answerType == 'sz') {
-              this.SZsizeComparison(collectionItemLists[q], 'A');
-            }
+            // // dhwb 初始化内容校验
+            // if (collectionItemLists[q].answerType == 'dhwb') {
+            //   this.DHWBsizeComparison(collectionItemLists[q], 'A');
+            // }
+            // // sz 初始化内容校验
+            // if (collectionItemLists[q].answerType == 'sz') {
+            //   this.SZsizeComparison(collectionItemLists[q], 'A');
+            // }
             if (
               collectionItemLists[q].answerType == 'duox' ||
               collectionItemLists[q].answerType == 'dx'
@@ -4245,14 +4247,14 @@ export default {
                           listchild[qq1].answerValue = '';
                         }
                       }
-                      // dhwb 初始化内容校验
-                      if (listchild[qq1].answerType == 'dhwb') {
-                        this.DHWBsizeComparison(listchild[qq1]);
-                      }
-                      // sz 初始化内容校验
-                      if (listchild[qq1].answerType == 'sz') {
-                        this.SZsizeComparison(listchild[qq1]);
-                      }
+                      // // dhwb 初始化内容校验
+                      // if (listchild[qq1].answerType == 'dhwb') {
+                      //   this.DHWBsizeComparison(listchild[qq1]);
+                      // }
+                      // // sz 初始化内容校验
+                      // if (listchild[qq1].answerType == 'sz') {
+                      //   this.SZsizeComparison(listchild[qq1]);
+                      // }
                       if (listchild[qq1].answerType == 'sm') {
                         listchild[qq1].success = false;
                         if (listchild[qq1].collectionOptionList[0].answerValue != null) {
@@ -4393,14 +4395,14 @@ export default {
                                   list3[l3].collectionItems[l3q].answerValue = '';
                                 }
                               }
-                              // dhwb 初始化内容校验
-                              if (list3[l3].collectionItems[l3q].answerType == 'dhwb') {
-                                this.DHWBsizeComparison(list3[l3].collectionItems[l3q]);
-                              }
-                              // sz 初始化内容校验
-                              if (list3[l3].collectionItems[l3q].answerType == 'sz') {
-                                this.SZsizeComparison(list3[l3].collectionItems[l3q]);
-                              }
+                              // // dhwb 初始化内容校验
+                              // if (list3[l3].collectionItems[l3q].answerType == 'dhwb') {
+                              //   this.DHWBsizeComparison(list3[l3].collectionItems[l3q]);
+                              // }
+                              // // sz 初始化内容校验
+                              // if (list3[l3].collectionItems[l3q].answerType == 'sz') {
+                              //   this.SZsizeComparison(list3[l3].collectionItems[l3q]);
+                              // }
                             }
                           }
                           // console.log(list3[l3])
@@ -5117,6 +5119,25 @@ export default {
         }
       }
     },
+    filterCollectionInfos(collectionItemList, type) {
+      if (
+        (collectionItemList.answerType == 'dx' || collectionItemList.answerType == 'duox') &&
+        collectionItemList.collectionOptionList
+      ) {
+        for (let x = 0; x < collectionItemList.collectionOptionList.length; x++) {
+          this.filterCollectionInfos(collectionItemList.collectionOptionList[x]);
+        }
+      } else {
+        // dhwb 初始化内容校验
+        if (collectionItemList.answerType == 'dhwb') {
+          this.DHWBsizeComparison(collectionItemList, type);
+        }
+        // sz 初始化内容校验
+        if (collectionItemList.answerType == 'sz') {
+          this.SZsizeComparison(collectionItemList, type);
+        }
+      }
+    },
     onSubmit() {
       var checkUnManage = 'Y';
       var formData = {};
@@ -5155,6 +5176,7 @@ export default {
 
       if (this.$route.query.taskType == 1 || this.$route.query.taskType == 4) {
         for (var b = 0; b < this.collectionItemList.length; b++) {
+          this.filterCollectionInfos(this.collectionItemList[b], 'A');
           if (
             this.collectionItemList[b].answerType == 'sz' ||
             this.collectionItemList[b].answerType == 'sm' ||
@@ -5204,6 +5226,14 @@ export default {
               }
             });
           }
+          // // dhwb 初始化内容校验
+          // if (this.collectionItemList[b].answerType == 'dhwb') {
+          //   this.DHWBsizeComparison(this.collectionItemList[b], 'A');
+          // }
+          // // sz 初始化内容校验
+          // if (this.collectionItemList[b].answerType == 'sz') {
+          //   this.SZsizeComparison(this.collectionItemList[b], 'A');
+          // }
         }
         for (let f = 0; f < this.collectionItemList.length; f++) {
           if (this.collectionItemList[f].answerType == 'dx') {
@@ -5635,6 +5665,7 @@ export default {
           }
         }
       }
+      return;
       // 调色机扫码是否正确
       if (!this.filterFormData(formData)) {
         this.$dialog.alert({