skyouc
2025-05-20 a5816e4f1abd1e513d304357e542b75ff76a8f94
rsf-admin/src/page/system/serialRule/SerialRuleItemEdit.jsx
@@ -19,6 +19,7 @@
    NumberField,
    required,
    useRecordContext,
    useGetOne,
    DeleteButton,
} from 'react-admin';
import { useWatch, useFormContext } from "react-hook-form";
@@ -35,7 +36,7 @@
    const { getValues } = useFormContext();
    return (
        <Toolbar sx={{ justifyContent: 'space-between' }}>
        <Toolbar sx={{ justifyContent: 'end' }}>
            <SaveButton />
            <DeleteButton mutationMode="optimistic" />
        </Toolbar>
@@ -45,15 +46,18 @@
const SerialRuleItemEdit = (props) => {
    const { open, setOpen, record } = props;
    const translate = useTranslate();
    const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_rule_item_type')) || [];
    const handleClose = (event, reason) => {
        if (reason !== "backdropClick") {
            setOpen(false);
        }
    };
    const { data, isPending, } = useGetOne('serialRuleItem', { id: record?.id });
    if (data == null || data == undefined) { return }
    return (
        <Edit
            id={record.id}
            redirect="list"
            resource="serialRuleItem"
            mutationMode={EDIT_MODE}
        >
@@ -99,10 +103,12 @@
                                    />
                                </Stack>
                                <Stack direction='row' gap={2}>
                                    <TextInput
                                    <AutocompleteInput
                                        choices={dicts}
                                        optionText="label"
                                        label="table.field.serialRuleItem.wkType"
                                        source="wkType$"
                                        readOnly
                                        source="wkType"
                                        optionValue="value"
                                        parse={v => v}
                                    />
                                </Stack>
@@ -146,7 +152,13 @@
                        </Grid>
                    </DialogContent>
                    <DialogActions>
                        <Toolbar sx={{ width: '100%', justifyContent: 'end' }}  >
                            <SaveButton type="button" mutationOptions={{
                                onSuccess: () => {
                                    setOpen(false)
                                }
                            }} />
                        </Toolbar>
                    </DialogActions>
                </Form>