【7.2.3】角色分配菜单,增加选中状态的半开状态

pull/30/head
fengshuonan 2022-06-24 17:51:39 +08:00
parent cf57f4a755
commit 9751d611d5
2 changed files with 20 additions and 0 deletions

View File

@ -69,6 +69,12 @@ public class MenuAndButtonTreeResponse implements AbstractTreeNode<MenuAndButton
@ChineseDescription("是否选择(已拥有的是true)") @ChineseDescription("是否选择(已拥有的是true)")
private Boolean checked; private Boolean checked;
/**
*
*/
@ChineseDescription("是否是半开状态(一部分选中)")
private Boolean indeterminate;
/** /**
* *
*/ */

View File

@ -212,6 +212,20 @@ public class AntdMenusFactory {
} }
} }
long checkedButtonsNumber = menuButtonList.stream().filter(MenuAndButtonTreeResponse::getChecked).count();
// 统计选中的数量
if (checkedButtonsNumber == menuButtonList.size()) {
menuAndButtonTreeResponse.setChecked(true);
menuAndButtonTreeResponse.setIndeterminate(false);
} else if (checkedButtonsNumber == 0) {
menuAndButtonTreeResponse.setChecked(false);
menuAndButtonTreeResponse.setIndeterminate(false);
} else {
menuAndButtonTreeResponse.setChecked(false);
menuAndButtonTreeResponse.setIndeterminate(true);
}
menuAndButtonTreeResponse.setButtons(menuButtonList); menuAndButtonTreeResponse.setButtons(menuButtonList);
} }
} }