This commit is contained in:
Taric Xin
2022-03-22 15:39:43 +08:00
parent 2c996dae05
commit 1e3e5ea830
7 changed files with 47 additions and 50 deletions

View File

@ -149,7 +149,8 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
points?.forEach((item: any) => { points?.forEach((item: any) => {
list.push({ list.push({
name: `${item.spd}km/h`, name: `${item.spd}km/h`,
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

@ -110,9 +110,6 @@
</ng-template> </ng-template>
</st> </st>
</div> </div>
<div class="footer-page">
</div>
</nz-card> </nz-card>
<nz-modal [(nzVisible)]="isVisible" [nzWidth]="600" [nzFooter]="nzModalFooter" nzTitle="运费变更记录" <nz-modal [(nzVisible)]="isVisible" [nzWidth]="600" [nzFooter]="nzModalFooter" nzTitle="运费变更记录"
@ -193,7 +190,7 @@
</div> </div>
<ng-template #footerTpl> <ng-template #footerTpl>
<div style="float: right"> <div style="float: right">
<button nz-button (click)="visible=false">关闭</button> <button nz-button (click)="visible=false">关闭</button>
<button nz-button [disabled]="loading" (click)="resetSF()">重置</button> <button nz-button [disabled]="loading" (click)="resetSF()">重置</button>
<button nz-button nzType="primary" (click)="search();;">搜索</button> <button nz-button nzType="primary" (click)="search();;">搜索</button>
</div> </div>

View File

@ -1,34 +0,0 @@
/*
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2021-12-03 15:31:52
* @LastEditors : Shiming
* @LastEditTime : 2022-01-25 13:28:47
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\components\\vehicle\\vehicle.component.spec.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { OrderManagementVehicleComponent } from './vehicle.component';
describe('OrderManagementVehicleComponent', () => {
let component: OrderManagementVehicleComponent;
let fixture: ComponentFixture<OrderManagementVehicleComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ OrderManagementVehicleComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(OrderManagementVehicleComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -8,4 +8,8 @@
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\amap\\amap-path-simplifier\\amap-path-simplifier.component.html * @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\amap\\amap-path-simplifier\\amap-path-simplifier.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
<div class="map-container" id="container" tabindex="0" [style]="{width: mapWidth, height: mapHeight}"></div> <div class="map-container" id="container" tabindex="0" [style]="{width: mapWidth, height: mapHeight}"></div>
<div style="display: flex;align-items: center;">
<div>巡航倍数 : <input type="number" [ngModel]="navSpeed" min="1" (ngModelChange)="changeMultiple($event)"
style="border-color: #f0f0f0;outline: 0;width: 60px;text-align: center;" class="mt-sm ml-sm"/></div>
</div>

View File

@ -1,9 +1,10 @@
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
import { Component, Input, OnChanges, OnInit, Output, SimpleChanges, EventEmitter, OnDestroy } from '@angular/core'; import { Component, Input, OnChanges, OnInit, Output, SimpleChanges, EventEmitter, OnDestroy } from '@angular/core';
import { amapConf } from '@conf/amap.config'; import { amapConf } from '@conf/amap.config';
import { InputNumber } from '@delon/util';
import { throwError } from 'rxjs'; import { throwError } from 'rxjs';
import { BaseService } from 'src/app/shared/services'; import { BaseService } from 'src/app/shared/services';
import { InfoItem, MapList, PathList, POI } from '../amap.service'; import { AmapService, InfoItem, MapList, PathList, POI } from '../amap.service';
declare var AMap: any; declare var AMap: any;
declare var AMapUI: any; declare var AMapUI: any;
declare var Loca: any; declare var Loca: any;
@ -31,6 +32,9 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
// 当前选中路线图下标 // 当前选中路线图下标
@Input() @Input()
selectedIndex = 0; selectedIndex = 0;
// 巡航倍数
@InputNumber()
navSpeed = 1;
// 标点数组 // 标点数组
@Input() @Input()
pois: POI[] = []; pois: POI[] = [];
@ -44,7 +48,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
@Output() @Output()
readonly clcikPointEvent = new EventEmitter<any>(); readonly clcikPointEvent = new EventEmitter<any>();
constructor(public service: BaseService) {} constructor(public service: BaseService, private amapService: AmapService) {}
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
// 路线图变更: 设置路线图, 指定路线图 // 路线图变更: 设置路线图, 指定路线图
if (changes?.pathList?.currentValue && this?.pathSimplifierIns) { if (changes?.pathList?.currentValue && this?.pathSimplifierIns) {
@ -154,7 +158,8 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
position: info.pathData.points[info.pointIndex].lnglat, position: info.pathData.points[info.pointIndex].lnglat,
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/> <label style="font-weight: 400;">车速: ${info.pathData.points[info.pointIndex].name}<label/><br/>
<label style="font-weight: 400;">时间: ${this.amapService.formatTime(info.pathData.points[info.pointIndex].time)}<label/>
` `
}); });
} }
@ -234,14 +239,32 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy
* 开启巡航 * 开启巡航
*/ */
startNav() { startNav() {
if (this.navigator) { this.navigator = this.pathSimplifierIns?.createPathNavigator(this.selectedIndex, {
this.navigator.start(); loop: true, //循环播放
speed: 500000 * this.navSpeed //巡航速度,单位千米/小时
});
this.navigator?.start();
}
changeMultiple(multiple: number) {
if (multiple <= 0) {
this.navSpeed = 1;
return;
} else { } else {
this.navigator = this.pathSimplifierIns?.createPathNavigator(0, { this.navSpeed = multiple;
loop: true, //循环播放 this.resetNav();
speed: 1000000 //巡航速度,单位千米/小时 }
}); }
this.navigator?.start();
/** 重置巡航 */
resetNav() {
if (this.navigator) {
this.navigator.destroy();
setTimeout(() => {
this.startNav();
}, 200);
} else {
this.startNav();
} }
} }

View File

@ -12,6 +12,8 @@ import { Injectable } from '@angular/core';
import { Observable, Subject, throwError } from 'rxjs'; import { Observable, Subject, throwError } from 'rxjs';
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
import { amapConf } from '@conf/amap.config'; import { amapConf } from '@conf/amap.config';
import { formatDate } from '@angular/common';
import { DateTimePickerUtil } from '@delon/util';
declare var AMap: any; declare var AMap: any;
declare var AMapUI: any; declare var AMapUI: any;
@ -110,6 +112,10 @@ export class AmapService {
}); });
}); });
} }
formatTime(time: string): string {
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)}`;
}
} }
export interface POI { export interface POI {