| | |
| | | NumberField, |
| | | required, |
| | | useRecordContext, |
| | | useGetOne, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | |
| | | 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} |
| | | 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> |
| | |
| | | </Grid> |
| | | </DialogContent> |
| | | <DialogActions> |
| | | |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'end' }} > |
| | | <SaveButton type="button" mutationOptions={{ |
| | | onSuccess: () => { |
| | | setOpen(false) |
| | | } |
| | | }} /> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | | |