From 5fc6e09508182701f31f017453b5c116adf40f7f Mon Sep 17 00:00:00 2001
From: wangjuncheng <1>
Date: 星期四, 17 四月 2025 10:44:30 +0800
Subject: [PATCH] change

---
 src/api/hpApi.js                                 |   65 ++++++++++++++++-----
 src/views/Home.vue                               |   20 ++++--
 src/utils/wktUtils.js                            |   35 ++++++-----
 src/views/left/KGSimOption/HistorySimulation.vue |    2 
 4 files changed, 84 insertions(+), 38 deletions(-)

diff --git a/src/api/hpApi.js b/src/api/hpApi.js
index b2e0f5b..1075faf 100644
--- a/src/api/hpApi.js
+++ b/src/api/hpApi.js
@@ -28,21 +28,54 @@
     });
   }, intervalTime);
 }
+
+// 鑾峰彇闅愭偅鐐规竻鍗�
+export async function getDangerPoint(data) {
+  const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getData", {
+    filterObject: {
+      year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
+    },
+  });
+  console.log("getDangerPoint:", response);
+  return response.data;
+}
+// 鑾峰彇閬块櫓浣嶇疆
+export async function getSafeLocation(data) {
+  const response = await axios.post("/hp/safeHavenLocation/getData", {
+    filterObject: {
+      year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
+    },
+  });
+  console.log("getSafeLocation:", response);
+  return response.data;
+}
+// 鑾峰彇閬块櫓绾胯矾
+export async function getEscapeRoute(data) {
+  const response = await axios.post("/hp/escapeRoute/getData", {
+    filterObject: {
+      year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
+    },
+  });
+  console.log("getEscapeRoute:", response);
+  return response.data;
+}
+// 鑾峰彇浼犳劅鍣ㄥ垪琛�
+export async function getSensor(data) {
+  const response = await axios.post("/hp/sensor/getData", {
+    filterObject: {
+      year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
+    },
+  });
+  console.log("getSensor:", response);
+  return response.data;
+}
 // 鑾峰彇闆ㄩ噺鏁版嵁
