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

This commit is contained in:
Taric Xin
2021-12-15 16:32:19 +08:00
29 changed files with 1193 additions and 122 deletions

View File

@ -46,7 +46,8 @@ export class AmapPoiPickerComponent implements OnInit {
'AMap.PoiPicker',
'AMap.Scale',
'AMap.InfoWindow',
'AMap.Geolocation'
'AMap.Geolocation',
'AMap.Geocoder'
],
AMapUI: {
// 是否加载 AMapUI缺省不加载
@ -110,11 +111,18 @@ export class AmapPoiPickerComponent implements OnInit {
infoWindow.setContent(`地址: <pre>${poi.name}</pre>`);
infoWindow.open(map, marker.getPosition());
map.setCenter(marker.getPosition());
//获取行政区信息
map.getCity(function (info: any) {
poi.cityInfo = info;
//获取地址所在的行政区
AMap.plugin('AMap.Geocoder', () => {
var geocoder = new AMap.Geocoder({
city: poi.adcode
});
geocoder.getLocation(poi.name, (status: any, result: any) => {
if (status === 'complete' && result.info === 'OK') {
// result中对应详细地理坐标信息
this.poi.cityInfo = result.geocodes[0].addressComponent;
}
});
});
});

View File

@ -1,9 +1,31 @@
import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
declare var AMap: any;
@Injectable({
providedIn: 'root'
})
export class AmapService {
constructor() {}
public length = 0;
public time = 0;
constructor() { }
sub = new Subject<any>();
//计算路径驾车最优路线的长度与所需时间
drivingCompute(starts: any[], ends: any[]): Observable<any> {
AMap.plugin('AMap.Driving', () => {
let driving = new AMap.Driving({
// 驾车路线规划策略AMap.DrivingPolicy.LEAST_TIME是最快捷模式
policy: AMap.DrivingPolicy.LEAST_TIME
});
const points = starts.concat(ends).map(item => {
return { keyword: item.address, city: item.city };
});
driving.search(points, (status: any, result: any) => {
const repData = { distance: (result.routes[0].distance / 1000).toFixed(2), time: (result.routes[0].time / 60 / 60).toFixed(2) };
this.sub.next(repData);
});
});
return this.sub;
}
}

View File

@ -0,0 +1,105 @@
import { Injectable, Injector } from '@angular/core';
import { BaseService } from '../core/base.service';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class ShipperBaseService extends BaseService {
$api_get_carless_carrier = ``; // 获取承运人
$api_get_enterprise_project = `/api/mdc/cuc/enterpriseProject/getEnterpriseProjectList `; // 所属项目列表
$api_get_staff_list = `/api/mdc/cuc/userApp/getStaffList`; //查询企业项目员工列表(录单员)
$api_get_network_freight_forwarder = ``; // 获取网络货运人
constructor(public injector: Injector) {
super(injector);
}
/**
* 获取无车承运人
* @returns
*/
getCarlessCarrier() {
return
const params = {
};
return this.request(this.$api_get_carless_carrier, params, 'POST').pipe(
map((res) => {
if (res) {
res.map((m: any) => {
return { label: m.platformName, value: m.operationId };
});
}
}),
);
}
/**
* 获取所属项目
* @returns
*/
getEnterpriseProject(params = {}) {
return this.request(this.$api_get_enterprise_project, params).pipe(
map((res: any) => {
if (!res) {
return [];
}
const list = res.map(((item: any) => {
return {
label: item.projectName,
value: item.enterpriseId
}
}))
const obj = [{ value: '', label: '全部' }];
return [...obj, ...list];
})
)
}
/**
* 获取录单员
* @returns
*/
getStaffList(params = {}) {
return this.request(this.$api_get_staff_list, params).pipe(
map((res: any) => {
if (!res) {
return [];
}
const list = res.map(((item: any) => {
return {
label: item.name,
value: item.userId
}
}))
const obj = [{ value: '', label: '全部' }];
return [...obj, ...list];
})
)
}
/**
* 获取网络货运人
* @returns
*/
getNetworkFreightForwarder(params = {}) {
return this.request(this.$api_get_network_freight_forwarder, params).pipe(
map((res: any) => {
if (!res) {
return [];
}
const list = res.map(((item: any) => {
return {
label: item.name,
value: item.userId
}
}))
const obj = [{ value: '', label: '全部' }];
return [...obj, ...list];
})
)
}
}

View File

@ -1,3 +1,11 @@
/*
* @Author: your name
* @Date: 2021-12-07 16:27:52
* @LastEditTime: 2021-12-14 21:09:21
* @LastEditors: your name
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\shared\services\index.ts
*/
// Core
export * from './core/base.service';
export * from './core/cache.service';
@ -12,4 +20,5 @@ export * from './business/user.service';
export * from './business/sl-platform.service';
export * from './business/user.service';
export * from './business/environment.service';
export * from './business/shipper-base.service';