From d205764a3ebe073b8302e8faf9345b74ae3350df Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 11 十一月 2024 17:12:35 +0800
Subject: [PATCH] 优化初始化进入界面时,默认监测因子选项为PM颗粒物等常用因子

---
 src/components/map/MapScene.vue |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/components/map/MapScene.vue b/src/components/map/MapScene.vue
index c3cb97a..89a665c 100644
--- a/src/components/map/MapScene.vue
+++ b/src/components/map/MapScene.vue
@@ -7,6 +7,7 @@
         class="el-button-custom p-events-auto"
       >
         鍦烘櫙鏍囨敞
+        <el-icon class="el-icon--right"><arrow-down /></el-icon>
       </el-button>
     </template>
     <OptionLocation v-model="districtCode"></OptionLocation>
@@ -55,6 +56,14 @@
       sceneMap: new Map()
     };
   },
+  watch: {
+    // 褰撳垏鎹㈠尯鍘挎椂锛屾竻绌烘墍鏈夐�夐」
+    districtCode(nV, oV) {
+      if (nV != oV) {
+        this.handelCheckAllChange(false);
+      }
+    }
+  },
   methods: {
     fetchScene(sceneType) {
       return sceneInfoApi
@@ -83,13 +92,14 @@
 
       // 鏍规嵁閫夐」锛屽皢鏈墦寮�鐨勫浘灞傚紑鍚�
       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 });
+            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;
@@ -99,7 +109,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