Blame view

src/views/basic/askTestQuestion/components/askSummaryReport.vue 24 KB
f45b3c05   LH_PC   云平台新UI界面
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
  <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">
                          <span class="line-subfix">班级:</span>
                          <span class="line-value">{{ detail.className }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">科目:</span>
                          <span class="line-value">{{ detail.subjectName }}</span>
                      </div>
                      <div class="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">
                          <span class="line-subfix">班级人数:</span>
                          <span class="line-value">{{ detail.classPersonNum }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">签到人数:</span>
                          <span class="line-value">{{ detail.checkInCount }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">题目总数:</span>
                          <span class="line-value">{{ detail.questionNum }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">答题总数:</span>
                          <span class="line-value">{{ detail.totalAnswersNum }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">课时时长:</span>
                          <span class="line-value">{{ setDuration(detail.duration) }}</span>
                      </div>
                  </el-row>
                  <el-row class="row-subfix">
                      <div class="row-line">
                          <span class="line-subfix">答对总数:</span>
                          <span class="line-value">{{ detail.totalCorrectAnswersNum }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">总参与度:</span>
6bca489d   LH_PC   云平台二期UI
66
                          <span class="line-value">{{ detail.participationRate ? detail.participationRate : 0 }}%</span>
f45b3c05   LH_PC   云平台新UI界面
67
68
69
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">班级正确率:</span>
6bca489d   LH_PC   云平台二期UI
70
                          <span class="line-value">{{ detail.classCorrectRate ? detail.classCorrectRate : 0 }}%</span>
f45b3c05   LH_PC   云平台新UI界面
71
72
73
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">已达正确率:</span>
6bca489d   LH_PC   云平台二期UI
74
                          <span class="line-value">{{ detail.answerCorrectRate ? detail.answerCorrectRate : 0 }}%</span>
f45b3c05   LH_PC   云平台新UI界面
75
76
77
78
79
80
81
82
83
                      </div>
                      <div class="row-line">
                          <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="singleSubjectSummary" border>
                          <el-table-column prop="title" label="课时-题号" />
6bca489d   LH_PC   云平台二期UI
84
                          <el-table-column label="题干" width="80">
f45b3c05   LH_PC   云平台新UI界面
85
86
87
88
89
90
91
92
93
                              <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" />
6bca489d   LH_PC   云平台二期UI
94
                          <el-table-column prop="participationRate" label="班级参与度(单题)" width="170">
f45b3c05   LH_PC   云平台新UI界面
95
96
                              <template slot-scope="scoped">{{ scoped.row.participationRate }}%</template>
                          </el-table-column>
6bca489d   LH_PC   云平台二期UI
97
                          <el-table-column prop="classCorrectRate" label="班级正确率(单题)" width="170">
f45b3c05   LH_PC   云平台新UI界面
98
99
100
                              <template slot-scope="scoped">{{ scoped.row.classCorrectRate }}%</template>
                          </el-table-column>
  
6bca489d   LH_PC   云平台二期UI
101
                          <el-table-column prop="answerCorrectRate" label="已答正确率(单题)" width="170">
f45b3c05   LH_PC   云平台新UI界面
102
103
104
                              <template slot-scope="scoped">{{ scoped.row.answerCorrectRate }}%</template>
                          </el-table-column>
  
6bca489d   LH_PC   云平台二期UI
105
106
107
108
109
110
111
112
113
                          <el-table-column prop="knowledge" label="知识点(单题)" width="150">
                              <template slot-scope="scoped">
                                  <el-tooltip effect="dark" :content="scoped.row.knowledge" placement="left">
                                      <span class="overflowText">
                                          {{  scoped.row.knowledge }}
                                      </span>
                                  </el-tooltip>
                              </template>
                          </el-table-column>
f45b3c05   LH_PC   云平台新UI界面
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
                          <el-table-column prop="correctAnswer" label="正确答案(单题)" width="150">
                              <template slot-scope="scoped">
                                  {{
                  scoped.row.correctAnswer == 1 ? "✓" :
                      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.fallible == 1 ? "✓" :
                          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">
                          <span class="line-subfix">班级:</span>
                          <span class="line-value">{{ detail.className }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">科目:</span>
                          <span class="line-value">{{ detail.subjectName }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">开始时间:</span>
                          <span class="line-value">{{ $props.queryParams.dateRange[0] }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">截止时间:</span>
                          <span class="line-value">{{ $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">
                          <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.questionNum }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">查询时间:</span>
                          <span class="line-value">{{ detail.selectDate }}</span>
                      </div>
                      <div class="row-line">
                          <span class="line-subfix">查询老师:</span>
                          <span class="line-value">{{ detail.answerCorrectRate }}</span>
                      </div>
                      <div class="row-line">
                          <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>
6bca489d   LH_PC   云平台二期UI
193
                          <el-table-column prop="correctRateRank" label="总正确率排名" width="140" />
f45b3c05   LH_PC   云平台新UI界面
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
                          <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="查看折线图" 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" />
6bca489d   LH_PC   云平台二期UI
214
215
                          <el-table-column prop="checkAnswerTimes" label="被抽答次数" width="210" />
                          <el-table-column prop="checkAnswerCorrectTimes" label="抽答答对次数" width="210" />
f45b3c05   LH_PC   云平台新UI界面
216
217
218
219
                      </el-table>
                  </el-row>
              </div>
          </div>
6bca489d   LH_PC   云平台二期UI
220
221
          <el-dialog :append-to-body="true" class="chart-dia" :visible.sync="lineChart.visible" :title="lineChart.title"
              width="800">
f45b3c05   LH_PC   云平台新UI界面
222
223
224
225
226
              <div class="chart-box">
                  <LineChart id="askLineChart" :params="lineChart.data" :xAxis="lineChart.xAxis"
                      :tooltipFormatter="true" />
              </div>
          </el-dialog>
6bca489d   LH_PC   云平台二期UI
227
          <el-dialog :append-to-body="true" class="stem" :visible.sync="stem.visible" :title="'题干'" width="800">
f45b3c05   LH_PC   云平台新UI界面
228
229
230
231
232
233
234
              <iframe v-if="stem && stem.src" :src="stem.src" style="width: 100%;min-height: 400px;" />
          </el-dialog>
          <ExportDia :exportStudent="exportStudent" :diaShow="diaShow" @cancel="cancel" @exportData="_exportData"
              :type="'折线图'" />
      </div>
  </template>
  <script>
6bca489d   LH_PC   云平台二期UI
235
  import { formatDate,getKnowledge } from "utils";
f45b3c05   LH_PC   云平台新UI界面
236
237
238
239
240
241
242
243
244
  import { downloadFile, tablePrint } from "@/utils";
  import LineChart from "@/components/charts/lineChart";
  export default {
      name: "askSummaryReport",
      components: {
          LineChart
      },
      props: {
          askReportIds: Array,
6bca489d   LH_PC   云平台二期UI
245
246
          queryParams: Object,
              role: "",
f45b3c05   LH_PC   云平台新UI界面
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
      },
  
      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: {
                  visible: false,
                  src: null
              }
          };
      },
      async created() {
          await this._changeType();
          await this._detail();
      },
      methods: {
          _export() {
              this.diaShow = true;
          },
          _print() {
6bca489d   LH_PC   云平台二期UI
299
300
301
              let title = this.detail.title || this.subjectNames.join();
  
              tablePrint("print-content", title + "_" + this.currentType);
f45b3c05   LH_PC   云平台新UI界面
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
          },
          cancel() {
              this.diaShow = false;
          },
          async _exportData(arr) {
  
              let studentIds = arr;
  
              let query = {};
  
              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("下载失败");
              }
6bca489d   LH_PC   云平台二期UI
345
          },
f45b3c05   LH_PC   云平台新UI界面
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
          async refresh() {
              await this._changeType();
              await this._detail();
          },
          async _changeType() {
              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) {
6bca489d   LH_PC   云平台二期UI
378
379
  
              if (!Number(times)) return "0分0秒";
f45b3c05   LH_PC   云平台新UI界面
380
381
382
383
              let m = parseInt(times / 1000 / 60);
              let s = parseInt((times / 1000) % 60);
              let ms = times;
              let aTime;
6bca489d   LH_PC   云平台二期UI
384
  
f45b3c05   LH_PC   云平台新UI界面
385
386
387
388
389
              if (times == 0) {
                  aTime = `0`;
              } else {
                  if (m == 0 && s == 0) {
                      aTime = `${ms}毫秒`;
6bca489d   LH_PC   云平台二期UI
390
                  } else if (m == 0) {
f45b3c05   LH_PC   云平台新UI界面
391
                      aTime = `${s}秒`;
6bca489d   LH_PC   云平台二期UI
392
393
394
395
396
397
398
                  } else {
                      if (s == 0) {
                          aTime = `${m}分`;
                      }
                      else {
                          aTime = `${m}分${s}秒`;
                      }
f45b3c05   LH_PC   云平台新UI界面
399
400
                  }
              }
6bca489d   LH_PC   云平台二期UI
401
              // c=(aTime);
f45b3c05   LH_PC   云平台新UI界面
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
              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;
              this.detail.selectDate = formatDate(new Date(), "yyyy-MM-dd");
          },
          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],
              };
  
              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) {
6bca489d   LH_PC   云平台二期UI
516
517
              var subejct = this.$props.role == 'ROLE_BANZHUREN' ? this.$props.queryParams.subjects[0] : this.$props.queryParams.subject;
              this.lineChart.title = `${chartRow.studentName}-${subejct}-多课时作答表现图`;
f45b3c05   LH_PC   云平台新UI界面
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
              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,
                  },
6bca489d   LH_PC   云平台二期UI
541
              ]; 
f45b3c05   LH_PC   云平台新UI界面
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
          },
          openStem(stemRow) {
              this.stem.src = stemRow.screenshot ?? "";
              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 {
6bca489d   LH_PC   云平台二期UI
574
      width: calc(20% - 4px);
f45b3c05   LH_PC   云平台新UI界面
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
      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>