fix issue

pull/330/head
vapao 2021-04-09 08:56:48 +08:00
parent 1883dba226
commit 10c782e186
3 changed files with 17 additions and 6 deletions

View File

@ -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 () {
<Card
title="分组列表"
loading={store.grpFetching}
extra={<Switch checked={draggable} onChange={setDraggable} checkedChildren="拖拽" unCheckedChildren="浏览"/>}>
extra={<Switch checked={draggable} onChange={setDraggable} checkedChildren="排版" unCheckedChildren="浏览"/>}>
<Dropdown
overlay={menus}
visible={visible}

View File

@ -57,6 +57,11 @@ export default observer(function (props) {
}
}
function handleChangeGrp(node) {
setGroup(node);
if (props.oneGroup) setSelectedRowKeys([])
}
return (
<Modal
visible={[undefined, true].includes(props.visible)}
@ -71,7 +76,7 @@ export default observer(function (props) {
selectedKeys={[group.key]}
treeData={store.treeData}
titleRender={treeRender}
onSelect={(_, {node}) => setGroup(node)}
onSelect={(_, {node}) => handleChangeGrp(node)}
/>
</Col>
<Col span={18}>

View File

@ -35,7 +35,8 @@ export default observer(function () {
<Detail/>
{store.formVisible && <ComForm/>}
{store.importVisible && <ComImport/>}
{store.selectorVisible && <Selector onCancel={() => store.selectorVisible = false} onOk={store.updateGroup}/>}
{store.selectorVisible &&
<Selector oneGroup={!store.addByCopy} onCancel={() => store.selectorVisible = false} onOk={store.updateGroup}/>}
</AuthDiv>
);
})