From 691d7ceaa521fa84c9091b63c2a9c35b49e16352 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 10 Jul 2025 18:40:44 +0800 Subject: [PATCH] fix: correct tag rendering and permission check logic in index.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1057921 --user=刘瑞斌 【资源授权】专业版和社区版、企业版授权工具勾选了文件夹,保存后,文件夹自动取消勾选,只勾选了工具 https://www.tapd.cn/62980211/s/1728387 --- .../system/resource-authorization/index.vue | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/ui/src/views/system/resource-authorization/index.vue b/ui/src/views/system/resource-authorization/index.vue index a2aa10878..8159171a6 100644 --- a/ui/src/views/system/resource-authorization/index.vue +++ b/ui/src/views/system/resource-authorization/index.vue @@ -46,7 +46,7 @@
{{ row.nick_name }} -
@@ -314,13 +314,26 @@ const dfsPermissionIndeterminate = ( } if (item.isFolder) { - item.permissionHalf[type] = permissionHalfMap[item.id][type].length - ? new Set(permissionHalfMap[item.id][type]).size > 1 - : false + // 判断是否存在子项且全部选中或全部未选中 + const hasPermissions = permissionHalfMap[item.id][type]; + const allTrue = hasPermissions.length && hasPermissions.every((p: boolean) => p); + const allFalse = hasPermissions.length && hasPermissions.every((p: boolean) => !p); + + // 只有在既有选中又有未选中的情况下才设置为半选状态 + item.permissionHalf[type] = hasPermissions.length && !allTrue && !allFalse; + + // 检查子文件夹是否有半选状态 if (item.children.some((ele: any) => ele.isFolder && ele.permissionHalf[type])) { - item.permissionHalf[type] = true + item.permissionHalf[type] = true; } + // 如果所有子项都已选中,确保当前项也被选中而不是半选 + if (allTrue) { + item.permission[type] = true; + item.permissionHalf[type] = false + } + + // 如果子项中有选中的也有未选中的,则设置为半选状态 if ( item.children.some((ele: any) => ele.permission[type]) && item.children.some((ele: any) => !ele.permission[type])