From be9c1145fc79165142fbe29aacb04dd8e34dd23f Mon Sep 17 00:00:00 2001
From: guonan <guonan201020@163.com>
Date: 星期二, 17 六月 2025 17:32:29 +0800
Subject: [PATCH] 避险场所以及完善弹窗详情

---
 src/components/tools/LayerTree.vue |   18 ++
 src/views/GisView.vue              |    6 
 src/components/tools/Detail.vue    |   71 +++++++--
 src/api/hpApi.js                   |   14 +
 src/store/simulation.js            |   11 -
 src/utils/area.js                  |  187 +++++++++++++-------------
 src/constant/dict.js               |    8 +
 src/views/mnfz.vue                 |   99 ++++++-------
 8 files changed, 238 insertions(+), 176 deletions(-)

diff --git a/src/api/hpApi.js b/src/api/hpApi.js
index 6be05d2..f5715b7 100644
--- a/src/api/hpApi.js
+++ b/src/api/hpApi.js
@@ -127,7 +127,6 @@
 
 // 鐩戞祴璁惧鎺ュ彛
 /**
- * 妫�鏌ユ椂闂村垪鏄惁鎸夊崌搴忔帓鍒�
  * @param {string} data - 闆ㄩ噺璁¤澶囩被鍨媔d
  * @param {string} townCode - 涔¢晣code,鍙互鏌ヨ涔¢晣鐩戞祴璁惧淇℃伅
  */
@@ -136,6 +135,8 @@
     filterObject: {
       "dictDeviceType": data,
       "townCode": townCode,
+      "year": 2025
+
       // 鎵�灞為」鐩�
       // "belongObjList": [
       //   "1797461961110261762"
@@ -152,6 +153,7 @@
     filterObject: {
       "divisionDistrict": data,
       // 鎵�灞為」鐩�
+      // 濡傛灉涓嶅姞杩欎釜锛屽垯杩斿洖鐨勫叏鏄己闇囦华锛�1933099069385355265锛�
       "belongObjList": [
         "1797461961110261762"
       ],
@@ -216,4 +218,14 @@
     params
   });
   return response.data;
+}
+
+// 鏌ヨ瀛欒儭娌熼伩闄╁満鎵�
+export async function getSafePoint() {
+  const response = await axios.get("/hp/safeHavenLocation/getDataSelect", {
+    params: {
+      divisionId: "110116110218"
+    }
+  });
+  return response.data;
 }
\ No newline at end of file
diff --git a/src/components/tools/Detail.vue b/src/components/tools/Detail.vue
index ae1f16b..1bbfe60 100644
--- a/src/components/tools/Detail.vue
+++ b/src/components/tools/Detail.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="detail" ref="detailRef">
-    <div class="detail-top">{{ detailTitle }}</div>
+    <div class="detail-top" :title="name">{{ detailTitle }}</div>
     <div class="detail-close" @click="closeMsg"></div>
     <div class="detail-context">
       <div v-for="(item, key) in detailList" :key="key" class="detail-item">
@@ -24,13 +24,13 @@
 
 const detailList = ref([]);
 const detailTitle = ref("璁惧璇︽儏");
+const name = ref("");
 function closeMsg() {
   showDeviceDetail.value = false;
   coloseDialog();
 }
 // 鐩戞祴璁惧鍏蜂綋淇℃伅
 function handlDeviceDetail() {
-  // const name = deviceDetail.value.deviceForShort;
   detailTitle.value = deviceDetail.value.deviceForShort;
   detailList.value = [
     {
@@ -43,17 +43,16 @@
       value: deviceDetail.value.type || "",
     },
     {
-      name: "瀹夎鏃堕棿",
-      value: "2024-01-15 12:55:18" || deviceDetail.value.startTime,
+      name: "鍏宠仈闅愭偅鐐�",
+      value: deviceDetail.value.hdName,
     },
     {
-      name: "鏇存柊鏃堕棿",
-      value: "2025-02-15 8:15:28",
+      name: "缇ら槻鍛�",
+      value: deviceDetail.value.groupTestGroupDefenseUserName,
     },
     {
-      name: "璁惧浣嶇疆",
-      value: deviceDetail.value.deviceForShort || cityData.listData[0],
-      //   value: deviceDetail.value.name.split("瀛欒儭娌�")[0] || cityData.listData[0],
+      name: "缇ら槻鍛樼數璇�",
+      value: deviceDetail.value.groupTestGroupDefenseMobile,
     },
   ];
 }
