From 5caf72a91b204c78cdc91ce116beae5d445dc73d Mon Sep 17 00:00:00 2001 From: wangjuncheng <1> Date: 星期二, 22 四月 2025 16:23:28 +0800 Subject: [PATCH] Merge branch 'master' of http://103.135.160.14:9034/r/NslWeb --- src/store/simulation.js | 47 ---- src/store/simAPI.js | 131 ++++++++++++++ src/views/left/KGSimOption/HistorySimulation.vue | 134 +++++++++++--- src/views/left/Left.vue | 19 + src/views/left/CitySim.vue | 136 ++++----------- src/components/monifangzhen/schemeCard.vue | 35 ++- src/views/left/Simulation.vue | 6 7 files changed, 315 insertions(+), 193 deletions(-) diff --git a/src/components/monifangzhen/schemeCard.vue b/src/components/monifangzhen/schemeCard.vue index 0661f02..7d2b618 100644 --- a/src/components/monifangzhen/schemeCard.vue +++ b/src/components/monifangzhen/schemeCard.vue @@ -345,6 +345,7 @@ /////////////////////// 璋冪敤鎺ュ彛锛堜娇鐢ㄦ椂鎵撳紑锛� /////////////////////// import { getData, getSimData, deleteSimData } from "@/api/trApi.js"; + onMounted(() => { getScheme(); getData({ type:2 }) @@ -358,8 +359,31 @@ const props = defineProps({ deleteSim: Boolean, // 鎺ユ敹鐖剁粍浠朵紶閫掔殑鍑芥暟 + showAddIns: Boolean, }); +// 鑾峰彇浠跨湡鍒楄〃 +const schemeList = ref([]); +async function getScheme() { + try { + const res = await getSimData(); + schemeList.value = res.data; + } catch (error) { + console.error("Error fetching data:", error); + } +} + +// 鏂板缓鏂规瀹屾垚涔嬪悗鏂规鍒楄〃闇�瀹炴椂鍒锋柊 +watch( + () => props.showAddIns, + (newVal) => { + if (newVal == false) { + getScheme(); + } + } +); + +// 鍒犻櫎浠跨湡鍒楄〃 watch( () => props.deleteSim, (newVal) => { @@ -370,17 +394,6 @@ } } ); - -const schemeList = ref([]); - -async function getScheme() { - try { - const res = await getSimData(); - schemeList.value = res.data; - } catch (error) { - console.error("Error fetching data:", error); - } -} const deleteSim = () => { ElMessageBox.confirm("纭畾瑕佸垹闄よ鏂规鍚�?", "鍒犻櫎鏂规", { diff --git a/src/store/simAPI.js b/src/store/simAPI.js new file mode 100644 index 0000000..c009a7d --- /dev/null +++ b/src/store/simAPI.js @@ -0,0 +1,131 @@ +import { defineStore } from 'pinia' +import { ref } from 'vue' +import { ElMessage, ElMessageBox } from 'element-plus' +import { createSimData } from '@/api/trApi'; + +export const SimAPIStore = defineStore('SimAPI', () => { + const selectTab = ref("琛屾斂鍖哄垝浠跨湡") + + const isLoading = ref(false) + + const handleClickTab = (data) => { + selectTab.value = data + } + + // 鑾峰彇鍖哄煙绫诲瀷 + const getAreaType = (tabName) => { + switch (tabName) { + case '琛屾斂鍖哄垝浠跨湡': return 1 + case '閲嶇偣鍖哄煙浠跨湡': return 2 + case '閲嶇偣娌熶豢鐪�': return 3 + default: return 0 + } + } + + // 鑾峰彇闄嶉洦绫诲瀷 + const getRainType = (tabName) => { + switch (tabName) { + case '棰勬祴妯℃嫙': return 1 + case '瀹炴椂妯℃嫙': return 2 + case '鍘嗗彶妯℃嫙': return 3 + default: return 0 + } + } + + // 楠岃瘉琛ㄥ崟 + const validateForm = (forms) => { + if (!forms?.name) { + ElMessage.warning('璇疯緭鍏ユ柟妗堝悕绉�') + return false + } + if (!forms.name) { + ElMessage.warning('璇风‘淇濊〃鍗曞潎宸插~鍐�') + return false + } + return true + } + + // 寮圭獥 + const openSaveDialog = async (forms) => { + if (!validateForm(forms)) return + + try { + await ElMessageBox.confirm('纭畾瑕佷繚瀛樺綋鍓嶆柟妗堝悧?', '鏂板缓鏂规', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + }) + // 鐢ㄦ埛纭鍚庢墽琛屼繚瀛� + await saveScheme(forms) + } catch (error) { + if (error !== 'cancel') { + console.error('淇濆瓨鍑洪敊:', error) + ElMessage.error('淇濆瓨杩囩▼涓嚭鐜伴敊璇�') + } else { + ElMessage.info('宸插彇娑堜繚瀛�') + } + } + } + + const saveScheme = async (forms) => { + if (isLoading.value) { + ElMessage.warning('姝e湪淇濆瓨锛岃绋嶅��...') + return + } + + isLoading.value = true + + try { + const params = { + areaType: getAreaType(selectTab.value), + createTime: Date.now(), + name: forms.name, + type: getRainType(forms.type), + status: 0, + data: forms.data + } + + const response = await createSimData(params) + ElMessage.success('鏂规淇濆瓨鎴愬姛') + return response + } catch (error) { + console.error('淇濆瓨澶辫触:', error) + ElMessage.error('淇濆瓨澶辫触: ' + (error.message || '璇风◢鍚庨噸璇�')) + throw error + } finally { + isLoading.value = false + } + } + + + // // 鏂板缓鏂规 + // const createSimulation = async (forms) => { + // console.log(forms, 'ffffffff') + + // const params = { + // areaType: getAreaType(selectTab), + // createTime: Date.now(), + // name: forms.name, + // // 1涓洪娴嬫ā鎷燂紝2涓哄疄鏃舵ā鎷燂紝3涓哄巻鍙叉ā鎷� + // type: getRainType(forms.type), + // // 0涓哄垱寤轰豢鐪燂紝1涓洪澶勭悊锛�2涓哄垎鏋愪腑锛�10涓哄畬鎴愶紝20涓哄嚭閿� + // status: 0, + // data: forms.data + // } + // console.log(params, 'params') + + // try { + // await createSimData(params) + // } catch (error) { + // console.error('鍒涘缓浠跨湡澶辫触:', error) + // } + // } + return { + // 鐘舵�� + selectTab, + isLoading, + // 鏂规硶 + handleClickTab, + openSaveDialog, + saveScheme, + } +}) \ No newline at end of file diff --git a/src/store/simulation.js b/src/store/simulation.js index 35b8ab9..5007810 100644 --- a/src/store/simulation.js +++ b/src/store/simulation.js @@ -3,7 +3,7 @@ import { ref } from 'vue' import { createSimData } from '@/api/trApi'; -export const useSimStore = defineStore('ui', () => { +export const useSimStore = defineStore('simulation', () => { // 鎵�鏈塙I鐘舵�� const navigationShow = ref(true) const leftShow = ref(false) @@ -25,7 +25,6 @@ const showLayerTree = ref(true) const showDangerAssess = ref(false) const schemCard = ref([]) - const selectTab = ref("琛屾斂鍖哄垝浠跨湡") const backToHome = ref(false) // 鍒濆鍖栨柟娉� @@ -47,42 +46,6 @@ showResultAssess.value = false showDangerAssess.value = false schemCard.value = [] - selectTab.value = "琛屾斂鍖哄垝浠跨湡" - - } - - const handleClickTab = (data) => { - selectTab.value = data - } - - // 鏂板缓鏂规 - const createSimulation = async (forms) => { - const getAreaType = (tabName) => { - switch (tabName) { - case '琛屾斂鍖哄垝浠跨湡': - return 1 - case '閲嶇偣鍖哄煙浠跨湡': - return 2 - case '閲嶇偣娌熶豢鐪�': - return 3 - default: - return 0 // 鑷畾涔� - } - } - const params = { - areaType: getAreaType(selectTab), - createTime: Date.now(), - name: forms.name, - // 1涓洪娴嬫ā鎷燂紝2涓哄疄鏃舵ā鎷燂紝3涓哄巻鍙叉ā鎷� - type: 1, - // 0涓哄垱寤轰豢鐪燂紝1涓洪澶勭悊锛�2涓哄垎鏋愪腑锛�10涓哄畬鎴愶紝20涓哄嚭閿� - status: 0, - } - try { - await createSimData(params) - } catch (error) { - console.error('鍒涘缓浠跨湡澶辫触:', error) - } } // 鏂规鐩稿叧 @@ -172,7 +135,8 @@ showLayerTree, showDangerAssess, schemCard, - selectTab, + // selectTab, + backToHome, handleNavClick, init, startYHGL, @@ -183,9 +147,8 @@ addSchemCard, removeSchemCardItem, updateSchemCardItem, - handleClickTab, - createSimulation, - backToHome, + // handleClickTab, + // createSimulation, setBackToHome } }) \ No newline at end of file diff --git a/src/views/left/CitySim.vue b/src/views/left/CitySim.vue index 5fdc7bf..20eca2a 100644 --- a/src/views/left/CitySim.vue +++ b/src/views/left/CitySim.vue @@ -107,34 +107,6 @@ <el-button type="primary" @click="openSaveDialog">淇濆瓨鏂规</el-button> <el-button type="success" @click="startPlay">寮�濮嬫ā鎷�</el-button> </div> - <!---------------------------- 淇濆瓨鏂规瀵硅瘽妗嗭紙鎺ュ彛鐗堟湰闇�鍒犻櫎锛� --------------------------------> - <!-- <el-dialog - v-model="saveDialogVisible" - :title="dialogTitle" - width="50%" - :before-close="handleClose" - custom-class="custom-dialog" - > - <div class="dialog-content"> - <p><strong>妯℃嫙绫诲瀷锛�</strong>{{ dialogTitle }}</p> - <p v-if="disForm === '琛屾斂鍖哄垝浠跨湡'"> - <strong>琛屾斂鍖哄煙锛�</strong>{{ forms.eare }} - </p> - <p v-if="disForm === '閲嶇偣鍖哄煙浠跨湡'"> - <strong>閲嶇偣鍖哄煙锛�</strong>{{ forms.eares }} - </p> - <p><strong>闄嶉洦閲忥細</strong>{{ forms.rainfall }} mm</p> - <p><strong>闄嶉洦鏃堕暱锛�</strong>{{ forms.duration }} h</p> - <p><strong>闄嶉洦寮哄害锛�</strong>{{ forms.intensity }} mm/h</p> - <p><strong>涓婁紶鏂囦欢锛�</strong>{{ uploadedFilesText }}</p> - </div> - <template #footer> - <span class="dialog-footer"> - <el-button @click="saveDialogVisible = false">鍙栨秷</el-button> - <el-button type="primary" @click="confirmSave">纭畾淇濆瓨</el-button> - </span> - </template> - </el-dialog> --> </div> </div> </template> @@ -145,13 +117,12 @@ import Papa from "papaparse"; import { ElMessage, ElMessageBox } from "element-plus"; import { initeWaterPrimitiveView } from "@/utils/water"; -import { useSimStore } from "@/store/simulation"; +import { SimAPIStore } from "@/store/simAPI"; -const simStore = useSimStore(); +const simStore = SimAPIStore(); // 娉ㄥ叆鐖剁粍浠舵彁渚涚殑鏂规硶 const { startSimulate, endSimulate } = inject("simulateActions"); -const saveDialogVisible = ref(false); // 鎺у埗淇濆瓨鏂规瀵硅瘽妗嗙殑鏄剧ず鐘舵�侊紙鎺ュ彛鐗堟湰鍒犻櫎锛� // 琛ㄥ崟鏁版嵁 const forms = reactive({ name: "", @@ -203,8 +174,13 @@ return forms.fileList.map((file) => file.name).join(", ") || "鏃�"; }); -////////////////////////////////////// 鎺ュ彛鐗堟湰闇�鍒犻櫎////////////////////////////////////// -// // 鎵撳紑淇濆瓨鏂规瀵硅瘽妗� +//////////////////////////////////鎺ュ彛鐗堟湰鍚敤////////////////////////////////// +const openSaveDialog = async () => { + await simStore.openSaveDialog(forms); +}; + +// const isLoading = ref(false); +// // 淇濆瓨鏂规 // const openSaveDialog = () => { // if ( // !forms.rainfall || @@ -216,73 +192,36 @@ // ElMessage.warning("璇峰厛濉啓鎵�鏈夊繀濉」"); // return; // } -// saveDialogVisible.value = true; -// } -// const handleClose = () => { -// saveDialogVisible.value = false; +// ElMessageBox.confirm("纭畾瑕佷繚瀛樺綋鍓嶆柟妗堝悧?", dialogTitle.value, { +// confirmButtonText: "纭畾", +// cancelButtonText: "鍙栨秷", +// type: "warning", +// }) +// .then(confirmSave) +// .catch(() => { +// ElMessage({ +// type: "info", +// message: "宸插彇娑堜繚瀛�", +// }); +// }); // }; - -// // 纭淇濆瓨 -// 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 confirmSave = async () => { +// if (isLoading.value) { +// ElMessage.warning("姝e湪淇濆瓨锛岃绋嶅��..."); +// 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 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("姝e湪淇濆瓨锛岃绋嶅��..."); - 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; // 缁撴潫鍔犺浇鐘舵�� - } -}; //////////////////////////////////鎺ュ彛鐗堟湰鍚敤////////////////////////////////// // 閲嶇疆琛ㄥ崟 @@ -410,7 +349,6 @@ } return true; }; - // 寮�濮嬫ā鎷� function startPlay() { diff --git a/src/views/left/KGSimOption/HistorySimulation.vue b/src/views/left/KGSimOption/HistorySimulation.vue index ebde892..03a6708 100644 --- a/src/views/left/KGSimOption/HistorySimulation.vue +++ b/src/views/left/KGSimOption/HistorySimulation.vue @@ -10,30 +10,54 @@ <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="schemeName" type="text" placeholder="璇疯緭鍏�"></el-input> + <el-input + v-model="schemeName" + type="text" + placeholder="璇疯緭鍏�" + ></el-input> </div> <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> @@ -48,8 +72,13 @@ </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>{{ schemeName }}</p> <p><strong>鎵�閫夐噸鐐规矡锛�</strong>{{ props.selectedArea }}</p> @@ -71,10 +100,11 @@ <script setup> import { ref, computed, inject } from "vue"; -import { ElMessage } from "element-plus"; +import { ElMessage, ElMessageBox } from "element-plus"; import { initeWaterPrimitiveView } from "@/utils/water"; import { useSimStore } from "@/store/simulation.js"; // 寮曞叆 Store -import { getRainfallData } from "@/api/hpApi.js" +import { getRainfallData } from "@/api/hpApi.js"; + // 鑾峰彇 Store 瀹炰緥 const simStore = useSimStore(); // 娴嬭瘯鑾峰彇闆ㄩ噺鏁版嵁 @@ -99,7 +129,7 @@ // 鏁版嵁缁戝畾 const rainfallHistory = ref("2"); // 榛樿閫変腑绗簩椤� const totalRainfall = ref(50); // 闄嶉洦鎬婚噺 -const schemeName = ref('鏂规鍚嶇О'); // 鏂规鍚嶇О +const schemeName = ref("鏂规鍚嶇О"); // 鏂规鍚嶇О const rainfallIntensity = ref(70); // 闄嶉洦寮哄害 const rainfallDuration = ref(5); // 闄嶉洦鏃堕暱 const isCollapsed = ref(false); // 鎺у埗璇︽儏鐨勫睍寮�/鏀惰捣鐘舵�� @@ -140,7 +170,47 @@ ElMessage.warning("璇峰厛濉啓鎵�鏈夊繀濉」"); return; } - saveDialogVisible.value = true; + ElMessageBox.confirm("纭畾瑕佷繚瀛樺綋鍓嶆柟妗堝悧?", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(confirmSave) + .catch(() => { + ElMessage({ + type: "info", + message: "宸插彇娑堜繚瀛�", + }); + }); + // saveDialogVisible.value = true; +}; +const params = { + name: schemeName.value, + type: "鍘嗗彶妯℃嫙", + data: { + rainFall: totalRainfall.value, + rainfallIntensity: rainfallIntensity.value, + rainfallDuration: rainfallDuration.value, + rainfallHistory: rainfallHistory.value, + }, +}; +const isLoading = ref(false); +const confirmSave = async () => { + if (isLoading.value) { + ElMessage.warning("姝e湪淇濆瓨锛岃绋嶅��..."); + return; // 闃叉閲嶅鎻愪氦 + } + isLoading.value = true; // 寮�濮嬪姞杞界姸鎬� + try { + await simStore.createSimulation(params); // 璋冪敤 Store 涓殑淇濆瓨鏂规硶 + ElMessage.success("淇濆瓨鎴愬姛"); + saveDialogVisible.value = true; // 鏄剧ず淇濆瓨瀵硅瘽妗嗭紙濡傛灉闇�瑕侊級 + } catch (error) { + console.error("淇濆瓨澶辫触:", error); + ElMessage.error("淇濆瓨澶辫触锛岃绋嶅悗閲嶈瘯"); + } finally { + isLoading.value = false; // 缁撴潫鍔犺浇鐘舵�� + } }; // 鍏抽棴淇濆瓨鏂规瀵硅瘽妗� @@ -148,26 +218,26 @@ saveDialogVisible.value = false; }; -// 纭淇濆瓨 -const confirmSave = () => { - // 鏋勯�犳柊鐨勬柟妗堝璞� - const newScheme = { - id: Date.now().toString(), // 鍞竴 ID - area: props.selectedArea, // 鍖哄煙 - name: selectedRainfallName.value, // 鏂规鍚嶇О - createTime: new Date().toISOString(), // 鍒涘缓鏃堕棿 - taskStatus: 1, // 鍒濆鐘舵�佷负鏈紑濮� - totalRainfall: totalRainfall.value, // 闄嶉洦鎬婚噺 - schemeName: schemeName.value, // 闄嶉洦鎬婚噺 - rainfallIntensity: rainfallIntensity.value, // 闄嶉洦寮哄害 - rainfallDuration: rainfallDuration.value, // 闄嶉洦鏃堕暱 - }; +// // 纭淇濆瓨 +// const confirmSave = () => { +// // 鏋勯�犳柊鐨勬柟妗堝璞� +// const newScheme = { +// id: Date.now().toString(), // 鍞竴 ID +// area: props.selectedArea, // 鍖哄煙 +// name: selectedRainfallName.value, // 鏂规鍚嶇О +// createTime: new Date().toISOString(), // 鍒涘缓鏃堕棿 +// taskStatus: 1, // 鍒濆鐘舵�佷负鏈紑濮� +// totalRainfall: totalRainfall.value, // 闄嶉洦鎬婚噺 +// schemeName: schemeName.value, // 闄嶉洦鎬婚噺 +// rainfallIntensity: rainfallIntensity.value, // 闄嶉洦寮哄害 +// rainfallDuration: rainfallDuration.value, // 闄嶉洦鏃堕暱 +// }; - simStore.addSchemCard(newScheme); - ElMessage.success("鏂规宸蹭繚瀛�"); - // 鍏抽棴瀵硅瘽妗� - saveDialogVisible.value = false; -}; +// simStore.addSchemCard(newScheme); +// ElMessage.success("鏂规宸蹭繚瀛�"); +// // 鍏抽棴瀵硅瘽妗� +// saveDialogVisible.value = false; +// }; // 寮�濮嬫ā鎷� function startPlay() { diff --git a/src/views/left/Left.vue b/src/views/left/Left.vue index 474cacd..94546e9 100644 --- a/src/views/left/Left.vue +++ b/src/views/left/Left.vue @@ -4,14 +4,20 @@ <span>浠跨湡鎺ㄦ紨鏂规</span> </div> <div class="left-content"> - <div style=" + <div + style=" display: flex; justify-content: space-evenly; padding: 8px 8px 8px 0px; " - v-if="btnShow"> - <el-button style="width: 45%;" @click="handleClick">鏂板缓浠跨湡鏂规</el-button> - <el-button style="width: 45%;" @click="deleteSelectedScheme">鍒犻櫎浠跨湡鏂规</el-button> + v-if="btnShow" + > + <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 @@ -20,6 +26,7 @@ @end="end" @reset="reset" :deleteSim="deleteSim" + :showAddIns="showAddIns" @closeBtn="handleBackFromParent" /> </div> @@ -296,8 +303,8 @@ } function handleBackFromParent(value) { if (value === false) { - btnShow.value = false - } else btnShow.value = true + btnShow.value = false; + } else btnShow.value = true; } function initDevicePoint() { list.forEach((item) => { diff --git a/src/views/left/Simulation.vue b/src/views/left/Simulation.vue index 3c459ff..4a1d764 100644 --- a/src/views/left/Simulation.vue +++ b/src/views/left/Simulation.vue @@ -29,9 +29,9 @@ import citySim from "./CitySim.vue"; import kgSim from "./KGSim.vue"; -import { useSimStore } from "@/store/simulation"; +import { SimAPIStore } from "@/store/simAPI"; -const simStore = useSimStore(); +const simStore = SimAPIStore(); // 瀹氫箟杩斿洖浜嬩欢 const emits = defineEmits(["back"]); @@ -44,7 +44,7 @@ // 鏍囩鐐瑰嚮浜嬩欢 const handleClick = (tab) => { - simStore.handleClickTab(tab.props.label); + SimAPIStore.handleClickTab(tab.props.label); }; // 杩斿洖涓婁竴绾� -- Gitblit v1.9.3