车辆对接

This commit is contained in:
wangshiming
2022-01-06 16:14:28 +08:00
parent c83c1e7a8e
commit bfcbe348b6
9 changed files with 272 additions and 141 deletions

View File

@ -32,8 +32,8 @@
/>
</nz-input-group>
<span style="padding: 0 10px"
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="chooseAddress(idx, 'start')"></i
></span>
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="chooseAddress(idx, 'start')"></i
></span>
<span
><i nz-icon nzType="minus-circle-o" nzTheme="fill" style="color: #d9001b" (click)="subStartInfo($event, idx, data.id)"></i
></span>
@ -44,12 +44,12 @@
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入联系人信息'">
<div class="align-center">
<input nz-input [(ngModel)]="data.appUserName" [ngModelOptions]="{ standalone: true }" maxlength="30" />
<input nz-input [(ngModel)]="data.appUserName" formControlName="loadName{{ idx }}" maxlength="30" />
<input
style="margin-left: 12px"
nz-input
formControlName="loadPhone{{ idx }}"
[(ngModel)]="data.contractTelephone"
[ngModelOptions]="{ standalone: true }"
maxlength="11"
/>
</div>
@ -82,8 +82,8 @@
/>
</nz-input-group>
<span style="padding: 0 10px"
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="chooseAddress(idx, 'end')"></i
></span>
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="chooseAddress(idx, 'end')"></i
></span>
<span><i nz-icon nzType="minus-circle-o" nzTheme="fill" style="color: #d9001b" (click)="subEndInfo($event, idx)"></i></span>
</div>
</nz-form-control>
@ -92,12 +92,12 @@
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入联系人信息'">
<div class="align-center">
<input nz-input [(ngModel)]="data.appUserName" [ngModelOptions]="{ standalone: true }" maxlength="30" />
<input nz-input [(ngModel)]="data.appUserName" formControlName="unloadName{{ idx }}" maxlength="30" />
<input
style="margin-left: 12px"
nz-input
[(ngModel)]="data.contractTelephone"
[ngModelOptions]="{ standalone: true }"
formControlName="unloadPhone{{ idx }}"
maxlength="11"
/>
</div>
@ -282,7 +282,7 @@
<div class="align-center">
<button nz-button nzType="primary" *ngIf="this.PageStatus == '整车修改'" (click)="choose()">取消</button>
<button *ngIf="this.PageStatus == '整车修改'" nz-button nzType="primary" style="margin-left: 48px" (click)="submit()">提交修改</button>
<!-- <button nz-button nzType="primary" *ngIf="this.PageStatus == '整车下一单'" (click)="chooseFamifiar()">指派熟车</button> -->
<button nz-button nzType="primary" *ngIf="this.PageStatus == '整车下一单'" (click)="submitConfirm('assign')">指派熟车</button>
<button *ngIf="this.PageStatus == '整车下一单'" nz-button nzType="primary" style="margin-left: 48px" (click)="submit()"
>司机抢单</button
>

View File

