Blame view

src/views/basic/askTestQuestion/components/askBzrMulti.vue 16.8 KB
f45b3c05   LH_PC   云平台新UI界面
1
2
3
  <template>
      <div style="margin-right: 20px;width: 100%">
          <el-row class="row-type">
ef16e57e   LH_PC   fix:前端版本迭代
4
              <label>报表类型</label>
f45b3c05   LH_PC   云平台新UI界面
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
              <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="_import" class="opration-btn" icon="el-icon-upload2">导出报表</el-button>
                  <el-button type="primary" @click="_print" class="opration-btn" icon="el-icon-printer">打印报表</el-button>
              </div>
          </el-row>
          <div id="print-content">
              <div v-if="currentType == '学生多科作答表现'">
                  <el-row class="row-table">
                      <el-table class="default-table" :data="answersList">
                          <el-table-column prop="studentCode" label="学号"></el-table-column>
                          <el-table-column prop="studentName" label="姓名"></el-table-column>
                          <el-table-column v-for="(item, index) in answersSubjects" :key="index" :label="item">
                              <el-table-column :label="index == 0 ? '总课时数' : '课时数'" :prop="'periodCount' + item">
                                  <template slot-scope="scoped">{{
                  scoped.row["periodCount" + item] ||
                      Number(scoped.row["periodCount" + item]) === 0
                      ? scoped.row["periodCount" + item]
                      : "-"
              }}</template>
                              </el-table-column>
                              <el-table-column :label="index == 0 ? '总出题数' : '出题数'" :prop="'questionNum' + item">
                                  <template slot-scope="scoped">{{
                  scoped.row["questionNum" + item] ||
                      Number(scoped.row["questionNum" + item]) === 0
                      ? scoped.row["questionNum" + item]
                      : "-"
              }}</template>
                              </el-table-column>
                              <el-table-column :label="index == 0 ? '总参与度' : '参与度'"
                                  :prop="'participationRate' + item"><template slot-scope="scoped">{{
                  scoped.row["participationRate" + item] ||
                      Number(scoped.row["participationRate" + item]) === 0
                      ? scoped.row["participationRate" + item] + "%"
                      : "-"
              }}</template>
                              </el-table-column>
                              <el-table-column :label="index == 0 ? '总正确率' : '正确率'"
                                  :prop="'answerCorrectRate' + item"><template slot-scope="scoped">{{
                  scoped.row["answerCorrectRate" + item] ||
                      Number(scoped.row["answerCorrectRate" + item]) === 0
                      ? scoped.row["answerCorrectRate" + item] + "%"
                      : "-"
              }}</template>
                              </el-table-column>
                          </el-table-column>
ef16e57e   LH_PC   fix:前端版本迭代
53
54
                          <el-table-column label="查看雷达图" fixed="right" width="100" align="center"
                              class-name="print-hidden">
f45b3c05   LH_PC   云平台新UI界面
55
56
57
58
59
60
61
62
63
64
65
66
                              <template slot-scope="scoped">
                                  <el-button type="text" @click="openRandarChart(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="interactionList">
                          <el-table-column prop="studentCode" label="学号"></el-table-column>
                          <el-table-column prop="studentName" label="姓名"></el-table-column>
6bca489d   LH_PC   云平台二期UI
67
68
                          <el-table-column prop="interactionsNum全部科目" label="参与分"></el-table-column>
                          <el-table-column prop="interactionsCorrectNum全部科目" label="对错分"></el-table-column>
f45b3c05   LH_PC   云平台新UI界面
69
                          <el-table-column v-for="(item, index) in interactionOptions" :key="index" :label="item">
6bca489d   LH_PC   云平台二期UI
70
71
  
                              <el-table-column label="互动数" :prop="'answerTimes' + item">
f45b3c05   LH_PC   云平台新UI界面
72
                                  <template slot-scope="scoped">{{
6bca489d   LH_PC   云平台二期UI
73
74
75
                  scoped.row["answerTimes" + item] ||
                      Number(scoped.row["answerTimes" + item]) === 0
                      ? scoped.row["answerTimes" + item]
f45b3c05   LH_PC   云平台新UI界面
76
77
78
                      : "-"
              }}</template>
                              </el-table-column>
6bca489d   LH_PC   云平台二期UI
79
                              <el-table-column label="参与数" :prop="'interactionsNum' + item">
f45b3c05   LH_PC   云平台新UI界面
80
81
82
83
84
                                  <template slot-scope="scoped">{{
                  scoped.row["interactionsNum" + item] ||
                      Number(scoped.row["interactionsNum" + item]) === 0
                      ? scoped.row["interactionsNum" + item]
                      : "-"
f45b3c05   LH_PC   云平台新UI界面
85
86
                                      }}</template>
                              </el-table-column>
6bca489d   LH_PC   云平台二期UI
87
                              <el-table-column label="答对数" :prop="'interactionsCorrectNum' + item">
