86201e49
梁保满
即时测模块
|
1
2
3
|
<template>
<div class="table-box" ref="main" v-loading="loading">
<div id="print-content">
|
b0cd2598
梁保满
fix:测试问题
|
4
5
6
7
8
9
10
11
12
13
14
15
|
<el-table
:max-height="tableMaxHeight"
:data="tableData"
border
style="width: 100%"
>
<el-table-column
prop="studentCode"
label="学号"
align="center"
fixed
></el-table-column>
|
86201e49
梁保满
即时测模块
|
16
|
<el-table-column prop="studentName" label="姓名" fixed align="center">
|
b0cd2598
梁保满
fix:测试问题
|
17
18
|
<template slot-scope="scoped"
><span class="click-b" @click="toPortrait(scoped.row)">
|
86201e49
梁保满
即时测模块
|
19
|
{{ scoped.row.studentName }}
|
b0cd2598
梁保满
fix:测试问题
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
</span></template
></el-table-column
>
<el-table-column
align="center"
v-for="(item, index) in answerList"
:key="index"
:label="item.title"
>
<el-table-column
:prop="'score' + index"
:label="index == 0 ? '总分' : '成绩'"
align="center"
:class-name="index % 2 == 0 ? 'bg' : ''"
></el-table-column>
<el-table-column
:prop="'classRank' + index"
label="班名"
align="center"
sortable
:class-name="index % 2 == 0 ? 'bg' : ''"
></el-table-column>
|
86201e49
梁保满
即时测模块
|
42
43
44
|
</el-table-column>
<el-table-column label="查看折线图" align="center">
<template slot-scope="scoped">
|
b0cd2598
梁保满
fix:测试问题
|
45
46
47
48
49
50
51
|
<el-button
@click="openChart(scoped.row)"
type="primary"
size="mini"
circle
icon="el-icon-arrow-right"
></el-button>
|
86201e49
梁保满
即时测模块
|
52
53
54
55
56
|
</template>
</el-table-column>
</el-table>
</div>
<div class="down">
|
b0cd2598
梁保满
fix:测试问题
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<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
梁保满
即时测模块
|
74
|
</div>
|
b0cd2598
梁保满
fix:测试问题
|
75
76
77
78
79
80
|
<el-dialog
class="chart-dia"
:visible.sync="chartDia"
:title="chartTitle"
width="800"
>
|
86201e49
梁保满
即时测模块
|
81
|
<div class="chart-box">
|
b0cd2598
梁保满
fix:测试问题
|
82
83
84
85
86
87
|
<LineChart
id="lineChart"
:params="chartData"
:xAxis="xAxis"
:formatterYAxis="false"
/>
|
86201e49
梁保满
即时测模块
|
88
89
|
</div>
</el-dialog>
|
b0cd2598
梁保满
fix:测试问题
|
90
91
92
93
94
95
96
|
<ExportDia
:exportStudent="exportStudent"
:diaShow="diaShow"
@cancel="cancel"
@exportData="exportData"
lastLabel="总分"
/>
|
86201e49
梁保满
即时测模块
|
97
98
99
100
|
</div>
<!-- 单科多卷 -->
</template>
<script>
|
b0cd2598
梁保满
fix:测试问题
|
101
|
import LineChart from "@/components/charts/lineChart";
|
86201e49
梁保满
即时测模块
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
import { downloadFile, tablePrint } from "@/utils";
export default {
components: { LineChart },
props: {
role: "",
ids: Array,
classId: String,
subjectName: String,
},
data() {
return {
tableMaxHeight: null,
answerList: [], //设置多卷内容供tableStage表格数据用
tableData: [],
loading: false,
exportLoading: false,
chartDia: false,
studentName: "",
xAxis: [],
chartData: [],
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
122
123
124
|
//导出相关
diaShow: false,
|
b0cd2598
梁保满
fix:测试问题
|
125
126
|
exportStudent: [],
};
|
86201e49
梁保满
即时测模块
|
127
128
129
|
},
computed: {
chartTitle: function () {
|
b0cd2598
梁保满
fix:测试问题
|
130
131
|
return `${this.studentName}-${this.subjectName}-多课时作答表现图`;
},
|
86201e49
梁保满
即时测模块
|
132
133
|
},
created() {
|
b0cd2598
梁保满
fix:测试问题
|
134
|
this.phaseExamReport();
|
86201e49
梁保满
即时测模块
|
135
136
137
138
139
140
|
},
mounted() {
this.tableMaxHeight = this.$refs.main.offsetHeight;
},
methods: {
print() {
|
b0cd2598
梁保满
fix:测试问题
|
141
|
tablePrint("print-content", this.subjectName + "汇总报表");
|
86201e49
梁保满
即时测模块
|
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
|
},
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,
},
});
},
//查看折线图
openChart(obj) {
|
b0cd2598
梁保满
fix:测试问题
|
181
182
183
184
185
186
187
188
189
190
191
192
|
this.studentName = obj.studentName;
this.chartDia = true;
let score = [];
let classRank = [];
let avgScore = [];
const examList = obj.examList.slice(1, obj.examList.length);
this.xAxis = examList.map((item) => {
score.push(item.score);
classRank.push(item.classRank);
avgScore.push(item.avgScore);
return item.title;
});
|
86201e49
梁保满
即时测模块
|
193
194
|
this.chartData = [
{
|
22095aba
梁保满
接口联调
|
195
|
name: "班级排名",
|
b0cd2598
梁保满
fix:测试问题
|
196
|
value: classRank,
|
86201e49
梁保满
即时测模块
|
197
198
|
},
{
|
22095aba
梁保满
接口联调
|
199
|
name: "班平均分",
|
b0cd2598
梁保满
fix:测试问题
|
200
|
value: avgScore,
|
86201e49
梁保满
即时测模块
|
201
202
|
},
{
|
22095aba
梁保满
接口联调
|
203
|
name: "个人成绩",
|
b0cd2598
梁保满
fix:测试问题
|
204
|
value: score,
|
86201e49
梁保满
即时测模块
|
205
|
},
|
b0cd2598
梁保满
fix:测试问题
|
206
|
];
|
86201e49
梁保满
即时测模块
|
207
208
209
210
211
212
213
214
215
216
|
},
async phaseExamReport() {
this.loading = true;
const phaseExamReport =
this.role == "ROLE_PERSONAL"
? this.$request.pPhaseExamReport
: this.$request.phaseExamReport;
const { data, status, info } = await phaseExamReport({
classId: this.classId,
examIds: this.ids,
|
b0cd2598
梁保满
fix:测试问题
|
217
|
subjectName: this.subjectName,
|
86201e49
梁保满
即时测模块
|
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
});
this.loading = false;
if (status === 0) {
this.total = data.count;
let dataIdsList = [],
dataList = [];
data?.list.map((item) => {
item.examList.map((items) => {
if (!dataIdsList.includes(items.title)) {
dataIdsList.push(items.title);
dataList.push(items);
}
});
});
this.tableData = data?.list.map((item) => {
let params = {};
dataIdsList.map((ids, index) => {
params["score" + index] = "--";
params["classRank" + index] = "--";
item.examList.map((items) => {
if (items.title == ids) {
|
384a2a54
梁保满
请求头添加班主任信息,bug修改
|
239
|
params["score" + index] = Number(items.score);
|
86201e49
梁保满
即时测模块
|
240
241
242
243
244
245
246
247
248
249
|
params["classRank" + index] = items.classRank;
}
});
});
return {
...item,
...params,
};
});
this.answerList = dataList;
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
250
|
|
b0cd2598
梁保满
fix:测试问题
|
251
|
this.exportStudent = [...this.tableData];
|
86201e49
梁保满
即时测模块
|
252
253
254
255
256
|
} else {
this.$message.error(info);
}
},
//导出
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
257
258
259
260
261
262
263
|
openDown() {
this.diaShow = true;
},
cancel() {
this.diaShow = false;
},
async exportData(arr) {
|
86201e49
梁保满
即时测模块
|
264
265
|
if (this.exportLoading == true) return;
this.exportLoading = true;
|
b0cd2598
梁保满
fix:测试问题
|
266
|
let studentIds = arr;
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
267
|
let query = {};
|
b0cd2598
梁保满
fix:测试问题
|
268
|
if (studentIds != null) {
|
ce278878
梁保满
2-2 bugfix
|
269
|
if (studentIds.length > 0) {
|
b0cd2598
梁保满
fix:测试问题
|
270
|
query.studentIds = studentIds;
|
ce278878
梁保满
2-2 bugfix
|
271
|
} else {
|
b0cd2598
梁保满
fix:测试问题
|
272
|
query.studentIds = [];
|
ce278878
梁保满
2-2 bugfix
|
273
|
}
|
e17ec739
梁保满
随堂问,即时测导出爆表修改
|
274
|
}
|
b0cd2598
梁保满
fix:测试问题
|
275
276
277
278
|
const exportPhaseExamReport =
this.role == "ROLE_PERSONAL"
? this.$request.pExportPhaseExamReport
: this.$request.exportPhaseExamReport;
|
86201e49
梁保满
即时测模块
|
279
|
const data = await exportPhaseExamReport({
|
049db2b2
梁保满
接口联调
|
280
281
|
classId: this.classId,
examIds: this.ids,
|
b0cd2598
梁保满
fix:测试问题
|
282
|
...query,
|
86201e49
梁保满
即时测模块
|
283
284
285
286
287
288
289
|
});
this.exportLoading = false;
if (data) {
let blob = new Blob([data], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
});
downloadFile("即时测-单科多卷报表.xlsx", blob);
|
f9916d4c
梁保满
导出摸板
|
290
|
this.$message.success("下载成功");
|
b0cd2598
梁保满
fix:测试问题
|
291
|
this.cancel();
|
86201e49
梁保满
即时测模块
|
292
293
294
295
|
} else {
this.$message.error("下载失败");
}
},
|
b0cd2598
梁保满
fix:测试问题
|
296
|
},
|
86201e49
梁保满
即时测模块
|
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
};
</script>
<style lang="scss" scoped>
.table-box {
padding: 20px;
}
.down {
padding-top: 20px;
width: 100%;
display: flex;
justify-content: space-between;
}
|
86201e49
梁保满
即时测模块
|
311
312
313
314
315
316
317
318
319
320
321
|
.chart-dia {
.chart-box {
width: 100%;
height: 300px;
}
:deep(.el-dialog__body) {
padding: 0 0 20px 0;
}
}
</style>
|