fix bug
This commit is contained in:
@ -11,7 +11,9 @@
|
||||
</nz-card>
|
||||
|
||||
<nz-card>
|
||||
<div class="card-title">装卸货信息<span class="tip-font">预计公里数:-km,预计行程耗时:-小时</span></div>
|
||||
<div class="card-title"
|
||||
>装卸货信息<span class="tip-font">预计公里数:{{ totalDistance }}km,预计行程耗时:{{ totalTime }}小时</span></div
|
||||
>
|
||||
<form nz-form [formGroup]="validateForm1" role="form">
|
||||
<div nz-row [nzGutter]="24">
|
||||
<div nz-col [nzSpan]="8">
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
SFUISchema
|
||||
} from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { AmapPoiPickerComponent } from '@shared';
|
||||
import { AmapPoiPickerComponent,AmapService } from '@shared';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar/choose-famifiar.component';
|
||||
import { SupplyManagementService } from '../../services/supply-management.service';
|
||||
@ -35,6 +35,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
|
||||
loadingTime: any; // 货源单设置回显
|
||||
unloadingTime: any; // 货源单设置回显
|
||||
totalFees: any; // 总数信息
|
||||
totalDistance = 0.0; //总里程
|
||||
totalTime = 0.0; //路程总时间
|
||||
npp =false
|
||||
id = this.route.snapshot.params.id;
|
||||
// // 单位
|
||||
@ -45,7 +47,15 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
|
||||
endInfo: any = [];
|
||||
PageStatus = '';
|
||||
dataList: any;
|
||||
constructor(private http: _HttpClient, fb: FormBuilder, private router: Router, private route: ActivatedRoute, private modalService: NzModalService, public service: SupplyManagementService) {
|
||||
constructor(
|
||||
private http: _HttpClient,
|
||||
fb: FormBuilder,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private modalService: NzModalService,
|
||||
public service: SupplyManagementService,
|
||||
private amapService: AmapService
|
||||
) {
|
||||
this.validateForm1 = fb.group({
|
||||
loadingTime: [null, []],
|
||||
unloadingTime: [null, []],
|
||||
@ -676,39 +686,47 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
|
||||
}
|
||||
})
|
||||
}
|
||||
// 打开地图
|
||||
openMap(type: string, index: number) {
|
||||
const modalRef = this.modalService.create({
|
||||
nzTitle: '',
|
||||
nzContent: AmapPoiPickerComponent,
|
||||
nzWidth: 900,
|
||||
nzOnOk: item => {
|
||||
const poi = item.poi;
|
||||
console.log(item.poi);
|
||||
const locList = poi.location.toString().split(',');
|
||||
switch (type) {
|
||||
case 'start':
|
||||
this.startInfo[index].detailedAddress = poi.district + poi.name;
|
||||
this.startInfo[index].longitude = locList[0];
|
||||
this.startInfo[index].latitude = locList[1];
|
||||
this.startInfo[index].province = poi.cityInfo.province;
|
||||
this.startInfo[index].city = poi.cityInfo.city;
|
||||
this.startInfo[index].area = poi.cityInfo.district;
|
||||
break;
|
||||
case 'end':
|
||||
this.endInfo[index].detailedAddress = poi.district + poi.name;
|
||||
this.endInfo[index].longitude = locList[0];
|
||||
this.endInfo[index].latitude = locList[1];
|
||||
this.endInfo[index].province = poi.cityInfo.province;
|
||||
this.endInfo[index].city = poi.cityInfo.city;
|
||||
this.endInfo[index].area = poi.cityInfo.district;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 打开地图
|
||||
openMap(type: string, index: number) {
|
||||
const modalRef = this.modalService.create({
|
||||
nzTitle: '',
|
||||
nzContent: AmapPoiPickerComponent,
|
||||
nzWidth: 900,
|
||||
nzOnOk: item => {
|
||||
const poi = item.poi;
|
||||
const locList = poi.location.toString().split(',');
|
||||
switch (type) {
|
||||
case 'start':
|
||||
this.startInfo[index].detailedAddress = poi.district + poi.name;
|
||||
this.startInfo[index].longitude = locList[0];
|
||||
this.startInfo[index].latitude = locList[1];
|
||||
this.startInfo[index].province = poi.cityInfo.province;
|
||||
this.startInfo[index].city = poi.cityInfo.city;
|
||||
this.startInfo[index].area = poi.cityInfo.district;
|
||||
this.startInfo[index].address = poi.name;
|
||||
break;
|
||||
case 'end':
|
||||
this.endInfo[index].detailedAddress = poi.district + poi.name;
|
||||
this.endInfo[index].longitude = locList[0];
|
||||
this.endInfo[index].latitude = locList[1];
|
||||
this.endInfo[index].province = poi.cityInfo.province;
|
||||
this.endInfo[index].city = poi.cityInfo.city;
|
||||
this.endInfo[index].area = poi.cityInfo.district;
|
||||
this.endInfo[index].address = poi.name;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
|
||||
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => {
|
||||
this.totalDistance = res.distance;
|
||||
this.totalTime = res.time;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
goBack() {
|
||||
window.history.go(-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user