From b23bc4d88ed6215fdda94dc94a15dd62e9f4a5cc Mon Sep 17 00:00:00 2001
From: guonan <guonan201020@163.com>
Date: 星期四, 12 六月 2025 11:59:10 +0800
Subject: [PATCH] 北京市隐患点和监测设备修改

---
 src/views/GisView.vue |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/views/GisView.vue b/src/views/GisView.vue
index bbb0786..f286edd 100644
--- a/src/views/GisView.vue
+++ b/src/views/GisView.vue
@@ -41,10 +41,10 @@
 import { loadAreaPolygon } from "@/utils/area.js";
 import { loadAreaPolygonAll } from "@/utils/area_all.js";
 import { isVisibleDistance } from "@/utils/customEntity";
-import { getDistrictCount, getDistrictCountByCity } from "@/api/index";
 import { useRoute } from "vue-router";
 import { EventBus } from "@/eventBus"; // 寮曞叆浜嬩欢鎬荤嚎
 import { useSimStore } from "@/store/simulation";
+const route = useRoute();
 const simStore = useSimStore();
 
 import {
@@ -52,6 +52,7 @@
   getDeviceInfo,
   getAeraCode,
   getAeraTownCode,
+  getDeviceCount,
 } from "@/api/hpApi";
 /////////////////////////鍦板浘褰卞儚閫夋嫨/////////////////////////
 const views = [
@@ -116,7 +117,6 @@
 };
 /////////////////////////鍦板浘褰卞儚閫夋嫨/////////////////////////
 
-const route = useRoute();
 let handler = null;
 /////////////////////////鍒濆鍖栧湴鍥�/////////////////////////
 function initMap() {
@@ -423,13 +423,40 @@
   },
 };
 
+const showDeviceCount = ref(false);
+
+// 鐩戝惉璺敱鍙樺寲
+watch(
+  () => route.name,
+  (newName) => {
+    console.log("璺敱鍚嶇О鍙樺寲:", newName);
+    // 浣跨敤涓夊厓杩愮畻绗︽潵鍐冲畾 showDeviceCount 鐨勫��
+    showDeviceCount.value = newName === "zhjc" ? true : false;
+    initDistrictCount("primary");
+  },
+  { immediate: true }
+);
+
 // 鍒濆鍖栧尯鍩熺粺璁�
 async function initDistrictCount(level = "secondary") {
   try {
+    const deviceTotal = ref([]);
     if (level === "primary") {
       // 涓�绾у尯鍩燂細鐩存帴璋冪敤 getAeraCode()
+      // 濡傛灉鏄� "/zhjc" 璺敱锛屽厛鑾峰彇璁惧缁熻鎺ュ彛鏁版嵁
+      if (showDeviceCount.value) {
+        deviceTotal.value = await getDeviceCount();
+      }
       const res = await getAeraCode();
       res.data.forEach((item) => {
+        if (showDeviceCount.value) {
+          const matchedDistrict = deviceTotal.value.data.find(
+            (d) => d.districtName === item.districtName
+          );
+          if (matchedDistrict) {
+            item.count = matchedDistrict.count; // 鏇存柊 count
+          }
+        }
         processDistrictItem(item, LEVEL_CONFIG[level], level);
       });
     } else if (level === "secondary") {
@@ -497,7 +524,7 @@
         res = await getDangerPoint(item.districtCode);
       } else if (route.path === "/zhjc") {
         // 璇锋眰鐩戞祴璁惧鏁版嵁
-        res = await getDeviceInfo(item.districtCode);
+        res = await getDeviceInfo(null,item.districtCode);
       } else {
         loadingInstance.close();
         return;

--
Gitblit v1.9.3