Commit 1eeb7d47655763506b4d55772374876e19bd71bb

Authored by 温伟
2 parents 25c4dad5 971ce856

Merge branch 'fix/zfl' into 'perf/main_dev'

fix: 修复设备选择是网关子时命令下发方式没有服务调用

See merge request yunteng/thingskit-scada!159
... ... @@ -41,7 +41,7 @@ export const getFormSchemas = (event: EventTypeEnum): FormSchema[] => {
41 41 // transportType:判断是什么类型的设备 code:设备地址码 deviceType:设备类型
42 42 let codeType: string | null = ''
43 43 const { transportType, deviceType, codeType: deviceCodeType } = deviceInfo || {}
44   - codeType = deviceCodeType || (deviceId ? contentDataStore.diveceDetailMap?.[deviceId].codeType : null)
  44 + codeType = deviceCodeType || (deviceId ? contentDataStore.diveceDetailMap?.[deviceId]?.codeType : null)
45 45 const isTemplate = contentDataStore.isTemplate // 判断是否是模板
46 46 return [
47 47 {
... ... @@ -124,8 +124,17 @@ export const getFormSchemas = (event: EventTypeEnum): FormSchema[] => {
124 124
125 125 function setOptions() {
126 126 // 是模板的话选择不到设备标识符类型所以就判断为放开自定义命令
127   - if (isTemplate)
  127 + if (isTemplate) {
  128 + if (transportType !== TransportTypeEnum.TCP)
  129 + options.push(serviceOption)
128 130 return
  131 + }
  132 +
  133 + if (transportType !== TransportTypeEnum.TCP && deviceType === DeviceTypeEnum.SENSOR) {
  134 + // 判断不是TCP但是是网关子
  135 + options.push(serviceOption)
  136 + return
  137 + }
129 138
130 139 if (deviceType !== DeviceTypeEnum.SENSOR)
131 140 options.push(serviceOption)
... ...