@@ -62,21 +61,46 @@
   const name = deviceDetail.value.hdName;
   detailTitle.value = name;
   detailList.value = [
+    // {}
     {
-      name: "闅愭偅绫诲瀷",
+      name: "鐏惧绫诲瀷",
       value: deviceDetail.value.disasterType || "娉ョ煶娴�",
     },
     {
-      name: "涓荤绉戦暱",
-      value: "寮犳旦",
+      name: "濞佽儊瀵硅薄",
+      value: deviceDetail.value.threatObj || "灞呮皯鐐�",
     },
     {
-      name: "涓荤闀囬暱",
-      value: deviceDetail.value.supervisorAlcaldeUserName,
+      name: "瑙勬ā绛夌骇",
+      value: deviceDetail.value.disasterGrade || "灏忓瀷",
+    },
+    {
+      name: "闄╂儏绛夌骇",
+      value: deviceDetail.value.riskLevel || "灏忓瀷",
+    },
+    {
+      name: "濞佽儊浜烘暟",
+      value: deviceDetail.value.threatPersonNum || "0",
+    },
+    {
+      name: "濞佽儊鎴锋暟",
+      value: deviceDetail.value.threatHouseNum || "0",
+    },
+    {
+      name: "濞佽儊鎴挎暟",
+      value: deviceDetail.value.threatRoomNum || "0",
+    },
+    {
+      name: "鏄惁娌荤悊",
+      value: deviceDetail.value.isGovern || "鍚�",
     },
     {
       name: "缇ゆ祴缇ら槻",
       value: deviceDetail.value.groupTestGroupDefenseUserName,
+    },
+    {
+      name: "缇ゆ祴缇ら槻",
+      value: deviceDetail.value.groupTestGroupDefenseMobile,
     },
     {
       name: "闅愭偅浣嶇疆",
@@ -91,8 +115,10 @@
 function loadClassNameDetail() {
   if (className.value == "device") {
     handlDeviceDetail();
+    name.value = deviceDetail.value.deviceName;
   } else if (className.value == "district") {
     handleDistrictDetail();
+    name.value = deviceDetail.value.hdName;
   }
 }
 const detailRef = ref(null);
@@ -155,11 +181,18 @@
   left: 1.25rem;
   font-weight: 700;
   font-size: 1.125rem;
-  font-weight: 700;
   color: #fff;
   line-height: 2.5rem;
-  width: 16.875rem;
+  width: 16.875rem; /* 瀹瑰櫒瀹藉害鍥哄畾鎴栭檺鍒� */
   cursor: pointer;
+
+  /* 瓒呭嚭闅愯棌 + 鐪佺暐鍙� */
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+
+  /* 鍙�夛細娣诲姞杩囨浮鍔ㄧ敾 */
+  transition: all 0.3s ease;
 }
 
 .detail-close {
@@ -184,6 +217,8 @@
   top: 3.8rem;
   left: 1.25rem;
   width: 21.875rem;
+  overflow-y: auto;
+  height: 63%;
 }
 
 .detail-item {
@@ -193,9 +228,11 @@
   margin-left: 0.625rem;
 }
 .detail-name {
-  width: 100px;
+  display: inline-block; /* 鍏抽敭 */
+  max-width: 100%; /* 闃叉婧㈠嚭 */
   font-weight: 700;
   color: #94e0c4;
+  white-space: nowrap; /* 鍙�夛細闃叉鏂囧瓧鎹㈣ */
   &::after {
     content: "锛�";
   }
diff --git a/src/components/tools/LayerTree.vue b/src/components/tools/LayerTree.vue
index e29ab66..d209e48 100644
--- a/src/components/tools/LayerTree.vue
+++ b/src/components/tools/LayerTree.vue
@@ -17,10 +17,15 @@
 import { createPoint, removeEntities, addTileset } from "@/utils/map";
 import { deviceDictList, getDictName } from "@/constant/dict.js";
 import { useRoute } from "vue-router";
-import { loadAreaPolygon, clearAreaPolygon } from "@/utils/area";
+import {
+  loadAreaPolygon,
+  convertToGeoJson,
+  clearAreaPolygon,
+} from "@/utils/area";
 import { checkedKeys } from "@/store/index";
 import { getDuanMainData } from "@/api/index.js";
 import { useSimStore } from "@/store/simulation";
+import { getSafePoint } from "@/api/hpApi";
 
 const simStore = useSimStore();
 const route = useRoute();
@@ -319,9 +324,13 @@
  * 娣诲姞閬块櫓鍦烘墍鏁版嵁
  */
 function addTetrahedron() {
-  loadAreaPolygon("/json/emergency_area.geojson", true).then((entities) => {
-    entities.forEach((entity) => (entity.show = false));
-    treeMap.set("閬块櫓鍦烘墍", entities);
+  getSafePoint().then((res) => {
+    const geoJsonData = convertToGeoJson(res.data); // 杞崲涓� GeoJSON
+    // 鍔犺浇 GeoJSON 鏁版嵁鍒板湴鍥�
+    loadAreaPolygon(geoJsonData, true).then((entities) => {
+      entities.forEach((entity) => (entity.show = false));
+      treeMap.set("閬块櫓鍦烘墍", entities);
+    });
   });
 }
 
@@ -350,6 +359,7 @@
     const defaultKeys = [...defaultSelectedKeys.value];
     const checkedKeys =
       {
+        // 椤甸潰榛樿鍕鹃�夋樉绀哄湪姝ゅ
         "/yhgl": [...defaultKeys, "瀛欒儭娌熼殣鎮g偣"],
         "/zhjc": [...defaultKeys, "缁煎悎鐩戞祴璁惧淇℃伅"],
         // "/mnfz": [...defaultKeys, "瀛欒儭娌熸柇闈�"],
diff --git a/src/constant/dict.js b/src/constant/dict.js
index ea8837d..dfc0466 100644
--- a/src/constant/dict.js
+++ b/src/constant/dict.js
@@ -8,6 +8,10 @@
 		value: "1874719366287368194",
 	},
 	{
+		label: "寮洪渿浠�",
+		value: "1933049314953330689",
+	},
+	{
 		label: "闆ㄩ噺璁�1",
 		value: "1437295810",
 	},
@@ -35,6 +39,10 @@
 		label: "澧掓儏",
 		value: "14372958380",
 	},
+	{
+		label: '浣嶇Щ鍊捐鎸姩鍔犻�熷害璁�',
+		value: '1437295831'
+	}
 ]
 
 export function getDictName(dictList, value) {
diff --git a/src/store/simulation.js b/src/store/simulation.js
index 3e85e8c..6bc13bf 100644
--- a/src/store/simulation.js
+++ b/src/store/simulation.js
@@ -2,12 +2,11 @@
 import { defineStore } from 'pinia'
 import { ref } from 'vue'
 export const useSimStore = defineStore('simulation', () => {
-    // 鐩綍鏍戦�変腑
-    const userSelectedLayers = ref([])
+
     // 闅愭偅鐐瑰垪琛�
+    const DangerPoint = ref([])
     const DeviceShowSwitch = ref(false)
     const DangerShowSwitch = ref(false)
-    const DangerPoint = ref([])
     // 鐩戞祴璁惧鍒楄〃
     const devices = ref([])
     const navigationShow = ref(true)
@@ -154,9 +153,7 @@
         }
     }
 
-    const updateSelectedLayers = (keys) => {
-        userSelectedLayers.value = keys;
-    }
+
 
 
 
@@ -188,7 +185,6 @@
         DangerShowSwitch,
         waterLegendData,
         isShowEarth,
-        userSelectedLayers,
         devices,
 
         // 鏂规鐩稿叧鏂规硶
@@ -210,6 +206,5 @@
         startMNFZ,
         startMNPG,
         handleNavClick,
-        updateSelectedLayers
     }
 })
