历史轨迹更新

master
tangwenkang 2023-11-26 21:50:30 +08:00
parent 45c1a5a1f2
commit 40a711b5ca
2 changed files with 11 additions and 6 deletions

View File

@ -43,3 +43,4 @@ export function insertCar(carInsert) {
data:carInsert data:carInsert
}) })
} }

View File

@ -199,7 +199,7 @@ export default {
equipmentId: String, equipmentId: String,
}, },
beforeDestroy() { beforeDestroy() {
this.map && this.map.destroy();// // this.map && this.map.destroy();//
}, },
data() { data() {
return { return {
@ -265,8 +265,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.initMap()
this.startAnimation()
}, },
created() { created() {
this.getList() this.getList()
@ -289,6 +288,8 @@ export default {
isShowAll(){ isShowAll(){
this.isShow = true this.isShow = true
this.isList = false this.isList = false
// this.map.destroy();//
location.reload()
}, },
insertCar(){ insertCar(){
insertCar(this.carInsert).then(res=>{ insertCar(this.carInsert).then(res=>{
@ -316,6 +317,8 @@ export default {
realTimeTrajectory(){ realTimeTrajectory(){
this.isShow = false this.isShow = false
this.isList = true this.isList = true
this.initMap()
this.startAnimation()
}, },
/*刷新*/ /*刷新*/
refreshTable(){ refreshTable(){
@ -379,14 +382,14 @@ export default {
"AMap.DragRoute", "AMap.DragRoute",
"AMap.MoveAnimation"], // 使'AMap.Scale' "AMap.MoveAnimation"], // 使'AMap.Scale'
}).then((AMap) => { }).then((AMap) => {
// DOM // DOM
this.map = new AMap.Map("container", { //id this.map = new AMap.Map("container", { //id
resizeEnable: true, resizeEnable: true,
viewMode: "3D", // 使3D viewMode: "3D", // 使3D
zoomEnable: true, // true zoomEnable: true, // true
dragEnable: true, // true dragEnable: true, // true
doubleClickZoom: true, // true doubleClickZoom: true, // true
zoom: 13, // zoom: 17, //
center: this.lineArr[0], // center: this.lineArr[0], //
// mapStyle: "amap://styles/darkblue", // // mapStyle: "amap://styles/darkblue", //
}) })
@ -418,13 +421,14 @@ export default {
// marker // marker
this.marker.on('moving', (e) => { this.marker.on('moving', (e) => {
console.log('marker动了', e)
this.passedPolyline.setPath(e.passedPath); // this.passedPolyline.setPath(e.passedPath); //
this.map.setCenter(e.target.getPosition(), true) // this.map.setCenter(e.target.getPosition(), true) //
}); });
this.map.setFitView(); // this.map.setFitView(); //
}).catch(e => {
console.log(e)
}) })
}, },
startAnimation () { startAnimation () {