From 9183c501352cde6c680ed5e2f2bdca3121fa8d49 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Tue, 10 Oct 2023 15:16:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=9C=BA=E6=99=AF=E5=92=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/LineLayout.vue | 66 +++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/src/layouts/LineLayout.vue b/src/layouts/LineLayout.vue index 08515eb..1103bc8 100644 --- a/src/layouts/LineLayout.vue +++ b/src/layouts/LineLayout.vue @@ -2,26 +2,20 @@ - - - - - {{ item.name }} - - - - + {{ projectName }} @@ -62,7 +56,7 @@ import { nextTick, } from 'vue'; import { useLineStore } from 'src/stores/line-store'; -import { usePslStore } from 'src/stores/psl-store.ts'; +import { usePslStore } from 'src/stores/psl-store'; import { useRoute, useRouter } from 'vue-router'; import { destroySimulation } from 'src/api/Simulation'; import StateProperties from 'src/components/line-app/StateProperties.vue'; @@ -90,6 +84,11 @@ const drawerRight = ref(false); const projectName = computed(() => projectInfo.name); +const sceneOptions = computed(() => { + return projectInfo.mapInfoLinks || []; +}); +const sceneInfo = ref(); + function onResize() { const clientWidth = document.documentElement.clientWidth; const clientHeight = document.documentElement.clientHeight; @@ -131,6 +130,7 @@ onMounted(async () => { return item.id == lineStore.mapId; }); if (find) { + sceneInfo.value = find; sceneName = getSceneNameFn(find); } lineStore.addAllScene(projectInfo.mapInfoLinks || []); @@ -197,22 +197,36 @@ watch( } ); function destroySimAndBack() { - if (simulationId) { - destroySimulation({ simulationId }); - } - backConfirm(); + $q.dialog({ + title: '确认', + message: `确认结束项目 "${projectName.value}" 吗?`, + cancel: true, + }).onOk(async () => { + try { + if (simulationId) { + await destroySimulation({ simulationId }); + } + backConfirm(); + } catch (err) { + const error = err as ApiError; + $q.notify({ + type: 'negative', + message: error.title, + }); + backConfirm(); + } + }); } function switchScene(val: MapInfo) { if (val.id == lineStore.mapId) return; - scene && scene.unbindDom(); lineStore.setMapId(val.id); sceneName = getSceneNameFn(val); lineStore.setSceneName(sceneName); - scene = lineApp.getScene(sceneName); const dom = document.getElementById('line-app-container'); if (dom) { - scene.bindDom(dom); + lineApp.switchScene(sceneName, dom); + scene = lineApp.getScene(sceneName); scene.reload(); } }