d01c5799
梁保满
随堂问 报表开发
|
1
|
<template>
|
22095aba
梁保满
接口联调
|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<div>
<el-table :data="resultData" border style="width: 100%">
<el-table-column prop="studentCode" label="学号" align="center"></el-table-column>
<el-table-column prop="studentName" label="姓名" align="center"></el-table-column>
<template v-if="types == 1">
<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">
<span :class="scoped.row['isRight' + index] ? '' : 'red'">{{
scoped.row["answer" + index]
}}</span>
</template>
|
d01c5799
梁保满
随堂问 报表开发
|
24
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
</template>
<template v-if="types == 2">
<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>
<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>
<el-table-column label="查看折线图" align="center">
<template slot-scope="scoped">
<el-button @click="openLineChart(scoped.row)" type="primary" size="mini" circle
icon="el-icon-arrow-right"></el-button></template>
|
d01c5799
梁保满
随堂问 报表开发
|
42
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
</template>
<template v-if="types == 3">
<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">
</el-table-column>
<el-table-column align="center" :label="index == 0 ? '总出题数' : '出题数'" :prop="'questionNum' + item">
</el-table-column>
<el-table-column align="center" :label="index == 0 ? '总参与度' : '参与度'"
:prop="'participationRate' + item"><template slot-scope="scoped">{{ scoped.row["participationRate" + item]
}}%</template>
</el-table-column>
<el-table-column align="center" :label="index == 0 ? '总正确率' : '正确率'" :prop="'correctRate' + item"><template
slot-scope="scoped">{{ scoped.row["correctRate" + item] }}%</template>
</el-table-column>
|
d01c5799
梁保满
随堂问 报表开发
|
57
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
58
59
60
61
|
<el-table-column label="查看雷达图" align="center">
<template slot-scope="scoped">
<el-button @click="openRandarChart(scoped.row)" type="primary" size="mini" circle
icon="el-icon-arrow-right"></el-button></template>
|
d01c5799
梁保满
随堂问 报表开发
|
62
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
63
64
65
66
67
68
69
70
71
|
</template>
</el-table>
<el-dialog class="chart-dia" :visible.sync="chartDia" :title="chartTitle" width="800">
<div class="chart-box">
<LineChart v-if="types == 2" id="askLineChart" :params="chartData" :xAxis="xAxis" />
<RadarChart v-if="types == 3" id="askRadarChart" :params="chartData" />
</div>
</el-dialog>
</div>
|
d01c5799
梁保满
随堂问 报表开发
|
72
73
|
</template>
<script>
|
22095aba
梁保满
接口联调
|
74
75
|
import LineChart from "@/components/charts/lineChart"
import RadarChart from "@/components/charts/radarChart"
|
d01c5799
梁保满
随堂问 报表开发
|
76
|
export default {
|
22095aba
梁保满
接口联调
|
77
78
79
80
|
components: {
LineChart,
RadarChart
},
|
d01c5799
梁保满
随堂问 报表开发
|
81
82
83
|
props: {
tableData: Array,
types: Number,
|
22095aba
梁保满
接口联调
|
84
|
subjectNames: Array,
|
d01c5799
梁保满
随堂问 报表开发
|
85
86
87
88
89
|
},
data() {
return {
optionsList: [],
phaseOption: [], //问答补充数据
|
22095aba
梁保满
接口联调
|
90
91
92
93
94
95
|
//折线图
chartDia: false,
chartTitle: "",
xAxis: [],
chartData: [],
|
d01c5799
梁保满
随堂问 报表开发
|
96
97
98
99
100
101
102
103
104
105
106
107
108
|
};
},
computed: {
resultData: function () {
let resultData = []
if (this.tableData.length) {
let optionsList = [];
let subjectName = [];
let rank = {}
resultData = this.tableData.map((item) => {
let params = {};
if (this.types == 1) {
|
9865dde4
梁保满
数据同步
|
109
|
const detail = item.detail ? JSON.parse(item.detail) : [];
|
d01c5799
梁保满
随堂问 报表开发
|
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
|
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
? "✗"
: items.answer;
});
} 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) {
let participationRateArr = []
let correctRateArr = []
this.tableData.map(item => {
participationRateArr.push(item.participationRate)
correctRateArr.push(item.correctRate)
})
participationRateArr = [...new Set(participationRateArr)]
participationRateArr = participationRateArr.sort((a, b) => {
return b - a
})
correctRateArr = [...new Set(correctRateArr)]
correctRateArr = correctRateArr.sort((a, b) => {
return b - a
})
let participationRateRank = participationRateArr.findIndex(value => {
return item.participationRate == value
})
let correctRateRank = correctRateArr.findIndex(value => {
return item.correctRate == value
})
rank = {
participationRateRank: participationRateRank + 1,
correctRateRank: correctRateRank + 1
}
}
return {
...item,
...params,
...rank
};
});
this.phaseOption = [...subjectName];
this.optionsList = [...optionsList];
} else {
resultData = []
this.optionsList = []
}
return resultData
}
},
|
5f80d60e
梁保满
备题试卷模版
|
177
|
created() { },
|
d01c5799
梁保满
随堂问 报表开发
|
178
179
|
methods: {
setDuration(times) {
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
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
梁保满
随堂问 报表开发
|
195
|
}
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
196
|
return aTime;
|
d01c5799
梁保满
随堂问 报表开发
|
197
|
}
|
d01c5799
梁保满
随堂问 报表开发
|
198
|
},
|
22095aba
梁保满
接口联调
|
199
200
201
202
203
204
205
|
//查看折线图
openLineChart(obj) {
this.chartTitle = `${obj.studentName}-${this.subjectNames[0]}-多课时作答表现图`
this.chartDia = true
let participationRate = []
let correctRate = []
let answerCorrectRate = []
|
5f80d60e
梁保满
备题试卷模版
|
206
207
|
let dataList = obj.dataList
this.xAxis = dataList.map(item => {
|
22095aba
梁保满
接口联调
|
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
participationRate.push(item.participationRate)
correctRate.push(item.correctRate)
answerCorrectRate.push(item.answerCorrectRate)
return item.name
})
this.chartData = [
{
name: "参与度",
value: participationRate
},
{
name: "正确率",
value: correctRate
},
{
name: "已答正确率",
value: answerCorrectRate
},
]
},
openRandarChart(obj) {
|
5f80d60e
梁保满
备题试卷模版
|
230
231
232
233
234
235
236
237
238
239
240
241
242
|
this.chartData = {
indicator: [
{
name: '', max: 100,
axisLabel: {
show: true,
showMaxLabel: true,
formatter: '{value}%'
},
},
],
seriesData: []
}
|
22095aba
梁保满
接口联调
|
243
|
this.chartTitle = obj.studentName + '-多科-多课时作答表现图'
|
5f80d60e
梁保满
备题试卷模版
|
244
245
|
let dataList = obj.dataList.slice(1, obj.dataList.length)
let subjectList = dataList.map(item => item.subjectName)
|
22095aba
梁保满
接口联调
|
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
subjectList.map((item, index) => {
if (index < 1) {
this.chartData.indicator[index].name = item
} else {
this.chartData.indicator.push({ name: item, max: 100 })
}
})
// 为了美观
if (this.chartData.indicator.length < 3) {
let num = this.chartData.indicator.length
for (let i = 0; i < 6; i++) {
if (i >= num) {
this.chartData.indicator.push({ name: "", max: 100 })
}
}
}
|
5f80d60e
梁保满
备题试卷模版
|
262
263
|
let participationRate = dataList.map(item => item.participationRate)
let correctRate = dataList.map(item => item.correctRate)
|
22095aba
梁保满
接口联调
|
264
265
|
this.chartData.seriesData = [
{
|
5f80d60e
梁保满
备题试卷模版
|
266
|
value: participationRate,
|
22095aba
梁保满
接口联调
|
267
268
269
|
name: '参与度'
},
{
|
5f80d60e
梁保满
备题试卷模版
|
270
|
value: correctRate,
|
22095aba
梁保满
接口联调
|
271
272
273
274
275
276
277
|
name: '正确率'
},
]
this.chartDia = true
},
|
d01c5799
梁保满
随堂问 报表开发
|
278
279
280
|
}
};
</script>
|
22095aba
梁保满
接口联调
|
281
|
<style lang="scss">
|
d01c5799
梁保满
随堂问 报表开发
|
282
283
284
|
.red {
color: #f30;
}
|
22095aba
梁保满
接口联调
|
285
286
287
288
289
290
291
292
293
294
295
|
.chart-dia {
.chart-box {
width: 100%;
height: 300px;
}
:deep(.el-dialog__body) {
padding: 0 0 20px 0;
}
}
|
d01c5799
梁保满
随堂问 报表开发
|
296
|
</style>
|