This commit is contained in:
wangshiming
2022-04-01 14:54:14 +08:00
parent 7798b51ee9
commit 5c9f68c967
4 changed files with 83 additions and 33 deletions

View File

@ -30,6 +30,7 @@ import { OrderManagementService } from '../../../services/order-management.servi
export class orderManagementVoucherViewComponent implements OnInit {
record: any = {};
i: any;
loadPDF: string = '';
formData: any;
Status: any;
data: any ={
@ -52,6 +53,7 @@ export class orderManagementVoucherViewComponent implements OnInit {
if(this.Status == 1) {
this.schema = {
properties: {
loadingLadingBillFilePath: {
type: 'string',
@ -217,9 +219,15 @@ export class orderManagementVoucherViewComponent implements OnInit {
required: ['loadingLadingBillFilePath', 'loadingPeopleVehiclesGoodsFilePath','unloadingLadingBillFilePath','unloadingPeopleVehiclesGoodsFilePath' ]
};
}else {
console.log('只读')
this.schema = {
properties: {
no0: {
type: 'string',
title: '',
ui: {
widget: 'custom',
},
},
loadingLadingBillFilePath: {
type: 'string',
title: '装货凭证',
@ -298,6 +306,7 @@ export class orderManagementVoucherViewComponent implements OnInit {
listType: 'picture-card',
} as SFUploadWidgetSchema,
},
no4: {
type: 'string',
title: '',
@ -306,6 +315,13 @@ export class orderManagementVoucherViewComponent implements OnInit {
},
default: '单张大小不超过5M支持.jpg、.jpeg和 .png格式',
},
no6: {
type: 'string',
title: '',
ui: {
widget: 'custom',
},
},
unloadingLadingBillFilePath: {
type: 'string',
title: '卸货凭证',
@ -486,5 +502,41 @@ export class orderManagementVoucherViewComponent implements OnInit {
close(): void {
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;
}
}