From f7108f5b4419dbe8d03a86020ef1889942e6e1f5 Mon Sep 17 00:00:00 2001 From: Orion Date: Fri, 5 Jun 2026 15:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E7=BB=9F=E4=B8=80=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E5=88=86=E9=A1=B5=E4=B8=8E=E8=AE=BE=E7=BD=AE=E9=A1=B5?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/DataPagination.vue | 2 +- src/composables/useAdminFiles.ts | 17 +++-- src/layout/AdminLayout/AdminLayout.vue | 4 +- src/views/manage/FileManageView.vue | 2 +- src/views/manage/SystemSettingsView.vue | 91 ++++++++++++------------ 5 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/components/common/DataPagination.vue b/src/components/common/DataPagination.vue index 283aa18..2c66ce6 100644 --- a/src/components/common/DataPagination.vue +++ b/src/components/common/DataPagination.vue @@ -97,7 +97,7 @@ interface Props { } const props = withDefaults(defineProps(), { - pageSizeOptions: () => [10, 20, 50, 100] + pageSizeOptions: () => [5, 10, 20, 50, 100] }) defineEmits<{ diff --git a/src/composables/useAdminFiles.ts b/src/composables/useAdminFiles.ts index 5719e13..8b6cdb9 100644 --- a/src/composables/useAdminFiles.ts +++ b/src/composables/useAdminFiles.ts @@ -81,6 +81,8 @@ const legacyForeverExpiresAt = '2099-12-31T23:59' const detailPolicyDownloadLimit = 5 const hourInMilliseconds = 60 * 60 * 1000 const dayInMilliseconds = 24 * 60 * 60 * 1000 +const adminPageSizeOptions = [5, 10, 20, 50, 100] as const +const defaultAdminPageSize = 10 type DetailPolicyActionOption = { action: AdminFilePolicyAction @@ -167,8 +169,10 @@ const normalizePresetChoice = ( const normalizePresetSize = (value: unknown) => { const normalizedSize = Number(value) - if (!Number.isFinite(normalizedSize)) return 10 - return Math.min(Math.max(Math.trunc(normalizedSize), 1), 100) + const pageSize = Number.isFinite(normalizedSize) ? Math.trunc(normalizedSize) : defaultAdminPageSize + return adminPageSizeOptions.includes(pageSize as (typeof adminPageSizeOptions)[number]) + ? pageSize + : defaultAdminPageSize } const buildDefaultViewPresetParams = (): AdminFileViewPresetParams => ({ @@ -178,7 +182,7 @@ const buildDefaultViewPresetParams = (): AdminFileViewPresetParams => ({ health: 'all', sortBy: 'created_at', sortOrder: 'desc', - size: 10 + size: defaultAdminPageSize }) const normalizeViewPresetParams = (params: unknown): AdminFileViewPresetParams => { @@ -218,7 +222,7 @@ export function useAdminFiles() { const summary = ref(emptySummary()) const params = ref({ page: 1, - size: 10, + size: defaultAdminPageSize, total: 0, keyword: '', status: 'all', @@ -311,7 +315,7 @@ export function useAdminFiles() { health: params.value.health || 'all', sortBy: params.value.sortBy || 'created_at', sortOrder: params.value.sortOrder || 'desc', - size: params.value.size || 10 + size: params.value.size || defaultAdminPageSize }) const buildBuiltInViewPreset = ( @@ -1204,8 +1208,7 @@ export function useAdminFiles() { } const handlePageSizeChange = async (size: number) => { - if (!Number.isFinite(size) || size < 1) return - params.value.size = Math.min(Math.trunc(size), 100) + params.value.size = normalizePresetSize(size) params.value.page = 1 markViewPresetDirty() await loadFiles() diff --git a/src/layout/AdminLayout/AdminLayout.vue b/src/layout/AdminLayout/AdminLayout.vue index 1a0f018..162c808 100644 --- a/src/layout/AdminLayout/AdminLayout.vue +++ b/src/layout/AdminLayout/AdminLayout.vue @@ -89,10 +89,10 @@
-
+
diff --git a/src/views/manage/FileManageView.vue b/src/views/manage/FileManageView.vue index 0ae8230..a8d7b21 100644 --- a/src/views/manage/FileManageView.vue +++ b/src/views/manage/FileManageView.vue @@ -707,7 +707,7 @@ :current-page="historyPage" :page-size="historyPageSize" :total="historyRows.length" - :page-size-options="[5, 10, 20, 50]" + :page-size-options="[5, 10, 20, 50, 100]" @page-change="historyPage = $event" @page-size-change="handleHistoryPageSizeChange" /> diff --git a/src/views/manage/SystemSettingsView.vue b/src/views/manage/SystemSettingsView.vue index 2b64fd7..acc8f6f 100644 --- a/src/views/manage/SystemSettingsView.vue +++ b/src/views/manage/SystemSettingsView.vue @@ -31,59 +31,50 @@ onMounted(() => { - +