فهرست منبع

Merge branch 'feature_20250926_数字题型&单行文本题型'

sunny 3 هفته پیش
والد
کامیت
b60cf614f0
1فایلهای تغییر یافته به همراه22 افزوده شده و 2 حذف شده
  1. 22 2
      src/views/deviceWithin/addStoreVisit.vue

+ 22 - 2
src/views/deviceWithin/addStoreVisit.vue

@@ -4407,7 +4407,7 @@ export default {
       this.$set(itemData, 'answerValue', value);
       if (value) {
         // 最大值
-        let maxValue = item.collectionOptionList[0].maxValue;
+        let maxValue = item.collectionOptionList[0].maxValue.toString();
         if (maxValue && maxValue != '') {
           if (value > Number(maxValue)) {
             this.$set(itemData, 'ruleMessage', '最大值为:' + maxValue);
@@ -4418,7 +4418,7 @@ export default {
           }
         }
         //最小值
-        let minValue = item.collectionOptionList[0].minValue;
+        let minValue = item.collectionOptionList[0].minValue.toString();
         if (minValue && minValue != '') {
           if (value < Number(minValue)) {
             this.$set(itemData, 'ruleMessage', '最小值为:' + minValue);
@@ -5666,6 +5666,24 @@ export default {
         }
       }
     },
+    // 递归遍历所有表单项
+    traverseCollectionItems(items) {
+      // 处理一层子项(如果有)
+      if (items.collectionOptionList && items.collectionOptionList.length > 0) {
+        if(items.answerValue == items.collectionOptionList[0].collectionOptionId ){
+          items.collectionOptionList.forEach((item) => {
+            // 处理二层子项(如果有)
+            if (item.collectionItems && item.collectionItems.length > 0) {
+              item.collectionItems.forEach((option) => {
+                this.filterCollectionInfos(option);
+                this.traverseCollectionItems(option);
+              });
+            }
+          });
+        }
+        
+      }
+    },
     onSubmit() {
       this.validatorFlag = true;
       var checkUnManage = 'Y';
@@ -5707,6 +5725,8 @@ 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');
+          const collectionItem = this.collectionItemList[b];
+          this.traverseCollectionItems(collectionItem);
           if (
             this.collectionItemList[b].answerType == 'sz' ||
             this.collectionItemList[b].answerType == 'sm' ||