Merge branch 'master' of http://103.135.160.14:9034/r/NslWeb
| | |
| | | baseURL: "/api", // 使用你配置的 /auth 代理 |
| | | timeout: 1000 * 60, // 请求超时时间(单位:毫秒) |
| | | headers: { |
| | | "Content-Type": "application/x-www-form-urlencoded", // 默认请求头 |
| | | "Content-Type": "application/x-www-form-urlencoded", // 默认请求头application/json |
| | | }, |
| | | }); |
| | | // 请求拦截器 |
| | |
| | | import axios from "./requestTR.js"; |
| | | import instance from "./requestTR.js"; |
| | | |
| | | // 获取雨量数据 |
| | | export async function getData() { |
| | | try { |
| | | const response = await axios.get("/region/selectPage", { |
| | | const response = await instance.get("/region/selectPage", { |
| | | }); |
| | | // console.log("Response:", response); |
| | | } catch (error) { |
| | |
| | | // 获取方案列表 |
| | | export async function getSimData() { |
| | | try { |
| | | const res = await axios.get("/simu/selectPage"); |
| | | const res = await instance.get("/simu/selectPage"); |
| | | return res.data; // 返回实际数据(通常 res.data 才是接口返回的内容) |
| | | } catch (error) { |
| | | console.error("Error fetching data:", error); |
| | |
| | | // 新建仿真方案 |
| | | export async function createSimData(simData) { |
| | | try { |
| | | const res = await axios.post("/simu/insert", simData, { |
| | | const res = await instance.post("/simu/insert", simData, { |
| | | headers: { |
| | | "Content-Type": "application/json", |
| | | }, |
| | |
| | | // 删除仿真方案 |
| | | export async function deleteSimData(ids) { |
| | | try { |
| | | const res = await axios.delete(`/simu/deleteByIds?ids=${ids}`); |
| | | const res = await instance.delete(`/simu/deleteByIds?ids=${ids}`); |
| | | return res.data; |
| | | } catch (error) { |
| | | console.error('Error deleting simulation data:', error); |
| | |
| | | <div class="listCard"> |
| | | <!-- <div>方案数量: {{ simStore.schemCard.length }}</div> --> |
| | | <!-- 接口版本删除该代码块 --> |
| | | <el-card v-if="!schemeInfoShow" v-for="(item, key) in simStore.schemCard" :key="key" |
| | | :class="{ selected: selectedId === item.id }" @click="selectScheme(item.id)"> |
| | | <!-- <el-card v-if="!schemeInfoShow" v-for="(item, key) in simStore.schemCard" :key="key" |
| | | :class="{ selected: selectedId === item.id }" @click="selectScheme(item.id)"> --> |
| | | <el-card |
| | | v-if="!schemeInfoShow" |
| | | v-for="(item, key) in schemeList" |
| | | :key="key" |
| | | :class="{ selected: selectedId === item.id }" |
| | | @click="selectScheme(item.id)" |
| | | > |
| | | <div> |
| | | <p>方案名称 : {{ item.name }}</p> |
| | | <p>创建时间 : {{ formatTime(item.createTime) }}</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="setSchemClick(item)" |
| | | >方案详情</el-button |
| | | > |
| | | <el-button size="small" @click="startPlay(item)">进入模拟</el-button> |
| | | <!-- :disabled="item.taskStatus !== 2" --> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | <schemeInfo v-if="schemeInfoShow" :selectedScheme="currentScheme" @back="handleBack" /> |
| | | <schemeInfo |
| | | v-if="schemeInfoShow" |
| | | :selectedScheme="currentScheme" |
| | | @back="handleBack" |
| | | /> |
| | | </div> |
| | | |
| | | <Message @close="close" class="mess" v-show="messageShow" :mesData="mesData" /> |
| | | <Message |
| | | @close="close" |
| | | class="mess" |
| | | v-show="messageShow" |
| | | :mesData="mesData" |
| | | /> |
| | | </template> |
| | | |
| | | <script setup> |
| | |
| | | function selectScheme(id) { |
| | | selectedId.value = id; |
| | | } |
| | | simStore.setSchemCard([ |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2025-01-13 19:33:04", |
| | | datPath: "e:/data/hydro/11011611021801/1878767214615695362", |
| | | dataType: 2, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2023-08-01 01:59:59", |
| | | fileCount: 299, |
| | | fileName: "东江沟雨量计0110.xls", |
| | | hotStart: false, |
| | | id: "1878767214431145986", |
| | | name: "降雨数据:房山区东江沟数据", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2023-07-30 00:00:00", |
| | | taskId: "1878767214615695362", |
| | | taskStatus: 2, |
| | | updateTime: "2025-01-13 19:33:04", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2025-01-10 14:33:49", |
| | | datPath: "e:/data/hydro/11011611021801/1877604741980196866", |
| | | dataType: 2, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2023-08-02 01:00:00", |
| | | fileCount: 450, |
| | | fileName: "东江沟雨量计0110.xls", |
| | | hotStart: false, |
| | | id: "1877604741590126594", |
| | | name: "东江沟0729-0801", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2023-07-29 22:00:00", |
| | | taskId: "1877604741980196866", |
| | | taskStatus: 2, |
| | | updateTime: "2025-01-10 14:33:49", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2024-12-27 12:28:45", |
| | | datPath: "e:/data/hydro/11011611021801/1872499838538584065", |
| | | dataType: 2, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2023-08-02 09:00:00", |
| | | fileCount: 654, |
| | | fileName: "东江沟雨量计0110.xls", |
| | | hotStart: false, |
| | | id: "1872499838278537217", |
| | | name: "北京市731暴雨", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2023-07-28 20:00:00", |
| | | taskId: "1872499838538584065", |
| | | taskStatus: 2, |
| | | updateTime: "2024-12-27 12:28:45", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2024-12-20 15:00:11", |
| | | datPath: "e:/data/hydro/11011611021801/1870001233680502786", |
| | | dataType: 0, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2024-12-20 06:00:00", |
| | | fileCount: 86, |
| | | fileName: "", |
| | | hotStart: false, |
| | | id: "1870001233646948354", |
| | | name: "雨强30mm", |
| | | noRainTime: 0, |
| | | outputPeriod: 300, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2024-12-20 00:00:00", |
| | | taskId: "1870001233680502786", |
| | | taskStatus: 2, |
| | | updateTime: "2024-12-20 15:00:11", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2024-12-19 17:34:34", |
| | | datPath: "e:/data/hydro/11011611021801/1869677696923045889", |
| | | dataType: 2, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2023-08-01 03:00:44", |
| | | fileCount: 388, |
| | | fileName: "截流坝雨量计0068.xls", |
| | | hotStart: false, |
| | | id: "1869677696608473090", |
| | | name: "截流坝数据模拟0729-0731", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2023-07-29 21:00:13", |
| | | taskId: "1869677696923045889", |
| | | taskStatus: 2, |
| | | updateTime: "2024-12-19 17:34:34", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2024-12-13 15:03:24", |
| | | datPath: "e:/data/hydro/11011611021801/1867465327392165890", |
| | | dataType: 2, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2023-07-31 12:00:00", |
| | | fileCount: 288, |
| | | fileName: "东江沟雨量计0110.xls", |
| | | hotStart: false, |
| | | id: "1867465327106953218", |
| | | name: "东江沟数据模拟0729-0731", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2023-07-29 12:00:00", |
| | | taskId: "1867465327392165890", |
| | | taskStatus: 2, |
| | | updateTime: "2024-12-13 15:03:24", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2024-11-28 19:01:16", |
| | | datPath: "e:/data/hydro/11011611021801/1862089369491931138", |
| | | dataType: 2, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2023-07-31 00:00:00", |
| | | fileCount: 145, |
| | | fileName: "东江沟雨量计0110.xls", |
| | | hotStart: false, |
| | | id: "1862089369462571010", |
| | | name: "东江沟雨量0731", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2023-07-30 00:00:00", |
| | | taskId: "1862089369491931138", |
| | | taskStatus: 2, |
| | | updateTime: "2024-11-28 19:01:16", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2024-11-28 18:47:45", |
| | | datPath: "e:/data/hydro/11011611021801/1862085967261270017", |
| | | dataType: 0, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2024-08-31 00:00:00", |
| | | fileCount: 145, |
| | | fileName: "", |
| | | hotStart: false, |
| | | id: "1862085967252881410", |
| | | name: "雨强模拟方案0830", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2024-08-30 00:00:00", |
| | | taskId: "1862085967261270017", |
| | | taskStatus: 2, |
| | | updateTime: "2024-11-28 18:47:45", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2024-11-28 18:39:49", |
| | | datPath: "e:/data/hydro/11011611021801/1862083971414294529", |
| | | dataType: 1, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2024-07-31 00:00:00", |
| | | fileCount: 145, |
| | | fileName: "", |
| | | hotStart: false, |
| | | id: "1862083971003252737", |
| | | name: "雨量模拟方案0730", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2024-07-30 00:00:00", |
| | | taskId: "1862083971414294529", |
| | | taskStatus: 2, |
| | | updateTime: "2024-11-28 18:39:49", |
| | | userId: "0", |
| | | }, |
| | | { |
| | | area: "孙胡沟", |
| | | areaId: "0", |
| | | createTime: "2024-11-28 17:26:45", |
| | | datPath: "e:/data/hydro/11011611021801/1862065584806100994", |
| | | dataType: 0, |
| | | dataValue: "", |
| | | depthThreshold: 0, |
| | | endTime: "2024-11-28 09:26:17", |
| | | fileCount: 57, |
| | | fileName: "", |
| | | hotStart: false, |
| | | id: "1862065584743186434", |
| | | name: "雨强模拟方案1128", |
| | | noRainTime: 0, |
| | | outputPeriod: 600, |
| | | shpPath: "e:/data/hydro/11011611021801/shp", |
| | | simulateType: 1, |
| | | startTime: "2024-11-28 00:00:00", |
| | | taskId: "1862065584806100994", |
| | | taskStatus: 2, |
| | | updateTime: "2024-11-28 17:26:45", |
| | | userId: "0", |
| | | }, |
| | | ]); |
| | | // simStore.setSchemCard([ |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2025-01-13 19:33:04", |
| | | // datPath: "e:/data/hydro/11011611021801/1878767214615695362", |
| | | // dataType: 2, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2023-08-01 01:59:59", |
| | | // fileCount: 299, |
| | | // fileName: "东江沟雨量计0110.xls", |
| | | // hotStart: false, |
| | | // id: "1878767214431145986", |
| | | // name: "降雨数据:房山区东江沟数据", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2023-07-30 00:00:00", |
| | | // taskId: "1878767214615695362", |
| | | // taskStatus: 2, |
| | | // updateTime: "2025-01-13 19:33:04", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2025-01-10 14:33:49", |
| | | // datPath: "e:/data/hydro/11011611021801/1877604741980196866", |
| | | // dataType: 2, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2023-08-02 01:00:00", |
| | | // fileCount: 450, |
| | | // fileName: "东江沟雨量计0110.xls", |
| | | // hotStart: false, |
| | | // id: "1877604741590126594", |
| | | // name: "东江沟0729-0801", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2023-07-29 22:00:00", |
| | | // taskId: "1877604741980196866", |
| | | // taskStatus: 2, |
| | | // updateTime: "2025-01-10 14:33:49", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2024-12-27 12:28:45", |
| | | // datPath: "e:/data/hydro/11011611021801/1872499838538584065", |
| | | // dataType: 2, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2023-08-02 09:00:00", |
| | | // fileCount: 654, |
| | | // fileName: "东江沟雨量计0110.xls", |
| | | // hotStart: false, |
| | | // id: "1872499838278537217", |
| | | // name: "北京市731暴雨", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2023-07-28 20:00:00", |
| | | // taskId: "1872499838538584065", |
| | | // taskStatus: 2, |
| | | // updateTime: "2024-12-27 12:28:45", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2024-12-20 15:00:11", |
| | | // datPath: "e:/data/hydro/11011611021801/1870001233680502786", |
| | | // dataType: 0, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2024-12-20 06:00:00", |
| | | // fileCount: 86, |
| | | // fileName: "", |
| | | // hotStart: false, |
| | | // id: "1870001233646948354", |
| | | // name: "雨强30mm", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 300, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2024-12-20 00:00:00", |
| | | // taskId: "1870001233680502786", |
| | | // taskStatus: 2, |
| | | // updateTime: "2024-12-20 15:00:11", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2024-12-19 17:34:34", |
| | | // datPath: "e:/data/hydro/11011611021801/1869677696923045889", |
| | | // dataType: 2, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2023-08-01 03:00:44", |
| | | // fileCount: 388, |
| | | // fileName: "截流坝雨量计0068.xls", |
| | | // hotStart: false, |
| | | // id: "1869677696608473090", |
| | | // name: "截流坝数据模拟0729-0731", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2023-07-29 21:00:13", |
| | | // taskId: "1869677696923045889", |
| | | // taskStatus: 2, |
| | | // updateTime: "2024-12-19 17:34:34", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2024-12-13 15:03:24", |
| | | // datPath: "e:/data/hydro/11011611021801/1867465327392165890", |
| | | // dataType: 2, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2023-07-31 12:00:00", |
| | | // fileCount: 288, |
| | | // fileName: "东江沟雨量计0110.xls", |
| | | // hotStart: false, |
| | | // id: "1867465327106953218", |
| | | // name: "东江沟数据模拟0729-0731", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2023-07-29 12:00:00", |
| | | // taskId: "1867465327392165890", |
| | | // taskStatus: 2, |
| | | // updateTime: "2024-12-13 15:03:24", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2024-11-28 19:01:16", |
| | | // datPath: "e:/data/hydro/11011611021801/1862089369491931138", |
| | | // dataType: 2, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2023-07-31 00:00:00", |
| | | // fileCount: 145, |
| | | // fileName: "东江沟雨量计0110.xls", |
| | | // hotStart: false, |
| | | // id: "1862089369462571010", |
| | | // name: "东江沟雨量0731", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2023-07-30 00:00:00", |
| | | // taskId: "1862089369491931138", |
| | | // taskStatus: 2, |
| | | // updateTime: "2024-11-28 19:01:16", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2024-11-28 18:47:45", |
| | | // datPath: "e:/data/hydro/11011611021801/1862085967261270017", |
| | | // dataType: 0, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2024-08-31 00:00:00", |
| | | // fileCount: 145, |
| | | // fileName: "", |
| | | // hotStart: false, |
| | | // id: "1862085967252881410", |
| | | // name: "雨强模拟方案0830", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2024-08-30 00:00:00", |
| | | // taskId: "1862085967261270017", |
| | | // taskStatus: 2, |
| | | // updateTime: "2024-11-28 18:47:45", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2024-11-28 18:39:49", |
| | | // datPath: "e:/data/hydro/11011611021801/1862083971414294529", |
| | | // dataType: 1, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2024-07-31 00:00:00", |
| | | // fileCount: 145, |
| | | // fileName: "", |
| | | // hotStart: false, |
| | | // id: "1862083971003252737", |
| | | // name: "雨量模拟方案0730", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2024-07-30 00:00:00", |
| | | // taskId: "1862083971414294529", |
| | | // taskStatus: 2, |
| | | // updateTime: "2024-11-28 18:39:49", |
| | | // userId: "0", |
| | | // }, |
| | | // { |
| | | // area: "孙胡沟", |
| | | // areaId: "0", |
| | | // createTime: "2024-11-28 17:26:45", |
| | | // datPath: "e:/data/hydro/11011611021801/1862065584806100994", |
| | | // dataType: 0, |
| | | // dataValue: "", |
| | | // depthThreshold: 0, |
| | | // endTime: "2024-11-28 09:26:17", |
| | | // fileCount: 57, |
| | | // fileName: "", |
| | | // hotStart: false, |
| | | // id: "1862065584743186434", |
| | | // name: "雨强模拟方案1128", |
| | | // noRainTime: 0, |
| | | // outputPeriod: 600, |
| | | // shpPath: "e:/data/hydro/11011611021801/shp", |
| | | // simulateType: 1, |
| | | // startTime: "2024-11-28 00:00:00", |
| | | // taskId: "1862065584806100994", |
| | | // taskStatus: 2, |
| | | // updateTime: "2024-11-28 17:26:45", |
| | | // userId: "0", |
| | | // }, |
| | | // ]); |
| | | const statusText = { |
| | | 0: "未开始", |
| | | 1: "进行中", |
| | |
| | | // return; |
| | | // } |
| | | currentScheme.value = item; |
| | | schemeInfoShow.value = true |
| | | schemeInfoShow.value = true; |
| | | emit("closeBtn", false); |
| | | initeWaterPrimitiveView(); |
| | | emit("start"); |
| | |
| | | EventBus.on("hide-schemeInfo", handleHideSchemeInfo); |
| | | |
| | | //////////////////////////////////// 暴露选中的 ID 给父组件(接口版本删除)//////////////////////////////////// |
| | | defineExpose({ |
| | | getSelectedId: () => selectedId.value, |
| | | }); |
| | | // defineExpose({ |
| | | // getSelectedId: () => selectedId.value, |
| | | // }); |
| | | |
| | | /////////////////////// 调用接口(使用时打开) /////////////////////// |
| | | // import { getData, getSimData, deleteSimData } from "@/api/trApi.js"; |
| | | // onMounted(() => { |
| | | // getScheme(); |
| | | // }); |
| | | import { getData, getSimData, deleteSimData } from "@/api/trApi.js"; |
| | | onMounted(() => { |
| | | getScheme(); |
| | | }); |
| | | |
| | | // const props = defineProps({ |
| | | // deleteSim: Boolean, // 接收父组件传递的函数 |
| | | // }); |
| | | const props = defineProps({ |
| | | deleteSim: Boolean, // 接收父组件传递的函数 |
| | | }); |
| | | |
| | | // watch( |
| | | // () => props.deleteSim, |
| | | // (newVal) => { |
| | | // if (newVal) { |
| | | // console.log(newVal); |
| | | // deleteSim(); |
| | | // emit("reset"); |
| | | // } |
| | | // } |
| | | // ); |
| | | watch( |
| | | () => props.deleteSim, |
| | | (newVal) => { |
| | | if (newVal) { |
| | | console.log(newVal); |
| | | deleteSim(); |
| | | emit("reset"); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | // const schemeList = ref([]); |
| | | const schemeList = ref([]); |
| | | |
| | | // async function getScheme() { |
| | | // try { |
| | | // const res = await getSimData(); |
| | | // schemeList.value = res.data; |
| | | // } catch (error) { |
| | | // console.error("Error fetching data:", error); |
| | | // } |
| | | // } |
| | | async function getScheme() { |
| | | try { |
| | | const res = await getSimData(); |
| | | schemeList.value = res.data; |
| | | } catch (error) { |
| | | console.error("Error fetching data:", error); |
| | | } |
| | | } |
| | | |
| | | // const deleteSim = () => { |
| | | // ElMessageBox.confirm("确定要删除该方案吗?", "删除方案", { |
| | | // confirmButtonText: "OK", |
| | | // cancelButtonText: "Cancel", |
| | | // }) |
| | | // .then(() => { |
| | | // deleteSimData(selectedId.value).then((res) => { |
| | | // getScheme(); |
| | | // }); |
| | | // ElMessage({ |
| | | // type: "success", |
| | | // message: "删除成功", |
| | | // }); |
| | | // }) |
| | | // .catch(() => { |
| | | // ElMessage({ |
| | | // type: "info", |
| | | // message: "已取消删除", |
| | | // }); |
| | | // }); |
| | | // }; |
| | | const deleteSim = () => { |
| | | ElMessageBox.confirm("确定要删除该方案吗?", "删除方案", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | }) |
| | | .then(() => { |
| | | deleteSimData(selectedId.value).then((res) => { |
| | | getScheme(); |
| | | }); |
| | | ElMessage({ |
| | | type: "success", |
| | | message: "删除成功", |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: "info", |
| | | message: "已取消删除", |
| | | }); |
| | | }); |
| | | }; |
| | | /////////////////////// 调用接口结束 /////////////////////// |
| | | onUnmounted(() => { |
| | | EventBus.off("hide-schemeInfo", handleHideSchemeInfo); |
| | |
| | | // import DangerAssess from "@/components/monifangzhen/DangerAssess.vue"; |
| | | import { showDeviceDetail } from "@/store"; |
| | | import { setupTokenRefresh } from "@/api/hpApi.js" |
| | | import { getData } from "@/api/trApi.js" |
| | | import { getSimData } from "@/api/trApi.js" |
| | | import { convertToWKT } from '@/utils/wktUtils'; |
| | | |
| | | const route = useRoute(); |
| | |
| | | const showDetail = computed(() => showDeviceDetail.value); |
| | | onMounted(() => { |
| | | setupTokenRefresh()// 获取宏图token |
| | | getData() //测试tr后端 |
| | | getSimData() //测试tr后端 |
| | | try { |
| | | const wktResult = convertToWKT(multiPolygonCoordinates); |
| | | console.log(wktResult); |
| | |
| | | <el-button type="success" @click="startPlay">开始模拟</el-button> |
| | | </div> |
| | | <!---------------------------- 保存方案对话框(接口版本需删除) --------------------------------> |
| | | <el-dialog |
| | | <!-- <el-dialog |
| | | v-model="saveDialogVisible" |
| | | :title="dialogTitle" |
| | | width="50%" |
| | |
| | | <el-button type="primary" @click="confirmSave">确定保存</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </el-dialog> --> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | import Papa from "papaparse"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { initeWaterPrimitiveView } from "@/utils/water"; |
| | | import { createSimData } from "@/api/trApi"; |
| | | |
| | | import { useSimStore } from "@/store/simulation"; |
| | | |
| | | const simStore = useSimStore(); |
| | |
| | | }); |
| | | |
| | | ////////////////////////////////////// 接口版本需删除////////////////////////////////////// |
| | | // 打开保存方案对话框 |
| | | const openSaveDialog = () => { |
| | | if ( |
| | | !forms.rainfall || |
| | | !forms.duration || |
| | | !forms.intensity || |
| | | (simStore.selectTab === "行政区划仿真" && !forms.eare) || |
| | | (simStore.selectTab === "重点区域仿真" && !forms.eares) |
| | | ) { |
| | | ElMessage.warning("请先填写所有必填项"); |
| | | return; |
| | | } |
| | | saveDialogVisible.value = true; |
| | | } |
| | | const handleClose = () => { |
| | | saveDialogVisible.value = false; |
| | | }; |
| | | |
| | | // 确认保存 |
| | | const confirmSave = () => { |
| | | console.log("保存方案成功", { |
| | | 模拟类型: dialogTitle.value, |
| | | 行政区域: simStore.selectTab === "行政区划仿真" ? forms.eare : null, |
| | | 重点区域: simStore.selectTab === "重点区域仿真" ? forms.eares : null, |
| | | 降雨量: `${forms.rainfall} mm`, |
| | | 降雨时长: `${forms.duration} h`, |
| | | 降雨强度: `${forms.intensity} mm/h`, |
| | | 上传文件: forms.fileList.map((file) => file.name), |
| | | }); |
| | | ElMessage.success("方案已保存"); |
| | | saveDialogVisible.value = false; |
| | | resetForm(); |
| | | }; |
| | | ////////////////////////////////////// 结束删除////////////////////////////////////// |
| | | |
| | | //////////////////////////////////接口版本启用////////////////////////////////// |
| | | // const isLoading = ref(false); |
| | | // // 保存方案 |
| | | // // 打开保存方案对话框 |
| | | // const openSaveDialog = () => { |
| | | // if ( |
| | | // !forms.rainfall || |
| | |
| | | // ElMessage.warning("请先填写所有必填项"); |
| | | // return; |
| | | // } |
| | | // ElMessageBox.confirm("确定要保存当前方案吗?", dialogTitle.value, { |
| | | // confirmButtonText: "确定", |
| | | // cancelButtonText: "取消", |
| | | // type: "warning", |
| | | // }) |
| | | // .then(confirmSave) |
| | | // .catch(() => { |
| | | // ElMessage({ |
| | | // type: "info", |
| | | // message: "已取消保存", |
| | | // }); |
| | | // }); |
| | | // saveDialogVisible.value = true; |
| | | // } |
| | | // const handleClose = () => { |
| | | // saveDialogVisible.value = false; |
| | | // }; |
| | | // const confirmSave = async () => { |
| | | // if (isLoading.value) { |
| | | // ElMessage.warning("正在保存,请稍候..."); |
| | | // return; // 防止重复提交 |
| | | // } |
| | | // isLoading.value = true; // 开始加载状态 |
| | | // try { |
| | | // await simStore.createSimulation(forms); // 调用 Store 中的保存方法 |
| | | // ElMessage.success("保存成功"); |
| | | // saveDialogVisible.value = true; // 显示保存对话框(如果需要) |
| | | // } catch (error) { |
| | | // console.error("保存失败:", error); |
| | | // ElMessage.error("保存失败,请稍后重试"); |
| | | // } finally { |
| | | // isLoading.value = false; // 结束加载状态 |
| | | // } |
| | | |
| | | // // 确认保存 |
| | | // const confirmSave = () => { |
| | | // console.log("保存方案成功", { |
| | | // 模拟类型: dialogTitle.value, |
| | | // 行政区域: simStore.selectTab === "行政区划仿真" ? forms.eare : null, |
| | | // 重点区域: simStore.selectTab === "重点区域仿真" ? forms.eares : null, |
| | | // 降雨量: `${forms.rainfall} mm`, |
| | | // 降雨时长: `${forms.duration} h`, |
| | | // 降雨强度: `${forms.intensity} mm/h`, |
| | | // 上传文件: forms.fileList.map((file) => file.name), |
| | | // }); |
| | | // ElMessage.success("方案已保存"); |
| | | // saveDialogVisible.value = false; |
| | | // resetForm(); |
| | | // }; |
| | | ////////////////////////////////////// 结束删除////////////////////////////////////// |
| | | |
| | | //////////////////////////////////接口版本启用////////////////////////////////// |
| | | const isLoading = ref(false); |
| | | // 保存方案 |
| | | const openSaveDialog = () => { |
| | | if ( |
| | | !forms.rainfall || |
| | | !forms.duration || |
| | | !forms.intensity || |
| | | (simStore.selectTab === "行政区划仿真" && !forms.eare) || |
| | | (simStore.selectTab === "重点区域仿真" && !forms.eares) |
| | | ) { |
| | | ElMessage.warning("请先填写所有必填项"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("确定要保存当前方案吗?", dialogTitle.value, { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(confirmSave) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: "info", |
| | | message: "已取消保存", |
| | | }); |
| | | }); |
| | | }; |
| | | const confirmSave = async () => { |
| | | if (isLoading.value) { |
| | | ElMessage.warning("正在保存,请稍候..."); |
| | | return; // 防止重复提交 |
| | | } |
| | | isLoading.value = true; // 开始加载状态 |
| | | try { |
| | | await simStore.createSimulation(forms); // 调用 Store 中的保存方法 |
| | | ElMessage.success("保存成功"); |
| | | saveDialogVisible.value = true; // 显示保存对话框(如果需要) |
| | | } catch (error) { |
| | | console.error("保存失败:", error); |
| | | ElMessage.error("保存失败,请稍后重试"); |
| | | } finally { |
| | | isLoading.value = false; // 结束加载状态 |
| | | } |
| | | }; |
| | | //////////////////////////////////接口版本启用////////////////////////////////// |
| | | |
| | | // 重置表单 |
| | |
| | | <el-button style="width: 45%;" @click="handleClick">新建仿真方案</el-button> |
| | | <el-button style="width: 45%;" @click="deleteSelectedScheme">删除仿真方案</el-button> |
| | | </div> |
| | | <schemeCard ref="schemeCardRef" @start="start" @end="end" @reset="reset" @closeBtn="handleBackFromParent" /> |
| | | <!-- <schemeCard |
| | | <!-- <schemeCard ref="schemeCardRef" @start="start" @end="end" @reset="reset" @closeBtn="handleBackFromParent" /> --> |
| | | <schemeCard |
| | | ref="schemeCardRef" |
| | | @start="start" |
| | | @end="end" |
| | | @reset="reset" |
| | | :deleteSim="deleteSim" |
| | | /> --> |
| | | @closeBtn="handleBackFromParent" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <div class="left" v-show="showAddIns"> |
| | |
| | | } |
| | | const schemeCardRef = ref(null); |
| | | |
| | | function deleteSelectedScheme() { |
| | | const selectedId = schemeCardRef.value.getSelectedId(); |
| | | const selectedScheme = simStore.schemCard.find( |
| | | (item) => item.id === selectedId |
| | | ); |
| | | if (!selectedId) { |
| | | ElMessage.warning("请先选择一个方案!"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | `确定要删除 "${selectedScheme.name}" 方案吗?`, |
| | | "删除确认", |
| | | { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | } |
| | | ) |
| | | .then(() => { |
| | | simStore.removeSchemCardItem(selectedId); |
| | | ElMessage.success(`方案 "${selectedScheme.name}" 删除成功!`); |
| | | }) |
| | | .catch(() => { }); |
| | | } |
| | | // function deleteSelectedScheme() { |
| | | // const selectedId = schemeCardRef.value.getSelectedId(); |
| | | // const selectedScheme = simStore.schemCard.find( |
| | | // (item) => item.id === selectedId |
| | | // ); |
| | | // if (!selectedId) { |
| | | // ElMessage.warning("请先选择一个方案!"); |
| | | // return; |
| | | // } |
| | | // ElMessageBox.confirm( |
| | | // `确定要删除 "${selectedScheme.name}" 方案吗?`, |
| | | // "删除确认", |
| | | // { |
| | | // confirmButtonText: "确定", |
| | | // cancelButtonText: "取消", |
| | | // type: "warning", |
| | | // } |
| | | // ) |
| | | // .then(() => { |
| | | // simStore.removeSchemCardItem(selectedId); |
| | | // ElMessage.success(`方案 "${selectedScheme.name}" 删除成功!`); |
| | | // }) |
| | | // .catch(() => { }); |
| | | // } |
| | | |
| | | function start(form) { |
| | | emits("start", form); |
| | |
| | | }); |
| | | |
| | | ///////////////////////////删除仿真方案/////////////////////////// |
| | | // const deleteSim = ref(false); |
| | | const deleteSim = ref(false); |
| | | |
| | | // function reset() { |
| | | // deleteSim.value = false; // 重置标志位 |
| | | // } |
| | | // function deleteSelectedScheme() { |
| | | // deleteSim.value = true; |
| | | // } |
| | | function reset() { |
| | | deleteSim.value = false; // 重置标志位 |
| | | } |
| | | function deleteSelectedScheme() { |
| | | deleteSim.value = true; |
| | | } |
| | | ///////////////////////////删除仿真方案/////////////////////////// |
| | | </script> |
| | | <style lang="less" scoped> |
| | |
| | | '/api': { |
| | | target: 'http://192.168.56.107:8078', |
| | | changeOrigin: true, |
| | | pathRewrite: { |
| | | '^/api': '' |
| | | }, |
| | | // pathRewrite: { |
| | | // '^/api': '' |
| | | // }, |
| | | secure: false |
| | | }, |
| | | '/hp': { |