import FileSaver from 'file-saver'
import XLSX from 'xlsx'
handleDownload(excelName) {
this.$message({
showClose: true,
offset: 100,
message: '正在导出,请稍等...',
type: 'success'
});
try {
const $e = this.$refs['report-table'].$el
let $table = $e.querySelector('.el-table__fixed')
debugger;
if (!$table) {
$table = $e
}
const wb = XLSX.utils.table_to_book($table, { raw: true })
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
FileSaver.saveAs(
new Blob([wbout], { type: 'application/octet-stream' }),
`${excelName}.xlsx`,
)
} catch (e) {
if (typeof console !== 'undefined') console.error(e)
}
},