\ No newline at end of file
diff --git a/src/utils/area.js b/src/utils/area.js
index eb44444..c4bcf7c 100644
--- a/src/utils/area.js
+++ b/src/utils/area.js
@@ -1,112 +1,116 @@
 let areaPrimitives = []
 let areaDataSource = []
 
-export function loadAreaPolygon(url, isPolluted = false) {
-	let color = new Cesium.Color(1.0, 0.0, 0.0, 0.1)
+/**
+ * 灏嗛伩闄╁満鎵�鏁版嵁杞负 GeoJSON FeatureCollection
+ */
+export function convertToGeoJson(data, offset = 0.0001) {
+	const features = data.map((item) => {
+		const lon = parseFloat(item.lon);
+		const lat = parseFloat(item.lat);
+
+		// 鏋勯�犱竴涓皬姝f柟褰㈠尯鍩燂紙5绫冲乏鍙筹級
+		const coordinates = [
+			[
+				[lon, lat],
+				[lon + offset, lat],
+				[lon + offset, lat - offset],
+				[lon, lat - offset],
+				[lon, lat],
+			],
+		];
+
+		return {
+			type: "Feature",
+			properties: {
+				id: item.safeHavenId,
+				name: item.safeHavenName,
+				locationInfo: item.locationInfo,
+				area: item.area,
+				safeHavenType: item.safeHavenType,
+				accommodatePersonNum: item.accommodatePersonNum,
+				planResettlementPersonNum: item.planResettlementPersonNum,
+				materialReserve: item.materialReserve,
+				remark: item.remark,
+			},
+			geometry: {
+				type: "MultiPolygon",
+				coordinates: [coordinates],
+			},
+		};
+	});
+
+	return {
+		type: "FeatureCollection",
+		name: "emergency_area",
+		crs: {
+			type: "name",
+			properties: {
+				name: "urn:ogc:def:crs:OGC:1.3:CRS84",
+			},
+		},
+		features,
+	};
+}
+
+
+export function loadAreaPolygon(geoJsonData, isPolluted = false) {
+	let color = new Cesium.Color(1.0, 0.0, 0.0, 0.1);
 	if (isPolluted) {
-		color = Cesium.Color.GREEN
+		color = Cesium.Color.GREEN;
 	}
+
 	// 浣跨敤 GeoJsonDataSource 鍔犺浇 GeoJSON 鏁版嵁
-	const dataSourcePromise = Cesium.GeoJsonDataSource.load(url, {
+	const dataSourcePromise = Cesium.GeoJsonDataSource.load(geoJsonData, {
 		clampToGround: true,
-	})
+	});
 
 	// 鑾峰彇 GeoJSON 涓殑绗竴涓� Polygon feature
 	return dataSourcePromise.then(function (dataSource) {
-		viewer.dataSources.add(dataSource)
-		// console.log("dataSource", dataSource)
-		// 鑾峰彇 GeoJSON 涓殑绗竴涓� Polygon feature
-		areaDataSource.push(dataSource)
+		viewer.dataSources.add(dataSource);
+		areaDataSource.push(dataSource);
 
-		// const polygonEntity = dataSource.entities.values[0]
-		// let areaPrimitive = createAreaPolygon(polygonEntity, color)
-		// areaPrimitives.push(areaPrimitive)
-
-		// return areaPrimitive
-
-		const polygonEntity = dataSource.entities.values
-		// console.log("polygonEntity", polygonEntity)
-		const distanceDisplayCondition = new Cesium.DistanceDisplayCondition(1000, 50000000)
+		const polygonEntity = dataSource.entities.values;
+		const distanceDisplayCondition = new Cesium.DistanceDisplayCondition(1000, 50000000);
 		polygonEntity.forEach(entity => {
-			// console.log("entity", entity)
+			entity.polygon.material = new Cesium.ColorMaterialProperty(color);
 
-			entity.polygon.material = new Cesium.ColorMaterialProperty(
-				// Cesium.Color.LIGHTSTEELBLUE.withAlpha(0.2)
-				color
-				// new Cesium.Color.fromCssColorString("#0f2636b3")
-				// Cesium.Color.fromRandom({
-				// 	alpha: 0.5,
-				// 	minimumAlpha: 0.2,
-				// 	maximumAlpha: 0.9,
-				// })
-			)
+			const properties = entity.properties;
+			const fullname = properties.name.getValue();
 
-			// entity.polygon.distanceDisplayCondition = distanceDisplayCondition
+			const positions = entity.polygon.hierarchy._value.positions;
 
-			const properties = entity.properties
-			const fullname = properties.name.getValue()
-
-			const positions = entity.polygon.hierarchy._value.positions
-
-			// entity.position = positions
 			entity.label = {
-				// 鏂囨湰銆傛敮鎸佹樉寮忔崲琛岀鈥� \ n鈥�
 				text: fullname || "榛樿鏍囩",
-				// 瀛椾綋鏍峰紡锛屼互CSS璇硶鎸囧畾瀛椾綋
 				font: "20pt Source Han Sans CN",
-				// 瀛椾綋棰滆壊
-
 				fillColor: Cesium.Color.WHITE,
-				// 鑳屾櫙棰滆壊
 				backgroundColor: Cesium.Color.BLACK.withAlpha(0.8),
-				// 鏄惁鏄剧ず鑳屾櫙棰滆壊
 				showBackground: false,
-				// 瀛椾綋杈规
 				outline: true,
-				// 瀛椾綋杈规棰滆壊
 				outlineColor: Cesium.Color.WHITE,
-				// 瀛椾綋杈规灏哄
 				outlineWidth: 0,
-				// 搴旂敤浜庡浘鍍忕殑缁熶竴姣斾緥銆傛瘮渚嬪ぇ浜庝細1.0鏀惧ぇ鏍囩锛岃�屾瘮渚嬪皬浜庝細1.0缂╁皬鏍囩銆�
 				scale: 1.0,
 				scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1.0, 1.5e7, 0.5),
-				// 璁剧疆鏍峰紡锛欶ILL锛氬~鍐欐爣绛剧殑鏂囨湰锛屼絾涓嶈鍕惧嫆杞粨锛汷UTLINE锛氭杩版爣绛剧殑鏂囨湰锛屼絾涓嶈濉啓锛汧ILL_AND_OUTLINE锛氬~鍐欏苟姒傝堪鏍囩鏂囨湰銆�
 				style: Cesium.LabelStyle.FILL_AND_OUTLINE,
-				// 鐩稿浜庡潗鏍囩殑姘村钩浣嶇疆
 				verticalOrigin: Cesium.VerticalOrigin.CENTER,
-				// 鐩稿浜庡潗鏍囩殑姘村钩浣嶇疆
 				horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
-				// 璇ュ睘鎬ф寚瀹氭爣绛惧湪灞忓箷绌洪棿涓窛姝ゆ爣绛惧師鐐圭殑鍍忕礌鍋忕Щ閲�
 				pixelOffset: new Cesium.Cartesian2(0, 0),
-				// pixelOffset: new Cesium.Cartesian2(0, 0),
-				// 鏄剧ず鍦ㄨ窛鐩告満鐨勮窛绂诲鐨勫睘鎬э紝澶氬皯鍖洪棿鍐呮槸鍙互鏄剧ず鐨�
-				// distanceDisplayCondition: distanceDisplayCondition,
-				// : new Cesium.DistanceDisplayCondition(0, 50000),
 				heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
 				disableDepthTestDistance: Number.POSITIVE_INFINITY,
-				// 鏄惁鏄剧ず
 				show: true,
-			}
+			};
 			entity.polyline = {
 				positions: positions,
 				width: 2,
-				material: new Cesium.ColorMaterialProperty(
-					Cesium.Color.YELLOW
-					// Cesium.Color.fromRandom({
-					// 	alpha: 0.5,
-					// 	minimumAlpha: 0.2,
-					// 	maximumAlpha: 0.9,
-					// })
-				),
+				material: new Cesium.ColorMaterialProperty(Cesium.Color.YELLOW),
 				clampToGround: true,
-				// distanceDisplayCondition: distanceDisplayCondition,
-			}
+			};
 
-			viewer.entities.add(entity)
-		})
+			viewer.entities.add(entity);
+		});
 
