mirror of https://gitee.com/stylefeng/roses
【7.2.3】角色分配菜单,增加选中状态的半开状态
parent
cf57f4a755
commit
9751d611d5
|
@ -69,6 +69,12 @@ public class MenuAndButtonTreeResponse implements AbstractTreeNode<MenuAndButton
|
|||
@ChineseDescription("是否选择(已拥有的是true)")
|
||||
private Boolean checked;
|
||||
|
||||
/**
|
||||
* 是否是半开状态(一部分选中)
|
||||
*/
|
||||
@ChineseDescription("是否是半开状态(一部分选中)")
|
||||
private Boolean indeterminate;
|
||||
|
||||
/**
|
||||
* 当前节点的按钮集合
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue