| | |
| | | NumberField, |
| | | required, |
| | | useRecordContext, |
| | | useGetOne, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | |
| | | const { getValues } = useFormContext(); |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'space-between' }}> |
| | | <Toolbar sx={{ justifyContent: 'end' }}> |
| | | <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | |
| | | 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} |
| | | > |
| | |
| | | /> |
| | | </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> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |