From 10c782e1869f39953687be73db5108359620188e Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 9 Apr 2021 08:56:48 +0800 Subject: [PATCH] fix issue --- spug_web/src/pages/host/Group.js | 13 +++++++++---- spug_web/src/pages/host/Selector.js | 7 ++++++- spug_web/src/pages/host/index.js | 3 ++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/spug_web/src/pages/host/Group.js b/spug_web/src/pages/host/Group.js index 6b419bd..657edb4 100644 --- a/spug_web/src/pages/host/Group.js +++ b/spug_web/src/pages/host/Group.js @@ -20,15 +20,20 @@ import store from './store'; import lds from 'lodash'; export default observer(function () { - const [loading, setLoading] = useState(false); + const [loading, setLoading] = useState(); const [visible, setVisible] = useState(false); const [draggable, setDraggable] = useState(false); const [action, setAction] = useState(''); - const [expands, setExpands] = useState([]); + const [expands, setExpands] = useState(); const [bakTreeData, setBakTreeData] = useState(); useEffect(() => { - if (!loading) store.fetchGroups() + if (!loading) store.fetchGroups().then(() => { + if (loading === undefined) { + const tmp = store.treeData.filter(x => x.children.length) + setExpands(tmp.map(x => x.key)) + } + }) }, [loading]) const menus = ( @@ -132,7 +137,7 @@ export default observer(function () { }> + extra={}> setGroup(node)} + onSelect={(_, {node}) => handleChangeGrp(node)} /> diff --git a/spug_web/src/pages/host/index.js b/spug_web/src/pages/host/index.js index a68d155..1d52b35 100644 --- a/spug_web/src/pages/host/index.js +++ b/spug_web/src/pages/host/index.js @@ -35,7 +35,8 @@ export default observer(function () { {store.formVisible && } {store.importVisible && } - {store.selectorVisible && store.selectorVisible = false} onOk={store.updateGroup}/>} + {store.selectorVisible && + store.selectorVisible = false} onOk={store.updateGroup}/>} ); })