d01c5799
梁保满
随堂问 报表开发
|
1
|
<template>
|
22095aba
梁保满
接口联调
|
2
3
|
<div>
<el-table :data="resultData" border style="width: 100%">
|
ce278878
梁保满
2-2 bugfix
|
4
5
6
7
8
9
10
11
12
13
|
<el-table-column
prop="studentCode"
label="学号"
align="center"
></el-table-column>
<el-table-column
prop="studentName"
label="姓名"
align="center"
></el-table-column>
|
22095aba
梁保满
接口联调
|
14
|
<template v-if="types == 1">
|
ce278878
梁保满
2-2 bugfix
|
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
|
<el-table-column
prop="answerTimes"
label="答题次数"
align="center"
></el-table-column>
<el-table-column
prop="consumingDuration"
label="答题耗时"
align="center"
><template slot-scope="scoped">{{
setDuration(scoped.row.consumingDuration)
}}</template></el-table-column
>
<el-table-column
prop="correctAnswerTimes"
label="答对次数"
align="center"
></el-table-column>
<el-table-column
prop="participationRate"
label="参与度"
sortable
align="center"
><template slot-scope="scoped"
>{{ scoped.row.participationRate }}%</template
></el-table-column
>
<el-table-column
prop="correctRate"
label="正确率"
sortable
align="center"
><template slot-scope="scoped"
>{{ scoped.row.correctRate }}%</template
></el-table-column
>
<el-table-column
prop="answerCorrectRate"
label="已答正确率"
sortable
align="center"
><template slot-scope="scoped"
>{{ scoped.row.answerCorrectRate }}%</template
></el-table-column
>
<el-table-column
v-for="(item, index) in optionsList"
:key="index"
:label="'Q' + (index + 1)"
align="center"
><template slot-scope="scoped">
|
22095aba
梁保满
接口联调
|
66
67
68
69
|
<span :class="scoped.row['isRight' + index] ? '' : 'red'">{{
scoped.row["answer" + index]
}}</span>
</template>
|
d01c5799
梁保满
随堂问 报表开发
|
70
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
71
72
|
</template>
<template v-if="types == 2">
|
ce278878
梁保满
2-2 bugfix
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
<el-table-column
prop="answerTimes"
label="累计答题次数"
align="center"
></el-table-column>
<el-table-column
prop="correctAnswerTimes"
label="累计答对次数"
align="center"
></el-table-column>
<el-table-column
prop="participationRate"
label="总参与度"
align="center"
><template slot-scope="scoped"
>{{ scoped.row.participationRate }}%</template
></el-table-column
>
|
22095aba
梁保满
接口联调
|
91
|
|
ce278878
梁保满
2-2 bugfix
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
<el-table-column
prop="participationRateRank"
label="总参与度班名"
align="center"
></el-table-column>
<el-table-column prop="correctRate" label="总正确率" align="center"
><template slot-scope="scoped"
>{{ scoped.row.correctRate }}%</template
></el-table-column
>
<el-table-column
prop="correctRateRank"
label="总正确率班名"
sortable
align="center"
></el-table-column>
<el-table-column
prop="answerCorrectRate"
label="已答正确率"
align="center"
><template slot-scope="scoped"
>{{ scoped.row.answerCorrectRate }}%</template
></el-table-column
>
|
22095aba
梁保满
接口联调
|
116
117
|
<el-table-column label="查看折线图" align="center">
<template slot-scope="scoped">
|
ce278878
梁保满
2-2 bugfix
|
118
119
120
121
122
123
124
125
|
<el-button
@click="openLineChart(scoped.row)"
type="primary"
size="mini"
circle
icon="el-icon-arrow-right"
></el-button
></template>
|
d01c5799
梁保满
随堂问 报表开发
|
126
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
127
128
|
</template>
<template v-if="types == 3">
|
ce278878
梁保满
2-2 bugfix
|
129
130
131
132
133
134
135
136
137
138
139
|
<el-table-column
v-for="(item, index) in phaseOption"
:key="index"
:label="item"
align="center"
>
<el-table-column
align="center"
:label="index == 0 ? '总课时数' : '课时数'"
:prop="'periodCount' + item"
>
|
22095aba
梁保满
接口联调
|
140
|
</el-table-column>
|
ce278878
梁保满
2-2 bugfix
|
141
142
143
144
145
|
<el-table-column
align="center"
:label="index == 0 ? '总出题数' : '出题数'"
:prop="'questionNum' + item"
>
|
22095aba
梁保满
接口联调
|
146
|
</el-table-column>
|
ce278878
梁保满
2-2 bugfix
|
147
148
149
150
151
152
153
|
<el-table-column
align="center"
:label="index == 0 ? '总参与度' : '参与度'"
:prop="'participationRate' + item"
><template slot-scope="scoped"
>{{ scoped.row["participationRate" + item] }}%</template
>
|
22095aba
梁保满
接口联调
|
154
|
</el-table-column>
|
ce278878
梁保满
2-2 bugfix
|
155
156
157
158
159
160
161
|
<el-table-column
align="center"
:label="index == 0 ? '总正确率' : '正确率'"
:prop="'correctRate' + item"
><template slot-scope="scoped"
>{{ scoped.row["correctRate" + item] }}%</template
>
|
22095aba
梁保满
接口联调
|
162
|
</el-table-column>
|
d01c5799
梁保满
随堂问 报表开发
|
163
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
164
165
|
<el-table-column label="查看雷达图" align="center">
<template slot-scope="scoped">
|
ce278878
梁保满
2-2 bugfix
|
166
167
168
169
170
171
172
173
|
<el-button
@click="openRandarChart(scoped.row)"
type="primary"
size="mini"
circle
icon="el-icon-arrow-right"
></el-button
></template>
|
d01c5799
梁保满
随堂问 报表开发
|
174
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
175
176
|
</template>
</el-table>
|
ce278878
梁保满
2-2 bugfix
|
177
178
179
180
181
182
|
<el-dialog
class="chart-dia"
:visible.sync="chartDia"
:title="chartTitle"
width="800"
>
|
22095aba
梁保满
接口联调
|
183
|
<div class="chart-box">
|
ce278878
梁保满
2-2 bugfix
|
184
185
186
187
188
189
190
|
<LineChart
v-if="types == 2"
id="askLineChart"
:params="chartData"
:xAxis="xAxis"
:tooltipFormatter="true"
/>
|
22095aba
梁保满
接口联调
|
191
192
193
194
|
<RadarChart v-if="types == 3" id="askRadarChart" :params="chartData" />
</div>
</el-dialog>
</div>
|
d01c5799
梁保满
随堂问 报表开发
|
195
196
|
</template>
<script>
|
ce278878
梁保满
2-2 bugfix
|
197
198
|
import LineChart from "@/components/charts/lineChart";
import RadarChart from "@/components/charts/radarChart";
|
d01c5799
梁保满
随堂问 报表开发
|
199
|
export default {
|
22095aba
梁保满
接口联调
|
200
201
|
components: {
LineChart,
|
ce278878
梁保满
2-2 bugfix
|
202
|
RadarChart,
|
22095aba
梁保满
接口联调
|
203
|
},
|
d01c5799
梁保满
随堂问 报表开发
|
204
205
206
|
props: {
tableData: Array,
types: Number,
|
22095aba
梁保满
接口联调
|
207
|
subjectNames: Array,
|
d01c5799
梁保满
随堂问 报表开发
|
208
209
210
211
212
|
},
data() {
return {
optionsList: [],
phaseOption: [], //问答补充数据
|
22095aba
梁保满
接口联调
|
213
214
215
216
217
218
|
//折线图
chartDia: false,
chartTitle: "",
xAxis: [],
chartData: [],
|
d01c5799
梁保满
随堂问 报表开发
|
219
220
221
222
|
};
},
computed: {
resultData: function () {
|
ce278878
梁保满
2-2 bugfix
|
223
|
let resultData = [];
|
d01c5799
梁保满
随堂问 报表开发
|
224
225
226
|
if (this.tableData.length) {
let optionsList = [];
let subjectName = [];
|
ce278878
梁保满
2-2 bugfix
|
227
|
let rank = {};
|
d01c5799
梁保满
随堂问 报表开发
|
228
229
230
231
|
resultData = this.tableData.map((item) => {
let params = {};
if (this.types == 1) {
|
9865dde4
梁保满
数据同步
|
232
|
const detail = item.detail ? JSON.parse(item.detail) : [];
|
d01c5799
梁保满
随堂问 报表开发
|
233
234
235
236
237
238
239
240
241
|
if (detail.length > optionsList.length) {
optionsList = [...detail];
}
detail.map((items, index) => {
params["isRight" + index] = items.isRight;
params["answer" + index] =
items.answer == 1
? "✓"
: items.answer == 2
|
ce278878
梁保满
2-2 bugfix
|
242
243
|
? "✗"
: items.answer;
|
d01c5799
梁保满
随堂问 报表开发
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
});
} else if (this.types == 3) {
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;
});
}
if (this.types != 3) {
|
ce278878
梁保满
2-2 bugfix
|
260
261
262
263
264
265
266
|
let participationRateArr = [];
let correctRateArr = [];
this.tableData.map((item) => {
participationRateArr.push(item.participationRate);
correctRateArr.push(item.correctRate);
});
participationRateArr = [...new Set(participationRateArr)];
|
d01c5799
梁保满
随堂问 报表开发
|
267
|
participationRateArr = participationRateArr.sort((a, b) => {
|
ce278878
梁保满
2-2 bugfix
|
268
269
270
|
return b - a;
});
correctRateArr = [...new Set(correctRateArr)];
|
d01c5799
梁保满
随堂问 报表开发
|
271
|
correctRateArr = correctRateArr.sort((a, b) => {
|
ce278878
梁保满
2-2 bugfix
|
272
273
274
275
276
277
278
279
280
281
|
return b - a;
});
let participationRateRank = participationRateArr.findIndex(
(value) => {
return item.participationRate == value;
}
);
let correctRateRank = correctRateArr.findIndex((value) => {
return item.correctRate == value;
});
|
d01c5799
梁保满
随堂问 报表开发
|
282
283
|
rank = {
participationRateRank: participationRateRank + 1,
|
ce278878
梁保满
2-2 bugfix
|
284
285
|
correctRateRank: correctRateRank + 1,
};
|
d01c5799
梁保满
随堂问 报表开发
|
286
287
288
289
|
}
return {
...item,
...params,
|
ce278878
梁保满
2-2 bugfix
|
290
|
...rank,
|
d01c5799
梁保满
随堂问 报表开发
|
291
292
293
294
295
|
};
});
this.phaseOption = [...subjectName];
this.optionsList = [...optionsList];
} else {
|
ce278878
梁保满
2-2 bugfix
|
296
297
|
resultData = [];
this.optionsList = [];
|
d01c5799
梁保满
随堂问 报表开发
|
298
|
}
|
ce278878
梁保满
2-2 bugfix
|
299
300
|
return resultData;
},
|
d01c5799
梁保满
随堂问 报表开发
|
301
|
},
|
ce278878
梁保满
2-2 bugfix
|
302
|
created() {},
|
d01c5799
梁保满
随堂问 报表开发
|
303
304
|
methods: {
setDuration(times) {
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
if (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}秒`;
}
|
d01c5799
梁保满
随堂问 报表开发
|
320
|
}
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
321
|
return aTime;
|
d01c5799
梁保满
随堂问 报表开发
|
322
|
}
|
d01c5799
梁保满
随堂问 报表开发
|
323
|
},
|
22095aba
梁保满
接口联调
|
324
325
|
//查看折线图
openLineChart(obj) {
|
ce278878
梁保满
2-2 bugfix
|
326
327
328
329
330
331
332
333
334
335
336
337
|
this.chartTitle = `${obj.studentName}-${this.subjectNames[0]}-多课时作答表现图`;
this.chartDia = true;
let participationRate = [];
let correctRate = [];
let answerCorrectRate = [];
let dataList = obj.dataList;
this.xAxis = dataList.map((item) => {
participationRate.push(item.participationRate);
correctRate.push(item.correctRate);
answerCorrectRate.push(item.answerCorrectRate);
return item.name;
});
|
22095aba
梁保满
接口联调
|
338
339
340
|
this.chartData = [
{
name: "参与度",
|
ce278878
梁保满
2-2 bugfix
|
341
|
value: participationRate,
|
22095aba
梁保满
接口联调
|
342
343
344
|
},
{
name: "正确率",
|
ce278878
梁保满
2-2 bugfix
|
345
|
value: correctRate,
|
22095aba
梁保满
接口联调
|
346
347
348
|
},
{
name: "已答正确率",
|
ce278878
梁保满
2-2 bugfix
|
349
|
value: answerCorrectRate,
|
22095aba
梁保满
接口联调
|
350
|
},
|
ce278878
梁保满
2-2 bugfix
|
351
|
];
|
22095aba
梁保满
接口联调
|
352
353
|
},
openRandarChart(obj) {
|
5f80d60e
梁保满
备题试卷模版
|
354
355
356
|
this.chartData = {
indicator: [
{
|
ce278878
梁保满
2-2 bugfix
|
357
358
|
name: "",
max: 100,
|
5f80d60e
梁保满
备题试卷模版
|
359
360
361
|
axisLabel: {
show: true,
showMaxLabel: true,
|
ce278878
梁保满
2-2 bugfix
|
362
|
formatter: "{value}%",
|
5f80d60e
梁保满
备题试卷模版
|
363
364
365
|
},
},
],
|
ce278878
梁保满
2-2 bugfix
|
366
367
368
369
370
|
seriesData: [],
};
this.chartTitle = obj.studentName + "-多科-多课时作答表现图";
let dataList = obj.dataList.slice(1, obj.dataList.length);
let subjectList = dataList.map((item) => item.subjectName);
|
22095aba
梁保满
接口联调
|
371
372
|
subjectList.map((item, index) => {
if (index < 1) {
|
ce278878
梁保满
2-2 bugfix
|
373
|
this.chartData.indicator[index].name = item;
|
22095aba
梁保满
接口联调
|
374
|
} else {
|
ce278878
梁保满
2-2 bugfix
|
375
|
this.chartData.indicator.push({ name: item, max: 100 });
|
22095aba
梁保满
接口联调
|
376
|
}
|
ce278878
梁保满
2-2 bugfix
|
377
|
});
|
22095aba
梁保满
接口联调
|
378
379
|
// 为了美观
if (this.chartData.indicator.length < 3) {
|
ce278878
梁保满
2-2 bugfix
|
380
|
let num = this.chartData.indicator.length;
|
22095aba
梁保满
接口联调
|
381
382
|
for (let i = 0; i < 6; i++) {
if (i >= num) {
|
ce278878
梁保满
2-2 bugfix
|
383
|
this.chartData.indicator.push({ name: "", max: 100 });
|
22095aba
梁保满
接口联调
|
384
385
386
|
}
}
}
|
ce278878
梁保满
2-2 bugfix
|
387
388
|
let participationRate = dataList.map((item) => item.participationRate);
let correctRate = dataList.map((item) => item.correctRate);
|
22095aba
梁保满
接口联调
|
389
390
|
this.chartData.seriesData = [
{
|
5f80d60e
梁保满
备题试卷模版
|
391
|
value: participationRate,
|
ce278878
梁保满
2-2 bugfix
|
392
|
name: "参与度",
|
22095aba
梁保满
接口联调
|
393
394
|
},
{
|
5f80d60e
梁保满
备题试卷模版
|
395
|
value: correctRate,
|
ce278878
梁保满
2-2 bugfix
|
396
|
name: "正确率",
|
22095aba
梁保满
接口联调
|
397
|
},
|
ce278878
梁保满
2-2 bugfix
|
398
399
|
];
this.chartDia = true;
|
22095aba
梁保满
接口联调
|
400
|
},
|
ce278878
梁保满
2-2 bugfix
|
401
|
},
|
d01c5799
梁保满
随堂问 报表开发
|
402
403
|
};
</script>
|
22095aba
梁保满
接口联调
|
404
|
<style lang="scss">
|
d01c5799
梁保满
随堂问 报表开发
|
405
406
407
|
.red {
color: #f30;
}
|
22095aba
梁保满
接口联调
|
408
409
410
411
412
413
414
415
416
417
418
|
.chart-dia {
.chart-box {
width: 100%;
height: 300px;
}
:deep(.el-dialog__body) {
padding: 0 0 20px 0;
}
}
|
d01c5799
梁保满
随堂问 报表开发
|
419
|
</style>
|