wangjuncheng
2025-04-22 5caf72a91b204c78cdc91ce116beae5d445dc73d
src/store/simulation.js
@@ -1,8 +1,9 @@
// stores/ui.js
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { createSimData } from '@/api/trApi';
export const useSimStore = defineStore('ui', () => {
export const useSimStore = defineStore('simulation', () => {
    // 所有UI状态
    const navigationShow = ref(true)
    const leftShow = ref(false)
@@ -24,6 +25,7 @@
    const showLayerTree = ref(true)
    const showDangerAssess = ref(false)
    const schemCard = ref([])
    const backToHome = ref(false)
    // 初始化方法
    const init = () => {
@@ -37,6 +39,7 @@
        locationShow.value = false
        tableShow.value = false
        flowShow.value = false
        backToHome.value = false
        rightRiverShow.value = false
        showPreview.value = false
        deviceShow.value = false
@@ -44,6 +47,7 @@
        showDangerAssess.value = false
        schemCard.value = []
    }
    // 方案相关
    const setSchemCard = (data) => {
        schemCard.value = data
@@ -82,15 +86,17 @@
    const startMNFZ = () => {
        init()
        leftShow.value = true
        rightRiverShow.value = true
        // rightRiverShow.value = true
    }
    const startMNPG = () => {
        init()
        showResultAssess.value = true
        showDangerAssess.value = true
        // showResultAssess.value = true
        // showDangerAssess.value = true
    }
    const setBackToHome = (value) => {
        backToHome.value = value;
    };
    // 导航点击
    const handleNavClick = (index) => {
        switch (index) {
@@ -128,16 +134,21 @@
        showResultAssess,
        showLayerTree,
        showDangerAssess,
        schemCard,
        // selectTab,
        backToHome,
        handleNavClick,
        init,
        startYHGL,
        startZHJC,
        startMNFZ,
        startMNPG,
        schemCard,
        setSchemCard,
        addSchemCard,
        removeSchemCardItem,
        updateSchemCardItem,
        // handleClickTab,
        // createSimulation,
        setBackToHome
    }
})