zjj
2025-05-23 eab76cd34bff799686f68e6b70f86c9001e4913f
rsf-admin/src/page/warehouseAreas/BatchModal.jsx
@@ -51,7 +51,7 @@
import { DataGrid } from '@mui/x-data-grid';
import StatusSelectInput from "../components/StatusSelectInput";
const InitModal = ({ open, setOpen }) => {
const InitModal = ({ open, setOpen, fieldType }) => {
    const refresh = useRefresh();
    const translate = useTranslate();
@@ -59,7 +59,9 @@
    const notify = useNotify();
    const [formData, setFormData] = useState({
        'status': null
        'status': null,
        'wareId': null,
        'flagMix': null,
    });
    const { selectedIds, onUnselectItems } = useListContext();
@@ -75,7 +77,9 @@
    const reset = () => {
        setFormData({
            'status': null
            'status': null,
            'wareId': null,
            'flagMix': null,
        })
    }
@@ -96,17 +100,20 @@
                const newObj = removeEmptyKeys(value);
                return !_.isEmpty(newObj);
            }
            return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value));
            return !_.isNil(value);
        });
    }
    const handleSubmit = async () => {
        const parmas = {
            id: selectedIds,
            matnr: removeEmptyKeys(formData)
            ids: selectedIds,
            warehouseAreas: {
                ...removeEmptyKeys(formData)
            }
        }
        const res = await request.post(`/matnr/modify`, parmas);
        const res = await request.post(`/warehouseAreas/batch/update`, parmas);
        if (res?.data?.code === 200) {
            handleClose()
@@ -116,20 +123,53 @@
    }
    return (
        <Dialog open={open} maxWidth="md" fullWidth>
        <Dialog open={open} maxWidth="xs" fullWidth>
            <Form onSubmit={handleSubmit}>
                <DialogCloseButton onClose={handleClose} />
                <DialogTitle>{translate('toolbar.batch')}</DialogTitle>
                <DialogContent sx={{ mt: 2 }}>
                    <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
                        <Grid container spacing={2}>
                            <Grid item xs={4}>
                                <StatusSelectInput
                                    onChange={(e) => handleChange(e.target.value, 'status')}
                                    defaultValue={''}
                                    require={false}
                                />
                            </Grid>
                            {fieldType === 'status' &&
                                <Grid item xs={6}>
                                    <StatusSelectInput
                                        onChange={(e) => handleChange(+e.target.value, 'status')}
                                        defaultValue={''}
                                        require={false}
                                    />
                                </Grid>
                            }
                            {fieldType === 'flagMix' &&
                                <Grid item xs={6}>
                                    <SelectInput
                                        label="table.field.warehouseAreas.flagMix"
                                        source="flagMix"
                                        validate={[required()]}
                                        onChange={(e) => handleChange(e.target.value, 'flagMix')}
                                        choices={[
                                            { id: 0, name: '否' },
                                            { id: 1, name: '是' },
                                        ]}
                                    />
                                </Grid>
                            }
                            {fieldType === 'wareId' &&
                                <Grid item xs={6}>
                                    <ReferenceInput
                                        source="warehouseId"
                                        reference="warehouse"
                                    >
                                        <AutocompleteInput
                                            onChange={(value) => handleChange(value, 'warehouseId')}
                                            label="table.field.warehouseAreas.wareId"
                                            optionText="name"
                                            validate={[required()]}
                                            filterToQuery={(val) => ({ name: val })}
                                        />
                                    </ReferenceInput>
                                </Grid>
                            }
                        </Grid>
                    </Box>