77ebf04d
梁保满
个人版
|
1
2
3
4
5
6
7
8
9
10
|
<template>
<div>
<back-box>
<template slot="title">
<span>发卡记录</span>
</template>
</back-box>
<div class="page-content">
<div class="answer-header">
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
11
|
<div class="sel-box" v-if="role == 'ROLE_XUEXIAO'">
|
77ebf04d
梁保满
个人版
|
12
|
<el-cascader
|
967e02c9
梁保满
发卡记录显示参数调整
|
13
|
@change="(page = 1), _QueryData(1)"
|
77ebf04d
梁保满
个人版
|
14
15
16
17
18
19
20
21
22
23
24
25
26
|
size="small"
class="sel"
clearable
placeholder="选择班级"
v-model="query.classId"
:options="gradeList"
:props="props"
:show-all-levels="false"
></el-cascader>
<el-input
placeholder="请输入学生姓名"
v-model="query.studentName"
class="input-with-select"
|
967e02c9
梁保满
发卡记录显示参数调整
|
27
|
@keyup.enter.native="(page = 1), _QueryData(2)"
|
77ebf04d
梁保满
个人版
|
28
29
30
31
|
>
<el-button
slot="append"
icon="el-icon-search"
|
967e02c9
梁保满
发卡记录显示参数调整
|
32
|
@click="(page = 1), _QueryData(2)"
|
77ebf04d
梁保满
个人版
|
33
34
35
36
37
38
|
></el-button>
</el-input>
<el-input
placeholder="请输入学生学号"
v-model="query.studentCode"
class="input-with-select"
|
967e02c9
梁保满
发卡记录显示参数调整
|
39
|
@keyup.enter.native="(page = 1), _QueryData(3)"
|
77ebf04d
梁保满
个人版
|
40
41
42
43
|
>
<el-button
slot="append"
icon="el-icon-search"
|
967e02c9
梁保满
发卡记录显示参数调整
|
44
|
@click="(page = 1), _QueryData(3)"
|
77ebf04d
梁保满
个人版
|
45
46
|
></el-button>
</el-input>
|
967e02c9
梁保满
发卡记录显示参数调整
|
47
|
<el-button type="primary" round @click="(page = 1), _QueryData(4)"
|
77ebf04d
梁保满
个人版
|
48
49
50
|
>筛选</el-button
>
</div>
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
51
52
53
54
55
|
<div class="sel-box" v-if="role == 'ROLE_JITUAN'">
<el-select
class="sel2"
v-model="schoolId"
placeholder="选择学校"
|
967e02c9
梁保满
发卡记录显示参数调整
|
56
|
@change="(page = 1), _QueryData(true)"
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
57
58
59
60
61
62
63
64
65
66
|
>
<el-option
v-for="item in schoolList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
|
77ebf04d
梁保满
个人版
|
67
68
69
70
71
72
73
74
75
76
77
78
79
|
</div>
<el-empty
:image-size="100"
v-if="!tableData.length && !loading"
description="暂无数据"
></el-empty>
<div v-else class="table-box" v-loading="loading">
<el-table :data="tableData" border style="width: 100%">
<el-table-column
align="center"
label="答题器编码"
prop="clickerSn"
></el-table-column>
|
a6eb85ed
梁保满
下载模版错误信息展示,图标根据环境切换
|
80
81
|
<el-table-column align="center" label="年级">
<template slot-scope="scope">
|
e5e4a3e6
梁保满
v1.3
|
82
|
<span>{{ scope.row.classList[0]?.gradeName }}</span>
|
a6eb85ed
梁保满
下载模版错误信息展示,图标根据环境切换
|
83
84
|
</template>
</el-table-column>
|
77ebf04d
梁保满
个人版
|
85
86
|
<el-table-column align="center" label="班级">
<template slot-scope="scope">
|
967e02c9
梁保满
发卡记录显示参数调整
|
87
88
89
90
91
|
<span
v-for="(item, index) in scope.row.classList"
:key="item.classCode"
>{{ (index == 0 ? "" : "、") + item.className }}</span
>
|
77ebf04d
梁保满
个人版
|
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
|
</template>
</el-table-column>
<el-table-column
align="center"
label="学生姓名"
prop="studentName"
></el-table-column>
<el-table-column
align="center"
label="学号"
prop="studentCode"
></el-table-column>
<el-table-column align="center" label="类型">
<template slot-scope="scope">
{{ scope.row.operationType == 0 ? "发卡" : "补卡" }}
</template></el-table-column
>
<el-table-column align="center" label="描述">
<template slot-scope="scope">
{{
scope.row.operationType == 0
? "--"
: scope.row.reason == 0
? "丢失"
: "损坏"
}}
</template></el-table-column
>
<el-table-column
align="center"
label="操作时间"
prop="modifiedTime"
></el-table-column>
</el-table>
<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>
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
139
140
141
142
143
144
145
146
147
148
|
<p class="down" v-if="tableData.length">
<el-button
type="primary"
plain
round
icon="fa fa-cloud-download"
@click="downExl"
>导出报表</el-button
>
</p>
|
77ebf04d
梁保满
个人版
|
149
150
151
152
153
|
</div>
</div>
</template>
<script>
|
a6eb85ed
梁保满
下载模版错误信息展示,图标根据环境切换
|
154
|
import { downloadFile, formatDate } from "utils";
|
77ebf04d
梁保满
个人版
|
155
156
157
|
export default {
data() {
return {
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
158
|
role: "",
|
77ebf04d
梁保满
个人版
|
159
160
161
162
163
164
165
|
loading: false,
props: { multiple: false },
query: {
classId: "",
studentName: "",
studentCode: "",
},
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
166
167
|
schoolId: "",
schoolList: [],
|
77ebf04d
梁保满
个人版
|
168
169
170
171
172
173
174
|
gradeList: [],
tableData: [],
page: 1,
size: 20,
total: 0,
};
},
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
175
176
177
178
179
180
181
182
183
184
185
|
async created() {
this.role =
this.$store.getters.info.showRole ||
this.$store.getters.info.permissions[0].role;
this.loading = true;
if (this.role == "ROLE_XUEXIAO") {
this._QueryGradeList();
} else if (this.role == "ROLE_JITUAN") {
await this._QuerySchool();
}
|
77ebf04d
梁保满
个人版
|
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
|
this._QueryData();
},
methods: {
// 查找班级
async _QueryGradeList() {
this.loading = true;
const { data, status, info } = await this.$request.gradeList();
console.log(status);
if (status === 0) {
if (!!data.list) {
this.gradeList =
data.list?.map((item) => {
let gradeList = {
value: item.grade,
label: item.gradeName,
};
gradeList.children =
item.classList?.map((items) => {
return {
value: items.id,
label: items.className,
};
}) || [];
return gradeList;
}) || [];
}
} else {
this.$message.error(info);
}
},
changePage(page) {
this.page = page;
this._QueryData(4);
},
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
async _QuerySchool() {
const { data, status, info } = await this.$request.schoolList();
if (status === 0) {
this.schoolList =
data.list?.map((item) => {
return {
label: item.schoolName,
value: item.id,
};
}) || [];
this.schoolId = (this.schoolList && this.schoolList[0].value) || "";
} else {
this.$message.error(info);
}
},
|
77ebf04d
梁保满
个人版
|
235
236
|
async _QueryData(type) {
let query = {};
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
if (this.role == "ROLE_XUEXIAO") {
query.gradeName = this.query.gradeName;
if (type == 1) {
query.classId = this.query.classId[1] ? this.query.classId[1] : "";
this.query.studentCode = "";
this.query.studentName = "";
} else if (type == 2) {
query.studentName = this.query.studentName;
this.query.classId = "";
this.query.studentCode = "";
} else if (type == 3) {
query.studentCode = this.query.studentCode;
this.query.classId = "";
this.query.studentName = "";
} else {
query = { ...this.query };
|
967e02c9
梁保满
发卡记录显示参数调整
|
253
|
query.classId = this.query.classId[1] ? this.query.classId[1] : "";
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
254
255
256
|
}
} else if (this.role == "ROLE_JITUAN") {
query.schoolId = this.schoolId;
|
77ebf04d
梁保满
个人版
|
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
}
this.loading = true;
const { data, status, info } = await this.$request.cardList({
...query,
page: this.page,
size: 20,
});
this.loading = false;
console.log(status);
if (status === 0) {
this.tableData = data.list || [];
this.total = data.count;
} else {
this.$message.error(info);
}
},
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
273
274
275
|
async downExl() {
//报表导出
if (this.exportLoading == true) return;
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
276
|
this.exportLoading = true;
|
967e02c9
梁保满
发卡记录显示参数调整
|
277
|
const data = await this.$request.exportClickersLog();
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
278
|
this.exportLoading = false;
|
a6eb85ed
梁保满
下载模版错误信息展示,图标根据环境切换
|
279
|
if (data && !data.code) {
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
280
281
282
|
let blob = new Blob([data], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
});
|
a6eb85ed
梁保满
下载模版错误信息展示,图标根据环境切换
|
283
284
285
|
let date = formatDate(new Date().getTime(), "yyyy-MM-dd");
let name = `发卡记录_${date}.xlsx`;
downloadFile(name, blob);
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
286
|
} else {
|
a6eb85ed
梁保满
下载模版错误信息展示,图标根据环境切换
|
287
|
this.$message.error(data.info);
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
288
289
|
}
},
|
77ebf04d
梁保满
个人版
|
290
291
292
293
294
295
296
297
|
},
};
</script>
<style lang="scss" scoped>
.table-box {
padding: 0 20px;
}
|
f20c48c9
梁保满
集团管理员添加发卡记录,并添加报表导出
|
298
299
300
301
302
303
|
.down {
padding: 16px 20px;
}
.answer-header .sel-box .sel2 {
width: 300px;
}
|
77ebf04d
梁保满
个人版
|
304
|
</style>
|