| | |
| | | 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: [ |
| | |
| | | }, |
| | | hmsInfo: {} as { |
| | | [sn: string]: DeviceHms[] |
| | | } |
| | | }, |
| | | // 机场指令执行状态信息 |
| | | devicesCmdExecuteInfo: { |
| | | } as DevicesCmdExecuteInfo |
| | | }) |
| | | |
| | | export type RootStateType = ReturnType<typeof initStateFunc> |
| | |
| | | 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] |
| | | }, |
| | |
| | | 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] |
| | | } |
| | | } |
| | | } |
| | | |