From db67c55c72b4f506db5f3afaf30ce8af1dcc2312 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期五, 26 十二月 2025 11:00:22 +0800
Subject: [PATCH] no message

---
 rsf-admin/src/page/system/menu/MenuList.jsx |   87 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 74 insertions(+), 13 deletions(-)

diff --git a/rsf-admin/src/page/system/menu/MenuList.jsx b/rsf-admin/src/page/system/menu/MenuList.jsx
index ab0e3c7..74e8c36 100644
--- a/rsf-admin/src/page/system/menu/MenuList.jsx
+++ b/rsf-admin/src/page/system/menu/MenuList.jsx
@@ -127,6 +127,8 @@
     textOverflow: 'ellipsis',
     whiteSpace: 'nowrap',
     maxWidth: 600,
+    // 纭繚鎵�鏈夊崟鍏冩牸鏈夊熀鏈殑鍐呰竟璺�
+    padding: '8px 16px',
 }));
 
 const TreeTableRow = (props) => {
@@ -139,15 +141,41 @@
 
     const isOpen = openNodes[row.id] || false;
 
+    // 鏇存槑鏄剧殑閫忔槑搴︽笎鍙�
+    const getOpacity = (currentDepth) => {
+        // 绗竴绾э細100%锛岀浜岀骇锛�75%锛岀涓夌骇锛�50%锛岀鍥涚骇锛�40%
+        const opacities = [1, 0.9, 0.8, 0.7];
+        return opacities[currentDepth] || 0.4;
+    };
+
+    const opacity = getOpacity(depth);
+
     return (
         <React.Fragment>
-            <StyledTableRow hover tabIndex={-1} key={row.id}>
-                <StyledTableCell sx={{ padding: 0 }}>
-                    {row.children && (
+            <StyledTableRow 
+                hover 
+                tabIndex={-1} 
+                key={row.id}
+                sx={{
+                    opacity: depth > 0 ? opacity : 1,
+                    // 娣诲姞鑳屾櫙鑹叉笎鍙樺寮烘晥鏋�
+                    backgroundColor: depth > 0 ? `rgba(0, 0, 0, ${0.02 * (3 - depth)})` : 'inherit',
+                }}
+            >
+                <StyledTableCell sx={{ 
+                    padding: 0, 
+                    width: 60,
+                    // 杩涗竴姝ュ噺灏忕缉杩涜窛绂诲埌12px
+                    paddingLeft: depth * 4
+                }}>
+                    {row.children && row.children.length > 0 && (
                         <IconButton
                             aria-label="expand row"
                             size="small"
                             onClick={() => toggleNode(row.id)}
+                            sx={{
+                                opacity: depth > 0 ? opacity : 1,
+                            }}
                         >
                             {isOpen ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
                         </IconButton>
@@ -164,10 +192,19 @@
                                 key={column.id}
                                 align={column.align || 'left'}
                                 style={{
-                                    paddingLeft: idx === 0 && (depth * 16 + 16),
-                                    opacity: column.id === 'icon' && .6
+                                    // 鍚嶇О鍒椾篃浣跨敤12px缂╄繘
+                                    paddingLeft: idx === 0 ? (depth * 24 + 16) : 16,
+                                    // opacity: column.id === 'icon' && .6
                                 }}
-                                onClick={() => toggleNode(row.id)}
+                                onClick={() => column.id === 'name' && toggleNode(row.id)}
+                                sx={{
+                                    opacity: column.id === 'icon' ? 0.6 : (depth > 0 ? opacity : 1),
+                                    fontWeight: 400,
+                                    // 浣跨敤瀛椾綋澶у皬鎴栭鑹叉潵鍖哄垎灞傜骇
+                                    fontSize: depth === 0 ? '0.95rem' : '0.9rem',
+                                    // 鎴栬�呬娇鐢ㄤ笉鍚岀殑棰滆壊
+                                    color: depth === 0 ? 'text.primary' : `rgba(0, 0, 0, ${opacity})`,
+                                }}
                             >
                                 {column.format ? column.format(value) : value}
                             </StyledTableCell>
@@ -176,18 +213,30 @@
                 })}
                 <StyledTableCell>
                     <Tooltip title="Edit">
-                        <IconButton onClick={() => onEdit(row)}>
+                        <IconButton 
+                            onClick={() => onEdit(row)}
+                            sx={{
+                                opacity: depth > 0 ? opacity : 1,
+                            }}
+                            size="small"
+                        >
                             <Edit />
                         </IconButton>
                     </Tooltip>
                     <Tooltip title="Delete">
-                        <IconButton onClick={() => onDelete(row)}>
+                        <IconButton 
+                            onClick={() => onDelete(row)}
+                            sx={{
+                                opacity: depth > 0 ? opacity : 1,
+                            }}
+                            size="small"
+                        >
                             <Delete />
                         </IconButton>
                     </Tooltip>
                 </StyledTableCell>
             </StyledTableRow>
-            {row.children && isOpen && (
+            {row.children && row.children.length > 0 && isOpen && (
                 row.children.map((child) => (
                     <TreeTableRow
                         key={child.id}
@@ -217,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', {
@@ -225,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);
         }
     }
 
@@ -255,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);
                     },
                 }
             );
@@ -270,6 +330,7 @@
             const newExpandAll = !prevExpandAll;
             const newOpenNodes = {};
             const updateOpenNodes = (nodes) => {
+                if (!nodes) return;
                 nodes.forEach(node => {
                     newOpenNodes[node.id] = newExpandAll;
                     if (node.children) {
@@ -392,4 +453,4 @@
     );
 };
 
-export default MenuList;
\ No newline at end of file
+export default MenuList;

--
Gitblit v1.9.1