|  |  | 
 |  |  |     NumberField, | 
 |  |  |     required, | 
 |  |  |     useRecordContext, | 
 |  |  |     useGetRecordId, | 
 |  |  |     useGetOne, | 
 |  |  |     DeleteButton, | 
 |  |  | } from 'react-admin'; | 
 |  |  | import { useWatch, useFormContext } from "react-hook-form"; | 
 |  |  | import { Stack, Grid, Box, Typography } from '@mui/material'; | 
 |  |  | import * as Common from '@/utils/common'; | 
 |  |  | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; | 
 |  |  | import EditBaseAside from "@/page/components/EditBaseAside"; | 
 |  |  | import CustomerTopToolBar from "@/page/components/EditTopToolBar"; | 
 |  |  | import MemoInput from "@/page/components/MemoInput"; | 
 |  |  | import StatusSelectInput from "@/page/components/StatusSelectInput"; | 
 |  |  | import CustomerTopToolBar from "@/page/components/EditTopToolBar"; | 
 |  |  | import { Stack, Grid, Box, Typography } from '@mui/material'; | 
 |  |  | import EditBaseAside from "@/page/components/EditBaseAside"; | 
 |  |  | import { useWatch, useFormContext } from "react-hook-form"; | 
 |  |  | import MemoInput from "@/page/components/MemoInput"; | 
 |  |  | import ReviseLogList from "./ReviseLogList"; | 
 |  |  | import * as Common from '@/utils/common'; | 
 |  |  |  | 
 |  |  | const FormToolbar = () => { | 
 |  |  |     const { getValues } = useFormContext(); | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Toolbar sx={{ justifyContent: 'space-between' }}> | 
 |  |  |             <SaveButton /> | 
 |  |  |             <DeleteButton mutationMode="optimistic" /> | 
 |  |  |         </Toolbar> | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | const LocReviseEdit = () => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |     const [disabled, setDisabled] = useState(false); | 
 |  |  |  | 
 |  |  |     const orderId = useGetRecordId(); | 
 |  |  |     const {data, isPending} =  useGetOne("locRevise", {id: orderId}); | 
 |  |  |     console.log(data); | 
 |  |  |  | 
 |  |  |     const FormToolbar = () => { | 
 |  |  |         return ( | 
 |  |  |             <Toolbar sx={{ justifyContent: 'flex-end' }}> | 
 |  |  |                 <SaveButton disabled={disabled} /> | 
 |  |  |                 <DeleteButton mutationMode="optimistic" /> | 
 |  |  |             </Toolbar> | 
 |  |  |         ) | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Edit | 
 |  |  |             redirect="list" | 
 |  |  |             mutationMode={EDIT_MODE} | 
 |  |  |             actions={<CustomerTopToolBar />} | 
 |  |  |             aside={<EditBaseAside />} | 
 |  |  |         > | 
 |  |  |             <SimpleForm | 
 |  |  |                 shouldUnregister | 
 |  |  |                 warnWhenUnsavedChanges | 
 |  |  |                 toolbar={<FormToolbar />} | 
 |  |  |                 mode="onTouched" | 
 |  |  |                 defaultValues={{}} | 
 |  |  |             // validate={(values) => { }} | 
 |  |  |         <> | 
 |  |  |             <Edit | 
 |  |  |                 redirect="list" | 
 |  |  |                 mutationMode={EDIT_MODE} | 
 |  |  |                 actions={<CustomerTopToolBar />} | 
 |  |  |                 aside={<EditBaseAside />} | 
 |  |  |             > | 
 |  |  |                 <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> | 
 |  |  |                     <Grid item xs={12} md={8}> | 
 |  |  |                         <Typography variant="h6" gutterBottom> | 
 |  |  |                             {translate('common.edit.title.main')} | 
 |  |  |                         </Typography> | 
 |  |  |                         <Stack direction='row' gap={2}> | 
 |  |  |                             <TextInput | 
 |  |  |                                 label="table.field.locRevise.code" | 
 |  |  |                                 source="code" | 
 |  |  |                                 parse={v => v} | 
 |  |  |                                 autoFocus | 
 |  |  |                             /> | 
 |  |  |                         </Stack> | 
 |  |  |                         <Stack direction='row' gap={2}> | 
 |  |  |                             <SelectInput | 
 |  |  |                                 label="table.field.locRevise.type" | 
 |  |  |                                 source="type" | 
 |  |  |                                 choices={[ | 
 |  |  |                                     { id: 0, name: ' 库存调整' }, | 
 |  |  |                                     { id:  2, name: ' 盘点调整' }, | 
 |  |  |                                 ]} | 
 |  |  |                             /> | 
 |  |  |                         </Stack> | 
 |  |  |                         <Stack direction='row' gap={2}> | 
 |  |  |                             <NumberInput | 
 |  |  |                                 label="table.field.locRevise.anfme" | 
 |  |  |                                 source="anfme" | 
 |  |  |                             /> | 
 |  |  |                         </Stack> | 
 |  |  |                         <Stack direction='row' gap={2}> | 
 |  |  |                             <NumberInput | 
 |  |  |                                 label="table.field.locRevise.reviseQty" | 
 |  |  |                                 source="reviseQty" | 
 |  |  |                             /> | 
 |  |  |                         </Stack> | 
 |  |  |                         <Stack direction='row' gap={2}> | 
 |  |  |                             <SelectInput | 
 |  |  |                                 label="table.field.locRevise.exceStatus" | 
 |  |  |                                 source="exceStatus" | 
 |  |  |                                 choices={[ | 
 |  |  |                                     { id: 0, name: '未执行' }, | 
 |  |  |                                     { id:  1, name: '执行中' }, | 
 |  |  |                                     { id:  2, name: '执行完成' }, | 
 |  |  |                                 ]} | 
 |  |  |                             /> | 
 |  |  |                         </Stack> | 
 |  |  |                         <Stack direction='row' gap={2}> | 
 |  |  |                             <NumberInput | 
 |  |  |                                 label="table.field.locRevise.orgAreaId" | 
 |  |  |                                 source="orgAreaId" | 
 |  |  |                             /> | 
 |  |  |                         </Stack> | 
 |  |  |                         <Stack direction='row' gap={2}> | 
 |  |  |                             <TextInput | 
 |  |  |                                 label="table.field.locRevise.orgAreaName" | 
 |  |  |                                 source="orgAreaName" | 
 |  |  |                                 parse={v => v} | 
 |  |  |                             /> | 
 |  |  |                         </Stack> | 
 |  |  |                 <SimpleForm | 
 |  |  |                     shouldUnregister | 
 |  |  |                     warnWhenUnsavedChanges | 
 |  |  |                     toolbar={false} | 
 |  |  |                     mode="onTouched" | 
 |  |  |                     sx={{ | 
 |  |  |                         "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": { | 
 |  |  |                             bgcolor: 'white', | 
 |  |  |                             WebkitTextFillColor: "rgba(0, 0, 0)" | 
 |  |  |                         }, | 
 |  |  |  | 
 |  |  |                         "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": { | 
 |  |  |                             bgcolor: 'white', | 
 |  |  |                             WebkitTextFillColor: "rgba(0, 0, 0)" | 
 |  |  |                         } | 
 |  |  |                     }} | 
 |  |  |                     defaultValues={{}} | 
 |  |  |                     // sx={{ | 
 |  |  |                     //     "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": { | 
 |  |  |                     //         bgcolor: 'white', | 
 |  |  |                     //         WebkitTextFillColor: "rgba(0, 0, 0)" | 
 |  |  |                     //     }, | 
 |  |  |  | 
 |  |  |                     //     "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": { | 
 |  |  |                     //         bgcolor: 'white', | 
 |  |  |                     //         WebkitTextFillColor: "rgba(0, 0, 0)" | 
 |  |  |                     //     } | 
 |  |  |                     // }} | 
 |  |  |                     validate={(values) => { }} | 
 |  |  |                 > | 
 |  |  |                     <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> | 
 |  |  |                         <Grid item xs={24} md={12}> | 
 |  |  |                             <Typography variant="h6" gutterBottom> | 
 |  |  |                                 {translate('common.edit.title.main')} | 
 |  |  |                             </Typography> | 
 |  |  |                             <Stack direction='row' gap={2}> | 
 |  |  |                                 <TextInput | 
 |  |  |                                     label="table.field.locRevise.code" | 
 |  |  |                                     source="code" | 
 |  |  |                                     parse={v => v} | 
 |  |  |                                     readOnly | 
 |  |  |                                 /> | 
 |  |  |                                 <SelectInput | 
 |  |  |                                     label="table.field.locRevise.type" | 
 |  |  |                                     source="type" | 
 |  |  |                                     choices={[ | 
 |  |  |                                         { id: 1, name: ' 库存调整' }, | 
 |  |  |                                         { id: 2, name: ' 盘点调整' }, | 
 |  |  |                                     ]} | 
 |  |  |                                     readOnly | 
 |  |  |                                 /> | 
 |  |  |                                 <NumberInput | 
 |  |  |                                     label="table.field.locRevise.anfme" | 
 |  |  |                                     source="anfme" | 
 |  |  |                                     readOnly | 
 |  |  |                                 /> | 
 |  |  |                             </Stack> | 
 |  |  |                             <Stack direction='row' gap={2}> | 
 |  |  |                                 <NumberInput | 
 |  |  |                                     label="table.field.locRevise.reviseQty" | 
 |  |  |                                     source="reviseQty" | 
 |  |  |                                     readOnly | 
 |  |  |                                 /> | 
 |  |  |                                 <SelectInput | 
 |  |  |                                     label="table.field.locRevise.exceStatus" | 
 |  |  |                                     source="exceStatus" | 
 |  |  |                                     choices={[ | 
 |  |  |                                         { id: 0, name: '未执行' }, | 
 |  |  |                                         { id: 1, name: '执行中' }, | 
 |  |  |                                         { id: 2, name: '执行完成' }, | 
 |  |  |                                     ]} | 
 |  |  |                                     readOnly | 
 |  |  |                                 /> | 
 |  |  |                                 <TextInput | 
 |  |  |                                     label="table.field.locRevise.areaName" | 
 |  |  |                                     source="areaName" | 
 |  |  |                                     parse={v => v} | 
 |  |  |                                     readOnly | 
 |  |  |                                 /> | 
 |  |  |                             </Stack> | 
 |  |  |                         </Grid> | 
 |  |  |                     </Grid> | 
 |  |  |                     <Grid item xs={12} md={4}> | 
 |  |  |                         <Typography variant="h6" gutterBottom> | 
 |  |  |                             {translate('common.edit.title.common')} | 
 |  |  |                         </Typography> | 
 |  |  |                         <StatusSelectInput /> | 
 |  |  |                         <Box mt="2em" /> | 
 |  |  |                         <MemoInput /> | 
 |  |  |                     </Grid> | 
 |  |  |                 </Grid> | 
 |  |  |             </SimpleForm> | 
 |  |  |         </Edit > | 
 |  |  |                 </SimpleForm> | 
 |  |  |             </Edit > | 
 |  |  |             <ReviseLogList record = {data}/> | 
 |  |  |         </> | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  |  |