|
...
|
...
|
@@ -19,7 +19,8 @@ export const useGenDynamicForm = () => { |
|
19
|
19
|
}: BasicCreateFormParams): FormSchema => {
|
|
20
|
20
|
const { specs, type } = dataType;
|
|
21
|
21
|
const { valueRange, step } = specs! as Partial<Specs>;
|
|
22
|
|
- const { max = 2147483647, min = -2147483648 } = valueRange || {};
|
|
|
22
|
+ const { max, min } = valueRange || {};
|
|
|
23
|
+ console.log({ max, min });
|
|
23
|
24
|
return {
|
|
24
|
25
|
field: identifier,
|
|
25
|
26
|
label: functionName,
|
|
...
|
...
|
@@ -29,7 +30,10 @@ export const useGenDynamicForm = () => { |
|
29
|
30
|
type: 'number',
|
|
30
|
31
|
trigger: 'change',
|
|
31
|
32
|
validator: (_rule, value) => {
|
|
32
|
|
- if (value < min || value > max) {
|
|
|
33
|
+ if (
|
|
|
34
|
+ value < (min ?? Number.MIN_SAFE_INTEGER) ||
|
|
|
35
|
+ value > (max || Number.MAX_SAFE_INTEGER)
|
|
|
36
|
+ ) {
|
|
33
|
37
|
return Promise.reject(`${functionName}取值范围在${min}~${max}之间`);
|
|
34
|
38
|
}
|
|
35
|
39
|
return Promise.resolve(value);
|
|
...
|
...
|
@@ -37,8 +41,8 @@ export const useGenDynamicForm = () => { |
|
37
|
41
|
},
|
|
38
|
42
|
],
|
|
39
|
43
|
componentProps: {
|
|
40
|
|
- max,
|
|
41
|
|
- min,
|
|
|
44
|
+ max: max ?? Number.MAX_SAFE_INTEGER,
|
|
|
45
|
+ min: min ?? Number.MIN_SAFE_INTEGER,
|
|
42
|
46
|
step,
|
|
43
|
47
|
placeholder: `请输入${functionName}`,
|
|
44
|
48
|
precision: type === DataTypeEnum.IS_NUMBER_INT ? 0 : 2,
|
...
|
...
|
|