From b513099359c0080de353c95a9aa5de2e3c159c55 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Thu, 9 Dec 2021 19:21:22 +0800 Subject: [PATCH] fix bug --- .../onecar-publish.component.html | 3 +- .../onecar-publish.component.ts | 196 ++++++++++++------ .../components/vehicle/vehicle.component.html | 11 +- .../components/vehicle/vehicle.component.ts | 7 +- .../services/supply-management.service.ts | 8 +- .../list/detail/detail.component.ts | 4 +- .../components/list/edit/edit.component.ts | 4 +- .../list/img-view/img-view.component.spec.ts | 20 +- .../components/list/list.component.html | 4 +- .../vehicle/components/list/list.component.ts | 4 +- .../vehicle/services/vehicle.service.ts | 76 +------ 11 files changed, 177 insertions(+), 160 deletions(-) diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html index df423fdf..e7c8b588 100644 --- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html +++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html @@ -24,7 +24,7 @@ X¥0.00 ¥0.00 ¥0.00 + {{totalFees | currency: '¥'}}
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 fc91d884..c15f01d6 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 @@ -30,6 +30,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { sf7data: any; // 货源单设置回显 creatTime: any; // 货源单设置回显 modifyTime: any; // 货源单设置回显 + totalFees: any; // 总数信息 id = this.route.snapshot.params.id; // // 单位 unit1 = '吨'; @@ -44,7 +45,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { modifyTime: [null, []], }); } - @ViewChild('sf1', { static: false }) sf1!: SFComponent; schema1: SFSchema = {}; ui1!: SFUISchema; @@ -81,25 +81,26 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { this.initSF6(); this.initSF7(); this.initdata(); + console.log( this.route.snapshot?.queryParams) } initSF1() { this.schema1 = { properties: { - shipperAppUserNmae: { - type: 'string', - title: '货主', - maxLength: 30, - ui: { - placeholder: '请输入' - } - }, + // shipperAppUserName: { + // type: 'string', + // title: '货主', + // maxLength: 30, + // ui: { + // placeholder: '请输入' + // } + // }, enterpriseProjectName: { type: 'string', title: '项目', enum: [ - { label: '1', value: '1' }, - { label: '2', value: '2' } + { label: '项目1', value: '1' }, + { label: '项目2', value: '2' } ], ui: { widget: 'select', @@ -131,12 +132,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { placeholder: '请输入' } }, - dispatchName2: { + dispatchId: { type: 'string', title: '调度员', enum: [ - { label: '1', value: '1' }, - { label: '2', value: '2' } + { label: '调度员1', value: '1' }, + { label: '调度员2', value: '2' } ], ui: { widget: 'select', @@ -190,8 +191,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { type: 'string', title: '货物名称', enum: [ - { label: '1', value: '1' }, - { label: '2', value: '2' } + { label: '真实货物', value: '1' }, + { label: '远程货物', value: '2' }, + { label: '其他', value: '3' } ], ui: { widget: 'select', @@ -207,12 +209,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { // change: (i) => this.updateCategory(i, '/categoryId2'), } as SFSelectWidgetSchema }, - name2: { + qita: { type: 'string', title: '', ui: { visibleIf: { - name1: value => value === '1' + goodsNameId: value => value === '3' } } } @@ -223,10 +225,10 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { spanLabelFixed: 90, grid: { span: 12 } }, - $name1: { + $goodsNameId: { grid: { span: 12 } }, - $name2: { + $qita: { grid: { span: 12 } } }; @@ -377,14 +379,24 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { } }; } - + changeValue() { + this.totalFees = this.sf7?.value?.appendFee + this.sf7?.value?.oilCardPay + this.sf7?.value?.prePay +this.sf7?.value?.receiptPay + this.sf7?.value?.toPay + } initSF7() { this.schema7 = { properties: { - prePay: { type: 'number', title: '预付', default: 0, ui: { prefix: '¥' } as SFNumberWidgetSchema }, - toPay: { type: 'number', title: '到付', default: 0, ui: { prefix: '¥' } as SFNumberWidgetSchema }, - oilCardPay: { type: 'number', title: '油卡', default: 0, ui: { prefix: '¥' } as SFNumberWidgetSchema }, - receiptPay: { type: 'number', title: '回单付', default: 0, ui: { prefix: '¥' } as SFNumberWidgetSchema }, + prePay: { type: 'number', title: '预付', default: 0, ui: { prefix: '¥', change: ()=> { + this.changeValue(); + } } as SFNumberWidgetSchema }, + toPay: { type: 'number', title: '到付', default: 0, ui: { prefix: '¥',change: ()=> { + this.changeValue(); + } } as SFNumberWidgetSchema }, + oilCardPay: { type: 'number', title: '油卡', default: 0, ui: { prefix: '¥',change: ()=> { + this.changeValue(); + } } as SFNumberWidgetSchema }, + receiptPay: { type: 'number', title: '回单付', default: 0, ui: { prefix: '¥',change: ()=> { + this.changeValue(); + } } as SFNumberWidgetSchema }, oilCardPay2: { type: 'string', title: '小计', @@ -431,7 +443,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { this.startInfo.push({ detailedAddress: '', appUserName: '', - contractTelephone: '' + contractTelephone: '', + type: 1 }); } subStartInfo(event: any, index: number) { @@ -442,7 +455,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { this.endInfo.push({ detailedAddress: '', appUserName: '', - contractTelephone: '' + contractTelephone: '', + type: 2 }); } subEndInfo(event: any, index: number) { @@ -463,13 +477,34 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { this.validateForm1.controls[key].updateValueAndValidity(); }); console.log(this.validateForm1); - var d = new Date(this.validateForm1.value.createTime); - console.log(d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds()) - + + if(typeof(this.validateForm1.value.modifyTime) !== 'string' ) { + var c = new Date(this.validateForm1.value.modifyTime); + this.validateForm1.value.modifyTime = c.getFullYear() + '-' + (c.getMonth() + 1) + '-' + c.getDate() + ' ' + c.getHours() + ':' + c.getMinutes() + ':' + c.getSeconds() + } + if(typeof(this.validateForm1.value.createTime) !== 'string' ) { + var c = new Date(this.validateForm1.value.createTime); + this.validateForm1.value.createTime = c.getFullYear() + '-' + (c.getMonth() + 1) + '-' + c.getDate() + ' ' + c.getHours() + ':' + c.getMinutes() + ':' + c.getSeconds() + } + console.log(typeof(this.validateForm1.value.createTime) === 'string') if (this.validateForm1.invalid) { return; } - console.log(this.sf1.value) + console.log({...this.sf4.value, ...this.sf3.value}) + this.startInfo.createTime = this.validateForm1.value.createTime + this.startInfo.modifyTime = this.validateForm1.value.modifyTime + const params = { + ...this.sf1.value, + ...this.sf5.value, + shippingInformationDTO: { + ...this.sf7.value + }, + unLoadingPlaceList: [...this.startInfo, ...this.endInfo,], + goodsInfoList: [ + {...this.sf4.value, ...this.sf3.value} + ] + } + console.log(params) console.log(this.startInfo) console.log(this.endInfo) console.log(this.validateForm1.value) @@ -478,22 +513,35 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { console.log(this.sf5.value) console.log(this.sf6.value) console.log(this.sf7.value) - // const data = this.form.value; - // this.http.post('/register', data).subscribe(() => { - // this.router.navigateByUrl('/passport/register-result', { - // // queryParams: { email: data.mail }, - // }); - // }); - // this.router.navigateByUrl('/passport/register-result', { - // // queryParams: { email: data.mail }, - // }); + this.service.request(this.service.$api_set_saveAnotherWholeOrder, params).subscribe((res: any) => { + console.log(res) + }) } - openMap() { - this.modalService.create({ + openMap(type: string, index: number) { + const modalRef = this.modalService.create({ nzTitle: '', nzContent: AmapPoiPickerComponent, - nzWidth: 848 + nzWidth: 900, + nzOnOk: item => { + const poi = item.poi; + console.log(item) + 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]; + break; + case 'end': + this.endInfo[index].detailedAddress = poi.district + poi.name; + this.endInfo[index].longitude = locList[0]; + this.endInfo[index].latitude = locList[1]; + break; + default: + break; + } + } }); } goBack() { @@ -502,12 +550,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { // 初始化信息 initdata() { console.log(this.id) - // this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, {id:this.id}).subscribe((res) => { - this.service.request(`${this.service.$api_get_getBulkDetail}`, {id:this.id}).subscribe((res) => { + this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, {id:this.id}).subscribe((res) => { console.log(res) // this.dataList = res; this.sf1data = { - shipperAppUserNmae: res?.shipperAppUserNmae || '', + // shipperAppUserName: res?.shipperAppUserName || '', enterpriseProjectName: res?.enterpriseProjectName || '', enterpriseInfoName: res?.enterpriseInfoName || '', externalResourceCode: res?.externalResourceCode || '', @@ -515,43 +562,52 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { } res.unLoadingPlaceList.forEach((element: any) => { if(element.type === 1) { - this.startInfo.push({ - detailedAddress: element.detailedAddress, - appUserName: element.appUserName, - contractTelephone: element.contractTelephone, - }) - console.log(element) + if(this.id) { + this.startInfo.push({ + detailedAddress: element.detailedAddress, + appUserName: element.appUserName, + contractTelephone: element.contractTelephone, + type: element.type + }) + } else { + this.startInfo.push({ + detailedAddress: element.detailedAddress, + appUserName: element.appUserName, + contractTelephone: element.contractTelephone, + type: element.type, + id: element.id + }) + } if(element.createTime) { - this.creatTime = element.createTime - this.creatTime = element.modifyTime + this.creatTime = element?.createTime + this.modifyTime = element?.modifyTime } } else if(element.type === 2) { this.endInfo.push({ - detailedAddress: element.detailedAddress, - appUserName: element.appUserName, - contractTelephone: element.contractTelephone, + detailedAddress: element?.detailedAddress, + appUserName: element?.appUserName, + contractTelephone: element?.contractTelephone, + type: element.type }) } }); this.sf3data = { - goodsNameId: res?.goodsInfoList.goodsNameId || '', - weight: res?.goodsInfoList.weight || '', - volume: res?.goodsInfoList.volume || '', - externalResourceCode: res?.goodsInfoList.goodsNameId || '', + goodsNameId: res?.goodsInfoList[0]?.goodsNameId || '', } this.sf4data = { - goodsNameId: res?.goodsInfoList.goodsNameId || '', - weight: res?.goodsInfoList.weight || '', - volume: res?.goodsInfoList.volume || '', - externalResourceCode: res?.goodsInfoList.goodsNameId || '', + weight: res?.goodsInfoList[0]?.weight || '', + volume: res?.goodsInfoList[0]?.volume || '', + vehicleDemand: res?.goodsInfoList[0]?.vehicleDemand || '', } this.sf5data = { goodsValue: res?.goodsValue || '', } this.sf6data = { - stateReceipt: res?.supplementaryInformationVO.stateReceipt || '', - remarks: res?.supplementaryInformationVO.remarks || '', + stateReceipt: res?.supplementaryInformationVO?.stateReceipt || '', + remarks: res?.supplementaryInformationVO?.remarks || '', } + console.log('99999') + console.log(res?.shippingInformationVO) this.sf7data = { prePay: res?.shippingInformationVO?.prePay || '', toPay: res?.shippingInformationVO?.toPay || '', @@ -559,9 +615,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { receiptPay: res?.shippingInformationVO?.receiptPay || '', oilCardPay2: res?.shippingInformationVO?.oilCardPay || '', appendFee: res?.shippingInformationVO?.appendFee || '', - totalFee: res?.shippingInformationVO?.totalFee || '', name8: res?.shippingInformationVO?.appendFee || '', } + this.totalFees = res?.shippingInformationVO?.totalFee || '0'; //

预付:{{dataList?.shippingInformationVO?.prePay | currency: '¥' }}

//

油卡:{{dataList?.shippingInformationVO?.oilCardPay | currency: '¥'}}

//

到付:{{dataList?.shippingInformationVO?.toPay | currency: '¥'}}

@@ -579,4 +635,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { }) } + asds(i: any) { + console.log(i) + } + // const data = } diff --git a/src/app/routes/supply-management/components/vehicle/vehicle.component.html b/src/app/routes/supply-management/components/vehicle/vehicle.component.html index 9b6deaec..a69ef0a6 100644 --- a/src/app/routes/supply-management/components/vehicle/vehicle.component.html +++ b/src/app/routes/supply-management/components/vehicle/vehicle.component.html @@ -1,7 +1,7 @@