| | |
| | | <template> |
| | | <div class="listCard"> |
| | | <el-card v-for="(item, key) in schemCard" :key="key"> |
| | | <!-- <div>方案数量: {{ simStore.schemCard.length }}</div> --> |
| | | <el-card v-for="(item, key) in simStore.schemCard" :key="key"> |
| | | <div> |
| | | <p>方案名称 : {{ item.name }}</p> |
| | | <p>创建时间 : {{ item.createTime }}</p> |
| | | <p>创建时间 : {{ formatTime(item.createTime) }}</p> |
| | | <p> |
| | | 方案状态 : |
| | | <span style="color: aquamarine">{{ item.status || "已完成" }}</span> |
| | | <span style="color: aquamarine">{{ statusText[item.taskStatus] || "未知" }}</span> |
| | | </p> |
| | | </div> |
| | | <div class="cardMenu"> |
| | | <div style="float: right; margin-top: 3px"> |
| | | <el-button size="small" @click="setSchemClick(item)" |
| | | >方案详情</el-button |
| | | > |
| | | <el-button size="small" @click="startPlay"> 进入模拟 </el-button> |
| | | <el-button size="small" @click="setSchemClick(item)">方案详情</el-button> |
| | | <el-button size="small" @click="startPlay(item)" :disabled="item.taskStatus !== 2">进入模拟</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | |
| | | <script setup> |
| | | import { ref } from "vue"; |
| | | import dayjs from "dayjs"; |
| | | import { initeWaterPrimitiveView } from "@/utils/water"; |
| | | import Message from "@/components/tools/Message.vue"; |
| | | // import { useSimStore } from "@/store/simulation"; |
| | | import { useSimStore } from "@/store/simulation.js"; |
| | | |
| | | // const simStore = useSimStore(); |
| | | const simStore = useSimStore(); |
| | | |
| | | const schemCard = ref([ |
| | | simStore.setSchemCard([ |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | |
| | | userId: "0", |
| | | }, |
| | | ]); |
| | | // function setSchemClick(res) { |
| | | // simStore.messageShow = true; |
| | | // } |
| | | const statusText = { |
| | | 0: "未开始", |
| | | 1: "进行中", |
| | | 2: "已完成", |
| | | }; |
| | | function formatTime(time) { |
| | | return dayjs(time).format("YYYY-MM-DD HH:mm:ss"); |
| | | } |
| | | const messageShow = ref(false); |
| | | const mesData = ref(null); |
| | | function setSchemClick(item) { |
| | | |
| | | mesData.value = item; |
| | | console.log(mesData.value,'dadadaddaadaadadadad'); |
| | | messageShow.value = true; |
| | | } |
| | | function close() { |
| | | messageShow.value = false; |
| | | } |
| | | function startPlay(item) { |
| | | // if (item.taskStatus !== 2) { |
| | | // alert("当前方案尚未完成,无法进入模拟!"); |
| | | // return; |
| | | // } |
| | | initeWaterPrimitiveView(); |
| | | emit("start"); |
| | | } |
| | | const emit = defineEmits(["start", "end"]); |
| | | function endPlay() { |
| | | emit("end"); |
| | | } |
| | | |
| | | function startPlay() { |
| | | initeWaterPrimitiveView(); |
| | | emit("start"); |
| | | } |
| | | </script> |
| | | |
| | |
| | | const showResultAssess = ref(false) |
| | | const showLayerTree = ref(true) |
| | | const showDangerAssess = ref(false) |
| | | const schemCard = ref([]) |
| | | |
| | | // 初始化方法 |
| | | const init = () => { |
| | |
| | | deviceShow.value = false |
| | | showResultAssess.value = false |
| | | showDangerAssess.value = false |
| | | schemCard.value = [] |
| | | } |
| | | // 方案相关 |
| | | const setSchemCard = (data) => { |
| | | schemCard.value = data |
| | | console.log(schemCard,'aaaaaaaaaaaaaa'); |
| | | |
| | | } |
| | | |
| | | // 添加单个方案数据 |
| | | const addSchemCardItem = (item) => { |
| | | schemCard.value.push(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 } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | startYHGL, |
| | | startZHJC, |
| | | startMNFZ, |
| | | startMNPG |
| | | startMNPG, |
| | | schemCard, |
| | | setSchemCard, |
| | | addSchemCardItem, |
| | | removeSchemCardItem, |
| | | updateSchemCardItem, |
| | | } |
| | | }) |
| | |
| | | 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() { |
| | | console.log("开始模拟按钮被点击"); |
| | | console.log("当前选中的区域:", props.selectedArea); |
| | | initeWaterPrimitiveView(); |
| | | 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: 0, // 初始状态为未开始 |
| | | totalRainfall: totalRainfall.value, // 降雨总量 |
| | | rainfallIntensity: rainfallIntensity.value, // 降雨强度 |
| | | rainfallDuration: rainfallDuration.value, // 降雨时长 |
| | | }; |
| | | |
| | | simStore.addSchemCardItem(newScheme); |
| | | ElMessage.success("方案已保存"); |
| | | // 关闭对话框 |
| | | saveDialogVisible.value = false; |
| | | }; |
| | | |
| | | // 开始模拟 |
| | | function startPlay() { |
| | | console.log("开始模拟按钮被点击"); |
| | | console.log("当前选中的区域:", props.selectedArea); |
| | | initeWaterPrimitiveView(); |
| | | startSimulate(); |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |