From 5679cbbb630092a197d991cb41997a2d953261e9 Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期三, 11 六月 2025 22:49:07 +0800
Subject: [PATCH] 动态溯源(待完成)

---
 src/components/map/MapScene.vue |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/components/map/MapScene.vue b/src/components/map/MapScene.vue
index 163b5a3..9e0fb06 100644
--- a/src/components/map/MapScene.vue
+++ b/src/components/map/MapScene.vue
@@ -42,6 +42,8 @@
 import sceneInfoApi from '@/api/sceneInfoApi';
 import marks from '@/utils/map/marks';
 import MapUtil from '@/utils/map/util';
+import { useToolboxStore } from '@/stores/toolbox';
+import { mapStores } from 'pinia';
 
 const lableMarkMap = new Map();
 
@@ -55,6 +57,18 @@
       options: sceneTypes(),
       sceneMap: new Map()
     };
+  },
+  computed: {
+    ...mapStores(useToolboxStore)
+  },
+  watch: {
+    // 褰撳垏鎹㈠尯鍘挎椂锛屾竻绌烘墍鏈夐�夐」
+    districtCode(nV, oV) {
+      if (nV != oV) {
+        this.toolboxStore.selectedDistrict = nV;
+        this.handelCheckAllChange(false);
+      }
+    }
   },
   methods: {
     fetchScene(sceneType) {
@@ -84,13 +98,19 @@
 
       // 鏍规嵁閫夐」锛屽皢鏈墦寮�鐨勫浘灞傚紑鍚�
       types.forEach((t) => {
-        if (!lableMarkMap.has(t)) {
+        const key = this.districtCode + t;
+        if (!lableMarkMap.has(key)) {
           this.fetchScene(t).then((res) => {
-            const layer = marks.createLabelMarks(sceneIcon(t), res);
-            lableMarkMap.set(t, { show: true, layer });
+            const layer = marks.createLabelMarks(
+              sceneIcon(t),
+              res,
+              false,
+              true
+            );
+            lableMarkMap.set(key, { show: true, layer });
           });
         } else {
-          const m = lableMarkMap.get(t);
+          const m = lableMarkMap.get(key);
           if (!m.show) {
             MapUtil.addViews(m.layer);
             m.show = true;
@@ -100,7 +120,7 @@
 
       // 鏍规嵁閫夐」锛屽皢寮�鍚腑鐨勬湭閫変腑鍥惧眰鍏抽棴
       for (const [key, value] of lableMarkMap) {
-        if (!types.includes(key)) {
+        if (!types.map((t) => this.districtCode + t).includes(key)) {
           if (value.show) {
             MapUtil.removeViews(value.layer);
             value.show = false;

--
Gitblit v1.9.3