Showing
1 changed file
with
11 additions
and
2 deletions
... | ... | @@ -114,7 +114,16 @@ export const step1Schemas: FormSchema[] = [ |
114 | 114 | { |
115 | 115 | field: 'code', |
116 | 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 | 127 | component: 'Input', |
119 | 128 | componentProps: { |
120 | 129 | maxLength: 255, |
... | ... | @@ -122,7 +131,7 @@ export const step1Schemas: FormSchema[] = [ |
122 | 131 | }, |
123 | 132 | ifShow: ({ values }) => |
124 | 133 | values?.transportType === TransportTypeEnum.TCP && |
125 | - values.deviceType === DeviceTypeEnum.SENSOR, | |
134 | + (values.deviceType === DeviceTypeEnum.SENSOR || values.deviceType === DeviceTypeEnum.GATEWAY), | |
126 | 135 | }, |
127 | 136 | { |
128 | 137 | field: 'brand', | ... | ... |