From 1e42773a05285543be5f18b352a8b5884c02273c Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 11 六月 2025 17:16:14 +0800
Subject: [PATCH] 库口修改问题修复 下发执行单据明细添加多选显示功能 库存信息删除按钮显示问题修复 库存信息删除分页信息

---
 rsf-admin/src/page/orders/outStock/OutStockPublic.jsx |   86 ++++++++++++++++++++++---------------------
 1 files changed, 44 insertions(+), 42 deletions(-)

diff --git a/rsf-admin/src/page/orders/outStock/OutStockPublic.jsx b/rsf-admin/src/page/orders/outStock/OutStockPublic.jsx
index 3a9f70b..e63b5a2 100644
--- a/rsf-admin/src/page/orders/outStock/OutStockPublic.jsx
+++ b/rsf-admin/src/page/orders/outStock/OutStockPublic.jsx
@@ -47,7 +47,6 @@
 import ConfirmButton from '../../components/ConfirmButton';
 import { Delete, Edit, Add } from '@mui/icons-material';
 import OutStockSiteDialog from "./OutStockSiteDialog";
-import { color } from "framer-motion";
 
 const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
     '& .css-1vooibu-MuiSvgIcon-root': {
@@ -58,14 +57,18 @@
     },
     '& .column-maktx': {
         width: 200
+    },
+    '& .RaBulkActionsToolbar-toolbar': {
+        display: 'none'
     }
+
 }));
 
 const OutStockPublic = (props) => {
     const { record, open, setOpen } = props;
     const notify = useNotify();
     const gridRef = useGridApiRef();
-    const [rows, setRows] = useState({});
+    const [rows, setRows] = useState([]);
     const translate = useTranslate();
     const [selectedIds, setSelectedIds] = useState([]);
     const [formData, setFormData] = useState({
@@ -83,10 +86,10 @@
         setDialog(false);
         setSelectedValue(value);
         const newRows = rows.map(item => {
-            return {
+            return selectedIds.includes(item?.id) ? {
                 ...item,
                 siteNo: value?.site
-            }
+            } : item
         })
         setRows(newRows);
     };
@@ -159,7 +162,7 @@
                                 />
                                 <StyledDatagrid
                                     preferenceKey='outStockItem'
-                                    bulkActionButtons={false}
+                                    bulkActionButtons={<></>}
                                     rowClick={false}
                                     omit={['id', 'splrName', 'qty', 'poCode', 'workQty']}
                                 >
@@ -185,6 +188,7 @@
                                     gridRef={gridRef}
                                     setRows={setRows}
                                     record={record}
+                                    formData={formData}
                                     selectedIds={selectedIds}
                                     setDialog={setDialog}
                                     setSelectedIds={setSelectedIds}
@@ -209,11 +213,18 @@
     );
 }
 
-const PreviewTable = ({ rows, gridRef, setRows, record, selectedIds, setSelectedIds, setDialog }) => {
+const PreviewTable = ({ rows, gridRef, setRows, record, selectedIds, setSelectedIds, setDialog, formData }) => {
     gridRef.current = useGridApiRef();
     const translate = useTranslate();
 
-    const columns = [
+    useEffect(() => {
+        if (selectedIds.length > 0) {
+            console.log(selectedIds);
+        }
+    }, [selectedIds])
+
+
+    const baseColumns = [
         // { field: 'id', headerName: 'ID', width: 40 },
         { field: 'locCode', headerName: '搴撲綅', width: 110 },
         { field: 'barcode', headerName: '瀹瑰櫒', width: 120 },
@@ -240,20 +251,23 @@
                 <OutStockSite {...params} />
             ),
         },
-        {
-            field: 'actions',
-            type: 'actions',
-            headerName: '鎿嶄綔',
-            with: 120,
-            getActions: (params) => [
-                <GridActionsCellItem
-                    icon={<Delete />}
-                    label="Delete"
-                    onClick={() => handleDelete(params.row, rows, setRows)}
-                />,
-            ]
-        },
     ]
+
+    const optAction = {
+        field: 'actions',
+        type: 'actions',
+        headerName: translate('common.field.opt'),
+        with: 120,
+        getActions: (params) => [
+            <GridActionsCellItem
+                icon={<Delete />}
+                label="Delete"
+                onClick={() => handleDelete(params.row, rows, setRows)}
+            />,
+        ]
+    }
+
+    const columns = (formData.waveId == 15 || formData.waveId == 16) ? [...baseColumns] : [...baseColumns, optAction];
 
     /**
      * 鍒犻櫎浜嬩欢
@@ -270,15 +284,12 @@
         const { value } = props;
         return (
             value > 0 ?
-                <Box
-                    sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
-                >
+                <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                     <span>{value}</span>
-                </Box> :
-                <Box
-                    sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
-                >
-                    <span style={{color: 'red'}}>{translate('common.edit.title.insuffInventory')}</span>
+                </Box>
+                :
+                <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
+                    <span style={{ color: 'red' }}>{translate('common.edit.title.insuffInventory')}</span>
                 </Box>
         );
     });
@@ -289,9 +300,7 @@
             return null;
         }
         return (
-            <Box
-                sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
-            >
+            <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                 <span>{value}</span>
             </Box>
         );
@@ -301,9 +310,8 @@
         const selectSiteNo = () => {
             setDialog(true)
         }
-
         return (
-            selectedIds.length > 0 ? <Box sx={{
+            <Box sx={{
                 p: 1,
                 display: 'flex',
                 justifyContent: 'flex-end',
@@ -315,7 +323,7 @@
                     label="toolbar.modiftySite"
                     size="medium"
                     sx={{ mr: 1 }} />
-            </Box> : <></>
+            </Box>
         );
     }
 
@@ -375,16 +383,10 @@
             columns={columns}
             slots={{ toolbar: CustomToolBar }}
             apiRef={gridRef}
-            initialState={{
-                pagination: {
-                    paginationModel: {
-                        pageSize: 15,
-                    },
-                },
-            }}
             checkboxSelection
             disableRowSelectionOnClick
-            pageSizeOptions={[15, 25, 35, 45]}
+            hideFooterPagination={true}  // 闅愯棌鍒嗛〉鎺т欢
+            hideFooter={false}
             onRowSelectionModelChange={(ids) => {
                 setSelectedIds(ids)
             }}

--
Gitblit v1.9.1