From 6ca84fc7e33e5639e7375200b0ecab347e0c320b Mon Sep 17 00:00:00 2001 From: tbphp Date: Sun, 13 Jul 2025 21:18:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=86=E9=92=A5?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E5=A4=8D=E8=AF=B7=E6=B1=82=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/keys/GroupFormModal.vue | 12 ++++++++++-- web/src/components/keys/KeyTable.vue | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/src/components/keys/GroupFormModal.vue b/web/src/components/keys/GroupFormModal.vue index 06ce565..285445c 100644 --- a/web/src/components/keys/GroupFormModal.vue +++ b/web/src/components/keys/GroupFormModal.vue @@ -80,6 +80,8 @@ const formData = reactive({ const channelTypeOptions = ref<{ label: string; value: string }[]>([]); const configOptions = ref([]); +const channelTypesFetched = ref(false); +const configOptionsFetched = ref(false); // 表单验证规则 const rules: FormRules = { @@ -124,6 +126,12 @@ watch( () => props.show, show => { if (show) { + if (!channelTypesFetched.value) { + fetchChannelTypes(); + } + if (!configOptionsFetched.value) { + fetchGroupConfigOptions(); + } resetForm(); if (props.group) { loadGroupData(); @@ -174,7 +182,6 @@ function loadGroupData() { }); } -fetchChannelTypes(); async function fetchChannelTypes() { const options = (await settingsApi.getChannelTypes()) || []; channelTypeOptions.value = @@ -182,6 +189,7 @@ async function fetchChannelTypes() { label: type, value: type, })) || []; + channelTypesFetched.value = true; } // 添加上游地址 @@ -199,10 +207,10 @@ function removeUpstream(index: number) { } } -fetchGroupConfigOptions(); async function fetchGroupConfigOptions() { const options = await keysApi.getGroupConfigOptions(); configOptions.value = options || []; + configOptionsFetched.value = true; } // 添加配置项 diff --git a/web/src/components/keys/KeyTable.vue b/web/src/components/keys/KeyTable.vue index e7a3b9d..10520f2 100644 --- a/web/src/components/keys/KeyTable.vue +++ b/web/src/components/keys/KeyTable.vue @@ -79,8 +79,13 @@ watch( () => props.selectedGroup, async newGroup => { if (newGroup) { + // 检查重置页面是否会触发分页观察者。 + const willWatcherTrigger = currentPage.value !== 1 || statusFilter.value !== "all"; resetPage(); - await loadKeys(); + // 如果分页观察者不触发,则手动加载。 + if (!willWatcherTrigger) { + await loadKeys(); + } } }, { immediate: true }