fix: correct tag rendering and permission check logic in index.vue
--bug=1057921 --user=刘瑞斌 【资源授权】专业版和社区版、企业版授权工具勾选了文件夹,保存后,文件夹自动取消勾选,只勾选了工具 https://www.tapd.cn/62980211/s/1728387
This commit is contained in:
parent
a2726a9367
commit
691d7ceaa5
@ -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])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user