| | |
| | | }); |
| | | }; |
| | | // 查看 |
| | | const clickDetail = row => { |
| | | if (!row.filePath) { |
| | | // const clickDetail = row => { |
| | | // if (!row.filePath) { |
| | | // ElMessage.warning('没有可预览的文件'); |
| | | // return; |
| | | // } |
| | | // fetch(row.filePath) |
| | | // .then(response => response.blob()) |
| | | // .then(res => { |
| | | // let blob = new Blob([res], { type: 'application/pdf' }); |
| | | // // pdfurl即转化后的结果 |
| | | // let pdfurl = window.URL.createObjectURL(blob); |
| | | // // 新标签页打开,即可预览并下载 |
| | | // window.open(pdfurl); |
| | | // }); |
| | | // }; |
| | | const clickDetail = val => { |
| | | const filePath = val.filePath; |
| | | if (!val.filePath) { |
| | | ElMessage.warning('没有可预览的文件'); |
| | | return; |
| | | } |
| | | fetch(row.filePath) |
| | | .then(response => response.blob()) |
| | | .then(res => { |
| | | let blob = new Blob([res], { type: 'application/pdf' }); |
| | | // pdfurl即转化后的结果 |
| | | let pdfurl = window.URL.createObjectURL(blob); |
| | | // 新标签页打开,即可预览并下载 |
| | | window.open(pdfurl); |
| | | }); |
| | | window.open(filePath, '_blank'); |
| | | }; |
| | | // 文件上传 |
| | | const onUploadFileBefore = (file, row) => { |
| | |
| | | const formData = new FormData(); |
| | | formData.append('file', file, file.name); |
| | | |
| | | |
| | | uploadFileAPI(formData).then(res => { |
| | | if (res.data.code === 200) { |
| | | const params = { |