From bf0eb543e2deab8a1629dd2a46f8e1cd191531e1 Mon Sep 17 00:00:00 2001
From: wangjuncheng <1>
Date: 星期四, 17 七月 2025 15:22:01 +0800
Subject: [PATCH] Merge branch 'master' of http://103.135.160.14:9034/r/NslWeb

---
 src/views/mnfz.vue |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/views/mnfz.vue b/src/views/mnfz.vue
index b015a4a..6a243ed 100644
--- a/src/views/mnfz.vue
+++ b/src/views/mnfz.vue
@@ -142,28 +142,55 @@
   });
   dataSources.length = 0;
 }
+
 // 閬块櫓鍦烘墍锛岀豢鑹插瘜鏂囨湰
 async function addTetrahedron(visible) {
   const emergencyAreaList = [];
 
   try {
-    const res = await getSafePoint();
+    let codesToFetch = [];
 
-    const geoJsonData = convertToGeoJson(res.data);
+    // 鍒ゆ柇褰撳墠閫夋嫨鍖哄煙鏄惁涓衡�滃尯鈥�
+    if (simStore.selectedScheme.areaName.includes("鍖�")) {
+      // 浠� simStore.townCodeAll 涓嬁鍒拌鍖轰笅鐨勬墍鏈変埂闀� code
+      const townList = simStore.townCodeAll[simStore.selectedScheme.areaName];
+
+      // 鍋囪 townList 鏄竴涓暟缁勶紝閲岄潰姣忎釜鍏冪礌鏈� .code 瀛楁
+      if (Array.isArray(townList)) {
+        codesToFetch = townList.map((item) => item.code);
+      } else {
+        console.warn("鏈壘鍒板搴旂殑涔¢晣鍒楄〃");
+        return;
+      }
+    } else {
+      // 涓嶆槸鈥滃尯鈥濓紝灏变娇鐢ㄩ粯璁� code
+      codesToFetch = ["110116110218"];
+    }
+
+    // 骞跺彂璇锋眰鎵�鏈� code 鐨勯伩闄╃偣鏁版嵁
+    const allRes = await Promise.all(
+      codesToFetch.map((code) => getSafePoint(code))
+    );
+
+    // 鍚堝苟缁撴灉锛堝亣璁炬瘡涓� res.data 鏄竴涓暟缁勶級
+    const allSafePoints = allRes.flatMap((res) => res.data);
+
+    // 杞崲涓� GeoJSON锛堝鏋滄瘡涓� data 閮介渶瑕佸崟鐙鐞嗭級
+    const geoJsonData = convertToGeoJson(allSafePoints);
 
     // 鍔犺浇搴曞眰闈㈢墖锛堝杈瑰舰锛�
     const polygonEntities = await loadAreaPolygon(geoJsonData, true);
     emergencyAreaList.push(...polygonEntities);
 
     // 娣诲姞缁胯壊瀵屾枃鏈爣娉�
-    const textPromises = res.data.map(async (item) => {
+    const textPromises = allSafePoints.map(async (item) => {
       const point = earthCtrl.factory.createRichTextPoint(
         "閬块櫓鍦烘墍",
-        [item.lon , item.lat , 540],
+        [item.lon, item.lat, 540],
         {
           distanceDisplayCondition:
             new SmartEarth.Cesium.DistanceDisplayCondition(0, 2000),
-          fontColor: "#fff", 
+          fontColor: "#fff",
           fontSize: 20,
         },
         "0"
@@ -179,6 +206,7 @@
     console.error("鍔犺浇閬块櫓鍦烘墍澶辫触锛�", error);
   }
 }
+
 // 鍒犻櫎閬块櫓鍦烘墍鐨勫瘜鏂囨湰瀹炰綋
 function removeEmergencyPoints() {
   const emergencyAreaList = treeMap.get("閬块櫓鍦烘墍"); // 鑾峰彇瀛樺偍鐨勯伩闄╁満鎵�瀹炰綋鍒楄〃

--
Gitblit v1.9.3