This commit is contained in:
weipengfei 2024-01-12 14:28:31 +08:00
parent 8768cd61f9
commit b761c4fdc7
2 changed files with 14 additions and 6 deletions

View File

@ -41,6 +41,7 @@ import {
resume, resume,
liaisonMan, liaisonMan,
} from "../../api/user"; } from "../../api/user";
import { notice } from '../../assets/js/notice';
export default { export default {
name: "datav", name: "datav",
@ -56,6 +57,8 @@ export default {
name: "全部", name: "全部",
}, },
member_list: [], member_list: [],
markers: [],
polyline: null,
}; };
}, },
created() { created() {
@ -115,7 +118,7 @@ export default {
// //
res.data.forEach((item) => { res.data.forEach((item) => {
if (item.positioning) { if (item.positioning) {
new AMap.Marker({ let marker = new AMap.Marker({
position: item.positioning.split(","), position: item.positioning.split(","),
map: this.map, map: this.map,
content: ` content: `
@ -133,12 +136,15 @@ export default {
`, `,
offset: new AMap.Pixel(-20, -20), offset: new AMap.Pixel(-20, -20),
}); });
this.markers.push(marker);
} }
}); });
}); });
}, },
initList() { initList() {
if(!this.now_user.member_code||!this.now_date) return; if(!this.now_user.member_code||!this.now_date) return;
this.map.remove(this.markers);
if(this.polyline)this.polyline.setMap(null);
positioningMember({ positioningMember({
code: this.now_user.member_code, code: this.now_user.member_code,
date: this.formatDate(new Date(this.now_date||Date.now())), date: this.formatDate(new Date(this.now_date||Date.now())),
@ -147,10 +153,9 @@ export default {
return item.split(","); 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, path: path,
strokeColor: "#52c41a", strokeColor: "#52c41a",
strokeWeight: 5, strokeWeight: 5,
@ -158,7 +163,10 @@ export default {
strokeStyle: "solid", strokeStyle: "solid",
zIndex: 50, zIndex: 50,
}); });
polyline.setMap(this.map); this.polyline.setMap(this.map);
}).catch(err=>{
console.log(err);
return notice({title: '该成员当日无轨迹信息'}, 'error', 3000);
}); });
}, },
}, },

View File

@ -83,7 +83,7 @@
</ul> </ul>
</section> </section>
<div class="project-nav-footer"> <div class="project-nav-footer">
<a class="footer-item" @click.stop="addTask()"> <a class="footer-item" v-if="userInfo.authorize!=4" @click.stop="addTask()">
<a-icon type="plus-circle"></a-icon> <a-icon type="plus-circle"></a-icon>
<span> 创建任务</span> <span> 创建任务</span>
</a> </a>