From d3f479a5e246d808688f85ca0b59e86c92621dbf Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期二, 10 二月 2026 14:38:50 +0800
Subject: [PATCH] 标签浮点处理

---
 rsf-admin/src/layout/TabsBar.jsx |  124 +++++++++++++++++++++++++----------------
 1 files changed, 76 insertions(+), 48 deletions(-)

diff --git a/rsf-admin/src/layout/TabsBar.jsx b/rsf-admin/src/layout/TabsBar.jsx
index 6ffa4c4..cf1d663 100644
--- a/rsf-admin/src/layout/TabsBar.jsx
+++ b/rsf-admin/src/layout/TabsBar.jsx
@@ -275,47 +275,47 @@
         setContextMenuTab(null);
     };
 
-    // 鍏抽棴宸︿晶鏍囩椤碉紙淇濈暀鎸囧畾鏍囩椤靛強鍏跺彸渚х殑鎵�鏈夋爣绛鹃〉锛�
-    // const handleCloseLeft = (keepTabPath) => {
-    //     const keepTabIndex = tabs.findIndex(tab => tab.path === keepTabPath);
-    //     if (keepTabIndex < 0) {
-    //         return;
-    //     }
+    //鍏抽棴宸︿晶鏍囩椤碉紙淇濈暀鎸囧畾鏍囩椤靛強鍏跺彸渚х殑鎵�鏈夋爣绛鹃〉锛�
+    const handleCloseLeft = (keepTabPath) => {
+        const keepTabIndex = tabs.findIndex(tab => tab.path === keepTabPath);
+        if (keepTabIndex < 0) {
+            return;
+        }
 
-    //     // 淇濈暀鎸囧畾鏍囩椤靛強鍏跺彸渚х殑鎵�鏈夋爣绛鹃〉
-    //     const newTabs = tabs.slice(keepTabIndex);
+        // 淇濈暀鎸囧畾鏍囩椤靛強鍏跺彸渚х殑鎵�鏈夋爣绛鹃〉
+        const newTabs = tabs.slice(keepTabIndex);
 
-    //     // 纭繚dashboard濮嬬粓鍦ㄧ涓�浣嶏紙濡傛灉瀛樺湪锛�
-    //     const dashboardTab = newTabs.find(tab => tab.path === '/dashboard');
-    //     if (dashboardTab && newTabs[0].path !== '/dashboard') {
-    //         const dashboardIndex = newTabs.findIndex(tab => tab.path === '/dashboard');
-    //         if (dashboardIndex > 0) {
-    //             newTabs.splice(dashboardIndex, 1);
-    //             newTabs.unshift(dashboardTab);
-    //         }
-    //     }
+        // 纭繚dashboard濮嬬粓鍦ㄧ涓�浣嶏紙濡傛灉瀛樺湪锛�
+        const dashboardTab = newTabs.find(tab => tab.path === '/dashboard');
+        if (dashboardTab && newTabs[0].path !== '/dashboard') {
+            const dashboardIndex = newTabs.findIndex(tab => tab.path === '/dashboard');
+            if (dashboardIndex > 0) {
+                newTabs.splice(dashboardIndex, 1);
+                newTabs.unshift(dashboardTab);
+            }
+        }
 
-    //     saveTabs(newTabs);
-    //     setTabs(newTabs);
-    //     setContextMenu(null);
-    //     setContextMenuTab(null);
-    // };
+        saveTabs(newTabs);
+        setTabs(newTabs);
+        setContextMenu(null);
+        setContextMenuTab(null);
+    };
 
     // 鍏抽棴鍙充晶鏍囩椤碉紙淇濈暀鎸囧畾鏍囩椤靛強鍏跺乏渚х殑鎵�鏈夋爣绛鹃〉锛�
