| import React, { useState, useRef, useEffect, useMemo } from "react"; | 
| import { | 
|     Edit, | 
|     SimpleForm, | 
|     useTranslate, | 
|     TextInput, | 
|     DateInput, | 
|     SelectInput, | 
|     AutocompleteInput, | 
|     SaveButton, | 
|     Toolbar, | 
|     required, | 
|     DeleteButton, | 
| } from 'react-admin'; | 
| import { useWatch, useFormContext } from "react-hook-form"; | 
| import { Stack, Grid, Box, Typography } from '@mui/material'; | 
| import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; | 
| import EditBaseAside from "../../components/EditBaseAside"; | 
| import CustomerTopToolBar from "../../components/EditTopToolBar"; | 
| import OutOrderItemList from "./OutOrderItemList"; | 
|   | 
|   | 
| const OutOrderEdit = () => { | 
|     const translate = useTranslate(); | 
|     const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_order_type')) || []; | 
|     const business = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; | 
|   | 
|     return ( | 
|         <> | 
|             <Edit | 
|                 redirect="list" | 
|                 mutationMode={EDIT_MODE} | 
|                 actions={<CustomerTopToolBar />} | 
|                 aside={<EditBaseAside />} | 
|             > | 
|                 <SimpleForm | 
|                     shouldUnregister | 
|                     warnWhenUnsavedChanges | 
|                     toolbar={false} | 
|                     mode="onTouched" | 
|                     defaultValues={{}} | 
|                 > | 
|                     <Grid container width={{ xs: '100%', xl: '100%' }} rowSpacing={3} columnSpacing={3} | 
|                         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)" | 
|                             }, | 
|                             "& .MuiFilledInput-root.MuiInputBase-sizeSmall": { | 
|                                 bgcolor: 'white', | 
|                             } | 
|                         }} | 
|                     > | 
|                         <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.outStock.code" | 
|                                     source="code" | 
|                                     readOnly | 
|                                     parse={v => v} | 
|                                 /> | 
|                                 <TextInput | 
|                                     label="table.field.outStock.poCode" | 
|                                     source="poCode" | 
|                                     readOnly | 
|                                     parse={v => v} | 
|                                 /> | 
|                                 <AutocompleteInput | 
|                                     choices={dicts} | 
|                                     optionText="label" | 
|                                     label="table.field.outStock.type" | 
|                                     source="type" | 
|                                     optionValue="value" | 
|                                     parse={v => v} | 
|                                     readOnly | 
|                                 /> | 
|                                 <AutocompleteInput | 
|                                     choices={business} | 
|                                     optionText="label" | 
|                                     label="table.field.outStock.wkType" | 
|                                     source="wkType" | 
|                                     optionValue="value" | 
|                                     parse={v => v} | 
|                                     readOnly | 
|                                 /> | 
|                             </Stack> | 
|                             <Stack direction='row' gap={2}> | 
|                                 <TextInput | 
|                                     label="table.field.outStock.logisNo" | 
|                                     source="logisNo" | 
|                                     readOnly | 
|                                     parse={v => v} | 
|                                 /> | 
|                                 <TextInput | 
|                                     label="table.field.outStock.anfme" | 
|                                     source="anfme" | 
|                                     readOnly | 
|                                     parse={v => v} | 
|                                 /> | 
|                                 <TextInput | 
|                                     label="table.field.outStock.qty" | 
|                                     source="qty" | 
|                                     readOnly | 
|                                     parse={v => v} | 
|                                 /> | 
|                                 <DateInput | 
|                                     label="table.field.outStock.arrTime" | 
|                                     source="arrTime" | 
|                                     readOnly | 
|                                 /> | 
|                                 <SelectInput | 
|                                     label="table.field.outStock.rleStatus" | 
|                                     source="rleStatus" | 
|                                     readOnly | 
|                                     choices={[ | 
|                                         { id: 0, name: ' 正常' }, | 
|                                         { id: 1, name: ' 已释放' }, | 
|                                     ]} | 
|                                     validate={required()} | 
|                                 /> | 
|                             </Stack> | 
|                         </Grid> | 
|                     </Grid> | 
|                 </SimpleForm> | 
|             </Edit > | 
|             <OutOrderItemList /> | 
|         </> | 
|     ) | 
| } | 
|   | 
| export default OutOrderEdit; |