From 479c2855f93517517037dd5805ba3512e9aec37d Mon Sep 17 00:00:00 2001 From: wangjuncheng <1> Date: 星期二, 15 四月 2025 14:58:01 +0800 Subject: [PATCH] change --- src/views/left/KGSimOption/HistorySimulation.vue | 45 +++++++++++++++++++++++++-------------------- 1 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/views/left/KGSimOption/HistorySimulation.vue b/src/views/left/KGSimOption/HistorySimulation.vue index 1388db7..c3431e0 100644 --- a/src/views/left/KGSimOption/HistorySimulation.vue +++ b/src/views/left/KGSimOption/HistorySimulation.vue @@ -93,18 +93,14 @@ import { ref, computed, inject } from "vue"; import { ElMessage } from "element-plus"; import { initeWaterPrimitiveView } from "@/utils/water"; -// const emit = defineEmits(["start", "end"]); +import { useSimStore } from "@/store/simulation.js"; // 寮曞叆 Store + +// 鑾峰彇 Store 瀹炰緥 +const simStore = useSimStore(); + +// 娉ㄥ叆妯℃嫙鎿嶄綔鏂规硶 const { startSimulate, endSimulate } = inject("simulateActions"); -// function endPlay() { -// emit("end"); -// } - -function startPlay() { - initeWaterPrimitiveView(); - // emit("start"); - startSimulate(); -} // 瀹氫箟 Props const props = defineProps({ selectedArea: { @@ -165,22 +161,31 @@ // 纭淇濆瓨 const confirmSave = () => { - console.log("淇濆瓨鏂规鎴愬姛", { - 鍖哄煙: props.selectedArea, - 妯℃嫙绫诲瀷: "鍘嗗彶妯℃嫙", - 鍘嗗彶闆ㄦ儏: selectedRainfallName.value, - 闄嶉洦鎬婚噺: `${totalRainfall.value} mm`, - 闄嶉洦寮哄害: `${rainfallIntensity.value} mm/h`, - 闄嶉洦鏃堕暱: `${rainfallDuration.value} h`, - }); + // 鏋勯�犳柊鐨勬柟妗堝璞� + const newScheme = { + id: Date.now().toString(), // 鍞竴 ID + area: props.selectedArea, // 鍖哄煙 + name: selectedRainfallName.value, // 鏂规鍚嶇О + createTime: new Date().toISOString(), // 鍒涘缓鏃堕棿 + taskStatus: 0, // 鍒濆鐘舵�佷负鏈紑濮� + totalRainfall: totalRainfall.value, // 闄嶉洦鎬婚噺 + rainfallIntensity: rainfallIntensity.value, // 闄嶉洦寮哄害 + rainfallDuration: rainfallDuration.value, // 闄嶉洦鏃堕暱 + }; + + simStore.addSchemCardItem(newScheme); ElMessage.success("鏂规宸蹭繚瀛�"); + // 鍏抽棴瀵硅瘽妗� saveDialogVisible.value = false; }; + // 寮�濮嬫ā鎷� -const startSimulation = () => { +function startPlay() { console.log("寮�濮嬫ā鎷熸寜閽鐐瑰嚮"); console.log("褰撳墠閫変腑鐨勫尯鍩燂細", props.selectedArea); -}; + initeWaterPrimitiveView(); + startSimulate(); +} </script> <style scoped> -- Gitblit v1.9.3