From 1dcbd4839f8397f39ea0e300b3425a29627ed466 Mon Sep 17 00:00:00 2001
From: wangjuncheng <1>
Date: 星期三, 23 四月 2025 10:30:26 +0800
Subject: [PATCH] change

---
 src/views/left/KGSim.vue                         |   54 ++++++++++++++------------
 vue.config.js                                    |    2 
 src/views/left/KGSimOption/HistorySimulation.vue |   18 ++++++++
 3 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/src/views/left/KGSim.vue b/src/views/left/KGSim.vue
index ad3b659..a9680ce 100644
--- a/src/views/left/KGSim.vue
+++ b/src/views/left/KGSim.vue
@@ -10,6 +10,7 @@
         popper-class="mySelectStyle"
         filterable
         :filter-method="filterOptions"
+        @change="handleSelectChange"
       >
         <el-option
           v-for="item in filteredOptions"
@@ -48,25 +49,36 @@
 </template>
 
 <script setup>
-import { ref, computed } from "vue";
+import { ref, computed, onMounted, reactive } from "vue";
 import HistorySimulation from "./KGSimOption/HistorySimulation.vue";
 import PredictiveSimulation from "./KGSimOption/PredictiveSimulation.vue";
 import RealTimeSimulation from "./KGSimOption/RealTimeSimulation.vue";
+import { getRegionData } from "@/api/trApi";
 
 const selectedSimulation = ref("鍘嗗彶妯℃嫙");
-const selectedArea = ref("瀛欒儭娌�");
-const earesOptions = [
-  { value: "瀛欒儭娌�", label: "瀛欒儭娌�" },
-  { value: "楸兼按娲炲悗娌�", label: "楸兼按娲炲悗娌�" },
-  { value: "浜庡瑗挎矡", label: "浜庡瑗挎矡" },
-  { value: "鍖楁渤娌�", label: "鍖楁渤娌�" },
-  { value: "榫欐硥宄潙", label: "榫欐硥宄潙" },
-];
+const selectedArea = ref(); // 閫変腑鐨勫尯鍩�
+// 閲嶇偣娌熸暟鎹�
+const importGOptions = reactive([]);
+
+onMounted(() => {
+  // 鑾峰彇閲嶇偣娌熸暟鎹�
+  getRegionData({ type: 3 }).then((res) => {
+    importGOptions.splice(
+      0,
+      importGOptions.length,
+      ...res.data.map((item) => ({
+        id:item.id,
+        value: item.geom,
+        label: item.name
+      }))
+    );
+  });
+});
 
 // 鍔ㄦ�佽繃婊ら�夐」
 const searchQuery = ref("");
 const filteredOptions = computed(() => {
-  return earesOptions.filter((option) =>
+  return importGOptions.filter((option) =>
     option.label.toLowerCase().includes(searchQuery.value.toLowerCase())
   );
 });
@@ -74,6 +86,12 @@
 // 鑷畾涔夎繃婊ゆ柟娉�
 const filterOptions = (query) => {
   searchQuery.value = query;
+};
+
+// 澶勭悊閫夐」閫夋嫨浜嬩欢
+const handleSelectChange = (value) => {
+  console.log("閫変腑鐨勫�硷細", value); // 鎵撳嵃閫変腑鐨勫��
+  console.log("褰撳墠閫変腑鐨勫畬鏁存暟鎹細", importGOptions.find((item) => item.value === value)); // 鎵撳嵃瀹屾暣鐨勯�変腑鏁版嵁
 };
 
 const handleStart = () => {
@@ -84,9 +102,6 @@
   console.log("鍔犺浇鎸夐挳琚偣鍑�");
 };
 </script>
-
-<style scoped>
-</style>
 
 <style scoped>
 .simulation-module {
@@ -129,15 +144,4 @@
 :deep(.el-input__inner) {
   color: #fff; /* 璁╂枃瀛楅鑹茶窡闅忕埗绾� */
 }
-/* .mySelectStyle {
-    .el-select-dropdown__item:hover {
-        color: #009688 !important;
-    }
-    .el-select-dropdown__item {
-      color: #fff !important;
-    }
-    .el-select-dropdown__item.selected {
-        color: #009688 !important;
-    }
-} */
-</style>
+</style>
\ No newline at end of file
diff --git a/src/views/left/KGSimOption/HistorySimulation.vue b/src/views/left/KGSimOption/HistorySimulation.vue
index 03a6708..f19670f 100644
--- a/src/views/left/KGSimOption/HistorySimulation.vue
+++ b/src/views/left/KGSimOption/HistorySimulation.vue
@@ -186,8 +186,10 @@
 };
 const params = {
   name: schemeName.value,
+
   type: "鍘嗗彶妯℃嫙",
   data: {
+    
     rainFall: totalRainfall.value,
     rainfallIntensity: rainfallIntensity.value,
     rainfallDuration: rainfallDuration.value,
@@ -201,10 +203,24 @@
     return; // 闃叉閲嶅鎻愪氦
   }
   isLoading.value = true; // 寮�濮嬪姞杞界姸鎬�
+  console.log("褰撳墠閫変腑鐨勫尯鍩� (selectedArea):", props.selectedArea);
+
+  const params = {
+    name: schemeName.value,
+    type: "鍘嗗彶妯℃嫙",
+    eares: props.selectedArea,
+    data: {
+      rainFall: totalRainfall.value,
+      rainfallIntensity: rainfallIntensity.value,
+      rainfallDuration: rainfallDuration.value,
+      rainfallHistory: rainfallHistory.value,
+    },
+  };
+
   try {
     await simStore.createSimulation(params); // 璋冪敤 Store 涓殑淇濆瓨鏂规硶
     ElMessage.success("淇濆瓨鎴愬姛");
-    saveDialogVisible.value = true; // 鏄剧ず淇濆瓨瀵硅瘽妗嗭紙濡傛灉闇�瑕侊級
+    saveDialogVisible.value = false; // 鍏抽棴淇濆瓨瀵硅瘽妗�
   } catch (error) {
     console.error("淇濆瓨澶辫触:", error);
     ElMessage.error("淇濆瓨澶辫触锛岃绋嶅悗閲嶈瘯");
diff --git a/vue.config.js b/vue.config.js
index eb25a59..45ca340 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -21,7 +21,7 @@
     hot: true,
     proxy: {
       '/api': {
-        target: 'http://192.168.56.107:8078',
+        target: 'http://192.168.56.107:8077',
         changeOrigin: true,
         // pathRewrite: {
         //   '^/api': ''

--
Gitblit v1.9.3