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 88f391e1..a1e6d848 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 @@ -150,10 +150,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { ui: { widget: 'select', // serverSearch: true, + allowClear: true, searchDebounceTime: 300, searchLoadingText: '搜索中...', onSearch: (q: any) => { - let str = q.replace(/^\s+|\s+$/g, ''); + let str = q?.replace(/^\s+|\s+$/g, ''); if (str) { return this.service .request(this.service.$api_enterpriceList, { enterpriseName: str }) @@ -164,7 +165,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { } }, change: (q: any, qs: any) => { - let str = q.replace(/^\s+|\s+$/g, ''); + let str = q?.replace(/^\s+|\s+$/g, ''); if (str) { this.getRegionCode(str); this.shipperName = qs?.label; @@ -894,7 +895,7 @@ 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.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; } @@ -1235,8 +1236,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { } this.validateForm1.patchValue( { - loadingTime: new Date(Date.parse(res.loadingTime.replace(/-/g, '/'))), - unloadingTime: new Date(Date.parse(res.unloadingTime.replace(/-/g, '/'))) + loadingTime: new Date(Date.parse(res?.loadingTime.replace(/-/g, '/'))), + unloadingTime: new Date(Date.parse(res?.unloadingTime.replace(/-/g, '/'))) }, { onlySelf: true } ); @@ -1383,6 +1384,7 @@ 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 ) { const params = { insuranceType, 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 9b8a45db..a8290682 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 @@ -142,12 +142,12 @@ export class SupplyManagementReleasePublishComponent implements OnInit { maxLength: 30, ui: { widget: 'select', - serverSearch: true, + allowClear: true, searchDebounceTime: 300, searchLoadingText: '搜索中...', onSearch: (q: any) => { console.log(q === ' '); - let str = q.replace(/^\s+|\s+$/g, ''); + let str = q?.replace(/^\s+|\s+$/g, ''); if (str) { return this.service .request(this.service.$api_enterpriceList, { enterpriseName: str }) @@ -158,7 +158,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { } }, change: (q: any, qs: any) => { - let str = q.replace(/^\s+|\s+$/g, ''); + let str = q?.replace(/^\s+|\s+$/g, ''); if (str) { this.getRegionCode(str); this.shipperName = qs?.label; @@ -845,12 +845,15 @@ export class SupplyManagementReleasePublishComponent implements OnInit { 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.sf5.validator({ emitError: true }); this.sf6.validator({ emitError: true }); this.sf7.validator({ emitError: true }); - if (this.validateForm1.invalid || !this.sf3.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; } @@ -884,10 +887,10 @@ export class SupplyManagementReleasePublishComponent implements OnInit { const getFreightParms = { carLengthKeys: this.sf4.value.carLength, km: this.totalDistance }; this.service.request(this.service.$api_getFreight, getFreightParms).subscribe(res => { - if (this.sf7.value.subtotal > res.maxPrice) { + if (this.sf7.value?.subtotal > res?.maxPrice) { this.service.msgSrv.error(`运费过高,请调整录入`); return; - } else if (this.sf7.value.subtotal > res.ewPrice) { + } else if (this.sf7.value?.subtotal > res?.ewPrice) { this.modalService.confirm({ nzTitle: '', nzContent: `您的录入的运费过高,可能会影响支付,请仔细确认`, @@ -1173,6 +1176,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { // 计算保价费金额 getInsurersPrice(insuranceType = this.sf5.value?.insuranceType) { console.log(insuranceType) + console.log(this.totalDistance) if ( insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) { const params = { insuranceType,