From 71c663091d05b11c41f78d8e75cb8b3db63b9cbc Mon Sep 17 00:00:00 2001
From: yangdelong <828900aaa>
Date: 星期六, 29 五月 2021 16:26:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/develop' into develop

---
 src/components/base-page/enterprise-emergency/events-reported/ReportLocationSearch.vue |   90 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 75 insertions(+), 15 deletions(-)

diff --git a/src/components/base-page/enterprise-emergency/events-reported/ReportLocationSearch.vue b/src/components/base-page/enterprise-emergency/events-reported/ReportLocationSearch.vue
index 71d6826..a96d691 100644
--- a/src/components/base-page/enterprise-emergency/events-reported/ReportLocationSearch.vue
+++ b/src/components/base-page/enterprise-emergency/events-reported/ReportLocationSearch.vue
@@ -3,8 +3,23 @@
         <el-row>
             <el-input type="text" v-model="clickLocation" clearable @change="focusLocation"></el-input>
         </el-row>
-        <el-row>
-            <el-button type="primary" @click="confirm" style="text-align: right">纭</el-button>
+        <el-scrollbar style="height:86.22px">
+            <el-row v-for="(item,index) in searchList" :key="index" style="display: flex;align-items: center">
+                <el-col :span="12">
+                    <span>{{ item.name }}</span>
+                </el-col>
+                <el-col :span="12">
+                    <el-button type="primary" size="mini" icon="el-icon-position" @click="locationMapClick(item)">瀹氫綅
+                    </el-button>
+                </el-col>
+                <!--            <el-pagination-->
+                <!--                    layout="prev, pager, next"-->
+                <!--                    :total="50">-->
+                <!--            </el-pagination>-->
+            </el-row>
+        </el-scrollbar>
+        <el-row style="text-align: right">
+            <el-button type="primary" @click="confirm">纭</el-button>
         </el-row>
     </div>
 </template>
@@ -14,16 +29,19 @@
 import { reportLocationSearch } from '../../../../api/request'
 import { pulseEffect } from '../../../../utils/utils'
 import eventBus from '../../../../eventBus'
+import iconUrl from '../../../../../public/assets/images/map/loc.png'
+
 export default {
   name: 'ReportLocationSearch',
   data () {
     return {
       // 鐐瑰嚮瀹氫綅缁戝畾鏁版嵁
-      clickLocation: ''
+      clickLocation: '',
+      searchList: []
     }
   },
   methods: {
-    // 鑾峰緱鐒︾偣 杩涜瀹氫綅
+    // 鎼滅储瀹氫綅
     focusLocation () {
       // console.log(this.clickLocation)
       // console.log(window.map.getZoom())
@@ -43,31 +61,73 @@
       }
       // console.log(data)
       reportLocationSearch(data).then(res => {
-        console.log(res)
+        // console.log(res)
+        this.searchList = res.pois
+        // console.log(this.searchList)
         // const as = res.pois[0].lonlat.trim().split(' ')
         // window.map.setView([as[1], as[0]], 17)
         // pulseEffect([as[1], as[0]])
-        for (let i = 0; i < res.pois.length; i++) {
-          const as = res.pois[i].lonlat.trim().split(' ')
-          if (res.pois[i].name.indexOf(this.clickLocation) >= 0) {
-            window.map.setView([as[1], as[0]], 17)
-            pulseEffect([as[1], as[0]])
-          }
-        }
+        // for (let i = 0; i < res.pois.length; i++) {
+        //   const as = res.pois[i].lonlat.trim().split(' ')
+        //   if (res.pois[i].name.indexOf(this.clickLocation) >= 0) {
+        //     window.map.setView([as[1], as[0]], 17)
+        //     pulseEffect([as[1], as[0]])
+        //   }
+        // }
       })
+      this.clickLocation = ''
+    },
+    // 鐐瑰嚮瀹氫綅
+    locationMapClick (val) {
+      console.log(val)
+      const ps = val.lonlat.trim().split(' ')
+      // const htmls = '<div><ul><li>' + val.name + '</li> + <li>' + val.adress + '</li></ul></div>'
+      // var myIcon = window.L.divIcon({
+      //   html: htmls,
+      //   className: 'company-bindTooltip',
+      //   iconSize: 16
+      // })
+      const htmls = '<div><ul><li>' + val.name + '</li> <br/> <li>' + val.address + '</li> <br/> <li>' + val.phone + '</li></ul></div>'
+      const marker = window.L.marker([ps[1], ps[0]], {
+        icon: window.L.icon({
+          iconUrl: iconUrl,
+          iconSize: [30, 30],
+          iconAnchor: [15, 15]
+        })
+        // icon: myIcon
+      })
+        .bindTooltip(htmls, {
+          // permanent: 'true',
+          direction: 'bottom',
+          offset: [0, 10],
+          sticky: true,
+          className: ''
+        })
+      window.map.addLayer(marker)
+      window.map.setView([ps[1], ps[0]], 17)
+      pulseEffect([ps[1], ps[0]])
     },
     // 鐐瑰嚮纭鎸夐挳浜嬩欢
     confirm () {
-      // 閫氳繃瀛愮粍浠跺悜鐖剁粍浠朵紶閫掓暟鎹�
-      // this.$emit('locationClick', this.LongLatPos)
+      this.searchList = []
+      this.clickLocation = ''
       eventBus.$emit('location-setChange', true)
-      // console.log('鎼滅储瀹氫綅')
     }
   }
 }
 </script>
 
 <style lang="less" scoped>
+    /*/deep/ .el-row {*/
+    /*    margin: 2px 0 !important;*/
+    /*    padding: 0;*/
+    /*    height: 10px;*/
+    /*    max-height: 10px;*/
+    /*}*/
+    .div-list-search {
+
+    }
+
     .click-location {
         margin: 0 auto;
         text-align: center;

--
Gitblit v1.8.0