From c3afc62cb109f5fc99c7da2809b4b83423497548 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Thu, 10 Mar 2022 14:31:12 +0800 Subject: [PATCH] fix bug --- .../bulk-publish/bulk-publish.component.ts | 4 + .../bulk-release-publish.component.ts | 4 + .../onecar-publish.component.ts | 102 ++++++++++-------- .../release-publish.component.ts | 101 +++++++++-------- .../components/vehicle/vehicle.component.ts | 28 ++--- 5 files changed, 133 insertions(+), 106 deletions(-) diff --git a/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts b/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts index df0cc433..80830828 100644 --- a/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts +++ b/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts @@ -648,6 +648,10 @@ export class SupplyManagementBulkPublishComponent implements OnInit { this.service.msgSrv.warning('请完善必填项!'); return; } + if (this.totalDistance <= 0) { + this.service.msgSrv.warning('起终点相同,请重新选择装卸货地址!'); + return; + } // 校验各个输入限定值 if ( this.sf4.value?.weight > this.limitValues?.maxWeight || diff --git a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts index a0b0328c..b4fbcb67 100644 --- a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts +++ b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts @@ -580,6 +580,10 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { this.service.msgSrv.warning('请完善必填项!'); return; } + if (this.totalDistance <= 0) { + this.service.msgSrv.warning('起终点相同,请重新选择装卸货地址!'); + return; + } // 校验各个输入限定值 if (this.sf4.value.weight > this.limitValues.maxWeight || this.sf4.value.volume > this.limitValues.maxVolume || this.sf4.value.number > this.limitValues.maxTrainNumber) { this.service.msgSrv.error(`当前货物核载信息已超出限定值【${this.limitValues.maxWeight}吨、${this.limitValues.maxVolume}方、${this.limitValues.maxTrainNumber}车】`); diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts index 00a3875f..22b49ab8 100644 --- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts +++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts @@ -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); } diff --git a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts index cb2b4c40..312a5e7d 100644 --- a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts +++ b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts @@ -208,10 +208,10 @@ export class SupplyManagementReleasePublishComponent implements OnInit { type: 'string', title: '调度员手机号', maxLength: 30, - ui: { + ui: { placeholder: '请输入' } - }, + } }, required: ['shipperAppUserId', 'enterpriseProjectId', 'enterpriseInfoName'] }; @@ -329,7 +329,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { title: '', ui: { widget: 'custom', - placeholder: '请输入', + placeholder: '请输入' } }, number: { @@ -337,7 +337,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { title: '', ui: { widget: 'custom', - placeholder: '请输入', + placeholder: '请输入' } }, carModel: { @@ -390,7 +390,7 @@ export class SupplyManagementReleasePublishComponent 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 []; @@ -404,14 +404,14 @@ export class SupplyManagementReleasePublishComponent 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'] }; @@ -436,14 +436,14 @@ export class SupplyManagementReleasePublishComponent 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 { - console.log(tag) + } else { + console.log(tag); this.getInsurersPrice(tag); } } @@ -475,7 +475,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { insurancePremium: { type: 'string', title: '服务包费用', - readOnly:true, + readOnly: true, ui: { visibleIf: { insuranceType: (value: string) => value !== '3' } } @@ -502,11 +502,9 @@ export class SupplyManagementReleasePublishComponent implements OnInit { widget: 'custom', visibleIf: { insuranceType: (value: string) => value === '1' } } - }, - - + } }, - required: [ 'insurancePremium'] + required: ['insurancePremium'] }; this.ui5 = { '*': { @@ -528,7 +526,6 @@ export class SupplyManagementReleasePublishComponent implements OnInit { }; } - initSF6() { this.schema6 = { properties: { @@ -769,8 +766,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit { addStartInfo() { console.log(this.startInfo.length); console.log(this.limitValues.maxTimes); - - if (this.startInfo.length < this.limitValues.maxTimes) { + + if (this.startInfo.length < this.limitValues.maxTimes) { const controlId = this.startInfo.length; this.startInfo.push({ detailedAddress: '', @@ -857,12 +854,24 @@ export class SupplyManagementReleasePublishComponent implements OnInit { this.sf5.validator({ emitError: true }); this.sf6.validator({ emitError: true }); this.sf7.validator({ emitError: true }); - console.log(!this.sf1.valid) - console.log(this.sf1.value) - if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) { + console.log(!this.sf1.valid); + console.log(this.sf1.value); + 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; @@ -955,8 +964,8 @@ export class SupplyManagementReleasePublishComponent 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 }; console.log(params); const modalRef = this.modalService.create({ @@ -964,11 +973,11 @@ export class SupplyManagementReleasePublishComponent implements OnInit { 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) { - this.submit(submitType, params, ); + this.submit(submitType, params); } }); } @@ -1088,14 +1097,14 @@ export class SupplyManagementReleasePublishComponent 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(); //计算保费金额 + }); + } } }); } @@ -1170,20 +1179,20 @@ export class SupplyManagementReleasePublishComponent implements OnInit { this.validateForm1.addControl(`unloadName${index}`, new FormControl(null, Validators.required)); this.validateForm1.addControl(`unloadPhone${index}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')])); }); - // 计算里程,时间 - 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(); //计算保费金额 + }); + } } // 计算保价费金额 getInsurersPrice(insuranceType = this.sf5.value?.insuranceType) { - console.log(insuranceType) - console.log(this.totalDistance) - if ( insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) { + console.log(insuranceType); + console.log(this.totalDistance); + if (insuranceType !== '3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0) { const params = { insuranceType, goodsValue: this.sf4.value.goodsValue, @@ -1193,7 +1202,7 @@ export class SupplyManagementReleasePublishComponent 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); } diff --git a/src/app/routes/supply-management/components/vehicle/vehicle.component.ts b/src/app/routes/supply-management/components/vehicle/vehicle.component.ts index 4fdcc546..aac4fc47 100644 --- a/src/app/routes/supply-management/components/vehicle/vehicle.component.ts +++ b/src/app/routes/supply-management/components/vehicle/vehicle.component.ts @@ -180,15 +180,15 @@ export class SupplyManagementVehicleComponent implements OnInit { type: 'primary', onClick: () => { this.service.request(this.service.$api_getFailUploadGoodsOperateResource, result.ids).subscribe((res: any) => { - if(res) { + if (res) { console.log(res); } - }) + }); console.log(111); } - }, + } ] - }) + }); } }); } @@ -252,7 +252,7 @@ export class SupplyManagementVehicleComponent implements OnInit { * 审核通过按钮 */ handleOK(value: any) { - if (this.auditMany === false) { + if (this.auditMany === false) { const params: any = { id: this.auditID, remarks: this.sfFre.value.remarks @@ -508,7 +508,7 @@ export class SupplyManagementVehicleComponent implements OnInit { width: '180px', className: 'text-left' }, - + { title: '项目名称', index: 'enterpriseProjectName', @@ -576,7 +576,7 @@ export class SupplyManagementVehicleComponent implements OnInit { title: '创建时间', width: '200px', index: 'createTime', - className: 'text-left', + className: 'text-left' }, { title: '审核状态', @@ -606,7 +606,7 @@ export class SupplyManagementVehicleComponent implements OnInit { { text: '修改货源', click: _record => this.amend(_record), - iif: item => item.resourceStatus === '1' , + iif: item => item.resourceStatus === '1' && item.insurancePayment !== 'Y', acl: { ability: ['SUPPLY-INDEX-vehicleModificationSupply'] } }, // { @@ -636,12 +636,12 @@ export class SupplyManagementVehicleComponent implements OnInit { } ]; } - // 导出 - exportFire() { - this.service.request(this.service.$api_asyncExportWholeList, this.reqParams ).subscribe((res: any) => { - if(res) { - this.service.msgSrv.success('导出成功,请去下载中心下载!') + // 导出 + exportFire() { + this.service.request(this.service.$api_asyncExportWholeList, this.reqParams).subscribe((res: any) => { + if (res) { + this.service.msgSrv.success('导出成功,请去下载中心下载!'); } - }) + }); } }