vue从后台获取数据,并导出EXCEL文件

<Button type="warning" v-if="this.$store.state.user.permissionList['报销单详情'].operationVOS.expense_list"
@click="exportDetails()" style="margin-right: 5px;">导出</Button>
 
//明细导出
exportDetails(){
this.$axios({
url:'findSampleFormPrintExport/'+this.id,
method:'get',
responseType: 'blob',
}).then((data)=>{
console.log('明细导出')
const url = window.URL.createObjectURL(data.data)
const a = document.createElement('a')
a.href = url
a.download = '样衣报销明细表.xls'
document.body.appendChild(a)
a.click()
window.URL.revokeObjectURL(url)
document.body.removeChild(a)
})
}
posted @ 2019-07-04 15:45  苏小白啊  阅读(4375)  评论(0编辑  收藏  举报