Explorar el Código

feat(modal.config): 增加号段、区号、城市必填及格式验证

闪电 hace 11 meses
padre
commit
4c5cb78186
Se han modificado 1 ficheros con 15 adiciones y 2 borrados
  1. 15 2
      src/views/main/telephone/mobile/config/modal.config.js

+ 15 - 2
src/views/main/telephone/mobile/config/modal.config.js

@@ -4,18 +4,31 @@ export const modalConfig = {
4 4
       field: 'mobilePrefix',
5 5
       type: 'input',
6 6
       label: '号段',
7
-      placeholder: '请输入号段'
7
+      required: true,
8
+      placeholder: '请输入号段',
9
+      rules:[{validator:(rule,value,callback)=>{
10
+        const reg = /^1\d{6}$/
11
+          
12
+        if(reg.test(value)) {
13
+          callback()
14
+        }else{
15
+          callback(new Error('请输入正确的格式'))
16
+        }
17
+      }
18
+    }]
8 19
     },
9 20
     {
10 21
       field: 'locationCode',
11 22
       type: 'input',
12 23
       label: '区号',
24
+      required: true,
13 25
       placeholder: '请输入区号'
14 26
     },
15 27
     {
16 28
       field: 'locationName',
17 29
       type: 'input',
18 30
       label: '城市',
31
+      required: true,
19 32
       placeholder: '城市'
20 33
     },
21 34
     {
@@ -26,5 +39,5 @@ export const modalConfig = {
26 39
     },
27 40
   ],
28 41
   colLayout: { span: 24 },
29
-  itemStyle: {}
42
+  itemStyle: {},
30 43
 }