exportPositionInfo() {
this.loading = true
//【API请求】----获取表格列表数据
var orgIds;
if(this.queryParam && this.queryParam.searchParam){
orgIds = this.queryParam.searchParam.SEARCH_IN_id+""
}
this.$fetch.postAction('/GbOrgStatistics/exportVOrgPositionInfo', {
orgIds: orgIds,
}, {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
responseType: 'blob'
}).then(res => {
const link = document.createElement('a')
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const objectUrl = URL.createObjectURL(blob) // 创建URL
link.href = objectUrl
link.download = 'XXX' + '.xlsx'
link.click() // 下载文件
URL.revokeObjectURL(objectUrl)
this.loading = false
}).catch(err => {
this.$message({
message: '下载失败!',
type: 'error',
showClose: true
})
this.loading = false
})
},
excel 导出
最新推荐文章于 2025-12-05 08:37:05 发布
此博客介绍了如何通过编程实现数据接口调用,获取组织岗位信息,并将其转换为Excel文件,以便于下载。使用了axios发送POST请求,详细展示了如何设置请求头和响应类型,以及处理下载过程中的错误情况。
3192

被折叠的 条评论
为什么被折叠?



