From 9422e97eb6203ff11606edf8f82a7de8a08b8269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E6=99=93=E4=BA=91?= Date: Tue, 12 Apr 2022 19:45:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contract-frame.component.ts | 60 ++++++------- .../bulk-publish/bulk-publish.component.ts | 89 +++++++++++-------- .../onecar-publish.component.ts | 66 ++++++++------ .../services/supply-management.service.ts | 3 + 4 files changed, 126 insertions(+), 92 deletions(-) diff --git a/src/app/routes/contract-management/components/contract-frame/contract-frame.component.ts b/src/app/routes/contract-management/components/contract-frame/contract-frame.component.ts index 517ec984..0a13f444 100644 --- a/src/app/routes/contract-management/components/contract-frame/contract-frame.component.ts +++ b/src/app/routes/contract-management/components/contract-frame/contract-frame.component.ts @@ -33,37 +33,37 @@ export class ContractManagementFrameComponent implements OnInit { private router: Router, public shipperservice: ShipperBaseService, private datePipe: DatePipe, - ) {} + ) { } ngOnInit(): void { this.initST(); this.initSF(); } - /** - * 查询参数 - */ - get reqParams() { - const params = { - ...this.sf?.value, - } - delete params.signTime; - delete params._$expand; - if(this.datePipe.transform(this.sf?.value?.signTime?.[0], 'yyyy-MM-dd HH:mm:ss') && this.datePipe.transform(this.sf?.value?.signTime?.[1], 'yyyy-MM-dd HH:mm:ss')) { - params.signTime = { - start: this.datePipe.transform(this.sf?.value?.signTime?.[0], 'yyyy-MM-dd HH:mm:ss'), - end: this.datePipe.transform(this.sf?.value?.signTime?.[1], 'yyyy-MM-dd HH:mm:ss'), - } - } - if(this.datePipe.transform(this.sf?.value?.effectiveEndTime?.[0], 'yyyy-MM-dd HH:mm:ss') && this.datePipe.transform(this.sf?.value?.effectiveEndTime?.[1], 'yyyy-MM-dd HH:mm:ss')) { - params.effectiveEndTime = { - start: this.datePipe.transform(this.sf?.value?.effectiveEndTime?.[0], 'yyyy-MM-dd HH:mm:ss'), - end: this.datePipe.transform(this.sf?.value?.effectiveEndTime?.[1], 'yyyy-MM-dd HH:mm:ss'), - } - } - return { - ...params - }; + /** +* 查询参数 +*/ + get reqParams() { + const params = { + ...this.sf?.value, } + delete params.signTime; + delete params._$expand; + if (this.datePipe.transform(this.sf?.value?.signTime?.[0], 'yyyy-MM-dd HH:mm:ss') && this.datePipe.transform(this.sf?.value?.signTime?.[1], 'yyyy-MM-dd HH:mm:ss')) { + params.signTime = { + start: this.datePipe.transform(this.sf?.value?.signTime?.[0], 'yyyy-MM-dd HH:mm:ss'), + end: this.datePipe.transform(this.sf?.value?.signTime?.[1], 'yyyy-MM-dd HH:mm:ss'), + } + } + if (this.datePipe.transform(this.sf?.value?.effectiveEndTime?.[0], 'yyyy-MM-dd HH:mm:ss') && this.datePipe.transform(this.sf?.value?.effectiveEndTime?.[1], 'yyyy-MM-dd HH:mm:ss')) { + params.effectiveEndTime = { + start: this.datePipe.transform(this.sf?.value?.effectiveEndTime?.[0], 'yyyy-MM-dd HH:mm:ss'), + end: this.datePipe.transform(this.sf?.value?.effectiveEndTime?.[1], 'yyyy-MM-dd HH:mm:ss'), + } + } + return { + ...params + }; + } /** * 初始化数据列表 */ @@ -91,7 +91,7 @@ export class ContractManagementFrameComponent implements OnInit { title: '合同名称', width: '100px', className: 'text-center', - index: 'templateName' + index: 'contractName' }, { title: '网络货运人', index: 'enterpriseInfoName', width: '120px', className: 'text-center' }, { title: '合同对象', index: 'contractObjectName', width: '120px', className: 'text-center' }, @@ -157,7 +157,7 @@ export class ContractManagementFrameComponent implements OnInit { widget: 'dict-select', containsAllLable: true, params: { dictKey: 'contract:type' }, - containAllLable:true, + containAllLable: true, } as SFSelectWidgetSchema, }, enterpriseInfoId: { @@ -210,7 +210,7 @@ export class ContractManagementFrameComponent implements OnInit { widget: 'dict-select', containsAllLable: true, params: { dictKey: 'esign:flow:status' }, - containAllLable:true, + containAllLable: true, visibleIf: { _$expand: (value: boolean) => value, }, @@ -238,9 +238,9 @@ export class ContractManagementFrameComponent implements OnInit { } } - approval(): void {} + approval(): void { } - add(): void {} + add(): void { } routeTo(item: any) { this.router.navigate(['/ticket/invoice-requested-detail/1']); 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 722bb487..bc5f0bf6 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 @@ -271,6 +271,9 @@ export class SupplyManagementBulkPublishComponent implements OnInit { errors: { required: '请填写货物名称' }, visibleIf: { goodsTypeName: (value: any) => value && value === '其它' + }, + blur: (value: any) => { + this.checkGoodsName(); } } } @@ -583,7 +586,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit { } subStartInfo(event: any, index: number, id?: any) { if (id) { - this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {}); + this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => { }); } this.startInfo.splice(index, 1); this.validateForm1.removeControl(`loadAddress${index}`); @@ -611,7 +614,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit { } subEndInfo(event: any, index: number, id?: any) { if (id) { - this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {}); + this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => { }); } this.endInfo.splice(index, 1); this.validateForm1.removeControl(`unloadAddress${index}`); @@ -838,43 +841,43 @@ export class SupplyManagementBulkPublishComponent implements OnInit { nzContent: AmapPoiPickerComponent, nzWidth: 900, nzOnOk: item => { - if(item?.poi) { - const poi = item.poi; - const locList = poi.location.toString().split(','); - switch (type) { - case 'start': - this.startInfo[index].detailedAddress = poi.district + poi.name; - this.startInfo[index].longitude = locList[0]; - this.startInfo[index].latitude = locList[1]; - this.startInfo[index].province = poi.cityInfo.province; - this.startInfo[index].city = poi.cityInfo.city; - this.startInfo[index].area = poi.cityInfo.district; - this.startInfo[index].address = poi.name; - break; - case 'end': - this.endInfo[index].detailedAddress = poi.district + poi.name; - this.endInfo[index].longitude = locList[0]; - this.endInfo[index].latitude = locList[1]; - this.endInfo[index].province = poi.cityInfo.province; - this.endInfo[index].city = poi.cityInfo.city; - this.endInfo[index].area = poi.cityInfo.district; - this.endInfo[index].address = poi.name; - break; - default: - break; - } + if (item?.poi) { + const poi = item.poi; + const locList = poi.location.toString().split(','); + switch (type) { + case 'start': + this.startInfo[index].detailedAddress = poi.district + poi.name; + this.startInfo[index].longitude = locList[0]; + this.startInfo[index].latitude = locList[1]; + this.startInfo[index].province = poi.cityInfo.province; + this.startInfo[index].city = poi.cityInfo.city; + this.startInfo[index].area = poi.cityInfo.district; + this.startInfo[index].address = poi.name; + break; + case 'end': + this.endInfo[index].detailedAddress = poi.district + poi.name; + this.endInfo[index].longitude = locList[0]; + this.endInfo[index].latitude = locList[1]; + this.endInfo[index].province = poi.cityInfo.province; + this.endInfo[index].city = poi.cityInfo.city; + this.endInfo[index].area = poi.cityInfo.district; + this.endInfo[index].address = poi.name; + break; + default: + break; + } - if (this.startInfo[0]?.area && this.endInfo[0]?.area) { - this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => { - this.totalDistance = res.distance; - this.totalTime = res.time; - }); + if (this.startInfo[0]?.area && this.endInfo[0]?.area) { + this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => { + this.totalDistance = res.distance; + this.totalTime = res.time; + }); + } + return true + } else { + this.service.msgSrv.warning('请重新手动选择地址!') + return false } - return true - } else { - this.service.msgSrv.warning('请重新手动选择地址!') - return false - } } }); } @@ -1127,4 +1130,16 @@ export class SupplyManagementBulkPublishComponent implements OnInit { }; }); } + checkGoodsName() { + this.service.request(this.service.$api_checkGoodsName, this.sf3.value.goodsName1).subscribe(res => { + if (res === false) { + const modalRef = this.modalService.error({ + nzTitle: '货物名称含有违禁词,请重新输入!', + }); + modalRef.afterClose.subscribe(result => { + // this.sf3.setValue('/goodsName1', null); + }); + } + }); + } } 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 107e87f5..84d2dba4 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 @@ -323,6 +323,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { errors: { required: '请填写货物名称' }, visibleIf: { goodsTypeName: (value: any) => value && value === '其它' + }, + blur: (value: any) => { + this.checkGoodsName(); } } } @@ -465,10 +468,10 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { ) }, 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); } } @@ -481,7 +484,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { ui: { widget: 'custom', visibleIf: { insuranceType: (value: string) => value === '0' } - } , + }, }, type2: { type: 'string', @@ -494,7 +497,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { insurancePremium: { type: 'string', title: '服务包费用', - readOnly:true, + readOnly: true, ui: { visibleIf: { insuranceType: (value: string) => value !== '3' } } @@ -523,7 +526,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { } }, }, - required: [ 'insurancePremium'] + required: ['insurancePremium'] }; this.ui5 = { '*': { @@ -733,7 +736,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { this.service .request( this.service.$api_getAdditionalRate + - `?shipperId=${this?.sf1?.value?.shipperAppUserId || ''}&enterpriseInfoId=${items}&resourcetype='1'` + `?shipperId=${this?.sf1?.value?.shipperAppUserId || ''}&enterpriseInfoId=${items}&resourcetype='1'` ) .subscribe(res => { if (res) { @@ -986,9 +989,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { ]; // 运费信息 const expenseList = [ - { expenseCode: 'PRE', expenseName: '预付', price: this.sf7.value.prePay || 0, id: this.sf7data?.prePayId || '' ,resourceId: this.sf7data?.PREresourceId || '' }, - { expenseCode: 'RECE', expenseName: '到付', price: this.sf7.value.toPay || 0, id: this.sf7data?.toPayId || '' ,resourceId: this.sf7data?.RECEresourceId || ''}, - { expenseCode: 'BACK', expenseName: '回单付', price: this.sf7.value.receiptPay || 0, id: this.sf7data?.receiptPayId || '' ,resourceId: this.sf7data?.BACKresourceId || ''} + { expenseCode: 'PRE', expenseName: '预付', price: this.sf7.value.prePay || 0, id: this.sf7data?.prePayId || '', resourceId: this.sf7data?.PREresourceId || '' }, + { expenseCode: 'RECE', expenseName: '到付', price: this.sf7.value.toPay || 0, id: this.sf7data?.toPayId || '', resourceId: this.sf7data?.RECEresourceId || '' }, + { expenseCode: 'BACK', expenseName: '回单付', price: this.sf7.value.receiptPay || 0, id: this.sf7data?.receiptPayId || '', resourceId: this.sf7data?.BACKresourceId || '' } ]; // 从“再下一单”过来,将所有的子参数内的id都删除 if (this.PageStatus === '整车下一单') { @@ -1017,8 +1020,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { paymentDays: this.sf7.value.paymentDays, estimatedKilometers: this.totalDistance, estimatedTravelTime: this.totalTime, - subtotal :this.sf7.value.subtotal, - total:this.sf7.value.total, + subtotal: this.sf7.value.subtotal, + total: this.sf7.value.total, insurancePackagedGoods: this.sf4.value.insurancePackagedGoods, goodsValue: this.sf4.value.goodsValue }; @@ -1081,7 +1084,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { nzWidth: 900, nzOnOk: item => { console.log(item); - if(item?.poi) { + if (item?.poi) { const poi = item.poi; const locList = poi.pois; switch (type) { @@ -1106,7 +1109,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { default: break; } - + if (this.startInfo[0]?.area && this.endInfo[0]?.area) { this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => { this.totalDistance = res.distance; @@ -1114,10 +1117,10 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { this.getInsurersPrice(); // 计算保费金额 }); } - return true + return true } else { this.service.msgSrv.warning('请重新手动选择地址!') - return false + return false } } }); @@ -1155,7 +1158,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { this.totalDistance = res?.estimatedKilometers; this.totalTime = res?.estimatedTravelTime; this.sf1data = { - resourceCode:res?.resourceCode || '', + resourceCode: res?.resourceCode || '', enterpriseInfoName: res?.enterpriseInfoName, enterpriseInfoId: res?.enterpriseInfoId, dispatchPhone: res?.dispatchPhone, @@ -1423,7 +1426,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { // 计算保价费金额 getInsurersPrice(insuranceType = this.sf5.value.insuranceType) { console.log(this.totalDistance); - if (insuranceType !== '3' && this.totalDistance > 0) { + if (insuranceType !== '3' && this.totalDistance > 0) { const params = { insuranceType, goodsValue: this.sf4.value.goodsValue, @@ -1440,14 +1443,27 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { }); } } - // 运费信息价格变更 - priceChange(event:any, i:any){ - i.setValue(event); - if(event>=99999){ - this.modalService.warning({ - nzTitle: '可输入的最大金额为99999元', + // 运费信息价格变更 + priceChange(event: any, i: any) { + i.setValue(event); + if (event >= 99999) { + this.modalService.warning({ + nzTitle: '可输入的最大金额为99999元', + }); + } + this.payChange() + } + + checkGoodsName() { + this.service.request(this.service.$api_checkGoodsName, this.sf3.value.goodsName1).subscribe(res => { + if (res === false) { + const modalRef = this.modalService.error({ + nzTitle: '货物名称含有违禁词,请重新输入!', + }); + modalRef.afterClose.subscribe(result => { + // this.sf3.setValue('/goodsName1', null); }); } - this.payChange() - } + }); + } } diff --git a/src/app/routes/supply-management/services/supply-management.service.ts b/src/app/routes/supply-management/services/supply-management.service.ts index 10cbc648..f2680cc9 100644 --- a/src/app/routes/supply-management/services/supply-management.service.ts +++ b/src/app/routes/supply-management/services/supply-management.service.ts @@ -180,6 +180,9 @@ export class SupplyManagementService extends BaseService { // 发送邀请司机短信 $api_send_msg_code = `/api/mdc/pbc/smsSend/sendInviteDriver`; + // 校验货物名称是否合规 + $api_checkGoodsName = '/api/sdc/goodsResourceShipper/checkGoodsName'; + getDictByKey(dictKey: string) { const params = { dictKey: dictKey }; return this.request(this.$api_getDictValue, params);