Commit c53e457b0ebadccf7ff538675b033ae9fbd636ef
Merge branch 'perf/command-delivery' into 'main_dev'
perf: 优化TCP modbus设备下发自定义命令时移除命令中的空白字符 See merge request yunteng/thingskit-front!1296
Showing
1 changed file
with
9 additions
and
2 deletions
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | import { CommandDeliveryFormFieldType, CommandFieldsEnum, CommandSchemas } from './config'; |
27 | 27 | import { useMessage } from '/@/hooks/web/useMessage'; |
28 | 28 | import { DeviceRecord } from '/@/api/device/model/deviceModel'; |
29 | - import { CommandDeliveryWayEnum } from '/@/enums/deviceEnum'; | |
29 | + import { CommandDeliveryWayEnum, TCPProtocolTypeEnum } from '/@/enums/deviceEnum'; | |
30 | 30 | import { CommandTypeEnum, RPCCommandMethodEnum, TransportTypeEnum } from '/@/enums/deviceEnum'; |
31 | 31 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
32 | 32 | import { getDeviceActiveTime } from '/@/api/alarm/position'; |
... | ... | @@ -87,7 +87,14 @@ |
87 | 87 | const isTcpDevice = unref(props.deviceDetail)?.transportType === TransportTypeEnum.TCP; |
88 | 88 | if (commandType === CommandTypeEnum.CUSTOM) { |
89 | 89 | if (isTcpDevice) { |
90 | - return values.tcpCommandValue; | |
90 | + const value = values.tcpCommandValue; | |
91 | + if ( | |
92 | + unref(props.deviceDetail).deviceProfile.profileData.transportConfiguration.protocol === | |
93 | + TCPProtocolTypeEnum.MODBUS_RTU | |
94 | + ) { | |
95 | + return value?.replaceAll(/\s/g, ''); | |
96 | + } | |
97 | + return value; | |
91 | 98 | } |
92 | 99 | return parseStringToJSON(values.commandValue!).json; |
93 | 100 | } else { | ... | ... |