d01c5799
梁保满
随堂问 报表开发
|
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
|
<el-table :data="tableData" border :show-header="total > 0" style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column prop="subject" label="科目" align="center" width="80"></el-table-column>
<el-table-column prop="title" 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="answerCorrectRate" label="已答总正确率" align="center"><template slot-scope="scoped">{{
scoped.row.answerCorrectRate }}%</template>
</el-table-column>
<el-table-column prop="classCorrectRate" label="班级总正确率" align="center"><template slot-scope="scoped">{{
scoped.row.classCorrectRate }}%</template></el-table-column>
<el-table-column prop="questionNum" label="题目总数" align="center"></el-table-column>
<el-table-column prop="startTime" label="上课时间" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scoped">
<template v-if="scoped.row.answerNum == 0">
<el-tooltip v-if="role == 'ROLE_JIAOSHI'" effect="dark" content="设置答案" placement="top">
<el-button type="primary" circle size="mini" icon="fa fa-file-text"
@click="edit(scoped.row)"></el-button>
</el-tooltip>
<template v-else>未设置答案</template>
</template>
<el-tooltip v-else effect="dark" content="详情" placement="top">
<el-button type="primary" circle size="mini" icon="fa fa-arrow-right"
@click="linkToDetail(scoped.row, 1)"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="删除" placement="top">
<el-button type="primary" circle size="mini" icon="el-icon-delete"
@click="remove(scoped.row)"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-box">
<el-pagination small="" layout="total,prev, pager, next" :hide-on-single-page="true" :total="total"
@current-change="changePage" :current-page="page" :page-size="size">
</el-pagination>
</div>
</div>
</div>
<router-view v-show="isDetail"></router-view>
</div>
</template>
<script>
import { downloadFile } from "utils";
export default {
data() {
return {
gdClass: 0, //已归档班级数量
code: "",
role: "",
loading: false,
query: {
//搜索条件
classId: "",
subjectNames: [],
startDay: "",
endDay: "",
},
tableData: [],
multipleSelection: [],
page: 1,
size: 20,
total: 0,
};
},
computed: {
isDetail: function () {
let bol = (this.$route.name == "随堂问报表分析") ? true : false
return bol
}
},
async created() {
this.code = localStorage.getItem("csCode") || "";
const queryData = this.$route.query.params
queryData ? this.query = { ...this.query, ...JSON.parse(queryData) } : ''
this.init()
},
watch: {
"$route.query.params": function (nVal) {
let isFromAskDetail = sessionStorage.getItem("isFromAskDetail");
if (!isFromAskDetail && nVal) {
this.init()
}
}
},
methods: {
//初始化
init() {
this.role =
this.$store.getters.info.showRole ||
this.$store.getters.info.permissions[0].role;
if (this.role != "ROLE_PERSONAL") {
this._QueryGdClass()
};
this.page = 1
this.total = 0
this.tableData = []
this._QueryData()
},
//归档
toArchiving() {
this.$router.push({
path: "/askArchiving",
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
//去详情
linkToDetail(obj, types) {
this.$router.push({
path: "/askAnalysis",
query: {
id: JSON.stringify([obj.id]),
types: types,
|
d01c5799
梁保满
随堂问 报表开发
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
},
});
},
//去详情
linkToDetail2() {
let subjectArr = []
const ids = this.multipleSelection.map(item => {
subjectArr.push(item.subject)
return item.id
})
subjectArr = [...new Set(subjectArr)]
this.$router.push({
path: "/askAnalysis",
query: {
id: JSON.stringify(ids),
|
d01c5799
梁保满
随堂问 报表开发
|
157
158
159
160
161
162
163
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
},
});
},
//删除
remove(obj) {
const { data, status, info } = this.$request.deletePaperReport({
id: obj.id,
});
if (status === 0) {
this.$message.success(info);
this._QueryData();
} else {
this.$message.error(info);
}
},
//修改答案
async edit(item) {
this.$router.push({
path: "/examinationPaperEdit",
query: {
paperId: item.id,
title: item.title,
type: 3,
},
});
},
changePage(page) {
this.page = page;
this._QueryData();
},
async _QueryGdClass() {
const fetchClassList =
this.role == "ROLE_BANZHUREN"
? this.$request.cTClassList
: this.$request.tClassList;
const { data, status, info } = await fetchClassList({
status: 1,
});
if (status === 0) {
this.gdClass = data?.list?.length || 0;
} else {
this.$message.error(info);
}
},
//分页查询课时报表列表
async _QueryData() {
this.loading = true;
let query = {};
for (let key in this.query) {
if (this.query[key] != "" || this.query[key].length != 0) {
query[key] = this.query[key];
}
}
const periodReportList = this.role == "ROLE_PERSONAL" ?
this.$request.pPhaseInteractiveReport :
this.$request.periodReportList;
const { data, status, info } = await periodReportList({
...query,
page: this.page,
size: this.size,
});
this.loading = false;
if (status === 0) {
this.tableData = (data?.list && [...data?.list]) || [];
this.total = data?.count || 0;
} else {
this.$message.error(info);
}
},
//导出
async exportData() {
if (this.exportLoading == true) return;
let query = {};
for (let key in this.query) {
if (this.query[key] != "" || this.query[key].length != 0) {
query[key] = this.query[key];
}
}
this.exportLoading = true;
let exportData = this.role == "ROLE_BANZHUREN" ?
this.$request.cTExportPhaseInteractiveReport :
this.role == "ROLE_PERSONAL" ?
this.$request.pExportPhaseReport :
this.$request.exportPhaseInteractiveReport;
const data = await exportData({ ...query });
this.exportLoading = false;
if (data) {
let blob = new Blob([data], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
});
downloadFile("随堂问-数据报表.xlsx", blob);
} else {
this.$message.error("下载失败");
}
},
},
};
</script>
<style>
div::-webkit-scrollbar {
width: 3px;
height: 10px;
}
div::-webkit-scrollbar-thumb {
border-radius: 10px;
background-color: #ccc;
}
</style>
<style lang="scss" scoped>
.main {
height: 100%;
}
.table-box {
padding: 16px;
border-radius: 5px;
.table-cont {
min-height: 300px;
}
:deep(.fa-arrow-right) {
padding-left: 2px;
}
:deep(.fa-file-text) {
padding-left: 2px;
}
}
.btn-box {
text-align: right;
padding: 0 12px 16px;
}
</style>
|