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

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