Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
f23318fb
Commit
f23318fb
authored
Feb 14, 2026
by
yangjianbo
Browse files
fix(frontend): 同步账号本地移除后的分页状态
parent
cbab49d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/views/admin/AccountsView.vue
View file @
f23318fb
...
@@ -716,12 +716,38 @@ const mergeRuntimeFields = (oldAccount: Account, updatedAccount: Account): Accou
...
@@ -716,12 +716,38 @@ const mergeRuntimeFields = (oldAccount: Account, updatedAccount: Account): Accou
current_window_cost
:
updatedAccount
.
current_window_cost
??
oldAccount
.
current_window_cost
,
current_window_cost
:
updatedAccount
.
current_window_cost
??
oldAccount
.
current_window_cost
,
active_sessions
:
updatedAccount
.
active_sessions
??
oldAccount
.
active_sessions
active_sessions
:
updatedAccount
.
active_sessions
??
oldAccount
.
active_sessions
}
)
}
)
const
syncPaginationAfterLocalRemoval
=
()
=>
{
const
nextTotal
=
Math
.
max
(
0
,
pagination
.
total
-
1
)
pagination
.
total
=
nextTotal
pagination
.
pages
=
nextTotal
>
0
?
Math
.
ceil
(
nextTotal
/
pagination
.
page_size
)
:
0
const
maxPage
=
Math
.
max
(
1
,
pagination
.
pages
||
1
)
let
shouldReload
=
false
if
(
pagination
.
page
>
maxPage
)
{
pagination
.
page
=
maxPage
shouldReload
=
nextTotal
>
0
}
else
if
(
nextTotal
>
0
)
{
const
displayedEnd
=
(
pagination
.
page
-
1
)
*
pagination
.
page_size
+
accounts
.
value
.
length
// 当前页条目变少时,若后续还有数据则补齐,避免空页/少一条直到手动刷新。
shouldReload
=
displayedEnd
<
nextTotal
}
if
(
shouldReload
)
{
load
().
catch
((
error
)
=>
{
console
.
error
(
'
Failed to refresh accounts after local removal:
'
,
error
)
}
)
}
}
const
patchAccountInList
=
(
updatedAccount
:
Account
)
=>
{
const
patchAccountInList
=
(
updatedAccount
:
Account
)
=>
{
const
index
=
accounts
.
value
.
findIndex
(
account
=>
account
.
id
===
updatedAccount
.
id
)
const
index
=
accounts
.
value
.
findIndex
(
account
=>
account
.
id
===
updatedAccount
.
id
)
if
(
index
===
-
1
)
return
if
(
index
===
-
1
)
return
const
mergedAccount
=
mergeRuntimeFields
(
accounts
.
value
[
index
],
updatedAccount
)
const
mergedAccount
=
mergeRuntimeFields
(
accounts
.
value
[
index
],
updatedAccount
)
if
(
!
accountMatchesCurrentFilters
(
mergedAccount
))
{
if
(
!
accountMatchesCurrentFilters
(
mergedAccount
))
{
accounts
.
value
=
accounts
.
value
.
filter
(
account
=>
account
.
id
!==
mergedAccount
.
id
)
accounts
.
value
=
accounts
.
value
.
filter
(
account
=>
account
.
id
!==
mergedAccount
.
id
)
syncPaginationAfterLocalRemoval
()
selIds
.
value
=
selIds
.
value
.
filter
(
id
=>
id
!==
mergedAccount
.
id
)
selIds
.
value
=
selIds
.
value
.
filter
(
id
=>
id
!==
mergedAccount
.
id
)
if
(
menu
.
acc
?.
id
===
mergedAccount
.
id
)
{
if
(
menu
.
acc
?.
id
===
mergedAccount
.
id
)
{
menu
.
show
=
false
menu
.
show
=
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment