#
luxiaotao1123
2024-02-22 a41b01a7ee01d96f614fe8264b39363423ec549d
#
1个文件已修改
49 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/system/user/index.jsx 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/system/user/index.jsx
@@ -1,6 +1,6 @@
import React, { useState, useRef, useEffect } from 'react';
import { Button, message, Modal, Row, Col, Card, Tree, Input, Tag } from 'antd';
import { Button, message, Modal, Row, Col, Card, Tree, Input, Tag, Skeleton } from 'antd';
import {
    FooterToolbar,
    PageContainer,
@@ -116,13 +116,18 @@
    const [modalVisible, setModalVisible] = useState(false);
    const [currentRow, setCurrentRow] = useState();
    const [searchParam, setSearchParam] = useState({});
    const [boxHeight, setBoxHeight] = useState();
    const [deptTreeLoading, setDeptTreeLoading] = useState(false);
    const [deptTreeData, setDeptTreeData] = useState([]);
    const [deptExpandedKeys, setDeptExpandedKeys] = useState([]);
    const [pwdModalVisible, setPwdModalVisible] = useState(false);
    const loadDeptTreeData = (param) => {
        setDeptTreeLoading(true);
        Http.doPostPromise('/api/dept/tree', param, (res) => {
            setDeptTreeLoading(false);
            const rootMenu = { id: 0, name: '全部', value: 0, children: [] };
            rootMenu.children = res.data;
            // const treeData = transformTreeData([rootMenu]);
@@ -130,6 +135,8 @@
            setDeptTreeData(treeData);
            const treeAllKeys = getTreeAllKeys(treeData);
            setDeptExpandedKeys(treeAllKeys);
        }).catch((err) => {
            setDeptTreeLoading(false);
        })
    }
@@ -494,24 +501,28 @@
                                })
                            }}
                        />
                        <div style={{height: 'calc(100vh - 350px)', overflowY: 'auto' }}>
                            <Tree
                                showLine
                                blockNode
                                defaultExpandAll    // 异步加载失效
                                expandedKeys={deptExpandedKeys}
                                onExpand={setDeptExpandedKeys}
                                treeData={deptTreeData}
                                switcherIcon={<DownOutlined />}
                                onSelect={(selectedKeys, info) => {
                                    const deptId = selectedKeys[0];
                                    setSearchParam(prevState => ({
                                        ...prevState,
                                        deptId: deptId
                                    }));
                                    actionRef.current?.reload();
                                }}
                            />
                        <div style={{ height: 'calc(100vh - 350px)', overflowY: 'auto' }}>
                            {deptTreeLoading ? (
                                <Skeleton active />
                            ) : (
                                < Tree
                                    showLine
                                    blockNode
                                    defaultExpandAll    // 异步加载失效
                                    expandedKeys={deptExpandedKeys}
                                    onExpand={setDeptExpandedKeys}
                                    treeData={deptTreeData}
                                    switcherIcon={<DownOutlined />}
                                    onSelect={(selectedKeys, info) => {
                                        const deptId = selectedKeys[0];
                                        setSearchParam(prevState => ({
                                            ...prevState,
                                            deptId: deptId
                                        }));
                                        actionRef.current?.reload();
                                    }}
                                />
                            )}
                        </div>
                    </Card>
                </Col>