更新实时轨迹4

master
tangwenkang 2023-12-03 19:50:41 +08:00
parent 4e8bb66df8
commit d76730c520
2 changed files with 18 additions and 16 deletions

View File

@ -244,6 +244,8 @@ export default {
marker: null,
lineArr: [],
vin:null,
carMsg:null,
carMsgTwo:{},
};
},
mounted() {
@ -253,18 +255,17 @@ export default {
this.getList()
this.listCarType()
this.listFence()
this.realMsg()
this.carMsg = setInterval(this.listRealTime,1000)
},
methods: {
realMsg(){
setInterval(() => {
//
listRealTime(){
listRealTime(this.vin).then(res=>{
console.log(res)
this.carMsgTwo = res.data
this.lineArr.push(res.longitude.replace(/"/g, "") +","+res.latitude.replace(/"/g, ""))
})
}, 1000); //
},
/*重置表单*/
resetForm() {
this.form = { // form

View File

@ -1,7 +1,7 @@
<script >
<script>
import AMapLoader from '@amap/amap-jsapi-loader';
import {deleteRecord, getList, historyMap} from "@/api/table";
import data from "@/views/system/dict/data.vue";
export default {
components: {},
props: {},
@ -18,10 +18,12 @@ export default {
endTime:null
},
arr:[],
lineArr:null
lineArr:null,
carMsg:{}
}
},
mounted() {
},
created() {
this.getList()
@ -45,11 +47,9 @@ export default {
this.recordCar.endTime = recordCar.endTime
historyMap(this.recordCar).then(res=>{
res.data.forEach(item=>{
this.carMsg = item
this.arr.push(item.longitude.replace(/"/g, "") +","+item.latitude.replace(/"/g, ""))
console.log(this.arr)
const result = this.arr.map(item => item.trim().replace(/'/g, '').split(','));
console.log(result)
this.lineArr = result
this.lineArr = this.arr.map(item => item.trim().replace(/'/g, '').split(','))
console.log(this.lineArr)
})
})
@ -137,6 +137,7 @@ export default {
<template>
<div>
<p>{{carMsg}}</p>
<div>
<el-form>