-		return polygonEntity
-	})
+		return polygonEntity;
+	});
 }
 function createAreaPolygon(polygonEntity, color, height) {
 	if (!polygonEntity) return
@@ -140,29 +144,29 @@
 }
 
 export function clearAreaPolygon() {
-    // 1. 娓呴櫎閫氳繃 viewer.entities 娣诲姞鐨勫疄浣�
-    if (Array.isArray(areaDataSource)) {
-        areaDataSource.forEach(dataSource => {
-            // 绉婚櫎鏁版嵁婧愪腑鐨勬墍鏈夊疄浣�
-            dataSource.entities.values.forEach(entity => {
-                viewer.entities.remove(entity);
-            });
-            // 绉婚櫎鏁版嵁婧愭湰韬�
-            viewer.dataSources.remove(dataSource);
-        });
-        areaDataSource = [];
-    }
+	// 1. 娓呴櫎閫氳繃 viewer.entities 娣诲姞鐨勫疄浣�
+	if (Array.isArray(areaDataSource)) {
+		areaDataSource.forEach(dataSource => {
+			// 绉婚櫎鏁版嵁婧愪腑鐨勬墍鏈夊疄浣�
+			dataSource.entities.values.forEach(entity => {
+				viewer.entities.remove(entity);
+			});
+			// 绉婚櫎鏁版嵁婧愭湰韬�
+			viewer.dataSources.remove(dataSource);
+		});
+		areaDataSource = [];
+	}
 
-    // 2. 娓呴櫎閫氳繃 viewer.scene.primitives 娣诲姞鐨勫浘鍏�
-    if (Array.isArray(areaPrimitives)) {
-        areaPrimitives.forEach(primitive => {
-            viewer.scene.primitives.remove(primitive);
-        });
-        areaPrimitives = [];
-    }
+	// 2. 娓呴櫎閫氳繃 viewer.scene.primitives 娣诲姞鐨勫浘鍏�
+	if (Array.isArray(areaPrimitives)) {
+		areaPrimitives.forEach(primitive => {
+			viewer.scene.primitives.remove(primitive);
+		});
+		areaPrimitives = [];
+	}
 
-    // 3. 寮哄埗鍦烘櫙閲嶇粯
-    viewer.scene.requestRender();
+	// 3. 寮哄埗鍦烘櫙閲嶇粯
+	viewer.scene.requestRender();
 }
 
 export function initAreaLine() {
@@ -236,3 +240,4 @@
 	})
 	viewer.dataSources.add(dataSourcePromise)
 }
