index.vue
10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
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
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<template>
<div class="template-box content_div_main">
<el-row class="">
<el-form :inline="true" class="search-form" size="small">
<el-form-item label="考点名称:" label-width="82px">
<el-select v-model="examinationId" placeholder="请选择" @change="changeExamination">
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="人员类型:">
<el-select v-model="typeId" placeholder="请选择">
<el-option
v-for="item in types"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button class="search-btn" @click="searchUser" icon="el-icon-download"
:disabled="buttonDisable()">获取考生列表</el-button>
<el-button class="search-btn ml10" @click="getAllUserList"
:disabled="buttonDisable()">获取考生照片</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<div class="line"></div>
</el-row>
<el-row>
<el-form :inline="true" class="search-form" size="small">
<el-form-item label="身份证号:">
<el-input type="text" class="bla bra br0" v-model="idCard" placeholder=""></el-input>
</el-form-item>
<el-form-item>
<el-button class="search-btn" @click="getUserList"
:disabled="examinationId === '' || typeId === ''">查询</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<el-table :data="systableData"
:v-loading="pictLoading"
element-loading-background = "rgba(0, 0, 0, 0.5)"
element-loading-text = "数据正在加载中"
element-loading-spinner = "el-icon-loading"
style="width:98%;margin:20px auto;" class="table_m_type" height="700">
<div slot="empty">
<div class="no-data-box">
<img src="../../../assets/img/nodata.png" alt="暂无数据"/>
<div>暂无数据</div>
</div>
</div>
<el-table-column type="index" width=""></el-table-column>
<!-- <el-table-column prop="tabOrder" label="序号" width=""></el-table-column> -->
<el-table-column prop="idCard" label="身份证号" width=""></el-table-column>
<el-table-column label="照片" align="center">
<template slot-scope="scope">
<el-popover placement="left" trigger="hover">
<div class="face-img-box" slot="reference">
<img
:src="dealCardImg(scope.row)"
width="50"
height="50"
alt
class="face-img"
:onerror="defaultImg"
/>
</div>
<img
:src="dealCardImg(scope.row)"
:alt="dealCardImg(scope.row)"
width="200"
height="200"
class="zoomout-img"
:onerror="defaultImg"
/>
</el-popover>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="">
<template slot-scope="scope" align="center">
<div class="tab-btn-box">
<span class="table-btn" @click="getItemUserImg(scope.$index, scope.row)">获取照片</span>
</div>
</template>
</el-table-column>
</el-table>
</el-row>
<el-row>
<div style="display: flex; flex-direction:row-reverse ">
<el-pagination
class="mt10"
@current-change="handleCurrentChange" :current-page.sync="currentPage"
:page-size="limit"
background
layout="prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-row>
<el-dialog title="考生照片获取进度" :visible.sync="progressDialog" width="40%">
<div class="progress-content">
<div>{{ `第${nowNumber}条` }}</div>
<div>{{ `共计${allUserList.length}条` }}</div>
</div>
<el-progress :text-inside="true" :stroke-width="14" :percentage="parseInt(nowNumber/allUserList.length * 100)"></el-progress>
</el-dialog>
</div>
</template>
<script>
const { picUrls = '' } = window.SECURITY_CONF
import defaultImg from "@/assets/img/default.png";
export default {
data() {
return {
options: [],
examinationId: "",
typeId: "",
systableData: [],
progressDialog: false,
types: [],
successCount: "",
idCard: null,
total:0,
currentPage:1,
limit:20,
pictLoading: false,
accountId:localStorage.getItem("accountId"),
allUserList: [],
picUrls,
defaultImg,
nowNumber: 0
}
},
methods: {
searchUser () {
this.axios.get(this.API.url+`/persons/socialSecurity/getStudentInfo`, {
params: {
mallId: this.examinationId,
personType: this.typeId
}
}).then(response => {
if (response.data.code === 200) {
this.successCount = response.data.data.successCount
this.userDataSuccess()
this.getUserList()
}
});
},
handleCurrentChange(val){
this.currentPage = val;
this.getUserList();
},
// 获取所有用户
async getAllUserList () {
try {
const allPerson = await this.axios.get(this.API.url+`/persons`, {
params: {
mallId: this.examinationId,
type: this.typeId,
}
});
if (allPerson.data && allPerson.data.data && allPerson.data.data.length > 0) {
const { data } = allPerson.data;
this.allUserList = data
this.progressDialog = true
this.editUserInfo()
} else {
}
} catch (err) {
}
},
dealCardImg(row) {
let img_path = "";
if (!row.personPic) {
img_path = this.defaultImg;
} else {
img_path = this.picUrls + "/" + row.personPic;
}
return img_path;
},
async editUserInfo () {
const { nowNumber } = this
if (nowNumber >= this.allUserList.length) {
return;
}
if (nowNumber === this.allUserList.length - 1) {
this.getUserList()
}
if (nowNumber < this.allUserList.length) {
await this.setUserPhoto(() => {
this.nowNumber = this.nowNumber + 1;
this.editUserInfo()
})
}
},
// 获取考生照片
async setUserPhoto (callback) {
const { allUserList, nowNumber } = this
try {
await this.axios.get(this.API.url+`/persons/socialSecurity/getPictures/${allUserList[nowNumber].id}`)
callback()
} catch (err) {
callback()
}
},
// 获取担任考生照片
getUserList () {
this.axios.get(this.API.url+`/persons`, {
params: {
mallId: this.examinationId,
type: this.typeId,
idCard: this.idCard === "" ? null : this.idCard,
page:this.currentPage,
pageSize: this.limit,
}
}).then(response => {
if (response.data && response.data.data && response.data.data.list) {
// response.data.data.list.forEach((item, index) => {
// item.tabOrder = ++index;
// });
this.systableData = response.data.data.list
this.total = response.data.data.total || 0
} else {
this.systableData = []
}
});
},
getTypes () {
this.axios.get(this.API.url+"/personTypes", {
params: {
accountId: this.accountId,
mallId: this.examinationId,
}
}).then(response => {
if (response && response.data && response.data.data) {
this.types = response.data.data
} else {
this.types = []
}
});
},
buttonDisable () {
if (this.typeId === "" || this.examinationId === "") {
return true
}
return false
},
async getItemUserImg (index, row) { // 单条获取照片
const { systableData } = this
try {
const data = await this.axios.get(this.API.url+`/persons/socialSecurity/getPictures/${row.id}`)
if (data && data.data && data.data.data) {
systableData[index].personPic = data.data.data.personPic
}
} catch (err) {
}
},
userDataSuccess () {
this.$alert(`考试列表获取成功!共计${this.successCount}条信息更新`, '', {
confirmButtonText: '确定'
});
},
getMalls () {
this.axios.get(this.API.url+`/malls`, {
params: {
accountId: this.accountId,
status: 1,
type: 1
}
}).then(response => {
if (response && response.data && response.data.data) {
this.options = response.data.data
} else {
this.options = []
}
});
},
changeExamination () {
if (this.examinationId !== '') {
this.getTypes()
}
}
},
created() {
this.getMalls()
},
};
</script>
<style lang="stylus" scoped>
.progress-content {
width 100%;
display flex;
justify-content space-between;
align-items center;
box-sizing border-box;
padding-right 18px;
margin-bottom 10px;
}
.line {
width 100%;
height 1px;
background-color #efefef;
}
.face-img-box {
position relative;
width 50px;
height 50px;
border 1px solid #dcdcdc;
margin 0px auto;
cursor zoom-in;
}
.pic-popover {
margin 5px 0;
padding 10px;
background #fff;
border 1px solid #ebeef5;
box-shadow 0 2px 12px 0 rgba(0, 0, 0, 0.1);
border-radius 4px;
}
.face-img {
width 50px;
height 50px;
}
.zoomout-img {
width auto;
height 200px;
}
</style>