|
@@ -1666,13 +1666,48 @@ export default {
|
|
|
this.pageRequest.pageNum = val;
|
|
this.pageRequest.pageNum = val;
|
|
|
this.findPage();
|
|
this.findPage();
|
|
|
},
|
|
},
|
|
|
|
|
+ getBlob(url) {
|
|
|
|
|
+ return new Promise(resolve => {
|
|
|
|
|
+ const xhr = new XMLHttpRequest()
|
|
|
|
|
+ xhr.open('GET', url)
|
|
|
|
|
+ xhr.responseType = 'blob'
|
|
|
|
|
+ xhr.onload = () => {
|
|
|
|
|
+ if (xhr.status === 200) {
|
|
|
|
|
+ resolve(xhr.response)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ xhr.send()
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ saveAs(blob, filename) {
|
|
|
|
|
+ var link = document.createElement('a')
|
|
|
|
|
+ link.href = window.URL.createObjectURL(blob)
|
|
|
|
|
+ link.target = '_ blank';
|
|
|
|
|
+ link.download = filename
|
|
|
|
|
+ link.click()
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
//预览文件
|
|
//预览文件
|
|
|
viewfile(index) {
|
|
viewfile(index) {
|
|
|
|
|
+ console.log(index,11111111)
|
|
|
|
|
+
|
|
|
|
|
+ // fetch(index.fileUrl)
|
|
|
|
|
+ // .then(response => response.blob())
|
|
|
|
|
+ // .then(blob => {
|
|
|
|
|
+ // console.log(blob,11111111)
|
|
|
|
|
+ // this.saveAs(blob, this.licenseNo +'.pdf')
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch(error => {
|
|
|
|
|
+ // });
|
|
|
|
|
+
|
|
|
|
|
+ // this.getBlob(index.fileUrl).then(blob => {
|
|
|
|
|
+ // this.saveAs(blob, this.licenseNo +'.pdf')
|
|
|
|
|
+ // })
|
|
|
|
|
+
|
|
|
const a = document.createElement('a')
|
|
const a = document.createElement('a')
|
|
|
a.href = index.fileurl
|
|
a.href = index.fileurl
|
|
|
a.target = '_ blank';
|
|
a.target = '_ blank';
|
|
|
- a.download = this.licenseNo + '-' + index.filename + '-' + index.fileTitle; // 下载文件的名字
|
|
|
|
|
- document.body.appendChild(a)
|
|
|
|
|
|
|
+ a.download = this.licenseNo+ '.pdf'; // 下载文件的名字
|
|
|
a.click()
|
|
a.click()
|
|
|
},
|
|
},
|
|
|
//锚链接
|
|
//锚链接
|