From 00b89e4c17c3d34301be0bd51604b0c29ed77c3a Mon Sep 17 00:00:00 2001 From: seatonwan9 <seatonwan9@163.com> Date: 星期五, 28 五月 2021 09:27:17 +0800 Subject: [PATCH] 修改风险统计图加载 --- src/components/LayerController/logic/EnvironmentRisk.js | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/components/LayerController/logic/EnvironmentRisk.js b/src/components/LayerController/logic/EnvironmentRisk.js index d80ace3..e7478e7 100644 --- a/src/components/LayerController/logic/EnvironmentRisk.js +++ b/src/components/LayerController/logic/EnvironmentRisk.js @@ -1,7 +1,7 @@ /** * 鐜椋庨櫓 */ -// const EnvironmentRiskIndex = require('@components/BaseNav/').default +// const EnvironmentRiskIndex = require('@components/base-page/').default // 璇锋眰鎺ュ彛鏁版嵁 const mapApi = require('../../../api/mapApi').default @@ -11,6 +11,8 @@ const echarts = require('echarts/lib/echarts') module.exports = function () { + // 瀛樻斁鐜舰鍥剧殑鏁扮粍 + let riskLayerGroup = [] /** * 杩斿洖marker瀵硅薄鏁扮粍 * @param L leaflet瀵硅薄 @@ -20,6 +22,11 @@ L: L, layer: layer }) + layer.addLayer(riskLayerGroup) + } + + this.start = async () => { + riskLayerGroup = window.layerFactory.L.featureGroup().addTo(window.layerFactory.map) const result = await mapApi.getRiskEnterprise() const features = result.features for (var i = 0; i < features.length; i++) { @@ -33,25 +40,30 @@ if (distract !== '闀挎睙娌跨嚎') { continue } - const bgMarker = L.marker([coordinates[1], coordinates[0]], { - icon: L.divIcon({ + window.layerFactory.L.marker([coordinates[1], coordinates[0]], { + icon: this.animalService.L.divIcon({ className: '', iconAnchor: [15, 45], iconSize: [40, 40], html: '<div style="width: 40px; height: 40px; background-color: rgba(255,255,255,1); position: relative; border-radius: 50%;"></div>' }) - }) - layer.addLayer(bgMarker) - const chartMarker = L.marker([coordinates[1], coordinates[0]], { - icon: L.divIcon({ + }).addTo(riskLayerGroup) + // this.animalService.layer.addLayer(bgMarker) + window.layerFactory.L.marker([coordinates[1], coordinates[0]], { + icon: this.animalService.L.divIcon({ className: '', iconAnchor: [30, 60], iconSize: [70, 70], html: '<div id="qy_id_' + qyId + '" style="width: 70px; height: 70px; background-color: transparent; position: relative; border-radius: 50%;"></div>' }) - }) - layer.addLayer(chartMarker) + }).addTo(riskLayerGroup) chartRender(properties) + } + } + + this.destory = () => { + if (riskLayerGroup) { + riskLayerGroup.remove() } } @@ -61,7 +73,6 @@ * @returns {string} */ this.bindTooltip = (layer) => { - } /** @@ -69,7 +80,6 @@ * @param e */ this.clickListener = (e) => { - } /** -- Gitblit v1.8.0