@ -20,6 +20,8 @@ import { PublishAddressListComponent } from './address-list/address-list.compone
import { PublishSuccessComponent } from './publish-success/publish-success.component';
import { map } from 'rxjs/operators';
import { of } from 'rxjs';
import { TranAgreementComponent } from '../tran-agreement/tran-agreement.component';
import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/assigned-car.component';
@Component({
selector: 'app-publish-goods-onecar-publish',
templateUrl: './onecar-publish.component.html',
@ -694,29 +696,63 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.removeControl(`unloadPhone${index}`);
}
//指派熟车
chooseFamifiar() {
this.modalService.create({
//指派熟车
chooseFamifiar(item: any) {
console.log('999')
const modalRef = this.modalService.create({
nzTitle: '指派熟车',
nzContent: PublishGoodsChooseFamifiarComponent,
nzWidth: 1300
nzContent: SupplyManagementVehicleAssignedCarComponent,
nzWidth: 1200,
nzComponentParams: {
status: 'new',
url: this.service.$api_save_assign_whole,
params: item
},
nzFooter: null
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.openFinishPage(result);
}
});
}
submit(): void {
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'onecar', resourceObj }
});
}
// 提交前确认,委托运输协议弹窗
submitConfirm(submitType?: any) {
const modalRef = this.modalService.create({
nzTitle: '运输协议',
nzContent: TranAgreementComponent,
nzWidth: 900,
nzFooter: null
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.submit(submitType);
}
});
}
submit(submitType?: string): void {
console.log('进来了');
console.log(this.startInfo);
// Object.keys(this.validateForm1.controls).forEach(key => {
// this.validateForm1.controls[key].markAsDirty();
// this.validateForm1.controls[key].updateValueAndValidity();
// });
// this.sf1.validator({ emitError: true });
// this.sf3.validator({ emitError: true });
// this.sf4.validator({ emitError: true });
// this.sf6.validator({ emitError: true });
// if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
// return;
// }
console.log(this.validateForm1.value);
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity();
});
this.sf3.validator({ emitError: true });
this.sf4.validator({ emitError: true });
this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true });
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) {
return;
}
if (typeof this.validateForm1.value.unloadingTime !== 'string') {
var c = new Date(this.validateForm1.value.unloadingTime);
this.validateForm1.value.unloadingTime =
@ -747,10 +783,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
':' +
this.addPreZero(c.getSeconds());
}
// if (this.validateForm1.invalid) {
// return;
// }
console.log(this.sf7.value)
const params: any = {
...this.sf1.value,
...this.sf5.value,
@ -773,6 +805,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
totalFees: this.totalFees
};
console.log(params);
if(submitType) {
if (submitType == 'assign') {
this.chooseFamifiar(params);
return;
}
}
if (this.PageStatus === '整车修改') {
this.requests(this.service.$api_set_WholeModify, params);
} else if (this.PageStatus === '整车下一单') {

View File

@ -313,7 +313,7 @@
</nz-card>
<nz-card>
<div class="align-center">
<!-- <button nz-button nzType="primary" (click)="submit('assign')" *ngIf="type === 'add'">指派熟车</button> -->
<button nz-button nzType="primary" (click)="submitConfirm('assign')" *ngIf="type === 'add'">指派熟车</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit('publish')" *ngIf="type === 'add'">司机抢单</button>
<button
nz-button

View File

@ -24,6 +24,7 @@ import { SupplyManagementService } from '../../services/supply-management.servic
import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/assigned-car.component';
import { PublishAddressListComponent } from '../onecar-publish/address-list/address-list.component';
import { PublishSuccessComponent } from '../onecar-publish/publish-success/publish-success.component';
import { TranAgreementComponent } from '../tran-agreement/tran-agreement.component';
@Component({
selector: 'app-publish-goods-onecar-publish',
@ -71,7 +72,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
private route: ActivatedRoute,
private eaCacheSrv: EACacheService,
private amapService: AmapService,
public service2: ShipperBaseService
public shipperSrv: ShipperBaseService
) {
this.validateForm1 = fb.group({
loadingTime: [null, [Validators.required]],
@ -170,7 +171,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
_$expand: (value: boolean) => value,
},
allowClear: true,
asyncData: () => this.service2.getNetworkFreightForwarder(),
asyncData: () => this.shipperSrv.getNetworkFreightForwarder(),
},
},
externalResourceCode: {
@ -182,28 +183,16 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}
},
dispatchId: {
type: 'string',
title: '调度员',
enum: [
{ label: '周涛', value: 1 },
{ label: '李诞', value: 2 }
],
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
optionalHelp: '选择调度员,司机直接联系调度员 ; 不选择,司机直接联系您'
// asyncData: () =>
// this.service.loadChildData2('0', '2').pipe(
// map((data: any) => {
// return data.map((m: any) => {
// return { label: m.name, value: m.id };
// });
// }),
// ),
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
}
type: 'string',
title: '调度员',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
optionalHelp: '选择调度员,司机直接联系调度员 ; 不选择,司机直接联系您',
asyncData: () => this.shipperSrv.getStaffList2()
} as SFSelectWidgetSchema
}
}
};
this.ui1 = {
@ -234,56 +223,82 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res);
});
}
initSF3() {
this.schema3 = {
properties: {
goodsTypeId: {
type: 'string',
title: '货物名称',
enum: [
{ label: '服装', value: '1' },
{ label: '电子产品', value: '2' },
{ label: '其他', value: '3' }
],
ui: {
widget: 'select',
placeholder: '请选择',
errors: { required: '请选择货物名称' },
change: (value, data) => {
this.currentGoodsTypeName = data;
}
// asyncData: () =>
// this.categoryService.loadChildData2('0', '2').pipe(
// map((data: any) => {
// return data.map((m: any) => {
// return { label: m.name, value: m.id };
// });
// }),
// ),
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
},
goodsName: {
type: 'string',
title: '',
maxLength: 20,
ui: {
errors: { required: '请填写货物名称' },
visibleIf: {
goodsTypeId: value => value === '其他'
}
}
}
},
required: ['goodsTypeId', 'goodsName']
};
this.ui3 = {
'*': {
spanLabelFixed: 90,
grid: { span: 12 }
}
};
}
initSF3() {
this.schema3 = {
properties: {
goodsTypeId: {
type: 'string',
title: '货物名称',
ui: {
widget: 'select',
placeholder: '请选择',
errors: { required: '请选择货物类型' },
asyncData: () =>
this.shipperSrv.loadConfigByKey('goods.name.config.type').pipe(
map((data: any) => {
return data[0].children?.map((m: any) => {
return { label: m.name, value: m.id };
});
})
),
change: (value, data: any) => {
this.changeGoodsType(value, data);
this.sf3.setValue('/goodsTypeName', data.label);
}
} as SFSelectWidgetSchema
},
goodsTypeName: {
type: 'string',
title: '',
ui: {
hidden: true
}
},
goodsNameId: {
type: 'string',
title: '',
ui: {
widget: 'select',
placeholder: '请选择',
errors: { required: '请填写货物名称' },
change: (value: any, data: any) => {
this.sf3.setValue('/goodsName', data.label);
},
visibleIf: {
goodsTypeName: (value: any) => value && value !== '其它'
}
}
},
goodsName: {
type: 'string',
title: '',
ui: {
hidden: true,
visibleIf: {
goodsTypeName: (value: any) => value && value !== '其它'
}
}
},
goodsName1: {
type: 'string',
title: '',
ui: {
errors: { required: '请填写货物名称' },
visibleIf: {
goodsTypeName: (value: any) => value && value === '其它'
}
}
}
},
required: ['goodsTypeId', 'goodsName', 'goodsNameId']
};
this.ui3 = {
'*': {
spanLabelFixed: 90,
grid: { span: 12 }
}
};
}
initSF4() {
this.schema4 = {
properties: {
@ -615,25 +630,40 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
this.validateForm1.removeControl(`unloadPhone${index}`);
}
//指派熟车
chooseFamifiar(item: any) {
const modalRef = this.modalService.create({
nzTitle: '指派熟车',
nzContent: SupplyManagementVehicleAssignedCarComponent,
nzWidth: 1200,
nzComponentParams: {
status: 'new',
url: this.service.$api_save_assign_bulk,
params: item
},
nzFooter: null
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.openFinishPage(result);
}
});
}
//指派熟车
chooseFamifiar(item: any) {
console.log('999')
const modalRef = this.modalService.create({
nzTitle: '指派熟车',
nzContent: SupplyManagementVehicleAssignedCarComponent,
nzWidth: 1200,
nzComponentParams: {
status: 'new',
url: this.service.$api_save_assign_whole,
params: item
},
nzFooter: null
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.openFinishPage(result);
}
});
}
// 提交前确认,委托运输协议弹窗
submitConfirm(submitType?: any) {
const modalRef = this.modalService.create({
nzTitle: '运输协议',
nzContent: TranAgreementComponent,
nzWidth: 900,
nzFooter: null
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.submit(submitType);
}
});
}
submit(submitType: string): void {
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
@ -652,13 +682,10 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
// 货物信息
const goodsInfoList = [
{
...this.sf3.value,
goodsTypeName: this.currentGoodsTypeName.label,
goodsName: '电子',
goodsNameId: '1',
...this.sf4.value,
maxWeight: this.sf4.value.maxWeight.join(','),
maxCube: this.sf4.value.maxCube.join(',')
...this.sf4.value,
...this.sf3.value,
maxWeight: this.sf4.value.maxWeight.join(','),
maxCube: this.sf4.value.maxCube.join(',')
}
];
// 运费信息
@ -692,10 +719,12 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
};
let reqUrl = this.service.$api_consignWhole;
if (submitType === 'assign') {
this.chooseFamifiar(params);
return;
}
if(submitType) {
if (submitType == 'assign') {
this.chooseFamifiar(params);
return;
}
}
this.service.request(reqUrl, params).subscribe((res: any) => {
if (res) {
@ -821,7 +850,34 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
nzComponentParams: { type: 'onecar', resourceObj }
});
}
changeGoodsType(value: string, data: any) {
if (data.label === '其它') return;
const params = {
pageIndex: 1,
pageSize: 100,
configId: value
};
this.service
.request(this.service.$api_get_config_item_page, params)
.pipe(
map(data => {
return data.records?.map((m: any) => {
return { label: m.name, value: m.id };
});
})
)
.subscribe(res => {
if (res) {
this.sf3.getProperty('/goodsNameId')!.schema.enum = res;
this.sf3.getProperty('/goodsNameId')!.widget.reset(res);
if(this.sf3data.goodsNameId){
this.sf3.setValue('/goodsNameId',this.sf3data.goodsNameId);
}
} else {
this.service.msgSrv.error(res.msg);
}
});
}
/**
* 取消
*/

