Commit 6b0ad3714b911373ed6d4b228d6eda59a5a899c2
Merge branch 'fix/device-send-command' into 'main_dev'
fix: 修复双向命令下发时判断设备在线取值错误 See merge request yunteng/thingskit-scada!169
Showing
3 changed files
with
9 additions
and
3 deletions
1 | -import type { DeviceAttributeItemType, DeviceItemType, DeviceProfileItemType, OrganizationItemType, RpcCommandType, SendValue, ThingsModel, ThingsModelItemType } from './model' | |
1 | +import type { DeviceActiveType, DeviceAttributeItemType, DeviceItemType, DeviceProfileItemType, OrganizationItemType, RpcCommandType, SendValue, ThingsModel, ThingsModelItemType } from './model' | |
2 | 2 | import { CommandWayEnum } from '@/enums/commandEnum' |
3 | 3 | import type { DeviceTypeEnum } from '@/enums/datasource' |
4 | 4 | import { isShareMode } from '@/utils/env' |
... | ... | @@ -113,7 +113,7 @@ export const genModbusCommand = (data: GenModbusCommandType) => { |
113 | 113 | |
114 | 114 | // 获取设备状态,在线 or 离线时间 entityId:设备id |
115 | 115 | export const getDeviceActiveTime = (entityId: string) => { |
116 | - return defHttp.get( | |
116 | + return defHttp.get<DeviceActiveType[]>( | |
117 | 117 | { |
118 | 118 | url: `/plugins/telemetry/DEVICE/${entityId}/values/attributes?keys=active`, |
119 | 119 | }, | ... | ... |
... | ... | @@ -192,7 +192,7 @@ const handleSubmit = async () => { |
192 | 192 | } |
193 | 193 | if (serviceInfo.callType === 'SYNC') { // 服务命令调用方式 是同步 需要调用设备是否在线才能下发 |
194 | 194 | const res = await getDeviceActiveTime(dataSourceJson.value.deviceId) |
195 | - const { value } = res | |
195 | + const { value } = res?.[0] || {} | |
196 | 196 | if (!value) { |
197 | 197 | createMessage.error('当前设备不在线') |
198 | 198 | return | ... | ... |