This commit is contained in:
wangshiming
2022-03-10 14:31:12 +08:00
parent a6c357e77a
commit c3afc62cb1
5 changed files with 133 additions and 106 deletions

View File

@ -189,7 +189,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
widget: 'text'
}
},
externalResourceCode: {
type: 'string',
title: '外部货源号',
@ -211,10 +211,10 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 'string',
title: '调度员手机号',
maxLength: 30,
ui: {
ui: {
placeholder: '请输入'
}
},
}
// dispatchId: {
// type: 'string',
// title: '调度员',
@ -249,7 +249,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
},
$enterpriseProjectId: {
grid: { span: 12 }
},
}
};
}
initSF3() {
@ -320,7 +320,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
}
},
required: ['goodsTypeId', 'goodsName', 'goodsNameId','goodsName1']
required: ['goodsTypeId', 'goodsName', 'goodsNameId', 'goodsName1']
};
this.ui3 = {
'*': {
@ -347,7 +347,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
placeholder: '请输入',
placeholder: '请输入'
}
},
number: {
@ -355,7 +355,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
placeholder: '请输入',
placeholder: '请输入'
}
},
carModel: {
@ -408,7 +408,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
params: { dictKey: 'insure:packaged:goods' },
containsAllLabel: false,
validator: val => {
if (this.sf5?.value?.insuranceType && this.sf5?.value?.insuranceType !=='3' && this.isEmpty(val)) {
if (this.sf5?.value?.insuranceType && this.sf5?.value?.insuranceType !== '3' && this.isEmpty(val)) {
return [{ keyword: 'required', message: '必填项' }];
} else {
return [];
@ -422,14 +422,14 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
widget: 'custom',
validator: val => {
if (this.sf5?.value?.insuranceType && this.sf5?.value?.insuranceType !=='3' && this.isEmpty(val)) {
if (this.sf5?.value?.insuranceType && this.sf5?.value?.insuranceType !== '3' && this.isEmpty(val)) {
return [{ keyword: 'required', message: '必填项' }];
} else {
return [];
}
}
}
},
}
},
required: ['weight', 'carModel', 'carLength']
};
@ -454,13 +454,13 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
map((res: any) => {
return [...res];
})
)
);
},
change: (tag: any, org: any) => {
if(tag === '3'){
if (tag === '3') {
this.sf5.setValue('/insurancePremium', null);
this.sf5.setValue('/insuranceRate', null);
}else {
} else {
this.getInsurersPrice(tag);
}
}
@ -492,7 +492,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
insurancePremium: {
type: 'string',
title: '服务包费用',
readOnly:true,
readOnly: true,
ui: {
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
@ -519,11 +519,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '1' }
}
},
}
},
required: [ 'insurancePremium']
required: ['insurancePremium']
};
this.ui5 = {
'*': {
@ -864,7 +862,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
nzComponentParams: {
status: 'new',
url: this.service.$api_save_assign_whole,
params: item,
params: item
},
nzFooter: null
});
@ -895,10 +893,22 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.sf5.validator({ emitError: true });
this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true });
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) {
if (
this.validateForm1.invalid ||
!this.sf3.valid ||
!this.sf1.valid ||
!this.sf4.valid ||
!this.sf5.valid ||
!this.sf6.valid ||
!this.sf7.valid
) {
this.service.msgSrv.warning('请完善必填项!');
return;
}
if (this.totalDistance <= 0) {
this.service.msgSrv.warning('起终点相同,请重新选择装卸货地址!');
return;
}
if (this.validateForm1.value.loadingTime < new Date()) {
this.service.msgSrv.warning('装货时间必须大于当前时间!');
return;
@ -979,7 +989,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
{ expenseCode: 'BACK', expenseName: '回单付', price: this.sf7.value.receiptPay || 0, id: this.sf7data?.receiptPayId || '' }
];
// 从“再下一单”过来将所有的子参数内的id都删除
if ((this.PageStatus === '整车下一单')) {
if (this.PageStatus === '整车下一单') {
LoadingList.forEach((ele: any) => {
delete ele.id;
});
@ -1003,15 +1013,15 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
paymentDays: this.sf7.value.paymentDays,
estimatedKilometers: this.totalDistance,
estimatedTravelTime: this.totalTime,
insurancePackagedGoods:this.sf4.value.insurancePackagedGoods,
goodsValue:this.sf4.value.goodsValue,
insurancePackagedGoods: this.sf4.value.insurancePackagedGoods,
goodsValue: this.sf4.value.goodsValue
};
const modalRef = this.modalService.create({
nzTitle: '运输协议',
nzContent: TranAgreementComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { object: params, shipperName: this.shipperName,type:'onecar' }
nzComponentParams: { object: params, shipperName: this.shipperName, type: 'onecar' }
});
modalRef.afterClose.subscribe(result => {
if (result) {
@ -1136,7 +1146,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
enterpriseInfoId: res?.enterpriseInfoId,
dispatchPhone: res?.dispatchPhone,
dispatchName: res?.dispatchName,
externalResourceCode: res?.externalResourceCode,
externalResourceCode: res?.externalResourceCode
};
if (this.PageStatus === '整车修改') {
this.sf1data.id = res?.id;
@ -1207,14 +1217,14 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required));
}
// 计算里程,时间
if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
// 计算里程,时间
if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
});
this.sf3data = {
@ -1248,7 +1258,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
carModel: res?.goodsInfoVOList[0]?.carModel?.split(',') || [],
carLength: res?.goodsInfoVOList[0]?.carLength?.split(',') || [],
goodsValue: res?.goodsValue || '',
insurancePackagedGoods: res?.insurancePackagedGoods || '',
insurancePackagedGoods: res?.insurancePackagedGoods || ''
};
if (this.PageStatus === '整车修改') {
this.sf4data.id = res?.goodsInfoVOList[0]?.id;
@ -1257,7 +1267,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.sf5data = {
insuranceType: res?.insuranceType || '',
insurancePremium: res?.insurancePremium || '',
insuranceRate: res?.insuranceRate || '',
insuranceRate: res?.insuranceRate || ''
};
this.sf6data = {
stateReceipt: res?.stateReceipt,
@ -1323,14 +1333,14 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
default:
break;
}
// 计算里程,时间
if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
// 计算里程,时间
if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
}
});
}
@ -1384,8 +1394,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
// 计算保价费金额
getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
console.log(this.totalDistance)
if ( insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) {
console.log(this.totalDistance);
if (insuranceType !== '3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0) {
const params = {
insuranceType,
goodsValue: this.sf4.value.goodsValue,
@ -1395,7 +1405,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
if (res) {
this.sf5.setValue('/insurancePremium', res.insurancePremium);
this.sf5.setValue('/insuranceRate', res.insuranceRate);
}else{
} else {
this.sf5.setValue('/insurancePremium', null);
this.sf5.setValue('/insuranceRate', null);
}