fix(fe): 修复表格分页和基础功能问题

修复的主要问题:

1. **分页切换失效**(AccountsView.vue)
   - 修复 useTableLoader 未解构 handlePageSizeChange 函数
   - 添加 @update:pageSize 事件绑定到 Pagination 组件

2. **内存泄漏修复**(多个文件)
   - UsersView.vue: 添加 searchTimeout 清理和 abortController.abort()
   - ProxiesView.vue: 添加 onUnmounted 钩子清理定时器
   - RedeemView.vue: 添加 onUnmounted 钩子清理定时器

3. **分页重置问题**(UsersView.vue)
   - toggleBuiltInFilter: 切换筛选器时重置 pagination.page = 1
   - toggleAttributeFilter: 切换属性筛选时重置 pagination.page = 1

影响范围:
- frontend/src/views/admin/AccountsView.vue
- frontend/src/views/admin/ProxiesView.vue
- frontend/src/views/admin/RedeemView.vue
- frontend/src/views/admin/UsersView.vue

测试:✓ 前端构建测试通过
This commit is contained in:
IanShaw027
2026-01-09 17:38:45 +08:00
parent 5d1badfe67
commit ee9b9b3971
4 changed files with 18 additions and 4 deletions

View File

@@ -107,7 +107,7 @@
</template>
</DataTable>
</template>
<template #pagination><Pagination v-if="pagination.total > 0" :page="pagination.page" :total="pagination.total" :page-size="pagination.page_size" @update:page="handlePageChange" /></template>
<template #pagination><Pagination v-if="pagination.total > 0" :page="pagination.page" :total="pagination.total" :page-size="pagination.page_size" @update:page="handlePageChange" @update:pageSize="handlePageSizeChange" /></template>
</TablePageLayout>
<CreateAccountModal :show="showCreate" :proxies="proxies" :groups="groups" @close="showCreate = false" @created="reload" />
<EditAccountModal :show="showEdit" :account="edAcc" :proxies="proxies" :groups="groups" @close="showEdit = false" @updated="load" />
@@ -175,7 +175,7 @@ const statsAcc = ref<Account | null>(null)
const togglingSchedulable = ref<number | null>(null)
const menu = reactive<{show:boolean, acc:Account|null, pos:{top:number, left:number}|null}>({ show: false, acc: null, pos: null })
const { items: accounts, loading, params, pagination, load, reload, debouncedReload, handlePageChange } = useTableLoader<Account, any>({
const { items: accounts, loading, params, pagination, load, reload, debouncedReload, handlePageChange, handlePageSizeChange } = useTableLoader<Account, any>({
fetchFn: adminAPI.accounts.list,
initialParams: { platform: '', type: '', status: '', search: '' }
})