From 0a0080a207a39e51a30a23a41c2054e842f36dae Mon Sep 17 00:00:00 2001 From: wangqi <magical1908@outlook.com> Date: 星期二, 06 四月 2021 18:21:27 +0800 Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop --- src/components/LayerController/logic/WasteWater.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/components/LayerController/logic/WasteWater.js b/src/components/LayerController/logic/WasteWater.js index 8b66aa9..210afcd 100644 --- a/src/components/LayerController/logic/WasteWater.js +++ b/src/components/LayerController/logic/WasteWater.js @@ -3,9 +3,15 @@ */ const AnimalService = require('../service/AnimalService').default const mapApi = require('../../../api/mapApi').default +// 寮圭獥鏁版嵁寮曡繘 +const publicBounced = require('../../BaseNav/PublicBounced/PublicBounced').default -const testValue1 = '/assets/images/map/wastewater/fs_green.png' -const testValue2 = '/assets/images/map/wastewater/fs_yellow.png' +const NormalImg = '/assets/images/map/wastewater/fs_green.png' // 姝e父 +const OffImg = '/assets/images/map/wastewater/fs_gray.png' // 鍋滆繍 +const AbnormalImg = '/assets/images/map/wastewater/fs_blue.png' // 寮傚父 +const MissImg = '/assets/images/map/wastewater/fs_yellow.png' // 缂哄け +const AlarmImg = '/assets/images/map/wastewater/fs_red.png' // 鎶ヨ闂儊 +const WarnImg = '/assets/images/map/wastewater/fs_orange.png' // 棰勮闂儊 module.exports = function () { /** @@ -18,9 +24,7 @@ layer: layer }) const res = await mapApi.getWasteWater() - // console.log(res) - const data = res.Result.DataInfo - // console.log(data) + const data = res.Result.DataInfo || {} for (let i = 0; i < data.length; i++) { // 缁忕含搴� 浣嶇疆 const positionX = data[i].Latitude @@ -30,6 +34,7 @@ const testValue = data[i].ContrLevel const iconUrl = this.differentTypes(testValue) const marker = L.marker.magic([positionX, positionY], { + test: data[i], icon: L.icon({ iconUrl: iconUrl, iconSize: [50, 50], @@ -41,22 +46,53 @@ } this.bindTooltip = (layer) => { - return '娴嬭瘯搴熸按' + return layer.options.test.Name } - this.clickListener = (e) => { + this.clickListener = async (e) => { // console.log(e) this.animalService.pulseEffect(e.latlng) - return this.PublicBounced.$el + // const dataValue = { + // StoragePlaceId: e.layer.options.test.StoragePlaceId + // } + // const result = await mapApi.getWasteWater(dataValue) + // console.log(result) + const PublicBounced = window.Vue.extend(publicBounced) + const instance = new PublicBounced() + instance.setGasData(e.layer.options.test, 'feishui') + console.log(e.layer.options.test) + instance.$mount() + document.body.appendChild(instance.$el) } // 鏍规嵁杩斿洖鍊肩殑涓嶅悓鏍囪涓嶅悓鍥剧墖 this.differentTypes = (testValue) => { let testChange - if (testValue === 1) { - testChange = testValue1 - } else { - testChange = testValue2 + switch (testValue) { + case 1: + testChange = NormalImg + break + case 2: + testChange = OffImg + break + case 3: + testChange = AbnormalImg + break + case 4: + testChange = MissImg + break + case 5: + testChange = NormalImg + break + case 6: + testChange = AlarmImg + break + case 7: + testChange = AbnormalImg + break + case 8: + testChange = WarnImg + break } return testChange } -- Gitblit v1.8.0