|  |  |  | 
|---|
|  |  |  | const EditContent = ({ editRecord }) => { | 
|---|
|  |  |  | const { resource } = useCreateContext(); | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { update } = useFieldArray({ name: "parCode" }) | 
|---|
|  |  |  | const formContext = useFormContext() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const pChange = (val) => { | 
|---|
|  |  |  | if (val > 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | const http = async (val) => { | 
|---|
|  |  |  | const res = await request.post(`/matnrGroup/page`, { id: val }); | 
|---|
|  |  |  | const code = res.data.data.records[0].code || '' | 
|---|
|  |  |  | editRecord && (editRecord.parCode = code); | 
|---|
|  |  |  | update(code) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | formContext.setValue('parCode', code) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Grid container rowSpacing={2} columnSpacing={2}> | 
|---|
|  |  |  | 
|---|
|  |  |  | isTranslate | 
|---|
|  |  |  | resource={resource} | 
|---|
|  |  |  | onChange={(e) => pChange(e.target.value)} | 
|---|
|  |  |  | required | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <Grid item xs={6} display="flex" gap={1}> | 
|---|
|  |  |  | <TextInput | 
|---|
|  |  |  | label="table.field.matnrGroup.parCode" | 
|---|
|  |  |  | validate={[required()]} | 
|---|
|  |  |  | source="parCode" | 
|---|
|  |  |  | value={editRecord?.parCode} | 
|---|
|  |  |  | parse={v => v} | 
|---|
|  |  |  | readOnly | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | 
|---|
|  |  |  | const onSubmit = (data) => { | 
|---|
|  |  |  | const _params = { ...data }; | 
|---|
|  |  |  | if (editRecord) { | 
|---|
|  |  |  | debugger | 
|---|
|  |  |  | if (_params.parentId === editRecord.id) { | 
|---|
|  |  |  | notify('common.response.dataError', { type: 'error' }); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | 
|---|
|  |  |  | disableRestoreFocus | 
|---|
|  |  |  | maxWidth="md"   // 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <Form record={editRecord} onSubmit={onSubmit}> | 
|---|
|  |  |  | <Form record={editRecord || {}} onSubmit={onSubmit}> | 
|---|
|  |  |  | <DialogTitle id="form-dialog-title" sx={{ | 
|---|
|  |  |  | position: 'sticky', | 
|---|
|  |  |  | top: 0, | 
|---|