| | |
| | | useDataProvider, |
| | | useNotify, |
| | | Form, |
| | | SelectArrayInput, |
| | | useCreateController, |
| | | } from 'react-admin'; |
| | | import { |
| | |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | import MemoInput from "../../components/MemoInput"; |
| | | import request from '@/utils/request'; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | |
| | | const LocCreate = (props) => { |
| | | const { open, setOpen } = props; |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_type')) || []; |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | |
| | | const handleError = async (error) => { |
| | | notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); |
| | | }; |
| | | |
| | | const [warehouseId, setWrehouseId] = useState(); |
| | | |
| | | const warehouseChange = (val) => { |
| | | setWrehouseId(val) |
| | | } |
| | | |
| | | |
| | | return ( |
| | | <> |
| | |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="warehouseId$" |
| | | source="warehouseId" |
| | | reference="warehouse" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.warehouseId" |
| | | optionText="name" |
| | | validate={[required()]} |
| | | onChange={warehouseChange} |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput> |
| | |
| | | <ReferenceInput |
| | | source="areaId" |
| | | reference="warehouseAreas" |
| | | filter={{ warehouseId }} |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.areaId" |
| | |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | {/* <ReferenceInput |
| | | source="type" |
| | | reference="dictData" |
| | | filter={{ dictTypeCode: 'sys_loc_type' }} |
| | |
| | | parse={v => v} |
| | | validate={[required()]} |
| | | /> |
| | | </ReferenceInput> |
| | | </ReferenceInput> */} |
| | | {/* <AutocompleteInput |
| | | choices={dicts} |
| | | source="type" |
| | | optionText="label" |
| | | label="table.field.loc.type" |
| | | optionValue="value" |
| | | parse={v => v} |
| | | validate={[required()]} |
| | | /> */} |
| | | <ReferenceArrayInput source="typeIds" reference="locType" > |
| | | <SelectArrayInput label="table.field.loc.type" validate={[required()]} /> |
| | | </ReferenceArrayInput> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | |
| | | parse={v => v} |
| | | /> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.loc.flagLogic" |
| | | source="flagLogic" |
| | |
| | | source="barcode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | </Grid> */} |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.loc.unit" |
| | |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.loc.channel" |
| | | source="channel" |
| | |
| | | parse={v => v} |
| | | validate={required()} |
| | | /> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <DictionarySelect |
| | | label={translate("table.field.loc.useStatus")} |
| | | name="useStatus" |
| | | size="small" |
| | | validate={[required()]} |
| | | dictTypeCode="sys_loc_use_stas" |
| | | /> |
| | | {/* <ReferenceInput |
| | | source="useStatus" |
| | | reference="dictData" |
| | | filter={{ dictTypeCode: 'sys_loc_use_stas' }} |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.useStatus" |
| | | optionText="label" |
| | | optionValue="value" |
| | | parse={v => v} |
| | | validate={[required()]} |
| | | /> |
| | | </ReferenceInput> */} |
| | | </Grid> |
| | | |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |