From 79f9b20e2661a560604e78a8e277eb5775747443 Mon Sep 17 00:00:00 2001
From: guonan <guonan201020@163.com>
Date: 星期二, 08 七月 2025 10:25:20 +0800
Subject: [PATCH] 提交

---
 src/components/tools/LayerTree.vue         |   55 +++++++++++++--------------
 src/utils/map.js                           |    1 
 src/api/hpApi.js                           |    2 
 src/api/requestTR.js                       |   18 +-------
 vue.config.js                              |    2 
 src/components/monifangzhen/schemeCard.vue |    2 
 6 files changed, 34 insertions(+), 46 deletions(-)

diff --git a/src/api/hpApi.js b/src/api/hpApi.js
index 06b36b9..2d609df 100644
--- a/src/api/hpApi.js
+++ b/src/api/hpApi.js
@@ -238,7 +238,7 @@
 export async function getSafePoint(data) {
   const response = await axios.get("/hp/safeHavenLocation/getDataSelect", {
     params: {
-      divisionId: data
+      divisionId: 110116110218
     }
   });
   return response.data;
diff --git a/src/api/requestTR.js b/src/api/requestTR.js
index 4076645..c404aac 100644
--- a/src/api/requestTR.js
+++ b/src/api/requestTR.js
@@ -1,25 +1,13 @@
 import axios from "axios";
 
-// 鍒ゆ柇褰撳墠鏄惁鏄紑鍙戠幆澧�
-let API_URL;
-
-if (process.env.NODE_ENV === 'development') {
-  // 寮�鍙戠幆澧冧娇鐢� '/api'
-  API_URL = '/api';
-} else {
-  // 鐢熶骇鐜浣跨敤瀹為檯鐨勯厤缃湴鍧�
-  API_URL = `${BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL}/api`;
-}
-
 // 鍒涘缓 Axios 瀹炰緥
 const instance = axios.create({
-  baseURL: API_URL,
-  // timeout: 1000 * 60, // 璇锋眰瓒呮椂鏃堕棿锛堝崟浣嶏細姣锛�
+  baseURL: "/api", // 浣跨敤浣犻厤缃殑 /auth 浠g悊
+  timeout: 1000 * 60, // 璇锋眰瓒呮椂鏃堕棿锛堝崟浣嶏細姣锛�
   headers: {
-    "Content-Type": "application/x-www-form-urlencoded", // 榛樿璇锋眰澶�
+    "Content-Type": "application/x-www-form-urlencoded", // 榛樿璇锋眰澶碼pplication/json
   },
 });
-
 // 璇锋眰鎷︽埅鍣�
 // instance.interceptors.request.use(
 //   (config) => {
diff --git a/src/components/monifangzhen/schemeCard.vue b/src/components/monifangzhen/schemeCard.vue
index c8c6c6e..a3c6507 100644
--- a/src/components/monifangzhen/schemeCard.vue
+++ b/src/components/monifangzhen/schemeCard.vue
@@ -221,7 +221,7 @@
         item.result == "鍒涘缓浠跨湡" ||
         item.result == "瀹屾垚" ||
         item.result == "-1" ||
-        item.result == "鍋滄" ||
+        item.result == "宸插仠姝�" ||
         item.result == "杩愯涓�"
     );
     simAPIStore.shouldPoll = !shouldStop; // 淇敼 Pinia 鐘舵��
diff --git a/src/components/tools/LayerTree.vue b/src/components/tools/LayerTree.vue
index 425de2b..d2cf58a 100644
--- a/src/components/tools/LayerTree.vue
+++ b/src/components/tools/LayerTree.vue
@@ -14,7 +14,12 @@
 
 <script setup>
 import { ref, onMounted, watch, nextTick, onUnmounted, watchEffect } from "vue";
