wangjuncheng
2025-04-15 8792be67cf5791a4a3afc2f72fd8d7cfc3cff353
src/store/simulation.js
@@ -23,6 +23,7 @@
    const showResultAssess = ref(false)
    const showLayerTree = ref(true)
    const showDangerAssess = ref(false)
    const schemCard = ref([])
    // 初始化方法
    const init = () => {
@@ -41,6 +42,29 @@
        deviceShow.value = false
        showResultAssess.value = false
        showDangerAssess.value = false
        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 }
        }
    }
@@ -109,6 +133,11 @@
        startYHGL,
        startZHJC,
        startMNFZ,
        startMNPG
        startMNPG,
        schemCard,
        setSchemCard,
        addSchemCard,
        removeSchemCardItem,
        updateSchemCardItem,
    }
})