导出表格操作

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-16 15:50:47
// 导出参与人名单
        exportPlayerInfo () {
            let form = {
                activityId: this.activityId
            }
            API.exportPlayerInfo(form).then(res => {
                if (+res.status === 200) {
                    if (+res.data.code === -1) {
                        this.sentMsg(res.data.message)
                        return
                    }
                    let elink = document.createElement('a')
                    elink.download = this.table.title + '.xls'
                    elink.style.display = 'none'

                    let blob = new Blob([res.body])
                    elink.href = window.URL.createObjectURL(blob)

                    document.body.appendChild(elink)
                    elink.click()
                    document.body.removeChild(elink)
                } else {
                    this.sentMsg(res.data.message || '下载失败')
                }
            }, res => {
                this.sentMsg()
            })
        },
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!