From e79998e0764d6d00b050363bdeda48519a1f0c31 Mon Sep 17 00:00:00 2001 From: 陈泽平 <chenzeping> Date: 星期五, 28 五月 2021 20:21:06 +0800 Subject: [PATCH] 企业应急-事件上报-位置定位修改 --- src/components/base-page/enterprise-emergency/events-reported/ReportLocationSearch.vue | 35 ++++++++++++++++++++--------------- 1 files changed, 20 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 77ed826..71d6826 100644 --- a/src/components/base-page/enterprise-emergency/events-reported/ReportLocationSearch.vue +++ b/src/components/base-page/enterprise-emergency/events-reported/ReportLocationSearch.vue @@ -12,7 +12,8 @@ <script> import { reportLocationSearch } from '../../../../api/request' -// import { pulseEffect } from '../../../../utils/utils' +import { pulseEffect } from '../../../../utils/utils' +import eventBus from '../../../../eventBus' export default { name: 'ReportLocationSearch', data () { @@ -24,9 +25,9 @@ methods: { // 鑾峰緱鐒︾偣 杩涜瀹氫綅 focusLocation () { - console.log(this.clickLocation) - console.log(window.map.getZoom()) - console.log(window.map.getBounds()) + // console.log(this.clickLocation) + // console.log(window.map.getZoom()) + // console.log(window.map.getBounds()) const getBoundsData = '' + window.map.getBounds()._southWest.lng + ',' + window.map.getBounds()._southWest.lat + ',' + window.map.getBounds()._northEast.lng + ',' + window.map.getBounds()._northEast.lat const data = { postStr: { @@ -40,23 +41,27 @@ }, type: 'query' } - console.log(data) + // console.log(data) reportLocationSearch(data).then(res => { - // console.log(res) - const as = res.pois[0].lonlat.trim().split(' ') - window.map.setView([as[1], as[0]], 17) - // for (let i = 0; i < res.pois.length; i++) { - // const as = res.pois[i].lonlat.trim().split(' ') - // window.map.flyTo([as[0], as[1]], 16) - // } - // window.map.setView(as, 17) + console.log(res) + // 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]]) + } + } }) }, // 鐐瑰嚮纭鎸夐挳浜嬩欢 confirm () { // 閫氳繃瀛愮粍浠跺悜鐖剁粍浠朵紶閫掓暟鎹� - this.$emit('locationClick', this.LongLatPos) - console.log('鎼滅储瀹氫綅') + // this.$emit('locationClick', this.LongLatPos) + eventBus.$emit('location-setChange', true) + // console.log('鎼滅储瀹氫綅') } } } -- Gitblit v1.8.0