From b761c4fdc7894105e6dd98a5f5edd300959b85e0 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Fri, 12 Jan 2024 14:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/datav/index.vue | 18 +++++++++++++----- src/views/project/space/task.vue | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/views/datav/index.vue b/src/views/datav/index.vue index b30daae..47ebe70 100644 --- a/src/views/datav/index.vue +++ b/src/views/datav/index.vue @@ -41,6 +41,7 @@ import { resume, liaisonMan, } from "../../api/user"; +import { notice } from '../../assets/js/notice'; export default { name: "datav", @@ -56,6 +57,8 @@ export default { name: "全部", }, member_list: [], + markers: [], + polyline: null, }; }, created() { @@ -115,7 +118,7 @@ export default { // 添加标记点 res.data.forEach((item) => { if (item.positioning) { - new AMap.Marker({ + let marker = new AMap.Marker({ position: item.positioning.split(","), map: this.map, content: ` @@ -133,12 +136,15 @@ export default { `, offset: new AMap.Pixel(-20, -20), }); + this.markers.push(marker); } }); }); }, initList() { if(!this.now_user.member_code||!this.now_date) return; + this.map.remove(this.markers); + if(this.polyline)this.polyline.setMap(null); positioningMember({ code: this.now_user.member_code, date: this.formatDate(new Date(this.now_date||Date.now())), @@ -147,10 +153,9 @@ export default { return item.split(","); })||[]; - if(path.length==0)return; - + if(path.length==0) return notice({title: '该成员当日无轨迹信息'}, 'error', 3000); // 绘制轨迹 - let polyline = new AMap.Polyline({ + this.polyline = new AMap.Polyline({ path: path, strokeColor: "#52c41a", strokeWeight: 5, @@ -158,7 +163,10 @@ export default { strokeStyle: "solid", zIndex: 50, }); - polyline.setMap(this.map); + this.polyline.setMap(this.map); + }).catch(err=>{ + console.log(err); + return notice({title: '该成员当日无轨迹信息'}, 'error', 3000); }); }, }, diff --git a/src/views/project/space/task.vue b/src/views/project/space/task.vue index efd5344..f252e77 100644 --- a/src/views/project/space/task.vue +++ b/src/views/project/space/task.vue @@ -83,7 +83,7 @@