From 3295832c31a1e26ba3b34e439b2caafbff66bd69 Mon Sep 17 00:00:00 2001
From: xiebin <123456>
Date: Thu, 25 Aug 2022 16:15:33 +0800
Subject: [PATCH] 地图农场地块显示种养品种图片

---
 src/components/map/index.vue |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 48d17c6..9700b3f 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -302,22 +302,24 @@
 
             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)
+            if (item.strainUrl != '') {
+                const urls = item.strainUrl.split(',')
+                let imageStr = '<div class="land-map-icon">'
+                urls.forEach(url => {
+                    imageStr += `<img src="${url}" alt=""width="100px" height="100px" text-align="center" class="strainImg">`
+                })
+                imageStr += '</div>'
+                const divIcon = new global.DC.DivIcon(
+                    new global.DC.Position(center[0], center[1], 0), imageStr
+                )
 
-            // divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
-            //     that.$parent.showDetailPopup(e.overlay.attrParams)
-            // })
+                divIcon.attrParams = item
+                farmLogoLayer.addOverlay(divIcon)
 
+                divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+                    that.$parent.plotDetailsPopupShow(e.overlay.attrParams)
+                })
+            }
             const polygon = new global.DC.Polygon(positions)
             polygon.attrParams = item
             polygon.setStyle({
@@ -485,7 +487,13 @@
          */
 
         setPlotCenter (landObj) {
-            console.log(landObj,11111111)
+            if (!landObj.landRange) {
+                this.$message({
+                    message: '当前地块暂未绘制',
+                    type: 'warning'
+                })
+                return
+            }
             let center
             addPlotLayers.forEach(item => {
                 if (landObj.landName == item.name) {

--
Gitblit v1.9.3