-export async function getRainfallData(year) {
-  try {
-    const response = await axios.post("/hp/rainfallCountyCity/getData", {
-      filterObject: {
-        year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
-      },
-    });
-    console.log("Response:", response); // 鎵撳嵃瀹屾暣鍝嶅簲锛堣皟璇曠敤锛�
-    return response.data; // 鍋囪鍚庣杩斿洖鐨勬暟鎹湪 response.data 涓�
-  } catch (error) {
-    console.error(
-      "Error fetching rainfall data:",
-      error.response ? error.response.data : error.message
-    );
-    throw error; // 鎶涘嚭閿欒浠ヤ究璋冪敤鏂瑰鐞�
-  }
+export async function getRainfallData(data) {
+  const response = await axios.post("/hp/rainfallCountyCity/getData", {
+    filterObject: {
+      year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
+    },
+  });
+  console.log("getRainfallData:", response);
+  return response.data;
 }
diff --git a/src/utils/wktUtils.js b/src/utils/wktUtils.js
index e1c19b7..55cc6be 100644
--- a/src/utils/wktUtils.js
+++ b/src/utils/wktUtils.js
@@ -1,26 +1,31 @@
 /**
- * 灏嗘櫘閫氱粡绾害鏁扮粍杞崲涓烘爣鍑嗙殑 MULTIPOLYGON WKT 鏍煎紡
- * @param {Array<Array<number>>} coordinates - 缁忕含搴︽暟缁勶紝姣忎釜鍏冪礌鏄竴涓� [缁忓害, 绾害] 鐨勭偣
+ * 灏嗗涓杈瑰舰鐨勭粡绾害鏁扮粍杞崲涓烘爣鍑嗙殑 MULTIPOLYGON WKT 鏍煎紡
+ * @param {Array<Array<Array<number>>>} multiPolygonCoordinates - 澶氫釜澶氳竟褰㈢殑鍧愭爣鏁扮粍
  * @returns {string} 鏍囧噯鍖栫殑 WKT 鏍煎紡瀛楃涓�
  */
-export function convertToWKT(coordinates) {
+export function convertToWKT(multiPolygonCoordinates) {
     // 妫�鏌ヨ緭鍏ユ槸鍚︿负闈炵┖鏁扮粍
-    if (!Array.isArray(coordinates) || coordinates.length === 0) {
-        throw new Error("Invalid input: 'coordinates' must be a non-empty array of [longitude, latitude] points.");
+    if (!Array.isArray(multiPolygonCoordinates) || multiPolygonCoordinates.length === 0) {
+        throw new Error("Invalid input: 'multiPolygonCoordinates' must be a non-empty array of polygons.");
     }
 
-    // 妫�鏌ユ瘡涓偣鏄惁鏄湁鏁堢殑 [缁忓害, 绾害] 鏁扮粍
-    for (const point of coordinates) {
-        if (!Array.isArray(point) || point.length !== 2 || typeof point[0] !== "number" || typeof point[1] !== "number") {
-            throw new Error("Invalid input: Each coordinate must be an array of two numbers [longitude, latitude].");
+    // 杞崲姣忎釜澶氳竟褰㈢殑鍧愭爣
+    const polygons = multiPolygonCoordinates.map(polygon => {
+        if (!Array.isArray(polygon) || polygon.length === 0) {
+            throw new Error("Invalid input: Each polygon must be a non-empty array of [longitude, latitude] points.");
         }
-    }
 
-    // 灏嗙粡绾害鏁扮粍杞崲涓� WKT 鏍煎紡鐨勫潗鏍囧瓧绗︿覆
-    const wktCoordinates = coordinates
-        .map(([longitude, latitude]) => `${longitude} ${latitude}`)
-        .join(",");
+        // 妫�鏌ユ瘡涓偣鏄惁鏄湁鏁堢殑 [缁忓害, 绾害] 鏁扮粍
+        for (const point of polygon) {
+            if (!Array.isArray(point) || point.length !== 2 || typeof point[0] !== "number" || typeof point[1] !== "number") {
+                throw new Error("Invalid input: Each coordinate must be an array of two numbers [longitude, latitude].");
+            }
+        }
+
+        // 灏嗘瘡涓杈瑰舰鐨勫潗鏍囪浆鎹负 WKT 鏍煎紡鐨勫瓧绗︿覆
+        return `((${polygon.map(([lng, lat]) => `${lng} ${lat}`).join(",")}))`;
+    });
 
     // 鏋勫缓鏍囧噯鐨� MULTIPOLYGON WKT 鏍煎紡
-    return `MULTIPOLYGON(((${wktCoordinates})))`;
+    return `MULTIPOLYGON(${polygons.join(",")})`;
 }
\ No newline at end of file
diff --git a/src/views/Home.vue b/src/views/Home.vue
index 95b8455..a250b6b 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -76,11 +76,19 @@
 } = storeToRefs(simStore);
 const { init, startYHGL, startZHJC, startMNFZ, startMNPG } = simStore;
 // 妯℃嫙鐨勭粡绾害鏁扮粍
-const coordinates = [
-  [120.123456, 30.654321],
-  [120.234567, 30.765432],
-  [120.345678, 30.876543],
-  [120.123456, 30.654321]
+const multiPolygonCoordinates = [
+    [
+        [120.123456, 30.654321],
+        [120.234567, 30.765432],
+        [120.345678, 30.876543],
+        [120.123456, 30.654321] // 闂悎鐐�
+    ],
+    [
+        [121.111111, 31.222222],
+        [121.333333, 31.444444],
+        [121.555555, 31.666666],
+        [121.111111, 31.222222] // 闂悎鐐�
+    ]
 ];
 
 
@@ -90,7 +98,7 @@
   setupTokenRefresh()// 鑾峰彇瀹忓浘token
   getData() //娴嬭瘯tr鍚庣
   try {
-    const wktResult = convertToWKT(coordinates);
+    const wktResult = convertToWKT(multiPolygonCoordinates);
     console.log(wktResult);
     // 杈撳嚭: MULTIPOLYGON(((120.123456 30.654321,120.234567 30.765432,120.345678 30.876543,120.123456 30.654321)))
   } catch (error) {
diff --git a/src/views/left/KGSimOption/HistorySimulation.vue b/src/views/left/KGSimOption/HistorySimulation.vue
index 3aa57d0..e5a8141 100644
--- a/src/views/left/KGSimOption/HistorySimulation.vue
+++ b/src/views/left/KGSimOption/HistorySimulation.vue
@@ -233,7 +233,7 @@
 
 /* 鑷畾涔� Dialog 鐨� z-index */
 .custom-dialog {
-  z-index: 3000 !important;
+  z-index: 5000 !important;
   /* 纭繚瀵硅瘽妗嗚鐩栧叾浠栧厓绱� */
 }
 </style>

--
Gitblit v1.9.3