Showing
1 changed file
with
11 additions
and
2 deletions
| @@ -114,7 +114,16 @@ export const step1Schemas: FormSchema[] = [ | @@ -114,7 +114,16 @@ export const step1Schemas: FormSchema[] = [ | ||
| 114 | { | 114 | { |
| 115 | field: 'code', | 115 | field: 'code', |
| 116 | label: '设备标识', | 116 | label: '设备标识', |
| 117 | - required: true, | 117 | + dynamicRules({ values }) { |
| 118 | + return [ | ||
| 119 | + { | ||
| 120 | + required: | ||
| 121 | + values?.transportType === TransportTypeEnum.TCP && | ||
| 122 | + values.deviceType === DeviceTypeEnum.SENSOR, | ||
| 123 | + message: '请输入设备标识符', | ||
| 124 | + }, | ||
| 125 | + ]; | ||
| 126 | + }, | ||
| 118 | component: 'Input', | 127 | component: 'Input', |
| 119 | componentProps: { | 128 | componentProps: { |
| 120 | maxLength: 255, | 129 | maxLength: 255, |
| @@ -122,7 +131,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -122,7 +131,7 @@ export const step1Schemas: FormSchema[] = [ | ||
| 122 | }, | 131 | }, |
| 123 | ifShow: ({ values }) => | 132 | ifShow: ({ values }) => |
| 124 | values?.transportType === TransportTypeEnum.TCP && | 133 | values?.transportType === TransportTypeEnum.TCP && |
| 125 | - values.deviceType === DeviceTypeEnum.SENSOR, | 134 | + (values.deviceType === DeviceTypeEnum.SENSOR || values.deviceType === DeviceTypeEnum.GATEWAY), |
| 126 | }, | 135 | }, |
| 127 | { | 136 | { |
| 128 | field: 'brand', | 137 | field: 'brand', |