86201e49
梁保满
即时测模块
|
1
2
3
4
|
<template>
<div class="table-box" ref="main" v-loading="loading">
<div id="print-content">
<!-- 多科多卷 -->
|
696f2d42
梁保满
fix:报表导出问题
|
5
6
7
8
9
10
11
12
13
14
15
16
|
<el-table
:data="tableData"
:max-height="tableMaxHeight"
border
style="width: 100%"
>
<el-table-column
prop="studentCode"
label="学号"
align="center"
fixed
></el-table-column>
|
86201e49
梁保满
即时测模块
|
17
18
|
<el-table-column prop="studentName" label="姓名" fixed align="center">
|
696f2d42
梁保满
fix:报表导出问题
|
19
20
|
<template slot-scope="scoped"
><span class="click-b" @click="toPortrait(scoped.row)">
|
86201e49
梁保满
即时测模块
|
21
|
{{ scoped.row.studentName }}
|
696f2d42
梁保满
fix:报表导出问题
|
22
23
|
</span></template
>
|
86201e49
梁保满
即时测模块
|
24
|
</el-table-column>
|
696f2d42
梁保满
fix:报表导出问题
|
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
|
<el-table-column
align="center"
v-for="(item, index) in answerList"
:key="index"
:label="item"
>
<el-table-column
:prop="'examCount' + item"
label="测练数"
align="center"
:class-name="index % 2 == 0 ? 'bg' : ''"
></el-table-column>
<el-table-column
:prop="'participationCount' + item"
label="参与数"
align="center"
:class-name="index % 2 == 0 ? 'bg' : ''"
></el-table-column>
<el-table-column
:prop="'score' + item"
label="总分"
align="center"
:class-name="index % 2 == 0 ? 'bg' : ''"
></el-table-column>
<el-table-column
:prop="'classRank' + item"
label="班名"
align="center"
:class-name="index % 2 == 0 ? 'bg' : ''"
></el-table-column>
|
86201e49
梁保满
即时测模块
|
55
|
</el-table-column>
|
22095aba
梁保满
接口联调
|
56
|
<el-table-column label="查看雷达图" align="center">
|
86201e49
梁保满
即时测模块
|
57
|
<template slot-scope="scoped">
|
696f2d42
梁保满
fix:报表导出问题
|
58
59
60
61
62
63
64
|
<el-button
@click="openChart(scoped.row)"
type="primary"
size="mini"
circle
icon="el-icon-arrow-right"
></el-button>
|
86201e49
梁保满
即时测模块
|
65
66
67
68
69
|
</template>
</el-table-column>
</el-table>
</div>
<div class="down">
|
696f2d42
梁保满
fix:报表导出问题
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
<el-button
@click="openDown"
type="primary"
plain
round
icon="fa fa-cloud-download"
>导出报表</el-button
>
<el-button
v-if="!this.$store.getters.code"
@click="print"
type="primary"
plain
round
icon="el-icon-printer"
>打印</el-button
>
|
86201e49
梁保满
即时测模块
|
87
|
</div>
|
696f2d42
梁保满
fix:报表导出问题
|
88
89
90
91
92
93
|
<el-dialog
class="chart-dia"
:visible.sync="chartDia"
:title="chartTitle"
width="800"
>
|
86201e49
梁保满
即时测模块
|
94
95
96
97
|
<div class="chart-box">
<RadarChart id="radarChart" :params="chartData" />
</div>
</el-dialog>
|
696f2d42
梁保满
fix:报表导出问题
|
98
99
100
101
102
103
104
105
|
<ExportDia
:exportStudent="exportStudent"
:diaShow="diaShow"
@cancel="cancel"
@exportData="exportData"
lastLabel="总分"
type="雷达图"
/>
|
86201e49
梁保满
即时测模块
|
106
107
108
|
</div>
</template>
<script>
|
696f2d42
梁保满
fix:报表导出问题
|
109
|
import RadarChart from "@/components/charts/radarChart";
|
86201e49
梁保满
即时测模块
|
110
111
112
113
|
import { downloadFile, tablePrint } from "@/utils";
export default {
components: {
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
114
|
RadarChart,
|
86201e49
梁保满
即时测模块
|
115
116
117
118
|
},
props: {
role: "",
ids: Array,
|
7222c2eb
梁保满
汇总前置条件修改,教学,行政可汇总
|
119
|
classIds: Array,
|
7812e986
梁保满
班主任查看报表添加额外信息
|
120
|
subjectName: String,
|
86201e49
梁保满
即时测模块
|
121
122
123
124
125
126
127
128
129
130
131
|
},
data() {
return {
tableMaxHeight: null,
answerList: [], //设置多卷内容供tableStage表格数据用
tableData: [],
loading: false,
exportLoading: false,
chartData: {
indicator: [
{
|
696f2d42
梁保满
fix:报表导出问题
|
132
133
|
name: "",
max: 100,
|
86201e49
梁保满
即时测模块
|
134
135
136
|
axisLabel: {
show: true,
showMaxLabel: true,
|
86201e49
梁保满
即时测模块
|
137
138
139
|
},
},
],
|
696f2d42
梁保满
fix:报表导出问题
|
140
|
seriesData: [],
|
86201e49
梁保满
即时测模块
|
141
142
143
|
},
chartDia: false,
chartTitle: "",
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
144
145
146
|
//导出相关
diaShow: false,
|
696f2d42
梁保满
fix:报表导出问题
|
147
148
|
exportStudent: [],
};
|
86201e49
梁保满
即时测模块
|
149
150
151
|
},
computed: {
subjectList: function () {
|
696f2d42
梁保满
fix:报表导出问题
|
152
153
|
return this.subjectName?.split(",");
},
|
86201e49
梁保满
即时测模块
|
154
155
|
},
created() {
|
696f2d42
梁保满
fix:报表导出问题
|
156
|
this.phaseExamReport();
|
86201e49
梁保满
即时测模块
|
157
158
159
160
161
162
|
},
mounted() {
this.tableMaxHeight = this.$refs.main.offsetHeight;
},
methods: {
print() {
|
696f2d42
梁保满
fix:报表导出问题
|
163
|
tablePrint("print-content", this.subjectName + "汇总报表");
|
86201e49
梁保满
即时测模块
|
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
|
},
toPortrait(obj) {
//暂时不上线
return;
if (this.$store.getters.code) {
return;
}
let subjectNames = [];
subjectNames =
this.role == "ROLE_BANZHUREN"
? [...this.query["subjectNames"]]
: [this.query["subjectNames"]];
if (
this.query["subjectNames"] &&
this.query["subjectNames"]?.length == 1 &&
this.query["subjectNames"][0] == "全部"
) {
subjectNames = this.subjectList.map((item) => {
return item.value;
});
subjectNames?.shift();
}
//去学生画像
this.$router.push({
path: "/portraitDetail",
query: {
id: obj.studentId,
classId: this.query.classId,
subjectNames: subjectNames.join(","),
studentName: obj.studentName,
studentCode: obj.studentCode,
startDay: this.query.startDay,
endDay: this.query.endDay,
date: this.date,
},
});
},
|
22095aba
梁保满
接口联调
|
201
|
//查看雷达图
|
86201e49
梁保满
即时测模块
|
202
|
openChart(obj) {
|
696f2d42
梁保满
fix:报表导出问题
|
203
|
this.chartTitle = obj.studentName + "-多科-多课时作答表现图";
|
7812e986
梁保满
班主任查看报表添加额外信息
|
204
|
let max = 0;
|
696f2d42
梁保满
fix:报表导出问题
|
205
206
207
208
209
210
211
212
|
const dataList = obj.dataList.slice(1, obj.dataList.length);
let subjectList = dataList.map((item) => {
let score = Number(item.highestScore || item.score);
max = score > max ? score : max;
return item.subjectName;
});
max += 10;
max = max > 150 ? 150 : max;
|
7812e986
梁保满
班主任查看报表添加额外信息
|
213
214
215
|
this.chartData = {
indicator: [
{
|
696f2d42
梁保满
fix:报表导出问题
|
216
217
|
name: "",
max: max,
|
7812e986
梁保满
班主任查看报表添加额外信息
|
218
219
220
221
222
223
|
axisLabel: {
show: true,
showMaxLabel: true,
},
},
],
|
696f2d42
梁保满
fix:报表导出问题
|
224
225
|
seriesData: [],
};
|
86201e49
梁保满
即时测模块
|
226
227
|
subjectList.map((item, index) => {
if (index < 1) {
|
696f2d42
梁保满
fix:报表导出问题
|
228
229
|
this.chartData.indicator[index].name = item;
this.chartData.indicator[index].max = max;
|
86201e49
梁保满
即时测模块
|
230
|
} else {
|
696f2d42
梁保满
fix:报表导出问题
|
231
|
this.chartData.indicator.push({ name: item, max: max });
|
86201e49
梁保满
即时测模块
|
232
|
}
|
696f2d42
梁保满
fix:报表导出问题
|
233
|
});
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
234
|
// 为了美观
|
86201e49
梁保满
即时测模块
|
235
|
if (this.chartData.indicator.length < 3) {
|
696f2d42
梁保满
fix:报表导出问题
|
236
|
let num = this.chartData.indicator.length;
|
86201e49
梁保满
即时测模块
|
237
238
|
for (let i = 0; i < 6; i++) {
if (i >= num) {
|
696f2d42
梁保满
fix:报表导出问题
|
239
|
this.chartData.indicator.push({ name: "", max: max });
|
86201e49
梁保满
即时测模块
|
240
241
242
243
244
|
}
}
}
this.chartData.seriesData = [
{
|
696f2d42
梁保满
fix:报表导出问题
|
245
246
|
value: dataList.map((item) => item.highestScore),
name: "班级最高分",
|
86201e49
梁保满
即时测模块
|
247
248
|
},
{
|
696f2d42
梁保满
fix:报表导出问题
|
249
250
|
value: dataList.map((item) => item.avgScore),
name: "班平均分",
|
22095aba
梁保满
接口联调
|
251
252
|
},
{
|
696f2d42
梁保满
fix:报表导出问题
|
253
254
|
value: dataList.map((item) => item.score),
name: "本人得分",
|
86201e49
梁保满
即时测模块
|
255
|
},
|
696f2d42
梁保满
fix:报表导出问题
|
256
257
|
];
this.chartDia = true;
|
86201e49
梁保满
即时测模块
|
258
259
260
261
|
},
async phaseExamReport() {
this.loading = true;
const { data, status, info } = await this.$request.cTPhaseExamReport({
|
7222c2eb
梁保满
汇总前置条件修改,教学,行政可汇总
|
262
|
classIds: this.classIds,
|
86201e49
梁保满
即时测模块
|
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
|
examIds: this.ids,
subjectNames: this.subjectList,
});
this.loading = false;
if (status === 0) {
this.total = data.count;
let subjectName = [];
this.tableData = data?.list.map((item) => {
let params = {};
item.dataList.map((items, index) => {
if (!subjectName.includes(items.subjectName)) {
subjectName.push(items.subjectName);
}
params["examCount" + items.subjectName] = items.examCount;
params["participationCount" + items.subjectName] =
items.participationCount;
params["score" + items.subjectName] = items.score;
params["classRank" + items.subjectName] = items.classRank;
});
return {
...item,
...params,
};
});
this.answerList = [...subjectName];
|
696f2d42
梁保满
fix:报表导出问题
|
288
|
this.exportStudent = [...this.tableData];
|
86201e49
梁保满
即时测模块
|
289
290
291
292
293
|
} else {
this.$message.error(info);
}
},
//导出
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
294
295
296
297
298
299
300
|
openDown() {
this.diaShow = true;
},
cancel() {
this.diaShow = false;
},
async exportData(arr) {
|
86201e49
梁保满
即时测模块
|
301
302
|
if (this.exportLoading == true) return;
this.exportLoading = true;
|
696f2d42
梁保满
fix:报表导出问题
|
303
|
let studentIds = arr;
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
304
|
let query = {};
|
696f2d42
梁保满
fix:报表导出问题
|
305
|
if (studentIds != null) {
|
ce278878
梁保满
2-2 bugfix
|
306
|
if (studentIds.length > 0) {
|
696f2d42
梁保满
fix:报表导出问题
|
307
|
query.studentIds = studentIds;
|
ce278878
梁保满
2-2 bugfix
|
308
|
} else {
|
696f2d42
梁保满
fix:报表导出问题
|
309
|
query.studentIds = [];
|
ce278878
梁保满
2-2 bugfix
|
310
|
}
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
311
|
}
|
f9916d4c
梁保满
导出摸板
|
312
|
|
f9916d4c
梁保满
导出摸板
|
313
|
const data = await this.$request.cTExportPhaseExamReport({
|
7222c2eb
梁保满
汇总前置条件修改,教学,行政可汇总
|
314
|
classIds: this.classIds,
|
049db2b2
梁保满
接口联调
|
315
|
examIds: this.ids,
|
696f2d42
梁保满
fix:报表导出问题
|
316
|
...query,
|
86201e49
梁保满
即时测模块
|
317
318
319
320
321
322
323
324
|
});
this.exportLoading = false;
if (data) {
let blob = new Blob([data], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
});
downloadFile(
this.status
|
f9916d4c
梁保满
导出摸板
|
325
326
|
? "即时测-已归档多科汇总报表.xlsx"
: "即时测-多科汇总报表.xlsx",
|
86201e49
梁保满
即时测模块
|
327
328
|
blob
);
|
f9916d4c
梁保满
导出摸板
|
329
|
this.$message.success("下载成功");
|
696f2d42
梁保满
fix:报表导出问题
|
330
|
this.cancel();
|
86201e49
梁保满
即时测模块
|
331
332
333
334
|
} else {
this.$message.error("下载失败");
}
},
|
696f2d42
梁保满
fix:报表导出问题
|
335
|
},
|
86201e49
梁保满
即时测模块
|
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
|
};
</script>
<style lang="scss" scoped>
.table-box {
padding: 20px;
}
.down {
padding-top: 20px;
width: 100%;
display: flex;
justify-content: space-between;
}
.chart-dia {
.chart-box {
width: 100%;
height: 400px;
}
:deep(.el-dialog__body) {
padding: 0 0 20px 0;
}
}
</style>
|