+
diff --git a/src/views/GisView.vue b/src/views/GisView.vue
index 6abc398..e1b6921 100644
--- a/src/views/GisView.vue
+++ b/src/views/GisView.vue
@@ -564,7 +564,7 @@
           point.name = point.hdName; // 闅愭偅鐐瑰悕绉�
           point.className = "district";
         } else if (route.path === "/zhjc") {
-          point.name = point.deviceForShort; // 璁惧绠�绉�
+          point.name = point.deviceName; // 璁惧绠�绉�
           point.className = "device";
         }
 
@@ -703,8 +703,8 @@
   addCityPolygon();
   initHandler();
   // initView()
-  loadAreaPolygon("/json/nsl_area.geojson");
-  loadAreaPolygonAll("/json/geometry.json", true);
+  // loadAreaPolygon("/json/nsl_area.geojson");
+  // loadAreaPolygonAll("/json/geometry.json", true);
   flyToHomeView();
   // 椤甸潰鍔犺浇鏃跺垵濮嬪寲
   initAllDistrictCounts();
diff --git a/src/views/mnfz.vue b/src/views/mnfz.vue
index f1ec1b4..5274d50 100644
--- a/src/views/mnfz.vue
+++ b/src/views/mnfz.vue
@@ -34,7 +34,11 @@
 import DebuffTable from "@/components/tools/DebuffTable.vue";
 import { getMaxInfluenceArea } from "@/api/index";
 import { createPoint, geomToGeoJSON } from "@/utils/map.js";
