mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 19:06:43 +08:00
成绩导出
This commit is contained in:
@@ -51,7 +51,7 @@ const pulish = function(id, publish) {
|
||||
*}
|
||||
*/
|
||||
const exports=function (query){
|
||||
return ajax.post('/xboe/m/exam/alone/answer/export',query);
|
||||
return ajax.post('/xboe/m/exam/alone/answer/export',query,{responseType: 'blob'});
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -470,6 +470,7 @@
|
||||
</div>
|
||||
<div style="padding: 0px 5px">
|
||||
<el-button icon="el-icon-search" type="primary" @click="getResults()">搜索</el-button>
|
||||
<el-button icon="el-icon-download" type="primary" @click="exportsList()">导出成绩</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -753,6 +754,26 @@ export default {
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
exportsList(){
|
||||
if(this.answerData.data.length == 0){
|
||||
return this.$message.warning('暂无导出数据!')
|
||||
}
|
||||
console.log(this.answerData.row.id,'this.answerData.row.id');
|
||||
apiTest.exports({testId: this.answerData.row.id}).then(res=>{
|
||||
if(res.status){
|
||||
this.$message.error(res.message)
|
||||
} else {
|
||||
const link = document.createElement('a');// 创建a标签
|
||||
let blob = new Blob([res],{type: 'application/vnd.ms-excel;charset=UTF-8'}); // 设置文件类型
|
||||
link.style.display = "none";
|
||||
link.href = URL.createObjectURL(blob); // 创建URL
|
||||
link.setAttribute("download", "成绩.xls");
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
})
|
||||
},
|
||||
changePaper(e) {
|
||||
this.questDirOptions.forEach(item=>{
|
||||
if(item.id == e) {
|
||||
|
||||
Reference in New Issue
Block a user