skyouc
2025-04-28 3798e0f2250a01493dc7b238cc3878aaade7aec0
优化出库单新增功能
1个文件已修改
107 ■■■■ 已修改文件
rsf-admin/src/page/orders/outStock/OutOrderCreate.jsx 107 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,6 +119,7 @@
                            </Box>
                        </DialogTitle>
                        <DialogContent sx={{ mt: 2 }}>
                            <>
                            <Grid container rowSpacing={2} columnSpacing={2}>
                                <Grid item xs={12} display="flex" gap={1}>
                                    <TextInput
@@ -106,8 +140,6 @@
                                        validate={required()}
                                        parse={v => v}
                                    /> */}
                                </Grid>
                                <Grid item xs={12} display="flex" gap={1}>
                                    <AutocompleteInput
                                        choices={business}
                                        optionText="label"
@@ -146,21 +178,68 @@
                                        ]}
                                    />
                                </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>
                        </DialogContent>
                        <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
                            <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }}  >
                                    <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>
                    </Form>
                </Dialog>
            </CreateBase>