Commit 6f5258fa2f327eea2b1979119285e94577f7c2e6

Authored by xp.Huang
2 parents 81efd7ce 7b06070e

Merge branch 'fix/change-device-type-change' into 'main_dev'

fix: 修复设备类型变更携带不属于该设备类型的参数

See merge request yunteng/thingskit-front!763
... ... @@ -90,6 +90,8 @@ export const step1Schemas: FormSchema[] = [
90 90 deviceProfileId: id,
91 91 gatewayId: null,
92 92 codeType: transportType === TransportTypeEnum.TCP ? TaskTypeEnum.MODBUS : null,
  93 + code: null,
  94 + addressCode: null,
93 95 });
94 96 },
95 97 showSearch: true,
... ... @@ -165,7 +167,12 @@ export const step1Schemas: FormSchema[] = [
165 167 minValue: 0,
166 168 },
167 169 ifShow: ({ values }) => {
168   - return values?.codeType === TaskTypeEnum.MODBUS;
  170 + return (
  171 + values?.transportType === TransportTypeEnum.TCP &&
  172 + (values.deviceType === DeviceTypeEnum.SENSOR ||
  173 + values.deviceType === DeviceTypeEnum.GATEWAY) &&
  174 + values?.codeType === TaskTypeEnum.MODBUS
  175 + );
169 176 },
170 177 },
171 178 {
... ... @@ -189,7 +196,12 @@ export const step1Schemas: FormSchema[] = [
189 196 };
190 197 },
191 198 ifShow: ({ values }) => {
192   - return values?.codeType === TaskTypeEnum.CUSTOM;
  199 + return (
  200 + values?.transportType === TransportTypeEnum.TCP &&
  201 + (values.deviceType === DeviceTypeEnum.SENSOR ||
  202 + values.deviceType === DeviceTypeEnum.GATEWAY) &&
  203 + values?.codeType === TaskTypeEnum.CUSTOM
  204 + );
193 205 },
194 206 },
195 207
... ...