This commit is contained in:
zlwu committed 2026-05-17 08:36:37 +08:00
1 parent 246ad2228e
commit 8e2dd8b9f0
186 files changed
+38821 -2571

No files matched your search

+4 -1
View File
@@ -2,6 +2,8 @@
* 新增时默认排序号:当前列表中最大 sortOrder + 1;无任何数据时为 0。
* 依赖列表接口按 sort_order 升序分页(最后一页含最大排序号)。
*/
import { MAX_ADMIN_LIST_PAGE_SIZE } from '@/utils/fetch-paged-list'
export async function fetchNextSortOrder(
fetchList: (params: {
page: number
@@ -11,7 +13,8 @@ export async function fetchNextSortOrder(
}) => Promise<{ list: { sortOrder?: number }[]; total: number }>,
options?: { pageSize?: number }
): Promise<number> {
const pageSize = options?.pageSize ?? 100
const requested = options?.pageSize ?? MAX_ADMIN_LIST_PAGE_SIZE
const pageSize = Math.min(Math.max(1, requested), MAX_ADMIN_LIST_PAGE_SIZE)
const first = await fetchList({ page: 1, pageSize })
const total = first.total ?? 0
if (total === 0) return 0