-    // const handleCloseRight = (keepTabPath) => {
-    //     const keepTabIndex = tabs.findIndex(tab => tab.path === keepTabPath);
-    //     if (keepTabIndex < 0) {
-    //         return;
-    //     }
+    const handleCloseRight = (keepTabPath) => {
+        const keepTabIndex = tabs.findIndex(tab => tab.path === keepTabPath);
+        if (keepTabIndex < 0) {
+            return;
+        }
 
-    //     // 淇濈暀鎸囧畾鏍囩椤靛強鍏跺乏渚х殑鎵�鏈夋爣绛鹃〉
-    //     const newTabs = tabs.slice(0, keepTabIndex + 1);
+        // 淇濈暀鎸囧畾鏍囩椤靛強鍏跺乏渚х殑鎵�鏈夋爣绛鹃〉
+        const newTabs = tabs.slice(0, keepTabIndex + 1);
 
-    //     saveTabs(newTabs);
-    //     setTabs(newTabs);
-    //     setContextMenu(null);
-    //     setContextMenuTab(null);
-    // };
+        saveTabs(newTabs);
+        setTabs(newTabs);
+        setContextMenu(null);
+        setContextMenuTab(null);
+    };
 
     // 澶勭悊鍙抽敭鑿滃崟
     const handleContextMenu = (event, tab) => {
@@ -373,18 +373,18 @@
     };
 
     // 鍙抽敭鑿滃崟锛氬叧闂乏渚ф爣绛�
-    // const handleCloseLeftTabs = () => {
-    //     if (contextMenuTab) {
-    //         handleCloseLeft(contextMenuTab.path);
-    //     }
-    // };
+    const handleCloseLeftTabs = () => {
+        if (contextMenuTab) {
+            handleCloseLeft(contextMenuTab.path);
+        }
+    };
 
     // 鍙抽敭鑿滃崟锛氬叧闂彸渚ф爣绛�
-    // const handleCloseRightTabs = () => {
-    //     if (contextMenuTab) {
-    //         handleCloseRight(contextMenuTab.path);
-    //     }
-    // };
+    const handleCloseRightTabs = () => {
+        if (contextMenuTab) {
+            handleCloseRight(contextMenuTab.path);
+        }
+    };
 
 
     // 鑾峰彇褰撳墠鏍囩椤电储寮�
@@ -549,13 +549,33 @@
                         ? { top: contextMenu.mouseY, left: contextMenu.mouseX }
                         : undefined
                 }
+                PaperProps={{
+                    sx: {
+                        minWidth: 120,
+                        borderRadius: '8px',
+                        boxShadow: '0 4px 20px rgba(0,0,0,0.08)',
+                        mt: 0.5,
+                        py: 0.5,
+                    },
+                }}
+                MenuListProps={{
+                    sx: { py: 0 },
+                }}
             >
                 {contextMenuTab && contextMenuTab.closable && (
-                    <MenuItem onClick={handleCloseCurrentTab}>
+                    <MenuItem
+                        onClick={handleCloseCurrentTab}
+                        sx={{
+                            fontSize: '0.8125rem',
+                            py: 0.75,
+                            px: 1.5,
+                            minHeight: 'auto',
+                        }}
+                    >
                         {t('ra.action.close', '鍏抽棴褰撳墠鏍囩')}
                     </MenuItem>
                 )}
-                {/* {contextMenuTab && canCloseLeftForTab(contextMenuTab.path) && (
+                {contextMenuTab && canCloseLeftForTab(contextMenuTab.path) && (
                     <MenuItem onClick={handleCloseLeftTabs}>
                         {t('ra.action.closeLeft', '鍏抽棴宸︿晶鏍囩')}
                     </MenuItem>
@@ -564,9 +584,17 @@
                     <MenuItem onClick={handleCloseRightTabs}>
                         {t('ra.action.closeRight', '鍏抽棴鍙充晶鏍囩')}
                     </MenuItem>
-                )} */}
+                )}
                 {contextMenuTab && canCloseOthersForTab(contextMenuTab.path) && (
-                    <MenuItem onClick={handleCloseOtherTabs}>
+                    <MenuItem
+                        onClick={handleCloseOtherTabs}
+                        sx={{
+                            fontSize: '0.8125rem',
+                            py: 0.75,
+                            px: 1.5,
+                            minHeight: 'auto',
+                        }}
+                    >
                         {t('ra.action.closeOthers', '鍏抽棴鍏朵粬鏍囩')}
                     </MenuItem>
                 )}

--
Gitblit v1.9.1