更新历史轨迹列表数据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() { export function getList() {
return request({ return request({
url: '/history/listHistoricalTrack', url: '/history/history/listHistoricalTrack',
method: 'get' method: 'get'
}) })
} }
export function deleteRecord(recordId) { export function deleteRecord(recordId) {
return request({ return request({
url: '/history/delHistoricalTrack?recordId='+recordId, url: '/history/history/delHistoricalTrack?recordId='+recordId,
method: 'post', method: 'post',
data:recordId data:recordId
}) })
} }
export function historyMap(recordCar) {
return request({
url: '/history/history/carRecord',
method: 'post',
data:recordCar
})
}

View File

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