From d77886b318b0274e719ce42638ee10aacca23ad0 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 1 Apr 2025 12:39:41 +0800 Subject: [PATCH 1/2] refactor: conditionally render dropdown item based on init_field_list length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1054160 --user=刘瑞斌 【函数库】没有启用参数的函数,不展示启动参数按钮 https://www.tapd.cn/57709429/s/1678874 --- ui/src/views/function-lib/index.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/src/views/function-lib/index.vue b/ui/src/views/function-lib/index.vue index eb41c2c6400..83526ba8ba6 100644 --- a/ui/src/views/function-lib/index.vue +++ b/ui/src/views/function-lib/index.vue @@ -184,6 +184,7 @@ {{ $t('common.copy') }} From cb7af5733d221572091681af9ae1c0bf58b3da7d Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 1 Apr 2025 12:56:49 +0800 Subject: [PATCH 2/2] refactor: convert getList and getUserList functions to async for improved handling of asynchronous operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1054152 --user=刘瑞斌 【函数库】筛选“我的”函数后刷新页面,还是显示的全部函数 https://www.tapd.cn/57709429/s/1678876 --- ui/src/views/function-lib/index.vue | 37 +++++++++++++++-------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/ui/src/views/function-lib/index.vue b/ui/src/views/function-lib/index.vue index 83526ba8ba6..879d33f0383 100644 --- a/ui/src/views/function-lib/index.vue +++ b/ui/src/views/function-lib/index.vue @@ -509,7 +509,10 @@ function importFunctionLib(file: any) { }) } -function getList() { +async function getList() { + if (userOptions.value?.length === 0) { + await getUserList() + } const params = { ...(searchValue.value && { name: searchValue.value }), ...(functionType.value && { function_type: functionType.value }), @@ -545,28 +548,26 @@ function refresh(data: any) { getList() } -function getUserList() { - applicationApi.getUserList('FUNCTION', loading).then((res) => { - if (res.data) { - userOptions.value = res.data.map((item: any) => { - return { - label: item.username, - value: item.id - } - }) - if (user.userInfo) { - const selectUserIdValue = localStorage.getItem(user.userInfo.id + 'function') - if (selectUserIdValue && userOptions.value.find((v) => v.value === selectUserIdValue)) { - selectUserId.value = selectUserIdValue - } +async function getUserList() { + const res = await applicationApi.getUserList('FUNCTION', loading) + if (res.data) { + userOptions.value = res.data.map((item: any) => { + return { + label: item.username, + value: item.id + } + }) + if (user.userInfo) { + const selectUserIdValue = localStorage.getItem(user.userInfo.id + 'function') + if (selectUserIdValue && userOptions.value.find((v) => v.value === selectUserIdValue)) { + selectUserId.value = selectUserIdValue } - // getList() } - }) + } } onMounted(() => { - getUserList() + })