更新历史轨迹列表数据2

master
tangwenkang 2023-12-01 13:55:02 +08:00
parent a8b9c1fcf1
commit 7ffaff98c6
2 changed files with 56 additions and 32 deletions

View File

@ -46,15 +46,24 @@ export function insertCar(carInsert) {
export function getList() {
return request({
url: '/history/listHistoricalTrack',
url: '/history/history/listHistoricalTrack',
method: 'get'
})
}
export function deleteRecord(recordId) {
return request({
url: '/history/delHistoricalTrack?recordId='+recordId,
url: '/history/history/delHistoricalTrack?recordId='+recordId,
method: 'post',
data:recordId
})
}
export function historyMap(recordCar) {
return request({
url: '/history/history/carRecord',
method: 'post',
data:recordCar
})
}

View File

@ -1,47 +1,54 @@
<script >
import path from "path";
import AMapLoader from '@amap/amap-jsapi-loader';
import {deleteRecord, getList} from "@/api/table";
import {deleteRecord, getList, historyMap} from "@/api/table";
export default {
components: {},
props: {},
data() {
return{
multiple: true,
duration:2000,
AMap: null,
map: null,
mouseTool: null,
historyList:[],
recordId:null,
recordCar:{
vin:null,
startTime:null,
endTime:null
},
lineArr: [
[116.478935,39.997761],
[116.478939,39.997825],
[116.478912,39.998549],
[116.478912,39.998549],
[116.478998,39.998555],
[116.478998,39.998555],
[116.479282,39.99856],
[116.479658,39.998528],
[116.480151,39.998453],
[116.480784,39.998302],
[116.480784,39.998302],
[116.481149,39.998184],
[116.481573,39.997997],
[116.481863,39.997846],
[116.482072,39.997718],
[116.482362,39.997718],
[116.483633,39.998935],
[116.48367,39.998968],
[116.484648,39.999861]],
// [116.478935,39.997761],
// [116.478939,39.997825],
// [116.478912,39.998549],
// [116.478912,39.998549],
// [116.478998,39.998555],
// [116.478998,39.998555],
// [116.479282,39.99856],
// [116.479658,39.998528],
// [116.480151,39.998453],
// [116.480784,39.998302],
// [116.480784,39.998302],
// [116.481149,39.998184],
// [116.481573,39.997997],
// [116.481863,39.997846],
// [116.482072,39.997718],
// [116.482362,39.997718],
// [116.483633,39.998935],
// [116.48367,39.998968],
// [116.484648,39.999861]
],
}
},
mounted() {
},
created() {
this.getList()
},
methods: {
deleteRecord(recordId){
deleteRecord(recordId).then(res=>{
this.recordId = recordId
deleteRecord(this.recordId).then(res=>{
this.$message.success("删除成功!")
location.reload()
})
},
@ -51,8 +58,15 @@ export default {
this.historyList = res.data
})
},
doDo(){
// this.$router.push('/cmpany/firm')
doDo(recordCar){
this.recordCar.vin = recordCar.vin
this.recordCar.startTime = recordCar.startTime
this.recordCar.endTime = recordCar.endTime
historyMap(this.recordCar).then(res=>{
console.log(res)
this.lineArr = res.data
})
this.initMap()
this.startAnimation()
},
@ -110,7 +124,6 @@ export default {
// marker
this.marker.on('moving', (e) => {
console.log('marker动了', e)
this.passedPolyline.setPath(e.passedPath); //
this.map.setCenter(e.target.getPosition(), true) //
});
@ -165,7 +178,7 @@ export default {
<el-table-column label="VIN">
<template slot-scope="scope">
{{scope.row.carVin}}
{{scope.row.vin}}
</template>
</el-table-column>
<el-table-column label="开始时间">
@ -174,11 +187,13 @@ export default {
</template>
</el-table-column>
<el-table-column label="结束时间">
<template slot-scope="scope">
{{scope.row.endTime}}
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button @click="doDo" type="text">历史轨迹</el-button>
<el-button @click="doDo(scope.row)" type="text">历史轨迹</el-button>
<el-button type="info" @click="deleteRecord(scope.row.recordId)"></el-button>
</template>
</el-table-column>