From c229a84e0a8eb68c974e6d23fa1296e064025d76 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 29 七月 2025 17:09:00 +0800
Subject: [PATCH] 调拔单功能优化

---
 rsf-admin/src/page/statistics/stockManage/WarehouseStockList.jsx |   72 +++++++++++++++++++++++++++--------
 1 files changed, 55 insertions(+), 17 deletions(-)

diff --git a/rsf-admin/src/page/statistics/stockManage/WarehouseStockList.jsx b/rsf-admin/src/page/statistics/stockManage/WarehouseStockList.jsx
index b50474b..94fb604 100644
--- a/rsf-admin/src/page/statistics/stockManage/WarehouseStockList.jsx
+++ b/rsf-admin/src/page/statistics/stockManage/WarehouseStockList.jsx
@@ -52,28 +52,36 @@
     '& .RaDatagrid-row': {
         cursor: 'auto'
     },
-    '& .column-name': {
+    '& .MuiTableCell-root': {
+    whiteSpace: 'nowrap',
+    overflow: 'visible',
+    textOverflow: 'unset'
     },
     '& .opt': {
-        width: 180
+        width: 180,
+        whiteSpace: 'normal',
+    },
+    '& .column-maktx': {        
+        maxWidth: '15em',
+        overflow: 'hidden',
+        textOverflow: 'ellipsis',
+        whiteSpace: 'nowrap',    
     },
 }));
 
 
+
 const WarehouseStockList = () => {
+    const dict = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_stock_summary_code')) || [];
+
     const translate = useTranslate();
     const [createDialog, setCreateDialog] = useState(false);
-    const [select, setSelect] = useState({});
-    const [drawerVal, setDrawerVal] = useState(false);
-
-    const filters = [
+    const [filters, setFilters] = useState([
         <SearchInput source="condition" alwaysOn />,
         <NumberInput source="locId" label="table.field.locItem.locId" />,
         <TextInput source="locCode" label="table.field.locItem.locCode" />,
         <TextInput source="type" label="table.field.locItem.type" />,
-        <ReferenceInput source="aggType" reference="dictData" filter={{ dictTypeCode: 'sys_stock_summary_code' }} alwaysOn>
-            <AutocompleteInput optionText='label' optionValue="value" label="table.field.locItem.aggType" />
-        </ReferenceInput>,
+        <AutocompleteInput choices={dict} optionText='label' optionValue="value" source="aggType" label="table.field.locItem.aggType" />,
         <NumberInput source="orderItemId" label="table.field.locItem.orderItemId" />,
         <NumberInput source="wkType" label="table.field.locItem.wkType" />,
         <NumberInput source="matnrId" label="table.field.locItem.matnrId" />,
@@ -85,8 +93,9 @@
         <TextInput source="spec" label="table.field.locItem.spec" />,
         <TextInput source="model" label="table.field.locItem.model" />,
         <TextInput source="fieldsIndex" label="table.field.locItem.fieldsIndex" />,
-        <TextInput label="common.field.memo" source="memo" />,
-    ]
+        <TextInput label="common.field.memo" source="memo" />,]);
+    const [select, setSelect] = useState({});
+    const [drawerVal, setDrawerVal] = useState(false);
 
     return (
         <>
@@ -99,10 +108,14 @@
                                 duration: theme.transitions.duration.enteringScreen,
                             }),
                         marginRight: 0,
+                        '& .RaAutocompleteInput-textField.MuiFormControl-root.MuiTextField-root': {
+                            width: '200px'
+                        }
                     }}
                     resource="warehouse/stock"
                     title={"common.button.detail"}
                     empty={false}
+                    // filter={{aggType: "matnr"}}
                     filters={filters}
                     sort={{ field: "create_time", order: "desc" }}
                     actions={(
@@ -119,6 +132,7 @@
                         setDrawerVal={setDrawerVal}
                         setCreateDialog={setCreateDialog}
                         setSelect={setSelect}
+                        filters={filters}
                     />
                 </List>
                 <WarehouseStockInfo
@@ -138,9 +152,19 @@
 
 export default WarehouseStockList;
 
+const PaginatedRowNumber = () => {
+    const record = useRecordContext();
+    const { page, perPage } = useListContext();
+    const index = record.__tmp_index !== undefined ? record.__tmp_index : 0;
+    //   const index = record.__tmp_index; // react-admin 鍐呴儴浣跨敤鐨勪复鏃剁储寮�
+    return <span>{(page - 1) * perPage + index + 1}</span>;
+};
+
+
 
 const DynamicFields = (props) => {
-    const {setDrawerVal, setCreateDialog, setSelect} = props
+    const index = 1;
+    const { setDrawerVal, setCreateDialog, setSelect, filters } = props
     const translate = useTranslate();
     const notify = useNotify();
     const [columns, setColumns] = useState([]);
@@ -166,6 +190,7 @@
                 <NumberField source="workQty" label="table.field.warehouseStock.qty" />,
                 <TextField source="spec" label="table.field.warehouseStock.spec" />,
                 <TextField source="model" label="table.field.warehouseStock.model" />,
+                <TextField source="warehouse$" label="table.field.warehouseStock.warehouse" />,
                 <TextField source="batch" label="table.field.warehouseStock.batch" />,
                 <TextField source="unit" label="table.field.warehouseStock.unit" />,
                 <TextField source="fieldsIndex" label="table.field.warehouseStock.fieldsIndex" />,
@@ -180,6 +205,18 @@
                 </WrapperField>
             ]
             setColumns([...arr, ...fields, ...lastArr]);
+
+            data.map(el => {
+                var i = 0;
+                filters.map((item) => {
+                    if (item.key === el.fields) {
+                        i = 1;
+                    }
+                })
+                i === 0 && filters.push(<TextInput key={el.fields} source={el.fields} label={el.fieldsAlise} />)
+            })
+            // setFilters([...filters, ...inputFields])
+
         } else {
             notify(msg);
         }
@@ -205,7 +242,7 @@
                     rowClick={false}
                     expand={false}
                     expandSingle={true}
-                    omit={['id', 'createTime', 'locId', 'spec', 'model', 'locCode', 'orderId', 'orderItemId', 'matnrId', 'splrBatch', 'createBy', 'memo', 'fieldsIndex']}
+                    omit={['id', 'createTime', 'locId', 'spec', 'model', 'locCode', 'orderId', 'orderItemId', 'matnrId', 'splrBatch', 'createBy', 'memo', 'fieldsIndex','updateBy$']}
                 >
                     {columns.map((column) => column)}
                 </StyledDatagrid>}
@@ -213,13 +250,14 @@
     )
 }
 
-
 const HistoriesButton = ({ setDrawerVal, setSelect }) => {
     const record = useRecordContext();
+    const { filterValues } = useListContext();
     const historyClick = (event) => {
         event.stopPropagation();
         setDrawerVal(true)
-        setSelect(record)
+        const objRecord = { ...record, ...filterValues }
+        setSelect(objRecord)
     }
     return (
         <Button label="common.button.histories" onClick={historyClick}></Button>
@@ -228,11 +266,11 @@
 
 const StockInfoButton = ({ setCreateDialog, setSelect }) => {
     const record = useRecordContext();
-    const {filterValues} = useListContext();
+    const { filterValues } = useListContext();
     const stockClick = (event) => {
         event.stopPropagation();
         setCreateDialog(true)
-        const objRecord = {...record, ...filterValues}
+        const objRecord = { ...record, ...filterValues }
         setSelect(objRecord)
     }
 

--
Gitblit v1.9.1