fix: 修复编辑oai账号是代理IP被错误保存的问题

This commit is contained in:
shaw
2025-09-18 10:22:41 +08:00
parent 0881cc09e2
commit f70c3babc9
3 changed files with 33 additions and 79 deletions

View File

@@ -1883,7 +1883,19 @@ const selectedTagCount = computed(() => {
// 分页相关
const currentPage = ref(1)
const pageSize = ref(10)
// 从 localStorage 读取保存的每页显示条数,默认为 10
const getInitialPageSize = () => {
const saved = localStorage.getItem('apiKeysPageSize')
if (saved) {
const parsedSize = parseInt(saved, 10)
// 验证保存的值是否在允许的选项中
if ([10, 20, 50, 100].includes(parsedSize)) {
return parsedSize
}
}
return 10
}
const pageSize = ref(getInitialPageSize())
const pageSizeOptions = [10, 20, 50, 100]
// 模态框状态
@@ -3640,6 +3652,11 @@ watch([currentPage, pageSize], () => {
updateSelectAllState()
})
// 监听每页显示条数变化,保存到 localStorage
watch(pageSize, (newSize) => {
localStorage.setItem('apiKeysPageSize', newSize.toString())
})
// 监听API Keys数据变化清理无效的选中状态
watch(apiKeys, () => {
const validIds = new Set(apiKeys.value.map((key) => key.id))