|
|
@@ -1662,19 +1662,6 @@ export default {
|
|
|
this.pageRequest.pageNum = val;
|
|
|
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)
|
|
|
@@ -1685,26 +1672,22 @@ export default {
|
|
|
|
|
|
//预览文件
|
|
|
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')
|
|
|
- a.href = index.fileurl
|
|
|
- a.target = '_ blank';
|
|
|
- a.download = this.licenseNo+ '.pdf'; // 下载文件的名字
|
|
|
- a.click()
|
|
|
+ let name=index.fileurl.lastIndexOf("\/")
|
|
|
+ fetch(index.fileurl)
|
|
|
+ .then(response => response.blob())
|
|
|
+ .then(blob => {
|
|
|
+ this.saveAs(blob, index.fileurl.substring (name + 1, index.fileurl.length))
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ });
|
|
|
+
|
|
|
+ // const a = document.createElement('a')
|
|
|
+ // a.style.display = 'none'
|
|
|
+ // a.href = index.fileurl
|
|
|
+ // a.target = '_ blank';
|
|
|
+ // a.download = this.licenseNo+ '.pdf'; // 下载文件的名字
|
|
|
+ // document.body.appendChild(a)
|
|
|
+ // a.click()
|
|
|
},
|
|
|
//锚链接
|
|
|
jump(obj) {
|