From 27f5533e3609ca5cc9e4d2894d2202410943f799 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期三, 26 十一月 2025 13:12:47 +0800
Subject: [PATCH] 添加手动下发任务功能
---
rsf-admin/src/page/statistics/stockManage/WarehouseStockInfo.jsx | 70 +++++++++++++++++++++++-----------
1 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/rsf-admin/src/page/statistics/stockManage/WarehouseStockInfo.jsx b/rsf-admin/src/page/statistics/stockManage/WarehouseStockInfo.jsx
index d540252..6fc96b8 100644
--- a/rsf-admin/src/page/statistics/stockManage/WarehouseStockInfo.jsx
+++ b/rsf-admin/src/page/statistics/stockManage/WarehouseStockInfo.jsx
@@ -55,7 +55,6 @@
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import DictionarySelect from "../../components/DictionarySelect";
import DictSelect from "../../components/DictSelect";
-import { 'zhCN' as locale } from 'date-fns/locale';
import { format, } from 'date-fns';
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
@@ -64,16 +63,18 @@
const translate = useTranslate();
const notify = useNotify();
const refresh = useRefresh();
+ const [page, setPage] = useState(0);
+ const [pageSize, setPageSize] = useState(100);
+ const [totalRowCount, setTotalRowCount] = useState(0);
const [disabled, setDisabled] = useState(false)
+ const [loading, setLoading] = useState(false);
const [createDialog, setCreateDialog] = useState(false);
const tableRef = useRef();
useEffect(() => {
- if (open && record !== 0) {
- requestGetBody()
- }
- setDisabled(false)
- }, [open])
+ requestGetBody()
+ // setDisabled(false)
+ }, [open, page, pageSize])
const handleClose = (event, reason) => {
if (reason !== "backdropClick") {
@@ -119,12 +120,21 @@
};
const requestGetBody = async () => {
- const res = await request.post(`warehouse/stock/info`, { stock: record, aggType: record?.aggType });
- if (res?.data?.code === 200) {
- setTableData(res.data.data.records)
- } else {
- notify(res.data.msg);
+ setLoading(true);
+ try {
+ const res = await request.post(`warehouse/stock/info`, { page: page + 1, pageSize: pageSize, stock: record, aggType: record?.aggType });
+ if (res?.data?.code === 200) {
+ setTableData(res.data.data.records)
+ setTotalRowCount(res.data.data.total)
+ } else {
+ notify(res.data.msg);
+ }
+ } catch (error) {
+
+ } finally {
+ setLoading(false);
}
+
}
const [selectedRows, setSelectedRows] = useState([]);
@@ -154,9 +164,16 @@
<DialogContent sx={{ mt: 2 }}>
<Box></Box>
<Box sx={{ mt: 2 }}>
- <AsnOrderModalTable tabelData={tabelData}
+ <AsnOrderModalTable
+ tabelData={tabelData}
setTableData={setTableData}
record={record}
+ page={page}
+ pageSize={pageSize}
+ loading={loading}
+ setPage={setPage}
+ setPageSize={setPageSize}
+ totalRowCount={totalRowCount}
selectedRows={selectedRows}
setSelectedRows={setSelectedRows}
tableRef={tableRef} />
@@ -229,20 +246,20 @@
);
};
-const AsnOrderModalTable = ({ tabelData, setTableData, record, selectedRows, setSelectedRows, tableRef }) => {
+const AsnOrderModalTable = ({ tabelData, setTableData, record, selectedRows, setSelectedRows, tableRef, page, pageSize, totalRowCount, setPageSize, setPage, loading }) => {
const translate = useTranslate();
const notify = useNotify();
const [columns, setColumns] = useState([
{
- field: 'warehouse',
+ field: 'warehouse$',
headerName: translate('table.field.warehouseStock.warehouse'),
width: 130,
editable: false,
},
{
field: 'matnrCode',
- headerName: translate('table.field.asnOrderItem.matnrCode'),
+ headerName: translate('table.field.warehouseStock.matnrCode'),
width: 130,
editable: false,
},
@@ -264,7 +281,7 @@
},
{
field: 'batch',
- headerName: translate('table.field.warehouseStock.splrBatch'),
+ headerName: translate('table.field.warehouseStock.batch'),
minWidth: 100,
flex: 1,
editable: false,
@@ -279,7 +296,7 @@
valueFormatter: (val) => val < 0 ? 0 : val,
},
{
- field: 'qty',
+ field: 'workQty',
headerName: translate('table.field.warehouseStock.qty'),
type: 'number',
minWidth: 100,
@@ -352,16 +369,23 @@
return (
- <div style={{ height: 400, width: '100%' }}>
+ <div style={{ height: 500, width: '100%' }}>
<DataGrid
apiRef={tableRef}
rows={tabelData}
columns={columns}
disableRowSelectionOnClick
getRowId={(row) => row.id}
- disableColumnFilter
- disableColumnSelector
- disableColumnSorting
+ rowCount={totalRowCount}
+ paginationMode="server"
+ page={page}
+ pageSize={pageSize}
+ onPageChange={(newPage) => {
+ setPage(newPage)
+ }}
+ onPageSizeChange={(newPageSize) => {
+ setPageSize(newPageSize)
+ }}
disableMultipleColumnsSorting
processRowUpdate={processRowUpdate}
initialState={{
@@ -371,11 +395,11 @@
},
},
}}
- pageSizeOptions={[10, 25, 50, 100]}
- editMode="row"
+ pageSizeOptions={[15, 25, 50, 100]}
checkboxSelection
onRowSelectionModelChange={handleSelectionChange}
selectionModel={selectedRows}
+ loading={loading}
sx={{
'& .MuiDataGrid-cell input': {
border: '1px solid #ccc'
--
Gitblit v1.9.1