f45b3c05   LH_PC   云平台新UI界面
88
89
90
91
92
93
94
95
96
97
98
99
                                  <template slot-scope="scoped">{{
                                      scoped.row["interactionsCorrectNum" + item] ||
                                      Number(scoped.row["interactionsCorrectNum" + item]) === 0
                                      ? scoped.row["interactionsCorrectNum" + item]
                                      : "-"
                                      }}</template>
                              </el-table-column>
                          </el-table-column>
                      </el-table>
                  </el-row>
              </div>
          </div>
6bca489d   LH_PC   云平台二期UI
100
101
          <el-dialog :append-to-body="true" class="chart-dia" :visible.sync="redarVisible" :title="radarChart.title"
              width="800">
f45b3c05   LH_PC   云平台新UI界面
102
              <div class="chart-box">
ef16e57e   LH_PC   fix:前端版本迭代
103
                  <RadarChart id="radarChart" :params="radarChart" :tooltipFormatter="true" />
f45b3c05   LH_PC   云平台新UI界面
104
105
106
107
108
              </div>
          </el-dialog>
      </div>
  </template>
  <script>
6bca489d   LH_PC   云平台二期UI
109
  import { downloadFile, tablePrint, formatDate } from "@/utils";
f45b3c05   LH_PC   云平台新UI界面
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
  import RadarChart from "@/components/charts/radarChart";
  export default {
      name: "askbzrMutli",
      components: {
          RadarChart
      },
      props: {
          askReportIds: Array,
          queryParams: Object
      },
  
      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: "学生多科作答表现",
              answersList: [],
              answersOptions: [],
              answersSubjects: [],
              interactionList: [],
              interactionOptions: [],
              interactionSubjects: [],
6bca489d   LH_PC   云平台二期UI
145
              redarVisible: false,
f45b3c05   LH_PC   云平台新UI界面
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
              radarChart: {
                  title: "",
                  indicator: [
                      {
                          name: "",
                          max: 100,
                          axisLabel: {
                              show: true,
                              showMaxLabel: true,
                              formatter: "{value}%",
                          },
                      },
                  ],
                  seriesData: []
              },
              //题干数据对象
              stem: {
                  visible: false,
                  src: null
              }
          };
      },
      async created() {
          await this._changeType();
      },
      methods: {
6bca489d   LH_PC   云平台二期UI
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
          async _import() {
  
              var importReport = this.currentType == '学生多科互动表现' ? this.$request.cTExportPhaseInteractiveReport : this.$request.cTExportPhaseAnswerReport;
  
              const data = await importReport({
                  periodIds: this.$props.askReportIds,
                  classIds: [this.$props.queryParams.class],
                  subjectNames: [...this.$props.queryParams.subjects],
              });
  
              if (data) {
                  let blob = new Blob([data], {
                      type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                  });
                  downloadFile(`随堂问-多科汇总分析报表.xlsx`, blob);
              } else {
                  this.$message.error("下载失败");
              }
          },
f45b3c05   LH_PC   云平台新UI界面
191
          _print() {
ef16e57e   LH_PC   fix:前端版本迭代
192
193
194
195
196
197
198
199
200
201
202
203
204
              var splitParam = 0;
              var diffNumber = 0;
              var diffStNumber = 0;
              if (this.currentType == '学生多科作答表现') {
                  splitParam = 16;
                  diffNumber = 2;
                  diffStNumber = 15;
              }
              else if (this.currentType == '学生多科互动表现') {
                  splitParam = 15;
                  diffNumber = 4;
                  diffStNumber = 14;
              }
f45b3c05   LH_PC   云平台新UI界面
205
  
ef16e57e   LH_PC   fix:前端版本迭代
206
207
208
209
210
211
212
213
214
              tablePrint({
                  id: "print-content",
                  title: this.currentType,
                  lindex: 1,
                  splitParam: splitParam,
                  fixedColumn: 2,
                  diffNumber: diffNumber,
                  diffStNumber: diffStNumber
              });
f45b3c05   LH_PC   云平台新UI界面
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
          },
          async refresh() {
              await this._changeType();
          },
          async _changeType() {
              switch (this.currentType) {
                  case "学生多科作答表现": { await this._multipleSubjectAnswers(); }; break;
                  case "学生多科互动表现": { await this._multiDisciplinaryInteraction(); }; 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) {
              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 && s != 0) {
                      aTime = `${s}秒`;
                  } else if (m != 0 && s != 0) {
                      aTime = `${m}分${s}秒`;
                  }
              }
              return aTime;
          },
          async _multipleSubjectAnswers() {
f45b3c05   LH_PC   云平台新UI界面
264
265
266
267
268
269
270
271
              const answersRequest =
                  this.role == "ROLE_PERSONAL"
                      ? this.$request.pPhaseAnswerReport
                      : this.$request.cTPhaseAnswerReport;
  
              let query = {
                  periodIds: this.$props.askReportIds,
                  classIds: [this.$props.queryParams.class],
6bca489d   LH_PC   云平台二期UI
272
                  subjectNames: [...this.$props.queryParams.subjects],
f45b3c05   LH_PC   云平台新UI界面
273
274
              };
  
f45b3c05   LH_PC   云平台新UI界面
275
276
277
278
279
280
281
282
283
284
285
286
287
288
              let answersResponse = await answersRequest({
                  ...query
              });
  
  
              if (answersResponse.status != 0) {
                  this.$message.error(answersResponse.info);
                  return;
              }
  
              let optionsList = [];
  
              let subjectName = [];
  
ef16e57e   LH_PC   fix:前端版本迭代
289
              this.answersList = answersResponse.data?.list?.map((item) => {
f45b3c05   LH_PC   云平台新UI界面
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
  
                  let params = {};
  
                  item.dataList.map((items, index) => {
                      if (!subjectName.includes(items.subjectName)) {
                          subjectName.push(items.subjectName);
                      }
                      params["answerCorrectRate" + items.subjectName] =
                          items.answerCorrectRate;
                      params["correctRate" + items.subjectName] = items.correctRate;
                      params["participationRate" + items.subjectName] =
                          items.participationRate;
                      params["periodCount" + items.subjectName] = items.periodCount;
                      params["questionNum" + items.subjectName] = items.questionNum;
                  });
  
                  return {
                      ...item,
                      ...params,
                  };
              });
  
              this.answersSubjects = [...subjectName];
  
              this.answersOptions = [...optionsList];
  
f45b3c05   LH_PC   云平台新UI界面
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
          },
          async _multiDisciplinaryInteraction() {
  
              this.studentPerformance = [];
  
              if (!this.$props.askReportIds || this.$props.askReportIds.length < 1) return;
  
              const interactionRequest =
                  this.role == "ROLE_PERSONAL"
                      ? this.$request.pPhaseInteractiveReport
                      : this.$request.cTPhaseInteractiveReport;
  
              let query = {
                  periodIds: this.$props.askReportIds,
                  classIds: [this.$props.queryParams.class],
6bca489d   LH_PC   云平台二期UI
331
                  subjectNames: [...this.$props.queryParams.subjects],
f45b3c05   LH_PC   云平台新UI界面
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
              };
  
              let interactionReponse = await interactionRequest({
                  ...query
              });
  
              if (interactionReponse.status != 0) {
                  this.$message.error(interactionReponse.info);
                  return;
              }
  
              let subjectName = [];
  
              this.interactionList = interactionReponse.data?.list?.map((item) => {
                  let params = {};
ef16e57e   LH_PC   fix:前端版本迭代
347
                  item.dataList?.filter((items, index) => {
6bca489d   LH_PC   云平台二期UI
348
                      if (!subjectName.includes(items.subjectName) && items.subjectName != '全部科目') {
f45b3c05   LH_PC   云平台新UI界面
349
350
                          subjectName.push(items.subjectName);
                      }
6bca489d   LH_PC   云平台二期UI
351
352
                      params["answerTimes" + items.subjectName] =
                          items.answerTimes;
f45b3c05   LH_PC   云平台新UI界面
353
354
355
356
357
                      params["interactionsNum" + items.subjectName] =
                          items.interactionsNum;
                      params["interactionsCorrectNum" + items.subjectName] =
                          items.interactionsCorrectNum;
                  });
6bca489d   LH_PC   云平台二期UI
358
  
f45b3c05   LH_PC   云平台新UI界面
359
360
361
362
363
                  return {
                      ...item,
                      ...params,
                  };
              });
6bca489d   LH_PC   云平台二期UI
364
              console.log(this.interactionList)
f45b3c05   LH_PC   云平台新UI界面
365
              this.interactionOptions = [...subjectName];
f45b3c05   LH_PC   云平台新UI界面
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
          },
          openRandarChart(obj) {
              this.radarChart = {
                  indicator: [
                      {
                          name: "",
                          max: 100,
                          axisLabel: {
                              show: true,
                              showMaxLabel: true,
                              formatter: "{value}%",
                          },
                      },
                  ],
                  seriesData: [],
              };
6bca489d   LH_PC   云平台二期UI
382
              this.radarChart.title = obj.studentName + "-多科阶段作答表现图";
f45b3c05   LH_PC   云平台新UI界面
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
              let dataList = obj.dataList.slice(1, obj.dataList.length);
              let subjectList = dataList.map((item) => item.subjectName);
              subjectList.map((item, index) => {
                  if (index < 1) {
                      this.radarChart.indicator[index].name = item;
                  } else {
                      this.radarChart.indicator.push({ name: item, max: 100 });
                  }
              });
              // 为了美观
              if (this.radarChart.indicator.length < 3) {
                  let num = this.radarChart.indicator.length;
                  for (let i = 0; i < 6; i++) {
                      if (i >= num) {
                          this.radarChart.indicator.push({ name: "", max: 100 });
                      }
                  }
              }
              let participationRate = dataList.map((item) => item.participationRate);
              let correctRate = dataList.map((item) => item.correctRate);
              this.radarChart.seriesData = [
                  {
                      value: participationRate,
                      name: "参与度",
                  },
                  {
                      value: correctRate,
                      name: "正确率",
                  },
              ];
  
6bca489d   LH_PC   云平台二期UI
414
              this.redarVisible = true;
f45b3c05   LH_PC   云平台新UI界面
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
          }
      }
  };
  </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% - 2px);
      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>