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

This commit is contained in:
Lingzi
2022-03-10 10:13:07 +08:00
23 changed files with 235 additions and 311 deletions

View File

@ -36,9 +36,8 @@
{{ item.orderPaymentCode }} <br> <a>{{ item.paymentStatusLabel }}</a>
</ng-template>
<ng-template st-row="amountDetails" let-item let-index="index" let-column="column">
{{item.costName}}:{{ item.price | currency }}<br />
<ng-container *ngIf="item.payType==='1'">
附加费: {{ item.surcharge| currency }}
<ng-container *ngFor="let detail of item.amountDetails">
{{detail.costName}}:{{ detail.price | currency }}<br />
</ng-container>
</ng-template>
<ng-template st-row="billCode" let-item let-index="index" let-column="column">

View File

@ -251,16 +251,14 @@ export class PaymentRecordComponent implements OnInit {
title: '运费明细',
render: 'amountDetails',
width: 160,
format: item => {
let surcharge = 0;
(item.amountDetails as Array<any>).forEach(detail => {
surcharge += detail.surcharge || 0;
});
item.surcharge = surcharge.toFixed(2);
item.price = item.amountDetails?.[0]?.price || 0;
item.costName = item.amountDetails?.[0]?.costName;
return '';
}
// format: item => {
// (item.amountDetails as Array<any>).forEach(detail => {
// detail.surcharge = detail.price + (detail.surcharge || 0);
// });
// console.log(item.amountDetails);
// return '';
// }
},
{
title: '支付类型',

View File

@ -203,7 +203,7 @@
</st>
</div>
<div nz-col [nzSpan]="12">
<amap-path-simplifier [mapWidth]="'100%'" [mapHeight]="'600px'" [MapList]="mapList"></amap-path-simplifier>
<amap-path-simplifier [mapWidth]="'100%'" [mapHeight]="'600px'" [MapList]="mapList" [pois]="pois"></amap-path-simplifier>
</div>
</div>
</nz-card>

View File

@ -24,8 +24,9 @@ import { OrderManagementService } from '../../services/order-management.service'
export class OrderManagementVehicleDetailComponent implements OnInit {
id = this.route.snapshot.params.id;
trajectory = 'car';
mapList:any[] = []; //地图点位数据组
addressItems:any[] = []; //打点地址数据组
mapList: any[] = []; //地图点位数据组
pois: any[] = [];
addressItems: any[] = []; //打点地址数据组
i: any = {
unLoadingPlaceList: [],
billExpenseDetails: [],
@ -40,7 +41,7 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
isVisible = false;
logColumns2: STColumn[] = [
{ title: '时间', index: 'vinOutTime' },
{ title: '地点', index: 'cityName' },
{ title: '地点', index: 'cityName' }
];
logColumns: STColumn[] = [
{ title: '款项', index: 'expenseCodeLabel' },
@ -72,15 +73,31 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
ngOnInit(): void {
this.initData();
this.getTrajectory()
this.getTrajectory();
}
initData() {
this.service.request(this.service.$api_get_getWholeBillDetail, { id: this.id }).subscribe(res => {
if (res) {
this.i = res;
this.billExpenses = this.i?.billExpenseDetails?.filter((data:any)=>data.expenseCode ==="PRE" || data.expenseCode ==="RECE" ||data.expenseCode ==="BACK" )
this.i.scheduleVOList = this.i?.scheduleVOList?.filter((data:any)=>data.displayStatus !=="HIDE");
this.pois = [
{
markerLabel: '起',
color: 'blue',
position: [res.startingPoint.longitude, res.startingPoint.latitude],
title: res.startingPoint.detailedAddress
},
{
markerLabel: '卸',
color: 'red',
position: [res.endPoint.longitude, res.endPoint.latitude],
title: res.endPoint.detailedAddress
}
];
this.billExpenses = this.i?.billExpenseDetails?.filter(
(data: any) => data.expenseCode === 'PRE' || data.expenseCode === 'RECE' || data.expenseCode === 'BACK'
);
this.i.scheduleVOList = this.i?.scheduleVOList?.filter((data: any) => data.displayStatus !== 'HIDE');
}
});
}
@ -128,11 +145,11 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
}
}
// 获取车辆轨迹
getTrajectory(){
getTrajectory() {
this.service.request(this.service.$api_get_getTrajectory, { id: this.id }).subscribe(res => {
if (res) {
const points = res.trackArray;
let list :any[] = [];
let list: any[] = [];
points?.forEach((item: any) => {
list.push({
name: `${item.spd}km/h`,
@ -141,7 +158,7 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
});
this.mapList = list;
this.addressItems = res.cityArray;
if(this.addressItems && this.addressItems.length > 0){
if (this.addressItems && this.addressItems.length > 0) {
this.addressItems.forEach(item => {
item.vinOutTime = this.getLocalTime(item.vinOutTime);
});
@ -150,12 +167,12 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
});
}
// 获取司机轨迹
getDriverTrajectory(){
// 获取司机轨迹
getDriverTrajectory() {
this.service.request(this.service.$api_get_getAppDriverPosition, { id: this.id }).subscribe(res => {
if (res) {
const points = res.tracks;
let list :any[] = [];
let list: any[] = [];
points?.forEach((item: any) => {
list.push({
name: item.hgt,
@ -164,7 +181,7 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
});
this.mapList = list;
this.addressItems = [...res.enclosureDataAppTrack];
if(this.addressItems && this.addressItems.length > 0){
if (this.addressItems && this.addressItems.length > 0) {
this.addressItems.forEach(item => {
item.vinOutTime = this.getLocalTime(item.gtm);
item.cityName = item.appAdress;
@ -172,14 +189,14 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
}
}
});
}
trajectoryChange(event:any){
if(event ==='car'){
this.getTrajectory()
}else if(event ==='driver'){
}
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');
}

View File

@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2021-12-15 13:17:42
* @LastEditors : Shiming
* @LastEditTime : 2022-03-02 13:50:12
* @LastEditTime : 2022-03-09 15:24:55
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\confir-receipt\\confir-receipt.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
@ -33,10 +33,10 @@
</st>
</sv>
<sv label="司机车辆">
<div>{{ dataInfo?.driverName }} / {{ dataInfo?.driverPhone }}/ {{ dataInfo?.carNo }}</div>
<div>{{ dataInfo?.driverName|| '-' }} / {{dataInfo?.driverTelephone || '-' }}/ {{ dataInfo?.carNo || '-' }}</div>
</sv>
<sv label="收款人">
<div>{{ dataInfo?.payeeName }} / {{ dataInfo?.payeePhone }}</div>
<div>{{ i?.payeeName || '-'}} / {{ i?.payeePhone || '-'}}</div>
</sv>
<sv label="回单凭证">
<nz-upload

View File

@ -42,7 +42,7 @@
<button nz-button nzType="primary" (click)="roleAction('',1)">新增结算客户</button>
</div>
</div>
<st #st [data]="service.$api_settlementCustomer_page" [columns]="columns" [req]="{ params: reqParams }"
<st #st [data]="service.$api_settlementCustomer_page" [columns]="columns" [req]="{ params: reqParams }" [page]="{}"
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)">
<ng-template st-row="customerType" let-item let-index="index">
<div>

View File

@ -55,7 +55,7 @@
[scroll]="{ x: '2000px' }"
[data]="service.$api_networkTransporter_page"
[columns]="columns"
[req]="{ params: reqParams }"
[req]="{ params: reqParams }" [page]="{}"
[loading]="service.http.loading"
(change)="stChange($event)"
>

View File

@ -51,7 +51,6 @@
<st #st size="small" [bordered]="true" [scroll]="{x:'800px',y: '300px' }" [data]="service.$api_ficoVatinv_Detail"
[columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, process: beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" class="mt-md">
[res]="{ reName: { list: 'data.records', total: 'data.total' } }" [page]="{ }" [loading]="service.http.loading"
class="mt-md">
</st>

View File

@ -85,7 +85,7 @@
</div>
</div>
<st #orderST [scroll]="{ x: '1200px' }" [data]="service.$api_get_invoice_order_detail" [columns]="orderColumns"
<st #orderST [scroll]="{ x: '1200px' }" [data]="service.$api_get_invoice_order_detail" [columns]="orderColumns" [page]="{}"
size="small" bordered="true" [req]="{ process: beforeReq }" [loading]="service.http.loading"
[scroll]="{ x: '1200px', y: '250px' }"></st>
</nz-tab>
@ -103,11 +103,11 @@
</div>
</div>
<st #costST [data]="service.$api_get_invoice_cost_detail" [columns]="costColumns" size="small" bordered="true"
<st #costST [data]="service.$api_get_invoice_cost_detail" [columns]="costColumns" size="small" bordered="true" [page]="{}"
[req]="{ process: beforeReq }" [loading]="service.http.loading" [scroll]="{ x: '1200px', y: '250px' }"></st>
</nz-tab>
<nz-tab nzTitle="发票明细">
<st #invoiceST [data]="service.$api_get_invoice_details" [columns]="invoiceColumns" size="small" bordered="true"
<st #invoiceST [data]="service.$api_get_invoice_details" [columns]="invoiceColumns" size="small" bordered="true" [page]="{}"
[req]="{ process: beforeReq }" [loading]="service.http.loading" [scroll]="{ x: '1200px', y: '250px' }">
<ng-template st-row="vatname" let-item let-index="index">
<nz-select *ngIf="isEdit" [ngModel]="item.owner"

View File

@ -130,12 +130,7 @@ export class InvoiceDetailComponent implements OnInit {
projectId: {
type: 'string',
title: '所属项目',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
asyncData: () => this.service.getEnterpriseProject()
},
ui: { widget: 'select', placeholder: '请选择', allowClear: true, asyncData: () => this.service.getEnterpriseProject() },
default: ''
}
}
@ -158,7 +153,7 @@ export class InvoiceDetailComponent implements OnInit {
width: 120,
type: 'widget',
className: 'text-right',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: this.type ==='2'?record.billkpmoney: record.billkpnotax }) }
widget: { type: 'currency-chy', params: ({ record }) => ({ value: this.type === '2' ? record.billkpmoney : record.billkpnotax }) }
},
{
title: '运输费',
@ -190,7 +185,7 @@ export class InvoiceDetailComponent implements OnInit {
private initCostSF(): SFSchema {
return {
properties: {
billHId: {
billHCode: {
type: 'string',
title: '订单号',
ui: {

View File

@ -13,7 +13,7 @@
<nz-card class="search-box" nzBordered>
<div nz-row nzGutter="8">
<div nz-col [nzXl]="_$expand ? 24 : 18" [nzLg]="24" [nzSm]="24" [nzXs]="24">
<sf #sf [schema]="searchSchema" [ui]="{ '*': { spanLabelFixed: 90, grid: { lg: 8, md: 12, sm: 12, xs: 24 } } }"
<sf #sf [schema]="searchSchema" [ui]="{ '*': { spanLabelFixed: 120, grid: { lg: 8, md: 12, sm: 12, xs: 24 } } }"
[compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" [class.expend-options]="_$expand"

View File

@ -38,9 +38,9 @@ export class InvoicedListComponent implements OnInit {
if (this.sf) {
Object.assign(requestOptions.body, {
...this.sf.value,
createTime: {
start: this.sf.value.createTime?.[0] || '',
end: this.sf.value.createTime?.[1] || ''
invoicedate: {
start: this.sf.value.invoicedate?.[0] || '',
end: this.sf.value.invoicedate?.[1] || ''
}
});
}
@ -135,7 +135,7 @@ export class InvoicedListComponent implements OnInit {
autocomplete: 'off'
}
},
createTime: {
invoicedate: {
title: '开票日期',
type: 'string',
ui: {
@ -145,13 +145,11 @@ export class InvoicedListComponent implements OnInit {
nzShowTime: true
} as SFDateWidgetSchema
},
arto: {
artoname: {
type: 'string',
title: '购买人',
enum: [{ label: '全部', value: '全部' }],
ui: {
widget: 'select',
placeholder: '请选择',
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
@ -167,7 +165,7 @@ export class InvoicedListComponent implements OnInit {
visibleIf: {
expand: (value: boolean) => value
},
asyncData: () => this.service.getNetworkFreightForwarder()
asyncData: () => this.service.getNetworkFreightForwarder({}, true)
},
default: ''
}

View File

@ -12,8 +12,8 @@
<div style="flex: 1">
<div style="display: flex; width: 100%; justify-content: space-between">
<p style="padding-right: 80px; width: 400px">{{ userDetail?.realName }}
<nz-badge nzStatus="success" nzText="正常" *ngIf="!userDetail?.stateLocked" class="ml-xl"> </nz-badge>
<nz-badge nzStatus="warning" nzText="冻结" *ngIf="userDetail?.stateLocked" class="ml-xl"> </nz-badge>
<nz-badge nzStatus="success" nzText="正常" *ngIf="!userDetail?.stateLocked" class="ml-xs"> </nz-badge>
<nz-badge nzStatus="warning" nzText="冻结" *ngIf="userDetail?.stateLocked" class="ml-xs"> </nz-badge>
</p>
<div style="margin-right: 24px">
<button *ngIf="userDetail?.stateLocked" [nzLoading]="service.http.loading" nz-button nzType="primary"

View File

@ -12,8 +12,8 @@
<div style="flex: 1">
<div style="display: flex;width: 100%;justify-content: space-between;">
<p style="padding-right: 80px; width: 400px;">{{ userDetail?.realName }}
<nz-badge nzStatus="success" nzText="正常" *ngIf="!userDetail?.stateLocked" class="ml-xl"></nz-badge>
<nz-badge nzStatus="warning" nzText="冻结" *ngIf="userDetail?.stateLocked" class="ml-xl"></nz-badge>
<nz-badge nzStatus="success" nzText="正常" *ngIf="!userDetail?.stateLocked" class="ml-xs"></nz-badge>
<nz-badge nzStatus="warning" nzText="冻结" *ngIf="userDetail?.stateLocked" class="ml-xs"></nz-badge>
</p>
<div style="margin-right: 24px;">
<button *ngIf="userDetail?.stateLocked" [disabled]="service.http.loading" nz-button nzType="primary"
@ -217,7 +217,7 @@
<input nz-input type="text" [(ngModel)]="licenseDetail.licenseNo" [readonly]="!isEditDriver"
[nzBorderless]="!isEditDriver" [placeholder]="isEditDriver?'':'-'">
</sv>
<!-- <sv label="公司所在地" >
<sv label="公司所在地" >
<ng-container *ngIf="isEditDriver; else cascaderelseTemplate">
<nz-select [(ngModel)]="licenseDetail.regionCode">
<ng-container *ngFor="let item of adressCodeList">
@ -228,7 +228,7 @@
<ng-template #cascaderelseTemplate>
{{licenseDetail?.regionCodeName }}
</ng-template>
</sv> -->
</sv>
<sv label="发证日期" col="2">
<nz-date-picker [(ngModel)]="licenseDetail.validStartTime" [nzDisabled]="!isEditDriver" nzPlaceHolder=" "
[nzBorderless]="!isEditDriver" [nzSuffixIcon]="isEditDriver?'calendar':''" style="width: 110px;"

View File

@ -323,11 +323,16 @@ export class UserCenterComponentsDriverDetailComponent implements OnInit {
return;
}
}
if (!licenseDetail.licenseNo || !licenseDetail.regionCode || !licenseDetail.validStartTime) {
this.service.msgSrv.warning('请完善从业资格证信息');
if (!driverDetail.licenseNo || !driverDetail.driverModel || !driverDetail.validStartTime || !driverDetail.signingOrganization || !driverDetail.certificatePhotoWatermark) {
this.service.msgSrv.warning('请完善驾驶证信息');
return;
}
if (!licenseDetail.licenseNo || !licenseDetail.validStartTime || !licenseDetail.certificatePhotoWatermark) {
this.service.msgSrv.warning('请完善从业资格证信息');
return;
}
const params: any = {
userId: this.route.snapshot.params.id,
mobile: this.userDetail?.phone,

View File

@ -1,7 +1,7 @@
<!--
* @Author: your name
* @Date: 2021-11-29 15:22:34
* @LastEditTime : 2022-02-18 16:29:43
* @LastEditTime : 2022-03-09 16:04:08
* @LastEditors : Shiming
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath : \\tms-obc-web\\src\\app\\routes\\usercenter\\components\\driver\\driver-config\\driver-config.component.html
@ -30,8 +30,8 @@
</nz-card>
<nz-card>
<!-- 数据列表 -->
<st #st [columns]="columns" [data]="service.$api_configPage" [req]="{ params: reqParams }"
[loading]="service.http.loading">
<st #st [columns]="columns" [scroll]="{ x: '1200px' }"[data]="service.$api_configPage" [req]="{ params: reqParams }"
[loading]="service.http.loading" [page]={}>
<ng-template st-row="monthFreightAmount" let-item let-index="index">
<div>{{item?.monthFreightAmount | currency}}</div>
</ng-template>

View File

@ -103,16 +103,17 @@ export class UserCenterComponentsDriverConfigComponent implements OnInit {
private initST(): STColumn[] {
return [
// { title: '', type: 'checkbox', className: 'text-center' },
{ title: '司机姓名', className: 'text-center', index: 'name' },
{ title: '手机号', className: 'text-center', index: 'mobile' },
{ title: '类型', className: 'text-center', render: 'isCaptain' },
{ title: '月承运金额上限(元)', className: 'text-center', render: 'monthFreightAmount' },
{ title: '日提现金额上限(元)', className: 'text-center', render: 'dayWithdrawalAmount' },
{ title: '月提现金额上限(元)', className: 'text-center', render: 'monthWithdrawalAmount' },
{ title: '月收款金额上限(元)', className: 'text-center', render: 'monthReceivableAmount' },
{ title: '司机姓名', className: 'text-center', width: '170px', index: 'name' },
{ title: '手机号', className: 'text-center', width: '170px', index: 'mobile' },
{ title: '类型', className: 'text-center', width: '170px',render: 'isCaptain' },
{ title: '月承运金额上限(元)', className: 'text-center', width: '200px', render: 'monthFreightAmount' },
{ title: '日提现金额上限(元)', className: 'text-center', width: '200px', render: 'dayWithdrawalAmount' },
{ title: '月提现金额上限(元)', className: 'text-center', width: '200px', render: 'monthWithdrawalAmount' },
{ title: '月收款金额上限(元)', className: 'text-center', width: '200px', render: 'monthReceivableAmount' },
{
title: '操作',
width: '170px',
fixed: 'right',
className: 'text-center',
buttons: [
{

View File

@ -269,7 +269,7 @@
</label>
</sv-title>
<sv label="法定代表人">
<input nz-input type="text" [(ngModel)]="detailData.legalPersonIdentityVO.name" [readonly]="!isEdit"
<input nz-input type="text" maxlength="32" [(ngModel)]="detailData.legalPersonIdentityVO.name" [readonly]="!isEdit"
[nzBorderless]="!isEdit" [placeholder]="isEdit?'':'-'">
</sv>
<sv label="身份证号码">

View File

@ -286,12 +286,24 @@ export class FreightComponentsListDetailComponent implements OnInit, OnDestroy {
this.isEdit = false;
}
save(data: any) {
save(data: any){
const dateil = { ...this.detailData };
Object.assign(dateil.legalPersonIdentityVO, {
validStartTime: this.datePipe.transform(dateil.legalPersonIdentityVO.validStartTime, 'yyyy-MM-dd'),
validEndTime: this.datePipe.transform(dateil.legalPersonIdentityVO.validEndTime, 'yyyy-MM-dd')
});
if (!this.detailData?.enterpriseName || !this.detailData?.enterpriseAddress) {
this.service.msgSrv.error('请完善企业基本信息!')
return false;
}
if (!this.detailData.legalPersonIdentityVO.name || !this.detailData.legalPersonIdentityVO.certificateNumber) {
this.service.msgSrv.error('请完善法人信息!')
return false;
}
if (!this.detailData.createBank || !this.detailData.bankAccount) {
this.service.msgSrv.error('请完善企业开票信息!')
return false;
}
const params = {};
Object.assign(params, {
adminMobile: dateil.adminMobile,
@ -331,6 +343,7 @@ export class FreightComponentsListDetailComponent implements OnInit, OnDestroy {
this.isEdit = false;
}
});
return
}
private refreshData(status: number) {

View File

@ -16,7 +16,11 @@ const CONFIG = amapConf;
export class AmapPathSimplifierComponent implements OnInit, OnChanges {
aMap: any;
pathSimplifierIns: any;
geocoder: any;
navigator: any;
infoWindow: any;
markerList: any;
SimpleMarker: any;
@Input()
pathList: any = [];
@Input()
@ -31,40 +35,8 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
clcikPointEvent = new EventEmitter<any>();
@Input()
pois: any = [
{
id: 'A',
position: [116.020764, 39.904989],
markerLabel: 'X_A',
infoWinContent: 'Hello! A',
listDesc: '起',
color: '#F5222D'
},
{
id: 'B',
position: [116.405285, 39.904989],
markerLabel: 'X_B',
infoWinContent: 'Hello! B',
listDesc: '终',
color: '#1890ff'
},
{
id: 'C',
position: [116.789806, 39.904989],
markerLabel: 'X_C',
infoWinContent: 'Hello! C',
listDesc: '卸',
color: '#1890ff'
},
{
id: 'C',
position: [116.789806, 39.904989],
markerLabel: 'X_C',
infoWinContent: 'Hello! C',
listDesc: '装',
color: '#F5222D'
}
];
pois: any = [];
private _pois: any = [];
constructor(public service: BaseService) {}
ngOnChanges(changes: SimpleChanges): void {
@ -77,11 +49,19 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
this.pathList = [
{
name: '路线1',
points: changes?.MapList?.currentValue
points: changes.MapList?.currentValue
}
];
this.setData(this.pathList);
this.setPathIndex(this.selectedIndex);
this.getPoiByPositon(this.MapList[this.MapList?.length - 1]?.lnglat);
}
if (changes?.pois?.currentValue) {
// console.log(this.pois);
this._pois = changes?.pois?.currentValue;
if (this?.markerList && this._pois.length > 0) {
this.markerList.render(this._pois);
}
}
}
ngOnInit(): void {
@ -99,7 +79,9 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
version: CONFIG.version,
plugins: [
// 需要使用的的插件列表,如比例尺'AMap.Scale'等
'AMap.PathSimplifier'
'AMap.PathSimplifier',
'AMap.InfoWindow',
'AMap.Geocoder'
],
AMapUI: {
version: CONFIG.AMapUIVersion,
@ -112,10 +94,16 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
});
this.aMap.on('complete', () => {
// 信息窗口
this.infoWindow = new AMap.InfoWindow({
offset: new AMap.Pixel(0, -40)
});
this.geocoder = new AMap.Geocoder({
radius: 1000 //范围默认500
});
// this.service.msgSrv.info('地图加载完成 !');
this.pathInit();
// this.setPOIS();
// this.loadPOIS();
this.setPOIS();
});
})
.catch(e => {
@ -123,88 +111,6 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
});
}
loadPOIS() {
AMapUI.loadUI(['overlay/SvgMarker'], (SvgMarker: any) => {
if (!SvgMarker.supportSvg) {
//当前环境并不支持SVG此时SvgMarker会回退到父类即SimpleMarker
alert('当前环境不支持SVG');
}
//just some colors
var colors = ['#F5222D', '#1890ff'];
//SvgMarker.Shape下的Shape
var shapeKeys = ['WaterDrop'];
var colNum = 2,
rowNum = shapeKeys.length;
const markers: any[] = [];
this.pois.forEach((d: any) => {
//创建shape
const shape = new SvgMarker.Shape['WaterDrop']({
height: 40,
strokeWidth: 1,
strokeColor: '#ccc',
fillColor: '#F5222D'
});
markers.push(
new SvgMarker(shape, {
map: this.aMap,
position: d.position,
containerClassNames: 'shape-' + 'WaterDrop',
iconLabel: {
innerHTML: d.listDesc,
style: {
top: 7 + 'px'
}
},
showPositionPoint: true
})
);
});
console.log(markers);
// var pxCenter = this.aMap.lnglatToPixel(this.aMap.getCenter());
// var startX = pxCenter.getX(),
// startY = pxCenter.getY();
// for (var c = 0; c < colNum; c++) {
// for (var r = 0; r < rowNum; r++) {
// var idx = r * colNum + c;
// if (!colors[idx]) {
// continue;
// }
// var x = startX + (c - colNum / 2) * 70;
// var y = startY + 50 + (r - rowNum / 2) * 80;
// var labelCenter = shape.getCenter();
// var position = this.aMap.pixelToLngLat(new AMap.Pixel(x, y));
// markers.push(
// new SvgMarker(shape, {
// map: this.aMap,
// position: position,
// containerClassNames: 'shape-' + shapeKeys[r],
// iconLabel: {
// innerHTML: String.fromCharCode('A'.charCodeAt(0) + c),
// style: {
// top: labelCenter[1] - 9 + 'px'
// }
// },
// showPositionPoint: true
// })
// );
// }
// }
});
}
pathInit() {
this.pathSimplifierIns = new AMapUI.PathSimplifier({
zIndex: 100,
@ -222,13 +128,11 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
return lnglatList;
},
getHoverTitle: function (pathData: any, pathIndex: any, pointIndex: any) {
console.log(pathData, pointIndex);
if (pointIndex >= 0) {
//point
return pathData.name + '' + pathData.points[pointIndex].name;
}
return pathData.name + ',点数量' + pathData.points?.length;
return '';
},
renderOptions: {
renderAllPointsIfNumberBelow: 10 //绘制路线节点,如不需要可设置为-1
@ -248,126 +152,53 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
}
setPOIS() {
AMapUI.loadUI(['misc/MarkerList'], (MarkerList: any) => {
var markerList = new MarkerList({
AMapUI.loadUI(['misc/MarkerList', 'overlay/SimpleMarker'], (MarkerList: any, SimpleMarker: any) => {
this.markerList = new MarkerList({
//关联的map对象
map: this.aMap,
//选中状态通过点击列表或者marker时在Marker和列表节点上添加的class可以借此编写css控制选中时的展示效果
selectedClassNames: 'selected',
//返回数据项的Id
getDataId: (dataItem: any, index: any) => {
//index表示该数据项在数组中的索引位置从0开始如果确实没有id可以返回index代替
return dataItem.id;
},
//返回数据项的位置信息需要是AMap.LngLat实例或者是经纬度数组比如[116.789806, 39.904989]
getPosition: (dataItem: any) => {
console.log(dataItem);
return dataItem.position;
},
//返回数据项对应的Marker
getMarker: (dataItem: any, context: any, recycledMarker: any) => {
//marker的标注内容
var content = dataItem.markerLabel;
var label = {
offset: new AMap.Pixel(16, 18), //修改label相对于marker的位置
content: content
};
//存在可回收利用的marker
if (recycledMarker) {
//直接更新内容返回
recycledMarker.setLabel(label);
recycledMarker.setIconLabel(context.id);
recycledMarker.setIconStyle(dataItem.iconStyle);
return recycledMarker;
}
this.SimpleMarker = SimpleMarker;
//返回一个新的Marker
return new AMap.Marker({
label: label
return new SimpleMarker({
//普通文本
iconLabel: {
//普通文本
innerHTML: dataItem.markerLabel,
//设置样式
style: {
color: '#fff',
fontSize: '110%',
marginTop: '2px'
}
},
iconStyle: dataItem.color,
map: this.aMap,
position: dataItem.position
});
},
//返回数据项对应的infoWindow
getInfoWindow: (dataItem: any, context: any, recycledInfoWindow: any) => {
var tpl = '<p><%- dataItem.id %><%- dataItem.infoWinContent %><p>';
//MarkerList.utils.template支持underscore语法的模板
var content = MarkerList.utils.template(tpl, {
dataItem: dataItem,
dataIndex: context.index
});
if (recycledInfoWindow) {
//存在可回收利用的infoWindow, 直接更新内容返回
recycledInfoWindow.setContent(content);
return recycledInfoWindow;
}
//返回一个新的InfoWindow
return new AMap.InfoWindow({
offset: new AMap.Pixel(0, -32),
content: content
});
},
//返回数据项对应的列表节点
getListElement: (dataItem: any, context: any, recycledListElement: any) => {
var tpl = '<p><%- dataItem.id %><%- dataItem.listDesc %><p>';
var content = MarkerList.utils.template(tpl, {
dataItem: dataItem,
dataIndex: context.index
});
if (recycledListElement) {
//存在可回收利用的listElement, 直接更新内容返回
recycledListElement.innerHTML = content;
return recycledListElement;
}
//返回一段htmlMarkerList将利用此html构建一个新的dom节点
return '<li>' + content + '</li>';
this.selectedPOI(dataItem);
return null;
}
});
//监听选中改变
markerList.on('selectedChanged', (event: any, info: any) => {
console.log(event, info);
});
//监听Marker和ListElement上的点击
markerList.on('markerClick listElementClick', (event: any, record: any) => {
//console.log(event, record);
});
//构建一个数据项数组数据项本身没有格式要求但需要支持getDataId和getPosition
var data = [
{
id: 'A',
position: [116.020764, 39.904989],
markerLabel: 'X_A',
infoWinContent: 'Hello! A',
listDesc: '店铺 A'
},
{
id: 'B',
position: [116.405285, 39.904989],
markerLabel: 'X_B',
infoWinContent: 'Hello! B',
listDesc: '店铺 B'
},
{
id: 'C',
position: [116.789806, 39.904989],
markerLabel: 'X_C',
infoWinContent: 'Hello! C',
listDesc: '店铺 C'
}
];
//展示该数据
markerList.render(data);
if (this._pois?.length > 0) {
//展示该数据
this.markerList.render(this._pois);
}
});
}
@ -377,7 +208,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
setPathIndex(index: number) {
this.pathSimplifierIns.setSelectedPathIndex(index);
// this.startNav();
this.startNav();
}
startNav() {
@ -391,4 +222,61 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
this.navigator?.start();
}
}
/** 根据经纬度获取地址信息 */
getPoiByPositon(position: Array<string>) {
this.geocoder.getAddress(position, (status: any, result: any) => {
if (status === 'complete' && result.info === 'OK') {
// result中对应详细地理坐标信息
this._pois = [...this.pois, { markerLabel: '终', color: 'red', position: position, title: result.regeocode.formattedAddress }];
if (this.markerList) {
this.markerList.render(this._pois);
}
// this.setPOI({ markerLabel: '终', color: 'red', position: position });
}
});
}
/**
* 选中标点,设置窗口信息
* @param location
*/
selectedPOI(location: any) {
this.infoWindow.setContent(`地址: <pre>${location.title}</pre>`);
this.infoWindow.open(this.aMap, location.position);
this.infoWindow.setPosition(location.position);
this.aMap.setCenter(location.position);
}
/**
* 增加标记点
* @param poi
*/
setPOI(poi: POI) {
AMapUI.loadUI(['overlay/SimpleMarker'], (SimpleMarker: any) => {
//启动页面
new SimpleMarker({
//普通文本
iconLabel: {
//普通文本
innerHTML: poi.markerLabel,
//设置样式
style: {
color: '#fff',
fontSize: '110%',
marginTop: '2px'
}
},
iconStyle: poi.color,
map: this.aMap,
position: poi.position
});
});
}
}
export interface POI {
markerLabel: string;
color: string;
position: Array<string>;
}

View File

@ -1,5 +1,5 @@
/*
* @Description :
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2021-12-24 15:37:00
@ -24,8 +24,8 @@ export class AmapService {
sub = new Subject<any>();
currentSub = new Subject<any>();
//计算路径驾车最优路线的长度与所需时间
drivingCompute(starts: any[], ends: any[]): Observable<any> {
//计算路径驾车最优路线的长度与所需时间
drivingCompute(starts: any[], ends: any[]): Observable<any> {
AMap.plugin('AMap.Driving', () => {
let driving = new AMap.Driving({
// 驾车路线规划策略AMap.DrivingPolicy.LEAST_TIME是最快捷模式
@ -35,7 +35,10 @@ export class AmapService {
return { keyword: item.detailedAddress, 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) };
const repData = {
distance: (result?.routes?.[0]?.distance / 1000).toFixed(2),
time: (result?.routes?.[0]?.time / 60 / 60).toFixed(2)
};
this.sub.next(repData);
});
});

View File

@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2022-01-25 16:03:45
* @LastEditors : Shiming
* @LastEditTime : 2022-03-01 15:31:23
* @LastEditTime : 2022-03-09 16:17:28
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-h5\\dynamic-setting-h5.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
@ -30,7 +30,10 @@
<ng-container *ngSwitchCase="1">
<nz-input-group [nzAddOnAfter]="item.remark?.afterLable" style="width: 155px;"
class="ml-md mr-xl">
<input type="number" nz-input [(ngModel)]="item.itemValue" placeholder="请输入" />
<nz-input-number [(ngModel)]="item.itemValue" [nzMin]="item.remark?.min"
[nzPrecision]="item.remark?.precision" [nzMax]="item.remark?.max"
nzPlaceHolder="请输入" style="width: 120px;"></nz-input-number>
<!-- <input type="number" nz-input [(ngModel)]="item.itemValue" placeholder="请输入"/> -->
</nz-input-group>
</ng-container>
<!-- 0-1单选框 -->

View File

@ -50,6 +50,11 @@ export class DynamicSettingH5Component implements OnInit {
if (this.configList?.length < 0) {
return;
}
// 配置校验
if (this.configList.find((config: any) => !config.itemValue && config.requiredField)) {
this.service.msgSrv.warning('请填写必填项');
return;
}
let params = [...this.configList];
params = params.map((item: any) => {
if (item.itemType == 9) {