chen.lin
1 天以前 c81fc5e2a4f4153be2bb8602ed14a0743e6ecd29
rsf-admin/src/layout/index.jsx
@@ -1,13 +1,28 @@
import { createPortal } from 'react-dom';
import { useLocation } from 'react-router-dom';
import { Layout as RALayout, CheckForApplicationUpdate, useSidebarState } from "react-admin";
import AppBar from './AppBar';
import { MyMenu } from './MyMenu';
import TabsBar from './TabsBar';
import { Box } from '@mui/material';
import { TabDialogStateProvider } from '@/context/TabDialogStateContext';
/** RCS测试独立页路由:不显示侧边栏和标签栏,整页只显示RCS测试内容 */
const RCS_TEST_STANDALONE_PATH = '/rcsTest-page';
const LayoutContent = ({ children }) => {
  const location = useLocation();
  const [sidebarIsOpen] = useSidebarState();
  const sidebarWidth = sidebarIsOpen ? 200 : 50;
  if (location.pathname === RCS_TEST_STANDALONE_PATH) {
    return (
      <Box sx={{ width: '100%', height: '100vh', overflow: 'hidden' }}>
        {children}
        <CheckForApplicationUpdate />
      </Box>
    );
  }
  const tabsBarEl = (
    <Box sx={{
@@ -15,7 +30,7 @@
      top: 48,
      left: sidebarWidth + 5,
      right: 0,
      zIndex: 1400, // 高于 Dialog/Modal(1300),通过 Portal 挂到 body 才能盖住弹窗
      zIndex: 1200, // 低于 Dialog/Modal 与 Select/Menu(1300),避免标签页遮盖下发窗口内的下拉(如出库策略:效率优先/先进先出)
      transition: (theme) =>
        theme.transitions.create('left', {
          easing: theme.transitions.easing.sharp,
@@ -47,7 +62,9 @@
      }}
    >
      {createPortal(tabsBarEl, document.body)}
      {children}
      <TabDialogStateProvider>
        {children}
      </TabDialogStateProvider>
      <CheckForApplicationUpdate />
    </RALayout>
  );