考试管理 - 成绩查询&成绩统计
This commit is contained in:
parent
388803eed5
commit
0fce737944
@ -1,19 +1,19 @@
|
||||
import request from '@/utils/request';
|
||||
import request from '@/utils/request'
|
||||
|
||||
/** 获取用户试题列表*/
|
||||
export function generateExamList(examId) {
|
||||
return request({
|
||||
url: `/api/userExam/${examId}/generate`,
|
||||
method: 'get'
|
||||
});
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
/** 刷新考题列表*/
|
||||
export function refreshExamList(userExamId) {
|
||||
return request({
|
||||
url: `/api/userExam/${userExamId}`,
|
||||
method: 'get'
|
||||
});
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交一个考题*/
|
||||
@ -21,17 +21,16 @@ export function finishOneExamQuestion(data) {
|
||||
return request({
|
||||
url: '/api/userExam/finish',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/** 考试完成提交*/
|
||||
export function submitExam(examId) {
|
||||
return request({
|
||||
url: `/api/userExam/${examId}/submit`,
|
||||
method: 'put'
|
||||
});
|
||||
|
||||
method: 'put',
|
||||
})
|
||||
}
|
||||
|
||||
/** 获取用户考试列表*/
|
||||
@ -39,40 +38,41 @@ export function getPublishExam(data) {
|
||||
return request({
|
||||
url: `/api/userExam/list`,
|
||||
method: 'get',
|
||||
params: data
|
||||
});
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除用户考试*/
|
||||
export function delPublishExam(id) {
|
||||
return request({
|
||||
url: `/api/userExam/${id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
export function updateExam(data) {
|
||||
return request({
|
||||
url: `/api/userExam/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
/** 获取班级考试成绩列表 */
|
||||
export function getClassGradeList(examId, params) {
|
||||
export function getClassGradeList(params) {
|
||||
return request({
|
||||
url: `/api/userExam/paged/orgUser/${params.orgId}/${examId}`,
|
||||
url: `/api/v2/paper/user/page`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询组织学生单次考试成绩曲线 */
|
||||
export function getClassGradeStatistic(orgId, examId) {
|
||||
return request({
|
||||
url: `/api/userExam/curve/${orgId}/${examId}`,
|
||||
method: 'get'
|
||||
});
|
||||
url: `/api/v2/paper/user/curve`,
|
||||
params: { pcId: examId, orgId },
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询组织学生单次考试成绩曲线 */
|
||||
@ -80,29 +80,29 @@ export function getStuGradeStatistic(userId) {
|
||||
return request({
|
||||
url: `/api/userExam/curve/${userId}`,
|
||||
method: 'get',
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 个人仿真数据统计 */
|
||||
export function getSimulationTimeChart(mapId) {
|
||||
return request({
|
||||
url: `/api/stats/simulation/${mapId}/stats`,
|
||||
method: 'get'
|
||||
});
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 课程内实训数据统计
|
||||
export function getLessonTimeChart(id) {
|
||||
return request({
|
||||
url: `/api/stats/lesson/${id}/stats`,
|
||||
method: 'get'
|
||||
});
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 课程列表
|
||||
export function getLessonList() {
|
||||
return request({
|
||||
url: '/api/stats/lesson/list',
|
||||
method: 'get'
|
||||
});
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export function handlerUrl() {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://114.116.51.125/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.90:9000'; // 周寅
|
||||
BASE_API = 'http://192.168.3.90:9000'; // 周寅
|
||||
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
|
||||
|
@ -13,10 +13,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getClassGradeList } from '@/api/management/userexam';
|
||||
import { getClassListUnPage } from '@/api/company';
|
||||
import XLSX from 'xlsx';
|
||||
import localStore from 'storejs';
|
||||
import { getClassGradeList } from '@/api/management/userexam'
|
||||
import { getClassListUnPage } from '@/api/company'
|
||||
import XLSX from 'xlsx'
|
||||
import localStore from 'storejs'
|
||||
export default {
|
||||
name: 'GradeList',
|
||||
data() {
|
||||
@ -32,14 +32,14 @@ export default {
|
||||
noClearable: true,
|
||||
label: '班级:',
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
}
|
||||
}
|
||||
data: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
pageIndex: 'pageNum',
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
@ -49,84 +49,68 @@ export default {
|
||||
columns: [
|
||||
{
|
||||
title: '姓名',
|
||||
prop: 'username'
|
||||
prop: 'nickname',
|
||||
},
|
||||
{
|
||||
title: '学号',
|
||||
prop: 'account'
|
||||
prop: 'account',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
prop: 'result',
|
||||
type: 'tag',
|
||||
columnValue: (row) => {
|
||||
if (!row.result) {
|
||||
return '未参加';
|
||||
} else if (row.result === '01') {
|
||||
return '考试中';
|
||||
} else if (row.result === '02') {
|
||||
return '通过';
|
||||
} else if (row.result === '03') {
|
||||
return '未通过';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
tagType: (row) => { }
|
||||
columnValue: row => ['未知', '通过', '不通过', '未参加', '未提交'][row.result],
|
||||
tagType: row => ['', 'success', 'danger', 'info', 'warning'][row.result],
|
||||
},
|
||||
{
|
||||
title: '得分',
|
||||
prop: 'score'
|
||||
}
|
||||
prop: 'score',
|
||||
},
|
||||
],
|
||||
actions: [
|
||||
{ text: '导出成绩', handler: this.exportGrade }
|
||||
]
|
||||
actions: [{ text: '导出成绩', handler: this.exportGrade }],
|
||||
},
|
||||
}
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
const resp = await getClassListUnPage();
|
||||
const classList = [];
|
||||
resp.data && resp.data.forEach(item => {
|
||||
classList.push({ value: item.id, label: item.name });
|
||||
localStore.set(this.$route.path, { orgId: classList[0].value + '' });
|
||||
});
|
||||
this.queryForm.queryObject.orgId.config.data = classList;
|
||||
const resp = await getClassListUnPage()
|
||||
const classList = []
|
||||
resp.data &&
|
||||
resp.data.forEach(item => {
|
||||
classList.push({ value: item.id, label: item.name })
|
||||
localStore.set(this.$route.path, { orgId: classList[0].value + '' })
|
||||
})
|
||||
this.queryForm.queryObject.orgId.config.data = classList
|
||||
},
|
||||
methods: {
|
||||
exportGrade() {
|
||||
// ;
|
||||
const wb = XLSX.utils.book_new();
|
||||
const data = [{A: '学号', B:'姓名', C: '得分'}];
|
||||
this.queryList.data && this.queryList.data.forEach(item => {
|
||||
data.push({ A: item.account, B: item.username, C:item.score });
|
||||
});
|
||||
const ws = XLSX.utils.json_to_sheet(data, {skipHeader:true});
|
||||
ws['!cols'] = [
|
||||
{width: 20},
|
||||
{width: 20},
|
||||
{width: 20}
|
||||
];
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'file');
|
||||
XLSX.writeFile(wb, `${this.$route.query.name}成绩.xlsx`);
|
||||
const wb = XLSX.utils.book_new()
|
||||
const data = [{ A: '学号', B: '姓名', C: '得分' }]
|
||||
this.queryList.data &&
|
||||
this.queryList.data.forEach(item => {
|
||||
data.push({ A: item.account, B: item.username, C: item.score })
|
||||
})
|
||||
const ws = XLSX.utils.json_to_sheet(data, { skipHeader: true })
|
||||
ws['!cols'] = [{ width: 20 }, { width: 20 }, { width: 20 }]
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'file')
|
||||
XLSX.writeFile(wb, `${this.$route.query.name}成绩.xlsx`)
|
||||
},
|
||||
queryFunction(params) {
|
||||
return getClassGradeList(this.$route.query.examId, params);
|
||||
return getClassGradeList({ pcId: this.$route.query.examId, ...params })
|
||||
},
|
||||
back() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
this.$router.go(-1)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.title_content {
|
||||
.title_content {
|
||||
width: 100%;
|
||||
margin: 20px 0 30px;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -3,11 +3,7 @@
|
||||
<div class="title_content">{{ $route.query.name + ' 成绩统计' }}</div>
|
||||
<el-button type="text" style="position: fixed;right: 20px;top: 70px;" @click="back">返回</el-button>
|
||||
<div class="gradeStatisticPane">
|
||||
<el-form
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
style="padding-top: 18px;"
|
||||
>
|
||||
<el-form ref="queryForm" size="small" style="padding-top: 18px;">
|
||||
<el-form-item prop="orgId" label="班级:" :required="false">
|
||||
<el-select
|
||||
ref="orgId"
|
||||
@ -29,230 +25,152 @@
|
||||
</div>
|
||||
<div class="statisticChart">
|
||||
<div id="mychart1" class="statisticChartLeft" />
|
||||
<!-- <div id="mychart2" class="statisticChartRight" /> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import * as echarts from 'echarts';
|
||||
import { getClassGradeStatistic } from '@/api/management/userexam';
|
||||
import { getClassListUnPage } from '@/api/company';
|
||||
import { getExamLessonDetail } from '@/api/management/exam';
|
||||
import localStore from 'storejs';
|
||||
import * as echarts from 'echarts'
|
||||
import { getClassGradeStatistic } from '@/api/management/userexam'
|
||||
import { getClassListUnPage } from '@/api/company'
|
||||
import localStore from 'storejs'
|
||||
export default {
|
||||
name: 'GradeStatistics',
|
||||
data() {
|
||||
return {
|
||||
orgId:'',
|
||||
myChart1:null,
|
||||
// myChart2:null,
|
||||
// userNameList:[],
|
||||
// gradeList:[],
|
||||
classList:[],
|
||||
// durationList:[],
|
||||
fullPoint:0,
|
||||
passingPoint:0,
|
||||
duration:0,
|
||||
title:{
|
||||
show:true,
|
||||
text:'成绩分布',
|
||||
textAlign:'center',
|
||||
left:'50%',
|
||||
top:'5px',
|
||||
textStyle:{
|
||||
color:'#f00'
|
||||
orgId: '',
|
||||
myChart1: null,
|
||||
classList: [],
|
||||
fullPoint: 0,
|
||||
passingPoint: 0,
|
||||
duration: 0,
|
||||
title: {
|
||||
show: true,
|
||||
text: '成绩分布',
|
||||
textAlign: 'center',
|
||||
left: '50%',
|
||||
top: '5px',
|
||||
textStyle: {
|
||||
color: '#f00',
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
position: 'left',
|
||||
name: '人数',
|
||||
nameLocation: 'end',
|
||||
min: 0,
|
||||
nameTextStyle: {
|
||||
align: 'left',
|
||||
fontSize: 14,
|
||||
},
|
||||
axisLine: { show: true },
|
||||
},
|
||||
gradeInterval: [],
|
||||
}
|
||||
},
|
||||
// title1:{
|
||||
// show:true,
|
||||
// text:' 答题时长区间人数 ',
|
||||
// // 各分数区间人数统计
|
||||
// textAlign:'center',
|
||||
// left:'50%',
|
||||
// top:'5px',
|
||||
// textStyle:{
|
||||
// color:'#f00'
|
||||
// }
|
||||
// },
|
||||
// yAxis1:{
|
||||
// position:'left',
|
||||
// name:'人数',
|
||||
// nameLocation:'end',
|
||||
// minInterval:1,
|
||||
// nameTextStyle:{
|
||||
// align:'left',
|
||||
// fontSize:14
|
||||
// },
|
||||
// axisLine:{show:true}
|
||||
// },
|
||||
yAxis:{
|
||||
position:'left',
|
||||
name:'人数',
|
||||
nameLocation:'end',
|
||||
min:0,
|
||||
nameTextStyle:{
|
||||
align:'left',
|
||||
fontSize:14
|
||||
},
|
||||
axisLine:{show:true}
|
||||
},
|
||||
gradeInterval:[]
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
const resp = await getClassListUnPage();
|
||||
resp.data && resp.data.forEach(item => {
|
||||
this.classList.push({ value: item.id, label: item.name });
|
||||
});
|
||||
localStore.set(this.$route.path, { orgId: this.classList[0].value + '' });
|
||||
this.orgId = this.classList[0].value;
|
||||
var chartDom1 = document.getElementById('mychart1');
|
||||
this.myChart1 = echarts.init(chartDom1);
|
||||
// var chartDom2 = document.getElementById('mychart2');
|
||||
// this.myChart2 = echarts.init(chartDom2);
|
||||
const eachInterval = this.fullPoint / 10;
|
||||
this.gradeInterval = [];
|
||||
for(var i=0;i<10;i++){
|
||||
this.gradeInterval.push(eachInterval*i+'-'+eachInterval*(i+1));
|
||||
}
|
||||
const resp = await getClassListUnPage()
|
||||
resp.data &&
|
||||
resp.data.forEach(item => {
|
||||
this.classList.push({ value: item.id, label: item.name })
|
||||
})
|
||||
localStore.set(this.$route.path, { orgId: this.classList[0].value + '' })
|
||||
this.orgId = this.classList[0].value
|
||||
|
||||
var chartDom1 = document.getElementById('mychart1')
|
||||
this.myChart1 = echarts.init(chartDom1)
|
||||
const option = {
|
||||
title:this.title,
|
||||
title: this.title,
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
name:'分数区间',
|
||||
data: this.gradeInterval
|
||||
name: '分数区间',
|
||||
data: this.gradeInterval,
|
||||
},
|
||||
yAxis:this.yAxis,
|
||||
tooltip:{
|
||||
show:true,
|
||||
trigger:'axis'
|
||||
yAxis: this.yAxis,
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'axis',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data:[],
|
||||
type: 'bar'
|
||||
data: [],
|
||||
type: 'bar',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
};
|
||||
option && this.myChart1 && this.myChart1.setOption(option);
|
||||
this.getClassGradeStatis();
|
||||
option && this.myChart1 && this.myChart1.setOption(option)
|
||||
this.getClassGradeStatis()
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
this.$router.go(-1);
|
||||
this.$router.go(-1)
|
||||
},
|
||||
getClassGradeStatis() {
|
||||
if (this.orgId) {
|
||||
// this.userNameList = [];
|
||||
// this.gradeList = [];
|
||||
// this.myChart1.restore();
|
||||
getClassGradeStatistic(this.orgId, this.$route.query.examId).then(resp=>{
|
||||
const results = resp.data;
|
||||
getClassGradeStatistic(this.orgId, this.$route.query.examId)
|
||||
.then(resp => {
|
||||
const results = resp.data
|
||||
if (results) {
|
||||
const gradeList = results.results;
|
||||
const countList = [0,0,0,0,0,0,0,0,0,0];
|
||||
this.fullPoint = results.fullScore
|
||||
const gradeList = results.detail
|
||||
const countList = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
if (gradeList.length > 0) {
|
||||
gradeList.forEach(each=>{
|
||||
// this.userNameList.push(each.username || '');
|
||||
// this.gradeList.push(each.score);
|
||||
// this.durationList.push(each.duration || 0);
|
||||
countList[Math.floor((each.score || 0) / (this.fullPoint/ 10))]++;
|
||||
});
|
||||
let option=this.myChart1.getOption();
|
||||
// debugger
|
||||
option.series[0].data=countList;
|
||||
// const option1 = {
|
||||
// title1:this.title1,
|
||||
// xAxis: {
|
||||
// name:'时长区间/s',
|
||||
// type: 'category',
|
||||
// data: this.durationInterval
|
||||
// },
|
||||
// yAxis: this.yAxis1,
|
||||
// tooltip:{
|
||||
// show:true,
|
||||
// trigger:'axis'
|
||||
// },
|
||||
// series: [
|
||||
// {
|
||||
// data:countList,
|
||||
// type: 'bar'
|
||||
// }
|
||||
// ]
|
||||
// };
|
||||
option && this.myChart1 && this.myChart1.setOption(option);
|
||||
// option1 && this.myChart2 && this.myChart2.setOption(option1);
|
||||
// debugger;
|
||||
// id": "92",
|
||||
// "userId": "92",
|
||||
// "account": "d8h4pz",
|
||||
// "username": "博涛.朱",
|
||||
// "examId": "92",
|
||||
// "examName": "博涛.朱",
|
||||
// "score": 29.38,
|
||||
// "usedTime": 727,
|
||||
// "result": "dbw206",
|
||||
// "duration": 429,
|
||||
}
|
||||
}
|
||||
}).catch((error) => {
|
||||
// const option1 = {
|
||||
// title:this.title1,
|
||||
// xAxis: {
|
||||
// name:'时长区间/s',
|
||||
// type: 'category',
|
||||
// data: this.durationInterval
|
||||
// },
|
||||
// yAxis:this.yAxis1,
|
||||
// series: [
|
||||
// {
|
||||
// data:[],
|
||||
// type: 'bar'
|
||||
// }
|
||||
// ]
|
||||
// };
|
||||
// option1 && this.myChart2 && this.myChart2.setOption(option1);
|
||||
this.$message.error(error.message);
|
||||
});
|
||||
gradeList.forEach(each => {
|
||||
countList[Math.floor((each.score || 0) / (this.fullPoint / 10))]++
|
||||
})
|
||||
let option = this.myChart1.getOption()
|
||||
|
||||
const eachInterval = this.fullPoint / 10
|
||||
this.gradeInterval = []
|
||||
for (var i = 0; i < 10; i++) {
|
||||
this.gradeInterval.push(eachInterval * i + '-' + eachInterval * (i + 1))
|
||||
}
|
||||
option.series[0].data = countList
|
||||
option.xAxis[0].data = this.gradeInterval
|
||||
option && this.myChart1 && this.myChart1.setOption(option)
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message.error(error.message)
|
||||
})
|
||||
}
|
||||
},
|
||||
onChange(data) {
|
||||
this.getClassGradeStatis();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.getClassGradeStatis()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.title_content {
|
||||
.title_content {
|
||||
width: 100%;
|
||||
margin: 20px 0 30px;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.gradeStatisticPane{
|
||||
}
|
||||
.gradeStatisticPane {
|
||||
margin: 0 auto;
|
||||
width: 300px;
|
||||
}
|
||||
.statisticChart{
|
||||
}
|
||||
.statisticChart {
|
||||
/* margin-left: 50%; */
|
||||
/* transform: translateX(-50%); */
|
||||
width:90%;
|
||||
width: 90%;
|
||||
display: flex;
|
||||
margin-left:5%;
|
||||
}
|
||||
.statisticChartLeft{
|
||||
margin-left: 5%;
|
||||
}
|
||||
.statisticChartLeft {
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
height: 500px;
|
||||
/* margin-left:25%; */
|
||||
/* border:1px #ccc solid */
|
||||
}
|
||||
.statisticChartRight{
|
||||
}
|
||||
.statisticChartRight {
|
||||
width: 50%;
|
||||
display: inline-block;
|
||||
height: 500px;
|
||||
/* border:1px #ccc solid */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user