From b1d8806a594268a763575e7584009f979e00fb81 Mon Sep 17 00:00:00 2001 From: xudan Date: Fri, 10 Oct 2025 14:55:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=BF=90=E5=8A=A8?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=8A=A0=E8=BD=BD=E5=90=8E=E7=9A=84=E6=9C=BA?= =?UTF-8?q?=E5=99=A8=E4=BA=BA=E5=88=9D=E5=A7=8B=E5=8C=96=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/movement-supervision.vue | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/pages/movement-supervision.vue b/src/pages/movement-supervision.vue index 8608605..42cbd89 100644 --- a/src/pages/movement-supervision.vue +++ b/src/pages/movement-supervision.vue @@ -6,6 +6,7 @@ import { isNil } from 'lodash-es'; import { computed, onMounted, onUnmounted, provide, ref, type ShallowRef, shallowRef, watch } from 'vue'; import { useRoute } from 'vue-router'; +import type { RobotRealtimeInfo } from '../apis/robot'; import { getSceneByGroupId, getSceneById, monitorRealSceneById, monitorSceneById } from '../apis/scene'; import expandIcon from '../assets/icons/png/expand.png'; import foldIcon from '../assets/icons/png/fold.png'; @@ -71,7 +72,7 @@ const client = shallowRef(); // 左侧边栏元素引用(用于 Ctrl/Cmd+F 聚焦搜索框) const leftSiderEl = shallowRef(); const isPlaybackControllerVisible = ref(true); -const selectedDate = ref(null); +const selectedDate = ref(); const playback = usePlaybackWebSocket(editor); @@ -85,9 +86,16 @@ watch(mode, async (newMode) => { } }); -const handleDateChange = (date: Dayjs) => { +watch(playback.sceneJson, async (newJson) => { + if (newJson) { + await editor.value?.load(newJson); + // [关键修复] 场景加载后,立即重新初始化机器人 + await editor.value?.initRobots(); + } +}); + +watch(selectedDate, (date) => { if (date) { - selectedDate.value = date; const startOfDayTimestamp = date.startOf('day').valueOf(); playback.seek(startOfDayTimestamp); // The total duration is now relative to the start of the day @@ -95,7 +103,7 @@ const handleDateChange = (date: Dayjs) => { // Set current time to the beginning of the selected day for the slider playback.currentTime.value = startOfDayTimestamp; } -}; +}); const handleSeek = (relativeTime: number) => { if (selectedDate.value) { @@ -552,9 +560,7 @@ const focusFindKeydownHandler = (event: KeyboardEvent) => { if (input) { event.preventDefault(); input.focus(); - try { - input.select?.(); - } catch {} + input.select?.(); } } } @@ -583,12 +589,7 @@ const handleGlobalKeydown = (event: KeyboardEvent) => { 保存比例 - +