Pārlūkot izejas kodu

feature_20251014_客资开户输入框限制

zhujindu 1 mēnesi atpakaļ
vecāks
revīzija
af06f797ea
2 mainītis faili ar 20 papildinājumiem un 2 dzēšanām
  1. 2 1
      src/mixin/clew.js
  2. 18 1
      src/views/clew/complaintDetail/radioGroup.vue

+ 2 - 1
src/mixin/clew.js

@@ -105,7 +105,8 @@ export const clewMixins = {
                 // 输入内容长度校验
                 if (optionList[i].answerValue.length < optionList[i].minTextLength) {
                   this.requiredFlag = false;
-                  this.requiredMessage = optionList[i].remark;
+                  this.requiredMessage =
+                    optionList[i].customerClueName + '长度必须等于' + optionList[i].minTextLength;
                   return;
                 }
               }

+ 18 - 1
src/views/clew/complaintDetail/radioGroup.vue

@@ -70,11 +70,23 @@
           {{ val.customerClueName }}
         </div>
         <van-field
+          v-if="
+            val.customerClueName.indexOf('开户门店代码') != -1 ||
+            val.customerClueName.indexOf('开户经销商代码') != -1
+          "
+          class="fieldInput"
+          v-model="val.answerValue"
+          :placeholder="val.remark"
+          maxlength="10"
+          :minTextLength="val.minTextLength"
+          type="digit"
+          @focus="inputFocus(val)"></van-field>
+        <van-field
+          v-else
           class="fieldInput"
           v-model="val.answerValue"
           :placeholder="val.remark"
           :minTextLength="val.minTextLength"
-          :error-message="val.remark"
           type="number"></van-field>
       </template>
       <!-- 照片 -->
@@ -248,6 +260,11 @@ export default {
       val.itemData.fileInfoList.splice(val.index, 1);
       this.setFileIdList(val);
     },
+    // 设置输入框长度限制
+    inputFocus(val) {
+      if (val.minTextLength) return;
+      this.$set(val, 'minTextLength', 10);
+    },
   },
 };
 </script>