🐛 用户/角色管理界面分页问题修复

This commit is contained in:
x ronger 2020-09-15 22:15:02 +08:00
parent dae9333b3f
commit e4ac54ed2d
3 changed files with 22 additions and 8 deletions

View File

@ -177,16 +177,18 @@
}); });
}); });
}, },
handleSizeChange(page) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchRoles', { _ts.$store.dispatch('admin/fetchRoles', {
page: page page: _ts.pagination.currentPage,
rows: pageSize
}) })
}, },
handleCurrentChange(page) { handleCurrentChange(page) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchRoles', { _ts.$store.dispatch('admin/fetchRoles', {
page: page page: page,
rows: _ts.pagination.pageSize
}) })
} }
} }

View File

@ -178,16 +178,18 @@
}); });
}); });
}, },
handleSizeChange(page) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchUsers', { _ts.$store.dispatch('admin/fetchUsers', {
page: page page: _ts.pagination.currentPage,
rows: pageSize
}) })
}, },
handleCurrentChange(page) { handleCurrentChange(page) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchUsers', { _ts.$store.dispatch('admin/fetchUsers', {
page: page page: page,
rows: _ts.pagination.pageSize
}) })
}, },
updateRole() { updateRole() {

View File

@ -42,9 +42,14 @@ export const actions = {
commit('updateUsersData', getDefaultUsersData()) commit('updateUsersData', getDefaultUsersData())
commit('updateFetching', true) commit('updateFetching', true)
let data = {
page: params.page || 1,
rows: params.rows || 10
}
return this.$axios return this.$axios
.$get(`${ADMIN_API_PATH}/users`, { .$get(`${ADMIN_API_PATH}/users`, {
params: params params: data
}) })
.then(response => { .then(response => {
commit('updateFetching', false); commit('updateFetching', false);
@ -60,9 +65,14 @@ export const actions = {
commit('updateRolesData', getDefaultRolesData()) commit('updateRolesData', getDefaultRolesData())
commit('updateFetching', true) commit('updateFetching', true)
let data = {
page: params.page || 1,
rows: params.rows || 10
}
return this.$axios return this.$axios
.$get(`${ADMIN_API_PATH}/roles`, { .$get(`${ADMIN_API_PATH}/roles`, {
params: params params: data
}) })
.then(response => { .then(response => {
commit('updateFetching', false); commit('updateFetching', false);