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 +++++++++++++++++++++++++++++-------------------------
 1 files changed, 29 insertions(+), 25 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

--
Gitblit v1.9.3