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

perf: 机构树

parent 585aa752
...@@ -347,7 +347,7 @@ const UserManage = () => { ...@@ -347,7 +347,7 @@ const UserManage = () => {
// 点击树节点,获取当前机构下所有用户 // 点击树节点,获取当前机构下所有用户
const onSelect = (props, e) => { const onSelect = (props, e) => {
console.log(e); // console.log(props);
setTableLoading(true); setTableLoading(true);
if (e) { if (e) {
setOrgTitle(e.node.title); setOrgTitle(e.node.title);
...@@ -358,6 +358,8 @@ const UserManage = () => { ...@@ -358,6 +358,8 @@ const UserManage = () => {
setCurrentSelectOrg(props[0]); setCurrentSelectOrg(props[0]);
} }
setOrgID(props[0] || currentSelectOrg); setOrgID(props[0] || currentSelectOrg);
// 树节点变化(即props不为空)时才请求,避免重复请求
if (props[0]) {
getOneOUUserListNew(props[0] || currentSelectOrg) getOneOUUserListNew(props[0] || currentSelectOrg)
.then(res => { .then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -391,6 +393,9 @@ const UserManage = () => { ...@@ -391,6 +393,9 @@ const UserManage = () => {
setTableLoading(false); setTableLoading(false);
message.error(err); message.error(err);
}); });
} else {
setTableLoading(false);
}
}; };
// 返回用户表数据结构处理,扁平化 // 返回用户表数据结构处理,扁平化
...@@ -1130,7 +1135,8 @@ const UserManage = () => { ...@@ -1130,7 +1135,8 @@ const UserManage = () => {
showLine={{ showLeafIcon: false }} showLine={{ showLeafIcon: false }}
blockNode blockNode
autoExpandParent autoExpandParent
expandedKeys={[currentSelectOrg]} // expandedKeys={[currentSelectOrg]}
defaultExpandAll
selectedKeys={[currentSelectOrg]} selectedKeys={[currentSelectOrg]}
onSelect={onSelect} onSelect={onSelect}
treeData={treeData.map(t => mapTree(t))} 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