gradeAnalysisDetail.vue
24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
<template>
<el-container class="default-body">
<el-header>
<back-box class="detailBack">
<template slot="title">
<span class="default-title">
{{ title }}
</span>
</template>
</back-box>
</el-header>
<div class="default-filter">
已考班级:
<el-checkbox-group style="display: inline-block" v-model="checkedClassInfos" @change="_handleCheckedClassChange">
<el-checkbox class="_el-checkbox" v-model="checkAll" @change="_handleCheckAllChange">全选</el-checkbox>
<el-checkbox class="_el-checkbox" v-for="classItem in classInfos" :key="classItem.classId"
:label="classItem.className">
{{ classItem.className }}
</el-checkbox>
</el-checkbox-group>
</div>
<el-main>
<div style="position: relative">
<el-tabs v-model="tabType" v-loading="queryLoading" type="card" class="default-tabs">
<el-tab-pane :name="'成绩测验单'" :label="`成绩测验单`" style="padding: 0 20px">
<div style="height: calc(100% - 80px);">
<el-row class="row-subfix">
<div style="float: right;margin-bottom: 20px;">
<el-button type="primary" class="opration-btn" icon="el-icon-upload2">导出报表</el-button>
<el-button type="primary" class="opration-btn" icon="el-icon-printer">打印报表</el-button>
</div>
</el-row>
<el-row class="row-subfix" :key="index" v-for="(item, index) in titleInfo">
<div class="row-line">
<span class="line-subfix">班级:</span>
<span class="line-value">{{ item.className }}</span>
</div>
<div class="row-line">
<span class="line-subfix">试卷名称:</span>
<span class="line-value">{{ item.paperName }}</span>
</div>
<div class="row-line">
<span class="line-subfix">测验时间:</span>
<span class="line-value">{{ item.testTime }}</span>
</div>
</el-row>
<el-row class="row-subfix">
<el-table class="default-table" style="margin-top: 10px" :data="titleInfo">
<el-table-column prop="testCount" label="测验人数" width="120" />
<el-table-column prop="avg" label="平均分" width="120" />
<el-table-column prop="hight" label="最高分" width="120" />
<el-table-column prop="low" label="最低分" width="120" />
<el-table-column prop="title" label="缺考名单">
<template slot-scope="scoped">
{{ scoped.row.miss.join("/") }}
</template>
</el-table-column>
</el-table>
</el-row>
<el-row class="row-subfix">
<el-table class="default-table" style="margin-top: 10px" :data="studentList">
<el-table-column :width="item.label == '学号' ? 120 : 0" :prop="item.prop" :label="item.label"
:key="index" v-for="(item, index) in studentHeader" />
</el-table>
</el-row>
<el-row class="row-subfix">
<el-table class="default-table" style="margin-top: 10px" :data="questionList">
<el-table-column :width="item.label == '题号&答案' ? 80 : 0" :prop="item.prop" :label="item.label"
:key="index" v-for="(item, index) in questionHeaders" />
</el-table>
</el-row>
<el-row class="row-subfix" v-if="questionOtherList && questionOtherList.length >= 1">
<el-table class="default-table" style="margin-top: 10px" :data="questionOtherList">
<el-table-column :prop="item.prop" :label="item.label" :key="index"
v-for="(item, index) in questionOtherHeaders" />
</el-table>
</el-row>
<el-row class="row-subfix">
<el-table class="default-table" style="margin-top: 10px" :data="questionTotal">
<el-table-column prop="quesion" label="题号" width="120" />
<el-table-column prop="anwser" label="答案" width="120" />
<el-table-column prop="student" label="答错学生">
<template slot-scope="scoped">
<span>总计 <span style="color:red;">
{{ scoped.row.details.filter(item => !item.isRight).length }}</span> 人
</span>
<span style="margin: 10px 0;"
v-for="(item, index) in scoped.row.details.filter(item => !item.isRight)">
选{{ item.option }}:{{ item.students.join("/") }}
</span>
<span></span>
</template>
</el-table-column>
</el-table>
</el-row>
</div>
<div style="height: 80px;">
<el-pagination background layout="prev, pager, next" :total="testTranscriptCount">
</el-pagination>
</div>
</el-tab-pane>
<el-tab-pane :name="'班级对比情况'" :label="`班级对比情况`" style="padding: 0 20px">
<div style="float: right;margin-bottom: 20px;">
<el-button type="primary" class="opration-btn" icon="el-icon-upload2">导出报表</el-button>
<el-button type="primary" class="opration-btn" icon="el-icon-printer">打印报表</el-button>
</div>
<el-table class="default-table" :data="classdiffExamReport">
<el-table-column prop="index" label="序号" width="120" />
<el-table-column prop="className" label="班级" width="120" />
<el-table-column label="测验人数/班级人数">
<template slot-scope="scoped">
{{ scoped.row.testCount }} / {{ scoped.row.classCount }}
</template>
</el-table-column>
<el-table-column prop="title" label="参与度" width="120">
<template slot-scope="scoped">
{{ scoped.row.testCount / scoped.row.classCount }}
</template>
</el-table-column>
<el-table-column prop="avg" label="班平均分" width="120" />
<el-table-column prop="hight" label="班最高分" width="120" />
<el-table-column prop="low" label="班最低分" width="120" />
<el-table-column prop="front20" label="前20名均分" width="120" />
<el-table-column prop="last20" label="后20名均分" width="120" />
<el-table-column prop="excellenRate" label="优秀数(率)" width="120">
<template slot-scope="scoped">
{{ scoped.row.excellenRate }}%
</template>
</el-table-column>
<el-table-column prop="goodRate" label="良好数(率)" width="120">
<template slot-scope="scoped">
{{ scoped.row.goodRate }}%
</template>
</el-table-column>
<el-table-column prop="passRate" label="合格数(率)" width="120">
<template slot-scope="scoped">
{{ scoped.row.passRate }}%
</template>
</el-table-column>
<el-table-column prop="failedRate" label="不合格数(率)" width="120">
<template slot-scope="scoped">
{{ scoped.row.passRate }}%
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane :name="'试题分析表'" :label="`试题分析表`" style="padding: 0 20px">
<div style="float: right;margin-bottom: 20px;">
<el-button type="primary" class="opration-btn" icon="el-icon-upload2">导出报表</el-button>
<el-button type="primary" class="opration-btn" icon="el-icon-printer">打印报表</el-button>
</div>
<el-table class="default-table" :data="testPaperExamReport">
<el-table-column prop="questionIndex" label="题号" width="120" />
<el-table-column prop="questionType" label="题型" width="100">
<template slot-scope="scope">
{{ setSubPro(scope.row.questionType) }}
</template>
</el-table-column>
<el-table-column prop="score" label="知识点" />
<el-table-column prop="score" label="满分值" width="120" />
<el-table-column prop="avgScore" label="年级平均分" width="120" />
<el-table-column prop="gradeScoringRate" label="年级得分率" width="120" />
<el-table-column prop="correctAnswer" label="答案" width="120" />
<el-table-column v-for="(item, index) in testPaperExamReportOptions" :key="index" :label="item.title"
:prop="'count' + index" width="120">
<template slot-scope="scope">
<p class="persent">
{{
scope.row.questionType == "5"
? ""
: scope.row["option" + index]
? `${scope.row["option" + index]}(${scope.row["persent" + index] ?? "0"
})`
: ""
}}
</p>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane :name="'学生成绩排行'" :label="`学生成绩排行`" style="padding: 0 20px">
<div style="float: right;margin-bottom: 20px;">
<el-button type="primary" class="opration-btn" icon="el-icon-upload2">导出报表</el-button>
<el-button type="primary" class="opration-btn" icon="el-icon-printer">打印报表</el-button>
</div>
<el-table class="default-table" style="margin-top: 10px" :data="testStudentExamReport">
<el-table-column prop="gradeRank" label="年级排行" />
<el-table-column prop="code" label="学号" />
<el-table-column prop="name" label="姓名" />
<el-table-column prop="className" label="班级" />
<el-table-column prop="exam" label="分数" />
<el-table-column prop="title" label="成绩等级" />
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</el-main>
</el-container>
</template>
<script>
export default {
data() {
return {
checkAll: true,
isIndeterminate: true,
title: "",
paperId: null,
classInfos: [],
checkedClassInfos: [],
queryLoading: false,
tabType: "0",
testTranscriptCount: 0,
titleInfo: [],
studentList: [],
studentHeader: [],
studentMapping: [
{
key: "code",
label: "学号",
},
{
key: "name",
label: "姓名",
},
{
key: "gradeRank",
label: "排名",
},
{
key: "exam",
label: "总分",
},
{
key: "objective",
label: "客观分",
},
{
key: "subjective",
label: "主观分",
},
],
questionList: [],
questionHeaders: [],
questionOtherList: [],
questionOtherHeaders: [],
questionTotal: [],
testPaperExamReport: [],
testPaperExamReportOptions: [],
testStudentExamReport: [],
classdiffExamReport: [],
};
},
watch: {
async tabType(value) {
console.log(value);
this.checkedClassInfos = this.classInfos;
switch (value) {
case "成绩测验单":
await this._testExamReport();
break;
case "班级对比情况":
await this._classdiffExamReport();
break;
case "试题分析表":
await this._testPaperExamReport();
break;
case "学生成绩排行":
await this._testStudentExamReport();
break;
}
},
},
async created() {
this.title = this.$route.query.title || "";
this.paperId = this.$route.query.paperId;
this.classInfos = JSON.parse(this.$route.query.classListStr);
this.checkedClassInfos = this.classInfos;
this.tabType = "成绩测验单";
},
methods: {
_handleCheckAllChange(val) {
// this.checkedClassInfos = val ? this.classInfos : [];
// this.isIndeterminate = false;
},
_handleCheckedClassChange(value) {
// let checkedCount = value.length;
// this.checkAll = checkedCount === this.cities.length;
// this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
},
_detailQ(id) { },
setSubPro(type) {
let tit;
switch (type) {
case 2:
tit = "单选题";
break;
case 3:
tit = "多选题";
break;
case 4:
tit = "判断题";
break;
case 5:
tit = "主观题";
break;
default:
tit = "其他";
}
return tit;
},
async _testExamReport() {
this.questionTotal = [];
const request = this.$request.gTestExamReport;
let response = await request({
paperId: this.paperId,
classIds: this.checkedClassInfos.map((item) => item.classId),
});
if (response.status != 0) {
this.$message.error(response.info);
return;
}
this.titleInfo = response.data.titleInfos;
console.log(this.titleInfo)
var studentHeaders = [];
var studentResults = [];
for (var iheader = 0; iheader < 3; iheader++) {
for (
var imapping = 0;
imapping < this.studentMapping.length;
imapping++
) {
studentHeaders.push({
prop: this.studentMapping[imapping].key + "_" + iheader,
label: this.studentMapping[imapping].label,
key: this.studentMapping[imapping].key,
});
}
}
this.studentHeader = [...studentHeaders];
for (var isp = 0; isp < response.data.gradeExamStudentReports.length; isp++) {
var item = {};
for (
var iamapping = 0;
iamapping < studentHeaders.length;
iamapping++
) {
var currentData = response.data.gradeExamStudentReports[isp];
if (!currentData) continue;
var currentHeader = studentHeaders[iamapping];
item[currentHeader.prop] = currentData[currentHeader.key];
if (
iamapping >= this.studentMapping.length - 1 &&
iamapping % this.studentMapping.length == 0
) {
isp += 1;
}
}
studentResults.push(item);
}
this.studentList = [...studentResults];
var otherDatas = [];
var questionHeaders = [];
var questionResults = [];
var questionOtherHeaders = [];
var questionOtherResults = [];
var defaultQuestion = 6;
var defaultCount = 3;
var defaultQuestionCount = 4;
var maxQuestionCount = 4;
var optionSt = 1;
for (var qheader = 0; qheader < defaultQuestion * defaultCount; qheader++) {
if (qheader == 0 || qheader % 6 == 0) {
questionHeaders.push({
prop: "column_" + qheader,
label: "题号&答案",
});
continue;
} else if (qheader == 1 || (qheader - 1) % 6 == 0) {
questionHeaders.push({
prop: "column_" + qheader,
label: "得分率",
});
optionSt = 1;
continue;
} else {
questionHeaders.push({
prop: "column_" + qheader,
label: "选项" + optionSt,
});
optionSt += 1;
}
}
var noPassIndex = 0;
this.questionHeaders = questionHeaders;
var itema = null;
response.data.questionInfos = [...response.data.questionInfos]
for (var qIndex = 0; qIndex < response.data.questionInfos.length; qIndex++) {
var currentData = response.data.questionInfos[qIndex];
var filterDetail = currentData.details.filter(fl => fl.option != '未答');
var correctAnswerValue = currentData.correctAnswer == "1" ? "✓" : currentData.correctAnswer == 2 ? "✗" : currentData.correctAnswer;
this.questionTotal.push({
quesion: "Q" + (qIndex + 1),
anwser: correctAnswerValue ?? "-----",
details: currentData.details
})
if (filterDetail.length > defaultQuestionCount || filterDetail.length > maxQuestionCount) {
currentData.index = qIndex;
otherDatas.push(currentData);
if (filterDetail.length > maxQuestionCount) {
maxQuestionCount = filterDetail.length;
}
continue;
}
else {
if (noPassIndex > defaultCount) {
questionResults.push(itema)
itema = null;
noPassIndex = 0;
}
var stPass = noPassIndex * defaultQuestion;
if (!itema) itema = {}
var correctAnswerValue = currentData.correctAnswer == "1" ? "✓" : currentData.correctAnswer == 2 ? "✗" : currentData.correctAnswer;
itema["column_" + (stPass)] = (qIndex + 1) + "" + correctAnswerValue;
itema["column_" + (stPass + 1)] = (currentData.gradeScoringRate * 100) + "%";
var value = "------";
for (var iOption = 0; iOption < defaultQuestion - 2; iOption++) {
var currentOption = filterDetail[iOption];
if (currentOption) {
var optionValue = currentOption.option == "1" ? "✓" : currentOption.option == 2 ? "✗" : currentOption.option;
itema["column_" + (stPass + iOption + 2)] = optionValue + "(" + (currentOption.persent ?? "0%") + ")";
}
else {
itema["column_" + (stPass + iOption + 2)] = value
}
}
noPassIndex += 1
}
if (qIndex >= response.data.questionInfos.length - 1 && noPassIndex != 0) {
questionResults.push(itema)
itema = null;
}
}
optionSt = 1;
maxQuestionCount += 2;
this.questionList = [...questionResults]
var otherCount = parseInt(defaultQuestion * defaultCount / maxQuestionCount);
itema = null;
for (var qOHeader = 0; qOHeader < maxQuestionCount * otherCount; qOHeader++) {
if (qOHeader == 0 || qOHeader % (maxQuestionCount) == 0) {
questionOtherHeaders.push({
prop: "column_" + qOHeader,
label: "题号&答案",
});
continue;
} else if (qOHeader == 1 || (qOHeader - 1) % (maxQuestionCount) == 0) {
questionOtherHeaders.push({
prop: "column_" + qOHeader,
label: "得分率",
});
optionSt = 1;
continue;
} else {
questionOtherHeaders.push({
prop: "column_" + qOHeader,
label: "选项" + optionSt,
});
optionSt += 1;
}
}
this.questionOtherHeaders = questionOtherHeaders;
noPassIndex = 0;
for (var qOIndex = 0; qOIndex < otherDatas.length; qOIndex++) {
var currentData = otherDatas[qOIndex];
var filterDetail = currentData.details.filter(fl => fl.option != '未答');
if (noPassIndex >= otherCount) {
questionOtherResults.push(itema)
itema = null;
noPassIndex = 0;
}
var stPass = noPassIndex * maxQuestionCount;
if (!itema) itema = {}
var correctAnswerValue = currentData.correctAnswer == "1" ? "✓" : currentData.correctAnswer == 2 ? "✗" : currentData.correctAnswer;
itema["column_" + (stPass)] = (Number(currentData.index) + 1) + "" + correctAnswerValue;
itema["column_" + (stPass + 1)] = (currentData.gradeScoringRate * 100) + "%";
var value = "------";
for (var iOption = 0; iOption < maxQuestionCount - 2; iOption++) {
var currentOption = filterDetail[iOption];
if (currentOption) {
var optionValue = currentOption.option == "1" ? "✓" : currentOption.option == 2 ? "✗" : currentOption.option;
itema["column_" + (stPass + iOption + 2)] = optionValue + "(" + (currentOption.persent ?? "0%") + ")";
}
else {
itema["column_" + (stPass + iOption + 2)] = value
}
}
noPassIndex += 1
if (qOIndex >= otherDatas.length - 1 && noPassIndex != 0) {
questionOtherResults.push(itema)
itema = null;
}
}
this.questionOtherList = [...questionOtherResults]
},
async _testPaperExamReport() {
const request = this.$request.gPaperExamReport;
let response = await request({
paperId: this.paperId,
classIds: this.checkedClassInfos.map((item) => item.classId),
});
if (response.status != 0) {
this.$message.error(response.info);
return;
}
let optionsList = [{}, {}, {}, {}, {}];
let tableData = response.data?.map((item) => {
let params = {};
const detail = item.details;
let lastOPtion = detail?.find((item) => {
return item.option == "未答";
});
let defaultArr = detail?.filter((item) => {
return item.option != "未答";
});
optionsList.map((items, index) => {
if (index != 4) {
params["count" + index] =
defaultArr[index]?.option != "未答"
? defaultArr[index]?.count
: "";
params["persent" + index] =
defaultArr[index]?.option != "未答"
? defaultArr[index]?.persent
: "";
params["option" + index] =
defaultArr[index]?.option != "未答"
? defaultArr[index]?.option == 1
? "✓"
: defaultArr[index]?.option == 2
? "✗"
: defaultArr[index]?.option
: "";
items["title"] = "选项" + (index + 1);
} else {
items["title"] = "未答";
params["count" + index] = lastOPtion.count;
params["persent" + index] = lastOPtion.persent;
params["option" + index] = "?";
}
});
return {
...item,
...params,
};
});
this.testPaperExamReport = tableData?.sort((a, b) => {
return a.questionIndex - b.questionIndex;
});
this.testPaperExamReportOptions = [...optionsList];
},
async _testStudentExamReport() {
const request = this.$request.gStudentExamReport;
let response = await request({
paperId: this.paperId,
classIds: this.checkedClassInfos.map((item) => item.classId),
});
if (response.status != 0) {
this.$message.error(response.info);
return;
}
this.testStudentExamReport = response.data;
},
async _classdiffExamReport() {
const request = this.$request.gClassdiffExamReport;
let response = await request({
paperId: this.paperId,
classIds: this.checkedClassInfos.map((item) => item.classId),
});
if (response.status != 0) {
this.$message.error(response.info);
return;
}
var index = 0;
this.classdiffExamReport = response.data.map((item) => {
item.index = index + 1;
index += 1;
return item;
});
},
_delete() { },
},
};
</script>
<style lang="scss">
._el-checkbox {
* {
height: 15px !important;
line-height: 15px !important;
}
}
.default-filter {
padding: 10px !important;
}
.row-line {
width: calc(33% - 2px);
border: 1px solid #ebeef5;
background: #f5f7fa;
display: inline-block;
height: 40px;
line-height: 40px;
.line-subfix {
margin-left: 10px;
}
}
</style>