From 8d7fca46fd7f1bf85dbe9fa6fcfd287f45ad1b71 Mon Sep 17 00:00:00 2001
From: guonan <guonan201020@163.com>
Date: 星期二, 22 四月 2025 16:45:03 +0800
Subject: [PATCH] tab报错

---
 src/views/left/CitySim.vue |   92 +++++++++++-----------------------------------
 1 files changed, 22 insertions(+), 70 deletions(-)

diff --git a/src/views/left/CitySim.vue b/src/views/left/CitySim.vue
index 20eca2a..7565ca9 100644
--- a/src/views/left/CitySim.vue
+++ b/src/views/left/CitySim.vue
@@ -104,7 +104,7 @@
         <!-- <el-form-item label="浠跨湡鍙傛暟:"></el-form-item> -->
       </el-form>
       <div style="display: flex; justify-content: flex-end">
-        <el-button type="primary" @click="openSaveDialog">淇濆瓨鏂规</el-button>
+        <el-button type="primary" @click="addSimCheme">淇濆瓨鏂规</el-button>
         <el-button type="success" @click="startPlay">寮�濮嬫ā鎷�</el-button>
       </div>
     </div>
@@ -112,12 +112,30 @@
 </template>
 
 <script setup>
-import { reactive, ref, watch, inject, computed } from "vue";
+import { reactive, ref, watch, inject, computed, onMounted } from "vue";
 import * as XLSX from "xlsx";
 import Papa from "papaparse";
 import { ElMessage, ElMessageBox } from "element-plus";
 import { initeWaterPrimitiveView } from "@/utils/water";
 import { SimAPIStore } from "@/store/simAPI";
+import { getRegionData } from "@/api/trApi";
+
+const cityOptions = reactive([]);
+
+onMounted(() => {
+  getRegionData({ type: 1 }).then((res) => {
+    console.log(res, "res");
+    // 浣跨敤鍝嶅簲寮忔暟缁勭殑鏂规硶鏇存柊鍐呭
+    cityOptions.splice(
+      0,
+      cityOptions.length,
+      ...res.data.map((item) => ({
+        value: item.geom,
+        label: item.name,
+      }))
+    );
+  });
+});
 
 const simStore = SimAPIStore();
 
@@ -134,26 +152,6 @@
   fileList: [],
 });
 
-// 鍩庡競鍜岄噸鐐瑰尯鍩熼�夐」
-const cityOptions = [
-  { value: "鍖椾含甯�", label: "鍖椾含甯�" },
-  { value: "涓滃煄鍖�", label: "涓滃煄鍖�" },
-  { value: "瑗垮煄鍖�", label: "瑗垮煄鍖�" },
-  { value: "鏈濋槼鍖�", label: "鏈濋槼鍖�" },
-  { value: "娴锋穩鍖�", label: "娴锋穩鍖�" },
-  { value: "涓板彴鍖�", label: "涓板彴鍖�" },
-  { value: "鐭虫櫙灞卞尯", label: "鐭虫櫙灞卞尯" },
-  { value: "闂ㄥご娌熷尯", label: "闂ㄥご娌熷尯" },
-  { value: "鎴垮北鍖�", label: "鎴垮北鍖�" },
-  { value: "閫氬窞鍖�", label: "閫氬窞鍖�" },
-  { value: "椤轰箟鍖�", label: "椤轰箟鍖�" },
-  { value: "鏄屽钩鍖�", label: "鏄屽钩鍖�" },
-  { value: "澶у叴鍖�", label: "澶у叴鍖�" },
-  { value: "鎬�鏌斿尯", label: "鎬�鏌斿尯" },
-  { value: "骞宠胺鍖�", label: "骞宠胺鍖�" },
-  { value: "瀵嗕簯鍖�", label: "瀵嗕簯鍖�" },
-  { value: "寤跺簡鍖�", label: "寤跺簡鍖�" },
-];
 const earesOptions = [
   { value: "瀛欒儭娌�", label: "瀛欒儭娌�" },
   { value: "楸兼按娲炲悗娌�", label: "楸兼按娲炲悗娌�" },
@@ -174,55 +172,9 @@
   return forms.fileList.map((file) => file.name).join(", ") || "鏃�";
 });
 
-//////////////////////////////////鎺ュ彛鐗堟湰鍚敤//////////////////////////////////
-const openSaveDialog = async () => {
-  await simStore.openSaveDialog(forms);
+const addSimCheme = async () => {
+  await simStore.addSimCheme(forms);
 };
-
-// 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; // 缁撴潫鍔犺浇鐘舵��
-//   }
-// };
-//////////////////////////////////鎺ュ彛鐗堟湰鍚敤//////////////////////////////////
 
 // 閲嶇疆琛ㄥ崟
 const resetForm = () => {

--
Gitblit v1.9.3