瀏覽代碼

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

闪电 11 月之前
父節點
當前提交
4c5cb78186
共有 1 個文件被更改,包括 15 次插入2 次删除
  1. 15 2
      src/views/main/telephone/mobile/config/modal.config.js

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

4
       field: 'mobilePrefix',
4
       field: 'mobilePrefix',
5
       type: 'input',
5
       type: 'input',
6
       label: '号段',
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
       field: 'locationCode',
21
       field: 'locationCode',
11
       type: 'input',
22
       type: 'input',
12
       label: '区号',
23
       label: '区号',
24
+      required: true,
13
       placeholder: '请输入区号'
25
       placeholder: '请输入区号'
14
     },
26
     },
15
     {
27
     {
16
       field: 'locationName',
28
       field: 'locationName',
17
       type: 'input',
29
       type: 'input',
18
       label: '城市',
30
       label: '城市',
31
+      required: true,
19
       placeholder: '城市'
32
       placeholder: '城市'
20
     },
33
     },
21
     {
34
     {
26
     },
39
     },
27
   ],
40
   ],
28
   colLayout: { span: 24 },
41
   colLayout: { span: 24 },
29
-  itemStyle: {}
42
+  itemStyle: {},
30
 }
43
 }