-import { createPoint, removeEntities, addTileset } from "@/utils/map";
+import {
+  createPoint,
+  removeEntities,
+  addTileset,
+  clearAllPoints,
+} from "@/utils/map";
 import { deviceDictList, getDictName } from "@/constant/dict.js";
 import { useRoute } from "vue-router";
 import {
@@ -76,7 +81,7 @@
   try {
     TerrainLayer = await earthCtrl.factory.createTerrainLayer({
       sourceType: "ctb",
-      url: "http://106.120.22.26:9103/gisserver/ctsserver/sunhugoudem84",
+      url: "http://106.120.22.26:9103/gisserver/ctsserver/sunhugoudem",
       requestVertexNormals: true,
     });
     treeMap.set("鍦板舰鏁版嵁", TerrainLayer);
@@ -238,9 +243,7 @@
   const list = treeMap.get(layerName);
   if (list && Array.isArray(list)) {
     list.forEach((entity) => {
-      if (viewer.entities.contains(entity)) {
-        viewer.entities.remove(entity);
-      }
+      clearAllPoints();
     });
   }
   treeMap.delete(layerName);
@@ -253,17 +256,14 @@
   if (simStore.DeviceShowSwitch) {
     const deviceList = simStore.devices
       .filter((item) => item.deviceName?.includes("瀛欒儭娌�"))
-      .map((item) => {
-        const entity = createPoint({
-          ...item,
-          type: getDictName(deviceDictList, item.dictDeviceType),
-          name: item.deviceName.split("瀛欒儭娌�")[1],
-          id: item.deviceId,
-          className: "device",
-          showLabel: true,
-        });
-        entity.show = true;
-        return entity;
+      .map(async (item) => {
+        const entity = viewer.entities.getById(item.deviceId);
+        item.type = getDictName(deviceDictList, item.dictDeviceType);
+        item.name = item.deviceName.split("瀛欒儭娌�")[1];
+        item.id = item.deviceId;
+        item.className = "device";
+        item.showLabel = true;
+        await createPoint(item);
       });
 
     if (deviceList.length) {
@@ -279,18 +279,16 @@
   if (simStore.DangerShowSwitch) {
     const dangerPoints = simStore.DangerPoint.filter((item) =>
       item.position?.includes("瀛欒儭娌�")
-    ).map((item) => {
-      const entity = createPoint({
-        id: item.hdId,
-        name: item.hdName,
-        latitude: item.lat,
-        longitude: item.lon,
-        showBillboard: true,
-        type: item.disasterType,
-        className: "district",
-      });
-      entity.show = true;
-      return entity;
+    ).map(async (item) => {
+      const entity = viewer.entities.getById(item.hdId);
+      item.id = item.hdId;
+      item.name = item.hdName;
+      item.latitude = item.lat;
+      item.longitude = item.lon;
+      item.showBillboard = true;
+      item.type = item.disasterType;
+      item.className = "district";
+      await createPoint(item);
     });
 
     if (dangerPoints.length) {
@@ -325,6 +323,7 @@
  */
 function addTetrahedron() {
   getSafePoint().then((res) => {
+    console.log(res,'resresresres')
     const geoJsonData = convertToGeoJson(res.data); // 杞崲涓� GeoJSON
     // 鍔犺浇 GeoJSON 鏁版嵁鍒板湴鍥�
     loadAreaPolygon(geoJsonData, true).then((entities) => {
diff --git a/src/utils/map.js b/src/utils/map.js
index b6e37ca..75dc1d0 100644
--- a/src/utils/map.js
+++ b/src/utils/map.js
@@ -196,6 +196,7 @@
 
     if (Cesium.defined(picked) && id) {
       const entity = picked?.id;
+      console.log(entity.attrs, 'attrsattrsattrs')
       if (entity && entity.className) {
         showDeviceDetail.value = true;
         deviceDetail.value = entity.attrs;
diff --git a/vue.config.js b/vue.config.js
index 4987689..2823e4d 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -30,7 +30,7 @@
         secure: false
       },
       '/hp': {
-        target: 'http://192.168.56.106:9522',
+        target: 'http://192.168.56.106:9533',
         changeOrigin: true,
         pathRewrite: {
           '^/hp': ''

--
Gitblit v1.9.3