mirror of https://github.com/openspug/spug
				
				
				
			fix issue
							parent
							
								
									1883dba226
								
							
						
					
					
						commit
						10c782e186
					
				| 
						 | 
				
			
			@ -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}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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}>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
  );
 | 
			
		||||
})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue