feat:完成员工档案导出

This commit is contained in:
xiongchengqiang 2020-05-21 18:39:00 +08:00
parent 814b3084de
commit 0f03b3db5f

View File

@ -191,15 +191,15 @@ export default {
// //
async handleExport () { async handleExport () {
let result = await apiExportFile() let result = await apiExportFile()
console.log('result: ', result) if ('msSaveOrOpenBlob' in navigator) {
const blob = new Blob([result], { type: 'application/json' }) window.navigator.msSaveOrOpenBlob(result, 'results.txt')
// const blob = new Blob([data], {type: 'audio/wav'}) } else {
const a = document.createElement('a') var url = window.URL.createObjectURL(result)
a.href = URL.createObjectURL(blob) var link = document.createElement('a')
a.download = '员工档案.xls' // link.href = url
a.click() link.setAttribute('download', '员工档案.xls')
URL.revokeObjectURL(a.href) link.click()
a.remove() }
}, },
// //
async handleUpLoad (file) { async handleUpLoad (file) {