| | |
| | | return getBaseUrl() + '/pc/fin/file/uploadMore' |
| | | } |
| | | |
| | | // 预览文件 |
| | | export function previewDoc(obj) { |
| | | const routeUrl = this.$router.resolve({url: '/webOffice/preview'}) |
| | | let url = obj.url |
| | | const wordLIst = ['doc', 'docm', 'docx', 'docxf', 'dot', 'dotm', 'dotx', 'epub', 'fodt', 'fb2', 'htm', 'html', 'mht', 'odt', 'oform', 'ott', 'oxps', 'pdf', 'rtf', 'txt', 'djvu', 'xml', 'xps', 'csv', 'fods', 'ods', 'ots', 'xls', 'xlsb', 'xlsm', 'xlsx', 'xlt', 'xltm', 'xltx', 'fodp', 'odp', 'otp', 'pot', 'potm', 'potx', 'pps', 'ppsm', 'ppsx', 'ppt', 'pptm', 'pptx'] |
| | | const arr = url.split('.') |
| | | if (arr.length === 2) { |
| | | if (wordLIst.includes(arr[arr.length - 1])) { |
| | | if (obj.url.indexOf('http') !== 0) { |
| | | url = SettingIplatform.ftpUrl + url |
| | | } |
| | | window.open(routeUrl.href + '?url=' + encodeURIComponent(url) + '&docName=' + encodeURIComponent(encodeURIComponent(obj.fileName)), '_blank') |
| | | } else { |
| | | Message.warning('文件格式不支持预览!') |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 下载文件 |
| | | export function downLoad(obj) { |
| | | let url = obj.url |
| | | if (obj.url.indexOf('http') !== 0) { |
| | | url = SettingIplatform.ftpUrl + obj.url |
| | | export function downLoad(url) { |
| | | let link = url |
| | | if (link.indexOf('http') !== 0) { |
| | | link = SettingIplatform.ftpUrl + url |
| | | } |
| | | window.open(decodeURI(url)) |
| | | /* var doc = document.createElement('a') |
| | | doc.href = url |
| | | doc.download = filename |
| | | var doc = document.createElement('a') |
| | | doc.href = link |
| | | doc.target = '_blank' |
| | | doc.click()*/ |
| | | /* const loading = Loading.service({ |
| | | lock: true, |
| | | text: '正在下载...', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(0, 0, 0, 0.7)' |
| | | }) |
| | | download(obj.url, obj.name, null, loading)*/ |
| | | doc.rel = "noreferrer noopener" |
| | | doc.click() |
| | | document.body.removeChild(doc); |
| | | } |
| | | |
| | | // 上传文件 |