From 41dc8bedbfee679decb94d2df35c10fc003e258a Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Wed, 24 Aug 2022 15:37:31 +0800
Subject: [PATCH] 二级菜单添加返回功能
---
src/components/map/plotMap.vue | 51 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/src/components/map/plotMap.vue b/src/components/map/plotMap.vue
index 0e9d0bc..94060dc 100644
--- a/src/components/map/plotMap.vue
+++ b/src/components/map/plotMap.vue
@@ -253,25 +253,22 @@
addPlotPolygon (positions, item) {
const that = this
-
const center = this.getCenter(positions)
-
- // const divIcon = new global.DC.DivIcon(
- // new global.DC.Position(center[0], center[1], 0),
- // `
- // <div class="farm-map-icon">
- // <img src="/img/icon/3858.png" alt="">
- // // <div>${item.farmName}</div>
- // </div>
- // `
- // )
- // divIcon.attrParams = item
- // farmLogoLayer.addOverlay(divIcon)
-
- // divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
- // that.$parent.showDetailPopup(e.overlay.attrParams)
- // })
-
+ if(item.strainUrl !=""){
+ const divIcon = new global.DC.DivIcon(
+ new global.DC.Position(center[0], center[1], 0),
+ `
+ <div class="farm-map-icon">
+ <img src="${item.strainUrl}" alt=""width="50%" height="50%" text-align="center">
+ </div>
+ `
+ )
+ divIcon.attrParams = item
+ farmLogoLayer.addOverlay(divIcon)
+ divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+ that.$parent.showDetailPopup(e.overlay.attrParams)
+ })
+ }
const polygon = new global.DC.Polygon(positions)
polygon.attrParams = item
polygon.setStyle({
@@ -285,8 +282,10 @@
that.$parent.plotDetailsPopupShow(e.overlay.attrParams)
})
+ console.log(item, 123)
+
plotRegionLayer.addOverlay(polygon)
- addPlotLayers.push({ center, name: item.landName })
+ addPlotLayers.push({ center, name: item.landName, id: item.id })
},
setCenter (name) {
@@ -337,6 +336,20 @@
})
},
+ setPlotAttr (params) {
+ let overLayers = plotRegionLayer.getOverlays()
+
+ overLayers.some(item => {
+
+ if (item.attrParams.id == params.id) {
+ item.attrParams = params
+
+ return true
+ }
+
+ })
+ },
+
// 经纬度测算中心位置
getCenter (arr) {
let centerLonLat = []
--
Gitblit v1.9.3