| | |
| | | required, |
| | | useRecordContext, |
| | | DeleteButton, |
| | | useNotify, |
| | | useRedirect, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography } from '@mui/material'; |
| | |
| | | import StatusSelectInput from "../../../components/StatusSelectInput"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | | const form = useFormContext(); |
| | | const redirect = useRedirect(); |
| | | const notify = useNotify(); |
| | | const onSuccess = (data) => { |
| | | const { dictTypeId, dictTypeCode } = data |
| | | notify(`修改成功!`); |
| | | redirect(`/dictData?dictTypeId=${dictTypeId}&code=${dictTypeCode}`); |
| | | } |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'space-between' }}> |
| | | <SaveButton /> |
| | | <SaveButton type="button" mutationOptions={{ onSuccess }} /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | | ) |