Ver código fonte

fix: 渠道颜色

lxf 1 semana atrás
pai
commit
1aac5c6472

+ 6 - 0
src/views/warningHome/index.vue

@@ -120,12 +120,18 @@ const getLegendData = async (code) => {
         if (code === "water_conservancy" && waterLayer) {
             waterLayer.setLegend(finalList);
         }
+        if (code === "facility" && waterLayer) {
+            waterLayer.setCanalLegend(finalList);
+        }
     } catch (e) {
         console.error("解析图例 content 失败:", e, data);
         legendRef.value && legendRef.value.updateData([]);
         if (code === "water_conservancy" && waterLayer) {
             waterLayer.setLegend([]);
         }
+        if (code === "facility" && waterLayer) {
+            waterLayer.setCanalLegend([]);
+        }
     }
 };
 

+ 2 - 1
src/views/warningHome/map/waterLayer.js

@@ -13,6 +13,7 @@ class WaterLayer {
         this.riverAnimationPhase = 0;
         // 图例配置(用于控制不同水利图层颜色)
         this.legend = [];
+        that.canalColorOverride = "#F0D09C";
 
         this.waterLayer = new KMap.VectorLayer("waterLayer", 99, {
             style: (f) => {
@@ -44,7 +45,7 @@ class WaterLayer {
 
         this.canalLayer = new KMap.VectorLayer("canalLayer", 99, {
             style: (f) => {
-                const strokeColor = that.getLayerColor("canal");
+                const strokeColor = that.canalColorOverride;
                 return that.vectorStyle.getPolygonStyle("#00000010", strokeColor, 3)
             }
         });