更新实时轨迹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, marker: null,
lineArr: [], lineArr: [],
vin:null, vin:null,
carMsg:null,
carMsgTwo:{},
}; };
}, },
mounted() { mounted() {
@ -253,18 +255,17 @@ export default {
this.getList() this.getList()
this.listCarType() this.listCarType()
this.listFence() this.listFence()
this.realMsg() this.carMsg = setInterval(this.listRealTime,1000)
}, },
methods: { methods: {
realMsg(){ //
setInterval(() => { listRealTime(){
// listRealTime(this.vin).then(res=>{
listRealTime(this.vin).then(res=>{ console.log(res)
this.lineArr.push(res.longitude.replace(/"/g, "") +","+res.latitude.replace(/"/g, "")) this.carMsgTwo = res.data
}) this.lineArr.push(res.longitude.replace(/"/g, "") +","+res.latitude.replace(/"/g, ""))
}, 1000); // })
}, },
/*重置表单*/ /*重置表单*/
resetForm() { resetForm() {
this.form = { // form this.form = { // form

View File

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