Showing
36 changed files
with
1868 additions
and
103 deletions
@@ -8,10 +8,10 @@ VITE_PUBLIC_PATH = / | @@ -8,10 +8,10 @@ VITE_PUBLIC_PATH = / | ||
8 | # Please note that no line breaks | 8 | # Please note that no line breaks |
9 | 9 | ||
10 | # 本地 | 10 | # 本地 |
11 | -VITE_PROXY = [["/api","http://localhost:8080/api"]] | 11 | +# VITE_PROXY = [["/api","http://localhost:8080/api"]] |
12 | 12 | ||
13 | # 线上 | 13 | # 线上 |
14 | -#VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | 14 | +VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] |
15 | 15 | ||
16 | # 实时数据的ws地址 | 16 | # 实时数据的ws地址 |
17 | VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= | 17 | VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= |
@@ -122,7 +122,7 @@ | @@ -122,7 +122,7 @@ | ||
122 | export default defineComponent({ | 122 | export default defineComponent({ |
123 | name: 'index', | 123 | name: 'index', |
124 | components: { BasicModal, BasicForm, Description, Upload, PlusOutlined }, | 124 | components: { BasicModal, BasicForm, Description, Upload, PlusOutlined }, |
125 | - emits: ['refreshPersonl'], | 125 | + emits: ['refreshPersonl', 'register'], |
126 | setup(_, { emit }) { | 126 | setup(_, { emit }) { |
127 | const userInfo = getAuthCache(USER_INFO_KEY); | 127 | const userInfo = getAuthCache(USER_INFO_KEY); |
128 | const { createMessage } = useMessage(); | 128 | const { createMessage } = useMessage(); |
@@ -33,6 +33,23 @@ export const alarmSearchSchemas: FormSchema[] = [ | @@ -33,6 +33,23 @@ export const alarmSearchSchemas: FormSchema[] = [ | ||
33 | label: '告警类型', | 33 | label: '告警类型', |
34 | component: 'Input', | 34 | component: 'Input', |
35 | colProps: { span: 6 }, | 35 | colProps: { span: 6 }, |
36 | + componentProps: { | ||
37 | + maxLength: 255, | ||
38 | + placeholder: '请输入告警类型', | ||
39 | + }, | ||
40 | + dynamicRules: () => { | ||
41 | + return [ | ||
42 | + { | ||
43 | + required: false, | ||
44 | + validator: (_, value) => { | ||
45 | + if (String(value).length > 255) { | ||
46 | + return Promise.reject('字数不超过255个字'); | ||
47 | + } | ||
48 | + return Promise.resolve(); | ||
49 | + }, | ||
50 | + }, | ||
51 | + ]; | ||
52 | + }, | ||
36 | }, | 53 | }, |
37 | { | 54 | { |
38 | field: 'endTime', | 55 | field: 'endTime', |
@@ -5,7 +5,6 @@ import { getOrganizationList } from '/@/api/system/system'; | @@ -5,7 +5,6 @@ import { getOrganizationList } from '/@/api/system/system'; | ||
5 | import { copyTransFun } from '/@/utils/fnUtils'; | 5 | import { copyTransFun } from '/@/utils/fnUtils'; |
6 | import { | 6 | import { |
7 | DeviceNameMaxLength, | 7 | DeviceNameMaxLength, |
8 | - DeviceUserNameMaxLength, | ||
9 | DeviceProfileIdMaxLength, | 8 | DeviceProfileIdMaxLength, |
10 | DeviceOrgIdMaxLength, | 9 | DeviceOrgIdMaxLength, |
11 | } from '/@/utils/rules'; | 10 | } from '/@/utils/rules'; |
@@ -76,6 +75,20 @@ export const step1Schemas: FormSchema[] = [ | @@ -76,6 +75,20 @@ export const step1Schemas: FormSchema[] = [ | ||
76 | component: 'Input', | 75 | component: 'Input', |
77 | componentProps: { | 76 | componentProps: { |
78 | maxLength: 255, | 77 | maxLength: 255, |
78 | + placeholder: '请输入设备标签', | ||
79 | + }, | ||
80 | + dynamicRules: () => { | ||
81 | + return [ | ||
82 | + { | ||
83 | + required: false, | ||
84 | + validator: (_, value) => { | ||
85 | + if (String(value).length > 255) { | ||
86 | + return Promise.reject('字数不超过255个字'); | ||
87 | + } | ||
88 | + return Promise.resolve(); | ||
89 | + }, | ||
90 | + }, | ||
91 | + ]; | ||
79 | }, | 92 | }, |
80 | }, | 93 | }, |
81 | { | 94 | { |
@@ -90,6 +103,20 @@ export const step1Schemas: FormSchema[] = [ | @@ -90,6 +103,20 @@ export const step1Schemas: FormSchema[] = [ | ||
90 | component: 'InputTextArea', | 103 | component: 'InputTextArea', |
91 | componentProps: { | 104 | componentProps: { |
92 | maxLength: 500, | 105 | maxLength: 500, |
106 | + placeholder: '请输入备注', | ||
107 | + }, | ||
108 | + dynamicRules: () => { | ||
109 | + return [ | ||
110 | + { | ||
111 | + required: false, | ||
112 | + validator: (_, value) => { | ||
113 | + if (String(value).length > 500) { | ||
114 | + return Promise.reject('字数不超过500个字'); | ||
115 | + } | ||
116 | + return Promise.resolve(); | ||
117 | + }, | ||
118 | + }, | ||
119 | + ]; | ||
93 | }, | 120 | }, |
94 | }, | 121 | }, |
95 | { | 122 | { |
@@ -99,6 +126,20 @@ export const step1Schemas: FormSchema[] = [ | @@ -99,6 +126,20 @@ export const step1Schemas: FormSchema[] = [ | ||
99 | show: false, | 126 | show: false, |
100 | componentProps: { | 127 | componentProps: { |
101 | maxLength: 36, | 128 | maxLength: 36, |
129 | + placeholder: '请输入id', | ||
130 | + }, | ||
131 | + dynamicRules: () => { | ||
132 | + return [ | ||
133 | + { | ||
134 | + required: false, | ||
135 | + validator: (_, value) => { | ||
136 | + if (String(value).length > 36) { | ||
137 | + return Promise.reject('字数不超过36个字'); | ||
138 | + } | ||
139 | + return Promise.resolve(); | ||
140 | + }, | ||
141 | + }, | ||
142 | + ]; | ||
102 | }, | 143 | }, |
103 | }, | 144 | }, |
104 | { | 145 | { |
@@ -108,6 +149,20 @@ export const step1Schemas: FormSchema[] = [ | @@ -108,6 +149,20 @@ export const step1Schemas: FormSchema[] = [ | ||
108 | show: false, | 149 | show: false, |
109 | componentProps: { | 150 | componentProps: { |
110 | maxLength: 36, | 151 | maxLength: 36, |
152 | + placeholder: '请输入租户Code', | ||
153 | + }, | ||
154 | + dynamicRules: () => { | ||
155 | + return [ | ||
156 | + { | ||
157 | + required: false, | ||
158 | + validator: (_, value) => { | ||
159 | + if (String(value).length > 36) { | ||
160 | + return Promise.reject('字数不超过36个字'); | ||
161 | + } | ||
162 | + return Promise.resolve(); | ||
163 | + }, | ||
164 | + }, | ||
165 | + ]; | ||
111 | }, | 166 | }, |
112 | }, | 167 | }, |
113 | { | 168 | { |
@@ -117,6 +172,20 @@ export const step1Schemas: FormSchema[] = [ | @@ -117,6 +172,20 @@ export const step1Schemas: FormSchema[] = [ | ||
117 | show: false, | 172 | show: false, |
118 | componentProps: { | 173 | componentProps: { |
119 | maxLength: 36, | 174 | maxLength: 36, |
175 | + placeholder: '请输入tbDeviceId', | ||
176 | + }, | ||
177 | + dynamicRules: () => { | ||
178 | + return [ | ||
179 | + { | ||
180 | + required: false, | ||
181 | + validator: (_, value) => { | ||
182 | + if (String(value).length > 36) { | ||
183 | + return Promise.reject('字数不超过36个字'); | ||
184 | + } | ||
185 | + return Promise.resolve(); | ||
186 | + }, | ||
187 | + }, | ||
188 | + ]; | ||
120 | }, | 189 | }, |
121 | }, | 190 | }, |
122 | ]; | 191 | ]; |
@@ -269,7 +338,21 @@ export const step2Schemas: FormSchema[] = [ | @@ -269,7 +338,21 @@ export const step2Schemas: FormSchema[] = [ | ||
269 | required: true, | 338 | required: true, |
270 | ifShow: false, | 339 | ifShow: false, |
271 | componentProps: { | 340 | componentProps: { |
272 | - maxLength: 0, | 341 | + maxLength: 36, |
342 | + placeholder: '请输入访问令牌', | ||
343 | + }, | ||
344 | + dynamicRules: () => { | ||
345 | + return [ | ||
346 | + { | ||
347 | + required: true, | ||
348 | + validator: (_, value) => { | ||
349 | + if (String(value).length > 36) { | ||
350 | + return Promise.reject('字数不超过36个字'); | ||
351 | + } | ||
352 | + return Promise.resolve(); | ||
353 | + }, | ||
354 | + }, | ||
355 | + ]; | ||
273 | }, | 356 | }, |
274 | }, | 357 | }, |
275 | { | 358 | { |
@@ -280,6 +363,20 @@ export const step2Schemas: FormSchema[] = [ | @@ -280,6 +363,20 @@ export const step2Schemas: FormSchema[] = [ | ||
280 | ifShow: false, | 363 | ifShow: false, |
281 | componentProps: { | 364 | componentProps: { |
282 | maxLength: 36, | 365 | maxLength: 36, |
366 | + placeholder: '请输入RSA公钥', | ||
367 | + }, | ||
368 | + dynamicRules: () => { | ||
369 | + return [ | ||
370 | + { | ||
371 | + required: true, | ||
372 | + validator: (_, value) => { | ||
373 | + if (String(value).length > 36) { | ||
374 | + return Promise.reject('字数不超过36个字'); | ||
375 | + } | ||
376 | + return Promise.resolve(); | ||
377 | + }, | ||
378 | + }, | ||
379 | + ]; | ||
283 | }, | 380 | }, |
284 | }, | 381 | }, |
285 | { | 382 | { |
@@ -290,6 +387,20 @@ export const step2Schemas: FormSchema[] = [ | @@ -290,6 +387,20 @@ export const step2Schemas: FormSchema[] = [ | ||
290 | ifShow: false, | 387 | ifShow: false, |
291 | componentProps: { | 388 | componentProps: { |
292 | maxLength: 36, | 389 | maxLength: 36, |
390 | + placeholder: '请输入客户端ID', | ||
391 | + }, | ||
392 | + dynamicRules: () => { | ||
393 | + return [ | ||
394 | + { | ||
395 | + required: true, | ||
396 | + validator: (_, value) => { | ||
397 | + if (String(value).length > 36) { | ||
398 | + return Promise.reject('字数不超过36个字'); | ||
399 | + } | ||
400 | + return Promise.resolve(); | ||
401 | + }, | ||
402 | + }, | ||
403 | + ]; | ||
293 | }, | 404 | }, |
294 | }, | 405 | }, |
295 | { | 406 | { |
@@ -297,10 +408,23 @@ export const step2Schemas: FormSchema[] = [ | @@ -297,10 +408,23 @@ export const step2Schemas: FormSchema[] = [ | ||
297 | component: 'Input', | 408 | component: 'Input', |
298 | field: 'username', | 409 | field: 'username', |
299 | required: true, | 410 | required: true, |
300 | - rules: DeviceUserNameMaxLength, | ||
301 | ifShow: false, | 411 | ifShow: false, |
302 | componentProps: { | 412 | componentProps: { |
303 | maxLength: 255, | 413 | maxLength: 255, |
414 | + placeholder: '请输入用户名', | ||
415 | + }, | ||
416 | + dynamicRules: () => { | ||
417 | + return [ | ||
418 | + { | ||
419 | + required: true, | ||
420 | + validator: (_, value) => { | ||
421 | + if (String(value).length > 255) { | ||
422 | + return Promise.reject('字数不超过255个字'); | ||
423 | + } | ||
424 | + return Promise.resolve(); | ||
425 | + }, | ||
426 | + }, | ||
427 | + ]; | ||
304 | }, | 428 | }, |
305 | }, | 429 | }, |
306 | { | 430 | { |
@@ -309,6 +433,20 @@ export const step2Schemas: FormSchema[] = [ | @@ -309,6 +433,20 @@ export const step2Schemas: FormSchema[] = [ | ||
309 | field: 'password', | 433 | field: 'password', |
310 | componentProps: { | 434 | componentProps: { |
311 | maxLength: 36, | 435 | maxLength: 36, |
436 | + placeholder: '请输入密码', | ||
437 | + }, | ||
438 | + dynamicRules: () => { | ||
439 | + return [ | ||
440 | + { | ||
441 | + required: false, | ||
442 | + validator: (_, value) => { | ||
443 | + if (String(value).length > 36) { | ||
444 | + return Promise.reject('字数不超过36个字'); | ||
445 | + } | ||
446 | + return Promise.resolve(); | ||
447 | + }, | ||
448 | + }, | ||
449 | + ]; | ||
312 | }, | 450 | }, |
313 | ifShow: false, | 451 | ifShow: false, |
314 | }, | 452 | }, |
@@ -450,7 +588,21 @@ export const TokenSchemas: FormSchema[] = [ | @@ -450,7 +588,21 @@ export const TokenSchemas: FormSchema[] = [ | ||
450 | required: true, | 588 | required: true, |
451 | ifShow: false, | 589 | ifShow: false, |
452 | componentProps: { | 590 | componentProps: { |
453 | - maxLength: 0, | 591 | + maxLength: 36, |
592 | + placeholder: '请输入访问令牌', | ||
593 | + }, | ||
594 | + dynamicRules: () => { | ||
595 | + return [ | ||
596 | + { | ||
597 | + required: false, | ||
598 | + validator: (_, value) => { | ||
599 | + if (String(value).length > 36) { | ||
600 | + return Promise.reject('字数不超过36个字'); | ||
601 | + } | ||
602 | + return Promise.resolve(); | ||
603 | + }, | ||
604 | + }, | ||
605 | + ]; | ||
454 | }, | 606 | }, |
455 | }, | 607 | }, |
456 | { | 608 | { |
@@ -461,6 +613,20 @@ export const TokenSchemas: FormSchema[] = [ | @@ -461,6 +613,20 @@ export const TokenSchemas: FormSchema[] = [ | ||
461 | ifShow: false, | 613 | ifShow: false, |
462 | componentProps: { | 614 | componentProps: { |
463 | maxLength: 36, | 615 | maxLength: 36, |
616 | + placeholder: '请输入RSA公钥', | ||
617 | + }, | ||
618 | + dynamicRules: () => { | ||
619 | + return [ | ||
620 | + { | ||
621 | + required: true, | ||
622 | + validator: (_, value) => { | ||
623 | + if (String(value).length > 36) { | ||
624 | + return Promise.reject('字数不超过36个字'); | ||
625 | + } | ||
626 | + return Promise.resolve(); | ||
627 | + }, | ||
628 | + }, | ||
629 | + ]; | ||
464 | }, | 630 | }, |
465 | }, | 631 | }, |
466 | { | 632 | { |
@@ -471,6 +637,20 @@ export const TokenSchemas: FormSchema[] = [ | @@ -471,6 +637,20 @@ export const TokenSchemas: FormSchema[] = [ | ||
471 | ifShow: false, | 637 | ifShow: false, |
472 | componentProps: { | 638 | componentProps: { |
473 | maxLength: 36, | 639 | maxLength: 36, |
640 | + placeholder: '请输入客户端ID', | ||
641 | + }, | ||
642 | + dynamicRules: () => { | ||
643 | + return [ | ||
644 | + { | ||
645 | + required: true, | ||
646 | + validator: (_, value) => { | ||
647 | + if (String(value).length > 36) { | ||
648 | + return Promise.reject('字数不超过36个字'); | ||
649 | + } | ||
650 | + return Promise.resolve(); | ||
651 | + }, | ||
652 | + }, | ||
653 | + ]; | ||
474 | }, | 654 | }, |
475 | }, | 655 | }, |
476 | { | 656 | { |
@@ -479,9 +659,22 @@ export const TokenSchemas: FormSchema[] = [ | @@ -479,9 +659,22 @@ export const TokenSchemas: FormSchema[] = [ | ||
479 | field: 'username', | 659 | field: 'username', |
480 | required: true, | 660 | required: true, |
481 | ifShow: false, | 661 | ifShow: false, |
482 | - rules: DeviceUserNameMaxLength, | ||
483 | componentProps: { | 662 | componentProps: { |
484 | maxLength: 255, | 663 | maxLength: 255, |
664 | + placeholder: '请输入用户名', | ||
665 | + }, | ||
666 | + dynamicRules: () => { | ||
667 | + return [ | ||
668 | + { | ||
669 | + required: true, | ||
670 | + validator: (_, value) => { | ||
671 | + if (String(value).length > 255) { | ||
672 | + return Promise.reject('字数不超过255个字'); | ||
673 | + } | ||
674 | + return Promise.resolve(); | ||
675 | + }, | ||
676 | + }, | ||
677 | + ]; | ||
485 | }, | 678 | }, |
486 | }, | 679 | }, |
487 | { | 680 | { |
@@ -491,6 +684,20 @@ export const TokenSchemas: FormSchema[] = [ | @@ -491,6 +684,20 @@ export const TokenSchemas: FormSchema[] = [ | ||
491 | ifShow: false, | 684 | ifShow: false, |
492 | componentProps: { | 685 | componentProps: { |
493 | maxLength: 36, | 686 | maxLength: 36, |
687 | + placeholder: '请输入密码', | ||
688 | + }, | ||
689 | + dynamicRules: () => { | ||
690 | + return [ | ||
691 | + { | ||
692 | + required: false, | ||
693 | + validator: (_, value) => { | ||
694 | + if (String(value).length > 36) { | ||
695 | + return Promise.reject('字数不超过36个字'); | ||
696 | + } | ||
697 | + return Promise.resolve(); | ||
698 | + }, | ||
699 | + }, | ||
700 | + ]; | ||
494 | }, | 701 | }, |
495 | }, | 702 | }, |
496 | { | 703 | { |
@@ -500,6 +707,20 @@ export const TokenSchemas: FormSchema[] = [ | @@ -500,6 +707,20 @@ export const TokenSchemas: FormSchema[] = [ | ||
500 | show: false, | 707 | show: false, |
501 | componentProps: { | 708 | componentProps: { |
502 | maxLength: 36, | 709 | maxLength: 36, |
710 | + placeholder: '请输入id', | ||
711 | + }, | ||
712 | + dynamicRules: () => { | ||
713 | + return [ | ||
714 | + { | ||
715 | + required: false, | ||
716 | + validator: (_, value) => { | ||
717 | + if (String(value).length > 36) { | ||
718 | + return Promise.reject('字数不超过36个字'); | ||
719 | + } | ||
720 | + return Promise.resolve(); | ||
721 | + }, | ||
722 | + }, | ||
723 | + ]; | ||
503 | }, | 724 | }, |
504 | }, | 725 | }, |
505 | { | 726 | { |
@@ -509,6 +730,20 @@ export const TokenSchemas: FormSchema[] = [ | @@ -509,6 +730,20 @@ export const TokenSchemas: FormSchema[] = [ | ||
509 | show: false, | 730 | show: false, |
510 | componentProps: { | 731 | componentProps: { |
511 | maxLength: 36, | 732 | maxLength: 36, |
733 | + placeholder: '请输入tbDeviceId', | ||
734 | + }, | ||
735 | + dynamicRules: () => { | ||
736 | + return [ | ||
737 | + { | ||
738 | + required: false, | ||
739 | + validator: (_, value) => { | ||
740 | + if (String(value).length > 36) { | ||
741 | + return Promise.reject('字数不超过36个字'); | ||
742 | + } | ||
743 | + return Promise.resolve(); | ||
744 | + }, | ||
745 | + }, | ||
746 | + ]; | ||
512 | }, | 747 | }, |
513 | }, | 748 | }, |
514 | ]; | 749 | ]; |
@@ -2,7 +2,6 @@ import { formatToDate } from '/@/utils/dateUtil'; | @@ -2,7 +2,6 @@ import { formatToDate } from '/@/utils/dateUtil'; | ||
2 | import { BasicColumn } from '/@/components/Table'; | 2 | import { BasicColumn } from '/@/components/Table'; |
3 | import { FormSchema } from '/@/components/Table'; | 3 | import { FormSchema } from '/@/components/Table'; |
4 | import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; | 4 | import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; |
5 | -import { DeviceQueryUserNameMaxLength } from '/@/utils/rules'; | ||
6 | 5 | ||
7 | // 表格列数据 | 6 | // 表格列数据 |
8 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
@@ -87,9 +86,22 @@ export const searchFormSchema: FormSchema[] = [ | @@ -87,9 +86,22 @@ export const searchFormSchema: FormSchema[] = [ | ||
87 | label: '设备名称', | 86 | label: '设备名称', |
88 | component: 'Input', | 87 | component: 'Input', |
89 | colProps: { span: 7 }, | 88 | colProps: { span: 7 }, |
90 | - rules: DeviceQueryUserNameMaxLength, | ||
91 | componentProps: { | 89 | componentProps: { |
92 | maxLength: 255, | 90 | maxLength: 255, |
91 | + placeholder: '请输入设备名称', | ||
92 | + }, | ||
93 | + dynamicRules: () => { | ||
94 | + return [ | ||
95 | + { | ||
96 | + required: false, | ||
97 | + validator: (_, value) => { | ||
98 | + if (String(value).length > 255) { | ||
99 | + return Promise.reject('字数不超过255个字'); | ||
100 | + } | ||
101 | + return Promise.resolve(); | ||
102 | + }, | ||
103 | + }, | ||
104 | + ]; | ||
93 | }, | 105 | }, |
94 | }, | 106 | }, |
95 | ]; | 107 | ]; |
@@ -99,6 +99,7 @@ | @@ -99,6 +99,7 @@ | ||
99 | switch (current.value) { | 99 | switch (current.value) { |
100 | case 0: | 100 | case 0: |
101 | proxy.$refs.DeviceProfileStep1Ref.customResetFunc(); | 101 | proxy.$refs.DeviceProfileStep1Ref.customResetFunc(); |
102 | + proxy.$refs.DeviceProfileStep1Ref.resetIconFunc(); | ||
102 | break; | 103 | break; |
103 | case 1: | 104 | case 1: |
104 | proxy.$refs.DeviceProfileStep2Ref.customResetAndFunc(); | 105 | proxy.$refs.DeviceProfileStep2Ref.customResetAndFunc(); |
@@ -123,6 +124,7 @@ | @@ -123,6 +124,7 @@ | ||
123 | switch (current.value) { | 124 | switch (current.value) { |
124 | case 0: | 125 | case 0: |
125 | proxy.$refs.DeviceProfileStep1Ref.resetFieldsFunc(editEchoData.value); | 126 | proxy.$refs.DeviceProfileStep1Ref.resetFieldsFunc(editEchoData.value); |
127 | + proxy.$refs.DeviceProfileStep1Ref.editIconFunc(editEchoData.value.icon); | ||
126 | break; | 128 | break; |
127 | } | 129 | } |
128 | } | 130 | } |
@@ -130,9 +132,12 @@ | @@ -130,9 +132,12 @@ | ||
130 | function handleStepPrev() { | 132 | function handleStepPrev() { |
131 | current.value--; | 133 | current.value--; |
132 | } | 134 | } |
133 | - function handleStepNext1(v) { | 135 | + function handleStepNext1(v, v1) { |
136 | + console.log(v, v1); | ||
134 | current.value++; | 137 | current.value++; |
135 | getStepOneData.value = v; | 138 | getStepOneData.value = v; |
139 | + getStepOneData.value.icon = v1; | ||
140 | + console.log(getStepOneData.value); | ||
136 | if (unref(isUpdate)) { | 141 | if (unref(isUpdate)) { |
137 | proxy.$refs.DeviceProfileStep2Ref.resetFieldsFunc({ | 142 | proxy.$refs.DeviceProfileStep2Ref.resetFieldsFunc({ |
138 | transportType: editEchoData.value.profileData.transportConfiguration.type, | 143 | transportType: editEchoData.value.profileData.transportConfiguration.type, |
@@ -4,7 +4,7 @@ import { findDictItemByCode } from '/@/api/system/dict'; | @@ -4,7 +4,7 @@ import { findDictItemByCode } from '/@/api/system/dict'; | ||
4 | import { MessageEnum } from '/@/enums/messageEnum'; | 4 | import { MessageEnum } from '/@/enums/messageEnum'; |
5 | // import { getOrganizationList } from '/@/api/system/system'; | 5 | // import { getOrganizationList } from '/@/api/system/system'; |
6 | // import { copyTransFun } from '/@/utils/fnUtils'; | 6 | // import { copyTransFun } from '/@/utils/fnUtils'; |
7 | -import { DeviceProfileQueryUserNameMaxLength } from '/@/utils/rules'; | 7 | +import { numberRule } from '/@/utils/rules'; |
8 | 8 | ||
9 | export const columns: BasicColumn[] = [ | 9 | export const columns: BasicColumn[] = [ |
10 | { | 10 | { |
@@ -36,8 +36,22 @@ export const searchFormSchema: FormSchema[] = [ | @@ -36,8 +36,22 @@ export const searchFormSchema: FormSchema[] = [ | ||
36 | component: 'Input', | 36 | component: 'Input', |
37 | colProps: { span: 8 }, | 37 | colProps: { span: 8 }, |
38 | componentProps: { | 38 | componentProps: { |
39 | + maxLength: 255, | ||
39 | placeholder: '请输入配置名称', | 40 | placeholder: '请输入配置名称', |
40 | }, | 41 | }, |
42 | + dynamicRules: () => { | ||
43 | + return [ | ||
44 | + { | ||
45 | + required: false, | ||
46 | + validator: (_, value) => { | ||
47 | + if (String(value).length > 255) { | ||
48 | + return Promise.reject('字数不超过255个字'); | ||
49 | + } | ||
50 | + return Promise.resolve(); | ||
51 | + }, | ||
52 | + }, | ||
53 | + ]; | ||
54 | + }, | ||
41 | }, | 55 | }, |
42 | ]; | 56 | ]; |
43 | 57 | ||
@@ -55,9 +69,22 @@ export const formSchema: FormSchema[] = [ | @@ -55,9 +69,22 @@ export const formSchema: FormSchema[] = [ | ||
55 | required: true, | 69 | required: true, |
56 | component: 'Input', | 70 | component: 'Input', |
57 | componentProps: { | 71 | componentProps: { |
72 | + maxLength: 255, | ||
58 | placeholder: '请输入配置名称', | 73 | placeholder: '请输入配置名称', |
59 | }, | 74 | }, |
60 | - rules: DeviceProfileQueryUserNameMaxLength, | 75 | + dynamicRules: () => { |
76 | + return [ | ||
77 | + { | ||
78 | + required: true, | ||
79 | + validator: (_, value) => { | ||
80 | + if (String(value).length > 255) { | ||
81 | + return Promise.reject('字数不超过255个字'); | ||
82 | + } | ||
83 | + return Promise.resolve(); | ||
84 | + }, | ||
85 | + }, | ||
86 | + ]; | ||
87 | + }, | ||
61 | }, | 88 | }, |
62 | { | 89 | { |
63 | field: 'messageType', | 90 | field: 'messageType', |
@@ -93,6 +120,23 @@ export const formSchema: FormSchema[] = [ | @@ -93,6 +120,23 @@ export const formSchema: FormSchema[] = [ | ||
93 | label: 'accessKeyId', | 120 | label: 'accessKeyId', |
94 | required: true, | 121 | required: true, |
95 | component: 'Input', | 122 | component: 'Input', |
123 | + componentProps: { | ||
124 | + maxLength: 36, | ||
125 | + placeholder: '请输入accessKeyId', | ||
126 | + }, | ||
127 | + dynamicRules: () => { | ||
128 | + return [ | ||
129 | + { | ||
130 | + required: true, | ||
131 | + validator: (_, value) => { | ||
132 | + if (String(value).length > 36) { | ||
133 | + return Promise.reject('字数不超过36个字'); | ||
134 | + } | ||
135 | + return Promise.resolve(); | ||
136 | + }, | ||
137 | + }, | ||
138 | + ]; | ||
139 | + }, | ||
96 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 140 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
97 | }, | 141 | }, |
98 | { | 142 | { |
@@ -100,6 +144,23 @@ export const formSchema: FormSchema[] = [ | @@ -100,6 +144,23 @@ export const formSchema: FormSchema[] = [ | ||
100 | label: 'accessKeySecret', | 144 | label: 'accessKeySecret', |
101 | required: true, | 145 | required: true, |
102 | component: 'Input', | 146 | component: 'Input', |
147 | + componentProps: { | ||
148 | + maxLength: 36, | ||
149 | + placeholder: '请输入accessKeySecret', | ||
150 | + }, | ||
151 | + dynamicRules: () => { | ||
152 | + return [ | ||
153 | + { | ||
154 | + required: true, | ||
155 | + validator: (_, value) => { | ||
156 | + if (String(value).length > 36) { | ||
157 | + return Promise.reject('字数不超过36个字'); | ||
158 | + } | ||
159 | + return Promise.resolve(); | ||
160 | + }, | ||
161 | + }, | ||
162 | + ]; | ||
163 | + }, | ||
103 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 164 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
104 | }, | 165 | }, |
105 | { | 166 | { |
@@ -108,6 +169,23 @@ export const formSchema: FormSchema[] = [ | @@ -108,6 +169,23 @@ export const formSchema: FormSchema[] = [ | ||
108 | defaultValue: 'smtp.163.com', | 169 | defaultValue: 'smtp.163.com', |
109 | required: true, | 170 | required: true, |
110 | component: 'Input', | 171 | component: 'Input', |
172 | + componentProps: { | ||
173 | + maxLength: 36, | ||
174 | + placeholder: '请输入accessKeySecret', | ||
175 | + }, | ||
176 | + dynamicRules: () => { | ||
177 | + return [ | ||
178 | + { | ||
179 | + required: true, | ||
180 | + validator: (_, value) => { | ||
181 | + if (String(value).length > 36) { | ||
182 | + return Promise.reject('字数不超过36个字'); | ||
183 | + } | ||
184 | + return Promise.resolve(); | ||
185 | + }, | ||
186 | + }, | ||
187 | + ]; | ||
188 | + }, | ||
111 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 189 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), |
112 | }, | 190 | }, |
113 | { | 191 | { |
@@ -116,6 +194,12 @@ export const formSchema: FormSchema[] = [ | @@ -116,6 +194,12 @@ export const formSchema: FormSchema[] = [ | ||
116 | defaultValue: 25, | 194 | defaultValue: 25, |
117 | required: true, | 195 | required: true, |
118 | component: 'InputNumber', | 196 | component: 'InputNumber', |
197 | + rules: numberRule, | ||
198 | + componentProps: { | ||
199 | + maxLength: 36, | ||
200 | + placeholder: '请输入端口', | ||
201 | + }, | ||
202 | + | ||
119 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 203 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), |
120 | }, | 204 | }, |
121 | { | 205 | { |
@@ -123,6 +207,24 @@ export const formSchema: FormSchema[] = [ | @@ -123,6 +207,24 @@ export const formSchema: FormSchema[] = [ | ||
123 | label: '用户名', | 207 | label: '用户名', |
124 | required: true, | 208 | required: true, |
125 | component: 'Input', | 209 | component: 'Input', |
210 | + componentProps: { | ||
211 | + maxLength: 255, | ||
212 | + placeholder: '请输入用户名', | ||
213 | + }, | ||
214 | + dynamicRules: () => { | ||
215 | + return [ | ||
216 | + { | ||
217 | + required: true, | ||
218 | + validator: (_, value) => { | ||
219 | + if (String(value).length > 255) { | ||
220 | + return Promise.reject('字数不超过255个字'); | ||
221 | + } | ||
222 | + return Promise.resolve(); | ||
223 | + }, | ||
224 | + }, | ||
225 | + ]; | ||
226 | + }, | ||
227 | + | ||
126 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 228 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), |
127 | }, | 229 | }, |
128 | { | 230 | { |
@@ -137,12 +239,46 @@ export const formSchema: FormSchema[] = [ | @@ -137,12 +239,46 @@ export const formSchema: FormSchema[] = [ | ||
137 | label: '消息配置', | 239 | label: '消息配置', |
138 | component: 'Input', | 240 | component: 'Input', |
139 | show: false, | 241 | show: false, |
242 | + componentProps: { | ||
243 | + maxLength: 255, | ||
244 | + placeholder: '请输入消息配置', | ||
245 | + }, | ||
246 | + dynamicRules: () => { | ||
247 | + return [ | ||
248 | + { | ||
249 | + required: false, | ||
250 | + validator: (_, value) => { | ||
251 | + if (String(value).length > 255) { | ||
252 | + return Promise.reject('字数不超过255个字'); | ||
253 | + } | ||
254 | + return Promise.resolve(); | ||
255 | + }, | ||
256 | + }, | ||
257 | + ]; | ||
258 | + }, | ||
140 | }, | 259 | }, |
141 | { | 260 | { |
142 | field: 'id', | 261 | field: 'id', |
143 | label: '主键', | 262 | label: '主键', |
144 | component: 'Input', | 263 | component: 'Input', |
145 | show: false, | 264 | show: false, |
265 | + componentProps: { | ||
266 | + maxLength: 36, | ||
267 | + placeholder: '请输入主键', | ||
268 | + }, | ||
269 | + dynamicRules: () => { | ||
270 | + return [ | ||
271 | + { | ||
272 | + required: false, | ||
273 | + validator: (_, value) => { | ||
274 | + if (String(value).length > 36) { | ||
275 | + return Promise.reject('字数不超过36个字'); | ||
276 | + } | ||
277 | + return Promise.resolve(); | ||
278 | + }, | ||
279 | + }, | ||
280 | + ]; | ||
281 | + }, | ||
146 | }, | 282 | }, |
147 | { | 283 | { |
148 | field: 'status', | 284 | field: 'status', |
@@ -160,5 +296,22 @@ export const formSchema: FormSchema[] = [ | @@ -160,5 +296,22 @@ export const formSchema: FormSchema[] = [ | ||
160 | label: '备注', | 296 | label: '备注', |
161 | field: 'remark', | 297 | field: 'remark', |
162 | component: 'InputTextArea', | 298 | component: 'InputTextArea', |
299 | + componentProps: { | ||
300 | + maxLength: 255, | ||
301 | + placeholder: '请输入备注', | ||
302 | + }, | ||
303 | + dynamicRules: () => { | ||
304 | + return [ | ||
305 | + { | ||
306 | + required: false, | ||
307 | + validator: (_, value) => { | ||
308 | + if (String(value).length > 255) { | ||
309 | + return Promise.reject('字数不超过255个字'); | ||
310 | + } | ||
311 | + return Promise.resolve(); | ||
312 | + }, | ||
313 | + }, | ||
314 | + ]; | ||
315 | + }, | ||
163 | }, | 316 | }, |
164 | ]; | 317 | ]; |
@@ -246,14 +246,14 @@ | @@ -246,14 +246,14 @@ | ||
246 | case '3': | 246 | case '3': |
247 | setTimeout(() => { | 247 | setTimeout(() => { |
248 | setRegisterStep3Schemas({ | 248 | setRegisterStep3Schemas({ |
249 | - alarmType: descInfo.value.profileData?.alarms[0].alarmType, | 249 | + alarmType: descInfo.value.profileData?.alarms[0]?.alarmType, |
250 | }); | 250 | }); |
251 | setRegisterStep3HighSetting({ | 251 | setRegisterStep3HighSetting({ |
252 | - propagate: descInfo.value.profileData?.alarms[0].propagate, | 252 | + propagate: descInfo.value.profileData?.alarms[0]?.propagate, |
253 | propagateRelationTypes: | 253 | propagateRelationTypes: |
254 | - descInfo.value.profileData?.alarms[0].propagateRelationTypes, | 254 | + descInfo.value.profileData?.alarms[0]?.propagateRelationTypes, |
255 | }); | 255 | }); |
256 | - const getKey = Object.keys(descInfo.value.profileData?.alarms[0].createRules); | 256 | + const getKey = Object.keys(descInfo.value.profileData?.alarms[0]?.createRules); |
257 | setRegisterStep3CreateAlarm({ | 257 | setRegisterStep3CreateAlarm({ |
258 | default: getKey[0], | 258 | default: getKey[0], |
259 | }); | 259 | }); |
@@ -315,8 +315,8 @@ | @@ -315,8 +315,8 @@ | ||
315 | case '4': | 315 | case '4': |
316 | setTimeout(() => { | 316 | setTimeout(() => { |
317 | setRegisterContact({ | 317 | setRegisterContact({ |
318 | - alarmContactId: descInfo.value.alarmProfile.alarmContactId, | ||
319 | - messageMode: descInfo.value.alarmProfile.messageMode, | 318 | + alarmContactId: descInfo.value?.alarmProfile?.alarmContactId, |
319 | + messageMode: descInfo.value?.alarmProfile?.messageMode, | ||
320 | }); | 320 | }); |
321 | }, 1000); | 321 | }, 1000); |
322 | break; | 322 | break; |
@@ -45,12 +45,12 @@ | @@ -45,12 +45,12 @@ | ||
45 | </BasicTable> | 45 | </BasicTable> |
46 | <DeviceProfileModal v-if="isJudgeStatus" @register="registerModal" @success="handleSuccess" /> | 46 | <DeviceProfileModal v-if="isJudgeStatus" @register="registerModal" @success="handleSuccess" /> |
47 | <DeviceConfigDetail @register="registerModalDetail" @success="handleSuccess" /> | 47 | <DeviceConfigDetail @register="registerModalDetail" @success="handleSuccess" /> |
48 | - <ExpExcelModal @register="register1" @success="defaultHeader" /> | 48 | + <!-- <ExpExcelModal @register="register1" @success="defaultHeader" /> --> |
49 | </div> | 49 | </div> |
50 | </template> | 50 | </template> |
51 | <script lang="ts"> | 51 | <script lang="ts"> |
52 | import { defineComponent, ref, reactive } from 'vue'; | 52 | import { defineComponent, ref, reactive } from 'vue'; |
53 | - import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 53 | + import { BasicTable, useTable, TableAction, BasicColumn } from '/@/components/Table'; |
54 | import { columns, searchFormSchema } from './device.profile.data'; | 54 | import { columns, searchFormSchema } from './device.profile.data'; |
55 | import { useMessage } from '/@/hooks/web/useMessage'; | 55 | import { useMessage } from '/@/hooks/web/useMessage'; |
56 | import { deviceConfigGetQuery, deviceConfigDelete } from '/@/api/device/deviceConfigApi'; | 56 | import { deviceConfigGetQuery, deviceConfigDelete } from '/@/api/device/deviceConfigApi'; |
@@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
58 | import DeviceProfileModal from '/@/views/device/profile/DeviceProfileModal.vue'; | 58 | import DeviceProfileModal from '/@/views/device/profile/DeviceProfileModal.vue'; |
59 | import DeviceConfigDetail from '/@/views/device/profile/deviceConfigDetail.vue'; | 59 | import DeviceConfigDetail from '/@/views/device/profile/deviceConfigDetail.vue'; |
60 | import { ImpExcel, ExcelData } from '/@/components/Excel'; | 60 | import { ImpExcel, ExcelData } from '/@/components/Excel'; |
61 | - import { jsonToSheetXlsx, ExportModalResult } from '/@/components/Excel'; | 61 | + // import { jsonToSheetXlsx, ExportModalResult } from '/@/components/Excel'; |
62 | 62 | ||
63 | export default defineComponent({ | 63 | export default defineComponent({ |
64 | name: 'DeviceProfileManagement', | 64 | name: 'DeviceProfileManagement', |
@@ -156,23 +156,23 @@ | @@ -156,23 +156,23 @@ | ||
156 | isJudgeStatus.value = false; | 156 | isJudgeStatus.value = false; |
157 | } | 157 | } |
158 | 158 | ||
159 | - function defaultHeader({ filename, bookType }: ExportModalResult) { | ||
160 | - // 默认Object.keys(data[0])作为header | ||
161 | - jsonToSheetXlsx({ | ||
162 | - data, | ||
163 | - filename, | ||
164 | - write2excelOpts: { | ||
165 | - bookType, | ||
166 | - }, | ||
167 | - }); | ||
168 | - } | 159 | + // function defaultHeader({ filename, bookType }: ExportModalResult) { |
160 | + // // 默认Object.keys(data[0])作为header | ||
161 | + // jsonToSheetXlsx({ | ||
162 | + // data, | ||
163 | + // filename, | ||
164 | + // write2excelOpts: { | ||
165 | + // bookType, | ||
166 | + // }, | ||
167 | + // }); | ||
168 | + // } | ||
169 | 169 | ||
170 | - const [register1, { openModal: openModalExcel }] = useModal(); | 170 | + // const [register1, { openModal: openModalExcel }] = useModal(); |
171 | const handleExport = (record: Recordable) => { | 171 | const handleExport = (record: Recordable) => { |
172 | console.log(record); | 172 | console.log(record); |
173 | - setTimeout(() => { | ||
174 | - openModalExcel(); | ||
175 | - }, 50); | 173 | + // setTimeout(() => { |
174 | + // openModalExcel(); | ||
175 | + // }, 50); | ||
176 | }; | 176 | }; |
177 | function handleImport() { | 177 | function handleImport() { |
178 | console.log('record'); | 178 | console.log('record'); |
@@ -182,8 +182,8 @@ | @@ -182,8 +182,8 @@ | ||
182 | } | 182 | } |
183 | return { | 183 | return { |
184 | registerModalDetail, | 184 | registerModalDetail, |
185 | - register1, | ||
186 | - defaultHeader, | 185 | + // register1, |
186 | + // defaultHeader, | ||
187 | useSelectionChange, | 187 | useSelectionChange, |
188 | handleTableDel, | 188 | handleTableDel, |
189 | isJudgeStatus, | 189 | isJudgeStatus, |
1 | <template> | 1 | <template> |
2 | <div class="step1"> | 2 | <div class="step1"> |
3 | <div class="step1-form"> | 3 | <div class="step1-form"> |
4 | - <BasicForm @register="register" /> | ||
5 | - <div> | ||
6 | - <span>请上传图片</span> | ||
7 | - <CropperAvatar | ||
8 | - :uploadApi="uploadApi" | ||
9 | - :value="avatar" | ||
10 | - btnText="更换头像" | ||
11 | - :btnProps="{ preIcon: 'ant-design:cloud-upload-outlined' }" | ||
12 | - @change="updateAvatar" | ||
13 | - width="150" | ||
14 | - /> | 4 | + <div |
5 | + style=" | ||
6 | + width: 12vw; | ||
7 | + height: 24vh; | ||
8 | + margin-left: 25px; | ||
9 | + display: flex; | ||
10 | + justify-content: space-between; | ||
11 | + align-items: center; | ||
12 | + " | ||
13 | + > | ||
14 | + <div style="width: 4vw; height: 24vh">请上传图片</div> | ||
15 | + <div style="width: 8vw; height: 24vh"> | ||
16 | + <Upload | ||
17 | + style="width: 20vw" | ||
18 | + name="avatar" | ||
19 | + list-type="picture-card" | ||
20 | + class="avatar-uploader" | ||
21 | + :show-upload-list="false" | ||
22 | + :customRequest="customUploadqrcodePic" | ||
23 | + :before-upload="beforeUploadqrcodePic" | ||
24 | + > | ||
25 | + <img | ||
26 | + style="text-align: center; border-radius: 50%; width: 10vw; height: 15vh" | ||
27 | + v-if="peresonalPic" | ||
28 | + :src="peresonalPic" | ||
29 | + alt="avatar" | ||
30 | + /> | ||
31 | + <div v-else> | ||
32 | + <div style="margin-top: 30px"> | ||
33 | + <PlusOutlined style="font-size: 30px" /> | ||
34 | + </div> | ||
35 | + <div | ||
36 | + class="ant-upload-text flex" | ||
37 | + style="width: 280px; height: 130px; align-items: center" | ||
38 | + > | ||
39 | + 支持.PNG、.JPG、.JPEG格式,建议大小不超过2M。</div | ||
40 | + > | ||
41 | + </div> | ||
42 | + </Upload> | ||
43 | + </div> | ||
15 | </div> | 44 | </div> |
45 | + <BasicForm @register="register" /> | ||
16 | </div> | 46 | </div> |
17 | </div> | 47 | </div> |
18 | </template> | 48 | </template> |
19 | <script lang="ts"> | 49 | <script lang="ts"> |
20 | - import { defineComponent } from 'vue'; | 50 | + import { defineComponent, ref } from 'vue'; |
21 | import { BasicForm, useForm } from '/@/components/Form'; | 51 | import { BasicForm, useForm } from '/@/components/Form'; |
22 | import { step1Schemas } from './data'; | 52 | import { step1Schemas } from './data'; |
23 | import { Select, Input, Divider } from 'ant-design-vue'; | 53 | import { Select, Input, Divider } from 'ant-design-vue'; |
24 | - import { CropperAvatar } from '/@/components/Cropper'; | ||
25 | import { uploadApi } from '/@/api/personal/index'; | 54 | import { uploadApi } from '/@/api/personal/index'; |
55 | + import { Upload } from 'ant-design-vue'; | ||
56 | + import { PlusOutlined } from '@ant-design/icons-vue'; | ||
57 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
58 | + import type { FileItem } from '/@/components/Upload/src/typing'; | ||
26 | 59 | ||
27 | export default defineComponent({ | 60 | export default defineComponent({ |
28 | components: { | 61 | components: { |
@@ -31,10 +64,13 @@ | @@ -31,10 +64,13 @@ | ||
31 | [Input.name]: Input, | 64 | [Input.name]: Input, |
32 | [Input.Group.name]: Input.Group, | 65 | [Input.Group.name]: Input.Group, |
33 | [Divider.name]: Divider, | 66 | [Divider.name]: Divider, |
34 | - CropperAvatar, | 67 | + Upload, |
68 | + PlusOutlined, | ||
35 | }, | 69 | }, |
36 | emits: ['next', 'resetFunc'], | 70 | emits: ['next', 'resetFunc'], |
37 | setup(_, { emit }) { | 71 | setup(_, { emit }) { |
72 | + const { createMessage } = useMessage(); | ||
73 | + | ||
38 | const [register, { validate, setFieldsValue, resetFields }] = useForm({ | 74 | const [register, { validate, setFieldsValue, resetFields }] = useForm({ |
39 | labelWidth: 100, | 75 | labelWidth: 100, |
40 | schemas: step1Schemas, | 76 | schemas: step1Schemas, |
@@ -50,16 +86,59 @@ | @@ -50,16 +86,59 @@ | ||
50 | const resetFieldsFunc = (v) => { | 86 | const resetFieldsFunc = (v) => { |
51 | setFieldsValue(v); | 87 | setFieldsValue(v); |
52 | }; | 88 | }; |
89 | + const peresonalPic = ref(); | ||
90 | + | ||
91 | + const resetIconFunc = () => { | ||
92 | + peresonalPic.value = ''; | ||
93 | + }; | ||
94 | + | ||
95 | + const editIconFunc = (v) => { | ||
96 | + peresonalPic.value = v; | ||
97 | + }; | ||
98 | + | ||
99 | + const customUploadqrcodePic = async ({ file }) => { | ||
100 | + if (beforeUploadqrcodePic(file)) { | ||
101 | + const formData = new FormData(); | ||
102 | + formData.append('file', file); | ||
103 | + const response = await uploadApi(formData); | ||
104 | + if (response.fileStaticUri) { | ||
105 | + peresonalPic.value = response.fileStaticUri; | ||
106 | + } | ||
107 | + } | ||
108 | + }; | ||
109 | + | ||
110 | + const beforeUploadqrcodePic = (file: FileItem) => { | ||
111 | + const isJpgOrPng = | ||
112 | + file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg'; | ||
113 | + if (!isJpgOrPng) { | ||
114 | + createMessage.error('只能上传图片文件!'); | ||
115 | + } | ||
116 | + const isLt2M = (file.size as number) / 1024 / 1024 < 2; | ||
117 | + if (!isLt2M) { | ||
118 | + createMessage.error('图片大小不能超过5MB!'); | ||
119 | + } | ||
120 | + return isJpgOrPng && isLt2M; | ||
121 | + }; | ||
53 | async function customSubmitFunc() { | 122 | async function customSubmitFunc() { |
54 | try { | 123 | try { |
55 | const values = await validate(); | 124 | const values = await validate(); |
56 | - emit('next', values); | 125 | + emit('next', values, peresonalPic.value); |
57 | } catch (error) {} | 126 | } catch (error) {} |
58 | } | 127 | } |
59 | const customResetFunc = async () => { | 128 | const customResetFunc = async () => { |
60 | await resetFields(); | 129 | await resetFields(); |
61 | }; | 130 | }; |
62 | - return { register, resetFieldsFunc, customResetFunc, uploadApi }; | 131 | + return { |
132 | + editIconFunc, | ||
133 | + resetIconFunc, | ||
134 | + register, | ||
135 | + resetFieldsFunc, | ||
136 | + customResetFunc, | ||
137 | + uploadApi, | ||
138 | + peresonalPic, | ||
139 | + beforeUploadqrcodePic, | ||
140 | + customUploadqrcodePic, | ||
141 | + }; | ||
63 | }, | 142 | }, |
64 | }); | 143 | }); |
65 | </script> | 144 | </script> |
@@ -65,16 +65,23 @@ export const formSchema: FormSchema[] = [ | @@ -65,16 +65,23 @@ export const formSchema: FormSchema[] = [ | ||
65 | colProps: { span: 13 }, | 65 | colProps: { span: 13 }, |
66 | component: 'Input', | 66 | component: 'Input', |
67 | componentProps: { | 67 | componentProps: { |
68 | - placeholder: '请输入键名', | ||
69 | maxLength: 255, | 68 | maxLength: 255, |
70 | - // options: [ | ||
71 | - // { label: 'active', value: 'active' }, | ||
72 | - // { label: 'inactivityAlarmTime', value: 'inactivityAlarmTime' }, | ||
73 | - // { label: 'lastActivityTime', value: 'lastActivityTime' }, | ||
74 | - // { label: 'lastConnectTime', value: 'lastConnectTime' }, | ||
75 | - // { label: 'lastDisconnectTime', value: 'lastDisconnectTime' }, | ||
76 | - // ], | 69 | + placeholder: '请输入键名', |
70 | + }, | ||
71 | + dynamicRules: () => { | ||
72 | + return [ | ||
73 | + { | ||
74 | + required: false, | ||
75 | + validator: (_, value) => { | ||
76 | + if (String(value).length > 255) { | ||
77 | + return Promise.reject('字数不超过255个字'); | ||
78 | + } | ||
79 | + return Promise.resolve(); | ||
80 | + }, | ||
81 | + }, | ||
82 | + ]; | ||
77 | }, | 83 | }, |
84 | + | ||
78 | ifShow: ({ values }) => isShiDu(Reflect.get(values, 'type')), | 85 | ifShow: ({ values }) => isShiDu(Reflect.get(values, 'type')), |
79 | }, | 86 | }, |
80 | { | 87 | { |
@@ -84,13 +91,20 @@ export const formSchema: FormSchema[] = [ | @@ -84,13 +91,20 @@ export const formSchema: FormSchema[] = [ | ||
84 | component: 'Input', | 91 | component: 'Input', |
85 | componentProps: { | 92 | componentProps: { |
86 | maxLength: 255, | 93 | maxLength: 255, |
87 | - | ||
88 | placeholder: '请输入键名', | 94 | placeholder: '请输入键名', |
89 | - // options: [ | ||
90 | - // { label: 'CO2', value: 'CO2' }, | ||
91 | - // { label: 'temp', value: 'temp' }, | ||
92 | - // { label: 'wet', value: 'wet' }, | ||
93 | - // ], | 95 | + }, |
96 | + dynamicRules: () => { | ||
97 | + return [ | ||
98 | + { | ||
99 | + required: false, | ||
100 | + validator: (_, value) => { | ||
101 | + if (String(value).length > 255) { | ||
102 | + return Promise.reject('字数不超过255个字'); | ||
103 | + } | ||
104 | + return Promise.resolve(); | ||
105 | + }, | ||
106 | + }, | ||
107 | + ]; | ||
94 | }, | 108 | }, |
95 | ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | 109 | ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), |
96 | }, | 110 | }, |
@@ -101,9 +115,21 @@ export const formSchema: FormSchema[] = [ | @@ -101,9 +115,21 @@ export const formSchema: FormSchema[] = [ | ||
101 | component: 'Input', | 115 | component: 'Input', |
102 | componentProps: { | 116 | componentProps: { |
103 | maxLength: 255, | 117 | maxLength: 255, |
104 | - | ||
105 | placeholder: '请输入键名', | 118 | placeholder: '请输入键名', |
106 | }, | 119 | }, |
120 | + dynamicRules: () => { | ||
121 | + return [ | ||
122 | + { | ||
123 | + required: false, | ||
124 | + validator: (_, value) => { | ||
125 | + if (String(value).length > 255) { | ||
126 | + return Promise.reject('字数不超过255个字'); | ||
127 | + } | ||
128 | + return Promise.resolve(); | ||
129 | + }, | ||
130 | + }, | ||
131 | + ]; | ||
132 | + }, | ||
107 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | 133 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
108 | }, | 134 | }, |
109 | { | 135 | { |
@@ -11,5 +11,18 @@ export const formSchema: FormSchema[] = [ | @@ -11,5 +11,18 @@ export const formSchema: FormSchema[] = [ | ||
11 | maxLength: 255, | 11 | maxLength: 255, |
12 | placeholder: '请输入报警详细信息', | 12 | placeholder: '请输入报警详细信息', |
13 | }, | 13 | }, |
14 | + dynamicRules: () => { | ||
15 | + return [ | ||
16 | + { | ||
17 | + required: true, | ||
18 | + validator: (_, value) => { | ||
19 | + if (String(value).length > 255) { | ||
20 | + return Promise.reject('字数不超过255个字'); | ||
21 | + } | ||
22 | + return Promise.resolve(); | ||
23 | + }, | ||
24 | + }, | ||
25 | + ]; | ||
26 | + }, | ||
14 | }, | 27 | }, |
15 | ]; | 28 | ]; |
@@ -5,7 +5,6 @@ import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | @@ -5,7 +5,6 @@ import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | ||
5 | import { ref } from 'vue'; | 5 | import { ref } from 'vue'; |
6 | import { findDictItemByCode } from '/@/api/system/dict'; | 6 | import { findDictItemByCode } from '/@/api/system/dict'; |
7 | import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; | 7 | import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; |
8 | -import { DeviceProfileQueryUserNameMaxLength } from '/@/utils/rules'; | ||
9 | 8 | ||
10 | export const step1Schemas: FormSchema[] = [ | 9 | export const step1Schemas: FormSchema[] = [ |
11 | { | 10 | { |
@@ -17,7 +16,19 @@ export const step1Schemas: FormSchema[] = [ | @@ -17,7 +16,19 @@ export const step1Schemas: FormSchema[] = [ | ||
17 | maxLength: 255, | 16 | maxLength: 255, |
18 | placeholder: '请输入配置名称', | 17 | placeholder: '请输入配置名称', |
19 | }, | 18 | }, |
20 | - rules: DeviceProfileQueryUserNameMaxLength, | 19 | + dynamicRules: () => { |
20 | + return [ | ||
21 | + { | ||
22 | + required: true, | ||
23 | + validator: (_, value) => { | ||
24 | + if (String(value).length > 255) { | ||
25 | + return Promise.reject('字数不超过255个字'); | ||
26 | + } | ||
27 | + return Promise.resolve(); | ||
28 | + }, | ||
29 | + }, | ||
30 | + ]; | ||
31 | + }, | ||
21 | }, | 32 | }, |
22 | //规则链(string) | 33 | //规则链(string) |
23 | { | 34 | { |
@@ -40,17 +51,6 @@ export const step1Schemas: FormSchema[] = [ | @@ -40,17 +51,6 @@ export const step1Schemas: FormSchema[] = [ | ||
40 | immediate: true, | 51 | immediate: true, |
41 | }, | 52 | }, |
42 | }, | 53 | }, |
43 | - // { | ||
44 | - // field: 'icon', | ||
45 | - // component: 'Upload', | ||
46 | - // label: '请上传图片', | ||
47 | - // colProps: { | ||
48 | - // span: 8, | ||
49 | - // }, | ||
50 | - // componentProps: { | ||
51 | - // api: uploadApi, | ||
52 | - // }, | ||
53 | - // }, | ||
54 | { | 54 | { |
55 | field: 'defaultQueueName', | 55 | field: 'defaultQueueName', |
56 | label: '处理队列', | 56 | label: '处理队列', |
@@ -69,9 +69,22 @@ export const step1Schemas: FormSchema[] = [ | @@ -69,9 +69,22 @@ export const step1Schemas: FormSchema[] = [ | ||
69 | field: 'description', | 69 | field: 'description', |
70 | component: 'InputTextArea', | 70 | component: 'InputTextArea', |
71 | componentProps: { | 71 | componentProps: { |
72 | - maxLength: 0, | 72 | + maxLength: 255, |
73 | placeholder: '请输入描述', | 73 | placeholder: '请输入描述', |
74 | }, | 74 | }, |
75 | + dynamicRules: () => { | ||
76 | + return [ | ||
77 | + { | ||
78 | + required: false, | ||
79 | + validator: (_, value) => { | ||
80 | + if (String(value).length > 255) { | ||
81 | + return Promise.reject('字数不超过255个字'); | ||
82 | + } | ||
83 | + return Promise.resolve(); | ||
84 | + }, | ||
85 | + }, | ||
86 | + ]; | ||
87 | + }, | ||
75 | }, | 88 | }, |
76 | ]; | 89 | ]; |
77 | 90 | ||
@@ -106,6 +119,19 @@ export const step3Schemas: FormSchema[] = [ | @@ -106,6 +119,19 @@ export const step3Schemas: FormSchema[] = [ | ||
106 | maxLength: 255, | 119 | maxLength: 255, |
107 | placeholder: '请输入报警类型', | 120 | placeholder: '请输入报警类型', |
108 | }, | 121 | }, |
122 | + dynamicRules: () => { | ||
123 | + return [ | ||
124 | + { | ||
125 | + required: false, | ||
126 | + validator: (_, value) => { | ||
127 | + if (String(value).length > 255) { | ||
128 | + return Promise.reject('字数不超过255个字'); | ||
129 | + } | ||
130 | + return Promise.resolve(); | ||
131 | + }, | ||
132 | + }, | ||
133 | + ]; | ||
134 | + }, | ||
109 | }, | 135 | }, |
110 | ]; | 136 | ]; |
111 | 137 | ||
@@ -125,7 +151,20 @@ export const step3ViewHighSetting: FormSchema[] = [ | @@ -125,7 +151,20 @@ export const step3ViewHighSetting: FormSchema[] = [ | ||
125 | }, | 151 | }, |
126 | componentProps: { | 152 | componentProps: { |
127 | maxLength: 255, | 153 | maxLength: 255, |
128 | - placeholder: '要传递的关联类型', | 154 | + placeholder: '请输入关联类型', |
155 | + }, | ||
156 | + dynamicRules: () => { | ||
157 | + return [ | ||
158 | + { | ||
159 | + required: false, | ||
160 | + validator: (_, value) => { | ||
161 | + if (String(value).length > 255) { | ||
162 | + return Promise.reject('字数不超过255个字'); | ||
163 | + } | ||
164 | + return Promise.resolve(); | ||
165 | + }, | ||
166 | + }, | ||
167 | + ]; | ||
129 | }, | 168 | }, |
130 | }, | 169 | }, |
131 | ]; | 170 | ]; |
@@ -146,7 +185,20 @@ export const step3HighSetting: FormSchema[] = [ | @@ -146,7 +185,20 @@ export const step3HighSetting: FormSchema[] = [ | ||
146 | }, | 185 | }, |
147 | componentProps: { | 186 | componentProps: { |
148 | maxLength: 255, | 187 | maxLength: 255, |
149 | - placeholder: '要传递的关联类型', | 188 | + placeholder: '请输入关联类型', |
189 | + }, | ||
190 | + dynamicRules: () => { | ||
191 | + return [ | ||
192 | + { | ||
193 | + required: false, | ||
194 | + validator: (_, value) => { | ||
195 | + if (String(value).length > 255) { | ||
196 | + return Promise.reject('字数不超过255个字'); | ||
197 | + } | ||
198 | + return Promise.resolve(); | ||
199 | + }, | ||
200 | + }, | ||
201 | + ]; | ||
150 | }, | 202 | }, |
151 | ifShow: ({ values }) => !!values.propagate, | 203 | ifShow: ({ values }) => !!values.propagate, |
152 | }, | 204 | }, |
@@ -162,7 +214,7 @@ export const step3CreateAlarm: FormSchema[] = [ | @@ -162,7 +214,7 @@ export const step3CreateAlarm: FormSchema[] = [ | ||
162 | colProps: { | 214 | colProps: { |
163 | span: 16, | 215 | span: 16, |
164 | }, | 216 | }, |
165 | - componentProps({ formModel }) { | 217 | + componentProps() { |
166 | return { | 218 | return { |
167 | placeholder: '请选择严重程度', | 219 | placeholder: '请选择严重程度', |
168 | options: [ | 220 | options: [ |
1 | -import { MessageTypeEnum } from '/@/api/tenant/tenantInfo'; | ||
2 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; |
3 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
4 | import { h } from 'vue'; | 3 | import { h } from 'vue'; |
@@ -117,6 +116,20 @@ export const formSchema: FormSchema[] = [ | @@ -117,6 +116,20 @@ export const formSchema: FormSchema[] = [ | ||
117 | component: 'Input', | 116 | component: 'Input', |
118 | componentProps: { | 117 | componentProps: { |
119 | maxLength: 30, | 118 | maxLength: 30, |
119 | + placeholder: '请输入配置名称', | ||
120 | + }, | ||
121 | + dynamicRules: () => { | ||
122 | + return [ | ||
123 | + { | ||
124 | + required: true, | ||
125 | + validator: (_, value) => { | ||
126 | + if (String(value).length > 30) { | ||
127 | + return Promise.reject('字数不超过30个字'); | ||
128 | + } | ||
129 | + return Promise.resolve(); | ||
130 | + }, | ||
131 | + }, | ||
132 | + ]; | ||
120 | }, | 133 | }, |
121 | }, | 134 | }, |
122 | { | 135 | { |
@@ -155,6 +168,20 @@ export const formSchema: FormSchema[] = [ | @@ -155,6 +168,20 @@ export const formSchema: FormSchema[] = [ | ||
155 | component: 'Input', | 168 | component: 'Input', |
156 | componentProps: { | 169 | componentProps: { |
157 | maxLength: 36, | 170 | maxLength: 36, |
171 | + placeholder: '请输入accessKeyId', | ||
172 | + }, | ||
173 | + dynamicRules: () => { | ||
174 | + return [ | ||
175 | + { | ||
176 | + required: true, | ||
177 | + validator: (_, value) => { | ||
178 | + if (String(value).length > 36) { | ||
179 | + return Promise.reject('字数不超过36个字'); | ||
180 | + } | ||
181 | + return Promise.resolve(); | ||
182 | + }, | ||
183 | + }, | ||
184 | + ]; | ||
158 | }, | 185 | }, |
159 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 186 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
160 | }, | 187 | }, |
@@ -164,6 +191,20 @@ export const formSchema: FormSchema[] = [ | @@ -164,6 +191,20 @@ export const formSchema: FormSchema[] = [ | ||
164 | required: true, | 191 | required: true, |
165 | componentProps: { | 192 | componentProps: { |
166 | maxLength: 36, | 193 | maxLength: 36, |
194 | + placeholder: '请输入accessKeySecret', | ||
195 | + }, | ||
196 | + dynamicRules: () => { | ||
197 | + return [ | ||
198 | + { | ||
199 | + required: true, | ||
200 | + validator: (_, value) => { | ||
201 | + if (String(value).length > 36) { | ||
202 | + return Promise.reject('字数不超过36个字'); | ||
203 | + } | ||
204 | + return Promise.resolve(); | ||
205 | + }, | ||
206 | + }, | ||
207 | + ]; | ||
167 | }, | 208 | }, |
168 | component: 'Input', | 209 | component: 'Input', |
169 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 210 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
@@ -176,6 +217,20 @@ export const formSchema: FormSchema[] = [ | @@ -176,6 +217,20 @@ export const formSchema: FormSchema[] = [ | ||
176 | component: 'Input', | 217 | component: 'Input', |
177 | componentProps: { | 218 | componentProps: { |
178 | maxLength: 36, | 219 | maxLength: 36, |
220 | + placeholder: '请输入服务器地址', | ||
221 | + }, | ||
222 | + dynamicRules: () => { | ||
223 | + return [ | ||
224 | + { | ||
225 | + required: true, | ||
226 | + validator: (_, value) => { | ||
227 | + if (String(value).length > 36) { | ||
228 | + return Promise.reject('字数不超过36个字'); | ||
229 | + } | ||
230 | + return Promise.resolve(); | ||
231 | + }, | ||
232 | + }, | ||
233 | + ]; | ||
179 | }, | 234 | }, |
180 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 235 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), |
181 | }, | 236 | }, |
@@ -186,6 +241,20 @@ export const formSchema: FormSchema[] = [ | @@ -186,6 +241,20 @@ export const formSchema: FormSchema[] = [ | ||
186 | required: true, | 241 | required: true, |
187 | componentProps: { | 242 | componentProps: { |
188 | maxLength: 36, | 243 | maxLength: 36, |
244 | + placeholder: '请输入端口', | ||
245 | + }, | ||
246 | + dynamicRules: () => { | ||
247 | + return [ | ||
248 | + { | ||
249 | + required: true, | ||
250 | + validator: (_, value) => { | ||
251 | + if (String(value).length > 36) { | ||
252 | + return Promise.reject('字数不超过36个字'); | ||
253 | + } | ||
254 | + return Promise.resolve(); | ||
255 | + }, | ||
256 | + }, | ||
257 | + ]; | ||
189 | }, | 258 | }, |
190 | component: 'InputNumber', | 259 | component: 'InputNumber', |
191 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 260 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), |
@@ -196,7 +265,22 @@ export const formSchema: FormSchema[] = [ | @@ -196,7 +265,22 @@ export const formSchema: FormSchema[] = [ | ||
196 | required: true, | 265 | required: true, |
197 | componentProps: { | 266 | componentProps: { |
198 | maxLength: 255, | 267 | maxLength: 255, |
268 | + placeholder: '请输入用户名', | ||
269 | + }, | ||
270 | + dynamicRules: () => { | ||
271 | + return [ | ||
272 | + { | ||
273 | + required: false, | ||
274 | + validator: (_, value) => { | ||
275 | + if (String(value).length > 255) { | ||
276 | + return Promise.reject('字数不超过255个字'); | ||
277 | + } | ||
278 | + return Promise.resolve(); | ||
279 | + }, | ||
280 | + }, | ||
281 | + ]; | ||
199 | }, | 282 | }, |
283 | + | ||
200 | component: 'Input', | 284 | component: 'Input', |
201 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 285 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), |
202 | }, | 286 | }, |
@@ -215,6 +299,20 @@ export const formSchema: FormSchema[] = [ | @@ -215,6 +299,20 @@ export const formSchema: FormSchema[] = [ | ||
215 | show: false, | 299 | show: false, |
216 | componentProps: { | 300 | componentProps: { |
217 | maxLength: 255, | 301 | maxLength: 255, |
302 | + placeholder: '请输入消息配置', | ||
303 | + }, | ||
304 | + dynamicRules: () => { | ||
305 | + return [ | ||
306 | + { | ||
307 | + required: false, | ||
308 | + validator: (_, value) => { | ||
309 | + if (String(value).length > 255) { | ||
310 | + return Promise.reject('字数不超过255个字'); | ||
311 | + } | ||
312 | + return Promise.resolve(); | ||
313 | + }, | ||
314 | + }, | ||
315 | + ]; | ||
218 | }, | 316 | }, |
219 | }, | 317 | }, |
220 | { | 318 | { |
@@ -224,6 +322,20 @@ export const formSchema: FormSchema[] = [ | @@ -224,6 +322,20 @@ export const formSchema: FormSchema[] = [ | ||
224 | show: false, | 322 | show: false, |
225 | componentProps: { | 323 | componentProps: { |
226 | maxLength: 36, | 324 | maxLength: 36, |
325 | + placeholder: '请输入主键', | ||
326 | + }, | ||
327 | + dynamicRules: () => { | ||
328 | + return [ | ||
329 | + { | ||
330 | + required: false, | ||
331 | + validator: (_, value) => { | ||
332 | + if (String(value).length > 36) { | ||
333 | + return Promise.reject('字数不超过255个字'); | ||
334 | + } | ||
335 | + return Promise.resolve(); | ||
336 | + }, | ||
337 | + }, | ||
338 | + ]; | ||
227 | }, | 339 | }, |
228 | }, | 340 | }, |
229 | { | 341 | { |
@@ -243,7 +355,22 @@ export const formSchema: FormSchema[] = [ | @@ -243,7 +355,22 @@ export const formSchema: FormSchema[] = [ | ||
243 | field: 'remark', | 355 | field: 'remark', |
244 | componentProps: { | 356 | componentProps: { |
245 | maxLength: 255, | 357 | maxLength: 255, |
358 | + placeholder: '请输入备注', | ||
246 | }, | 359 | }, |
360 | + dynamicRules: () => { | ||
361 | + return [ | ||
362 | + { | ||
363 | + required: false, | ||
364 | + validator: (_, value) => { | ||
365 | + if (String(value).length > 255) { | ||
366 | + return Promise.reject('字数不超过255个字'); | ||
367 | + } | ||
368 | + return Promise.resolve(); | ||
369 | + }, | ||
370 | + }, | ||
371 | + ]; | ||
372 | + }, | ||
373 | + | ||
247 | component: 'InputTextArea', | 374 | component: 'InputTextArea', |
248 | }, | 375 | }, |
249 | { | 376 | { |
@@ -253,6 +380,20 @@ export const formSchema: FormSchema[] = [ | @@ -253,6 +380,20 @@ export const formSchema: FormSchema[] = [ | ||
253 | show: false, | 380 | show: false, |
254 | componentProps: { | 381 | componentProps: { |
255 | maxLength: 36, | 382 | maxLength: 36, |
383 | + placeholder: '请输入租户ID', | ||
384 | + }, | ||
385 | + dynamicRules: () => { | ||
386 | + return [ | ||
387 | + { | ||
388 | + required: false, | ||
389 | + validator: (_, value) => { | ||
390 | + if (String(value).length > 36) { | ||
391 | + return Promise.reject('字数不超过255个字'); | ||
392 | + } | ||
393 | + return Promise.resolve(); | ||
394 | + }, | ||
395 | + }, | ||
396 | + ]; | ||
256 | }, | 397 | }, |
257 | }, | 398 | }, |
258 | ]; | 399 | ]; |
@@ -51,6 +51,24 @@ export const searchFormSchema: FormSchema[] = [ | @@ -51,6 +51,24 @@ export const searchFormSchema: FormSchema[] = [ | ||
51 | field: 'emailSubject', | 51 | field: 'emailSubject', |
52 | label: '邮件主题', | 52 | label: '邮件主题', |
53 | component: 'Input', | 53 | component: 'Input', |
54 | + componentProps: { | ||
55 | + maxLength: 255, | ||
56 | + placeholder: '请输入邮件主题', | ||
57 | + }, | ||
58 | + dynamicRules: () => { | ||
59 | + return [ | ||
60 | + { | ||
61 | + required: false, | ||
62 | + validator: (_, value) => { | ||
63 | + if (String(value).length > 255) { | ||
64 | + return Promise.reject('字数不超过255个字'); | ||
65 | + } | ||
66 | + return Promise.resolve(); | ||
67 | + }, | ||
68 | + }, | ||
69 | + ]; | ||
70 | + }, | ||
71 | + | ||
54 | colProps: { span: 6 }, | 72 | colProps: { span: 6 }, |
55 | }, | 73 | }, |
56 | { | 74 | { |
@@ -24,12 +24,45 @@ | @@ -24,12 +24,45 @@ | ||
24 | label: '用途', | 24 | label: '用途', |
25 | component: 'Input', | 25 | component: 'Input', |
26 | show: false, | 26 | show: false, |
27 | + componentProps: { | ||
28 | + maxLength: 36, | ||
29 | + placeholder: '请输入用途', | ||
30 | + }, | ||
31 | + dynamicRules: () => { | ||
32 | + return [ | ||
33 | + { | ||
34 | + required: false, | ||
35 | + validator: (_, value) => { | ||
36 | + if (String(value).length > 36) { | ||
37 | + return Promise.reject('字数不超过36个字'); | ||
38 | + } | ||
39 | + return Promise.resolve(); | ||
40 | + }, | ||
41 | + }, | ||
42 | + ]; | ||
43 | + }, | ||
27 | }, | 44 | }, |
28 | { | 45 | { |
29 | field: 'messageType', | 46 | field: 'messageType', |
30 | component: 'Input', | 47 | component: 'Input', |
31 | label: 'messageType', | 48 | label: 'messageType', |
32 | show: false, | 49 | show: false, |
50 | + componentProps: { | ||
51 | + maxLength: 36, | ||
52 | + }, | ||
53 | + dynamicRules: () => { | ||
54 | + return [ | ||
55 | + { | ||
56 | + required: false, | ||
57 | + validator: (_, value) => { | ||
58 | + if (String(value).length > 36) { | ||
59 | + return Promise.reject('字数不超过36个字'); | ||
60 | + } | ||
61 | + return Promise.resolve(); | ||
62 | + }, | ||
63 | + }, | ||
64 | + ]; | ||
65 | + }, | ||
33 | }, | 66 | }, |
34 | { | 67 | { |
35 | field: 'phoneNumbers', | 68 | field: 'phoneNumbers', |
@@ -50,6 +83,23 @@ | @@ -50,6 +83,23 @@ | ||
50 | field: 'remark', | 83 | field: 'remark', |
51 | component: 'InputTextArea', | 84 | component: 'InputTextArea', |
52 | label: '备注', | 85 | label: '备注', |
86 | + componentProps: { | ||
87 | + maxLength: 255, | ||
88 | + placeholder: '请输入备注', | ||
89 | + }, | ||
90 | + dynamicRules: () => { | ||
91 | + return [ | ||
92 | + { | ||
93 | + required: false, | ||
94 | + validator: (_, value) => { | ||
95 | + if (String(value).length > 255) { | ||
96 | + return Promise.reject('字数不超过255个字'); | ||
97 | + } | ||
98 | + return Promise.resolve(); | ||
99 | + }, | ||
100 | + }, | ||
101 | + ]; | ||
102 | + }, | ||
53 | }, | 103 | }, |
54 | ]; | 104 | ]; |
55 | export default defineComponent({ | 105 | export default defineComponent({ |
@@ -95,12 +95,46 @@ export const searchFormSchema: FormSchema[] = [ | @@ -95,12 +95,46 @@ export const searchFormSchema: FormSchema[] = [ | ||
95 | label: '模板名称', | 95 | label: '模板名称', |
96 | component: 'Input', | 96 | component: 'Input', |
97 | colProps: { span: 8 }, | 97 | colProps: { span: 8 }, |
98 | + componentProps: { | ||
99 | + maxLength: 32, | ||
100 | + placeholder: '请输入模板名称', | ||
101 | + }, | ||
102 | + dynamicRules: () => { | ||
103 | + return [ | ||
104 | + { | ||
105 | + required: false, | ||
106 | + validator: (_, value) => { | ||
107 | + if (String(value).length > 32) { | ||
108 | + return Promise.reject('字数不超过32个字'); | ||
109 | + } | ||
110 | + return Promise.resolve(); | ||
111 | + }, | ||
112 | + }, | ||
113 | + ]; | ||
114 | + }, | ||
98 | }, | 115 | }, |
99 | { | 116 | { |
100 | field: 'templateCode', | 117 | field: 'templateCode', |
101 | label: '模板编码', | 118 | label: '模板编码', |
102 | component: 'Input', | 119 | component: 'Input', |
103 | colProps: { span: 8 }, | 120 | colProps: { span: 8 }, |
121 | + componentProps: { | ||
122 | + maxLength: 20, | ||
123 | + placeholder: '请输入模板编码', | ||
124 | + }, | ||
125 | + dynamicRules: () => { | ||
126 | + return [ | ||
127 | + { | ||
128 | + required: false, | ||
129 | + validator: (_, value) => { | ||
130 | + if (String(value).length > 20) { | ||
131 | + return Promise.reject('字数不超过20个字'); | ||
132 | + } | ||
133 | + return Promise.resolve(); | ||
134 | + }, | ||
135 | + }, | ||
136 | + ]; | ||
137 | + }, | ||
104 | }, | 138 | }, |
105 | ]; | 139 | ]; |
106 | 140 | ||
@@ -112,6 +146,20 @@ export const formSchema: FormSchema[] = [ | @@ -112,6 +146,20 @@ export const formSchema: FormSchema[] = [ | ||
112 | show: false, | 146 | show: false, |
113 | componentProps: { | 147 | componentProps: { |
114 | maxLength: 36, | 148 | maxLength: 36, |
149 | + placeholder: '请输入主键', | ||
150 | + }, | ||
151 | + dynamicRules: () => { | ||
152 | + return [ | ||
153 | + { | ||
154 | + required: false, | ||
155 | + validator: (_, value) => { | ||
156 | + if (String(value).length > 36) { | ||
157 | + return Promise.reject('字数不超过36个字'); | ||
158 | + } | ||
159 | + return Promise.resolve(); | ||
160 | + }, | ||
161 | + }, | ||
162 | + ]; | ||
115 | }, | 163 | }, |
116 | }, | 164 | }, |
117 | { | 165 | { |
@@ -150,6 +198,20 @@ export const formSchema: FormSchema[] = [ | @@ -150,6 +198,20 @@ export const formSchema: FormSchema[] = [ | ||
150 | component: 'Input', | 198 | component: 'Input', |
151 | componentProps: { | 199 | componentProps: { |
152 | maxLength: 32, | 200 | maxLength: 32, |
201 | + placeholder: '请输入模板名称', | ||
202 | + }, | ||
203 | + dynamicRules: () => { | ||
204 | + return [ | ||
205 | + { | ||
206 | + required: false, | ||
207 | + validator: (_, value) => { | ||
208 | + if (String(value).length > 32) { | ||
209 | + return Promise.reject('字数不超过32个字'); | ||
210 | + } | ||
211 | + return Promise.resolve(); | ||
212 | + }, | ||
213 | + }, | ||
214 | + ]; | ||
153 | }, | 215 | }, |
154 | }, | 216 | }, |
155 | { | 217 | { |
@@ -159,6 +221,20 @@ export const formSchema: FormSchema[] = [ | @@ -159,6 +221,20 @@ export const formSchema: FormSchema[] = [ | ||
159 | component: 'Input', | 221 | component: 'Input', |
160 | componentProps: { | 222 | componentProps: { |
161 | maxLength: 20, | 223 | maxLength: 20, |
224 | + placeholder: '请输入模板编号', | ||
225 | + }, | ||
226 | + dynamicRules: () => { | ||
227 | + return [ | ||
228 | + { | ||
229 | + required: false, | ||
230 | + validator: (_, value) => { | ||
231 | + if (String(value).length > 20) { | ||
232 | + return Promise.reject('字数不超过20个字'); | ||
233 | + } | ||
234 | + return Promise.resolve(); | ||
235 | + }, | ||
236 | + }, | ||
237 | + ]; | ||
162 | }, | 238 | }, |
163 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 239 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
164 | }, | 240 | }, |
@@ -169,7 +245,22 @@ export const formSchema: FormSchema[] = [ | @@ -169,7 +245,22 @@ export const formSchema: FormSchema[] = [ | ||
169 | component: 'Input', | 245 | component: 'Input', |
170 | componentProps: { | 246 | componentProps: { |
171 | maxLength: 32, | 247 | maxLength: 32, |
248 | + placeholder: '请输入签名', | ||
172 | }, | 249 | }, |
250 | + dynamicRules: () => { | ||
251 | + return [ | ||
252 | + { | ||
253 | + required: false, | ||
254 | + validator: (_, value) => { | ||
255 | + if (String(value).length > 32) { | ||
256 | + return Promise.reject('字数不超过32个字'); | ||
257 | + } | ||
258 | + return Promise.resolve(); | ||
259 | + }, | ||
260 | + }, | ||
261 | + ]; | ||
262 | + }, | ||
263 | + | ||
173 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 264 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
174 | }, | 265 | }, |
175 | { | 266 | { |
@@ -194,6 +285,20 @@ export const formSchema: FormSchema[] = [ | @@ -194,6 +285,20 @@ export const formSchema: FormSchema[] = [ | ||
194 | show: false, | 285 | show: false, |
195 | componentProps: { | 286 | componentProps: { |
196 | maxLength: 36, | 287 | maxLength: 36, |
288 | + placeholder: '请输入租户ID', | ||
289 | + }, | ||
290 | + dynamicRules: () => { | ||
291 | + return [ | ||
292 | + { | ||
293 | + required: false, | ||
294 | + validator: (_, value) => { | ||
295 | + if (String(value).length > 36) { | ||
296 | + return Promise.reject('字数不超过36个字'); | ||
297 | + } | ||
298 | + return Promise.resolve(); | ||
299 | + }, | ||
300 | + }, | ||
301 | + ]; | ||
197 | }, | 302 | }, |
198 | }, | 303 | }, |
199 | ]; | 304 | ]; |
@@ -76,7 +76,7 @@ | @@ -76,7 +76,7 @@ | ||
76 | async (newV) => { | 76 | async (newV) => { |
77 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | 77 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); |
78 | options.items.forEach((v) => { | 78 | options.items.forEach((v) => { |
79 | - return (v.value = v.id); | 79 | + return (v.value = v.id), (v.label = v.name); |
80 | }); | 80 | }); |
81 | updateSchema({ | 81 | updateSchema({ |
82 | field: 'deviceId', | 82 | field: 'deviceId', |
@@ -70,7 +70,7 @@ | @@ -70,7 +70,7 @@ | ||
70 | async (newV) => { | 70 | async (newV) => { |
71 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | 71 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); |
72 | options.items.forEach((v) => { | 72 | options.items.forEach((v) => { |
73 | - return (v.value = v.id); | 73 | + return (v.value = v.id), (v.label = v.name); |
74 | }); | 74 | }); |
75 | updateSchema({ | 75 | updateSchema({ |
76 | field: 'deviceId', | 76 | field: 'deviceId', |
@@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
87 | async (newV) => { | 87 | async (newV) => { |
88 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | 88 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); |
89 | options.items.forEach((v) => { | 89 | options.items.forEach((v) => { |
90 | - return (v.value = v.id); | 90 | + return (v.value = v.id), (v.label = v.name); |
91 | }); | 91 | }); |
92 | updateSchema({ | 92 | updateSchema({ |
93 | field: 'deviceId', | 93 | field: 'deviceId', |
@@ -150,6 +150,19 @@ export const formSchema: FormSchema[] = [ | @@ -150,6 +150,19 @@ export const formSchema: FormSchema[] = [ | ||
150 | maxLength: 36, | 150 | maxLength: 36, |
151 | placeholder: '请输入场景联动名称', | 151 | placeholder: '请输入场景联动名称', |
152 | }, | 152 | }, |
153 | + dynamicRules: () => { | ||
154 | + return [ | ||
155 | + { | ||
156 | + required: true, | ||
157 | + validator: (_, value) => { | ||
158 | + if (String(value).length > 36) { | ||
159 | + return Promise.reject('字数不超过36个字'); | ||
160 | + } | ||
161 | + return Promise.resolve(); | ||
162 | + }, | ||
163 | + }, | ||
164 | + ]; | ||
165 | + }, | ||
153 | }, | 166 | }, |
154 | { | 167 | { |
155 | required: true, | 168 | required: true, |
@@ -204,6 +217,19 @@ export const formSchema: FormSchema[] = [ | @@ -204,6 +217,19 @@ export const formSchema: FormSchema[] = [ | ||
204 | maxLength: 255, | 217 | maxLength: 255, |
205 | placeholder: '请输入描述', | 218 | placeholder: '请输入描述', |
206 | }, | 219 | }, |
220 | + dynamicRules: () => { | ||
221 | + return [ | ||
222 | + { | ||
223 | + required: false, | ||
224 | + validator: (_, value) => { | ||
225 | + if (String(value).length > 255) { | ||
226 | + return Promise.reject('字数不超过255个字'); | ||
227 | + } | ||
228 | + return Promise.resolve(); | ||
229 | + }, | ||
230 | + }, | ||
231 | + ]; | ||
232 | + }, | ||
207 | }, | 233 | }, |
208 | ]; | 234 | ]; |
209 | 235 | ||
@@ -228,7 +254,20 @@ export const searchFormSchema: FormSchema[] = [ | @@ -228,7 +254,20 @@ export const searchFormSchema: FormSchema[] = [ | ||
228 | colProps: { span: 8 }, | 254 | colProps: { span: 8 }, |
229 | componentProps: { | 255 | componentProps: { |
230 | maxLength: 36, | 256 | maxLength: 36, |
231 | - placeholder: '请输入场景联动状态', | 257 | + placeholder: '请输入名称', |
258 | + }, | ||
259 | + dynamicRules: () => { | ||
260 | + return [ | ||
261 | + { | ||
262 | + required: false, | ||
263 | + validator: (_, value) => { | ||
264 | + if (String(value).length > 36) { | ||
265 | + return Promise.reject('字数不超过36个字'); | ||
266 | + } | ||
267 | + return Promise.resolve(); | ||
268 | + }, | ||
269 | + }, | ||
270 | + ]; | ||
232 | }, | 271 | }, |
233 | }, | 272 | }, |
234 | { | 273 | { |
@@ -266,9 +305,14 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -266,9 +305,14 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
266 | field: 'deviceId', | 305 | field: 'deviceId', |
267 | label: '', | 306 | label: '', |
268 | component: 'Select', | 307 | component: 'Select', |
269 | - componentProps: { | ||
270 | - placeholder: '请选择设备', | 308 | + componentProps() { |
309 | + return { | ||
310 | + placeholder: '请选择设备', | ||
311 | + }; | ||
271 | }, | 312 | }, |
313 | + // componentProps: { | ||
314 | + // placeholder: '请选择设备', | ||
315 | + // }, | ||
272 | ifShow: ({ values }) => | 316 | ifShow: ({ values }) => |
273 | !isTime(Reflect.get(values, 'triggerEvent')) && | 317 | !isTime(Reflect.get(values, 'triggerEvent')) && |
274 | !isScene(Reflect.get(values, 'triggerEvent')) && | 318 | !isScene(Reflect.get(values, 'triggerEvent')) && |
@@ -283,9 +327,22 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -283,9 +327,22 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
283 | label: '', | 327 | label: '', |
284 | componentProps: { | 328 | componentProps: { |
285 | maxLength: 255, | 329 | maxLength: 255, |
286 | - | ||
287 | placeholder: '请输入Cron表达式', | 330 | placeholder: '请输入Cron表达式', |
288 | }, | 331 | }, |
332 | + dynamicRules: () => { | ||
333 | + return [ | ||
334 | + { | ||
335 | + required: false, | ||
336 | + validator: (_, value) => { | ||
337 | + if (String(value).length > 255) { | ||
338 | + return Promise.reject('字数不超过255个字'); | ||
339 | + } | ||
340 | + return Promise.resolve(); | ||
341 | + }, | ||
342 | + }, | ||
343 | + ]; | ||
344 | + }, | ||
345 | + | ||
289 | colProps: { | 346 | colProps: { |
290 | span: 12, | 347 | span: 12, |
291 | }, | 348 | }, |
@@ -373,9 +430,22 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -373,9 +430,22 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
373 | label: '', | 430 | label: '', |
374 | componentProps: { | 431 | componentProps: { |
375 | maxLength: 16, | 432 | maxLength: 16, |
376 | - | ||
377 | placeholder: '请输入比较值', | 433 | placeholder: '请输入比较值', |
378 | }, | 434 | }, |
435 | + dynamicRules: () => { | ||
436 | + return [ | ||
437 | + { | ||
438 | + required: false, | ||
439 | + validator: (_, value) => { | ||
440 | + if (String(value).length > 16) { | ||
441 | + return Promise.reject('字数不超过16个字'); | ||
442 | + } | ||
443 | + return Promise.resolve(); | ||
444 | + }, | ||
445 | + }, | ||
446 | + ]; | ||
447 | + }, | ||
448 | + | ||
379 | ifShow: ({ values }) => | 449 | ifShow: ({ values }) => |
380 | isWenDu(Reflect.get(values, 'attributeChoose')) && | 450 | isWenDu(Reflect.get(values, 'attributeChoose')) && |
381 | !isUpAndDown(Reflect.get(values, 'touchWay')) && | 451 | !isUpAndDown(Reflect.get(values, 'touchWay')) && |
@@ -528,6 +598,20 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -528,6 +598,20 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
528 | maxLength: 16, | 598 | maxLength: 16, |
529 | placeholder: '请输入比较值', | 599 | placeholder: '请输入比较值', |
530 | }, | 600 | }, |
601 | + dynamicRules: () => { | ||
602 | + return [ | ||
603 | + { | ||
604 | + required: false, | ||
605 | + validator: (_, value) => { | ||
606 | + if (String(value).length > 16) { | ||
607 | + return Promise.reject('字数不超过16个字'); | ||
608 | + } | ||
609 | + return Promise.resolve(); | ||
610 | + }, | ||
611 | + }, | ||
612 | + ]; | ||
613 | + }, | ||
614 | + | ||
531 | ifShow: ({ values }) => | 615 | ifShow: ({ values }) => |
532 | isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 616 | isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), |
533 | colProps: { | 617 | colProps: { |
@@ -559,9 +643,21 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -559,9 +643,21 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
559 | label: '', | 643 | label: '', |
560 | componentProps: { | 644 | componentProps: { |
561 | maxLength: 16, | 645 | maxLength: 16, |
562 | - | ||
563 | placeholder: '请输入比较值', | 646 | placeholder: '请输入比较值', |
564 | }, | 647 | }, |
648 | + dynamicRules: () => { | ||
649 | + return [ | ||
650 | + { | ||
651 | + required: false, | ||
652 | + validator: (_, value) => { | ||
653 | + if (String(value).length > 16) { | ||
654 | + return Promise.reject('字数不超过16个字'); | ||
655 | + } | ||
656 | + return Promise.resolve(); | ||
657 | + }, | ||
658 | + }, | ||
659 | + ]; | ||
660 | + }, | ||
565 | ifShow: ({ values }) => | 661 | ifShow: ({ values }) => |
566 | isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 662 | isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), |
567 | colProps: { | 663 | colProps: { |
@@ -613,9 +709,21 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -613,9 +709,21 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
613 | label: '', | 709 | label: '', |
614 | componentProps: { | 710 | componentProps: { |
615 | maxLength: 255, | 711 | maxLength: 255, |
616 | - | ||
617 | placeholder: '请输入下发指定', | 712 | placeholder: '请输入下发指定', |
618 | }, | 713 | }, |
714 | + dynamicRules: () => { | ||
715 | + return [ | ||
716 | + { | ||
717 | + required: false, | ||
718 | + validator: (_, value) => { | ||
719 | + if (String(value).length > 255) { | ||
720 | + return Promise.reject('字数不超过255个字'); | ||
721 | + } | ||
722 | + return Promise.resolve(); | ||
723 | + }, | ||
724 | + }, | ||
725 | + ]; | ||
726 | + }, | ||
619 | ifShow: ({ values }) => | 727 | ifShow: ({ values }) => |
620 | !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')), | 728 | !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')), |
621 | colProps: { | 729 | colProps: { |
@@ -161,9 +161,10 @@ export const searchFormSchema: FormSchema[] = [ | @@ -161,9 +161,10 @@ export const searchFormSchema: FormSchema[] = [ | ||
161 | { | 161 | { |
162 | field: 'type', | 162 | field: 'type', |
163 | label: '', | 163 | label: '', |
164 | - colProps: { span: 8 }, | 164 | + colProps: { span: 4 }, |
165 | component: 'Select', | 165 | component: 'Select', |
166 | componentProps: { | 166 | componentProps: { |
167 | + placeholder: '请选择类型', | ||
167 | options: [ | 168 | options: [ |
168 | { | 169 | { |
169 | label: '公告', | 170 | label: '公告', |
@@ -43,12 +43,44 @@ export const searchFormSchema: FormSchema[] = [ | @@ -43,12 +43,44 @@ export const searchFormSchema: FormSchema[] = [ | ||
43 | label: '用户名', | 43 | label: '用户名', |
44 | component: 'Input', | 44 | component: 'Input', |
45 | colProps: { span: 8 }, | 45 | colProps: { span: 8 }, |
46 | + componentProps: { | ||
47 | + maxLength: 255, | ||
48 | + }, | ||
49 | + dynamicRules: () => { | ||
50 | + return [ | ||
51 | + { | ||
52 | + required: false, | ||
53 | + validator: (_, value) => { | ||
54 | + if (String(value).length > 255) { | ||
55 | + return Promise.reject('字数不超过255个字'); | ||
56 | + } | ||
57 | + return Promise.resolve(); | ||
58 | + }, | ||
59 | + }, | ||
60 | + ]; | ||
61 | + }, | ||
46 | }, | 62 | }, |
47 | { | 63 | { |
48 | field: 'realName', | 64 | field: 'realName', |
49 | label: '姓名', | 65 | label: '姓名', |
50 | component: 'Input', | 66 | component: 'Input', |
51 | colProps: { span: 8 }, | 67 | colProps: { span: 8 }, |
68 | + componentProps: { | ||
69 | + maxLength: 255, | ||
70 | + }, | ||
71 | + dynamicRules: () => { | ||
72 | + return [ | ||
73 | + { | ||
74 | + required: false, | ||
75 | + validator: (_, value) => { | ||
76 | + if (String(value).length > 255) { | ||
77 | + return Promise.reject('字数不超过255个字'); | ||
78 | + } | ||
79 | + return Promise.resolve(); | ||
80 | + }, | ||
81 | + }, | ||
82 | + ]; | ||
83 | + }, | ||
52 | }, | 84 | }, |
53 | ]; | 85 | ]; |
54 | 86 | ||
@@ -61,6 +93,19 @@ export const accountFormSchema: FormSchema[] = [ | @@ -61,6 +93,19 @@ export const accountFormSchema: FormSchema[] = [ | ||
61 | componentProps: { | 93 | componentProps: { |
62 | maxLength: 36, | 94 | maxLength: 36, |
63 | }, | 95 | }, |
96 | + dynamicRules: () => { | ||
97 | + return [ | ||
98 | + { | ||
99 | + required: false, | ||
100 | + validator: (_, value) => { | ||
101 | + if (String(value).length > 36) { | ||
102 | + return Promise.reject('字数不超过36个字'); | ||
103 | + } | ||
104 | + return Promise.resolve(); | ||
105 | + }, | ||
106 | + }, | ||
107 | + ]; | ||
108 | + }, | ||
64 | }, | 109 | }, |
65 | { | 110 | { |
66 | field: 'username', | 111 | field: 'username', |
@@ -114,6 +159,19 @@ export const accountFormSchema: FormSchema[] = [ | @@ -114,6 +159,19 @@ export const accountFormSchema: FormSchema[] = [ | ||
114 | componentProps: { | 159 | componentProps: { |
115 | maxLength: 255, | 160 | maxLength: 255, |
116 | }, | 161 | }, |
162 | + dynamicRules: () => { | ||
163 | + return [ | ||
164 | + { | ||
165 | + required: true, | ||
166 | + validator: (_, value) => { | ||
167 | + if (String(value).length > 255) { | ||
168 | + return Promise.reject('字数不超过255个字'); | ||
169 | + } | ||
170 | + return Promise.resolve(); | ||
171 | + }, | ||
172 | + }, | ||
173 | + ]; | ||
174 | + }, | ||
117 | }, | 175 | }, |
118 | { | 176 | { |
119 | label: '角色', | 177 | label: '角色', |
@@ -176,5 +234,21 @@ export const accountFormSchema: FormSchema[] = [ | @@ -176,5 +234,21 @@ export const accountFormSchema: FormSchema[] = [ | ||
176 | label: ' ', | 234 | label: ' ', |
177 | component: 'Input', | 235 | component: 'Input', |
178 | slot: 'organizationId', | 236 | slot: 'organizationId', |
237 | + componentProps: { | ||
238 | + maxLength: 36, | ||
239 | + }, | ||
240 | + dynamicRules: () => { | ||
241 | + return [ | ||
242 | + { | ||
243 | + required: false, | ||
244 | + validator: (_, value) => { | ||
245 | + if (String(value).length > 36) { | ||
246 | + return Promise.reject('字数不超过36个字'); | ||
247 | + } | ||
248 | + return Promise.resolve(); | ||
249 | + }, | ||
250 | + }, | ||
251 | + ]; | ||
252 | + }, | ||
179 | }, | 253 | }, |
180 | ]; | 254 | ]; |
@@ -38,6 +38,19 @@ export const searchFormSchema: FormSchema[] = [ | @@ -38,6 +38,19 @@ export const searchFormSchema: FormSchema[] = [ | ||
38 | componentProps: { | 38 | componentProps: { |
39 | maxLength: 32, | 39 | maxLength: 32, |
40 | }, | 40 | }, |
41 | + dynamicRules: () => { | ||
42 | + return [ | ||
43 | + { | ||
44 | + required: false, | ||
45 | + validator: (_, value) => { | ||
46 | + if (String(value).length > 32) { | ||
47 | + return Promise.reject('字数不超过32个字'); | ||
48 | + } | ||
49 | + return Promise.resolve(); | ||
50 | + }, | ||
51 | + }, | ||
52 | + ]; | ||
53 | + }, | ||
41 | }, | 54 | }, |
42 | { | 55 | { |
43 | field: 'dictCode', | 56 | field: 'dictCode', |
@@ -47,6 +60,19 @@ export const searchFormSchema: FormSchema[] = [ | @@ -47,6 +60,19 @@ export const searchFormSchema: FormSchema[] = [ | ||
47 | componentProps: { | 60 | componentProps: { |
48 | maxLength: 32, | 61 | maxLength: 32, |
49 | }, | 62 | }, |
63 | + dynamicRules: () => { | ||
64 | + return [ | ||
65 | + { | ||
66 | + required: false, | ||
67 | + validator: (_, value) => { | ||
68 | + if (String(value).length > 32) { | ||
69 | + return Promise.reject('字数不超过32个字'); | ||
70 | + } | ||
71 | + return Promise.resolve(); | ||
72 | + }, | ||
73 | + }, | ||
74 | + ]; | ||
75 | + }, | ||
50 | }, | 76 | }, |
51 | ]; | 77 | ]; |
52 | 78 | ||
@@ -59,6 +85,19 @@ export const formSchema: FormSchema[] = [ | @@ -59,6 +85,19 @@ export const formSchema: FormSchema[] = [ | ||
59 | componentProps: { | 85 | componentProps: { |
60 | maxLength: 32, | 86 | maxLength: 32, |
61 | }, | 87 | }, |
88 | + dynamicRules: () => { | ||
89 | + return [ | ||
90 | + { | ||
91 | + required: true, | ||
92 | + validator: (_, value) => { | ||
93 | + if (String(value).length > 32) { | ||
94 | + return Promise.reject('字数不超过32个字'); | ||
95 | + } | ||
96 | + return Promise.resolve(); | ||
97 | + }, | ||
98 | + }, | ||
99 | + ]; | ||
100 | + }, | ||
62 | }, | 101 | }, |
63 | { | 102 | { |
64 | field: 'dictCode', | 103 | field: 'dictCode', |
@@ -68,6 +107,19 @@ export const formSchema: FormSchema[] = [ | @@ -68,6 +107,19 @@ export const formSchema: FormSchema[] = [ | ||
68 | componentProps: { | 107 | componentProps: { |
69 | maxLength: 32, | 108 | maxLength: 32, |
70 | }, | 109 | }, |
110 | + dynamicRules: () => { | ||
111 | + return [ | ||
112 | + { | ||
113 | + required: true, | ||
114 | + validator: (_, value) => { | ||
115 | + if (String(value).length > 32) { | ||
116 | + return Promise.reject('字数不超过32个字'); | ||
117 | + } | ||
118 | + return Promise.resolve(); | ||
119 | + }, | ||
120 | + }, | ||
121 | + ]; | ||
122 | + }, | ||
71 | }, | 123 | }, |
72 | { | 124 | { |
73 | label: '备注', | 125 | label: '备注', |
@@ -76,5 +128,18 @@ export const formSchema: FormSchema[] = [ | @@ -76,5 +128,18 @@ export const formSchema: FormSchema[] = [ | ||
76 | componentProps: { | 128 | componentProps: { |
77 | maxLength: 255, | 129 | maxLength: 255, |
78 | }, | 130 | }, |
131 | + dynamicRules: () => { | ||
132 | + return [ | ||
133 | + { | ||
134 | + required: false, | ||
135 | + validator: (_, value) => { | ||
136 | + if (String(value).length > 255) { | ||
137 | + return Promise.reject('字数不超过255个字'); | ||
138 | + } | ||
139 | + return Promise.resolve(); | ||
140 | + }, | ||
141 | + }, | ||
142 | + ]; | ||
143 | + }, | ||
79 | }, | 144 | }, |
80 | ]; | 145 | ]; |
@@ -70,6 +70,19 @@ export const searchFormSchema: FormSchema[] = [ | @@ -70,6 +70,19 @@ export const searchFormSchema: FormSchema[] = [ | ||
70 | componentProps: { | 70 | componentProps: { |
71 | maxLength: 32, | 71 | maxLength: 32, |
72 | }, | 72 | }, |
73 | + dynamicRules: () => { | ||
74 | + return [ | ||
75 | + { | ||
76 | + required: false, | ||
77 | + validator: (_, value) => { | ||
78 | + if (String(value).length > 32) { | ||
79 | + return Promise.reject('字数不超过32个字'); | ||
80 | + } | ||
81 | + return Promise.resolve(); | ||
82 | + }, | ||
83 | + }, | ||
84 | + ]; | ||
85 | + }, | ||
73 | }, | 86 | }, |
74 | { | 87 | { |
75 | field: 'dictId', | 88 | field: 'dictId', |
@@ -79,6 +92,19 @@ export const searchFormSchema: FormSchema[] = [ | @@ -79,6 +92,19 @@ export const searchFormSchema: FormSchema[] = [ | ||
79 | componentProps: { | 92 | componentProps: { |
80 | maxLength: 36, | 93 | maxLength: 36, |
81 | }, | 94 | }, |
95 | + dynamicRules: () => { | ||
96 | + return [ | ||
97 | + { | ||
98 | + required: false, | ||
99 | + validator: (_, value) => { | ||
100 | + if (String(value).length > 36) { | ||
101 | + return Promise.reject('字数不超过36个字'); | ||
102 | + } | ||
103 | + return Promise.resolve(); | ||
104 | + }, | ||
105 | + }, | ||
106 | + ]; | ||
107 | + }, | ||
82 | }, | 108 | }, |
83 | ]; | 109 | ]; |
84 | 110 | ||
@@ -91,6 +117,19 @@ export const formSchema: FormSchema[] = [ | @@ -91,6 +117,19 @@ export const formSchema: FormSchema[] = [ | ||
91 | componentProps: { | 117 | componentProps: { |
92 | maxLength: 32, | 118 | maxLength: 32, |
93 | }, | 119 | }, |
120 | + dynamicRules: () => { | ||
121 | + return [ | ||
122 | + { | ||
123 | + required: true, | ||
124 | + validator: (_, value) => { | ||
125 | + if (String(value).length > 32) { | ||
126 | + return Promise.reject('字数不超过32个字'); | ||
127 | + } | ||
128 | + return Promise.resolve(); | ||
129 | + }, | ||
130 | + }, | ||
131 | + ]; | ||
132 | + }, | ||
94 | }, | 133 | }, |
95 | { | 134 | { |
96 | field: 'itemValue', | 135 | field: 'itemValue', |
@@ -100,6 +139,19 @@ export const formSchema: FormSchema[] = [ | @@ -100,6 +139,19 @@ export const formSchema: FormSchema[] = [ | ||
100 | componentProps: { | 139 | componentProps: { |
101 | maxLength: 32, | 140 | maxLength: 32, |
102 | }, | 141 | }, |
142 | + dynamicRules: () => { | ||
143 | + return [ | ||
144 | + { | ||
145 | + required: true, | ||
146 | + validator: (_, value) => { | ||
147 | + if (String(value).length > 32) { | ||
148 | + return Promise.reject('字数不超过32个字'); | ||
149 | + } | ||
150 | + return Promise.resolve(); | ||
151 | + }, | ||
152 | + }, | ||
153 | + ]; | ||
154 | + }, | ||
103 | }, | 155 | }, |
104 | { | 156 | { |
105 | field: 'sort', | 157 | field: 'sort', |
@@ -129,5 +181,18 @@ export const formSchema: FormSchema[] = [ | @@ -129,5 +181,18 @@ export const formSchema: FormSchema[] = [ | ||
129 | componentProps: { | 181 | componentProps: { |
130 | maxLength: 255, | 182 | maxLength: 255, |
131 | }, | 183 | }, |
184 | + dynamicRules: () => { | ||
185 | + return [ | ||
186 | + { | ||
187 | + required: false, | ||
188 | + validator: (_, value) => { | ||
189 | + if (String(value).length > 255) { | ||
190 | + return Promise.reject('字数不超过255个字'); | ||
191 | + } | ||
192 | + return Promise.resolve(); | ||
193 | + }, | ||
194 | + }, | ||
195 | + ]; | ||
196 | + }, | ||
132 | }, | 197 | }, |
133 | ]; | 198 | ]; |
@@ -80,6 +80,22 @@ export const searchFormSchema: FormSchema[] = [ | @@ -80,6 +80,22 @@ export const searchFormSchema: FormSchema[] = [ | ||
80 | // label: '菜单名称', | 80 | // label: '菜单名称', |
81 | component: 'Input', | 81 | component: 'Input', |
82 | colProps: { span: 8 }, | 82 | colProps: { span: 8 }, |
83 | + componentProps: { | ||
84 | + maxLength: 255, | ||
85 | + }, | ||
86 | + dynamicRules: () => { | ||
87 | + return [ | ||
88 | + { | ||
89 | + required: false, | ||
90 | + validator: (_, value) => { | ||
91 | + if (String(value).length > 255) { | ||
92 | + return Promise.reject('字数不超过255个字'); | ||
93 | + } | ||
94 | + return Promise.resolve(); | ||
95 | + }, | ||
96 | + }, | ||
97 | + ]; | ||
98 | + }, | ||
83 | }, | 99 | }, |
84 | { | 100 | { |
85 | field: 'status', | 101 | field: 'status', |
@@ -126,6 +142,19 @@ export const formSchema: FormSchema[] = [ | @@ -126,6 +142,19 @@ export const formSchema: FormSchema[] = [ | ||
126 | componentProps: { | 142 | componentProps: { |
127 | maxLength: 255, | 143 | maxLength: 255, |
128 | }, | 144 | }, |
145 | + dynamicRules: () => { | ||
146 | + return [ | ||
147 | + { | ||
148 | + required: true, | ||
149 | + validator: (_, value) => { | ||
150 | + if (String(value).length > 255) { | ||
151 | + return Promise.reject('字数不超过255个字'); | ||
152 | + } | ||
153 | + return Promise.resolve(); | ||
154 | + }, | ||
155 | + }, | ||
156 | + ]; | ||
157 | + }, | ||
129 | }, | 158 | }, |
130 | 159 | ||
131 | { | 160 | { |
@@ -150,6 +179,19 @@ export const formSchema: FormSchema[] = [ | @@ -150,6 +179,19 @@ export const formSchema: FormSchema[] = [ | ||
150 | componentProps: { | 179 | componentProps: { |
151 | maxLength: 32, | 180 | maxLength: 32, |
152 | }, | 181 | }, |
182 | + dynamicRules: () => { | ||
183 | + return [ | ||
184 | + { | ||
185 | + required: true, | ||
186 | + validator: (_, value) => { | ||
187 | + if (String(value).length > 32) { | ||
188 | + return Promise.reject('字数不超过32个字'); | ||
189 | + } | ||
190 | + return Promise.resolve(); | ||
191 | + }, | ||
192 | + }, | ||
193 | + ]; | ||
194 | + }, | ||
153 | }, | 195 | }, |
154 | { | 196 | { |
155 | field: 'icon', | 197 | field: 'icon', |
@@ -168,6 +210,19 @@ export const formSchema: FormSchema[] = [ | @@ -168,6 +210,19 @@ export const formSchema: FormSchema[] = [ | ||
168 | componentProps: { | 210 | componentProps: { |
169 | maxLength: 255, | 211 | maxLength: 255, |
170 | }, | 212 | }, |
213 | + dynamicRules: () => { | ||
214 | + return [ | ||
215 | + { | ||
216 | + required: false, | ||
217 | + validator: (_, value) => { | ||
218 | + if (String(value).length > 255) { | ||
219 | + return Promise.reject('字数不超过255个字'); | ||
220 | + } | ||
221 | + return Promise.resolve(); | ||
222 | + }, | ||
223 | + }, | ||
224 | + ]; | ||
225 | + }, | ||
171 | }, | 226 | }, |
172 | { | 227 | { |
173 | field: 'component', | 228 | field: 'component', |
@@ -177,6 +232,19 @@ export const formSchema: FormSchema[] = [ | @@ -177,6 +232,19 @@ export const formSchema: FormSchema[] = [ | ||
177 | componentProps: { | 232 | componentProps: { |
178 | maxLength: 100, | 233 | maxLength: 100, |
179 | }, | 234 | }, |
235 | + dynamicRules: () => { | ||
236 | + return [ | ||
237 | + { | ||
238 | + required: false, | ||
239 | + validator: (_, value) => { | ||
240 | + if (String(value).length > 100) { | ||
241 | + return Promise.reject('字数不超过100个字'); | ||
242 | + } | ||
243 | + return Promise.resolve(); | ||
244 | + }, | ||
245 | + }, | ||
246 | + ]; | ||
247 | + }, | ||
180 | }, | 248 | }, |
181 | { | 249 | { |
182 | field: 'permission', | 250 | field: 'permission', |
@@ -186,6 +254,19 @@ export const formSchema: FormSchema[] = [ | @@ -186,6 +254,19 @@ export const formSchema: FormSchema[] = [ | ||
186 | componentProps: { | 254 | componentProps: { |
187 | maxLength: 100, | 255 | maxLength: 100, |
188 | }, | 256 | }, |
257 | + dynamicRules: () => { | ||
258 | + return [ | ||
259 | + { | ||
260 | + required: false, | ||
261 | + validator: (_, value) => { | ||
262 | + if (String(value).length > 100) { | ||
263 | + return Promise.reject('字数不超过100个字'); | ||
264 | + } | ||
265 | + return Promise.resolve(); | ||
266 | + }, | ||
267 | + }, | ||
268 | + ]; | ||
269 | + }, | ||
189 | }, | 270 | }, |
190 | { | 271 | { |
191 | field: 'status', | 272 | field: 'status', |
@@ -48,6 +48,19 @@ export const formSchema: FormSchema[] = [ | @@ -48,6 +48,19 @@ export const formSchema: FormSchema[] = [ | ||
48 | componentProps: { | 48 | componentProps: { |
49 | maxLength: 255, | 49 | maxLength: 255, |
50 | }, | 50 | }, |
51 | + dynamicRules: () => { | ||
52 | + return [ | ||
53 | + { | ||
54 | + required: true, | ||
55 | + validator: (_, value) => { | ||
56 | + if (String(value).length > 255) { | ||
57 | + return Promise.reject('字数不超过255个字'); | ||
58 | + } | ||
59 | + return Promise.resolve(); | ||
60 | + }, | ||
61 | + }, | ||
62 | + ]; | ||
63 | + }, | ||
51 | }, | 64 | }, |
52 | { | 65 | { |
53 | field: 'sort', | 66 | field: 'sort', |
@@ -57,6 +70,19 @@ export const formSchema: FormSchema[] = [ | @@ -57,6 +70,19 @@ export const formSchema: FormSchema[] = [ | ||
57 | componentProps: { | 70 | componentProps: { |
58 | maxLength: 32, | 71 | maxLength: 32, |
59 | }, | 72 | }, |
73 | + dynamicRules: () => { | ||
74 | + return [ | ||
75 | + { | ||
76 | + required: true, | ||
77 | + validator: (_, value) => { | ||
78 | + if (String(value).length > 32) { | ||
79 | + return Promise.reject('字数不超过32个字'); | ||
80 | + } | ||
81 | + return Promise.resolve(); | ||
82 | + }, | ||
83 | + }, | ||
84 | + ]; | ||
85 | + }, | ||
60 | }, | 86 | }, |
61 | { | 87 | { |
62 | label: t('routes.common.common.remark'), //备注 | 88 | label: t('routes.common.common.remark'), //备注 |
@@ -65,6 +91,19 @@ export const formSchema: FormSchema[] = [ | @@ -65,6 +91,19 @@ export const formSchema: FormSchema[] = [ | ||
65 | componentProps: { | 91 | componentProps: { |
66 | maxLength: 255, | 92 | maxLength: 255, |
67 | }, | 93 | }, |
94 | + dynamicRules: () => { | ||
95 | + return [ | ||
96 | + { | ||
97 | + required: false, | ||
98 | + validator: (_, value) => { | ||
99 | + if (String(value).length > 255) { | ||
100 | + return Promise.reject('字数不超过255个字'); | ||
101 | + } | ||
102 | + return Promise.resolve(); | ||
103 | + }, | ||
104 | + }, | ||
105 | + ]; | ||
106 | + }, | ||
68 | }, | 107 | }, |
69 | { | 108 | { |
70 | label: '租户ID', | 109 | label: '租户ID', |
@@ -74,5 +113,18 @@ export const formSchema: FormSchema[] = [ | @@ -74,5 +113,18 @@ export const formSchema: FormSchema[] = [ | ||
74 | componentProps: { | 113 | componentProps: { |
75 | maxLength: 36, | 114 | maxLength: 36, |
76 | }, | 115 | }, |
116 | + dynamicRules: () => { | ||
117 | + return [ | ||
118 | + { | ||
119 | + required: false, | ||
120 | + validator: (_, value) => { | ||
121 | + if (String(value).length > 36) { | ||
122 | + return Promise.reject('字数不超过36个字'); | ||
123 | + } | ||
124 | + return Promise.resolve(); | ||
125 | + }, | ||
126 | + }, | ||
127 | + ]; | ||
128 | + }, | ||
77 | }, | 129 | }, |
78 | ]; | 130 | ]; |
@@ -67,6 +67,22 @@ export const searchFormSchema: FormSchema[] = [ | @@ -67,6 +67,22 @@ export const searchFormSchema: FormSchema[] = [ | ||
67 | label: '角色名称', | 67 | label: '角色名称', |
68 | component: 'Input', | 68 | component: 'Input', |
69 | colProps: { span: 8 }, | 69 | colProps: { span: 8 }, |
70 | + componentProps: { | ||
71 | + maxLength: 255, | ||
72 | + }, | ||
73 | + dynamicRules: () => { | ||
74 | + return [ | ||
75 | + { | ||
76 | + required: false, | ||
77 | + validator: (_, value) => { | ||
78 | + if (String(value).length > 255) { | ||
79 | + return Promise.reject('字数不超过255个字'); | ||
80 | + } | ||
81 | + return Promise.resolve(); | ||
82 | + }, | ||
83 | + }, | ||
84 | + ]; | ||
85 | + }, | ||
70 | }, | 86 | }, |
71 | { | 87 | { |
72 | field: 'status', | 88 | field: 'status', |
@@ -91,6 +107,19 @@ export const formSchema: FormSchema[] = [ | @@ -91,6 +107,19 @@ export const formSchema: FormSchema[] = [ | ||
91 | componentProps: { | 107 | componentProps: { |
92 | maxLength: 255, | 108 | maxLength: 255, |
93 | }, | 109 | }, |
110 | + dynamicRules: () => { | ||
111 | + return [ | ||
112 | + { | ||
113 | + required: true, | ||
114 | + validator: (_, value) => { | ||
115 | + if (String(value).length > 255) { | ||
116 | + return Promise.reject('字数不超过255个字'); | ||
117 | + } | ||
118 | + return Promise.resolve(); | ||
119 | + }, | ||
120 | + }, | ||
121 | + ]; | ||
122 | + }, | ||
94 | }, | 123 | }, |
95 | { | 124 | { |
96 | field: 'status', | 125 | field: 'status', |
@@ -111,6 +140,19 @@ export const formSchema: FormSchema[] = [ | @@ -111,6 +140,19 @@ export const formSchema: FormSchema[] = [ | ||
111 | componentProps: { | 140 | componentProps: { |
112 | maxLength: 255, | 141 | maxLength: 255, |
113 | }, | 142 | }, |
143 | + dynamicRules: () => { | ||
144 | + return [ | ||
145 | + { | ||
146 | + required: false, | ||
147 | + validator: (_, value) => { | ||
148 | + if (String(value).length > 255) { | ||
149 | + return Promise.reject('字数不超过255个字'); | ||
150 | + } | ||
151 | + return Promise.resolve(); | ||
152 | + }, | ||
153 | + }, | ||
154 | + ]; | ||
155 | + }, | ||
114 | }, | 156 | }, |
115 | { | 157 | { |
116 | label: ' ', | 158 | label: ' ', |
@@ -120,5 +162,18 @@ export const formSchema: FormSchema[] = [ | @@ -120,5 +162,18 @@ export const formSchema: FormSchema[] = [ | ||
120 | componentProps: { | 162 | componentProps: { |
121 | maxLength: 255, | 163 | maxLength: 255, |
122 | }, | 164 | }, |
165 | + dynamicRules: () => { | ||
166 | + return [ | ||
167 | + { | ||
168 | + required: false, | ||
169 | + validator: (_, value) => { | ||
170 | + if (String(value).length > 255) { | ||
171 | + return Promise.reject('字数不超过255个字'); | ||
172 | + } | ||
173 | + return Promise.resolve(); | ||
174 | + }, | ||
175 | + }, | ||
176 | + ]; | ||
177 | + }, | ||
123 | }, | 178 | }, |
124 | ]; | 179 | ]; |
@@ -49,6 +49,19 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -49,6 +49,19 @@ export const tenantFormSchema: FormSchema[] = [ | ||
49 | componentProps: { | 49 | componentProps: { |
50 | maxLength: 36, | 50 | maxLength: 36, |
51 | }, | 51 | }, |
52 | + dynamicRules: () => { | ||
53 | + return [ | ||
54 | + { | ||
55 | + required: false, | ||
56 | + validator: (_, value) => { | ||
57 | + if (String(value).length > 36) { | ||
58 | + return Promise.reject('字数不超过36个字'); | ||
59 | + } | ||
60 | + return Promise.resolve(); | ||
61 | + }, | ||
62 | + }, | ||
63 | + ]; | ||
64 | + }, | ||
52 | show: false, | 65 | show: false, |
53 | }, | 66 | }, |
54 | { | 67 | { |
@@ -58,6 +71,19 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -58,6 +71,19 @@ export const tenantFormSchema: FormSchema[] = [ | ||
58 | componentProps: { | 71 | componentProps: { |
59 | maxLength: 36, | 72 | maxLength: 36, |
60 | }, | 73 | }, |
74 | + dynamicRules: () => { | ||
75 | + return [ | ||
76 | + { | ||
77 | + required: false, | ||
78 | + validator: (_, value) => { | ||
79 | + if (String(value).length > 36) { | ||
80 | + return Promise.reject('字数不超过36个字'); | ||
81 | + } | ||
82 | + return Promise.resolve(); | ||
83 | + }, | ||
84 | + }, | ||
85 | + ]; | ||
86 | + }, | ||
61 | show: false, | 87 | show: false, |
62 | }, | 88 | }, |
63 | { | 89 | { |
@@ -68,6 +94,19 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -68,6 +94,19 @@ export const tenantFormSchema: FormSchema[] = [ | ||
68 | componentProps: { | 94 | componentProps: { |
69 | maxLength: 255, | 95 | maxLength: 255, |
70 | }, | 96 | }, |
97 | + dynamicRules: () => { | ||
98 | + return [ | ||
99 | + { | ||
100 | + required: false, | ||
101 | + validator: (_, value) => { | ||
102 | + if (String(value).length > 255) { | ||
103 | + return Promise.reject('字数不超过255个字'); | ||
104 | + } | ||
105 | + return Promise.resolve(); | ||
106 | + }, | ||
107 | + }, | ||
108 | + ]; | ||
109 | + }, | ||
71 | }, | 110 | }, |
72 | { | 111 | { |
73 | field: 'name', | 112 | field: 'name', |
@@ -77,6 +116,19 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -77,6 +116,19 @@ export const tenantFormSchema: FormSchema[] = [ | ||
77 | componentProps: { | 116 | componentProps: { |
78 | maxLength: 255, | 117 | maxLength: 255, |
79 | }, | 118 | }, |
119 | + dynamicRules: () => { | ||
120 | + return [ | ||
121 | + { | ||
122 | + required: false, | ||
123 | + validator: (_, value) => { | ||
124 | + if (String(value).length > 255) { | ||
125 | + return Promise.reject('字数不超过255个字'); | ||
126 | + } | ||
127 | + return Promise.resolve(); | ||
128 | + }, | ||
129 | + }, | ||
130 | + ]; | ||
131 | + }, | ||
80 | }, | 132 | }, |
81 | { | 133 | { |
82 | field: 'roleIds', | 134 | field: 'roleIds', |
@@ -121,5 +173,18 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -121,5 +173,18 @@ export const tenantFormSchema: FormSchema[] = [ | ||
121 | componentProps: { | 173 | componentProps: { |
122 | maxLength: 500, | 174 | maxLength: 500, |
123 | }, | 175 | }, |
176 | + dynamicRules: () => { | ||
177 | + return [ | ||
178 | + { | ||
179 | + required: false, | ||
180 | + validator: (_, value) => { | ||
181 | + if (String(value).length > 500) { | ||
182 | + return Promise.reject('字数不超过500个字'); | ||
183 | + } | ||
184 | + return Promise.resolve(); | ||
185 | + }, | ||
186 | + }, | ||
187 | + ]; | ||
188 | + }, | ||
124 | }, | 189 | }, |
125 | ]; | 190 | ]; |
@@ -8,9 +8,22 @@ export const schemas: FormSchema[] = [ | @@ -8,9 +8,22 @@ export const schemas: FormSchema[] = [ | ||
8 | span: 24, | 8 | span: 24, |
9 | }, | 9 | }, |
10 | componentProps: { | 10 | componentProps: { |
11 | - maxLength: 50, | 11 | + maxLength: 255, |
12 | placeholder: '请输入平台名称', | 12 | placeholder: '请输入平台名称', |
13 | }, | 13 | }, |
14 | + dynamicRules: () => { | ||
15 | + return [ | ||
16 | + { | ||
17 | + required: false, | ||
18 | + validator: (_, value) => { | ||
19 | + if (String(value).length > 255) { | ||
20 | + return Promise.reject('字数不超过255个字'); | ||
21 | + } | ||
22 | + return Promise.resolve(); | ||
23 | + }, | ||
24 | + }, | ||
25 | + ]; | ||
26 | + }, | ||
14 | }, | 27 | }, |
15 | { | 28 | { |
16 | field: 'logo', | 29 | field: 'logo', |
@@ -9,9 +9,22 @@ export const schemas: FormSchema[] = [ | @@ -9,9 +9,22 @@ export const schemas: FormSchema[] = [ | ||
9 | span: 24, | 9 | span: 24, |
10 | }, | 10 | }, |
11 | componentProps: { | 11 | componentProps: { |
12 | - maxLength: 50, | 12 | + maxLength: 255, |
13 | placeholder: '请输入平台名称', | 13 | placeholder: '请输入平台名称', |
14 | }, | 14 | }, |
15 | + dynamicRules: () => { | ||
16 | + return [ | ||
17 | + { | ||
18 | + required: false, | ||
19 | + validator: (_, value) => { | ||
20 | + if (String(value).length > 255) { | ||
21 | + return Promise.reject('字数不超过255个字'); | ||
22 | + } | ||
23 | + return Promise.resolve(); | ||
24 | + }, | ||
25 | + }, | ||
26 | + ]; | ||
27 | + }, | ||
15 | }, | 28 | }, |
16 | { | 29 | { |
17 | field: 'logo', | 30 | field: 'logo', |
@@ -58,6 +71,20 @@ export const schemas: FormSchema[] = [ | @@ -58,6 +71,20 @@ export const schemas: FormSchema[] = [ | ||
58 | }, | 71 | }, |
59 | componentProps: { | 72 | componentProps: { |
60 | maxLength: 100, | 73 | maxLength: 100, |
74 | + placeholder: '请输入页面底部版权信息', | ||
75 | + }, | ||
76 | + dynamicRules: () => { | ||
77 | + return [ | ||
78 | + { | ||
79 | + required: false, | ||
80 | + validator: (_, value) => { | ||
81 | + if (String(value).length > 100) { | ||
82 | + return Promise.reject('字数不超过100个字'); | ||
83 | + } | ||
84 | + return Promise.resolve(); | ||
85 | + }, | ||
86 | + }, | ||
87 | + ]; | ||
61 | }, | 88 | }, |
62 | }, | 89 | }, |
63 | { | 90 | { |
@@ -69,6 +96,20 @@ export const schemas: FormSchema[] = [ | @@ -69,6 +96,20 @@ export const schemas: FormSchema[] = [ | ||
69 | }, | 96 | }, |
70 | componentProps: { | 97 | componentProps: { |
71 | maxLength: 50, | 98 | maxLength: 50, |
99 | + placeholder: '请输入备案信息', | ||
100 | + }, | ||
101 | + dynamicRules: () => { | ||
102 | + return [ | ||
103 | + { | ||
104 | + required: false, | ||
105 | + validator: (_, value) => { | ||
106 | + if (String(value).length > 50) { | ||
107 | + return Promise.reject('字数不超过50个字'); | ||
108 | + } | ||
109 | + return Promise.resolve(); | ||
110 | + }, | ||
111 | + }, | ||
112 | + ]; | ||
72 | }, | 113 | }, |
73 | }, | 114 | }, |
74 | { | 115 | { |
@@ -80,6 +121,20 @@ export const schemas: FormSchema[] = [ | @@ -80,6 +121,20 @@ export const schemas: FormSchema[] = [ | ||
80 | }, | 121 | }, |
81 | componentProps: { | 122 | componentProps: { |
82 | maxLength: 100, | 123 | maxLength: 100, |
124 | + placeholder: '请输入绑定域名', | ||
125 | + }, | ||
126 | + dynamicRules: () => { | ||
127 | + return [ | ||
128 | + { | ||
129 | + required: false, | ||
130 | + validator: (_, value) => { | ||
131 | + if (String(value).length > 100) { | ||
132 | + return Promise.reject('字数不超过100个字'); | ||
133 | + } | ||
134 | + return Promise.resolve(); | ||
135 | + }, | ||
136 | + }, | ||
137 | + ]; | ||
83 | }, | 138 | }, |
84 | }, | 139 | }, |
85 | ]; | 140 | ]; |
@@ -14,6 +14,19 @@ export const schemas: FormSchema[] = [ | @@ -14,6 +14,19 @@ export const schemas: FormSchema[] = [ | ||
14 | maxLength: 100, | 14 | maxLength: 100, |
15 | placeholder: '请输入公司名称', | 15 | placeholder: '请输入公司名称', |
16 | }, | 16 | }, |
17 | + dynamicRules: () => { | ||
18 | + return [ | ||
19 | + { | ||
20 | + required: false, | ||
21 | + validator: (_, value) => { | ||
22 | + if (String(value).length > 100) { | ||
23 | + return Promise.reject('字数不超过100个字'); | ||
24 | + } | ||
25 | + return Promise.resolve(); | ||
26 | + }, | ||
27 | + }, | ||
28 | + ]; | ||
29 | + }, | ||
17 | }, | 30 | }, |
18 | { | 31 | { |
19 | field: 'abbreviation', | 32 | field: 'abbreviation', |
@@ -24,9 +37,21 @@ export const schemas: FormSchema[] = [ | @@ -24,9 +37,21 @@ export const schemas: FormSchema[] = [ | ||
24 | }, | 37 | }, |
25 | componentProps: { | 38 | componentProps: { |
26 | maxLength: 100, | 39 | maxLength: 100, |
27 | - | ||
28 | placeholder: '请输入公司简称', | 40 | placeholder: '请输入公司简称', |
29 | }, | 41 | }, |
42 | + dynamicRules: () => { | ||
43 | + return [ | ||
44 | + { | ||
45 | + required: false, | ||
46 | + validator: (_, value) => { | ||
47 | + if (String(value).length > 100) { | ||
48 | + return Promise.reject('字数不超过100个字'); | ||
49 | + } | ||
50 | + return Promise.resolve(); | ||
51 | + }, | ||
52 | + }, | ||
53 | + ]; | ||
54 | + }, | ||
30 | }, | 55 | }, |
31 | { | 56 | { |
32 | field: 'officialWebsite', | 57 | field: 'officialWebsite', |
@@ -39,6 +64,19 @@ export const schemas: FormSchema[] = [ | @@ -39,6 +64,19 @@ export const schemas: FormSchema[] = [ | ||
39 | maxLength: 255, | 64 | maxLength: 255, |
40 | placeholder: '请输入公司官网', | 65 | placeholder: '请输入公司官网', |
41 | }, | 66 | }, |
67 | + dynamicRules: () => { | ||
68 | + return [ | ||
69 | + { | ||
70 | + required: false, | ||
71 | + validator: (_, value) => { | ||
72 | + if (String(value).length > 255) { | ||
73 | + return Promise.reject('字数不超过255个字'); | ||
74 | + } | ||
75 | + return Promise.resolve(); | ||
76 | + }, | ||
77 | + }, | ||
78 | + ]; | ||
79 | + }, | ||
42 | }, | 80 | }, |
43 | { | 81 | { |
44 | field: 'email', | 82 | field: 'email', |
@@ -66,6 +104,19 @@ export const schemas: FormSchema[] = [ | @@ -66,6 +104,19 @@ export const schemas: FormSchema[] = [ | ||
66 | autoSize: { minRows: 8, maxRows: 12 }, | 104 | autoSize: { minRows: 8, maxRows: 12 }, |
67 | showCount: true, | 105 | showCount: true, |
68 | }, | 106 | }, |
107 | + dynamicRules: () => { | ||
108 | + return [ | ||
109 | + { | ||
110 | + required: false, | ||
111 | + validator: (_, value) => { | ||
112 | + if (String(value).length > 500) { | ||
113 | + return Promise.reject('字数不超过500个字'); | ||
114 | + } | ||
115 | + return Promise.resolve(); | ||
116 | + }, | ||
117 | + }, | ||
118 | + ]; | ||
119 | + }, | ||
69 | }, | 120 | }, |
70 | { | 121 | { |
71 | field: 'nameCountry', | 122 | field: 'nameCountry', |
@@ -252,6 +303,19 @@ export const schemas: FormSchema[] = [ | @@ -252,6 +303,19 @@ export const schemas: FormSchema[] = [ | ||
252 | maxLength: 100, | 303 | maxLength: 100, |
253 | placeholder: '请输入详细地址', | 304 | placeholder: '请输入详细地址', |
254 | }, | 305 | }, |
306 | + dynamicRules: () => { | ||
307 | + return [ | ||
308 | + { | ||
309 | + required: false, | ||
310 | + validator: (_, value) => { | ||
311 | + if (String(value).length > 100) { | ||
312 | + return Promise.reject('字数不超过100个字'); | ||
313 | + } | ||
314 | + return Promise.resolve(); | ||
315 | + }, | ||
316 | + }, | ||
317 | + ]; | ||
318 | + }, | ||
255 | }, | 319 | }, |
256 | 320 | ||
257 | { | 321 | { |
@@ -265,6 +329,19 @@ export const schemas: FormSchema[] = [ | @@ -265,6 +329,19 @@ export const schemas: FormSchema[] = [ | ||
265 | maxLength: 25, | 329 | maxLength: 25, |
266 | placeholder: '请输入联系人', | 330 | placeholder: '请输入联系人', |
267 | }, | 331 | }, |
332 | + dynamicRules: () => { | ||
333 | + return [ | ||
334 | + { | ||
335 | + required: false, | ||
336 | + validator: (_, value) => { | ||
337 | + if (String(value).length > 25) { | ||
338 | + return Promise.reject('字数不超过25个字'); | ||
339 | + } | ||
340 | + return Promise.resolve(); | ||
341 | + }, | ||
342 | + }, | ||
343 | + ]; | ||
344 | + }, | ||
268 | }, | 345 | }, |
269 | { | 346 | { |
270 | field: 'tel', | 347 | field: 'tel', |
@@ -284,7 +361,22 @@ export const schemas: FormSchema[] = [ | @@ -284,7 +361,22 @@ export const schemas: FormSchema[] = [ | ||
284 | component: 'Input', | 361 | component: 'Input', |
285 | componentProps: { | 362 | componentProps: { |
286 | maxLength: 255, | 363 | maxLength: 255, |
364 | + placeholder: '请输入二维码', | ||
287 | }, | 365 | }, |
366 | + dynamicRules: () => { | ||
367 | + return [ | ||
368 | + { | ||
369 | + required: false, | ||
370 | + validator: (_, value) => { | ||
371 | + if (String(value).length > 255) { | ||
372 | + return Promise.reject('字数不超过255个字'); | ||
373 | + } | ||
374 | + return Promise.resolve(); | ||
375 | + }, | ||
376 | + }, | ||
377 | + ]; | ||
378 | + }, | ||
379 | + | ||
288 | colProps: { | 380 | colProps: { |
289 | span: 24, | 381 | span: 24, |
290 | }, | 382 | }, |
@@ -297,6 +389,20 @@ export const schemas: FormSchema[] = [ | @@ -297,6 +389,20 @@ export const schemas: FormSchema[] = [ | ||
297 | show: false, | 389 | show: false, |
298 | componentProps: { | 390 | componentProps: { |
299 | maxLength: 36, | 391 | maxLength: 36, |
392 | + placeholder: '请输入平台名称', | ||
393 | + }, | ||
394 | + dynamicRules: () => { | ||
395 | + return [ | ||
396 | + { | ||
397 | + required: false, | ||
398 | + validator: (_, value) => { | ||
399 | + if (String(value).length > 36) { | ||
400 | + return Promise.reject('字数不超过36个字'); | ||
401 | + } | ||
402 | + return Promise.resolve(); | ||
403 | + }, | ||
404 | + }, | ||
405 | + ]; | ||
300 | }, | 406 | }, |
301 | }, | 407 | }, |
302 | ]; | 408 | ]; |
@@ -69,6 +69,20 @@ export const searchFormSchema: FormSchema[] = [ | @@ -69,6 +69,20 @@ export const searchFormSchema: FormSchema[] = [ | ||
69 | colProps: { span: 8 }, | 69 | colProps: { span: 8 }, |
70 | componentProps: { | 70 | componentProps: { |
71 | maxLength: 255, | 71 | maxLength: 255, |
72 | + placeholder: '请输入角色名称', | ||
73 | + }, | ||
74 | + dynamicRules: () => { | ||
75 | + return [ | ||
76 | + { | ||
77 | + required: false, | ||
78 | + validator: (_, value) => { | ||
79 | + if (String(value).length > 255) { | ||
80 | + return Promise.reject('字数不超过255个字'); | ||
81 | + } | ||
82 | + return Promise.resolve(); | ||
83 | + }, | ||
84 | + }, | ||
85 | + ]; | ||
72 | }, | 86 | }, |
73 | }, | 87 | }, |
74 | { | 88 | { |
@@ -81,6 +95,19 @@ export const searchFormSchema: FormSchema[] = [ | @@ -81,6 +95,19 @@ export const searchFormSchema: FormSchema[] = [ | ||
81 | componentProps: { | 95 | componentProps: { |
82 | maxLength: 20, | 96 | maxLength: 20, |
83 | }, | 97 | }, |
98 | + dynamicRules: () => { | ||
99 | + return [ | ||
100 | + { | ||
101 | + required: false, | ||
102 | + validator: (_, value) => { | ||
103 | + if (String(value).length > 20) { | ||
104 | + return Promise.reject('字数不超过20个字'); | ||
105 | + } | ||
106 | + return Promise.resolve(); | ||
107 | + }, | ||
108 | + }, | ||
109 | + ]; | ||
110 | + }, | ||
84 | }, | 111 | }, |
85 | { | 112 | { |
86 | field: 'status', | 113 | field: 'status', |
@@ -104,6 +131,20 @@ export const formSchema: FormSchema[] = [ | @@ -104,6 +131,20 @@ export const formSchema: FormSchema[] = [ | ||
104 | component: 'Input', | 131 | component: 'Input', |
105 | componentProps: { | 132 | componentProps: { |
106 | maxLength: 255, | 133 | maxLength: 255, |
134 | + placeholder: '请输入角色名称', | ||
135 | + }, | ||
136 | + dynamicRules: () => { | ||
137 | + return [ | ||
138 | + { | ||
139 | + required: true, | ||
140 | + validator: (_, value) => { | ||
141 | + if (String(value).length > 255) { | ||
142 | + return Promise.reject('字数不超过255个字'); | ||
143 | + } | ||
144 | + return Promise.resolve(); | ||
145 | + }, | ||
146 | + }, | ||
147 | + ]; | ||
107 | }, | 148 | }, |
108 | }, | 149 | }, |
109 | { | 150 | { |
@@ -124,6 +165,20 @@ export const formSchema: FormSchema[] = [ | @@ -124,6 +165,20 @@ export const formSchema: FormSchema[] = [ | ||
124 | component: 'InputTextArea', | 165 | component: 'InputTextArea', |
125 | componentProps: { | 166 | componentProps: { |
126 | maxLength: 255, | 167 | maxLength: 255, |
168 | + placeholder: '请输入备注', | ||
169 | + }, | ||
170 | + dynamicRules: () => { | ||
171 | + return [ | ||
172 | + { | ||
173 | + required: false, | ||
174 | + validator: (_, value) => { | ||
175 | + if (String(value).length > 255) { | ||
176 | + return Promise.reject('字数不超过255个字'); | ||
177 | + } | ||
178 | + return Promise.resolve(); | ||
179 | + }, | ||
180 | + }, | ||
181 | + ]; | ||
127 | }, | 182 | }, |
128 | }, | 183 | }, |
129 | { | 184 | { |
@@ -134,5 +189,18 @@ export const formSchema: FormSchema[] = [ | @@ -134,5 +189,18 @@ export const formSchema: FormSchema[] = [ | ||
134 | componentProps: { | 189 | componentProps: { |
135 | maxLength: 255, | 190 | maxLength: 255, |
136 | }, | 191 | }, |
192 | + dynamicRules: () => { | ||
193 | + return [ | ||
194 | + { | ||
195 | + required: false, | ||
196 | + validator: (_, value) => { | ||
197 | + if (String(value).length > 255) { | ||
198 | + return Promise.reject('字数不超过255个字'); | ||
199 | + } | ||
200 | + return Promise.resolve(); | ||
201 | + }, | ||
202 | + }, | ||
203 | + ]; | ||
204 | + }, | ||
137 | }, | 205 | }, |
138 | ]; | 206 | ]; |
@@ -37,8 +37,22 @@ export const searchFormSchema: FormSchema[] = [ | @@ -37,8 +37,22 @@ export const searchFormSchema: FormSchema[] = [ | ||
37 | colProps: { span: 8 }, | 37 | colProps: { span: 8 }, |
38 | component: 'Input', | 38 | component: 'Input', |
39 | componentProps: { | 39 | componentProps: { |
40 | + maxLength: 255, | ||
40 | placeholder: '请输入租户配置名称', | 41 | placeholder: '请输入租户配置名称', |
41 | }, | 42 | }, |
43 | + dynamicRules: () => { | ||
44 | + return [ | ||
45 | + { | ||
46 | + required: false, | ||
47 | + validator: (_, value) => { | ||
48 | + if (String(value).length > 255) { | ||
49 | + return Promise.reject('字数不超过255个字'); | ||
50 | + } | ||
51 | + return Promise.resolve(); | ||
52 | + }, | ||
53 | + }, | ||
54 | + ]; | ||
55 | + }, | ||
42 | }, | 56 | }, |
43 | ]; | 57 | ]; |
44 | export const formSchema: FormSchema[] = [ | 58 | export const formSchema: FormSchema[] = [ |
@@ -50,7 +64,20 @@ export const formSchema: FormSchema[] = [ | @@ -50,7 +64,20 @@ export const formSchema: FormSchema[] = [ | ||
50 | component: 'Input', | 64 | component: 'Input', |
51 | componentProps: { | 65 | componentProps: { |
52 | maxLength: 255, | 66 | maxLength: 255, |
53 | - placeholder: '名称', | 67 | + placeholder: '请输入名称', |
68 | + }, | ||
69 | + dynamicRules: () => { | ||
70 | + return [ | ||
71 | + { | ||
72 | + required: true, | ||
73 | + validator: (_, value) => { | ||
74 | + if (String(value).length > 255) { | ||
75 | + return Promise.reject('字数不超过255个字'); | ||
76 | + } | ||
77 | + return Promise.resolve(); | ||
78 | + }, | ||
79 | + }, | ||
80 | + ]; | ||
54 | }, | 81 | }, |
55 | }, | 82 | }, |
56 | { | 83 | { |
@@ -71,8 +98,21 @@ export const formSchema: FormSchema[] = [ | @@ -71,8 +98,21 @@ export const formSchema: FormSchema[] = [ | ||
71 | colProps: { span: 24 }, | 98 | colProps: { span: 24 }, |
72 | component: 'InputTextArea', | 99 | component: 'InputTextArea', |
73 | componentProps: { | 100 | componentProps: { |
74 | - maxLength: 0, | 101 | + maxLength: 255, |
75 | placeholder: '请输入说明', | 102 | placeholder: '请输入说明', |
76 | }, | 103 | }, |
104 | + dynamicRules: () => { | ||
105 | + return [ | ||
106 | + { | ||
107 | + required: false, | ||
108 | + validator: (_, value) => { | ||
109 | + if (String(value).length > 255) { | ||
110 | + return Promise.reject('字数不超过255个字'); | ||
111 | + } | ||
112 | + return Promise.resolve(); | ||
113 | + }, | ||
114 | + }, | ||
115 | + ]; | ||
116 | + }, | ||
77 | }, | 117 | }, |
78 | ]; | 118 | ]; |
@@ -143,6 +143,7 @@ export const formSchema: FormSchema[] = [ | @@ -143,6 +143,7 @@ export const formSchema: FormSchema[] = [ | ||
143 | componentProps: { | 143 | componentProps: { |
144 | placeholder: '请输入最大规则引擎数(请输入数字)', | 144 | placeholder: '请输入最大规则引擎数(请输入数字)', |
145 | }, | 145 | }, |
146 | + rules: numberRule, | ||
146 | }, | 147 | }, |
147 | 148 | ||
148 | { | 149 | { |
@@ -155,6 +156,7 @@ export const formSchema: FormSchema[] = [ | @@ -155,6 +156,7 @@ export const formSchema: FormSchema[] = [ | ||
155 | componentProps: { | 156 | componentProps: { |
156 | placeholder: '请输入最大JavaScript执行数(请输入数字)', | 157 | placeholder: '请输入最大JavaScript执行数(请输入数字)', |
157 | }, | 158 | }, |
159 | + rules: numberRule, | ||
158 | }, | 160 | }, |
159 | { | 161 | { |
160 | field: 'maxDPStorageDays', | 162 | field: 'maxDPStorageDays', |
@@ -166,6 +168,7 @@ export const formSchema: FormSchema[] = [ | @@ -166,6 +168,7 @@ export const formSchema: FormSchema[] = [ | ||
166 | componentProps: { | 168 | componentProps: { |
167 | placeholder: '请输入最大日存储数据点数(请输入数字)', | 169 | placeholder: '请输入最大日存储数据点数(请输入数字)', |
168 | }, | 170 | }, |
171 | + rules: numberRule, | ||
169 | }, | 172 | }, |
170 | { | 173 | { |
171 | field: 'defaultStorageTtlDays', | 174 | field: 'defaultStorageTtlDays', |
@@ -177,6 +180,7 @@ export const formSchema: FormSchema[] = [ | @@ -177,6 +180,7 @@ export const formSchema: FormSchema[] = [ | ||
177 | componentProps: { | 180 | componentProps: { |
178 | placeholder: '请输入默认存储 TTL 天数(请输入数字)', | 181 | placeholder: '请输入默认存储 TTL 天数(请输入数字)', |
179 | }, | 182 | }, |
183 | + rules: numberRule, | ||
180 | }, | 184 | }, |
181 | { | 185 | { |
182 | field: 'alarmsTtlDays', | 186 | field: 'alarmsTtlDays', |
@@ -188,6 +192,7 @@ export const formSchema: FormSchema[] = [ | @@ -188,6 +192,7 @@ export const formSchema: FormSchema[] = [ | ||
188 | componentProps: { | 192 | componentProps: { |
189 | placeholder: '请输入Alams TTL days(请输入数字)', | 193 | placeholder: '请输入Alams TTL days(请输入数字)', |
190 | }, | 194 | }, |
195 | + rules: numberRule, | ||
191 | }, | 196 | }, |
192 | { | 197 | { |
193 | field: 'rpcTtlDays', | 198 | field: 'rpcTtlDays', |
@@ -199,6 +204,7 @@ export const formSchema: FormSchema[] = [ | @@ -199,6 +204,7 @@ export const formSchema: FormSchema[] = [ | ||
199 | componentProps: { | 204 | componentProps: { |
200 | placeholder: '请输入RPC TTL days(请输入数字)', | 205 | placeholder: '请输入RPC TTL days(请输入数字)', |
201 | }, | 206 | }, |
207 | + rules: numberRule, | ||
202 | }, | 208 | }, |
203 | { | 209 | { |
204 | field: 'maxRuleNodeExecutionsPerMessage', | 210 | field: 'maxRuleNodeExecutionsPerMessage', |
@@ -210,6 +216,7 @@ export const formSchema: FormSchema[] = [ | @@ -210,6 +216,7 @@ export const formSchema: FormSchema[] = [ | ||
210 | componentProps: { | 216 | componentProps: { |
211 | placeholder: '请输入每条消息的最大规则节点执行数(请输入数字)', | 217 | placeholder: '请输入每条消息的最大规则节点执行数(请输入数字)', |
212 | }, | 218 | }, |
219 | + rules: numberRule, | ||
213 | }, | 220 | }, |
214 | { | 221 | { |
215 | field: 'maxEmails', | 222 | field: 'maxEmails', |
@@ -220,6 +227,7 @@ export const formSchema: FormSchema[] = [ | @@ -220,6 +227,7 @@ export const formSchema: FormSchema[] = [ | ||
220 | componentProps: { | 227 | componentProps: { |
221 | placeholder: '请输入发送的最大电子邮件数(请输入数字)', | 228 | placeholder: '请输入发送的最大电子邮件数(请输入数字)', |
222 | }, | 229 | }, |
230 | + rules: numberRule, | ||
223 | }, | 231 | }, |
224 | { | 232 | { |
225 | field: 'maxSms', | 233 | field: 'maxSms', |
@@ -231,6 +239,7 @@ export const formSchema: FormSchema[] = [ | @@ -231,6 +239,7 @@ export const formSchema: FormSchema[] = [ | ||
231 | componentProps: { | 239 | componentProps: { |
232 | placeholder: '请输入发送的最大短信数(请输入数字)', | 240 | placeholder: '请输入发送的最大短信数(请输入数字)', |
233 | }, | 241 | }, |
242 | + rules: numberRule, | ||
234 | }, | 243 | }, |
235 | { | 244 | { |
236 | field: 'maxCreatedAlarms', | 245 | field: 'maxCreatedAlarms', |
@@ -242,6 +251,7 @@ export const formSchema: FormSchema[] = [ | @@ -242,6 +251,7 @@ export const formSchema: FormSchema[] = [ | ||
242 | componentProps: { | 251 | componentProps: { |
243 | placeholder: '请输入maxCreatedAlarms(请输入数字)', | 252 | placeholder: '请输入maxCreatedAlarms(请输入数字)', |
244 | }, | 253 | }, |
254 | + rules: numberRule, | ||
245 | }, | 255 | }, |
246 | { | 256 | { |
247 | field: 'transportTenantMsgRateLimit', | 257 | field: 'transportTenantMsgRateLimit', |