From 0976a86e697f64c9193a4496df3f3fe483d6654b Mon Sep 17 00:00:00 2001 From: zhangshuaibao <15731629597@163.com> Date: 星期三, 31 三月 2021 11:24:26 +0800 Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop --- src/components/LayerController/logic/SolidWaste.js | 70 +++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-) diff --git a/src/components/LayerController/logic/SolidWaste.js b/src/components/LayerController/logic/SolidWaste.js new file mode 100644 index 0000000..dfc5841 --- /dev/null +++ b/src/components/LayerController/logic/SolidWaste.js @@ -0,0 +1,70 @@ +/** + * 鍥哄簾 + */ +// 鍖哄垎涓嶅悓绫诲瀷 浣跨敤涓嶅悓img +const defaultImg = '/assets/images/map/solidwaste/voc.png' +const setting = '/assets/images/map/solidwaste/gf_green.png' + +const mapApi = require('../../../api/mapApi').default +const AnimalService = require('../service/AnimalService').default + +module.exports = function () { + /** + * 杩斿洖marker瀵硅薄鏁扮粍 + * @param L leaflet瀵硅薄 + */ + this.init = async (layer, L) => { + // const SolidWasteIcon = this.SolidWasteIcon() + this.animalService = new AnimalService({ + L: L, + layer: layer + }) + const res = await mapApi.getSolidWaste() + // console.log(res) + const data = res.Result.DataInfo || {} + for (let i = 0; i < data.length; i++) { + // 缁忕含搴� 浣嶇疆 + const positionX = data[i].Latitude + const positionY = data[i].Longitude + + // 瀹氫箟绫诲瀷 鐢ㄦ潵鍖哄垎鏁版嵁鐨勪笉鍚� + const judgeValue = data[i].StorageQty + var iconUrl = this.differentTypes(judgeValue) + + const marker = L.marker.magic([positionX, positionY], { + icon: L.icon({ + iconUrl: iconUrl, + iconSize: [50, 50], + iconAnchor: [25, 25] + }) + }) + + layer.addLayer(marker) + } + } + + this.bindTooltip = (layer) => { + return '娴嬭瘯鍥哄簾' + } + + this.clickListener = (e) => { + this.animalService.pulseEffect(e.latlng) + console.log(e) + return this.PublicBounced.$el + } + + // 涓嶅悓绫诲瀷鍥剧墖灏佽 + this.differentTypes = (judgeValue) => { + var effectOfChange + if (judgeValue === 1) { + effectOfChange = defaultImg + } else { + effectOfChange = setting + } + return effectOfChange + } + // 鍥哄簾鐐瑰嚮杩涜鐨� 鍐呭鐨勮缃� + // SetSolidWasteContent (config, containerPopup) { + // this.SolidWastePopup = containerPopup + // } +} -- Gitblit v1.8.0