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 }