代码调整

This commit is contained in:
joylink_cuiweidong 2022-04-19 13:45:00 +08:00
parent f61785fc5e
commit bf1886a534
4 changed files with 88 additions and 30 deletions

View File

@ -11,7 +11,7 @@
style="width:80%;margin: 0 auto;" style="width:80%;margin: 0 auto;"
/> />
<create-student ref="createStudents" @refresh="refresh" /> <create-student ref="createStudents" @refresh="refresh" />
<student-grade-Statis ref="studentGradeStatis"/> <!-- <student-grade-Statis ref="studentGradeStatis"/> -->
</div> </div>
</template> </template>
@ -74,14 +74,11 @@ export default {
return this.$route.query.creatorId == this.$store.state.user.id; return this.$route.query.creatorId == this.$store.state.user.id;
} }
}, },
{ // {
name: '成绩曲线', // name: '',
handleClick: this.gradeStatistic, // handleClick: this.gradeStatistic,
type: 'success', // type: 'success',
// showControl: (row) => { // }
// return this.$route.query.creatorId == this.$store.state.user.id;
// }
}
] ]
} }
], ],
@ -210,9 +207,9 @@ 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){ // gradeStatistic(index,row){
this.$refs.studentGradeStatis.doShow(row); // this.$refs.studentGradeStatis.doShow(row);
}, // },
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

