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/WasteGas.js | 7 ++- src/components/LayerController/service/AnimalService.js | 13 ------ src/components/LayerController/logic/WasteWater.js | 38 ++----------------- src/components/LayerController/logic/WasteSolid.js | 7 ++- 4 files changed, 12 insertions(+), 53 deletions(-) diff --git a/src/components/LayerController/logic/WasteGas.js b/src/components/LayerController/logic/WasteGas.js index 17706bc..6c2fe65 100644 --- a/src/components/LayerController/logic/WasteGas.js +++ b/src/components/LayerController/logic/WasteGas.js @@ -3,7 +3,8 @@ */ const AnimalService = require('../service/AnimalService').default // const AjaxUtils = require('../../../utils/AjaxUtils').default - +// 鍏叡鏂规硶 panTo() 寮曠敤 +const { setPanTo } = require('../../../utils/utils') // 鍖哄垎涓嶅悓绫诲瀷 浣跨敤涓嶅悓img // const ImgBlue = '/assets/images/map/exhaust/fq_blue.png' // const ImgGray = '/assets/images/map/exhaust/fq_gray.png' @@ -60,8 +61,9 @@ } this.clickListener = async (e) => { - console.log(e) + // console.log(e) this.animalService.pulseEffect(e.latlng) + setPanTo(e.latlng, 200) const title = e.layer.options.test.Name const res = e.layer.options.test window.$layer.open({ @@ -74,7 +76,6 @@ }, title: '澶╂触鐭冲寲' + title // 鏍囬 }) - this.animalService.setPanTo(e.latlng, 150) } // 涓嶅悓绫诲瀷鍥剧墖鍔犺浇 this.differentTypes = (ContrLevel) => { diff --git a/src/components/LayerController/logic/WasteSolid.js b/src/components/LayerController/logic/WasteSolid.js index 28b0938..1b9cd9c 100644 --- a/src/components/LayerController/logic/WasteSolid.js +++ b/src/components/LayerController/logic/WasteSolid.js @@ -5,7 +5,8 @@ // 鍖哄垎涓嶅悓绫诲瀷 浣跨敤涓嶅悓img const defaultImg = '/assets/images/map/solidwaste/voc.png' const setting = '/assets/images/map/solidwaste/gf_green2.png' - +// 鍏叡鏂规硶 panTo() 寮曠敤 +const { setPanTo } = require('../../../utils/utils') // 璇锋眰鎺ュ彛鏁版嵁 const mapApi = require('../../../api/mapApi').default // 浣跨敤灏佽鏂规硶 @@ -53,6 +54,8 @@ this.clickListener = (e) => { // 鐐瑰嚮marker鐨刾ulse()鍏夋尝 this.animalService.pulseEffect(e.latlng) + /* flyTo()寮瑰嚭妗嗗钩绉讳簨浠� */ + setPanTo(e.latlng, 200) // 寮规鏍囬 const title = e.layer.options.totransferData.Name window.$layer.open({ @@ -65,8 +68,6 @@ }, title: title // 鏍囬 }) - /* flyTo()寮瑰嚭妗嗗钩绉讳簨浠� */ - this.animalService.setPanTo(e.latlng, 300) } // 涓嶅悓绫诲瀷鍥剧墖灏佽 diff --git a/src/components/LayerController/logic/WasteWater.js b/src/components/LayerController/logic/WasteWater.js index 6f67ed6..267fe0a 100644 --- a/src/components/LayerController/logic/WasteWater.js +++ b/src/components/LayerController/logic/WasteWater.js @@ -1,13 +1,14 @@ /** * 搴熸按 */ -// import WasteWater from "../../table/components/WasteWater"; + +// 鍏叡鏂规硶 panTo() 寮曠敤 +const { setPanTo } = require('../../../utils/utils') const AnimalService = require('../service/AnimalService').default const mapApi = require('../../../api/mapApi').default // 寮圭獥鏁版嵁寮曡繘 const WasteWaterIndex = require('@components/BaseNav/WasteWater/WasteWaterIndex').default -// const publicBounced = require('../../BaseNav/PublicBounced/PublicBounced').default const NormalImg = '/assets/images/map/wastewater/fs_bright_green.png' // 姝e父 const OffImg = '/assets/images/map/wastewater/fs_gray.png' // 鍋滆繍 @@ -48,14 +49,13 @@ } } - // 鍒嗗壊绾�------------------------------------------------------------------------------- this.bindTooltip = (layer) => { return '<div class="company-bindTooltip-hover"><h3>澶╂触鐭冲寲</h3></div>' + layer.options.totransferData.Name } this.clickListener = (e) => { - // 鐐瑰嚮marker鐨刾ulse()鍏夋尝 this.animalService.pulseEffect(e.latlng) + setPanTo(e.latlng, 200) // 寮规鏍囬 const title = e.layer.options.totransferData.Name const res = e.layer.options.totransferData @@ -70,36 +70,6 @@ }, title: '澶╂触鐭冲寲' + title // 鏍囬 }) - this.animalService.setPanTo(e.latlng, 150) - } - this.requestWasteWaterData = async (e) => { - // 鍩烘湰淇℃伅 鍜� 璇︾粏淇℃伅 灞曠ず鏁版嵁鎵�闇�鍙傛暟 - // const dataValue = { - // StoragePlaceId: e.layer.options.test.StoragePlaceId - // } - // 寮规鏍囬 - // const title = e.layer.options.totransferData.Name - // console.log(e.layer.options) - // 鍩烘湰淇℃伅 tabs - // const resultBasic = await mapApi.getWasteWater(dataValue) - // 鍥捐〃淇℃伅灞曠ず echarts - // 瀹炴椂鏁版嵁 - // const resultReal = await mapApi.getDataItems(Value) - // 灏忔椂鏁版嵁 鍙� 鏄庣粏琛ㄦ暟鎹� - // const result = await mapApi.getQueryOnlineMonData(dataValue) - // 鏃ユ暟鎹� 鍙� 鏄庣粏琛ㄦ暟鎹� - // const result = await mapApi.getQueryOnlineMonData(dataValue) - // 浜哄伐鏁版嵁 - // const resultEchart = await mapApi.getQueryLabMonData(dataValue) - - // // 缁戝畾寮规瀹炰緥 - // const PublicBounced = window.Vue.extend(publicBounced) - // const instance = new PublicBounced().$mount() - // document.body.appendChild(instance.$el) - // // document.body.removeChild(instance.$el) - // // 閫氳繃鏂规硶 鍚戠粦瀹氬脊妗嗕紶閫掓暟鎹� - // instance.setData(title, resultBasic.Result.DataInfo, resultDetailed.Result.DataInfo, 'gufei') - /* flyTo()寮瑰嚭妗嗗钩绉讳簨浠� */ } // 鏍规嵁杩斿洖鍊肩殑涓嶅悓鏍囪涓嶅悓鍥剧墖 diff --git a/src/components/LayerController/service/AnimalService.js b/src/components/LayerController/service/AnimalService.js index 3de6468..687b6e7 100644 --- a/src/components/LayerController/service/AnimalService.js +++ b/src/components/LayerController/service/AnimalService.js @@ -33,19 +33,6 @@ } }, 1000) } - - /** - * 璁剧疆寮圭獥骞崇Щ浣嶇疆 - * @param pos - * @param value - */ - setPanTo = (pos, value) => { - var position = pos - position = this.layer.latLngToLayerPoint(position) - position.y += value - position = this.layer.layerPointToLatLng(position) - this.layer.flyTo(position) - } } export default AnimalService -- Gitblit v1.8.0