| | |
| | | <template> |
| | | <div class="history-simulation"> |
| | | <div class="left-top"> |
| | | <span>历史模拟</span> |
| | | <span @click="getRainData">历史模拟</span> |
| | | <span class="clickable-text" @click="toggleDetails">{{ |
| | | isCollapsed ? "展开" : "收起" |
| | | }}</span> |
| | |
| | | <div class="input-group"> |
| | | <div class="input-item"> |
| | | <label>历史雨情:</label> |
| | | <el-select |
| | | v-model="rainfallHistory" |
| | | placeholder="请选择" |
| | | popper-class="mySelectStyle" |
| | | > |
| | | <el-option |
| | | v-for="item in HistoricalRainData" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | ></el-option> |
| | | <el-select v-model="rainfallHistory" placeholder="请选择" popper-class="mySelectStyle"> |
| | | <el-option v-for="item in HistoricalRainData" :key="item.id" :label="item.name" |
| | | :value="item.id"></el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | <div class="input-group"> |
| | | <div class="input-item"> |
| | | <label>降雨总量:</label> |
| | | <el-input |
| | | v-model="totalRainfall" |
| | | type="number" |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | <el-input v-model="totalRainfall" type="number" placeholder="请输入"></el-input> |
| | | <span>mm</span> |
| | | </div> |
| | | <div class="input-item"> |
| | | <label>降雨强度:</label> |
| | | <el-input |
| | | v-model="rainfallIntensity" |
| | | type="number" |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | <el-input v-model="rainfallIntensity" type="number" placeholder="请输入"></el-input> |
| | | <span>mm/h</span> |
| | | </div> |
| | | <div class="input-item"> |
| | | <label>降雨时长:</label> |
| | | <el-input |
| | | v-model="rainfallDuration" |
| | | type="number" |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | <el-input v-model="rainfallDuration" type="number" placeholder="请输入"></el-input> |
| | | <span>h</span> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | |
| | | <!-- 保存方案对话框 --> |
| | | <el-dialog |
| | | v-model="saveDialogVisible" |
| | | title="保存方案" |
| | | width="50%" |
| | | :before-close="handleClose" |
| | | custom-class="custom-dialog" |
| | | > |
| | | <el-dialog v-model="saveDialogVisible" title="保存方案" width="50%" :before-close="handleClose" |
| | | custom-class="custom-dialog"> |
| | | <div class="dialog-content"> |
| | | <p><strong>所选重点沟:</strong>{{ props.selectedArea }}</p> |
| | | <p><strong>模拟类型:</strong>历史模拟</p> |
| | |
| | | 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 |
| | | import { getRainfallData } from "@/api/hpApi.js" |
| | | // 获取 Store 实例 |
| | | const simStore = useSimStore(); |
| | | // 测试获取雨量数据 |
| | | // const getRainData = () => { |
| | | // getRainfallData() |
| | | // .then((a) => { |
| | | // console.log(a, '宏图获取雨量数据'); |
| | | // }) |
| | | // }; |
| | | |
| | | // 注入模拟操作方法 |
| | | const { startSimulate, endSimulate } = inject("simulateActions"); |
| | | |
| | | // function endPlay() { |
| | | // emit("end"); |
| | | // } |
| | | |
| | | function startPlay() { |
| | | initeWaterPrimitiveView(); |
| | | // emit("start"); |
| | | startSimulate(); |
| | | } |
| | | // 定义 Props |
| | | const props = defineProps({ |
| | | selectedArea: { |
| | |
| | | |
| | | // 确认保存 |
| | | 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: 1, // 初始状态为未开始 |
| | | totalRainfall: totalRainfall.value, // 降雨总量 |
| | | rainfallIntensity: rainfallIntensity.value, // 降雨强度 |
| | | rainfallDuration: rainfallDuration.value, // 降雨时长 |
| | | }; |
| | | |
| | | simStore.addSchemCard(newScheme); |
| | | ElMessage.success("方案已保存"); |
| | | // 关闭对话框 |
| | | saveDialogVisible.value = false; |
| | | }; |
| | | |
| | | // 开始模拟 |
| | | const startSimulation = () => { |
| | | function startPlay() { |
| | | console.log("开始模拟按钮被点击"); |
| | | console.log("当前选中的区域:", props.selectedArea); |
| | | }; |
| | | initeWaterPrimitiveView(); |
| | | startSimulate(); |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |