perf(frontend): 管理页面更新操作改为局部刷新,避免全量重载列表

Provider、API Key、Pool Key、Management Token 的更新操作
完成后直接替换本地列表中对应记录,仅创建操作保留全量刷新。
This commit is contained in:
fawney19
2026-03-01 11:57:09 +08:00
parent b61fc4eb6b
commit 8b0e92e408
5 changed files with 47 additions and 11 deletions

View File

@@ -178,7 +178,7 @@
@update:open="providerDrawerOpen = $event"
@edit="openEditProviderDialog"
@toggle-status="toggleProviderStatus"
@refresh="loadProviders"
@refresh="handleDrawerRefresh"
/>
<ProviderAuthDialog
@@ -211,6 +211,7 @@ import { useProviderFilters } from '@/features/providers/composables/useProvider
import { useProviderBalance } from '@/features/providers/composables/useProviderBalance'
import {
getProvidersSummary,
getProvider,
deleteProvider,
updateProvider,
getGlobalModels,
@@ -407,8 +408,28 @@ function handleOpsConfigSaved() {
}
// 处理提供商编辑完成
function handleProviderUpdated() {
loadProviders()
function handleProviderUpdated(updated: ProviderWithEndpointsSummary) {
const index = providers.value.findIndex(p => p.id === updated.id)
if (index !== -1) {
providers.value[index] = updated
// 刷新该提供商的余额数据
loadBalances([updated])
}
}
// 处理详情抽屉内的刷新:只刷新当前查看的那一条提供商
async function handleDrawerRefresh() {
if (!selectedProviderId.value) return
try {
const updated = await getProvider(selectedProviderId.value)
const index = providers.value.findIndex(p => p.id === updated.id)
if (index !== -1) {
providers.value[index] = updated
loadBalances([updated])
}
} catch (err) {
showError(parseApiError(err, '刷新提供商数据失败'), '错误')
}
}
// 优先级保存成功回调