From 3215e24a462ee364ead6709b0ef238b1f43015c4 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 21 二月 2024 16:15:14 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/system/user/index.jsx |   83 +++++++++++++++++++++++++++++++++++------
 1 files changed, 70 insertions(+), 13 deletions(-)

diff --git a/zy-asrs-flow/src/pages/system/user/index.jsx b/zy-asrs-flow/src/pages/system/user/index.jsx
index a5c0d6a..70fe28f 100644
--- a/zy-asrs-flow/src/pages/system/user/index.jsx
+++ b/zy-asrs-flow/src/pages/system/user/index.jsx
@@ -10,6 +10,7 @@
 import { PlusOutlined, ExportOutlined, DownOutlined } from '@ant-design/icons';
 import Http from '@/utils/http';
 import Edit from './components/edit'
+import Pwd from './components/pwd'
 import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
 import { transformTreeData, getTreeAllKeys } from '@/utils/tree-util'
 import { statusMap } from '@/utils/enum-util'
@@ -88,6 +89,25 @@
     }
 };
 
+const handlePwd = async (val) => {
+    const hide = message.loading('姝e湪閲嶇疆');
+    try {
+        const resp = await Http.doPost('api/user/reset/pwd', val);
+        if (resp.code === 200) {
+            message.success('閲嶇疆鎴愬姛');
+            return true;
+        } else {
+            message.error(resp.msg);
+            return false;
+        }
+    } catch (error) {
+        message.error('閲嶇疆澶辫触璇烽噸璇曪紒');
+        return false;
+    } finally {
+        hide();
+    }
+};
+
 
 const Main = () => {
     const formTableRef = useRef();
@@ -99,6 +119,7 @@
     const [boxHeight, setBoxHeight] = useState();
     const [deptTreeData, setDeptTreeData] = useState([]);
     const [deptExpandedKeys, setDeptExpandedKeys] = useState([]);
+    const [pwdModalVisible, setPwdModalVisible] = useState(false);
 
     useEffect(() => {
         const handleResize = () => setBoxHeight(window.innerHeight - 368);
@@ -125,12 +146,11 @@
             width: 30,
         },
         {
-            title: '鏄电О',
+            title: '鍚嶇О',
             dataIndex: 'nickname',
             valueType: 'text',
             hidden: false,
             width: 100,
-            copyable: true,
             filterDropdown: (props) => <TextFilter
                 name='nickname'
                 {...props}
@@ -139,7 +159,7 @@
             />,
         },
         {
-            title: '璐﹀彿',
+            title: '鐧诲綍璐﹀彿',
             dataIndex: 'username',
             valueType: 'text',
             hidden: false,
@@ -264,13 +284,13 @@
                     return '-'
                 }
             },
-            filterDropdown: (props) => <LinkFilter
-                name='deptId'
-                major='dept'
-                {...props}
-                actionRef={actionRef}
-                setSearchParam={setSearchParam}
-            />,
+            // filterDropdown: (props) => <LinkFilter
+            //     name='deptId'
+            //     major='dept'
+            //     {...props}
+            //     actionRef={actionRef}
+            //     setSearchParam={setSearchParam}
+            // />,
         },
         {
             title: '鐪熷疄濮撳悕',
@@ -402,7 +422,7 @@
         {
             title: '鎿嶄綔',
             dataIndex: 'option',
-            width: 100,
+            width: 150,
             valueType: 'option',
             render: (_, record) => [
                 <Button
@@ -414,6 +434,16 @@
                     }}
                 >
                     缂栬緫
+                </Button>,
+                <Button
+                    type="link"
+                    key="pwd"
+                    onClick={() => {
+                        setPwdModalVisible(true);
+                        setCurrentRow(record);
+                    }}
+                >
+                    閲嶇疆瀵嗙爜
                 </Button>,
                 <Button
                     type="link"
@@ -462,6 +492,7 @@
                             blockNode
                             defaultExpandAll    // 寮傛鍔犺浇澶辨晥
                             expandedKeys={deptExpandedKeys}
+                            onExpand={setDeptExpandedKeys} 
                             treeData={deptTreeData}
                             switcherIcon={<DownOutlined />}
                             onSelect={(selectedKeys, info) => {
@@ -483,7 +514,7 @@
                         formRef={formTableRef}
                         columns={columns}
                         cardBordered
-                        scroll={{y: boxHeight }}
+                        scroll={{ y: boxHeight }}
                         dateFormatter="string"
                         pagination={{ pageSize: 20 }}
                         search={false}
@@ -527,7 +558,7 @@
                             ],
                         }}
                         request={(params, sorter, filter) =>
-                            Http.doPostPromise('/api/user/page', { ...params, ...searchParam }, (res) => {
+                            Http.doPostPromise('/api/user/page1', { ...params, ...searchParam }, (res) => {
                                 return {
                                     data: res.data.records,
                                     total: res.data.total,
@@ -587,6 +618,7 @@
                 <Edit
                     open={modalVisible}
                     values={currentRow || {}}
+                    treeData={deptTreeData}
                     onCancel={
                         () => {
                             setModalVisible(false);
@@ -610,6 +642,31 @@
                     }
                     }
                 />
+
+                <Pwd
+                    open={pwdModalVisible}
+                    values={currentRow || {}}
+                    onCancel={
+                        () => {
+                            setPwdModalVisible(false);
+                            setCurrentRow(undefined);
+                        }
+                    }
+                    onSubmit={async (values) => {
+                        let ok = false;
+                        if (values.id) {
+                            ok = await handlePwd({ ...values })
+                        }
+                        if (ok) {
+                            setPwdModalVisible(false);
+                            setCurrentRow(undefined);
+                            if (actionRef.current) {
+                                actionRef.current.reload();
+                            }
+                        }
+                    }
+                    }
+                />
             </Row>
         </PageContainer>
     );

--
Gitblit v1.9.1