mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-30 23:26:41 +08:00
fix(hooks): Updated an issue with user management pagination exceptions
This commit is contained in:
parent
c7e2c55996
commit
3b9a81b5ec
@ -83,7 +83,7 @@ export function useTable<TableData extends BaseData, Fn extends ApiFn, CustomCol
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
showSizePicker: true,
|
showSizePicker: true,
|
||||||
pageSizes: [10, 15, 20, 25, 30],
|
pageSizes: [10, 15, 20, 25, 30],
|
||||||
onChange: async (page: number) => {
|
onUpdatePage: async (page: number) => {
|
||||||
pagination.page = page;
|
pagination.page = page;
|
||||||
|
|
||||||
await onPaginationChanged?.(pagination);
|
await onPaginationChanged?.(pagination);
|
||||||
|
@ -64,7 +64,7 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: 'function_hide-child',
|
title: 'function_hide-child',
|
||||||
i18nKey: 'route.function_hide-child',
|
i18nKey: 'route.function_hide-child',
|
||||||
icon: 'material-symbols:filter-list-off',
|
icon: 'material-symbols:filter-list-off'
|
||||||
},
|
},
|
||||||
redirect: '/function/hide-child/one',
|
redirect: '/function/hide-child/one',
|
||||||
children: [
|
children: [
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import type { PaginationProps } from 'naive-ui';
|
||||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||||
import { useBoolean } from '@sa/hooks';
|
import { useBoolean } from '@sa/hooks';
|
||||||
import { fetchGetUserList } from '@/service/api';
|
import { fetchGetUserList } from '@/service/api';
|
||||||
@ -141,7 +142,18 @@ const { columns, filteredColumns, data, loading, pagination, getData, searchPara
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||||
|
async onPaginationChanged(pagination: PaginationProps) {
|
||||||
|
// If you need to use parameters to control the back-end paginated data
|
||||||
|
searchParams.current = pagination.page;
|
||||||
|
searchParams.size = pagination.pageSize;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(pagination);
|
||||||
|
await getData();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const operateType = ref<OperateType>('add');
|
const operateType = ref<OperateType>('add');
|
||||||
@ -155,6 +167,7 @@ const checkedRowKeys = ref<string[]>([]);
|
|||||||
|
|
||||||
async function handleBatchDelete() {
|
async function handleBatchDelete() {
|
||||||
// request
|
// request
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(checkedRowKeys.value);
|
console.log(checkedRowKeys.value);
|
||||||
window.$message?.success($t('common.deleteSuccess'));
|
window.$message?.success($t('common.deleteSuccess'));
|
||||||
|
|
||||||
@ -174,6 +187,7 @@ function handleEdit(id: number) {
|
|||||||
|
|
||||||
async function handleDelete(id: number) {
|
async function handleDelete(id: number) {
|
||||||
// request
|
// request
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(id);
|
console.log(id);
|
||||||
window.$message?.success($t('common.deleteSuccess'));
|
window.$message?.success($t('common.deleteSuccess'));
|
||||||
|
|
||||||
@ -209,7 +223,6 @@ function getIndex(index: number) {
|
|||||||
:flex-height="!appStore.isMobile"
|
:flex-height="!appStore.isMobile"
|
||||||
:scroll-x="962"
|
:scroll-x="962"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="pagination"
|
|
||||||
:row-key="item => item.id"
|
:row-key="item => item.id"
|
||||||
class="sm:h-full"
|
class="sm:h-full"
|
||||||
/>
|
/>
|
||||||
@ -220,6 +233,20 @@ function getIndex(index: number) {
|
|||||||
@submitted="getData"
|
@submitted="getData"
|
||||||
/>
|
/>
|
||||||
</NCard>
|
</NCard>
|
||||||
|
|
||||||
|
<div class="flex-center">
|
||||||
|
<n-pagination
|
||||||
|
:page="pagination.page"
|
||||||
|
:page-size="pagination.pageSize"
|
||||||
|
:item-count="pagination.itemCount"
|
||||||
|
:page-sizes="pagination.pageSizes"
|
||||||
|
show-size-picker
|
||||||
|
@update:page="pagination.onUpdatePage"
|
||||||
|
@update:page-size="pagination.onUpdatePageSize"
|
||||||
|
>
|
||||||
|
<template #prefix="{ itemCount }">共 {{ itemCount }} 项</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user