From b8c980574e7868281624a244df93299e1aaa8596 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期五, 21 三月 2025 10:09:40 +0800 Subject: [PATCH] fix:仓库和库区联动 --- rsf-admin/src/page/basicInfo/loc/LocCreate.jsx | 82 +++++++++++++++++++++++++++++++++-------- 1 files changed, 66 insertions(+), 16 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx b/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx index 831412b..9b368c1 100644 --- a/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx +++ b/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx @@ -16,6 +16,7 @@ useDataProvider, useNotify, Form, + SelectArrayInput, useCreateController, } from 'react-admin'; import { @@ -30,13 +31,14 @@ import DialogCloseButton from "../../components/DialogCloseButton"; import StatusSelectInput from "../../components/StatusSelectInput"; import MemoInput from "../../components/MemoInput"; +import request from '@/utils/request'; 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); @@ -51,6 +53,13 @@ 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 ( <> @@ -86,13 +95,14 @@ <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> @@ -101,6 +111,7 @@ <ReferenceInput source="areaId" reference="warehouseAreas" + filter={{ warehouseId }} > <AutocompleteInput label="table.field.loc.areaId" @@ -119,21 +130,40 @@ /> </Grid> <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.loc.type" + {/* <ReferenceInput source="type" + reference="dictData" + filter={{ dictTypeCode: 'sys_loc_type' }} + > + <AutocompleteInput + label="table.field.loc.type" + optionText="label" + optionValue="value" + parse={v => v} + validate={[required()]} + /> + </ReferenceInput> */} + {/* <AutocompleteInput + choices={dicts} + source="type" + optionText="label" + label="table.field.loc.type" + optionValue="value" parse={v => v} - validate={required()} - /> + validate={[required()]} + /> */} + <ReferenceArrayInput source="typeIds" reference="locType" > + <SelectArrayInput label="table.field.loc.type" /> + </ReferenceArrayInput> </Grid> - <Grid item xs={6} display="flex" gap={1}> + {/* <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.loc.name" source="name" parse={v => v} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> + </Grid> */} + {/* <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.loc.flagLogic" source="flagLogic" @@ -152,25 +182,42 @@ source="barcode" parse={v => v} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> + </Grid> */} + {/* <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.loc.unit" source="unit" parse={v => v} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> + </Grid> */} + {/* <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.loc.size" source="size" parse={v => v} /> + </Grid> */} + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.loc.length" + source="length" + validate={required()} + /> + <NumberInput + label="table.field.loc.width" + source="width" + validate={required()} + /> + <NumberInput + label="table.field.loc.height" + source="height" + validate={required()} + /> </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.loc.row" - source="lrow" + source="row" validate={required()} /> <NumberInput @@ -184,7 +231,7 @@ 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" @@ -216,7 +263,10 @@ parse={v => v} validate={required()} /> - </Grid> + </Grid> */} + + + <Grid item xs={6} display="flex" gap={1}> <StatusSelectInput /> -- Gitblit v1.9.1