From 3d7c359a73da1e5d796642d35be0e2444d997041 Mon Sep 17 00:00:00 2001 From: seatonwan9 <seatonwan9@163.com> Date: 星期三, 12 五月 2021 16:10:05 +0800 Subject: [PATCH] 公共方法提取 --- src/components/LayerController/logic/WasteSolid.js | 45 ++++++++++++++------------------------------- 1 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/components/LayerController/logic/WasteSolid.js b/src/components/LayerController/logic/WasteSolid.js index 977eaac..c027ae9 100644 --- a/src/components/LayerController/logic/WasteSolid.js +++ b/src/components/LayerController/logic/WasteSolid.js @@ -52,8 +52,20 @@ this.clickListener = (e) => { // 鐐瑰嚮marker鐨刾ulse()鍏夋尝 this.animalService.pulseEffect(e.latlng) - /* 鐐瑰嚮鏁版嵁鐨勬帴鍙h姹� */ - this.requestSolidWasteData(e).then(e) + // 寮规鏍囬 + const title = e.layer.options.totransferData.Name + window.$layer.open({ + content: { + content: WasteSolidIndex, // 缁勪欢 + parent: this, // 鐖剁粍浠� + data: { // 浼犻�掔殑鍙傛暟 + storagePlaceId: e.layer.options.totransferData.StoragePlaceId + } + }, + title: title // 鏍囬 + }) + /* flyTo()寮瑰嚭妗嗗钩绉讳簨浠� */ + this.animalService.setPanTo(e.latlng, 300) } // 涓嶅悓绫诲瀷鍥剧墖灏佽 @@ -65,34 +77,5 @@ effectOfChange = setting } return effectOfChange - } - - // 鏍规嵁鐐瑰嚮涓嶅悓鏁版嵁 杩涜鎺ュ彛鐨勬暟鎹姹� - this.requestSolidWasteData = async (e) => { - // 寮规鏍囬 - const title = e.layer.options.totransferData.Name - /* flyTo()寮瑰嚭妗嗗钩绉讳簨浠� */ - this.setPanTo(e.latlng, 300) - - // console.log(e.layer.options.totransferData.StoragePlaceId) - window.$layer.open({ - content: { - content: WasteSolidIndex, // 缁勪欢 - parent: this, // 鐖剁粍浠� - data: { // 浼犻�掔殑鍙傛暟 - storagePlaceId: e.layer.options.totransferData.StoragePlaceId - } - }, - title: title // 鏍囬 - }) - } - - // flayTo() 寮规鐨勫彲婊戝姩浜嬩欢 - 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