From 209878277a178ab91d48b523265e5ffb1b8cf7e6 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期一, 09 三月 2026 16:18:21 +0800
Subject: [PATCH] 库位转移,优化查询速度

---
 rsf-admin/src/page/components/StickyDataTable.jsx |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/rsf-admin/src/page/components/StickyDataTable.jsx b/rsf-admin/src/page/components/StickyDataTable.jsx
index 728665b..2eaa4b6 100644
--- a/rsf-admin/src/page/components/StickyDataTable.jsx
+++ b/rsf-admin/src/page/components/StickyDataTable.jsx
@@ -1,5 +1,5 @@
 
-import React, { useMemo } from 'react';
+import React, { useMemo, useRef, useEffect } from 'react';
 import { DataTable, useDataTableDataContext, useTranslate } from 'react-admin';
 import { TableFooter, TableRow, TableCell } from '@mui/material';
 
@@ -63,6 +63,10 @@
  * DataTable 鏍峰紡甯搁噺
  */
 const tableStyles = {
+    '& .RaBulkActionsToolbar-toolbar': {
+        top: 0,
+        zIndex: 6,
+    },
     '& .MuiTableCell-head': {
         zIndex: 4,
         borderBottom: 'none'
@@ -140,12 +144,14 @@
  *   - label: 鏄剧ず鐨勬爣绛撅紝鏀寔缈昏瘧 key 鎴栫洿鎺ユ樉绀虹殑鏂囨湰
  *   - render: 鍙�夛紝鑷畾涔夋覆鏌撳嚱鏁� (value, data) => ReactNode
  * @param {string} props.footerLabel - footer 绗竴鍒楁爣绛撅紝榛樿'鍚堣'
+ * @param {number} props.bulkActionsOffsetY - 鎵归噺鎿嶄綔鏍忓睍寮�鏃跺悜涓嬪亸绉伙紙px锛�
  */
 export const StickyDataTable = ({
     stickyLeft = [],
     stickyRight = [],
     footerConfig,
     footerLabel = '鍚堣',
+    bulkActionsOffsetY = 0,
     children,
     ...props
 }) => {
@@ -197,8 +203,37 @@
         return () => <StickyTableFooter footerConfig={footerConfig} footerLabel={footerLabel} />;
     }, [footerConfig, footerLabel]);
 
+    const dataTableStyles = useMemo(() => {
+        return {
+            ...tableStyles,
+            '& .RaBulkActionsToolbar-toolbar:not(.RaBulkActionsToolbar-collapsed)': {
+                transform: `translateY(${bulkActionsOffsetY}px)`,
+                zIndex: 10,
+                opacity: 1,
+            },
+            '& .RaBulkActionsToolbar-toolbar.RaBulkActionsToolbar-collapsed': {
+                zIndex: 10,
+                opacity: 1,
+            },
+        };
+    }, [bulkActionsOffsetY]);
+
+    const containerRef = useRef(null);
+    useEffect(() => {
+        const el = containerRef.current;
+        if (!el) return;
+        const clearExpandIconAriaHidden = () => {
+            el.querySelectorAll('.RaDataTable-expandIcon').forEach((btn) => btn.removeAttribute('aria-hidden'));
+        };
+        clearExpandIconAriaHidden();
+        const mo = new MutationObserver(clearExpandIconAriaHidden);
+        mo.observe(el, { attributes: true, attributeFilter: ['aria-hidden'], subtree: true });
+        return () => mo.disconnect();
+    }, []);
+
     return (
-        <DataTable {...props} foot={footerComponent} sx={tableStyles}>
+        <span ref={containerRef} style={{ display: 'contents' }}>
+        <DataTable {...props} foot={footerComponent} sx={dataTableStyles}>
             {/* {processedChildren} */}
             {processedChildren
                 .map((column) => (
@@ -213,6 +248,7 @@
                 ))
             }
         </DataTable>
+        </span>
     );
 };
 

--
Gitblit v1.9.1