Showing
1 changed file
with
30 additions
and
0 deletions
@@ -45,6 +45,21 @@ export const formSchemas = ({ | @@ -45,6 +45,21 @@ export const formSchemas = ({ | ||
45 | maxLength: 32, | 45 | maxLength: 32, |
46 | placeholder: '请输入功能名称', | 46 | placeholder: '请输入功能名称', |
47 | }, | 47 | }, |
48 | + dynamicRules: ({ values }) => { | ||
49 | + return [ | ||
50 | + { | ||
51 | + required: true, | ||
52 | + trigger: 'blur', | ||
53 | + validator: () => { | ||
54 | + const reg = /[,,]+/; | ||
55 | + if (reg.test(values[FormField.FUNCTION_NAME])) { | ||
56 | + return Promise.reject('功能名称不能包含逗号'); | ||
57 | + } | ||
58 | + return Promise.resolve(); | ||
59 | + }, | ||
60 | + }, | ||
61 | + ]; | ||
62 | + }, | ||
48 | }, | 63 | }, |
49 | { | 64 | { |
50 | field: FormField.IDENTIFIER, | 65 | field: FormField.IDENTIFIER, |
@@ -58,6 +73,21 @@ export const formSchemas = ({ | @@ -58,6 +73,21 @@ export const formSchemas = ({ | ||
58 | maxLength: 128, | 73 | maxLength: 128, |
59 | placeholder: '请输入标识符', | 74 | placeholder: '请输入标识符', |
60 | }, | 75 | }, |
76 | + dynamicRules: ({ values }) => { | ||
77 | + return [ | ||
78 | + { | ||
79 | + required: true, | ||
80 | + trigger: 'blur', | ||
81 | + validator: () => { | ||
82 | + const reg = /[,,]+/; | ||
83 | + if (reg.test(values[FormField.IDENTIFIER])) { | ||
84 | + return Promise.reject('标识符不能包含逗号'); | ||
85 | + } | ||
86 | + return Promise.resolve(); | ||
87 | + }, | ||
88 | + }, | ||
89 | + ]; | ||
90 | + }, | ||
61 | }, | 91 | }, |
62 | { | 92 | { |
63 | field: FormField.HAS_STRUCT_FROM, | 93 | field: FormField.HAS_STRUCT_FROM, |