From ce9312be0865e2ec49cf86606489ad87bafcebfc Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期三, 07 四月 2021 10:30:48 +0800
Subject: [PATCH] 固废弹框信息及数据修改

---
 src/components/LayerController/logic/SolidWaste.js |   49 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/src/components/LayerController/logic/SolidWaste.js b/src/components/LayerController/logic/SolidWaste.js
index fc55978..ffbedfa 100644
--- a/src/components/LayerController/logic/SolidWaste.js
+++ b/src/components/LayerController/logic/SolidWaste.js
@@ -1,6 +1,7 @@
 /**
  * 鍥哄簾
  */
+
 // 鍖哄垎涓嶅悓绫诲瀷 浣跨敤涓嶅悓img
 const defaultImg = '/assets/images/map/solidwaste/voc.png'
 const setting = '/assets/images/map/solidwaste/gf_green.png'
@@ -35,7 +36,7 @@
       var iconUrl = this.differentTypes(judgeValue)
 
       const marker = L.marker([positionX, positionY], {
-        test: getSolidWasteData[i],
+        totransferData: getSolidWasteData[i],
         icon: L.icon({
           iconUrl: iconUrl,
           iconSize: [50, 50],
@@ -47,19 +48,14 @@
   }
 
   this.bindTooltip = (layer) => {
-    return layer.options.test.Name
+    return layer.options.totransferData.Name
   }
 
-  this.clickListener = async (e) => {
+  this.clickListener = (e) => {
+    // 鐐瑰嚮marker鐨刾ulse()鍏夋尝
     this.animalService.pulseEffect(e.latlng)
-    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')
+    /* 鐐瑰嚮鏁版嵁鐨勬帴鍙h姹� */
+    this.requestSolidWasteData(e).then(e)
   }
 
   // 涓嶅悓绫诲瀷鍥剧墖灏佽
@@ -72,4 +68,35 @@
     }
     return effectOfChange
   }
+
+  // 鏍规嵁鐐瑰嚮涓嶅悓鏁版嵁 杩涜鎺ュ彛鐨勬暟鎹姹�
+  this.requestSolidWasteData = async (e) => {
+    // 鍩烘湰淇℃伅 鍜� 璇︾粏淇℃伅 灞曠ず鏁版嵁鎵�闇�鍙傛暟
+    const dataValue = {
+      StoragePlaceId: e.layer.options.totransferData.StoragePlaceId
+    }
+    // 鍩烘湰淇℃伅 tabs
+    const resultBasic = await mapApi.getSolidWasteBaseInfo(dataValue)
+    // 璇︾粏淇℃伅灞曠ず table
+    const resultDetailed = await mapApi.getSolidWasteDetail(dataValue)
+
+    // 缁戝畾寮规瀹炰緥
+    const PublicBounced = window.Vue.extend(publicBounced)
+    const instance = new PublicBounced()
+    instance.$mount()
+    document.body.appendChild(instance.$el)
+    // 閫氳繃鏂规硶 鍚戠粦瀹氬脊妗嗕紶閫掓暟鎹�
+    instance.setData(resultBasic.Result.DataInfo, resultDetailed.Result.DataInfo, 'gufei')
+    /* flyTo()寮瑰嚭妗嗗钩绉讳簨浠� */
+    this.setPanTo(e.latlng, 200)
+  }
+
+  // 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