From 342e93ab9e770f58f783cc40847ec6acf3750235 Mon Sep 17 00:00:00 2001 From: wangjuncheng <1> Date: 星期二, 29 四月 2025 16:19:47 +0800 Subject: [PATCH] change --- src/store/simulation.js | 49 ++++++++++++++++++++++++++++++------------------- 1 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/store/simulation.js b/src/store/simulation.js index 5007810..751e1f7 100644 --- a/src/store/simulation.js +++ b/src/store/simulation.js @@ -1,10 +1,10 @@ // stores/ui.js import { defineStore } from 'pinia' import { ref } from 'vue' -import { createSimData } from '@/api/trApi'; +import { createSimData } from '@/api/trApi' export const useSimStore = defineStore('simulation', () => { - // 鎵�鏈塙I鐘舵�� + // 鎵�鏈塙I鐘舵��... const navigationShow = ref(true) const leftShow = ref(false) const rightShow = ref(false) @@ -26,8 +26,14 @@ const showDangerAssess = ref(false) const schemCard = ref([]) const backToHome = ref(false) + const selectedScheme = ref(null) + const setSelectedScheme = (scheme) => { + selectedScheme.value = scheme + } + const clearSelectedScheme = () => { + selectedScheme.value = null + } - // 鍒濆鍖栨柟娉� const init = () => { navigationShow.value = true leftShow.value = false @@ -48,29 +54,24 @@ schemCard.value = [] } - // 鏂规鐩稿叧 const setSchemCard = (data) => { schemCard.value = data } - // 娣诲姞鍗曚釜鏂规鏁版嵁 const addSchemCard = (item) => { schemCard.value.unshift(item) } - // 鍒犻櫎鎸囧畾鏂规鏁版嵁 const removeSchemCardItem = (id) => { schemCard.value = schemCard.value.filter(item => item.id !== id) } - // 鏇存柊鎸囧畾鏂规鏁版嵁 const updateSchemCardItem = (id, newData) => { const index = schemCard.value.findIndex(item => item.id === id) if (index !== -1) { schemCard.value[index] = { ...schemCard.value[index], ...newData } } } - const startYHGL = () => { init() @@ -94,9 +95,11 @@ // showResultAssess.value = true // showDangerAssess.value = true } + const setBackToHome = (value) => { - backToHome.value = value; - }; + backToHome.value = value + } + // 瀵艰埅鐐瑰嚮 const handleNavClick = (index) => { switch (index) { @@ -114,7 +117,9 @@ break } } + return { + // UI 鐘舵�� navigationShow, leftShow, rightShow, @@ -135,20 +140,26 @@ showLayerTree, showDangerAssess, schemCard, - // selectTab, backToHome, - handleNavClick, + + // 鏂规鐩稿叧鏂规硶 + setSchemCard, + addSchemCard, + removeSchemCardItem, + updateSchemCardItem, + setBackToHome, + + // 鉁� 鏆撮湶 selectedScheme 鍙婂叾鏂规硶 + selectedScheme, // 鍝嶅簲寮忓紩鐢� + setSelectedScheme, // 鏂规硶 + clearSelectedScheme, // 鏂规硶 + + // 鎺у埗閫昏緫 init, startYHGL, startZHJC, startMNFZ, startMNPG, - setSchemCard, - addSchemCard, - removeSchemCardItem, - updateSchemCardItem, - // handleClickTab, - // createSimulation, - setBackToHome + handleNavClick, } }) \ No newline at end of file -- Gitblit v1.9.3