From a41b01a7ee01d96f614fe8264b39363423ec549d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 22 二月 2024 10:11:17 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/system/user/index.jsx |   49 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/zy-asrs-flow/src/pages/system/user/index.jsx b/zy-asrs-flow/src/pages/system/user/index.jsx
index dae8e2a..cd88e37 100644
--- a/zy-asrs-flow/src/pages/system/user/index.jsx
+++ b/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>

--
Gitblit v1.9.1