From 45d96c1dbdda5664a1a38f112a7a35bf95093717 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Fri, 1 Apr 2022 15:31:22 +0800 Subject: [PATCH] fix bug --- .../receipts-audit.component.ts | 6 +- .../voucher-view/voucher-view.component.html | 7 +-- .../voucher-view/voucher-view.component.ts | 59 ++++++------------- 3 files changed, 24 insertions(+), 48 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 1a208dab..169a656f 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,19 +397,19 @@ export class OrderManagementReceiptsAuditComponent implements OnInit { { text: '生成电子单据', click: _record => this.generate(_record, 2), - iif: item => item.auditStatus == '1' && !item.loadingLadingBillFilePath, + iif: item => !item.loadingLadingBillFilePath, acl: { ability: ['ORDER-RECEIPTS-electronicBillingOne'] }, }, { text: '通过', click: _record => this.sign(_record), - iif: item => item.auditStatus == '1' && !item.loadingLadingBillFilePath, + iif: item => !item.loadingLadingBillFilePath, acl: { ability: ['ORDER-RECEIPTS-billAuditPassBatch'] }, }, { text: '修改', click: _record => this.modification(_record), - iif: item => item.auditStatus == '1' && !item.loadingLadingBillFilePath, + iif: item => !item.loadingLadingBillFilePath, acl: { ability: ['ORDER-RECEIPTS-updateBillExamine'] }, }, { diff --git a/src/app/routes/order-management/modal/audit/voucher-view/voucher-view.component.html b/src/app/routes/order-management/modal/audit/voucher-view/voucher-view.component.html index 80895431..7cf7bc57 100644 --- a/src/app/routes/order-management/modal/audit/voucher-view/voucher-view.component.html +++ b/src/app/routes/order-management/modal/audit/voucher-view/voucher-view.component.html @@ -4,7 +4,7 @@ * @Author : Shiming * @Date : 2021-12-15 13:17:42 * @LastEditors : Shiming - * @LastEditTime : 2022-04-01 14:27:47 + * @LastEditTime : 2022-04-01 15:28:44 * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\audit\\voucher-view\\voucher-view.component.html * Copyright (C) 2022 huzhenhong. All rights reserved. --> @@ -12,12 +12,11 @@
- -
电子装货单
+
电子装货单
-
电子卸货单
+
电子卸货单
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 b3262631..2a24f881 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 @@ -32,6 +32,7 @@ export class orderManagementVoucherViewComponent implements OnInit { i: any; loadPDF: string = ''; formData: any; + datas: any; Status: any; data: any ={ weight: 0, @@ -438,17 +439,16 @@ export class orderManagementVoucherViewComponent implements OnInit { } sure() { const params = [this.i.id]; - this.service.request(this.service.$api_get_billAuditPass, params).subscribe((res) => { - if(res) { - this.service.msgSrv.success('生成电子单据成功!') - this.modal.destroy(true); - } - }) + 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 if (res.unloadingLadingBillFilePath) { this.formData = { loadingLadingBillFilePath: [ @@ -503,40 +503,17 @@ export class orderManagementVoucherViewComponent implements OnInit { this.modal.destroy(true); } openlaod(value: any) { - "https://sascs-tj-tms-test.obs.cn-south-1.myhuaweicloud.com:443/854be85a81d4471ebeb9cda464dcc5eb.pdf" - let url: any = 'https://sascs-tj-tms-test.obs.cn-south-1.myhuaweicloud.com:443/854be85a81d4471ebeb9cda464dcc5eb.pdf'; - const xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - xhr.responseType = 'blob'; - //xhr.setRequestHeader('Authorization', 'Basic a2VybWl0Omtlcm1pdA=='); - xhr.onload = () => { - if (xhr.status === 200) { - // 获取文件blob数据并保存 - var fileName = this.getFileName(url); - console.log(xhr.response); - - // saveAs(xhr.response, fileName); - } - }; - xhr.send(); - // const disp = res.headers.get('Content-Disposition'); - // const blob = new Blob([res.body], { type: 'text/plain;charset=utf-8' }); - // const url = window.URL.createObjectURL(blob); - // const a = document.createElement('a'); - // const fileName = disp.split(';')[1].split('=')[1]; - // a.href = url; - // a.download = decodeURI(fileName); - // a.click(); - // window.URL.revokeObjectURL(url); - // console.log(value?.loadingLadingBillFilePath); - // this.loadPDF = value?.loadingLadingBillFilePath; - } - getFileName(url:any) - { - var num = url.lastIndexOf('/')+1 - var fileName = url.substring(num) - //把参数和文件名分割开 - fileName = decodeURI(fileName.split("?")[0]); - return fileName; + if(value === 1) { + const a = document.createElement('a'); + console.log(this.datas?.loadingLadingBillFilePath); + a.href = this.datas?.loadingLadingBillFilePath; + a.click(); + } else { + const a = document.createElement('a'); + console.log(this.datas?.loadingPeopleVehiclesGoodsFilePath); + a.href = this.datas?.loadingPeopleVehiclesGoodsFilePath; + a.click(); + } + } }