Commit 27f0abe4f652310b73b3a8f7e5cf9ee8c429b96b
1 parent
28121eab
fix: DEFECT-754 add form rule will stack overflow
Showing
2 changed files
with
18 additions
and
2 deletions
| @@ -129,7 +129,15 @@ export const defaultSchemas: FormSchema[] = [ | @@ -129,7 +129,15 @@ export const defaultSchemas: FormSchema[] = [ | ||
| 129 | field: SchemaFiled.INTERVAL, | 129 | field: SchemaFiled.INTERVAL, |
| 130 | label: '分组间隔', | 130 | label: '分组间隔', |
| 131 | component: 'Select', | 131 | component: 'Select', |
| 132 | - rules: [{ required: true, message: '分组间隔为必填项', type: 'number' }], | 132 | + dynamicRules: ({ model }) => { |
| 133 | + return [ | ||
| 134 | + { | ||
| 135 | + required: model[SchemaFiled.AGG] !== AggregateDataEnum.NONE, | ||
| 136 | + message: '分组间隔为必填项', | ||
| 137 | + type: 'number', | ||
| 138 | + }, | ||
| 139 | + ]; | ||
| 140 | + }, | ||
| 133 | ifShow({ values }) { | 141 | ifShow({ values }) { |
| 134 | return values[SchemaFiled.AGG] !== AggregateDataEnum.NONE; | 142 | return values[SchemaFiled.AGG] !== AggregateDataEnum.NONE; |
| 135 | }, | 143 | }, |
| @@ -151,7 +151,15 @@ export const formSchema: FormSchema[] = [ | @@ -151,7 +151,15 @@ export const formSchema: FormSchema[] = [ | ||
| 151 | field: SchemaFiled.INTERVAL, | 151 | field: SchemaFiled.INTERVAL, |
| 152 | label: '分组间隔', | 152 | label: '分组间隔', |
| 153 | component: 'Select', | 153 | component: 'Select', |
| 154 | - rules: [{ required: true, message: '分组间隔为必填项', type: 'number' }], | 154 | + dynamicRules: ({ model }) => { |
| 155 | + return [ | ||
| 156 | + { | ||
| 157 | + required: model[SchemaFiled.AGG] !== AggregateDataEnum.NONE, | ||
| 158 | + message: '分组间隔为必填项', | ||
| 159 | + type: 'number', | ||
| 160 | + }, | ||
| 161 | + ]; | ||
| 162 | + }, | ||
| 155 | ifShow({ values }) { | 163 | ifShow({ values }) { |
| 156 | return values[SchemaFiled.AGG] !== AggregateDataEnum.NONE; | 164 | return values[SchemaFiled.AGG] !== AggregateDataEnum.NONE; |
| 157 | }, | 165 | }, |