学生统计信息代码调整

This commit is contained in:
joylink_cuiweidong 2022-04-18 09:28:37 +08:00
parent 87dc324d74
commit fc9c148753
8 changed files with 373 additions and 86 deletions

View File

@ -76,10 +76,34 @@ export function getClassGradeStatistic(orgId, examId) {
} }
/** 查询组织学生单次考试成绩曲线 */ /** 查询组织学生单次考试成绩曲线 */
export function getStuGradeStatistic() { export function getStuGradeStatistic(params) {
return request({ return request({
url: `/api/userExam/curve/personal`, url: `/api/userExam/curve/personal`,
method: 'get',
params
});
}
/** 个人仿真数据统计 */
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'
});
}
// 课程列表
export function getLessonList() {
return request({
url: '/api/stats/lesson/list',
method: 'get'
});
}

View File

@ -53,6 +53,7 @@ export default {
}, },
isCGY() { isCGY() {
return getSessionStorage('project') === 'cgy'; return getSessionStorage('project') === 'cgy';
// gzb
} }
}, },
mounted() { mounted() {

View File

@ -172,6 +172,7 @@ const StudentManage = () => import('@/views/organization/classManage/studentMana
const DurationView = () => import('@/views/organization/classManage/durationView'); const DurationView = () => import('@/views/organization/classManage/durationView');
const GradeList = () => import('@/views/organization/examManage/gradeList'); const GradeList = () => import('@/views/organization/examManage/gradeList');
const GradeStatistics = () => import('@/views/organization/examManage/gradeStatistics'); const GradeStatistics = () => import('@/views/organization/examManage/gradeStatistics');
const StudentGradeStatis = () => import('@/views/organization/studentStatistics/studentGradeStatis');
const StudentStatistics = () => import('@/views/organization/studentStatistics/index'); const StudentStatistics = () => import('@/views/organization/studentStatistics/index');
const CreateRule = () => import('@/views/organization/ruleManage/createRule'); const CreateRule = () => import('@/views/organization/ruleManage/createRule');
const TotalGrade = () => import('@/views/organization/ruleManage/totalGrade'); const TotalGrade = () => import('@/views/organization/ruleManage/totalGrade');
@ -664,6 +665,11 @@ export const publicAsyncRoute = [
component: StudentStatistics, component: StudentStatistics,
hidden: true hidden: true
}, },
{
path: 'studentGradeStatis',
component: StudentGradeStatis,
hidden: true
},
{ {
path: 'createRule', path: 'createRule',
component: CreateRule, component: CreateRule,

View File

@ -70,6 +70,14 @@ export default {
showControl: (row) => { showControl: (row) => {
return this.$route.query.creatorId == this.$store.state.user.id; return this.$route.query.creatorId == this.$store.state.user.id;
} }
},
{
name: '成绩曲线',
handleClick: this.gradeStatistic,
type: 'success',
// showControl: (row) => {
// return this.$route.query.creatorId == this.$store.state.user.id;
// }
} }
] ]
} }
@ -199,6 +207,16 @@ export default {
XLSX.utils.book_append_sheet(wb, ws, 'file'); XLSX.utils.book_append_sheet(wb, ws, 'file');
XLSX.writeFile(wb, '学生信息模板' + '.xlsx'); XLSX.writeFile(wb, '学生信息模板' + '.xlsx');
}, },
gradeStatistic(index,row){
this.$router.push({ path: '/info/studentGradeStatis',
query: {
username: row.name,
departmentId: row.departmentId,
userId: row.userId,
orgRole: row.orgRole
}
});
},
removeStudent(index, row) { removeStudent(index, row) {
const _that = this; const _that = this;
this.$confirm(`是否确认将${row.name}移出班级?`, this.$t('tip.hint'), { this.$confirm(`是否确认将${row.name}移出班级?`, this.$t('tip.hint'), {

View File

@ -0,0 +1,66 @@
<template>
<div id="mychart1" style="width:100%;height:100%"/>
</template>
<script>
import * as echarts from 'echarts';
import { getLessonList } from '@/api/management/userexam';
export default {
name: 'ExamStatistics',
data() {
return {
myChart2:null,
title:{
show:true,
text:'教学时长统计',
textAlign:'center',
left:'50%',
top:'5px',
textStyle:{
color:'#f00'
}
}
}
},
async mounted() {
this.initChart()
this.loadData();
},
methods: {
initChart(){
var chartDom1 = document.getElementById('mychart1');
this.myChart1 = echarts.init(chartDom1);
let option1={
title: this.title,
tooltip: {trigger: 'item'},
legend: {orient: 'vertical',left: 'left',top:'45px',orient:'horizontal'},
series: [
{
data:[],
label:{show:false},
radius: '60%',
top:'20px',
type: 'pie'
}
]
}
option1 && this.myChart1 && this.myChart1.setOption(option1);
},
loadData(){
getLessonList().then(response => {
let timeList=response.data;
if(timeList){
let realList=[];
timeList.forEach(eachItem=>{
realList.push({value:eachItem.duration,name:eachItem.statsProjectName});
})
let option=this.myChart1.getOption();
option.series[0].data=realList;
option && this.myChart1 && this.myChart1.setOption(option);
}
}).catch(error=>{
this.$message.error(error.message)
});
}
}
}
</script>

View File

@ -0,0 +1,151 @@
<template>
<div id="mychart2" style="width:100%;height:100%"/>
</template>
<script>
import * as echarts from 'echarts';
import { getStuGradeStatistic } from '@/api/management/userexam';
export default {
name: 'GradeStatistics',
data() {
return {
myChart2:null,
title:{
show:true,
textAlign:'center',
left:'50%',
top:'5px',
textStyle:{
color:'#f00'
}
},
yAxis:[
{
// position:'left',
name:'分数',
type: 'value',
// nameLocation:'end',
// minInterval:1,
nameTextStyle:{
align:'left',
fontSize:14
},
axisLine:{show:true}
},
{
nameLocation:'end',
nameTextStyle:{
align:'left',
fontSize:14
},
axisLine:{show:true},
name: '时长',
alignTicks: true,
type: 'value',
// inverse: true
},
],
}
},
async mounted() {
this.initChart()
this.loadData()
},
methods: {
initChart(){
var chartDom2 = document.getElementById('mychart2');
this.myChart2 = echarts.init(chartDom2);
let option={
xAxis: {
type: 'category',
axisLabel:{
show :false
},
data:[]
},
yAxis:this.yAxis,
tooltip:{
show:true,
trigger:'axis'
},
title: Object.assign({text:'考试成绩统计'},this.title),
series: [
{
name: '分数',
data:[],
type: 'line'
},
{
name:'时长',
yAxisIndex: 1,
data:[],
type: 'line'
},
]
}
option && this.myChart2 && this.myChart2.setOption(option);
},
loadData(){
let data={creatorId:'',orgId:'',userId:''}
getStuGradeStatistic(data).then(res=>{
const results = resp.data;
if (results) {
const gradeList = results.results;
// const gradeList = [
// {
// "id": "92",
// "userId": "92",
// "account": "p8f1a3",
// "username": ".",
// "examId": "92",
// "examName": ".",
// "score": 40.89,
// "usedTime": 674,
// "result": "mrz4xd",
// "duration": 403,
// },
// {
// "id": "93",
// "userId": "92",
// "account": "p8f1a3",
// "username": ".",
// "examId": "92",
// "examName": "111",
// "score": 70.89,
// "usedTime": 674,
// "result": "mrz4xd",
// "duration": 203,
// },
// {
// "id": "93",
// "userId": "92",
// "account": "p8f1a3",
// "username": ".",
// "examId": "92",
// "examName": "2222",
// "score": 30.89,
// "usedTime": 374,
// "result": "mrz4xd",
// "duration": 203,
// }
// ];
let gradeNumList=[];
let exameNameList=[];
let durationList=[];
gradeList.forEach(item=>{
gradeNumList.push(item.score);
exameNameList.push(item.examName);
durationList.push(item.duration);
})
let option=this.myChart2.getOption();
option.xAxis[0].data=exameNameList;
option.series[0].data=gradeNumList;
option.series[1].data=durationList;
option && this.myChart2 && this.myChart2.setOption(option);
}
}).catch(error=>{
this.$message.error(error.message)
});
}
}
}
</script>

View File

@ -1,28 +1,37 @@
<template> <template>
<div> <div>
<div class="student_title_content">{{ '统计信息' }}</div> <div class="student_title_content">{{ '统计信息' }}</div>
<el-button type="text" style="position: fixed;right: 20px;top: 70px;" @click="back">返回</el-button>
<div class="statisticChart"> <div class="statisticChart">
<div id="mychart1" class="statisticChartLeft" /> <div class="statisticChartLeft" >
<div id="mychart2" class="statisticChartCenter" /> <!-- id="mychart1" -->
<exam-statistics/>
</div>
<div class="statisticChartCenter">
<grade-statistics/>
</div>
<div id="mychart3" class="statisticChartRight" /> <div id="mychart3" class="statisticChartRight" />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import { getStuGradeStatistic } from '@/api/management/userexam'; import GradeStatistics from './gradeStatistic.vue';
// import { getClassListUnPage } from '@/api/company'; import ExamStatistics from './examStatistic.vue';
// import { getExamLessonDetail } from '@/api/management/exam'; import { getSimulationTimeChart } from '@/api/management/userexam';
// import localStore from 'storejs'; import { getSubSystemByProjectCode } from '@/api/trainingPlatform';
export default { export default {
name: 'StudentStatistics', name: 'StudentStatistics',
components: {
GradeStatistics,
ExamStatistics
},
data() { data() {
return { return {
myChart1:null,
myChart2:null,
myChart3:null, myChart3:null,
title:{ title:{
show:true, show:true,
text:'仿真时长统计',
textAlign:'center', textAlign:'center',
left:'50%', left:'50%',
top:'5px', top:'5px',
@ -30,105 +39,72 @@ export default {
color:'#f00' color:'#f00'
} }
}, },
yAxis:{
position:'left',
name:'人数',
nameLocation:'end',
minInterval:1,
nameTextStyle:{
align:'left',
fontSize:14
},
axisLine:{show:true}
},
} }
}, },
async mounted() { async mounted() {
this.initChart() this.initChart()
this.loadData();
}, },
methods: { methods: {
initChart(){ initChart(){
var chartDom1 = document.getElementById('mychart1');
this.myChart1 = echarts.init(chartDom1);
var chartDom2 = document.getElementById('mychart2');
this.myChart2 = echarts.init(chartDom2);
var chartDom3 = document.getElementById('mychart3'); var chartDom3 = document.getElementById('mychart3');
this.myChart3 = echarts.init(chartDom3); this.myChart3 = echarts.init(chartDom3);
let option1={
title: Object.assign({text:'教学时长统计'},this.title),
tooltip: {trigger: 'item'},
series: [
{
data:[
{ value: 1048, name: '福州' },
{ value: 735, name: '测试' },
{ value: 580, name: '标准' },
],
radius: '80%',
type: 'pie'
}
]
}
let option2={
xAxis: {},
yAxis:this.yAxis,
title: Object.assign({text:'考试成绩统计'},this.title),
series: [
{
data:[],
type: 'bar'
}
]
}
let option3={ let option3={
title: Object.assign({text:'仿真时长统计'},this.title), title: this.title,
tooltip: {trigger: 'item'}, tooltip: {trigger: 'item'},
legend: {orient: 'vertical',left: 'left',top:'45px',orient:'horizontal'},
// http://2i38984j47.qicp.vip/doc/UserExamController.html // http://2i38984j47.qicp.vip/doc/UserExamController.html
series: [ series: [
{ {
data:[ data:[],
{ value: 1048, name: 'Search Engine' }, label:{show:false},
{ value: 735, name: 'Direct' }, radius: '60%',
{ value: 580, name: 'Email' }, top:'20px',
],
radius: '80%',
type: 'pie' type: 'pie'
} }
] ]
} }
option1 && this.myChart1 && this.myChart1.setOption(option1);
option2 && this.myChart2 && this.myChart2.setOption(option2);
option3 && this.myChart3 && this.myChart3.setOption(option3); option3 && this.myChart3 && this.myChart3.setOption(option3);
},
loadData(){
// getPublishLessonListByMapId({mapId:this.mapId}).then(response => {
getSubSystemByProjectCode().then(response => {
let mapIdList = response.data;
if(mapIdList.length>0){
getSimulationTimeChart(mapIdList[0].id).then(res=>{
let list=mapIdList[0].children.find(child=>{return child.id=='Simulation'})
let dataMap={};
if(list){
list.children.forEach(item=>{
dataMap[item.id]=item.name
})
}
let timeList=res.data;
if(timeList){
let realList=[];
timeList.forEach(eachItem=>{
let realtName=dataMap[eachItem.statsProjectId];
if(realtName){
realList.push({value:eachItem.duration,name:realtName});
}
})
let option=this.myChart3.getOption();
option.series[0].data=realList;
option && this.myChart3 && this.myChart3.setOption(option);
}
}).catch(error=>{
this.$message.error(error.message)
});
}
}).catch(error=>{
this.$message.error(error.message)
});
},
back(){
this.$router.go(-1);
} }
} }
}; };
// [
// {
// "id": "92",
// "userId": "92",
// "account": "p8f1a3",
// "username": ".",
// "examId": "92",
// "examName": ".",
// "score": 30.89,
// "usedTime": 674,
// "result": "mrz4xd",
// "duration": 403,
// "userExamQuestionsVOs": [
// {
// "id": 651,
// "userExamId": "92",
// "trainingId": "92",
// "trainingName": ".",
// "usedTime": 622,
// "score": 71.79,
// "group": "76w1am",
// "cause": "kwmnx3"
// }
// ]
// }
// ]
</script> </script>
<style scoped> <style scoped>
.student_title_content { .student_title_content {

View File

@ -0,0 +1,45 @@
<template>
<div>
<div class="student_title_content">{{ studentName+'统计信息' }}</div>
<el-button type="text" style="position: fixed;right: 20px;top: 70px;" @click="back">返回</el-button>
<div class="statisticChart">
<grade-statistics/>
</div>
</div>
</template>
<script>
import GradeStatistics from './gradeStatistic.vue';
export default {
name: 'StudentGradeStatis',
components: {
GradeStatistics,
},
computed:{
studentName() {
return this.$route.query.username||'';
}
},
methods: {
back(){
this.$router.go(-1);
}
}
}
</script>
<style scoped>
.statisticChart{
/* margin-left: 50%; */
/* transform: translateX(-50%); */
width:90%;
display: flex;
margin-left:5%;
height:500px;
}
.student_title_content {
width: 100%;
margin: 20px 0 30px;
text-align: left;
font-size: 22px;
padding-left: 30px;
}
</style>