You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
8.2 KiB

4 years ago
<template>
4 years ago
<div>
4 years ago
<breadcrumb :data="'成绩管理/成绩统计'"></breadcrumb>
4 years ago
<div class="box">
4 years ago
<div class="page left">
<div class="tabs">
<a class="item active">基本信息</a>
4 years ago
</div>
4 years ago
<div class="page-content">
<div class="info">
<div class="item">
<p class="key">考试名称</p>
<p class="val">{{assessmentName}}</p>
</div>
<div class="item">
<p class="key">开始时间</p>
<p class="val">{{info.startTime}}</p>
</div>
<div class="item">
<p class="key">总分</p>
<p class="val">{{info.totalScore}}</p>
</div>
<div class="item">
<p class="key">最高分</p>
<p class="val">{{info.highestScore}}</p>
</div>
<div class="item">
<p class="key">应考人数</p>
<p class="val">{{info.shouldPeople}}</p>
</div>
<div class="item">
<p class="key">最低分</p>
<p class="val">{{info.lowestScore}}</p>
</div>
<div class="item">
<p class="key">实考人数</p>
<p class="val">{{info.actualPeople}}</p>
</div>
<div class="item">
<p class="key">平均分</p>
<p class="val">{{info.averageScore}}</p>
</div>
4 years ago
</div>
</div>
4 years ago
</div>
<div class="page right">
<div class="tabs">
<a class="item active">成绩分布图</a>
4 years ago
</div>
4 years ago
<div class="page-content">
<div class="info">
<div class="chart" id="chart"></div>
</div>
4 years ago
</div>
</div>
</div>
4 years ago
<div class="page">
<div class="tabs">
<a class="item active">考试成绩</a>
4 years ago
</div>
4 years ago
<div class="page-content">
<div class="tool">
<ul class="filter"></ul>
<div>
<el-button type="primary" size="small" round @click="exportData">导出</el-button>
</div>
4 years ago
</div>
4 years ago
<el-table :data="listData" ref="table" row-key="id" class="table" stripe header-align="center">
<el-table-column type="index" width="100" label="序号" align="center">
<template
slot-scope="scope"
>{{scope.$index + (page - 1) * pageSize + 1}}</template>
</el-table-column>
<el-table-column prop="paperName" label="试卷名称" align="center"></el-table-column>
<el-table-column prop="userName" label="学生姓名" align="center"></el-table-column>
<el-table-column prop="workNumber" label="学号" align="center"></el-table-column>
<el-table-column prop="score" label="得分" align="center"></el-table-column>
<el-table-column prop="rank" label="名次" align="center"></el-table-column>
</el-table>
<div class="pagination">
<el-pagination background @current-change="handleCurrentChange" :current-page="page" :page-size="pageSize" layout="total,prev, pager, next" :total="total"></el-pagination>
</div>
4 years ago
</div>
4 years ago
</div>
4 years ago
</div>
4 years ago
</template>
<script>
4 years ago
import { mapState,mapGetters } from 'vuex'
4 years ago
import echarts from 'echarts'
4 years ago
import breadcrumb from '@/components/breadcrumb'
import util from '@/libs/util'
4 years ago
export default {
data() {
return {
4 years ago
info: {
id: '',
actualPeople: '',
averageScore: '',
highestScore: '',
lowestScore: '',
paperName: '',
shouldPeople: '',
startTime: '',
totalScore: '',
},
4 years ago
statData: [],
listData: [],
page: 1,
pageSize: 10,
total: 0,
4 years ago
};
},
4 years ago
components: {
breadcrumb
},
4 years ago
computed: {
...mapState('user', [
'userId'
]),
...mapState('achievement', [
4 years ago
'id','assessmentId','assessmentName','classId','stuId'
4 years ago
])
},
4 years ago
mounted() {
this.getData()
4 years ago
this.getList()
4 years ago
},
methods: {
getData() {
4 years ago
this.$post(`${this.api.achievementStatistics}?userId=${this.stuId}&assessmentId=${this.assessmentId}&paperId=${this.id}&classId=${this.classId}`)
4 years ago
.then(res => {
4 years ago
this.info = res.data.list
let statData = []
for(let i in this.info){
if(i.includes('get')) statData.push(this.info[i])
}
this.statData = statData
this.getChart()
4 years ago
}).catch(err => {})
4 years ago
},
getChart(){
let myChart = echarts.init(document.getElementById('chart'))
myChart.setOption({
title: { text: '成绩分布图' },
tooltip: {},
xAxis: {
4 years ago
name: '分数',
4 years ago
type: 'category',
boundaryGap: false,
4 years ago
data: ['0-10', '11-20', '21-30', '31-40', '41-50', '51-60', '61-70', '71-80','81-90','91-100']
4 years ago
},
yAxis: {
4 years ago
name: '人数',
4 years ago
type: 'value'
},
series: [{
4 years ago
data: this.statData,
4 years ago
type: 'line',
areaStyle: {}
}]
4 years ago
})
4 years ago
},
getList() {
this.$get(`${this.api.getRanking}?pageNum=${this.page}&pageSize=${this.pageSize}&assessmentId=${this.assessmentId}`)
.then(res => {
4 years ago
let list = res.data.list.list
let len = list.length - 1
for(let i = 0; i < len; i++){
for(let j = 0; j < len; j++){
if(list[j].rank && list[j].rank > list[j + 1].rank){
let temp = list[j]
list[j] = list[j + 1]
list[j + 1] = temp
}
}
}
let hasRank = list.filter(n => n.rank)
let notRank = list.filter(n => !n.rank)
list = [...hasRank,...notRank]
this.listData = list
4 years ago
this.total = res.data.list.totalCount
})
.catch(err => {})
},
handleCurrentChange(val) {
this.page = val
this.getList()
},
exportData(){
location.href = `${this.api.getRankingExport}?assessmentId=${this.assessmentId}`
4 years ago
}
},
};
</script>
<style lang="scss" scoped>
.box{
display: flex;
4 years ago
margin-bottom: 24px;
.left{
width: 320px;
4 years ago
}
4 years ago
.right{
width: calc(80% - 344px);
margin-left: 24px;
4 years ago
}
.info{
4 years ago
.item{
4 years ago
display: flex;
align-items: center;
margin: 20px 0;
font-size: 14px;
}
4 years ago
.key,.val{
color: rgba(0, 0, 0, 0.65);
4 years ago
font-size: 14px;
}
4 years ago
.key{
width: 130px;
text-align: right;
4 years ago
}
}
.chart{
height: 400px;
}
}
</style>