File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
ui/src/views/system/resource-authorization Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 4646 <div class =" flex-between" >
4747 <div class =" flex" >
4848 <span class =" mr-8" >{{ row.nick_name }}</span >
49- <TagGroup :tags =" row.roles"
49+ <TagGroup :tags =" row.roles"
5050 v-if =" hasPermission([EditionConst.IS_EE,EditionConst.IS_PE],'OR')"
5151 />
5252 </div >
@@ -314,13 +314,26 @@ const dfsPermissionIndeterminate = (
314314 }
315315
316316 if (item .isFolder ) {
317- item .permissionHalf [type ] = permissionHalfMap [item .id ][type ].length
318- ? new Set (permissionHalfMap [item .id ][type ]).size > 1
319- : false
317+ // 判断是否存在子项且全部选中或全部未选中
318+ const hasPermissions = permissionHalfMap [item .id ][type ];
319+ const allTrue = hasPermissions .length && hasPermissions .every ((p : boolean ) => p );
320+ const allFalse = hasPermissions .length && hasPermissions .every ((p : boolean ) => ! p );
321+
322+ // 只有在既有选中又有未选中的情况下才设置为半选状态
323+ item .permissionHalf [type ] = hasPermissions .length && ! allTrue && ! allFalse ;
324+
325+ // 检查子文件夹是否有半选状态
320326 if (item .children .some ((ele : any ) => ele .isFolder && ele .permissionHalf [type ])) {
321- item .permissionHalf [type ] = true
327+ item .permissionHalf [type ] = true ;
328+ }
329+
330+ // 如果所有子项都已选中,确保当前项也被选中而不是半选
331+ if (allTrue ) {
332+ item .permission [type ] = true ;
333+ item .permissionHalf [type ] = false
322334 }
323335
336+ // 如果子项中有选中的也有未选中的,则设置为半选状态
324337 if (
325338 item .children .some ((ele : any ) => ele .permission [type ]) &&
326339 item .children .some ((ele : any ) => ! ele .permission [type ])
You can’t perform that action at this time.
0 commit comments