From 6d7147093fb95d2b13014d9979c90c907f6cfbcb Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 11 六月 2025 09:42:51 +0800
Subject: [PATCH] #
---
rsf-admin/src/page/orders/outStock/OutStockPublic.jsx | 205 +++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 181 insertions(+), 24 deletions(-)
diff --git a/rsf-admin/src/page/orders/outStock/OutStockPublic.jsx b/rsf-admin/src/page/orders/outStock/OutStockPublic.jsx
index c2c399a..5b60940 100644
--- a/rsf-admin/src/page/orders/outStock/OutStockPublic.jsx
+++ b/rsf-admin/src/page/orders/outStock/OutStockPublic.jsx
@@ -1,4 +1,4 @@
-import { Box, Card, Grid, LinearProgress } from "@mui/material";
+import { Box, Card, Grid, LinearProgress, Select, MenuItem, ListItemText, Tooltip } from "@mui/material";
import React, { useState, useRef, useEffect, useMemo } from "react";
import {
List,
@@ -34,15 +34,16 @@
AutocompleteInput,
DeleteButton,
SimpleForm,
+ required,
Form,
- SaveButton,
- useRefresh,
- useGetList,
- useGetOne,
} from 'react-admin';
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting';
import { styled } from '@mui/material/styles';
-import { DataGrid } from '@mui/x-data-grid';
+import { DataGrid, useGridApiContext } from '@mui/x-data-grid';
+import request from '@/utils/request';
+import ConfirmationNumberOutlinedIcon from '@mui/icons-material/ConfirmationNumberOutlined';
+import CloseSharpIcon from '@mui/icons-material/CloseSharp';
+import ConfirmButton from '../../components/ConfirmButton';
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
@@ -51,18 +52,64 @@
'& .RaDatagrid-row': {
cursor: 'auto'
},
+ '& .column-maktx': {
+ width: 200
+ }
}));
const OutStockPublic = (props) => {
- const { record } = props;
+ const { record, open, setOpen } = props;
+ const dataGridRef = useRef(null);
+ const notify = useNotify();
+ const [rows, setRows] = useState({});
+ const translate = useTranslate();
+ const [selectedIds, setSelectedIds] = React.useState([]);
+ const [formData, setFormData] = useState({
+ orderId: record?.id
+ });
+ useEffect(() => {
+ getWaveRule()
+ }, [formData, open])
+ const getWaveRule = async () => {
+ if (formData.waveId == null && formData.waveId == undefined) {
+ return
+ }
+ const { data: { code, data, msg } } = await request.post('/outStock/order/getOutTaskItems', { ...formData });
+
+ if (code === 200) {
+ setRows(data)
+ } else {
+ notify(msg);
+ }
+ }
+
+ const handleChange = (value, name) => {
+ setFormData((prevData) => ({
+ ...prevData,
+ [name]: value
+ }));
+ };
return (
<>
<Box>
<Grid sx={{ display: "flex" }} container rowSpacing={2} columnSpacing={2}>
<Grid item xl={6} gap={2} >
<Card>
+ <Form>
+ <ReferenceInput
+ source="type"
+ reference="waveRule"
+ >
+ <AutocompleteInput
+ label="table.field.waveRule.type"
+ onChange={(e) => handleChange(e, 'waveId')}
+ value={formData.type}
+ validate={required()}
+ />
+ </ReferenceInput>
+ </Form>
<List
resource="outStockItem"
storeKey='outStockItem'
@@ -77,7 +124,9 @@
empty={false}
filter={{ asnId: record?.id, deleted: 0 }}
sort={{ field: "create_time", order: "desc" }}
- actions={false}
+ actions={(
+ <SelectColumnsButton preferenceKey='outStock' />
+ )}
perPage={DEFAULT_ITEM_PAGE_SIZE}
>
<LinearProgress
@@ -87,7 +136,7 @@
preferenceKey='outStockItem'
bulkActionButtons={false}
rowClick={false}
- omit={['id', 'splrName', 'qty']}
+ omit={['id', 'splrName', 'qty', 'poCode', 'workQty']}
>
<NumberField source="id" />
<TextField source="asnCode" label="table.field.outStockItem.asnCode" />
@@ -116,9 +165,17 @@
},
},
}}
+ ref={dataGridRef}
+ checkboxSelection
+ onRowSelectionModelChange={(ids) => {
+ setSelectedIds(ids)
+ }}
pageSizeOptions={[15, 25, 35, 45]}
- disableRowSelectionOnClick
/>
+ </Box>
+ <Box sx={{ textAlign: 'center' }}>
+ <CloseButton setOpen={setOpen} />
+ <SubmitButton selectedIds={selectedIds} setSelectedIds={setSelectedIds} />
</Box>
</Card>
</Grid>
@@ -129,28 +186,128 @@
}
-const rows = [
- { id: 1, locCode: '03-02-1-2-1', container: 'Snow', batch: 'Jon', curQty: 14 },
- { id: 2, locCode: '03-02-1-2-1', container: 'Lannister', batch: 'Cersei', curQty: 31 },
- { id: 3, locCode: '03-02-1-2-1', container: 'Lannister', batch: 'Jaime', curQty: 31 },
- { id: 4, locCode: '03-02-1-2-1', container: 'Stark', batch: 'Arya', curQty: 11 },
- { id: 5, locCode: '03-02-1-2-1', container: 'Targaryen', batch: 'Daenerys', curQty: null },
- { id: 6, locCode: '03-02-1-2-1', container: 'Melisandre', batch: null, curQty: 150 },
- { id: 7, locCode: '03-02-1-2-1', container: 'Clifford', batch: 'Ferrara', curQty: 44 },
- { id: 8, locCode: '03-02-1-2-1', container: 'Frances', batch: 'Rossini', curQty: 36 },
- { id: 9, locCode: '03-02-1-2-1', container: 'Roxie', batch: 'Harvey', curQty: 65 },
-]
+//鎻愪氦鎸夐挳
+const SubmitButton = ({ selectedIds, setSelectedIds }) => {
+ const submit = () => {
+ if (selectedIds.length < 1) { return }
+ console.log(selectedIds);
+ }
+
+ return (
+ <ConfirmButton
+ label="toolbar.confirm"
+ variant="contained"
+ size="medium"
+ onConfirm={submit}
+ startIcon={<ConfirmationNumberOutlinedIcon />}
+ />
+ )
+}
+
+//鍏抽棴鎸夐挳
+const CloseButton = ({ setOpen }) => {
+ const close = () => {
+ setOpen(false)
+ }
+ return (
+ <Button
+ label="toolbar.close"
+ variant="outlined"
+ size="medium"
+ onClick={close}
+ startIcon={<CloseSharpIcon />}
+ sx={{ margin: '3.5em' }} />
+ )
+}
+
const columns = [
{ field: 'id', headerName: 'ID', width: 40 },
{ field: 'locCode', headerName: '搴撲綅', width: 110 },
- { field: 'container', headerName: '瀹瑰櫒', width: 120 },
+ { field: 'barcode', headerName: '瀹瑰櫒', width: 120 },
{ field: 'batch', headerName: '鎵规', width: 90 },
{ field: 'unit', headerName: '鍗曚綅', width: 90 },
- { field: 'curQty', headerName: '鏈鍑哄簱鏁伴噺', width: 110 },
- { field: 'siteNo', headerName: '鍑哄簱鍙�', width: 90 }, ``
+ { field: 'workQty', headerName: '鏈鍑哄簱鏁伴噺', width: 110 },
+ {
+ field: 'siteNo',
+ headerName: '鍑哄簱鍙�',
+ width: 90,
+ type: 'singleSelect',
+ editable: true,
+ renderCell: (params) => (
+ <OutStockSiteNo value={params.value} />
+ ),
+ renderEditCell: (params) => (
+ <OutStockSite {...params} />
+ ),
+ },
]
+const OutStockSiteNo = React.memo(function OutStockSiteNo(props) {
+ const { value } = props;
+ if (!value) {
+ return null;
+ }
+ return (
+ <Box
+ sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
+ >
+ <span>{value}</span>
+ </Box>
+ );
+});
+
+
+const OutStockSite = (params) => {
+ const { id, field, siteNo, row: { staNos } } = params;
+ const apiRef = useGridApiContext();
+ const handleChange = async (event) => {
+ await apiRef.current.setEditCellValue(
+ { id, field, value: event.target.value },
+ event,
+ );
+ apiRef.current.stopCellEditMode({ id, field });
+ };
+
+ const handleClose = (event, reason) => {
+ if (reason === 'backdropClick') {
+ apiRef.current.stopCellEditMode({ id, field });
+ }
+ };
+
+ return (
+ <Select
+ value={siteNo}
+ onChange={handleChange}
+ MenuProps={{
+ onClose: handleClose,
+ }}
+ sx={{
+ height: '100%',
+ '& .MuiSelect-select': {
+ display: 'flex',
+ alignItems: 'center',
+ pl: 1,
+ },
+ }}
+ autoFocus
+ fullWidth
+ open
+ >
+ {staNos.map((option) => {
+ return (
+ <MenuItem
+ key={option}
+ value={option.staNo}
+ >
+ <ListItemText sx={{ overflow: 'hidden' }} primary={option.staNo} />
+ </MenuItem>
+ );
+ })}
+ </Select >
+ )
+}
+
export default OutStockPublic;
--
Gitblit v1.9.1