Commit 52a1093c authored by 陈前坚's avatar 陈前坚

perf: 机构树

parent 585aa752
......@@ -347,7 +347,7 @@ const UserManage = () => {
// 点击树节点,获取当前机构下所有用户
const onSelect = (props, e) => {
console.log(e);
// console.log(props);
setTableLoading(true);
if (e) {
setOrgTitle(e.node.title);
......@@ -358,6 +358,8 @@ const UserManage = () => {
setCurrentSelectOrg(props[0]);
}
setOrgID(props[0] || currentSelectOrg);
// 树节点变化(即props不为空)时才请求,避免重复请求
if (props[0]) {
getOneOUUserListNew(props[0] || currentSelectOrg)
.then(res => {
if (res.code === 0) {
......@@ -391,6 +393,9 @@ const UserManage = () => {
setTableLoading(false);
message.error(err);
});
} else {
setTableLoading(false);
}
};
// 返回用户表数据结构处理,扁平化
......@@ -1130,7 +1135,8 @@ const UserManage = () => {
showLine={{ showLeafIcon: false }}
blockNode
autoExpandParent
expandedKeys={[currentSelectOrg]}
// expandedKeys={[currentSelectOrg]}
defaultExpandAll
selectedKeys={[currentSelectOrg]}
onSelect={onSelect}
treeData={treeData.map(t => mapTree(t))}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment