Merge branch 'develop' of https://gitlab.eascs.com/tms-ui/tms-obc-web into develop

This commit is contained in:
潘晓云
2022-04-13 09:54:13 +08:00
10 changed files with 122 additions and 69 deletions

View File

@ -968,7 +968,8 @@ export class OrderManagementBulkDetailChangeComponent implements OnInit {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;
@ -991,7 +992,8 @@ export class OrderManagementBulkDetailChangeComponent implements OnInit {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;

View File

@ -25,7 +25,7 @@ import format from 'date-fns/format';
styleUrls: ['./bulk-detail.component.less'] styleUrls: ['./bulk-detail.component.less']
}) })
export class OrderManagementBulkeDetailComponent implements OnInit { export class OrderManagementBulkeDetailComponent implements OnInit {
MapList: any[]=[]; MapList: any[] = [];
id = this.route.snapshot.params.id; id = this.route.snapshot.params.id;
billExpenses: any[] = []; //运费信息表格信息 billExpenses: any[] = []; //运费信息表格信息
pois: any[] = []; pois: any[] = [];
@ -35,11 +35,11 @@ export class OrderManagementBulkeDetailComponent implements OnInit {
totalObj: any; totalObj: any;
attObj: any; attObj: any;
modalcontent: any; modalcontent: any;
modalTitle:string = ''; modalTitle: string = '';
isVisible = false; isVisible = false;
logColumns2: STColumn[] = [ logColumns2: STColumn[] = [
{ title: '时间', index: 'vinOutTime' }, { title: '时间', index: 'vinOutTime' },
{ title: '地点', index: 'cityName' }, { title: '地点', index: 'cityName' }
]; ];
logColumns: STColumn[] = [ logColumns: STColumn[] = [
{ title: '款项', index: 'expenseCodeLabel' }, { title: '款项', index: 'expenseCodeLabel' },
@ -62,20 +62,19 @@ export class OrderManagementBulkeDetailComponent implements OnInit {
} }
]; ];
trajectory = 'car'; trajectory = 'car';
mapList:any[] = []; //地图点位数据组 mapList: any[] = []; //地图点位数据组
addressItems:any[] = []; //打点地址数据组 addressItems: any[] = []; //打点地址数据组
constructor( constructor(
public route: ActivatedRoute, public route: ActivatedRoute,
private msgSrv: NzMessageService, private msgSrv: NzMessageService,
private service: OrderManagementService, private service: OrderManagementService,
private router: Router, private router: Router,
private modal: NzModalService private modal: NzModalService
) { ) {}
}
ngOnInit(): void { ngOnInit(): void {
console.log(this.route?.snapshot?.queryParams?.sts); console.log(this.route?.snapshot?.queryParams?.sts);
this.initData(); this.initData();
this.getTrajectory(); this.getTrajectory();
} }
@ -85,34 +84,36 @@ export class OrderManagementBulkeDetailComponent implements OnInit {
if (res) { if (res) {
this.i = res; this.i = res;
this.billExpenses = this.i?.billExpenseDetails?.filter((data: any) => data.expenseCode === 'TRA'); this.billExpenses = this.i?.billExpenseDetails?.filter((data: any) => data.expenseCode === 'TRA');
this.i.scheduleVOList = this.i?.scheduleVOList?.filter((data:any)=>data.displayStatus !=="HIDE"); this.i.scheduleVOList = this.i?.scheduleVOList?.filter((data: any) => data.displayStatus !== 'HIDE');
this.pois = [ this.pois = [
{ {
markerLabel: '', markerLabel: '',
color: 'blue', color: 'blue',
position: [res.startingPoint.longitude, res.startingPoint.latitude], position: [res.startingPoint.longitude, res.startingPoint.latitude],
title: res.startingPoint.detailedAddress title: '发货地:' + res.startingPoint.detailedAddress,
time: '计划出发时间:' + res.loadPlanTime
}, },
{ {
markerLabel: '卸', markerLabel: '卸',
color: 'red', color: 'red',
position: [res.endPoint.longitude, res.endPoint.latitude], position: [res.endPoint.longitude, res.endPoint.latitude],
title: res.endPoint.detailedAddress title: '卸货地地:' + res.endPoint.detailedAddress,
time: '计划卸货时间:' + res.unloadPlanTime
} }
]; ];
} }
}); });
this.service.request(this.service.$api_listBillComplianceAbnormalByBillId, { id: this.id }).subscribe(res => { this.service.request(this.service.$api_listBillComplianceAbnormalByBillId, { id: this.id }).subscribe(res => {
if (res) { if (res) {
console.log('风险详情') console.log('风险详情');
console.log(res) console.log(res);
this.abnormalList = res this.abnormalList = res;
} }
}); });
this.service.request(this.service.$api_getAbnormalWarningByBillId, { id: this.id }).subscribe(res => { this.service.request(this.service.$api_getAbnormalWarningByBillId, { id: this.id }).subscribe(res => {
if (res) { if (res) {
console.log('异常预警') console.log('异常预警');
console.log(res) console.log(res);
} }
}); });
} }
@ -125,12 +126,12 @@ export class OrderManagementBulkeDetailComponent implements OnInit {
this.router.navigate(['order-management/bulk-detailChange', this.id]); this.router.navigate(['order-management/bulk-detailChange', this.id]);
} }
agreement(value: any) { agreement(value: any) {
if(value ==='1'){ if (value === '1') {
this.modalTitle = '附件信息'; this.modalTitle = '附件信息';
// this.modalcontent = this.i?.contractContent?.contractContent; // this.modalcontent = this.i?.contractContent?.contractContent;
// this.service.reviewPDF(this.i?.contractContent?.contractFilePath) // this.service.reviewPDF(this.i?.contractContent?.contractFilePath)
this.service.openURL(this.i?.contractContent?.contractFilePath); this.service.openURL(this.i?.contractContent?.contractFilePath);
}else if(value === '2'){ } else if (value === '2') {
this.modalTitle = '补充协议'; this.modalTitle = '补充协议';
this.modalcontent = this.i?.supplementContent?.contractContent; this.modalcontent = this.i?.supplementContent?.contractContent;
this.isVisible = true; this.isVisible = true;
@ -164,20 +165,21 @@ export class OrderManagementBulkeDetailComponent implements OnInit {
} }
// 获取车辆轨迹 // 获取车辆轨迹
getTrajectory(){ getTrajectory() {
this.service.request(this.service.$api_get_getTrajectory, { id: this.id }).subscribe(res => { this.service.request(this.service.$api_get_getTrajectory, { id: this.id }).subscribe(res => {
if (res) { if (res) {
const points = res.trackArray; const points = res.trackArray;
let list :any[] = []; let list: any[] = [];
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;
this.addressItems = res.cityArray; this.addressItems = res.cityArray;
if(this.addressItems && this.addressItems.length > 0){ if (this.addressItems && this.addressItems.length > 0) {
this.addressItems.forEach(item => { this.addressItems.forEach(item => {
item.vinOutTime = this.getLocalTime(item.vinOutTime); item.vinOutTime = this.getLocalTime(item.vinOutTime);
}); });
@ -186,21 +188,22 @@ export class OrderManagementBulkeDetailComponent implements OnInit {
}); });
} }
// 获取司机轨迹 // 获取司机轨迹
getDriverTrajectory(){ getDriverTrajectory() {
this.service.request(this.service.$api_get_getAppDriverPosition, { id: this.id }).subscribe(res => { this.service.request(this.service.$api_get_getAppDriverPosition, { id: this.id }).subscribe(res => {
if (res) { if (res) {
const points = res.tracks; const points = res.tracks;
let list :any[] = []; let list: any[] = [];
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;
this.addressItems = [...res.enclosureDataAppTrack]; this.addressItems = [...res.enclosureDataAppTrack];
if(this.addressItems && this.addressItems.length > 0){ if (this.addressItems && this.addressItems.length > 0) {
this.addressItems.forEach(item => { this.addressItems.forEach(item => {
item.vinOutTime = this.getLocalTime(item.gtm); item.vinOutTime = this.getLocalTime(item.gtm);
item.cityName = item.appAdress; item.cityName = item.appAdress;
@ -208,14 +211,14 @@ export class OrderManagementBulkeDetailComponent implements OnInit {
} }
} }
}); });
} }
trajectoryChange(event:any){ trajectoryChange(event: any) {
if(event ==='car'){ if (event === 'car') {
this.getTrajectory() this.getTrajectory();
}else if(event ==='driver'){ } else if (event === 'driver') {
this.getDriverTrajectory(); this.getDriverTrajectory();
} }
} }
getLocalTime(time: any) { getLocalTime(time: any) {
return format(new Date(parseInt(time)), 'yyyy-MM-dd HH:mm:ss'); return format(new Date(parseInt(time)), 'yyyy-MM-dd HH:mm:ss');
} }

View File

@ -923,7 +923,8 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;
@ -946,7 +947,8 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;

View File

@ -77,16 +77,18 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
this.i = res; this.i = res;
this.pois = [ this.pois = [
{ {
markerLabel: '', markerLabel: '',
color: 'blue', color: 'blue',
position: [res.startingPoint.longitude, res.startingPoint.latitude], position: [res.startingPoint.longitude, res.startingPoint.latitude],
title: res.startingPoint.detailedAddress title: '发货地:' + res.startingPoint.detailedAddress,
time: '计划出发时间:' +res.loadPlanTime
}, },
{ {
markerLabel: '卸', markerLabel: '卸',
color: 'red', color: 'red',
position: [res.endPoint.longitude, res.endPoint.latitude], position: [res.endPoint.longitude, res.endPoint.latitude],
title: res.endPoint.detailedAddress title: '卸货地地:' + res.endPoint.detailedAddress,
time: '计划卸货时间:' + res.unloadPlanTime
} }
]; ];
this.billExpenses = this.i?.billExpenseDetails?.filter( this.billExpenses = this.i?.billExpenseDetails?.filter(
@ -188,7 +190,8 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;
@ -210,6 +213,9 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
} }
} }
getLocalTime(time: any) { getLocalTime(time: any) {
if (!time) {
return '';
}
return format(new Date(parseInt(time)), 'yyyy-MM-dd HH:mm:ss'); return format(new Date(parseInt(time)), 'yyyy-MM-dd HH:mm:ss');
} }
} }

View File

@ -65,7 +65,8 @@ export class OneCarOrderViewtrackComponent implements OnInit {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;
@ -88,7 +89,8 @@ export class OneCarOrderViewtrackComponent implements OnInit {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;

View File

@ -51,7 +51,7 @@ export class TaxManagementOrderVerifyResultComponent implements OnInit {
beforeReq = (requestOptions: STRequestOptions) => {let a: string = ''; beforeReq = (requestOptions: STRequestOptions) => {let a: string = '';
switch (this.subjectType) { switch (this.subjectType) {
case '0': case '0':
a = this.record?.networkTransporter; a = this.record?.networkTransporterId;
break break
case '1': case '1':
a = this.record?.shipperId; a = this.record?.shipperId;
@ -60,7 +60,7 @@ export class TaxManagementOrderVerifyResultComponent implements OnInit {
a = this.record?.driverId; a = this.record?.driverId;
break break
case '3': case '3':
a = this.record?.billId; a = this.record?.wayBillId;
break break
} }
Object.assign(requestOptions.body, { Object.assign(requestOptions.body, {

View File

@ -167,7 +167,8 @@ sureArrive(item: any) {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;
@ -190,7 +191,8 @@ sureArrive(item: any) {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;

View File

@ -160,7 +160,8 @@ export class WaybillManagementVehicleDetailComponent implements OnInit, OnDestro
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;
@ -183,7 +184,8 @@ export class WaybillManagementVehicleDetailComponent implements OnInit, OnDestro
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: item.hgt, name: item.hgt,
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))] lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))],
time: item.gtm
}); });
}); });
this.mapList = list; this.mapList = list;

View File

@ -48,15 +48,18 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
@Output() @Output()
readonly clcikPointEvent = new EventEmitter<any>(); readonly clcikPointEvent = new EventEmitter<any>();
constructor(public service: BaseService, private amapService: AmapService) {} constructor(public service: BaseService, private amapService: AmapService) {
this.mapInit();
}
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
// 路线图变更: 设置路线图, 指定路线图 // 路线图变更: 设置路线图, 指定路线图
if (changes?.pathList?.currentValue && this?.pathSimplifierIns) { if (changes?.pathList?.currentValue && this?.pathSimplifierIns) {
this.setData(changes.pathList?.currentValue); this.setData(changes.pathList?.currentValue);
this.setPathIndex(this.selectedIndex); this.setPathIndex(this.selectedIndex);
} }
// 路径信息变更: 更新路线图, 设置路线图, 指定路线图, 获取终点地址信息并标点 // 路径信息变更: 更新路线图, 设置路线图, 指定路线图, 获取终点地址信息并标点
if (changes?.mapList?.currentValue && this?.pathSimplifierIns && changes.mapList?.currentValue.length > 0) { if (changes?.mapList?.currentValue) {
// console.log(this.mapList); // console.log(this.mapList);
this.pathList = [ this.pathList = [
{ {
@ -64,22 +67,29 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
points: changes.mapList?.currentValue points: changes.mapList?.currentValue
} }
]; ];
this.setData(this.pathList); if (this?.pathSimplifierIns) {
this.setPathIndex(this.selectedIndex); this.setData(this.pathList);
this.getPoiByPositon(this.mapList[this.mapList?.length - 1]?.lnglat); if (changes.mapList?.currentValue.length > 0) {
this.setPathIndex(this.selectedIndex);
this.getPoiByPositon('起', 'blue', this.mapList[0]?.lnglat, '时间:' + this.amapService.formatTime(this.mapList[0]?.time));
this.getPoiByPositon(
'终',
'red',
this.mapList[this.mapList?.length - 1]?.lnglat,
'时间:' + this.amapService.formatTime(this.mapList[this.mapList?.length - 1]?.time)
);
}
}
} }
// 标点列表变更: 更新标点数据, 绘画标点 // 标点列表变更: 更新标点数据, 绘画标点
if (changes?.pois?.currentValue) { if (changes?.pois?.currentValue) {
// console.log(this.pois);
this._pois = changes?.pois?.currentValue; this._pois = changes?.pois?.currentValue;
if (this?.markerList && this._pois.length > 0) { if (this?.markerList && this._pois.length > 0) {
this.markerList.render(this._pois); this.markerList.render(this._pois);
} }
} }
} }
ngOnInit(): void { ngOnInit(): void {}
this.mapInit();
}
ngOnDestroy(): void { ngOnDestroy(): void {
// 销毁地图数据 // 销毁地图数据
if (this.aMap) { if (this.aMap) {
@ -145,6 +155,13 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
if (this.pathList.length > 0) { if (this.pathList.length > 0) {
this.setPathIndex(this.selectedIndex); this.setPathIndex(this.selectedIndex);
this.getPoiByPositon('起', 'blue', this.mapList[0]?.lnglat, '时间:' + this.amapService.formatTime(this.mapList[0]?.time));
this.getPoiByPositon(
'终',
'red',
this.mapList[this.mapList?.length - 1]?.lnglat,
'时间:' + this.amapService.formatTime(this.mapList[this.mapList?.length - 1]?.time)
);
} }
this.pathSimplifierIns.on('pointClick', (e: any, info: any) => { this.pathSimplifierIns.on('pointClick', (e: any, info: any) => {
@ -159,6 +176,9 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
content: ` content: `
<label style="font-weight: bold;">${result.regeocode.formattedAddress}<label/><br/> <label style="font-weight: bold;">${result.regeocode.formattedAddress}<label/><br/>
<label style="font-weight: 400;">车速: ${info.pathData.points[info.pointIndex].name}<label/><br/> <label style="font-weight: 400;">车速: ${info.pathData.points[info.pointIndex].name}<label/><br/>
<label style="font-weight: 400;">东经: ${info.pathData.points[info.pointIndex].lnglat?.[0]}, 北纬:${
info.pathData.points[info.pointIndex].lnglat?.[1]
}<label/><br/>
<label style="font-weight: 400;">时间: ${this.amapService.formatTime(info.pathData.points[info.pointIndex].time)}<label/> <label style="font-weight: 400;">时间: ${this.amapService.formatTime(info.pathData.points[info.pointIndex].time)}<label/>
` `
}); });
@ -179,12 +199,13 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
//返回数据项对应的Marker //返回数据项对应的Marker
getMarker: (dataItem: POI, context: any, recycledMarker: any) => { getMarker: (dataItem: POI, context: any, recycledMarker: any) => {
//存在可回收利用的marker //存在可回收利用的marker
if (recycledMarker) { // if (recycledMarker) {
//直接更新内容返回 // //直接更新内容返回
recycledMarker.setIconLabel(context.id); // recycledMarker.setIconLabel(context.id);
recycledMarker.setIconStyle(dataItem.color); // recycledMarker.setIconStyle(dataItem.color);
return recycledMarker; // return recycledMarker;
} // }
this.SimpleMarker = SimpleMarker; this.SimpleMarker = SimpleMarker;
//返回一个新的Marker //返回一个新的Marker
return new SimpleMarker({ return new SimpleMarker({
@ -212,6 +233,8 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
}); });
if (this._pois?.length > 0) { if (this._pois?.length > 0) {
console.log(this._pois);
//展示该数据 //展示该数据
this.markerList.render(this._pois); this.markerList.render(this._pois);
} }
@ -241,7 +264,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
startNav() { startNav() {
this.navigator = this.pathSimplifierIns?.createPathNavigator(this.selectedIndex, { this.navigator = this.pathSimplifierIns?.createPathNavigator(this.selectedIndex, {
loop: true, //循环播放 loop: true, //循环播放
speed: 500000 * this.navSpeed //巡航速度,单位千米/小时 speed: 50000 * this.navSpeed //巡航速度,单位千米/小时
}); });
this.navigator?.start(); this.navigator?.start();
} }
@ -269,11 +292,11 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
} }
/** 根据标点经纬度获取地址信息 */ /** 根据标点经纬度获取地址信息 */
getPoiByPositon(position: string[]) { getPoiByPositon(label: string, color: string, position: string[], time: string) {
this.geocoder.getAddress(position, (status: any, result: any) => { this.geocoder.getAddress(position, (status: any, result: any) => {
if (status === 'complete' && result.info === 'OK') { if (status === 'complete' && result.info === 'OK') {
// result中对应详细地理坐标信息 // result中对应详细地理坐标信息
this._pois = [...this.pois, { markerLabel: '终', color: 'red', position: position, title: result.regeocode.formattedAddress }]; this._pois = [...this._pois, { markerLabel: label, color: color, position, title: result.regeocode.formattedAddress, time }];
if (this.markerList) { if (this.markerList) {
this.markerList.render(this._pois); this.markerList.render(this._pois);
} }
@ -287,7 +310,14 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
* @param infoItem * @param infoItem
*/ */
selectedPOI(infoItem: InfoItem) { selectedPOI(infoItem: InfoItem) {
this.infoWindow.setContent(infoItem.content || `地址: <pre style="font-weight: bold;">${infoItem.title}</pre>`); this.infoWindow.setContent(
infoItem.content ||
`
<label style="font-weight: bold;">${infoItem.title}</label><br/>
东经:${infoItem.position?.[0]}, 北纬:${infoItem.position?.[1]}<br/>
${infoItem.time}
`
);
this.infoWindow.open(this.aMap, infoItem.position); this.infoWindow.open(this.aMap, infoItem.position);
this.infoWindow.setPosition(infoItem.position); this.infoWindow.setPosition(infoItem.position);
// 地图定位居中 // 地图定位居中

View File

@ -114,6 +114,9 @@ export class AmapService {
} }
formatTime(time: string): string { formatTime(time: string): string {
if (!time) {
return '';
}
return `${time.slice(0, 4)}-${time.slice(4, 6)}-${time.slice(6, 8)} ${time.slice(9, 11)}:${time.slice(11, 13)}:${time.slice(13, 15)}`; return `${time.slice(0, 4)}-${time.slice(4, 6)}-${time.slice(6, 8)} ${time.slice(9, 11)}:${time.slice(11, 13)}:${time.slice(13, 15)}`;
} }
} }
@ -128,6 +131,7 @@ export interface POI {
export interface InfoItem { export interface InfoItem {
title?: string; title?: string;
content?: string; content?: string;
time?: string;
position: string[]; position: string[];
} }