接口
// 导出某场考试的成绩
export function scoreDownload (params) {
return request({
url: '/api/eExamInfo/download',
params,
method: 'get',
responseType: 'blob'
})
}
调用接口
// 导出
downloadScore(row){
let params = {
examInfoId: row.id
}
ExamMessage.scoreDownload(params).then(res=>{
const data = res
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }))
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', '成绩.xlsx')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
}