更新实时轨迹4
parent
4e8bb66df8
commit
d76730c520
|
@ -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对象重置为空对象或者你定义的初始值
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue