- {{'导出'}}
res.data,
- columnFormatter: [],
- dropColumns: [] // 需要剔除的列,例如dropColumns: ["netWeight"],即剔除净重列
- })
+ try {
+ this.exportLoading2 = true
+ let params = this.searchData2
+ if (!this.searchData.buDesc || this.searchData.buDesc === '' || this.searchData.buDesc === null) {
+ this.$message.warning('请选择BU')
+ return
+ }
+ const item = this.userBuList.find(i => i.buDesc === this.searchData.buDesc)
+ params.site = item.buNo.split('_')[0]
+ params.buNo = item.buNo.split('_')[1]
+ const response = await coreComponentsExpiortExcel(params)
+ // 创建下载链接
+ const url = window.URL.createObjectURL(new Blob([response.data]))
+ const link = document.createElement('a')
+ link.href = url
+ link.setAttribute('download', '核心备件更换记录导出.xlsx')
+ document.body.appendChild(link)
+ link.click()
+ link.remove()
+ window.URL.revokeObjectURL(url)
+ } catch (error) {
+ console.error('导出失败:', error)
+ this.$message.error('导出失败')
+ } finally {
+ this.exportLoading2 = false
+ }
},
//导出excel