From 0a649e65c2e28b42f0d9eecb86ce07f71ef76b0e Mon Sep 17 00:00:00 2001 From: wangshiming Date: Tue, 8 Mar 2022 19:07:46 +0800 Subject: [PATCH] fix bug --- .../release-publish/release-publish.component.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 976e71dd..2c6dba1d 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 @@ -390,7 +390,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { params: { dictKey: 'insure:packaged:goods' }, containsAllLabel: false, validator: val => { - if (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,7 +404,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { ui: { widget: 'custom', validator: val => { - if (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 []; @@ -1110,8 +1110,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit { 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); + if (this.sf3data?.goodsNameId) { + this.sf3.setValue('/goodsNameId', this.sf3data?.goodsNameId); } } else { this.service.msgSrv.error(res.msg); @@ -1162,7 +1162,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit { } // 计算保价费金额 getInsurersPrice(insuranceType = this.sf5.value.insuranceType) { - if ( this.sf5.value.insuranceType !=='3' && this.sf4.value.goodsValue >= 50000 && this.totalDistance > 0 ) { + console.log(this.sf5.value?.insuranceType) + if ( this.sf5.value?.insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) { const params = { insuranceType, goodsValue: this.sf4.value.goodsValue,