@ -11,7 +11,9 @@ export default {
myChart2:null, myChart2:null,
title:{ title:{
show:true, show:true,
text:'教学时长统计', subtext:'',
subtextStyle:{color:'#358ff8',fontSize:14},
text:'学习时长统计',
textAlign:'center', textAlign:'center',
left:'50%', left:'50%',
top:'5px', top:'5px',
@ -31,14 +33,32 @@ export default {
this.myChart1 = echarts.init(chartDom1); this.myChart1 = echarts.init(chartDom1);
let option1={ let option1={
title: this.title, title: this.title,
tooltip: {trigger: 'item'}, tooltip: {
legend: {orient: 'vertical',left: 'left',top:'45px',orient:'horizontal'}, trigger: 'item',
formatter: function (params, ticket, callback) {
let value=params.data.value;
let hour=0;
let minu=0;
let seconds=0;
hour=Math.floor(value/3600);
minu=Math.floor((value%3600)/60);
seconds=Math.floor((value%3600)%60);
// hour=hour>9?hour:'0'+hour;
// minu=minu>9?minu:'0'+minu;
// seconds=seconds>9?seconds:'0'+seconds;
let temp=hour+'时'+minu+"分"+seconds+'秒';
return '<p>'+params.data.name+': '+temp+'</p>'
}
},
color:['#358ff8','#91cb74','#f7c757','#ec6566','#73c0de','#4ca273','#ee8250','#9a60b4','#ea7ccc','#59eca9'],
legend: {orient: 'vertical',left: 'left',top:'65px'},
series: [ series: [
{ {
data:[], data:[],
label:{show:false}, label:{show:false},
radius: '60%', radius: '60%',
top:'20px', top:'60px',
showEmptyCircle:true,
type: 'pie' type: 'pie'
} }
] ]
@ -50,10 +70,19 @@ export default {
let timeList=response.data; let timeList=response.data;
if(timeList){ if(timeList){
let realList=[]; let realList=[];
let allcount=0;
timeList.forEach(eachItem=>{ timeList.forEach(eachItem=>{
allcount+=parseInt(eachItem.duration);
realList.push({value:eachItem.duration,name:eachItem.statsProjectName}); realList.push({value:eachItem.duration,name:eachItem.statsProjectName});
}) })
let option=this.myChart1.getOption(); let option=this.myChart1.getOption();
let hour=0;
let minu=0;
let seconds=0;
hour=Math.floor(allcount/3600);
minu=Math.floor((allcount%3600)/60);
seconds=Math.floor((allcount%3600)%60);
option.title[0].subtext="总时长: "+hour+'时'+minu+"分"+seconds+'秒';
option.series[0].data=realList; option.series[0].data=realList;
option && this.myChart1 && this.myChart1.setOption(option); option && this.myChart1 && this.myChart1.setOption(option);
} }

View File

@ -90,6 +90,7 @@ export default {
{ {
name: '分数', name: '分数',
data:[], data:[],
barMaxWidth:'50px',
type: 'bar' type: 'bar'
}, },
// { // {

View File

@ -7,24 +7,24 @@
<!-- id="mychart1" --> <!-- id="mychart1" -->
<exam-statistics/> <exam-statistics/>
</div> </div>
<div class="statisticChartCenter"> <!-- <div class="statisticChartCenter"> -->
<!-- :creatorId="creatorId" :orgId="orgId" --> <!-- :creatorId="creatorId" :orgId="orgId" -->
<grade-statistics :userId="userId"/> <!-- <grade-statistics :userId="userId"/> -->
</div> <!-- </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 GradeStatistics from './gradeStatistic.vue'; // import GradeStatistics from './gradeStatistic.vue';
import ExamStatistics from './examStatistic.vue'; import ExamStatistics from './examStatistic.vue';
import { getSimulationTimeChart } from '@/api/management/userexam'; import { getSimulationTimeChart } from '@/api/management/userexam';
import { getSubSystemByProjectCode } from '@/api/trainingPlatform'; import { getSubSystemByProjectCode } from '@/api/trainingPlatform';
export default { export default {
name: 'StudentStatistics', name: 'StudentStatistics',
// GradeStatistics
components: { components: {
GradeStatistics,
ExamStatistics ExamStatistics
}, },
data() { data() {
@ -32,9 +32,11 @@ export default {
myChart3:null, myChart3:null,
// creatorId:'', // creatorId:'',
// orgId:'', // orgId:'',
userId:'', // userId:'',
title:{ title:{
show:true, show:true,
subtext:'',
subtextStyle:{color:'#358ff8',fontSize:14},
text:'仿真时长统计', text:'仿真时长统计',
textAlign:'center', textAlign:'center',
left:'50%', left:'50%',
@ -48,7 +50,7 @@ export default {
async mounted() { async mounted() {
this.initChart() this.initChart()
this.loadData(); this.loadData();
this.userId=this.$store.state.user.id; // this.userId=this.$store.state.user.id;
// this.orgId=this.$store.state.user.companyId; // this.orgId=this.$store.state.user.companyId;
}, },
methods: { methods: {
@ -57,15 +59,33 @@ export default {
this.myChart3 = echarts.init(chartDom3); this.myChart3 = echarts.init(chartDom3);
let option3={ let option3={
title: this.title, title: this.title,
tooltip: {trigger: 'item'}, tooltip: {
legend: {orient: 'vertical',left: 'left',top:'45px',orient:'horizontal'}, trigger: 'item',
formatter: function (params, ticket, callback) {
let value=params.data.value;
let hour=0;
let minu=0;
let seconds=0;
hour=Math.floor(value/3600);
minu=Math.floor((value%3600)/60);
seconds=Math.floor((value%3600)%60);
// hour=hour>9?hour:'0'+hour;
// minu=minu>9?minu:'0'+minu;
// seconds=seconds>9?seconds:'0'+seconds;
let temp=hour+'时'+minu+"分"+seconds+'秒';
return '<p>'+params.data.name+': '+temp+'</p>'
}
},
color:['#358ff8','#91cb74','#f7c757','#ec6566','#73c0de','#4ca273','#ee8250','#9a60b4','#ea7ccc','#59eca9'],
legend: {left: 'left',top:'65px',orient:'horizontal'},
// http://2i38984j47.qicp.vip/doc/UserExamController.html // http://2i38984j47.qicp.vip/doc/UserExamController.html
series: [ series: [
{ {
data:[], data:[],
label:{show:false}, label:{show:false},
showEmptyCircle:true,
radius: '60%', radius: '60%',
top:'20px', top:'60px',
type: 'pie' type: 'pie'
} }
] ]
@ -88,14 +108,23 @@ export default {
let timeList=res.data; let timeList=res.data;
if(timeList){ if(timeList){
let realList=[]; let realList=[];
let allcount=0;
timeList.forEach(eachItem=>{ timeList.forEach(eachItem=>{
let realtName=dataMap[eachItem.statsProjectId]; let realtName=dataMap[eachItem.statsProjectId];
if(realtName){ if(realtName){
allcount+=parseInt(eachItem.duration);
realList.push({value:eachItem.duration,name:realtName}); realList.push({value:eachItem.duration,name:realtName});
} }
}) })
let option=this.myChart3.getOption(); let option=this.myChart3.getOption();
option.series[0].data=realList; option.series[0].data=realList;
let hour=0;
let minu=0;
let seconds=0;
hour=Math.floor(allcount/3600);
minu=Math.floor((allcount%3600)/60);
seconds=Math.floor((allcount%3600)%60);
option.title[0].subtext="总时长: "+hour+'时'+minu+"分"+seconds+'秒';
option && this.myChart3 && this.myChart3.setOption(option); option && this.myChart3 && this.myChart3.setOption(option);
} }
}).catch(error=>{ }).catch(error=>{
@ -126,18 +155,20 @@ export default {
margin-left:5%; margin-left:5%;
} }
.statisticChartLeft{ .statisticChartLeft{
width: 30%; /* width: 30%; */
width: 50%;
display: inline-block; display: inline-block;
height: 500px; height: 500px;
/* border:1px #ccc solid */ /* border:1px #ccc solid */
} }
.statisticChartCenter{ /* .statisticChartCenter{
width: 40%; width: 40%;
display: inline-block; display: inline-block;
height: 500px; height: 500px;
} } */
.statisticChartRight{ .statisticChartRight{
width: 30%; /* width: 30%; */
width: 50%;
display: inline-block; display: inline-block;
height: 500px; height: 500px;
/* border:1px #ccc solid */ /* border:1px #ccc solid */