From e15245c624a20a3b46e428d646f5f2dd863cd1bc Mon Sep 17 00:00:00 2001 From: guonan <guonan201020@163.com> Date: 星期四, 17 四月 2025 14:22:36 +0800 Subject: [PATCH] 完善 --- src/store/simulation.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/store/simulation.js b/src/store/simulation.js index 8fd427c..d99e4d2 100644 --- a/src/store/simulation.js +++ b/src/store/simulation.js @@ -1,6 +1,7 @@ // stores/ui.js import { defineStore } from 'pinia' import { ref } from 'vue' +import { createSimData } from '@/api/trApi'; export const useSimStore = defineStore('ui', () => { // 鎵�鏈塙I鐘舵�� @@ -24,6 +25,7 @@ const showLayerTree = ref(true) const showDangerAssess = ref(false) const schemCard = ref([]) + const selectTab = ref("琛屾斂鍖哄垝浠跨湡") // 鍒濆鍖栨柟娉� const init = () => { @@ -43,17 +45,52 @@ showResultAssess.value = false showDangerAssess.value = false schemCard.value = [] + selectTab.value = "琛屾斂鍖哄垝浠跨湡" + } + + const handleClickTab = (data) => { + selectTab.value = data + } + + // 鏂板缓鏂规 + const createSimulation = async (forms) => { + const getAreaType = (tabName) => { + switch (tabName) { + case '琛屾斂鍖哄垝浠跨湡': + return 1 + case '閲嶇偣鍖哄煙浠跨湡': + return 2 + case '閲嶇偣娌熶豢鐪�': + return 3 + default: + return 0 // 鑷畾涔� + } + } + const params = { + areaType: getAreaType(selectTab), + createTime: Date.now(), + name: forms.name, + // 1涓洪娴嬫ā鎷燂紝2涓哄疄鏃舵ā鎷燂紝3涓哄巻鍙叉ā鎷� + type: 1, + // 0涓哄垱寤轰豢鐪燂紝1涓洪澶勭悊锛�2涓哄垎鏋愪腑锛�10涓哄畬鎴愶紝20涓哄嚭閿� + status: 0, + } + try { + await createSimData(params) + } catch (error) { + console.error('鍒涘缓浠跨湡澶辫触:', error) + } + } + // 鏂规鐩稿叧 const setSchemCard = (data) => { schemCard.value = data - console.log(schemCard,'aaaaaaaaaaaaaa'); - } // 娣诲姞鍗曚釜鏂规鏁版嵁 - const addSchemCardItem = (item) => { - schemCard.value.push(item) + const addSchemCard = (item) => { + schemCard.value.unshift(item) } // 鍒犻櫎鎸囧畾鏂规鏁版嵁 @@ -89,8 +126,8 @@ const startMNPG = () => { init() - showResultAssess.value = true - showDangerAssess.value = true + // showResultAssess.value = true + // showDangerAssess.value = true } // 瀵艰埅鐐瑰嚮 @@ -130,16 +167,19 @@ showResultAssess, showLayerTree, showDangerAssess, + schemCard, + selectTab, handleNavClick, init, startYHGL, startZHJC, startMNFZ, startMNPG, - schemCard, setSchemCard, - addSchemCardItem, + addSchemCard, removeSchemCardItem, updateSchemCardItem, + handleClickTab, + createSimulation, } }) \ No newline at end of file -- Gitblit v1.9.3