代码调整

This commit is contained in:
joylink_cuiweidong 2022-04-18 18:43:39 +08:00
parent 62be008849
commit d82ab8f93c
4 changed files with 53 additions and 55 deletions

View File

@ -76,11 +76,10 @@ export function getClassGradeStatistic(orgId, examId) {
} }
/** 查询组织学生单次考试成绩曲线 */ /** 查询组织学生单次考试成绩曲线 */
export function getStuGradeStatistic(params) { export function getStuGradeStatistic(userId) {
return request({ return request({
url: `/api/userExam/curve/personal`, url: `/api/userExam/curve/${userId}`,
method: 'get', method: 'get',
params
}); });
} }

View File

@ -7,21 +7,21 @@ import { getStuGradeStatistic } from '@/api/management/userexam';
export default { export default {
name: 'GradeStatistics', name: 'GradeStatistics',
props:{ props:{
creatorId:{ // creatorId:{
type:String, // type:String,
require:true // require:true
}, // },
orgId:{ // orgId:{
type:String, // type:String,
require:true // require:true
}, // },
userId:{ userId:{
type:Number, type:String,
require:true require:true
}, },
}, },
watch:{ watch:{
'orgId':function(){ 'userId':function(){
this.loadData() this.loadData()
} }
}, },
@ -50,18 +50,18 @@ export default {
}, },
axisLine:{show:true} axisLine:{show:true}
}, },
{ // {
nameLocation:'end', // nameLocation:'end',
nameTextStyle:{ // nameTextStyle:{
align:'left', // align:'left',
fontSize:14 // fontSize:14
}, // },
axisLine:{show:true}, // axisLine:{show:true},
name: '时长', // name: '',
alignTicks: true, // alignTicks: true,
type: 'value', // type: 'value',
// inverse: true // // inverse: true
}, // },
], ],
} }
}, },
@ -76,7 +76,7 @@ export default {
xAxis: { xAxis: {
type: 'category', type: 'category',
axisLabel:{ axisLabel:{
show :false show :true
}, },
data:[] data:[]
}, },
@ -90,14 +90,14 @@ export default {
{ {
name: '分数', name: '分数',
data:[], data:[],
type: 'line' type: 'bar'
},
{
name:'时长',
yAxisIndex: 1,
data:[],
type: 'line'
}, },
// {
// name:'',
// yAxisIndex: 1,
// data:[],
// type: 'line'
// },
] ]
} }
option && this.myChart2 && this.myChart2.setOption(option); option && this.myChart2 && this.myChart2.setOption(option);
@ -106,12 +106,13 @@ export default {
this.loadData(); this.loadData();
}, },
loadData(){ loadData(){
let data={creatorId:this.creatorId,orgId:this.orgId,userId:this.userId} // creatorId:this.creatorId,orgId:this.orgId,
debugger // let data={userId:this.userId}
getStuGradeStatistic(data).then(res=>{ // debugger
getStuGradeStatistic(this.userId).then(resp=>{
const results = resp.data; const results = resp.data;
if (results) { if (results) {
const gradeList = results.results; const gradeList = results;
// const gradeList = [ // const gradeList = [
// { // {
// "id": "92", // "id": "92",
@ -152,16 +153,16 @@ export default {
// ]; // ];
let gradeNumList=[]; let gradeNumList=[];
let exameNameList=[]; let exameNameList=[];
let durationList=[]; // let durationList=[];
gradeList.forEach(item=>{ gradeList.forEach(item=>{
gradeNumList.push(item.score); gradeNumList.push(item.score);
exameNameList.push(item.examName); exameNameList.push(item.examName);
durationList.push(item.duration); // durationList.push(item.duration);
}) })
let option=this.myChart2.getOption(); let option=this.myChart2.getOption();
option.xAxis[0].data=exameNameList; option.xAxis[0].data=exameNameList;
option.series[0].data=gradeNumList; option.series[0].data=gradeNumList;
option.series[1].data=durationList; // option.series[1].data=durationList;
option && this.myChart2 && this.myChart2.setOption(option); option && this.myChart2 && this.myChart2.setOption(option);
} }
}).catch(error=>{ }).catch(error=>{

View File

@ -8,7 +8,8 @@
<exam-statistics/> <exam-statistics/>
</div> </div>
<div class="statisticChartCenter"> <div class="statisticChartCenter">
<grade-statistics :creatorId="creatorId" :orgId="orgId" :userId="userId"/> <!-- :creatorId="creatorId" :orgId="orgId" -->
<grade-statistics :userId="userId"/>
</div> </div>
<div id="mychart3" class="statisticChartRight" /> <div id="mychart3" class="statisticChartRight" />
</div> </div>
@ -29,8 +30,9 @@ export default {
data() { data() {
return { return {
myChart3:null, myChart3:null,
creatorId:'', // creatorId:'',
orgId:'', // orgId:'',
userId:'',
title:{ title:{
show:true, show:true,
text:'仿真时长统计', text:'仿真时长统计',
@ -46,12 +48,8 @@ export default {
async mounted() { async mounted() {
this.initChart() this.initChart()
this.loadData(); this.loadData();
this.orgId=this.$store.state.user.companyId; this.userId=this.$store.state.user.id;
}, // this.orgId=this.$store.state.user.companyId;
computed:{
userId(){
return parseInt(this.$store.state.user.id);
}
}, },
methods: { methods: {
initChart(){ initChart(){

View File

@ -9,7 +9,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div class="statisticChart"> <div class="statisticChart">
<grade-statistics ref="gradeStatic" :creatorId="creatorId" :orgId="orgId" :userId="userId"/> <grade-statistics ref="gradeStatic" :userId="userId"/>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
@ -24,19 +24,19 @@ export default {
return { return {
studentName:'', studentName:'',
show:false, show:false,
creatorId:'', // creatorId:'',
userId:'', userId:'',
orgId:'', // orgId:'',
} }
}, },
methods: { methods: {
doShow(row){ doShow(row){
this.show=true; this.show=true;
this.studentName=row.name; this.studentName=row.name;
this.userId=row.userId; // this.creatorId=this.$store.state.user.id;
this.creatorId=this.$store.state.user.id;
this.$nextTick(()=>{ this.$nextTick(()=>{
this.orgId=row.companyId; // this.orgId=row.companyId;
this.userId=row.userId;
}) })
// this.$refs.gradeStatic.doShow(); // this.$refs.gradeStatic.doShow();
}, },