🐛 登陆记录分页问题修复

This commit is contained in:
ronger 2022-04-18 11:02:35 +08:00
parent d1e04082aa
commit 82a1d6bc18
2 changed files with 13 additions and 5 deletions

View File

@ -28,6 +28,7 @@
<el-pagination <el-pagination
:hide-on-single-page="true" :hide-on-single-page="true"
@current-change="currentChange" @current-change="currentChange"
@size-change="sizeChange"
:current-page="records.pagination.currentPage" :current-page="records.pagination.currentPage"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="records.pagination.pageSize" :page-size="records.pagination.pageSize"
@ -56,14 +57,19 @@ export default {
return {} return {}
}, },
methods: { methods: {
sizeChange(size) {
let _ts = this;
let search = {
size: size,
page: _ts.records.pagination.currentPage
}
_ts.$emit('currentChange', search);
},
currentChange(page) { currentChange(page) {
let _ts = this; let _ts = this;
let startDate = _ts.searchDate[0]
let endDate = _ts.searchDate[1]
let search = { let search = {
page: page, page: page,
startDate: startDate, size: _ts.records.pagination.pageSize
endDate: endDate
} }
_ts.$emit('currentChange', search); _ts.$emit('currentChange', search);
} }

View File

@ -32,13 +32,15 @@ export default {
_ts.$axios.$get('api/user-info/login-records', { _ts.$axios.$get('api/user-info/login-records', {
params: { params: {
idUser: _ts.idUser, idUser: _ts.idUser,
page: search.page page: search.page || 1,
rows: search.size || 10
} }
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
_ts.records = res _ts.records = res
} }
}) })
}, },
getData() { getData() {
let _ts = this let _ts = this