mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: convert getList and getUserList functions to async for improved handling of asynchronous operations
--bug=1054152 --user=刘瑞斌 【函数库】筛选“我的”函数后刷新页面,还是显示的全部函数 https://www.tapd.cn/57709429/s/1678876
This commit is contained in:
parent
ec6657177a
commit
26946d0afb
|
|
@ -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()
|
||||
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
Loading…
Reference in New Issue