代码调整

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;"
/>
<create-student ref="createStudents" @refresh="refresh" />
<student-grade-Statis ref="studentGradeStatis"/>
<!-- <student-grade-Statis ref="studentGradeStatis"/> -->
</div>
</template>
@ -74,14 +74,11 @@ export default {
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;
// {
// name: '',
// handleClick: this.gradeStatistic,
// type: 'success',
// }
}
]
}
],
@ -210,9 +207,9 @@ export default {
XLSX.utils.book_append_sheet(wb, ws, 'file');
XLSX.writeFile(wb, '学生信息模板' + '.xlsx');
},
gradeStatistic(index,row){
this.$refs.studentGradeStatis.doShow(row);
},
// gradeStatistic(index,row){
// this.$refs.studentGradeStatis.doShow(row);
// },
removeStudent(index, row) {
const _that = this;
this.$confirm(`是否确认将${row.name}移出班级?`, this.$t('tip.hint'), {

View File

@ -11,7 +11,9 @@ export default {
myChart2:null,
title:{
show:true,
text:'教学时长统计',
subtext:'',
subtextStyle:{color:'#358ff8',fontSize:14},
text:'学习时长统计',
textAlign:'center',
left:'50%',
top:'5px',
@ -31,14 +33,32 @@ export default {
this.myChart1 = echarts.init(chartDom1);
let option1={
title: this.title,
tooltip: {trigger: 'item'},
legend: {orient: 'vertical',left: 'left',top:'45px',orient:'horizontal'},
tooltip: {
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: [
{
data:[],
label:{show:false},
radius: '60%',
top:'20px',
top:'60px',
showEmptyCircle:true,
type: 'pie'
}
]
@ -50,10 +70,19 @@ export default {
let timeList=response.data;
if(timeList){
let realList=[];
let allcount=0;
timeList.forEach(eachItem=>{
allcount+=parseInt(eachItem.duration);
realList.push({value:eachItem.duration,name:eachItem.statsProjectName});
})
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 && this.myChart1 && this.myChart1.setOption(option);
}

View File

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

View File

@ -7,24 +7,24 @@
<!-- id="mychart1" -->
<exam-statistics/>
</div>
<div class="statisticChartCenter">
<!-- <div class="statisticChartCenter"> -->
<!-- :creatorId="creatorId" :orgId="orgId" -->
<grade-statistics :userId="userId"/>
</div>
<!-- <grade-statistics :userId="userId"/> -->
<!-- </div> -->
<div id="mychart3" class="statisticChartRight" />
</div>
</div>
</template>
<script>
import * as echarts from 'echarts';
import GradeStatistics from './gradeStatistic.vue';
// import GradeStatistics from './gradeStatistic.vue';
import ExamStatistics from './examStatistic.vue';
import { getSimulationTimeChart } from '@/api/management/userexam';
import { getSubSystemByProjectCode } from '@/api/trainingPlatform';
export default {
name: 'StudentStatistics',
// GradeStatistics
components: {
GradeStatistics,
ExamStatistics
},
data() {
@ -32,9 +32,11 @@ export default {
myChart3:null,
// creatorId:'',
// orgId:'',
userId:'',
// userId:'',
title:{
show:true,
subtext:'',
subtextStyle:{color:'#358ff8',fontSize:14},
text:'仿真时长统计',
textAlign:'center',
left:'50%',
@ -48,7 +50,7 @@ export default {
async mounted() {
this.initChart()
this.loadData();
this.userId=this.$store.state.user.id;
// this.userId=this.$store.state.user.id;
// this.orgId=this.$store.state.user.companyId;
},
methods: {
@ -57,15 +59,33 @@ export default {
this.myChart3 = echarts.init(chartDom3);
let option3={
title: this.title,
tooltip: {trigger: 'item'},
legend: {orient: 'vertical',left: 'left',top:'45px',orient:'horizontal'},
tooltip: {
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
series: [
{
data:[],
label:{show:false},
showEmptyCircle:true,
radius: '60%',
top:'20px',
top:'60px',
type: 'pie'
}
]
@ -88,14 +108,23 @@ export default {
let timeList=res.data;
if(timeList){
let realList=[];
let allcount=0;
timeList.forEach(eachItem=>{
let realtName=dataMap[eachItem.statsProjectId];
if(realtName){
allcount+=parseInt(eachItem.duration);
realList.push({value:eachItem.duration,name:realtName});
}
})
let option=this.myChart3.getOption();
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);
}
}).catch(error=>{
@ -126,18 +155,20 @@ export default {
margin-left:5%;
}
.statisticChartLeft{
width: 30%;
/* width: 30%; */
width: 50%;
display: inline-block;
height: 500px;
/* border:1px #ccc solid */
}
.statisticChartCenter{
/* .statisticChartCenter{
width: 40%;
display: inline-block;
height: 500px;
}
} */
.statisticChartRight{
width: 30%;
/* width: 30%; */
width: 50%;
display: inline-block;
height: 500px;
/* border:1px #ccc solid */