From a70b76f5f880dc6dfc9da8754e1d117c7ca5c7e7 Mon Sep 17 00:00:00 2001 From: 陈泽平 <chenzeping> Date: 星期一, 17 五月 2021 16:07:57 +0800 Subject: [PATCH] 公共flyTo方法 --- src/components/LayerController/logic/WasteWater.js | 67 ++++++++++++--------------------- 1 files changed, 24 insertions(+), 43 deletions(-) diff --git a/src/components/LayerController/logic/WasteWater.js b/src/components/LayerController/logic/WasteWater.js index 2ed9ee0..267fe0a 100644 --- a/src/components/LayerController/logic/WasteWater.js +++ b/src/components/LayerController/logic/WasteWater.js @@ -1,10 +1,14 @@ /** * 搴熸按 */ + +// 鍏叡鏂规硶 panTo() 寮曠敤 +const { setPanTo } = require('../../../utils/utils') + const AnimalService = require('../service/AnimalService').default const mapApi = require('../../../api/mapApi').default // 寮圭獥鏁版嵁寮曡繘 -const publicBounced = require('../../BaseNav/PublicBounced/PublicBounced').default +const WasteWaterIndex = require('@components/BaseNav/WasteWater/WasteWaterIndex').default const NormalImg = '/assets/images/map/wastewater/fs_bright_green.png' // 姝e父 const OffImg = '/assets/images/map/wastewater/fs_gray.png' // 鍋滆繍 @@ -34,54 +38,38 @@ const testValue = data[i].ContrLevel const iconUrl = this.differentTypes(testValue) const marker = L.marker([positionX, positionY], { - test: data[i], + totransferData: data[i], icon: L.icon({ iconUrl: iconUrl, iconSize: [35, 35], - iconAnchor: [18, 18] + iconAnchor: [15, 15] }) }) layer.addLayer(marker) } } - // 鍒嗗壊绾�------------------------------------------------------------------------------- - // this. this.bindTooltip = (layer) => { - return layer.options.test.Name + return '<div class="company-bindTooltip-hover"><h3>澶╂触鐭冲寲</h3></div>' + layer.options.totransferData.Name } - this.clickListener = async (e) => { - // console.log(e) + this.clickListener = (e) => { this.animalService.pulseEffect(e.latlng) - const dataValue = { - StoragePlaceId: e.layer.options.test.StoragePlaceId - } - const hourValue = { - onLineMonEmissPointId: '23', - monItemId: '28,31', - beginTime: '2020-04-06 15:13:20', - endTime: '2020-04-07 15:13:20', - dataType: '2' - } - const dateValue = { - onLineMonEmissPointId: '23', - monItemId: '28,31', - beginTime: '2020-04-06', - endTime: '2020-04-07', - dataType: '1' - } - const detailData = await mapApi.getWasteWaterMonitoringDetails(dataValue) // 鏄庣粏琛ㄨ繑鍥炴暟鎹� - const hourData = await mapApi.getQueryOnlineMonData(hourValue) // 灏忔椂鏁版嵁 - const dateData = await mapApi.getQueryOnlineMonData(dateValue) // 鏃ユ暟鎹� - // const drawback = await mapApi.getWasteWaterMonitoring() - const PublicBounced = window.Vue.extend(publicBounced) - const instance = new PublicBounced() - instance.setWaterData(e.layer.options.test, detailData.Result.DataInfo, hourData.Result.DataInfo, dateData.Result.DataInfo, 'feishui') - // console.log(e.layer.options.test) - instance.$mount() - document.body.appendChild(instance.$el) - this.setPanTo(e.latlng, 80) + setPanTo(e.latlng, 200) + // 寮规鏍囬 + const title = e.layer.options.totransferData.Name + const res = e.layer.options.totransferData + window.$layer.open({ + content: { + content: WasteWaterIndex, // 缁勪欢 + parent: this, // 鐖剁粍浠� + data: { // 浼犻�掔殑鍙傛暟 + // info: this.info + storagePlaceId: res + } + }, + title: '澶╂触鐭冲寲' + title // 鏍囬 + }) } // 鏍规嵁杩斿洖鍊肩殑涓嶅悓鏍囪涓嶅悓鍥剧墖 @@ -114,12 +102,5 @@ break } return testChange - } - this.setPanTo = (pos, value) => { - var position = pos - position = window.map.latLngToLayerPoint(position) - position.y += value - position = window.map.layerPointToLatLng(position) - window.map.flyTo(position) } } -- Gitblit v1.8.0