From fa611ff2eeaac289931eb0e21a962743fb271ba7 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 23 Sep 2022 17:46:57 +0800
Subject: [PATCH] Update v1.2.0
---
src/store/index.ts | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/store/index.ts b/src/store/index.ts
index bdcd972..36a7725 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -5,6 +5,7 @@
import { getLayers } from '/@/api/layer'
import { LayerType } from '/@/types/mapLayer'
import { ETaskStatus, TaskInfo, WaylineFile } from '/@/types/wayline'
+import { DevicesCmdExecuteInfo } from '/@/types/device-cmd'
const initStateFunc = () => ({
Layers: [
@@ -87,7 +88,10 @@
},
hmsInfo: {} as {
[sn: string]: DeviceHms[]
- }
+ },
+ // 机场指令执行状态信息
+ devicesCmdExecuteInfo: {
+ } as DevicesCmdExecuteInfo
})
export type RootStateType = ReturnType<typeof initStateFunc>
@@ -144,7 +148,6 @@
delete state.deviceState.deviceInfo[info.sn]
delete state.deviceState.dockInfo[info.sn]
delete state.hmsInfo[info.sn]
-
// delete state.markerInfo.coverMap[info.sn]
// delete state.markerInfo.pathMap[info.sn]
},
@@ -171,6 +174,25 @@
SET_DEVICE_HMS_INFO (state, info) {
const hmsList: Array<DeviceHms> = state.hmsInfo[info.sn]
state.hmsInfo[info.sn] = info.host.concat(hmsList ?? [])
+ },
+ SET_DEVICES_CMD_EXECUTE_INFO (state, info) { // 保存设备指令ws消息推送
+ if (!info.sn) {
+ return
+ }
+ if (state.devicesCmdExecuteInfo[info.sn]) {
+ const index = state.devicesCmdExecuteInfo[info.sn].findIndex(cmdExecuteInfo => cmdExecuteInfo.biz_code === info.biz_code)
+ if (index >= 0) {
+ // 丢弃前面的消息
+ if (state.devicesCmdExecuteInfo[info.sn][index].timestamp > info.timestamp) {
+ return
+ }
+ state.devicesCmdExecuteInfo[info.sn][index] = info
+ } else {
+ state.devicesCmdExecuteInfo[info.sn].push(info)
+ }
+ } else {
+ state.devicesCmdExecuteInfo[info.sn] = [info]
+ }
}
}
--
Gitblit v1.9.3