fix bug
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-02-22 13:53:29
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-03-02 16:02:51
|
||||
* @LastEditTime : 2022-03-08 16:11:58
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\view-track\\view-track.component.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
@ -35,8 +35,9 @@ export class OneCarOrderViewtrackComponent implements OnInit {
|
||||
i: any; // 单行数据
|
||||
MapList:any[] = []; //地图点位数据组
|
||||
trajectory = 'car';
|
||||
mapList:any[] = []; //地图点位数据组
|
||||
addressItems: any[] = []; //打点地址数据组
|
||||
logColumns: STColumn[] = [
|
||||
logColumns2: STColumn[] = [
|
||||
{ title: '时间', index: 'vinOutTime' },
|
||||
{ title: '地点', index: 'cityName' },
|
||||
];
|
||||
@ -49,12 +50,15 @@ export class OneCarOrderViewtrackComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
console.log(this.i);
|
||||
this.MapInit();
|
||||
this.getTrajectory();
|
||||
|
||||
}
|
||||
// 获取轨迹
|
||||
MapInit() {
|
||||
this.service.request(this.service.$api_get_getTrajectory, { id: this.i.id }).subscribe(res => {
|
||||
close(value: boolean): void {
|
||||
this.modalRef.close(false);
|
||||
}
|
||||
// 获取车辆轨迹
|
||||
getTrajectory(){
|
||||
this.service.request(this.service.$api_get_getTrajectory, { id: this.i?.id }).subscribe(res => {
|
||||
if (res) {
|
||||
const points = res.trackArray;
|
||||
let list :any[] = [];
|
||||
@ -64,8 +68,7 @@ export class OneCarOrderViewtrackComponent implements OnInit {
|
||||
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))]
|
||||
});
|
||||
});
|
||||
this.MapList = list;
|
||||
// this.addressItems = res.parkArray;
|
||||
this.mapList = list;
|
||||
this.addressItems = res.cityArray;
|
||||
if(this.addressItems && this.addressItems.length > 0){
|
||||
this.addressItems.forEach(item => {
|
||||
@ -75,10 +78,38 @@ export class OneCarOrderViewtrackComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
close(value: boolean): void {
|
||||
this.modalRef.close(false);
|
||||
}
|
||||
getLocalTime(time: any) {
|
||||
return format(new Date(parseInt(time)), 'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
||||
|
||||
// 获取司机轨迹
|
||||
getDriverTrajectory(){
|
||||
this.service.request(this.service.$api_get_getAppDriverPosition, { id: this.i?.id }).subscribe(res => {
|
||||
if (res) {
|
||||
const points = res.tracks;
|
||||
let list :any[] = [];
|
||||
points?.forEach((item: any) => {
|
||||
list.push({
|
||||
name: item.hgt,
|
||||
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))]
|
||||
});
|
||||
});
|
||||
this.mapList = list;
|
||||
this.addressItems = [...res.enclosureDataAppTrack];
|
||||
if(this.addressItems && this.addressItems.length > 0){
|
||||
this.addressItems.forEach(item => {
|
||||
item.vinOutTime = this.getLocalTime(item.gtm);
|
||||
item.cityName = item.appAdress;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
trajectoryChange(event:any){
|
||||
if(event ==='car'){
|
||||
this.getTrajectory()
|
||||
}else if(event ==='driver'){
|
||||
this.getDriverTrajectory();
|
||||
}
|
||||
}
|
||||
getLocalTime(time: any) {
|
||||
return format(new Date(parseInt(time)), 'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user