下载后台返回的excel文件
//下载后台返回的excel文件
export const exportExcel = (url, data = {}, name = 'bill', module = 'pay') => {
$.get({
url: UrlPrefix[module] + url,
data,
xhrFields: { responseType: 'blob' },
success: function (res) {
const aLink = document.createElement('a')
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
aLink.href = URL.createObjectURL(blob)
aLink.setAttribute('download', name + '.xlsx')
document.body.appendChild(aLink)
aLink.click()
document.body.removeChild(aLink)
URL.revokeObjectURL(aLink.href)
},
})
}