const exportExcel = () => {
let param = cloneDeep(exportExcelParam.value) //自定参数
let date = moment(new Date()).format('YYYY-MM-DD HH:mm:ss') //这里用日期,避免下载名称一样被覆盖
mdItemApi
.exeportExecel(param)
.then((res) => {
//主要代码 ---start
const blob = new Blob([res.data], { type: 'application/msexcel' })
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = decodeURIComponent(date + '物料产品管理.xlsx')
link.click()
URL.revokeObjectURL(url)
//主要代码 ---end
})
.finally(() => {
spinningFlag.value = false
})
}
导出/下载excel文件
最新推荐文章于 2024-07-25 09:10:51 发布