feat(movement-supervision): 优化监控场景切换逻辑,支持多楼层实时数据获取
This commit is contained in:
parent
259c881469
commit
f6e8a225cd
@ -195,7 +195,8 @@ const monitorScene = async () => {
|
||||
console.log(current.value?.id);
|
||||
client.value?.close();
|
||||
// 根据路由路径是否是真实场景监控决定使用哪个监控接口
|
||||
const ws = isMonitorMode.value ? await monitorRealSceneById(props.sid) : await monitorSceneById(props.sid);
|
||||
const sidWithFloor = isMultiFloor.value ? `${props.sid}/${currentFloorIndex.value + 1}` : props.sid;
|
||||
const ws = isMonitorMode.value ? await monitorRealSceneById(sidWithFloor) : await monitorSceneById(sidWithFloor);
|
||||
if (isNil(ws)) return;
|
||||
|
||||
// 使用 Map 来缓冲每个机器人最新的实时数据。
|
||||
@ -618,6 +619,10 @@ const handleFloorChange = async (value: any) => {
|
||||
await editor.value.load(floorScenes.value[newFloorIndex]);
|
||||
// 切换楼层后,重新初始化机器人以确保状态正确
|
||||
await editor.value.initRobots();
|
||||
// 重新连接 WebSocket 以获取新楼层的实时数据
|
||||
if (mode.value === 'live') {
|
||||
await monitorScene();
|
||||
}
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user