<!-- 答卷管理 -->
|
<template>
|
<div class="c">
|
<div class="bg">
|
<div class="main">
|
<!-- 待返回的标题 -->
|
<TitleIndex title="答卷管理" />
|
<div class="content">
|
<!-- 搜索 -->
|
<div>
|
<el-form :inline="true" :model="queryParam" class="demo-form-inline" label-width="80px">
|
<el-form-item>
|
<el-input v-model="queryParam.userName" placeholder="请输入名称" clearable></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button style="width:100px;" type="primary" size="small" @click="search()">查询</el-button>
|
<el-button style="width:100px;" type="danger" size="small" @click="handleExport()">导出</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<!-- 表格 -->
|
<el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%">
|
<el-table-column prop="paperName" label="试卷名称" align="center" />
|
<el-table-column prop="userName" label="用户名称" align="center" />
|
<el-table-column label="得分" width="100px">
|
<template slot-scope="{row}">
|
{{ row.userScore }} / {{ row.paperScore }}
|
</template>
|
</el-table-column>
|
<el-table-column label="题目对错" width="100px" align="center">
|
<template slot-scope="{row}">
|
{{ row.questionCorrect }} / {{ row.questionCount }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="doTime" label="耗时" width="80px" align="center" />
|
<el-table-column prop="createTime" label="提交时间" width="160px" align="center" />
|
<el-table-column label="操作" width="200px" align="center">
|
<template slot-scope="{row}">
|
<el-button size="mini" @click="view(row)">详情</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex"
|
:limit.sync="queryParam.pageSize" @pagination="search" />
|
</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
<script>
|
// 引入彈出窗口組件
|
import examPaperAnswerApi from '@/api/examPaperAnswer'
|
import Pagination from '@/components/Pagination'
|
|
export default {
|
// 注册
|
components: {
|
Pagination
|
},
|
data() {
|
return {
|
listLoading: true,
|
queryParam: {
|
examPaperId: '',
|
userName: '',
|
pageIndex: 1,
|
pageSize: 10
|
},
|
formLoading: false,
|
total: 0,
|
tableData: [],
|
visible: false,
|
subjects: []
|
};
|
},
|
created() {
|
this.queryParam.examPaperId = this.$route.query.id
|
this.search()
|
},
|
methods: {
|
// 获取列表
|
search() {
|
this.listLoading = true
|
examPaperAnswerApi.page(this.queryParam).then(re => {
|
this.tableData = re.data.list
|
this.total = re.data.total
|
this.queryParam.pageSize = re.data.pageSize
|
this.queryParam.pageIndex = re.data.pageNum
|
this.listLoading = false
|
})
|
},
|
view(row) {
|
this.$router.push({ path: '/manage/answer-detail', query: { id: row.id } });
|
},
|
handleExport() {
|
let that = this
|
let url = '/api/admin/examPaperAnswer/exportExcel?examPaperId=' + this.queryParam.examPaperId + '&userName=' + this.queryParam.userName
|
var x = new XMLHttpRequest();
|
x.open("POST", url, true);
|
x.responseType = "blob";
|
x.onload = function () {
|
var url = window.URL.createObjectURL(x.response);
|
var a = document.createElement("a");
|
a.href = url;
|
a.download = that.tableData[0].paperName + '.xlsx';
|
a.click();
|
};
|
x.send();
|
}
|
}
|
};
|
</script>
|
<style scoped lang="scss">
|
.flex {
|
display: flex;
|
}
|
|
// 内容
|
.content {
|
width: 1262px;
|
margin-bottom: 80px;
|
background-color: #fff;
|
padding: 20px 40px;
|
border-radius: 10px;
|
}
|
</style>
|