车辆接口更新

This commit is contained in:
wangshiming
2022-01-24 16:49:24 +08:00
parent 5ce1b29126
commit da1f474e57
4 changed files with 163 additions and 150 deletions

View File

@ -1,22 +1,17 @@
import { Router } from '@angular/router';
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STColumn, STComponent } from '@delon/abc/st'; import { STColumn, STComponent } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; import { SFComponent, SFDateWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { ShipperBaseService } from '@shared'; import { ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { UpdateFreightComponent } from '../../modal/bulk/update-freight/update-freight.component';
import { OneCarOrderCancelComponent } from '../../modal/vehicle/cancel/cancel.component';
import { VehicleConfirReceiptComponent } from '../../modal/vehicle/confir-receipt/confir-receipt.component'; import { VehicleConfirReceiptComponent } from '../../modal/vehicle/confir-receipt/confir-receipt.component';
import { VehicleSureArriveComponent } from '../../modal/vehicle/sure-arrive/sure-arrive.component';
import { VehicleSureDepartComponent } from '../../modal/vehicle/sure-depart/sure-depart.component';
import { VehicleUpdateFreightComponent } from '../../modal/vehicle/update-freight/update-freight.component';
import { OrderManagementService } from '../../services/order-management.service';
import { VehicleModifyRateComponent } from '../../modal/vehicle/modify-rate/modify-rate.component';
import { VehicleFreightPeopleComponent } from '../../modal/vehicle/freight-people/freight-people.component'; import { VehicleFreightPeopleComponent } from '../../modal/vehicle/freight-people/freight-people.component';
import { VehicleModifyCaptainComponent } from '../../modal/vehicle/modify-captain/modify-captain.component'; import { VehicleModifyCaptainComponent } from '../../modal/vehicle/modify-captain/modify-captain.component';
import { VehicleModifyRateComponent } from '../../modal/vehicle/modify-rate/modify-rate.component';
import { VehicleUpdateFreightComponent } from '../../modal/vehicle/update-freight/update-freight.component';
import { OrderManagementService } from '../../services/order-management.service';
@Component({ @Component({

View File

@ -4,11 +4,31 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2021-12-14 14:03:07 * @Date : 2021-12-14 14:03:07
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-01-18 17:21:21 * @LastEditTime : 2022-01-24 16:40:01
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\bulk\\update-freight\\update-freight.component.html * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\bulk\\update-freight\\update-freight.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
<sf #sf [schema]="schema" [ui]="{ '*': { spanLabelFixed: 90, grid: { span: 24 } } }" [button]="'none'"> </sf> <sf #sf [schema]="schema" [ui]="{ '*': { spanLabelFixed: 90, grid: { span: 24 } } }" [button]="'none'">
<ng-template sf-template="freightPrice" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate">
<input
nz-input
type="number"
min="0"
step="0.01"
[ngModel]="i.value"
(ngModelChange)="i.setValue($event)"
placeholder="请输入"
oninput="if(value>99999)value=99999;if(value<0)value=0"
/>
</nz-input-group>
<ng-template #addOnAfterTemplate>
<nz-select [ngModel]="sf.value.freightType" (ngModelChange)="sf.setValue('/freightType', $event)" [nzDisabled]="true">
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of freightTypeOptions"></nz-option>
</nz-select>
</ng-template>
</ng-template>
</sf>
<nz-divider style="margin-top: 0"></nz-divider> <nz-divider style="margin-top: 0"></nz-divider>
<div> <div>
<p style="font-size: 16px"> <p style="font-size: 16px">

View File

@ -25,12 +25,16 @@ export class UpdateFreightComponent implements OnInit {
@Input() @Input()
data: any; data: any;
freightTypeOptions: any;
calculateSub!: Subscription; calculateSub!: Subscription;
constructor(private service: OrderManagementService, private modal: NzModalRef) {} constructor(private service: OrderManagementService, private modal: NzModalRef) {}
ngOnInit(): void { ngOnInit(): void {
this.schema = this.initSF(this.data); this.schema = this.initSF(this.data);
this.service.getDictByKey('freight:type').subscribe(res => {
this.freightTypeOptions = res;
});
} }
/** /**
@ -38,21 +42,14 @@ export class UpdateFreightComponent implements OnInit {
*/ */
private initSF(data: any): SFSchema { private initSF(data: any): SFSchema {
return { return {
properties: {
dto: {
type: 'object',
properties: { properties: {
freightPrice: { freightPrice: {
type: 'number', type: 'number',
title: '运费单价', title: '运费单价',
minimum: 0,
maximum: 99999,
ui: { ui: {
addOnAfter: data.freightTypeLabel,
placeholder: '请输入', placeholder: '请输入',
grid: { widget: 'custom',
span: 12 grid: { span: 12 },
},
change: (val: any) => this.changeNumVal() change: (val: any) => this.changeNumVal()
} as SFStringWidgetSchema, } as SFStringWidgetSchema,
default: data.freightPrice default: data.freightPrice
@ -78,15 +75,13 @@ export class UpdateFreightComponent implements OnInit {
title: '结算依据', title: '结算依据',
type: 'string', type: 'string',
default: data.settlementBasis, default: data.settlementBasis,
enum: [
{ label: '以收货为准', value: '1' },
{ label: '以发货为准', value: '2' }
],
ui: { ui: {
widget: 'select', widget: 'dict-select',
grid: { params: { dictKey: 'goodresource:settlement:type' },
span: 12 containsAllLabel: false,
} placeholder: '结算依据',
errors: { required: '请选择结算依据' },
grid: {span: 12}
} as SFSelectWidgetSchema } as SFSelectWidgetSchema
}, },
blank1: { blank1: {
@ -104,7 +99,7 @@ export class UpdateFreightComponent implements OnInit {
acceptWeight: { acceptWeight: {
type: 'number', type: 'number',
title: '装货重量', title: '装货重量',
default: data.acceptWeight, default: data.loadWeight || 0,
minimum: 0, minimum: 0,
maximum: 99999, maximum: 99999,
ui: { ui: {
@ -120,11 +115,11 @@ export class UpdateFreightComponent implements OnInit {
acceptVolume: { acceptVolume: {
type: 'number', type: 'number',
title: '装货体积', title: '装货体积',
default: data.acceptVolume, default: data.loadVolume || 0,
minimum: 0, minimum: 0,
maximum: 99999, maximum: 99999,
ui: { ui: {
unit: '', unit: '',
placeholder: '请输入', placeholder: '请输入',
grid: { grid: {
span: 12 span: 12
@ -136,7 +131,7 @@ export class UpdateFreightComponent implements OnInit {
settlementWeight: { settlementWeight: {
type: 'number', type: 'number',
title: '卸货重量', title: '卸货重量',
default: data.settlementWeight, default: data.settlementWeight || 0,
minimum: 0, minimum: 0,
maximum: 99999, maximum: 99999,
ui: { ui: {
@ -152,11 +147,11 @@ export class UpdateFreightComponent implements OnInit {
settlementVolume: { settlementVolume: {
type: 'number', type: 'number',
title: '卸货体积', title: '卸货体积',
default: data.settlementVolume, default: data.settlementVolume || 0,
minimum: 0, minimum: 0,
maximum: 99999, maximum: 99999,
ui: { ui: {
unit: '', unit: '',
placeholder: '请输入', placeholder: '请输入',
grid: { grid: {
span: 12 span: 12
@ -164,9 +159,6 @@ export class UpdateFreightComponent implements OnInit {
hideStep: true, hideStep: true,
change: (val: any) => this.changeNumVal() change: (val: any) => this.changeNumVal()
} as SFNumberWidgetSchema } as SFNumberWidgetSchema
}
},
required: ['freightPrice', 'settlementBasis']
}, },
changeCause: { changeCause: {
title: '审核备注', title: '审核备注',
@ -182,8 +174,9 @@ export class UpdateFreightComponent implements OnInit {
maxRows: 5 maxRows: 5
} }
} as SFTextWidgetSchema } as SFTextWidgetSchema
} },
} },
required: ['freightPrice', 'settlementBasis']
}; };
} }
@ -191,9 +184,10 @@ export class UpdateFreightComponent implements OnInit {
if (this.calculateSub) { if (this.calculateSub) {
this.calculateSub.unsubscribe(); this.calculateSub.unsubscribe();
} }
const params = { billId: this.data.billId, changeCause: this.sf.value.changeCause, dto: {...this.sf.value} }
this.calculateSub = this.service this.calculateSub = this.service
.request(this.service.$api_calculate_cost, { billId: this.data.billId, ...this.sf.value, changeCause: '' }) .request(this.service.$api_calculate_cost, params)
.subscribe(res => { .subscribe((res: any) => {
if (res) { if (res) {
Object.assign(this.data, { Object.assign(this.data, {
totalFreight: res.totalFreight, totalFreight: res.totalFreight,
@ -205,14 +199,14 @@ export class UpdateFreightComponent implements OnInit {
} }
save(value: any): void { save(value: any): void {
console.log(this.sf.value)
if (!this.sf.valid) { if (!this.sf.valid) {
this.sf.validator({ emitError: true }); this.sf.validator({ emitError: true });
return; return;
} }
this.service.request(this.service.$api_change_bulk, { billId: this.data.billId, ...this.sf.value }).subscribe(res => { const params = { billId: this.data.billId, changeCause: this.sf.value.changeCause, dto: {...this.sf.value} }
this.service.request(this.service.$api_change_bulk,params).subscribe((res: any) => {
if (res) { if (res) {
this.service.msgSrv.success('变更运费成功'); this.service.msgSrv.success('变更运费成功');
this.modal.destroy(true); this.modal.destroy(true);
} }
}); });

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2021-12-03 15:31:52 * @Date : 2021-12-03 15:31:52
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-01-24 15:51:21 * @LastEditTime : 2022-01-24 16:39:11
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\services\\order-management.service.ts * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\services\\order-management.service.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -144,8 +144,12 @@ export class OrderManagementService extends ShipperBaseService {
// 获取规则抽查分类统计 // 获取规则抽查分类统计
public $api_get_getComplianceStatisticalStatus = '/api/sdc/billOperate/getComplianceStatisticalStatus'; public $api_get_getComplianceStatisticalStatus = '/api/sdc/billOperate/getComplianceStatisticalStatus';
getDictByKey(dictKey: string) {
const params = { dictKey: dictKey };
return this.request(this.$api_getDictValue, params);
}
// 获取数据字典
$api_getDictValue = `/api/mdc/pbc/dictItems/getDictValue`;
/** /**
* 根据企业ID获取企业历史网络货运人 * 根据企业ID获取企业历史网络货运人
* @returns * @returns