View File

@ -0,0 +1,7 @@
<h2 >
委托运输协议
</h2>
<div *nzModalFooter>
<button nz-button nzType="primary" (click)="handleOk()" >我已阅读并同意签署</button>
</div>

View File

@ -0,0 +1,21 @@
import { Component } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
@Component({
selector: 'publish-goods-tran-agreement',
templateUrl: './tran-agreement.component.html',
styleUrls: ['./tran-agreement.component.less']
})
export class TranAgreementComponent {
constructor(private modal: NzModalRef) {
}
handleOk(){
this.modal.close(true);
}
}

View File

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-12-03 11:10:14
* @LastEditTime: 2022-01-05 16:45:24
* @LastEditTime: 2022-01-06 15:32:50
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\services\supply-management.service.ts
@ -63,7 +63,13 @@ export class SupplyManagementService extends BaseService {
$api_get_goods_resource_shipper = `/api/sdc/goodsResourceShipper/modifyPricePre`; // 修改单价页面根据货源ID获取货物表
$api_get_car_captain_by_mobile = `/api/mdc/userDriverExpand/getCarCaptainByMobile`; // 查询车队长或者司机列表
$api_save_assign_vehicle = `/api/sdc/goodsResourceShipper/reAssignWhole`;// 货主端大宗货源重新指派
$api_save_assign_bulk = `/api/sdc/goodsResourceShipper/reAssignBulk`; // 货主端大宗货源指派熟车
// 货主端大宗货源指派熟车
$api_save_assign_whole = `/api/sdc/goodsResourceShipper/saveWholeAssign`;
// 货主端大宗货源指派熟车
$api_save_bulk_assign = `/api/sdc/goodsResourceShipper/saveBulkAssign`;
$api_get_has_assigned_car_list = `/api/sdc/goodsResourceShipper/getCarDriverIdsByResourceId`;// 大宗货源根据货源id获取司机和车辆的id集合
// 根据手机号查询车队长/司机

View File

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-12-03 11:10:14
* @LastEditTime: 2021-12-28 20:31:23
* @LastEditTime: 2022-01-06 15:01:57
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\supply-management.module.ts
@ -31,6 +31,7 @@ import { CarAddmodalComponent } from './components/addmodal/addmodal.component';
import { SupplyManagementBulkDetailComponent } from './components/bulk-detail/bulk-detail.component';
import { SupplyManagementReleasePublishComponent } from './components/release-publish/release-publish.component';
import { SupplyManagementBulkReleasePublishComponent } from './components/bulk-release-publish/bulk-release-publish.component';
import { TranAgreementComponent } from './components/tran-agreement/tran-agreement.component';
const COMPONENTS: Type<void>[] = [
@ -55,7 +56,9 @@ const COMPONENTS: Type<void>[] = [
CarAddmodalComponent,
SupplyManagementBulkDetailComponent,
SupplyManagementReleasePublishComponent,
SupplyManagementBulkReleasePublishComponent
SupplyManagementBulkReleasePublishComponent,
TranAgreementComponent
];
@NgModule({