From 33c6fc64e820d0ace1420cad0bf1a1858ea71efe Mon Sep 17 00:00:00 2001 From: wangshiming Date: Thu, 21 Apr 2022 14:39:31 +0800 Subject: [PATCH] fix bug --- .../receipts-audit.component.ts | 8 +- .../voucher-view/voucher-view.component.ts | 242 +++++++++++------- .../services/order-management.service.ts | 5 + 3 files changed, 159 insertions(+), 96 deletions(-) diff --git a/src/app/routes/order-management/components/receipts-audit/receipts-audit.component.ts b/src/app/routes/order-management/components/receipts-audit/receipts-audit.component.ts index 5588a7b0..c3ddd93f 100644 --- a/src/app/routes/order-management/components/receipts-audit/receipts-audit.component.ts +++ b/src/app/routes/order-management/components/receipts-audit/receipts-audit.component.ts @@ -397,25 +397,25 @@ export class OrderManagementReceiptsAuditComponent implements OnInit { { text: '生成电子单据', click: _record => this.generate(_record, 2), - iif: item => !item?.loadingElectronicsLadingBillFilePath, + iif: item => !item?.loadingElectronicsLadingBillFilePath || !item?.unloadingElectronicsLadingBillFilePath, acl: { ability: ['ORDER-RECEIPTS-electronicBillingOne'] }, }, { text: '通过', click: _record => this.sign(_record), - iif: item => !item?.loadingElectronicsLadingBillFilePath, + iif: item => !item?.loadingElectronicsLadingBillFilePath || !item?.unloadingElectronicsLadingBillFilePath, acl: { ability: ['ORDER-RECEIPTS-billAuditPassBatch'] }, }, { text: '修改', click: _record => this.modification(_record), - iif: item => !item?.loadingElectronicsLadingBillFilePath, + iif: item => !item?.loadingElectronicsLadingBillFilePath || !item?.unloadingElectronicsLadingBillFilePath, acl: { ability: ['ORDER-RECEIPTS-updateBillExamine'] }, }, { text: '查看凭证', click: _record => this.generate(_record, 3), - iif: item => item?.loadingElectronicsLadingBillFilePath, + iif: item => item?.loadingElectronicsLadingBillFilePath && item?.unloadingElectronicsLadingBillFilePath, acl: { ability: ['ORDER-RECEIPTS-view'] }, }, ] diff --git a/src/app/routes/order-management/modal/audit/voucher-view/voucher-view.component.ts b/src/app/routes/order-management/modal/audit/voucher-view/voucher-view.component.ts index 4594edb6..5b8fa7ba 100644 --- a/src/app/routes/order-management/modal/audit/voucher-view/voucher-view.component.ts +++ b/src/app/routes/order-management/modal/audit/voucher-view/voucher-view.component.ts @@ -1,4 +1,3 @@ - import { Component, OnInit, ViewChild } from '@angular/core'; import { DatePipe } from '@angular/common'; import { @@ -41,20 +40,25 @@ export class orderManagementVoucherViewComponent implements OnInit { @ViewChild('sf', { static: false }) sf!: SFComponent; schema: SFSchema = {}; ui: SFUISchema = {}; - constructor(private modal: NzModalRef, private msgSrv: NzMessageService, public http: _HttpClient, public service: OrderManagementService, private datePipe: DatePipe, private envSrv: EAEnvironmentService,) { } + constructor( + private modal: NzModalRef, + private msgSrv: NzMessageService, + public http: _HttpClient, + public service: OrderManagementService, + private datePipe: DatePipe, + private envSrv: EAEnvironmentService + ) {} ngOnInit(): void { - console.log(this.i) - this.initData() + console.log(this.i); + this.initData(); this.i.time = this.i.loadingTime; this.initSF(); } initSF() { - console.log(this.Status) + console.log(this.Status); if (this.Status == 1) { - this.schema = { - properties: { loadingLadingBillFilePath: { type: 'string', @@ -73,7 +77,7 @@ export class orderManagementVoucherViewComponent implements OnInit { content: [ `上传用户:${this.i?.driverName}(${this.i?.driverTelephone})`, `上传位置:${this.i?.loadingAddressArr[0]}`, - `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}`, + `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}` ], position: '2', fontSize: '100' @@ -98,8 +102,8 @@ export class orderManagementVoucherViewComponent implements OnInit { }); }, multiple: false, - listType: 'picture-card', - } as SFUploadWidgetSchema, + listType: 'picture-card' + } as SFUploadWidgetSchema }, loadingPeopleVehiclesGoodsFilePath: { type: 'string', @@ -118,7 +122,7 @@ export class orderManagementVoucherViewComponent implements OnInit { content: [ `上传用户:${this.i?.driverName}(${this.i?.driverTelephone})`, `上传位置:${this.i?.loadingAddressArr[0]}`, - `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}`, + `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}` ], position: '2', fontSize: '100' @@ -143,16 +147,16 @@ export class orderManagementVoucherViewComponent implements OnInit { }); }, multiple: false, - listType: 'picture-card', - } as SFUploadWidgetSchema, + listType: 'picture-card' + } as SFUploadWidgetSchema }, no4: { type: 'string', title: '', ui: { - widget: 'text', + widget: 'text' }, - default: '单张大小不超过5M,支持.jpg、.jpeg和 .png格式', + default: '单张大小不超过5M,支持.jpg、.jpeg和 .png格式' }, unloadingLadingBillFilePath: { type: 'string', @@ -171,7 +175,7 @@ export class orderManagementVoucherViewComponent implements OnInit { content: [ `上传用户:${this.i?.driverName}(${this.i?.driverTelephone})`, `上传位置:${this.i?.unloadingAddressArr[0]}`, - `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}`, + `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}` ], position: '2', fontSize: '100' @@ -196,8 +200,8 @@ export class orderManagementVoucherViewComponent implements OnInit { }); }, multiple: false, - listType: 'picture-card', - } as SFUploadWidgetSchema, + listType: 'picture-card' + } as SFUploadWidgetSchema }, unloadingPeopleVehiclesGoodsFilePath: { type: 'string', @@ -216,7 +220,7 @@ export class orderManagementVoucherViewComponent implements OnInit { content: [ `上传用户:${this.i?.driverName}(${this.i?.driverTelephone})`, `上传位置:${this.i?.unloadingAddressArr[0]}`, - `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}`, + `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}` ], position: '2', fontSize: '100' @@ -241,11 +245,16 @@ export class orderManagementVoucherViewComponent implements OnInit { }); }, multiple: false, - listType: 'picture-card', - } as SFUploadWidgetSchema, + listType: 'picture-card' + } as SFUploadWidgetSchema } }, - required: ['loadingLadingBillFilePath', 'loadingPeopleVehiclesGoodsFilePath', 'unloadingLadingBillFilePath', 'unloadingPeopleVehiclesGoodsFilePath'] + required: [ + 'loadingLadingBillFilePath', + 'loadingPeopleVehiclesGoodsFilePath', + 'unloadingLadingBillFilePath', + 'unloadingPeopleVehiclesGoodsFilePath' + ] }; } else { this.schema = { @@ -254,8 +263,8 @@ export class orderManagementVoucherViewComponent implements OnInit { type: 'string', title: '', ui: { - widget: 'custom', - }, + widget: 'custom' + } }, loadingLadingBillFilePath: { type: 'string', @@ -275,7 +284,7 @@ export class orderManagementVoucherViewComponent implements OnInit { content: [ `上传用户:${this.i?.driverName}(${this.i?.driverTelephone})`, `上传位置:${this.i?.loadingAddressArr[0]}`, - `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}`, + `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}` ], position: '2', fontSize: '100' @@ -300,8 +309,8 @@ export class orderManagementVoucherViewComponent implements OnInit { }); }, multiple: false, - listType: 'picture-card', - } as SFUploadWidgetSchema, + listType: 'picture-card' + } as SFUploadWidgetSchema }, loadingPeopleVehiclesGoodsFilePath: { type: 'string', @@ -321,7 +330,7 @@ export class orderManagementVoucherViewComponent implements OnInit { content: [ `上传用户:${this.i?.driverName}(${this.i?.driverTelephone})`, `上传位置:${this.i?.loadingAddressArr[0]}`, - `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}`, + `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}` ], position: '2', fontSize: '100' @@ -346,24 +355,24 @@ export class orderManagementVoucherViewComponent implements OnInit { }); }, multiple: false, - listType: 'picture-card', - } as SFUploadWidgetSchema, + listType: 'picture-card' + } as SFUploadWidgetSchema }, no4: { type: 'string', title: '', ui: { - widget: 'text', + widget: 'text' }, - default: '单张大小不超过5M,支持.jpg、.jpeg和 .png格式', + default: '单张大小不超过5M,支持.jpg、.jpeg和 .png格式' }, no6: { type: 'string', title: '', ui: { - widget: 'custom', - }, + widget: 'custom' + } }, unloadingLadingBillFilePath: { type: 'string', @@ -383,7 +392,7 @@ export class orderManagementVoucherViewComponent implements OnInit { content: [ `上传用户:${this.i?.driverName}(${this.i?.driverTelephone})`, `上传位置:${this.i?.unloadingAddressArr[0]}`, - `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}`, + `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}` ], position: '2', fontSize: '100' @@ -408,8 +417,8 @@ export class orderManagementVoucherViewComponent implements OnInit { }); }, multiple: false, - listType: 'picture-card', - } as SFUploadWidgetSchema, + listType: 'picture-card' + } as SFUploadWidgetSchema }, unloadingPeopleVehiclesGoodsFilePath: { type: 'string', @@ -429,7 +438,7 @@ export class orderManagementVoucherViewComponent implements OnInit { content: [ `上传用户:${this.i?.driverName}(${this.i?.driverTelephone})`, `上传位置:${this.i?.unloadingAddressArr[0]}`, - `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}`, + `上传时间:${format(new Date(), 'yyyy-MM-dd HH:mm:ss')}` ], position: '2', fontSize: '100' @@ -454,11 +463,16 @@ export class orderManagementVoucherViewComponent implements OnInit { }); }, multiple: false, - listType: 'picture-card', - } as SFUploadWidgetSchema, + listType: 'picture-card' + } as SFUploadWidgetSchema } }, - required: ['loadingLadingBillFilePath', 'loadingPeopleVehiclesGoodsFilePath', 'unloadingLadingBillFilePath', 'unloadingPeopleVehiclesGoodsFilePath'] + required: [ + 'loadingLadingBillFilePath', + 'loadingPeopleVehiclesGoodsFilePath', + 'unloadingLadingBillFilePath', + 'unloadingPeopleVehiclesGoodsFilePath' + ] }; } this.ui = { @@ -469,42 +483,42 @@ export class orderManagementVoucherViewComponent implements OnInit { $unloadingLadingBillFilePath: { grid: { span: 12 } }, $unloadingPeopleVehiclesGoodsFilePath: { grid: { span: 12 } }, $loadingLadingBillFilePath: { grid: { span: 12 } }, - $loadingPeopleVehiclesGoodsFilePath: { grid: { span: 12 } }, + $loadingPeopleVehiclesGoodsFilePath: { grid: { span: 12 } } }; } save(value: any): void { if (!this.sf.valid) { - this.service.msgSrv.warning('必填项为空!') + this.service.msgSrv.warning('必填项为空!'); return; } - console.log(value) + console.log(value); const params = { id: this.i?.id, loadingLadingBillFilePath: value?.loadingLadingBillFilePath?.data?.fullFilePath, loadingPeopleVehiclesGoodsFilePath: value?.loadingPeopleVehiclesGoodsFilePath?.data?.fullFilePath, unloadingLadingBillFilePath: value?.unloadingLadingBillFilePath?.data?.fullFilePath, - unloadingPeopleVehiclesGoodsFilePath: value?.unloadingPeopleVehiclesGoodsFilePath?.data?.fullFilePath, - } - console.log(params) - this.service.request(this.service.$api_get_updateBillExamine, params).subscribe((res) => { + unloadingPeopleVehiclesGoodsFilePath: value?.unloadingPeopleVehiclesGoodsFilePath?.data?.fullFilePath + }; + console.log(params); + this.service.request(this.service.$api_get_updateBillExamine, params).subscribe(res => { if (res) { - this.service.msgSrv.success('修改成功!') + this.service.msgSrv.success('修改成功!'); this.modal.destroy(true); } - }) + }); } sure() { const params = [this.i?.id]; - this.service.downloadFile(this.service.$api_createBillTakeGoods, params) - this.service.downloadFile(this.service.$api_createBillDischargeGoods, params) - this.service.msgSrv.success('生成电子单据成功!') + this.service.downloadFile(this.service.$api_createBillTakeGoods, params); + this.service.downloadFile(this.service.$api_createBillDischargeGoods, params); + this.service.msgSrv.success('生成电子单据成功!'); this.modal.destroy(true); } // 确认到车界面信息(两个只能看的图片) initData() { - this.service.request(this.service.$api_get_getCredentials, { id: this.i?.id }).subscribe((res) => { - console.log(res) - this.datas = res + this.service.request(this.service.$api_get_getCredentials, { id: this.i?.id }).subscribe(res => { + console.log(res); + this.datas = res; if (res.unloadingLadingBillFilePath) { this.formData = { loadingLadingBillFilePath: [ @@ -514,9 +528,9 @@ export class orderManagementVoucherViewComponent implements OnInit { status: 'done', url: res.loadingLadingBillFilePath, response: { - url: res.loadingLadingBillFilePath, - }, - }, + url: res.loadingLadingBillFilePath + } + } ], loadingPeopleVehiclesGoodsFilePath: [ { @@ -525,9 +539,9 @@ export class orderManagementVoucherViewComponent implements OnInit { status: 'done', url: res.loadingPeopleVehiclesGoodsFilePath, response: { - url: res.loadingPeopleVehiclesGoodsFilePath, - }, - }, + url: res.loadingPeopleVehiclesGoodsFilePath + } + } ], unloadingLadingBillFilePath: [ { @@ -536,9 +550,9 @@ export class orderManagementVoucherViewComponent implements OnInit { status: 'done', url: res.unloadingLadingBillFilePath, response: { - url: res.unloadingLadingBillFilePath, - }, - }, + url: res.unloadingLadingBillFilePath + } + } ], unloadingPeopleVehiclesGoodsFilePath: [ { @@ -547,44 +561,88 @@ export class orderManagementVoucherViewComponent implements OnInit { status: 'done', url: res.unloadingPeopleVehiclesGoodsFilePath, response: { - url: res.unloadingPeopleVehiclesGoodsFilePath, - }, - }, - ], + url: res.unloadingPeopleVehiclesGoodsFilePath + } + } + ] }; } - }) + }); } close(): void { this.modal.destroy(true); } openlaod(value: any) { - if (value === 1) { - if(this.datas?.esignFlowStatus == '1') { - this.service.request(this.service.$api_getBillTakeEsignFile, [this.datas?.id]).subscribe((res) => { + if (!this.datas?.loadingElectronicsLadingBillFilePath) { + this.service.request(this.service.$api_createBillTakeGoods, [this.datas?.id]).subscribe(res => { console.log(res); - }) + if (res) { + console.log(res[0].esignFlowStatus); + + switch (res[0]?.esignFlowStatus) { + case 1: + case '1': + console.log(res[0]?.esignFlowStatus); + + this.service.msgSrv.success('电子装货单签署中!') + this.service.request(this.service.$api_getBillTakeEsignFile, [this.datas?.id]).subscribe(res => { + console.log(res); + if(res[0]?.esignFlowStatus == '2') { + this.service.msgSrv.success('电子装货单已生效!') + this.modal.destroy(true); + } + }); + return ; + case 2: + + return; + } + } + }); + } else { + const a = document.createElement('a'); + a.href = this.datas?.loadingElectronicsLadingBillFilePath; + document.body.appendChild(a); + console.log(document.body.contains(a)); + a.click(); //点击下载 + document.body.removeChild(a); //下载完成移除元素 } - const a = document.createElement('a'); - a.href = this.datas?.loadingElectronicsLadingBillFilePath; - document.body.appendChild(a); - console.log(document.body.contains(a)) - a.click(); //点击下载 - document.body.removeChild(a); //下载完成移除元素 } else { - if(this.datas?.esignFlowStatus == '1') { - this.service.request(this.service.$api_getBillTakeEsignFile, [this.datas?.id]).subscribe((res) => { - console.log(res); - }) - } - const a = document.createElement('a'); - a.href = this.datas?.unloadingElectronicsLadingBillFilePath; - document.body.appendChild(a); - console.log(document.body.contains(a)) - a.click(); //点击下载 - document.body.removeChild(a); //下载完成移除元素 - } + if (!this.datas?.unloadingElectronicsLadingBillFilePath) { + this.service.request(this.service.$api_createBillDischargeGoods, [this.datas?.id]).subscribe(res => { + console.log(res); + if (res) { + console.log(res[0].esignFlowStatus); + + switch (res[0]?.esignFlowStatus) { + case 1: + case '1': + console.log(res[0]?.esignFlowStatus); + + this.service.msgSrv.success('电子卸货单签署中!') + this.service.request(this.service.$api_getBillDischargeEsignFile, [this.datas?.id]).subscribe(res => { + console.log(res); + if(res[0]?.esignFlowStatus == '2') { + this.service.msgSrv.success('电子卸货单已生效!') + this.modal.destroy(true); + } + }); + return ; + case 2: + return; + } + } + }); + } else { + const a = document.createElement('a'); + a.href = this.datas?.unloadingElectronicsLadingBillFilePath; + document.body.appendChild(a); + console.log(document.body.contains(a)); + a.click(); //点击下载 + document.body.removeChild(a); //下载完成移除元素 + } + } } } diff --git a/src/app/routes/order-management/services/order-management.service.ts b/src/app/routes/order-management/services/order-management.service.ts index 12584bca..2c7f4a05 100644 --- a/src/app/routes/order-management/services/order-management.service.ts +++ b/src/app/routes/order-management/services/order-management.service.ts @@ -214,6 +214,11 @@ export class OrderManagementService extends ShipperBaseService { public $api_getBillTakeEsignFile = `/api/sdc/billOperate/getBillTakeEsignFile`; // 获取电子卸货单签章附件 public $api_getBillDischargeEsignFile = `/api/sdc/billOperate/getBillDischargeEsignFile`; + + // // 生成卸货单 + // public $api_createBillDischargeGoods = `/api/sdc/billOperate/createBillDischargeGoods`; + // // 生成提货单 + // public $api_createBillTakeGoods = `/api/sdc/billOperate/createBillTakeGoods`; /** * 根据企业ID,获取企业历史网络货运人 * @returns