From dd48001d9793e5d338d38feebee5fc44e1296005 Mon Sep 17 00:00:00 2001 From: chenzeping <ChenZeping02609@163.com> Date: 星期三, 31 三月 2021 15:33:24 +0800 Subject: [PATCH] 公共弹框修改 固废内容修改 --- src/components/LayerController/logic/SolidWaste.js | 43 ++++++++++++++++++++++++------------------- 1 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/components/LayerController/logic/SolidWaste.js b/src/components/LayerController/logic/SolidWaste.js index dfc5841..fc55978 100644 --- a/src/components/LayerController/logic/SolidWaste.js +++ b/src/components/LayerController/logic/SolidWaste.js @@ -5,8 +5,12 @@ 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 + +const publicBounced = require('../../BaseNav/PublicBounced/PublicBounced').default module.exports = function () { /** @@ -14,43 +18,48 @@ * @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 result = await mapApi.getSolidWaste() + const getSolidWasteData = result.Result.DataInfo || {} + // 寰幆閬嶅巻鏁版嵁 鏍规嵁杩涜marker 鐨勫垱寤� + for (let i = 0; i < getSolidWasteData.length; i++) { // 缁忕含搴� 浣嶇疆 - const positionX = data[i].Latitude - const positionY = data[i].Longitude + const positionX = getSolidWasteData[i].Latitude + const positionY = getSolidWasteData[i].Longitude - // 瀹氫箟绫诲瀷 鐢ㄦ潵鍖哄垎鏁版嵁鐨勪笉鍚� - const judgeValue = data[i].StorageQty + // 瀹氫箟绫诲瀷 鐢ㄦ潵鍖哄垎鏁版嵁鐨勪笉鍚� 1.鎺ュ彛鎺ュ彛鏁版嵁鏉ヨ繘琛屾暟鎹殑鍒ゆ柇 2.鏍规嵁鏁版嵁绫诲瀷鐨勪笉鍚岋紝杩涜涓嶅悓绫诲瀷鐨勫浘鐗囨樉绀� + const judgeValue = getSolidWasteData[i].StorageQty var iconUrl = this.differentTypes(judgeValue) - const marker = L.marker.magic([positionX, positionY], { + const marker = L.marker([positionX, positionY], { + test: getSolidWasteData[i], icon: L.icon({ iconUrl: iconUrl, iconSize: [50, 50], iconAnchor: [25, 25] }) }) - layer.addLayer(marker) } } this.bindTooltip = (layer) => { - return '娴嬭瘯鍥哄簾' + return layer.options.test.Name } - this.clickListener = (e) => { + this.clickListener = async (e) => { this.animalService.pulseEffect(e.latlng) - console.log(e) - return this.PublicBounced.$el + const dataValue = { + StoragePlaceId: e.layer.options.test.StoragePlaceId + } + const result = await mapApi.getSolidWasteBaseInfo(dataValue) + // console.log(result) + const PublicBounced = window.Vue.extend(publicBounced) + const instance = new PublicBounced() + instance.setData(result, 'gufei') } // 涓嶅悓绫诲瀷鍥剧墖灏佽 @@ -63,8 +72,4 @@ } return effectOfChange } - // 鍥哄簾鐐瑰嚮杩涜鐨� 鍐呭鐨勮缃� - // SetSolidWasteContent (config, containerPopup) { - // this.SolidWastePopup = containerPopup - // } } -- Gitblit v1.8.0