From 3798e0f2250a01493dc7b238cc3878aaade7aec0 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 28 四月 2025 22:59:35 +0800 Subject: [PATCH] 优化出库单新增功能 --- rsf-admin/src/page/orders/outStock/OutOrderCreate.jsx | 213 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 146 insertions(+), 67 deletions(-) diff --git a/rsf-admin/src/page/orders/outStock/OutOrderCreate.jsx b/rsf-admin/src/page/orders/outStock/OutOrderCreate.jsx index ec66955..25a8314 100644 --- a/rsf-admin/src/page/orders/outStock/OutOrderCreate.jsx +++ b/rsf-admin/src/page/orders/outStock/OutOrderCreate.jsx @@ -5,7 +5,13 @@ TextInput, NumberInput, BooleanInput, + TextField, + WrapperField, + NumberField, DateInput, + TopToolbar, + SelectColumnsButton, + DatagridConfigurable, SaveButton, SelectInput, ReferenceInput, @@ -17,6 +23,10 @@ useNotify, Form, useCreateController, + useGetList, + useList, + ListContextProvider, + useListContext, } from 'react-admin'; import { Dialog, @@ -28,15 +38,35 @@ Box, } from '@mui/material'; import DialogCloseButton from "../../components/DialogCloseButton"; +import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; +import { styled } from '@mui/material/styles'; import StatusSelectInput from "../../components/StatusSelectInput"; +import OutOrderItemList from "./OutOrderItemList"; import MemoInput from "../../components/MemoInput"; + +const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ + '& .css-1vooibu-MuiSvgIcon-root': { + height: '.9em' + }, + '& .RaDatagrid-row': { + cursor: 'auto' + }, + '& .column-name': { + }, + '& .opt': { + width: 200 + }, +})); + + const OutOrderCreate = (props) => { - const { open, setOpen } = props; + const { open, setOpen, record } = props; const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_order_type')) || []; const business = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; const translate = useTranslate(); const notify = useNotify(); + const [drawerVal, setDrawerVal] = useState(false); const handleClose = (event, reason) => { if (reason !== "backdropClick") { @@ -53,6 +83,9 @@ notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); }; + const { data, total, isPending, error, refetch, meta } = useGetList('/wave/locs/preview', { filter: { waveId: record?.id } }); + const listContext = useList({ data, isPending }); + return ( <> <CreateBase @@ -68,7 +101,7 @@ aria-labelledby="form-dialog-title" fullWidth disableRestoreFocus - maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' + maxWidth="xl" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' > <Form resource="outStock" @@ -86,18 +119,19 @@ </Box> </DialogTitle> <DialogContent sx={{ mt: 2 }}> - <Grid container rowSpacing={2} columnSpacing={2}> - <Grid item xs={12} display="flex" gap={1}> - <TextInput - label="table.field.asnOrder.poCode" - source="poCode" - parse={v => v} - /> - <NumberInput - label="table.field.asnOrder.poId" - source="poId" - /> - {/* <AutocompleteInput + <> + <Grid container rowSpacing={2} columnSpacing={2}> + <Grid item xs={12} display="flex" gap={1}> + <TextInput + label="table.field.asnOrder.poCode" + source="poCode" + parse={v => v} + /> + <NumberInput + label="table.field.asnOrder.poId" + source="poId" + /> + {/* <AutocompleteInput choices={dicts} optionText="label" label="table.field.asnOrder.type" @@ -106,61 +140,106 @@ validate={required()} parse={v => v} /> */} + <AutocompleteInput + choices={business} + optionText="label" + label="table.field.asnOrder.wkType" + source="wkType" + optionValue="value" + validate={required()} + parse={v => v} + /> + <NumberInput + label="table.field.asnOrder.anfme" + source="anfme" + validate={required()} + /> + <NumberInput + label="table.field.asnOrder.qty" + source="qty" + /> + </Grid> + <Grid item xs={12} display="flex" gap={1}> + <TextInput + label="table.field.asnOrder.logisNo" + source="logisNo" + parse={v => v} + /> + <DateInput + label="table.field.asnOrder.arrTime" + source="arrTime" + /> + <SelectInput + label="table.field.asnOrder.rleStatus" + source="rleStatus" + choices={[ + { id: 0, name: ' 姝e父' }, + { id: 1, name: ' 宸查噴鏀�' }, + ]} + /> + </Grid> </Grid> - <Grid item xs={12} display="flex" gap={1}> - <AutocompleteInput - choices={business} - optionText="label" - label="table.field.asnOrder.wkType" - source="wkType" - optionValue="value" - validate={required()} - parse={v => v} - /> - <NumberInput - label="table.field.asnOrder.anfme" - source="anfme" - validate={required()} - /> - <NumberInput - label="table.field.asnOrder.qty" - source="qty" - /> - </Grid> - <Grid item xs={12} display="flex" gap={1}> - <TextInput - label="table.field.asnOrder.logisNo" - source="logisNo" - parse={v => v} - /> - <DateInput - label="table.field.asnOrder.arrTime" - source="arrTime" - /> - <SelectInput - label="table.field.asnOrder.rleStatus" - source="rleStatus" - choices={[ - { id: 0, name: ' 姝e父' }, - { id: 1, name: ' 宸查噴鏀�' }, - ]} - /> - </Grid> - <Grid item xs={4} display="flex" gap={1}> - <StatusSelectInput /> - </Grid> - <Grid item xs={12} display="flex" gap={1}> - <Stack direction="column" spacing={1} width={'100%'}> - <MemoInput /> - </Stack> - </Grid> - </Grid> + <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> + <Toolbar sx={{ width: '100%', justifyContent: 'end' }} > + <SaveButton /> + </Toolbar> + </DialogActions> + + <Box> + <ListContextProvider + // resource="waveItem脧" + value={listContext} + sx={{ + flexGrow: 1, + transition: (theme) => + theme.transitions.create(['all'], { + duration: theme.transitions.duration.enteringScreen, + }), + marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, + }} + title={"menu.waveItem"} + empty={false} + sort={{ field: "create_time", order: "desc" }} + filters={false} + actions={( + <TopToolbar> + <SelectColumnsButton preferenceKey='waveItem' /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='waveItem' + bulkActionButtons={false} + rowClick={(id, resource, record) => false} + expand={false} + expandSingle={false} + omit={['id', 'createTime', 'matnrId', 'waveId', 'batch', 'orderItemId', 'unit', 'batch', 'trackCode', 'fieldsIndex', 'createBy', 'memo']} + > + <NumberField source="id" /> + <NumberField source="waveId" label="table.field.waveItem.waveId" /> + <TextField source="waveCode" label="table.field.waveItem.waveCode" /> + <TextField source="orderCode" label="table.field.waveItem.orderCode" /> + <NumberField source="matnrId" label="table.field.waveItem.matnrId" /> + <TextField source="matnrCode" label="table.field.waveItem.matnrCode" /> + <TextField source="batch" label="table.field.waveItem.batch" /> + <TextField source="splrBatch" label="table.field.waveItem.splrBatch" /> + <NumberField source="orderItemId" label="table.field.waveItem.orderItemId" /> + <TextField source="unit" label="table.field.waveItem.unit" /> + <TextField source="trackCode" label="table.field.waveItem.trackCode" /> + <TextField source="fieldsIndex" label="table.field.waveItem.fieldsIndex" /> + <NumberField source="anfme" label="table.field.waveItem.anfme" /> + <NumberField source="workQty" label="table.field.waveItem.workQty" /> + <NumberField source="qty" label="table.field.waveItem.qty" /> + <NumberField source="stockQty" label="table.field.waveItem.stockQty" /> + <WrapperField cellClassName="opt" label="table.field.waveItem.stockLocs"> + {/* <TagsField /> */} + </WrapperField> + </StyledDatagrid> + </ListContextProvider> + </Box> + </> </DialogContent> - <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> - <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > - <SaveButton /> - </Toolbar> - </DialogActions> </Form> </Dialog> </CreateBase> -- Gitblit v1.9.1