فهرست منبع

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

zhujindu 2 ماه پیش
والد
کامیت
d26b29e224
1فایلهای تغییر یافته به همراه9 افزوده شده و 5 حذف شده
  1. 9 5
      src/views/deviceWithin/addStoreVisit.vue

+ 9 - 5
src/views/deviceWithin/addStoreVisit.vue

@@ -3578,15 +3578,18 @@ export default {
     },
     numberFn(val, index, type) {
       let value = this.collectionItemList[index].answerValue;
-      if (value && !/^[+-]?\d*\.{0,1}\d{0,1}$/.test(value)) {
-        value = this.collectionItemList[index].answerValue.replace(
-          /\.\d{2,}$/,
-          value.substr(value.indexOf('.'), 3)
-        );
+      if (value) {
+        if (!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(value)) {
+          value = this.collectionItemList[index].answerValue.replace(
+            /\.\d{2,}$/,
+            value.substr(value.indexOf('.'), 3)
+          );
+        }
         // 最大值
         let maxValue = this.collectionItemList[index].collectionOptionList[0].maxValue;
         if (maxValue) {
           if (value > maxValue) {
+            this.collectionItemList[index].answerValue = value.slice(0, -1);
             this.$toast(this.collectionItemList[index].collectionName + '输入内容不合法');
           }
         }
@@ -3594,6 +3597,7 @@ export default {
         let minValue = this.collectionItemList[index].collectionOptionList[0].minValue;
         if (minValue) {
           if (value < minValue) {
+            this.collectionItemList[index].answerValue = minValue;
             this.$toast(this.collectionItemList[index].collectionName + '输入内容不合法');
           }
         }