This commit is contained in:
wangshiming
2022-04-01 15:31:22 +08:00
parent 8e157193f0
commit 45d96c1dbd
3 changed files with 24 additions and 48 deletions

View File

@ -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'] },
},
{

View File

@ -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 @@
<sf #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="formData" button="none">
<ng-template sf-template="no0" let-me let-ui="ui" let-schema="schema">
<div style="color: #1890FF" >
<!-- <a [href]="loadPDF" (click)="openlaod(me)">电子装货单</a> -->
<div (click)="openlaod(me)">电子装货单</div>
<div (click)="openlaod(1)">电子装货单</div>
</div>
</ng-template>
<ng-template sf-template="no6" let-me let-ui="ui" let-schema="schema">
<div style="color: #1890FF">电子卸货单</div>
<div style="color: #1890FF" (click)="openlaod(2)">电子卸货单</div>
</ng-template>
</sf>
</div>

View File

@ -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);
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();
}
// 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;
}
}