提交 8117a1fd authored 作者: matian's avatar matian

feat:分数排名和题目数据导出

上级 951710b7
......@@ -35,6 +35,13 @@ export function getExamDataInfo(params) {
export function getScoreRanking(params) {
return httpRequest.get('/api/zy/v3-teacher/statistics/sheet-score-ranking', { params })
}
/**
* 考试数据-看板(分数排名导出)
*/
export function exportScoreList(params) {
return httpRequest.get('/api/zy/v3-teacher/statistics/sheet-score-ranking', { params, responseType: 'blob' })
}
/**
* 考试数据-看板(题目数据)
*/
......@@ -45,5 +52,8 @@ export function getTitleList(params) {
* 考试数据-看板(题目数据导出)
*/
export function exportTitleList(params) {
return httpRequest.get('/api/zy/v3-teacher/statistics/sheet-questions/download', { params })
return httpRequest.get('/api/zy/v3-teacher/statistics/sheet-questions', {
params,
responseType: 'blob'
})
}
......@@ -4,7 +4,12 @@
<h1 style="color: #333; font-size: 16px; border-left: 3px solid #aa1941; padding-left: 7px">
<span style="color: #c01540" v-show="dataInfo == 0">*</span>分数排名
</h1>
<el-button type="text" style="font-size: 16px; color: #aa1941; float: right; margin-top: -30px">导出</el-button>
<el-button
type="text"
style="font-size: 16px; color: #aa1941; float: right; margin-top: -30px"
@click="exportScore"
>导出</el-button
>
</div>
<el-tabs v-model="tabActive" @tab-click="handleClick">
<el-tab-pane label="已完成" name="finished">
......@@ -24,7 +29,7 @@
</template>
<script>
import { getScoreRanking } from '../api'
import { getScoreRanking, exportScoreList } from '../api'
import RankingAll from './RankingAll.vue'
export default {
components: { RankingAll },
......@@ -80,7 +85,6 @@ export default {
}
getScoreRanking(params).then(res => {
this.scoreRanking = res.data
console.log(this.scoreRanking, 'jfdsf')
})
},
handleClick(tab, event) {
......@@ -95,6 +99,29 @@ export default {
// 未提交
this.getScoreRanking()
}
},
// 导出
exportScore() {
const params = {
type: this.type,
course_id: this.course_id,
examination_id: this.examination_id,
download: 'true'
}
exportScoreList(params).then(r => {
const content = r
const blob = new Blob([content], { type: 'application/vnd.ms-excel' })
if ('download' in document.createElement('a')) {
const elink = document.createElement('a')
elink.download = '分数排名.xlsx'
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href)
document.body.removeChild(elink)
}
})
}
}
}
......
......@@ -2,7 +2,6 @@
<el-card style="margin-right: -20px; height: 650px">
<div slot="header" class="clearfix">
<h1 style="color: #333; font-size: 16px; border-left: 3px solid #aa1941; padding-left: 7px">
{{ dataInfo }}
<span style="color: #c01540" v-show="dataInfo == 0">*</span>题目数据
</h1>
<el-button
......@@ -75,7 +74,12 @@ export default {
},
methods: {
exportTitleData() {
const params = this.tableOptions.remote.params
const params = {
type: this.type,
course_id: this.course_id,
examination_id: this.examination_id,
download: 'true'
}
exportTitleList(params).then(r => {
const content = r
const blob = new Blob([content], { type: 'application/vnd.ms-excel' })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论