From 6166b702c4cf716302e44cc118bc8e5fc8e909b3 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 25 十二月 2025 16:11:18 +0800
Subject: [PATCH] 问题修复及优化

---
 rsf-admin/src/page/system/menu/MenuList.jsx |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/rsf-admin/src/page/system/menu/MenuList.jsx b/rsf-admin/src/page/system/menu/MenuList.jsx
index 5c50e52..74e8c36 100644
--- a/rsf-admin/src/page/system/menu/MenuList.jsx
+++ b/rsf-admin/src/page/system/menu/MenuList.jsx
@@ -199,7 +199,6 @@
                                 onClick={() => column.id === 'name' && toggleNode(row.id)}
                                 sx={{
                                     opacity: column.id === 'icon' ? 0.6 : (depth > 0 ? opacity : 1),
-                                    color: depth > 0 ? `rgba(0, 0, 0, ${opacity})` : 'inherit',
                                     fontWeight: 400,
                                     // 浣跨敤瀛椾綋澶у皬鎴栭鑹叉潵鍖哄垎灞傜骇
                                     fontSize: depth === 0 ? '0.95rem' : '0.9rem',
@@ -267,6 +266,14 @@
     const [editRecord, setEditRecord] = React.useState(null);
     const [openNodes, setOpenNodes] = React.useState({});
     const [expandAll, setExpandAll] = React.useState(false);
+    const notifyState = React.useRef({ last: '', at: 0 });
+    const pushNotify = React.useCallback((type, msg) => {
+        const text = typeof msg === 'string' ? msg : (msg || '');
+        const now = Date.now();
+        if (notifyState.current.last === text && now - notifyState.current.at < 1500) return;
+        notifyState.current = { last: text, at: now };
+        notify(text, { type, messageArgs: { _: text } });
+    }, [notify]);
 
     const http = async () => {
         const res = await request.post(RESOURCE + '/tree', {
@@ -275,7 +282,8 @@
         if (res?.data?.code === 200) {
             setTreeData(res.data.data);
         } else {
-            notify(res.data.msg);
+            const msg = translate('ra.notification.http_error', { _: res?.data?.msg || 'Request failed' });
+            pushNotify('warning', msg);
         }
     }
 
@@ -305,10 +313,12 @@
                 {
                     onSuccess: () => {
                         handleRefresh();
-                        notify('Department deleted successfully', { type: 'info', messageArgs: { _: 'Department deleted successfully' } });
+                        const msg = translate('ra.message.delete_success', { _: 'Deleted successfully' });
+                        pushNotify('success', msg);
                     },
                     onError: (error) => {
-                        notify(`Error: ${error.message}`, { type: 'warning', messageArgs: { _: `Error: ${error.message}` } });
+                        const msg = translate('ra.notification.http_error', { _: error?.message || 'Network error' });
+                        pushNotify('error', msg);
                     },
                 }
             );
@@ -320,6 +330,7 @@
             const newExpandAll = !prevExpandAll;
             const newOpenNodes = {};
             const updateOpenNodes = (nodes) => {
+                if (!nodes) return;
                 nodes.forEach(node => {
                     newOpenNodes[node.id] = newExpandAll;
                     if (node.children) {
@@ -442,4 +453,4 @@
     );
 };
 
-export default MenuList;
\ No newline at end of file
+export default MenuList;

--
Gitblit v1.9.1