车辆对接

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

@ -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);
}
});
}
/**
* 取消
*/