From d06f7ad0231d5fb029ab8520bf442590d3bab20b Mon Sep 17 00:00:00 2001
From: guonan <guonan201020@163.com>
Date: 星期三, 16 七月 2025 15:29:13 +0800
Subject: [PATCH] 完善监测设备弹窗

---
 src/components/tools/Detail.vue |   73 ++++++++++++++++++++++++------------
 src/api/hpApi.js                |   12 +++++
 src/store/simulation.js         |    3 +
 3 files changed, 61 insertions(+), 27 deletions(-)

diff --git a/src/api/hpApi.js b/src/api/hpApi.js
index c085429..9c220ff 100644
--- a/src/api/hpApi.js
+++ b/src/api/hpApi.js
@@ -247,7 +247,7 @@
   return response.data;
 }
 
-// 鏌ヨ瀛欒儭娌熼伩闄╁満鎵�
+// 鏌ヨ鍖椾含甯傞伩闄╁満鎵�
 export async function getSafePoint(data) {
   const response = await axios.get("/hp/safeHavenLocation/getDataSelect", {
     params: {
@@ -286,4 +286,14 @@
     }
   });
   return response.data;
+}
+
+// 鐩戞祴璁惧涓叧鑱旂殑闅愭偅鐐圭殑鍏蜂綋淇℃伅
+export async function hdByDevice(data) {
+  const response = await axios.get("/hp/sinoDzHiddenDangerPoint/getDetail", {
+    params: {
+      unifiedCode: data
+    }
+  });
+  return response.data;
 }
\ No newline at end of file
diff --git a/src/components/tools/Detail.vue b/src/components/tools/Detail.vue
index 245373a..dfa5128 100644
--- a/src/components/tools/Detail.vue
+++ b/src/components/tools/Detail.vue
@@ -22,6 +22,8 @@
   dialogPositon,
 } from "@/store";
 
+import { hdByDevice } from "@/api/hpApi";
+
 const detailList = ref([]);
 const detailTitle = ref("璁惧璇︽儏");
 const name = ref("");
@@ -29,33 +31,54 @@
   showDeviceDetail.value = false;
   coloseDialog();
 }
+
 // 鐩戞祴璁惧鍏蜂綋淇℃伅
-function handlDeviceDetail() {
-  detailTitle.value = deviceDetail.value.deviceForShort;
-  detailList.value = [
-    {
-      name: "璁惧缂栧彿",
-      value:
-        deviceDetail.value.deviceCode || Math.floor(Math.random() * 100000),
-    },
-    {
-      name: "璁惧绫诲瀷",
-      value: deviceDetail.value.type || deviceDetail.value.deviceTypeName,
-    },
-    {
-      name: "鍏宠仈闅愭偅鐐�",
-      value: deviceDetail.value.hdName,
-    },
-    {
-      name: "缇ら槻鍛�",
-      value: deviceDetail.value.groupTestGroupDefenseUserName,
-    },
-    {
-      name: "缇ら槻鍛樼數璇�",
-      value: deviceDetail.value.groupTestGroupDefenseMobile,
-    },
-  ];
+async function handlDeviceDetail() {
+  const hdInfo = ref();
+
+  try {
+    const res = await hdByDevice(deviceDetail.value.hdUnifiedCode);
+    hdInfo.value = res.data;
+
+    detailList.value = [
+      {
+        name: "璁惧缂栧彿",
+        value: deviceDetail.value.deviceCode || Math.floor(Math.random() * 100000),
+      },
+      {
+        name: "璁惧绫诲瀷",
+        value: deviceDetail.value.type || deviceDetail.value.deviceTypeName,
+      },
+      {
+        name: "鍏宠仈闅愭偅鐐�",
+        value: deviceDetail.value.hdName,
+      },
+      {
+        name: "缇ゆ祴缇ら槻鍛�",
+        value: hdInfo.value?.groupTestGroupDefenseUserName || "鏆傛棤淇℃伅",
+      },
+      {
+        name: "缇ゆ祴缇ら槻鍛樼數璇�",
+        value: hdInfo.value?.groupTestGroupDefenseMobile || "鏆傛棤淇℃伅",
+      },
+    ];
+
+    detailTitle.value = deviceDetail.value.deviceForShort;
+  } catch (err) {
+    console.error("鑾峰彇 hdInfo 澶辫触", err);
+    detailList.value = [
+      {
+        name: "缇ゆ祴缇ら槻鍛�",
+        value: "鎺ュ彛寮傚父"
+      },
+      {
+        name: "缇ゆ祴缇ら槻鍛樼數璇�",
+        value: "鎺ュ彛寮傚父"
+      }
+    ];
+  }
 }
+
 // 闅愭偅鐐瑰叿浣撲俊鎭�
 function handleDistrictDetail() {
   const name = deviceDetail.value.hdName;
diff --git a/src/store/simulation.js b/src/store/simulation.js
index bb75f7e..e810802 100644
--- a/src/store/simulation.js
+++ b/src/store/simulation.js
@@ -1,6 +1,7 @@
 // stores/ui.js
 import { defineStore } from 'pinia'
 import { ref } from 'vue'
+import { showDeviceDetail } from "@/store";
 export const useSimStore = defineStore('simulation', () => {
     // 鏂潰鏁版嵁
     const crossSection = ref([])
@@ -157,7 +158,6 @@
     const startMNPG = () => {
         init()
         isShowEarth.value = false
-
     }
 
     const setBackToHome = (value) => {
@@ -166,6 +166,7 @@
 
     // 瀵艰埅鐐瑰嚮
     const handleNavClick = (index) => {
+        showDeviceDetail.value = false;
         switch (index) {
             case 1:
                 startYHGL()

--
Gitblit v1.9.3