#
luxiaotao1123
2024-09-23 d4ae421c04e90172b808cbebb86f297412ea8345
zy-acs-flow/src/page/bus/BusCreate.jsx
@@ -33,12 +33,47 @@
import DialogCloseButton from "../components/DialogCloseButton";
import StatusSelectInput from "../components/StatusSelectInput";
import MemoInput from "../components/MemoInput";
import request from '@/utils/request';
const BusCreate = (props) => {
    const { open, setOpen } = props;
    const translate = useTranslate();
    const notify = useNotify();
    const [locStsIdByStock, setLocStsIdByStock] = useState(null);
    const [locStsIdByIdle, setLocStsIdByIdle] = useState(null);
    useEffect(() => {
        const queryLocStsByStock = async () => {
            request.post('/locSts/list', {
                uuid: 'STOCK'
            }, {
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                }
            }).then(res => {
                setLocStsIdByStock(res.data.data[0]?.id);
            })
        }
        const queryLocStsByIdle = async () => {
            request.post('/locSts/list', {
                uuid: 'IDLE'
            }, {
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                }
            }).then(res => {
                setLocStsIdByIdle(res.data.data[0]?.id);
            })
        }
        if (open) {
            console.log(1);
            queryLocStsByStock();
            queryLocStsByIdle();
        }
    }, [open])
    const handleClose = (event, reason) => {
        if (reason !== "backdropClick") {
@@ -57,6 +92,7 @@
    return (
        <>
            {(locStsIdByStock && locStsIdByIdle) && (
            <CreateBase
                record={{}}
                transform={(data) => {
@@ -110,10 +146,6 @@
                                        <SimpleFormIterator fullWidth getItemLabel={index => `#${index + 1}`}>
                                            <Box mt={1} />
                                            <Stack direction="row" spacing={2}>
                                                <TextInput source="seqNum" />
                                                <NumberInput source="priority" defaultValue={1} />
                                            </Stack>
                                            <Stack direction="row" spacing={2}>
                                                <ReferenceInput
                                                    source="oriSta"
                                                    reference="sta"
@@ -127,6 +159,7 @@
                                                <ReferenceInput
                                                    source="oriLoc"
                                                    reference="loc"
                                                        filter={{ locSts: locStsIdByStock }}
                                                >
                                                    <AutocompleteInput
                                                        label="table.field.task.oriLoc"
@@ -149,6 +182,7 @@
                                                <ReferenceInput
                                                    source="destLoc"
                                                    reference="loc"
                                                        filter={{ locSts: locStsIdByIdle }}
                                                >
                                                    <AutocompleteInput
                                                        label="table.field.task.destLoc"
@@ -156,6 +190,10 @@
                                                        filterToQuery={(val) => ({ locNo: val })}
                                                    />
                                                </ReferenceInput>
                                                </Stack>
                                                <Stack direction="row" spacing={2} sx={{ maxWidth: '50%' }}>
                                                    {/* <TextInput source="seqNum" /> */}
                                                    <NumberInput source="priority" defaultValue={1} />
                                            </Stack>
                                        </SimpleFormIterator>
                                    </ArrayInput>
@@ -175,6 +213,7 @@
                    </Form>
                </Dialog>
            </CreateBase>
            )}
        </>
    )
}