askSummaryReport.vue
25.3 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
<template>
<div style="margin-right: 20px;width: 100%">
<el-row class="row-type">
<label>报表类型</label>
<el-select class="opration-select" v-model="currentType">
<el-option v-for="(item, index) in types" :lable="item" :key="index" :value="item" />
</el-select>
<div style="float: right;">
<el-button type="primary" @click="_export" icon="el-icon-upload2" class="opration-btn">导出报表</el-button>
<el-button type="primary" @click="_print" icon="el-icon-printer" class="opration-btn">打印报表</el-button>
</div>
</el-row>
<div id="print-content">
<div v-if="currentType == '题目作答表现汇总'">
<el-row class="row-subfix" style="margin-top:10px">
<div class="row-line row-line">
<span class="line-subfix">班级:</span>
<span class="line-value">{{ detail.className }}</span>
</div>
<div class="row-line row-line">
<span class="line-subfix">科目:</span>
<span class="line-value">{{ detail.subjectName }}</span>
</div>
<div class="row-line row-line">
<span class="line-subfix">课时数:</span>
<span class="line-value">{{ $props.askReportIds.length }}</span>
</div>
<div class="row-line ">
<span class="line-subfix">上课时间:</span>
<span class="line-value">{{ detail.startTime }}</span>
</div>
<div class="row-line ">
<span class="line-subfix">下课时间:</span>
<span class="line-value">{{ detail.endTime }}</span>
</div>
</el-row>
<el-row class="row-subfix">
<div class="row-line row-line-5">
<span class="line-subfix">班级人数:</span>
<span class="line-value">{{ detail.classPersonNum }}</span>
</div>
<div class="row-line row-line-5">
<span class="line-subfix">签到人数:</span>
<span class="line-value">{{ detail.checkInCount }}</span>
</div>
<div class="row-line row-line-5">
<span class="line-subfix">题目总数:</span>
<span class="line-value">{{ detail.questionNum }}</span>
</div>
<div class="row-line row-line-5">
<span class="line-subfix">答题总数:</span>
<span class="line-value">{{ detail.totalAnswersNum }}</span>
</div>
<div class="row-line row-line-5">
<span class="line-subfix">课时时长:</span>
<span class="line-value">{{ setDuration(detail.consumingDuration) }}</span>
</div>
</el-row>
<el-row class="row-subfix">
<div class="row-line row-line-5">
<span class="line-subfix">答对总数:</span>
<span class="line-value">{{ detail.totalCorrectAnswersNum }}</span>
</div>
<div class="row-line row-line-5">
<span class="line-subfix">总参与度:</span>
<span class="line-value">{{ detail.participationRate ? detail.participationRate : 0 }}%</span>
</div>
<div class="row-line row-line-5">
<span class="line-subfix">班级正确率:</span>
<span class="line-value">{{ detail.classCorrectRate ? detail.classCorrectRate : 0 }}%</span>
</div>
<div class="row-line row-line-5">
<span class="line-subfix">已达正确率:</span>
<span class="line-value">{{ detail.answerCorrectRate ? detail.answerCorrectRate : 0 }}%</span>
</div>
<div class="row-line row-line-5">
<span class="line-subfix">反馈时长:</span>
<span class="line-value">{{ setDuration(detail.duration) }}</span>
</div>
</el-row>
<el-row class="row-table">
<el-table class="default-table" :data="singleSubjectSummary" border>
<el-table-column prop="title" label="课时-题号" />
<el-table-column label="题干" class-name="print-hidden" width="80">
<template slot-scope="scoped">
<el-button type="text" @click="openStem(scoped.row)">查看</el-button>
</template>
</el-table-column>
<el-table-column prop="questionType" label="题型" width="100">
<template slot-scope="scoped">{{ setSubPro(scoped.row.questionType) }}</template>
</el-table-column>
<el-table-column prop="answeredNum" label="答题人数" width="100" />
<el-table-column prop="correctAnswerNum" label="答对人数" width="100" />
<el-table-column prop="participationRate" label="班级参与度(单题)" width="170">
<template slot-scope="scoped">{{ scoped.row.participationRate }}%</template>
</el-table-column>
<el-table-column prop="classCorrectRate" label="班级正确率(单题)" width="170">
<template slot-scope="scoped">{{ scoped.row.classCorrectRate }}%</template>
</el-table-column>
<el-table-column prop="answerCorrectRate" label="已答正确率(单题)" width="170">
<template slot-scope="scoped">{{ scoped.row.answerCorrectRate }}%</template>
</el-table-column>
<el-table-column prop="knowledge" label="知识点(单题)" width="150">
<template slot-scope="scoped">
<el-tooltip effect="dark" :content="_knowledge(scoped.row.knowledge)"
placement="bottom">
<span class="overflowText">
{{ _knowledge(scoped.row.knowledge) }}
</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="correctAnswer" label="正确答案(单题)" width="150">
<template slot-scope="scoped">
{{
scoped.row.questionType == 4 && scoped.row.correctAnswer == 1 ? "✓" :
scoped.row.questionType == 4 && scoped.row.correctAnswer == 2 ? "✗" :
scoped.row.correctAnswer
}}
</template>
</el-table-column>
<el-table-column prop="fallible" label="干扰选项(单题)" width="150">
<template slot-scope="scoped">
{{
scoped.row.questionType == 4 && scoped.row.fallible == 1 ? "✓" :
scoped.row.questionType == 4 && scoped.row.fallible == 2 ? "✗" :
scoped.row.fallible
}}
</template>
</el-table-column>
</el-table>
</el-row>
</div>
<div v-if="currentType == '学生单科表现作答汇总表'">
<el-row class="row-subfix" style="margin-top:10px">
<div class="row-line row-line-4">
<span class="line-subfix">班级:</span>
<span class="line-value">{{ detail.className }}</span>
</div>
<div class="row-line row-line-4">
<span class="line-subfix">科目:</span>
<span class="line-value">{{ detail.subjectName }}</span>
</div>
<div class="row-line row-line-4">
<span class="line-subfix">开始日期:</span>
<span class="line-value">{{ $props.queryParams.dateRange && $props.queryParams.dateRange.length
> 1 ?
$props.queryParams.dateRange[0] : "" }}</span>
</div>
<div class="row-line row-line-4">
<span class="line-subfix">截止日期:</span>
<span class="line-value">{{ $props.queryParams.dateRange && $props.queryParams.dateRange.length
> 1 ?
$props.queryParams.dateRange[1] : "" }}</span>
</div>
<!-- <div class="row-line">
<span class="line-subfix">下课时间:</span>
<span class="line-value">{{ detail.endTime }}</span>
</div> -->
</el-row>
<el-row class="row-subfix">
<div class="row-line row-line-4">
<span class="line-subfix">课时数:</span>
<span class="line-value">{{ $props.askReportIds.length }}</span>
</div>
<div class="row-line row-line-4">
<span class="line-subfix">总出题数:</span>
<span class="line-value">{{ detail.questionNum }}</span>
</div>
<div class="row-line row-line-4">
<span class="line-subfix">查询时间:</span>
<span class="line-value">{{ detail.selectDate }}</span>
</div>
<div class="row-line row-line-4">
<span class="line-subfix">查询老师:</span>
<span class="line-value">{{ this.$store.getters.info.name }}</span>
</div>
<!-- <div class="row-line row-line-5">
<span class="line-subfix">课时时长:</span>
<span class="line-value">{{ setDuration(detail.consumingDuration) }}</span>
</div> -->
</el-row>
<el-row class="row-table">
<el-table class="default-table" :data="studentPerformance">
<el-table-column prop="studentCode" label="学号" />
<el-table-column prop="studentName" label="姓名" width="160" />
<el-table-column prop="answerTimes" label="累计答题次数" width="160" />
<el-table-column prop="correctAnswerTimes" label="累计答对次数" width="160" />
<el-table-column prop="participationRate" label="总参与度" width="160">
<template slot-scope="scoped">{{ scoped.row.participationRate }}%</template>
</el-table-column>
<el-table-column prop="participationRateRank" label="总参与度排名" width="160" />
<el-table-column prop="correctRate" label="总正确率" width="120">
<template slot-scope="scoped">{{ scoped.row.correctRate }}%</template>
</el-table-column>
<el-table-column prop="correctRateRank" label="总正确率排名" width="140" />
<el-table-column prop="answerCorrectRate" label="已答正确率" width="120">
<template slot-scope="scoped">{{ scoped.row.answerCorrectRate }}%</template>
</el-table-column>
<el-table-column prop="correctAnswerNum" label="查看折线图" class-name="print-hidden" width="120">
<template slot-scope="scoped">
<el-button type="text" text @click="openLineChart(scoped.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
</div>
<div v-if="currentType == '学生单科互动表现排名表'">
<el-row class="row-table">
<el-table class="default-table" :data="studentInteractive">
<el-table-column prop="studentCode" label="学号" />
<el-table-column prop="studentName" label="姓名" width="160" />
<el-table-column prop="interactionsNum" label="参与得分" width="210" />
<el-table-column prop="interactionsCorrectNum" label="对错得分" width="210" />
<el-table-column prop="rushAnswerTimes" label="抢答成功次数" width="210" />
<el-table-column prop="rushAnswerCorrectTimes" label="抢答答对次数" width="210" />
<el-table-column prop="checkAnswerTimes" label="被抽答次数" width="210" />
<el-table-column prop="checkAnswerCorrectTimes" label="抽答答对次数" width="210" />
</el-table>
</el-row>
</div>
</div>
<el-dialog :append-to-body="true" class="chart-dia" :visible.sync="lineChart.visible" :title="lineChart.title"
width="800">
<div class="chart-box">
<LineChart id="askLineChart" :params="lineChart.data" :xAxis="lineChart.xAxis"
:tooltipFormatter="true" />
</div>
</el-dialog>
<el-dialog :append-to-body="true" class="stem" :visible.sync="stem.visible" :title="'题干'" width="800">
<Preview v-if="stem && stem.src" :src="stem.src" :key="stem.src" />
</el-dialog>
<ExportDia :exportStudent="exportStudent" :diaShow="diaShow" @cancel="cancel" @exportData="_exportData"
:type="'折线图'" />
</div>
</template>
<script>
import { formatDate, getKnowledge } from "utils";
import { downloadFile, tablePrint } from "@/utils";
import LineChart from "@/components/charts/lineChart";
import Preview from "@/components/preview";
export default {
name: "askSummaryReport",
components: {
LineChart,
Preview
},
props: {
askReportIds: Array,
queryParams: Object,
role: "",
},
watch: {
currentType: {
handler: async function (val) {
await this._changeType();
},
deep: false,
},
$props: {
handler: async function (val) {
await this._changeType();
},
deep: false,
}
},
data() {
return {
types: ["题目作答表现汇总", "学生单科表现作答汇总表", "学生单科互动表现排名表"],
currentType: "题目作答表现汇总",
detail: {},
page: 1,
exportStudent: [],
diaShow: false,
size: 10,
total: 0,
studentPerformance: [],
singleSubjectSummary: [],
studentInteractive: [],
//折线图数据对象
lineChart: {
data: [],
xAxis: [],
title: "",
visible: false
},
//题干数据对象
stem: {
type: "html",
visible: false,
src: null
}
};
},
async created() {
await this._changeType();
await this._detail();
},
methods: {
_knowledge(knowledgeParam) {
return getKnowledge(knowledgeParam)
},
_export() {
this.diaShow = true;
},
_print() {
let title = this.detail.title || this.subjectNames?.join();
tablePrint({
id: "print-content",
title: title + "_" + this.currentType
});
},
cancel() {
this.diaShow = false;
},
async _exportData(arr) {
let studentIds = arr;
let query = {
size: 9999
};
if (studentIds != null) {
if (studentIds.length > 0) {
query.studentIds = studentIds;
} else {
query.studentIds = [];
}
}
let exportPeriodReport = "";
query.periodIds = this.$props.askReportIds;
query.classIds = [this.$props.queryParams.class];
exportPeriodReport =
this.role == "ROLE_PERSONAL"
? this.$request.pExportPhaseAnswerReport
: this.$request.exportPhaseAnswerReport;
const data = await exportPeriodReport({
...query,
});
if (data) {
this.cancel();
let blob = new Blob([data], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
});
let name = `随堂问-${this.detail.className}-${this.detail.subjectName}汇总分析报表.xlsx`
downloadFile(this.status ? "随堂问-已归档单课时报表.xlsx" : name, blob);
} else {
this.$message.error("下载失败");
}
},
async refresh() {
await this._changeType();
await this._detail();
},
async _changeType() {
this.detail.selectDate = formatDate(new Date(), "yyyy-MM-dd");
switch (this.currentType) {
case "题目作答表现汇总": { await this._singleSubjectSummary(); }; break;
case "学生单科表现作答汇总表": { await this._studentPerformance(); }; break;
case "学生单科互动表现排名表": { await this._studentInteractive(); }; break;
}
},
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;
},
setDuration(times) {
if (!Number(times)) return "0分0秒";
let m = parseInt(times / 1000 / 60);
let s = parseInt((times / 1000) % 60);
let ms = times;
let aTime;
if (times == 0) {
aTime = `0`;
} else {
if (m == 0 && s == 0) {
aTime = `${ms}毫秒`;
} else if (m == 0) {
aTime = `${s}秒`;
} else {
if (s == 0) {
aTime = `${m}分`;
}
else {
aTime = `${m}分${s}秒`;
}
}
}
// c=(aTime);
return aTime;
},
async _detail() {
this.detail = {};
if (!this.$props.askReportIds || this.$props.askReportIds.length < 1) return;
const periodDetail =
this.role == "ROLE_PERSONAL"
? this.$request.pPeriodDetail :
this.role == "ROLE_BANZHUREN" ?
this.$request.periodDetail
: this.$request.periodDetail;
let detailReponse = await periodDetail({
periodIds: this.$props.askReportIds
});
if (detailReponse.status != 0) {
this.$message.error(detailReponse.info);
return;
}
this.detail = detailReponse.data;
},
async _singleSubjectSummary() {
this.singleSubjectSummary = [];
if (!this.$props.askReportIds || this.$props.askReportIds.length < 1) return;
const periodList =
this.role == "ROLE_PERSONAL"
? this.$request.pPeriodQuestionReport
: this.$request.periodQuestionReport;
let query = {
periodIds: this.$props.askReportIds,
classIds: [this.$props.queryParams.class],
size: 9999
};
let periodListReponse = await periodList({
...query
});
if (periodListReponse.status != 0) {
this.$message.error(periodListReponse.info);
return;
}
this.singleSubjectSummary = periodListReponse.data.list;
this.total = periodListReponse.data.count;
},
async _studentPerformance() {
this.studentPerformance = [];
if (!this.$props.askReportIds || this.$props.askReportIds.length < 1) return;
const phaseAnswerList =
this.role == "ROLE_PERSONAL"
? this.$request.pPhaseAnswerReport
: this.$request.phaseAnswerReport;
let query = {
periodIds: this.$props.askReportIds,
classIds: [this.$props.queryParams.class],
};
let phaseAnswerReponse = await phaseAnswerList({
...query
});
if (phaseAnswerReponse.status != 0) {
this.$message.error(phaseAnswerReponse.info);
return;
}
this.studentPerformance = phaseAnswerReponse.data.list;
this.total = phaseAnswerReponse.data.count;
},
async _studentInteractive() {
this.studentInteractive = [];
if (!this.$props.askReportIds || this.$props.askReportIds.length < 1) return;
const interactiveList =
this.role == "ROLE_PERSONAL"
? this.$request.phaseInteractiveReport
: this.$request.phaseInteractiveReport;
let query = {
periodIds: this.$props.askReportIds,
classIds: [this.$props.queryParams.class],
};
let interactiveListReponse = await interactiveList({
...query
});
if (interactiveListReponse.status != 0) {
this.$message.error(interactiveListReponse.info);
return;
}
this.studentInteractive = interactiveListReponse.data.list;
this.total = interactiveListReponse.data.count;
},
openLineChart(chartRow) {
var subejct = this.$props.role == 'ROLE_BANZHUREN' ? this.$props.queryParams.subjects[0] : this.$props.queryParams.subject;
this.lineChart.title = `${chartRow.studentName}-${subejct}-多课时作答表现图`;
this.lineChart.visible = true;
let participationRate = [];
let correctRate = [];
let answerCorrectRate = [];
this.lineChart.xAxis = chartRow.dataList.map((item) => {
participationRate.push(item.participationRate);
correctRate.push(item.correctRate);
answerCorrectRate.push(item.answerCorrectRate);
return item.name;
});
this.lineChart.data = [
{
name: "参与度",
value: participationRate,
},
{
name: "正确率",
value: correctRate,
},
{
name: "已答正确率",
value: answerCorrectRate,
},
];
},
openStem(stemRow) {
this.stem.src = stemRow.screenshot ?? "";
console.log('stem', this.stem)
this.stem.visible = true;
},
openExport() {
}
}
};
</script>
<style scoped lang="scss">
.chart-dia {
.chart-box {
width: 100%;
height: 300px;
}
:deep(.el-dialog__body) {
padding: 0 0 20px 0;
}
}
.opration-btn {
margin-right: 10px;
}
.opration-select {
margin-left: 10px;
}
.row-line {
width: calc(20% - 4px);
border: 1px solid #ebeef5;
background: #f5f7fa;
display: inline-block;
height: 40px;
line-height: 40px;
.line-subfix {
margin-left: 10px;
}
}
.row-line-4 {
width: calc(25% - 4px);
border: 1px solid #ebeef5;
background: #f5f7fa;
display: inline-block;
height: 40px;
line-height: 40px;
.line-subfix {
margin-left: 10px;
}
}
.row-table {
margin-top: 20px;
}
</style>