From 471e5f234236f524c0c096fedbc04805700a3fa9 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Thu, 11 Jan 2024 10:16:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E8=AF=B7=E6=B1=82=E6=8E=A5=E5=8F=A3=E6=9C=AA?= =?UTF-8?q?=E5=B8=A6=E6=97=B6=E9=97=B4=E5=8F=82=E6=95=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../charts/entityDetail/EntityDetailMap.vue | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/views/charts2/charts/entityDetail/EntityDetailMap.vue b/src/views/charts2/charts/entityDetail/EntityDetailMap.vue index 49ac67f0..9e68ad7b 100644 --- a/src/views/charts2/charts/entityDetail/EntityDetailMap.vue +++ b/src/views/charts2/charts/entityDetail/EntityDetailMap.vue @@ -101,15 +101,16 @@ export default { } } }) - this.queryData().then(res => { - this.showError = false - const result = _.get(res, 'data.data.result', []).sort((a, b) => a.stat_time - b.stat_time) - const route = this.generateRouteGEOJSON(result) - const points = this.generatePointsGEOJSON(result) map.on('load', () => { - map.jumpTo({ center: this.computeMapCenter(result) }) - map.zoomTo(this.computeMapZoom(result)) + this.showError = false + const result = _.get(res, 'data.data.result', []).sort((a, b) => a.stat_time - b.stat_time) + const route = this.generateRouteGEOJSON(result) + const points = this.generatePointsGEOJSON(result) + if (result.length > 0) { + map.jumpTo({ center: this.computeMapCenter(result) }) + map.zoomTo(this.computeMapZoom(result)) + } map.loadImage( `${window.location.protocol}//${window.location.host}/images/entity-detail/track-point.png`, (error, image) => { @@ -194,7 +195,12 @@ export default { } }) })*/ - return axios.get(`${api.entity.locationTrack}?resource=${this.entity.entityName}`) + const params = { + resource: this.entity.entityName, + startTime: this.timeFilter.startTime, + endTime: this.timeFilter.endTime + } + return axios.get(`${api.entity.locationTrack}`, { params }) }, generateRouteGEOJSON (result) { return { @@ -299,8 +305,10 @@ export default { const points = this.generatePointsGEOJSON(result) this.myChart.getSource('route').setData(route) this.myChart.getSource('points').setData(points) - this.myChart.jumpTo({ center: this.computeMapCenter(result) }) - this.myChart.zoomTo(this.computeMapZoom(result)) + if (result.length > 0) { + this.myChart.jumpTo({ center: this.computeMapCenter(result) }) + this.myChart.zoomTo(this.computeMapZoom(result)) + } }).catch(e => { this.showError = true console.error(e)