| | |
| | | import { ref, computed,inject } from 'vue'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { initeWaterPrimitiveView } from "@/utils/water"; |
| | | import { useSimStore } from "@/store/simulation.js"; // 引入 Store |
| | | |
| | | // 获取 Store 实例 |
| | | const simStore = useSimStore(); |
| | | |
| | | // 注入模拟操作方法 |
| | | const { startSimulate, endSimulate } = inject("simulateActions"); |
| | | |
| | | function startPlay() { |
| | |
| | | initeWaterPrimitiveView(); |
| | | startSimulate(); |
| | | } |
| | | |
| | | // 定义 Props |
| | | const props = defineProps({ |
| | | selectedArea: { |
| | |
| | | |
| | | // 确认保存 |
| | | const confirmSave = () => { |
| | | console.log('保存方案成功', { |
| | | 区域: props.selectedArea, |
| | | 模拟类型: '预测模拟', |
| | | 预测数据: selectedForecastDataName.value, |
| | | 降雨雨量: `${totalRainfall.value} mm`, |
| | | 降雨强度: `${rainfallIntensity.value} mm/h`, |
| | | 降雨模式: selectedRainfallPatternsName.value, |
| | | 预计时长: `${rainfallDuration.value} h` |
| | | }); |
| | | ElMessage.success('方案已保存'); |
| | | // 构造新的方案对象 |
| | | const newScheme = { |
| | | id: Date.now().toString(), // 唯一 ID |
| | | area: props.selectedArea, // 区域 |
| | | name: selectedForecastDataName.value, // 方案名称(预测数据类型) |
| | | createTime: new Date().toISOString(), // 创建时间 |
| | | taskStatus: 0, // 初始状态为未开始 |
| | | simulationType: '预测模拟', // 模拟类型 |
| | | forecastData: selectedForecastDataName.value, // 预测数据 |
| | | totalRainfall: `${totalRainfall.value} mm`, // 降雨雨量 |
| | | rainfallIntensity: `${rainfallIntensity.value} mm/h`, // 降雨强度 |
| | | rainfallPattern: selectedRainfallPatternsName.value, // 降雨模式 |
| | | rainfallDuration: `${rainfallDuration.value} h`, // 预计时长 |
| | | }; |
| | | |
| | | // 调用 Store 的方法添加方案 |
| | | simStore.addSchemCard(newScheme); |
| | | |
| | | console.log("保存方案成功", newScheme); |
| | | ElMessage.success("方案已保存"); |
| | | |
| | | // 关闭对话框 |
| | | saveDialogVisible.value = false; |
| | | }; |
| | | |