From dd8bc33ffe7d8fa04f0286aa0e04cbb30926df48 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Wed, 28 Oct 2026 11:33:15 +0800 Subject: [PATCH] fix: system group select user --- .../business/api-key-list/index.vue | 2 +- .../groups/dialog/CreateGroupMemberDialog.vue | 22 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ui/src/components/business/api-key-list/index.vue b/ui/src/components/business/api-key-list/index.vue index e1803328e08..045516b4b16 100644 --- a/ui/src/components/business/api-key-list/index.vue +++ b/ui/src/components/business/api-key-list/index.vue @@ -141,7 +141,7 @@ onMounted(loadApiKeys) - + diff --git a/ui/src/views/system/identity/groups/dialog/CreateGroupMemberDialog.vue b/ui/src/views/system/identity/groups/dialog/CreateGroupMemberDialog.vue index 6456f2d89d7..870a87477ed 100644 --- a/ui/src/views/system/identity/groups/dialog/CreateGroupMemberDialog.vue +++ b/ui/src/views/system/identity/groups/dialog/CreateGroupMemberDialog.vue @@ -18,12 +18,15 @@ const memberForm = reactive<{ userIds: string[] }>({ userIds: [] }) /* 成员选项 */ const optionsLoading = ref(false) const userOptions = ref([]) +const allUserOptions = ref([]) let searchTimer: ReturnType | null = null -function loadUserOptions(query?: string) { +function loadUserOptions(query = '') { + const keyword = query.trim() optionsLoading.value = true - CommonSystemApi.getWorkspaceMembers(props.workspaceId, query ? { nick_name: query } : undefined) + CommonSystemApi.getWorkspaceMembers(props.workspaceId, keyword ? { nick_name: keyword } : undefined) .then((users) => { userOptions.value = users + if (!keyword) allUserOptions.value = users }) .finally(() => { optionsLoading.value = false @@ -31,9 +34,19 @@ function loadUserOptions(query?: string) { } function handleRemoteSearch(query: string) { - if (searchTimer) clearTimeout(searchTimer) + if (searchTimer) { + clearTimeout(searchTimer) + searchTimer = null + } + const keyword = query.trim() + if (!keyword) { + // Select 聚焦会触发空关键词搜索,复用首次列表以避免加载态导致下拉浮层重绘。 + userOptions.value = allUserOptions.value + return + } searchTimer = setTimeout(() => { - loadUserOptions(query) + searchTimer = null + loadUserOptions(keyword) }, 300) } @@ -67,6 +80,7 @@ function resetData() { loading.value = false optionsLoading.value = false userOptions.value = [] + allUserOptions.value = [] formRef.value?.clearValidate() if (searchTimer) { clearTimeout(searchTimer)