-import { loadAreaPolygon, clearAreaPolygon } from "@/utils/area";
+import {
+  loadAreaPolygon,
+  clearAreaPolygon,
+  convertToGeoJson,
+} from "@/utils/area";
 
 import colors from "@/assets/img/left/colors3.png";
 
@@ -43,6 +47,7 @@
 
 import { useSimStore } from "@/store/simulation";
 import { storeToRefs } from "pinia";
+import { getSafePoint } from "@/api/hpApi";
 const simStore = useSimStore();
 const { rightRiverShow } = storeToRefs(simStore);
 
@@ -139,51 +144,41 @@
   dataSources.length = 0;
 }
 // 閬块櫓鍦烘墍锛岀豢鑹插瘜鏂囨湰
-function addTetrahedron(visible) {
+async function addTetrahedron(visible) {
   const emergencyAreaList = [];
-  //  杩欓噷鏄坊鍔犻伩闄╁満鎵�搴曞眰闈㈢墖
-  loadAreaPolygon("/json/emergency_area.geojson", true).then((entities) => {
-    emergencyAreaList.push(...entities);
-  });
-  // console.log('polygon', polygon);
 
-  let list = [
-    {
-      name: "灏瑰缓鍗庡",
-      longitude: 116.593517,
-      latitude: 40.568391,
-      altitude: 528.45,
-    },
-    // {
-    //   name: "鑼冩尟姹熷",
-    //   longitude: 116.591059,
-    //   latitude: 40.574068,
-    //   altitude: 528,
-    // },
-    // {
-    //   name: "鍚庡潯",
-    //   longitude: 116.597975,
-    //   latitude: 40.558199,
-    //   altitude: 528,
-    // },
-  ];
-  // 杩欓噷鏄坊鍔犻伩闄╁満鎵�瀵屾枃鏈珮浜樉绀�
-  list.forEach((item) => {
-    let point = earthCtrl.factory.createRichTextPoint(
-      "閬块櫓鍦烘墍",
-      [item.longitude, item.latitude, item.altitude - 10],
-      {
-        distanceDisplayCondition:
-          new SmartEarth.Cesium.DistanceDisplayCondition(0, 2000),
-        fontColor: "#ffffff",
-        fontSize: 20,
-      },
-      "0"
-    );
-    console.log("point", point);
-    emergencyAreaList.push(point);
-  });
-  treeMap.set("閬块櫓鍦烘墍", emergencyAreaList);
+  try {
+    const res = await getSafePoint();
+
+    const geoJsonData = convertToGeoJson(res.data);
+
+    // 鍔犺浇搴曞眰闈㈢墖锛堝杈瑰舰锛�
+    const polygonEntities = await loadAreaPolygon(geoJsonData, true);
+    emergencyAreaList.push(...polygonEntities);
+
+    // 娣诲姞缁胯壊瀵屾枃鏈爣娉�
+    const textPromises = res.data.map(async (item) => {
+      const point = earthCtrl.factory.createRichTextPoint(
+        "閬块櫓鍦烘墍",
+        [item.lon , item.lat , 540],
+        {
+          distanceDisplayCondition:
+            new SmartEarth.Cesium.DistanceDisplayCondition(0, 2000),
+          fontColor: "#fff", 
+          fontSize: 20,
+        },
+        "0"
+      );
+      emergencyAreaList.push(point);
+    });
+
+    await Promise.all(textPromises);
+
+    // 灏嗙粨鏋滀繚瀛樺埌 treeMap
+    treeMap.set("閬块櫓鍦烘墍", emergencyAreaList);
+  } catch (error) {
+    console.error("鍔犺浇閬块櫓鍦烘墍澶辫触锛�", error);
+  }
 }
 // 鍒犻櫎閬块櫓鍦烘墍鐨勫瘜鏂囨湰瀹炰綋
 function removeEmergencyPoints() {
@@ -542,9 +537,9 @@
 function playbackFinished(val) {
   isFinish.value = val;
 }
-function isColorRender(val){
+function isColorRender(val) {
   // console.log('杩欓噷鎵撳嵃鏄惁鏄剧ず姘翠綅鍥句緥鐨勫�硷細',val);
-  isShowLegend.value = val
+  isShowLegend.value = val;
 }
 // 瀹氫箟鍏ㄥ眬鍙橀噺瀛樺偍褰撳墠姝e湪闂姩鐨勯潰鐗�
 let flashingPolygon = null;
@@ -654,11 +649,11 @@
 <style lang="less" scoped>
 @import url("../assets/css/home.css");
 .legend {
-	// background: url("@/assets/img/right/rightbg.png");
-	color: white;
-	position: fixed;
-	bottom: 6%;
-	right: 20%;
-	z-index: 3333;
+  // background: url("@/assets/img/right/rightbg.png");
+  color: white;
+  position: fixed;
+  bottom: 6%;
+  right: 20%;
+  z-index: 3333;
 }
 </style>

--
Gitblit v1.9.3