Browse Source

fix: search result can’t paging

pull/4692/head
诗人的咸鱼 2 years ago
parent
commit
0a2e7bc1a8
  1. 13
      packages/nc-gui/components/tabs/auth/UserManagement.vue

13
packages/nc-gui/components/tabs/auth/UserManagement.vue

@ -44,7 +44,7 @@ let isLoading = $ref(false)
let totalRows = $ref(0) let totalRows = $ref(0)
const currentPage = $ref(1) let currentPage = $ref(1)
const currentLimit = $ref(10) const currentLimit = $ref(10)
@ -58,7 +58,7 @@ const loadUsers = async (page = currentPage, limit = currentLimit) => {
const response: any = await api.auth.projectUserList(project.value?.id, { const response: any = await api.auth.projectUserList(project.value?.id, {
query: { query: {
limit, limit,
offset: searchText.value.length === 0 ? (page - 1) * limit : 0, offset: (page - 1) * limit,
query: searchText.value, query: searchText.value,
}, },
} as RequestParams) } as RequestParams)
@ -160,7 +160,14 @@ onBeforeMount(async () => {
} }
}) })
watchDebounced(searchText, () => loadUsers(), { debounce: 300, maxWait: 600 }) watchDebounced(
searchText,
() => {
currentPage = 1
loadUsers()
},
{ debounce: 300, maxWait: 600 },
)
const isSuperAdmin = (user: { main_roles?: string }) => { const isSuperAdmin = (user: { main_roles?: string }) => {
return user.main_roles?.split(',').includes(OrgUserRoles.SUPER_ADMIN) return user.main_roles?.split(',').includes(OrgUserRoles.SUPER_ADMIN)

Loading…
Cancel
Save