export function download (url, params, filename) {
Message.warning('导出数据中')
return axios.get(url, {
params: params,
responseType:'arraybuffer',
}).then((r) => {
const content = r.data
const blob = new Blob([content],{type:'application/vnd.ms-excel'})
if ('download' in document.createElement('a')) {
const elink = document.createElement('a')
elink.download = filename
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href)
document.body.removeChild(elink)
Message.success('导出成功')
}
}).catch((r) => {
console.error(r)
Message.error('导出失败')
})
}