| import React, { useState, useRef, useEffect, useMemo } from "react"; | 
| import { | 
|   Edit, | 
|   SimpleForm, | 
|   FormDataConsumer, | 
|   useTranslate, | 
|   TextInput, | 
|   NumberInput, | 
|   BooleanInput, | 
|   DateInput, | 
|   SelectInput, | 
|   ReferenceInput, | 
|   ReferenceArrayInput, | 
|   AutocompleteInput, | 
|   SaveButton, | 
|   Toolbar, | 
|   Labeled, | 
|   NumberField, | 
|   required, | 
|   useRecordContext, | 
|   DeleteButton, | 
| } from "react-admin"; | 
|   | 
| import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from "@/config/setting.js"; | 
| import StatusSelectInput from "../../components/StatusSelectInput.jsx"; | 
| import CustomerTopToolBar from "../../components/EditTopToolBar.jsx"; | 
| import EditBaseAside from "../../components/EditBaseAside.jsx"; | 
| import { Stack, Grid, Box, Typography } from "@mui/material"; | 
| import { useWatch, useFormContext } from "react-hook-form"; | 
| import MemoInput from "../../components/MemoInput.jsx"; | 
| import TransferItemList from "./TransferItemList.jsx"; | 
| import * as Common from "@/utils/common.js"; | 
|   | 
| const FormToolbar = () => { | 
|   const { getValues } = useFormContext(); | 
|   | 
|   return ( | 
|     <Toolbar sx={{ justifyContent: "flex-end" }}> | 
|       <SaveButton /> | 
|       <DeleteButton mutationMode="optimistic" /> | 
|     </Toolbar> | 
|   ); | 
| }; | 
|   | 
| const TransferEdit = () => { | 
|   const translate = useTranslate(); | 
|   | 
|   return ( | 
|     <> | 
|       <Edit | 
|         redirect="list" | 
|         mutationMode={EDIT_MODE} | 
|         actions={<CustomerTopToolBar />} | 
|         aside={<EditBaseAside />} | 
|       > | 
|         <SimpleForm | 
|           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', | 
|             } | 
|           }} | 
|           shouldUnregister | 
|           warnWhenUnsavedChanges | 
|           toolbar={false} | 
|           mode="onTouched" | 
|           defaultValues={{}} | 
|         > | 
|           <Grid | 
|             container | 
|             width={{ xs: "100%", xl: "90%", }} | 
|             rowSpacing={3} | 
|             columnSpacing={3} | 
|           > | 
|             <Grid item xs={24} md={16}> | 
|               <Typography variant="h6" gutterBottom> | 
|                 {translate("common.edit.title.main")} | 
|               </Typography> | 
|               <Stack direction="row" gap={2}> | 
|                 <TextInput | 
|                   label="table.field.transfer.code" | 
|                   source="code" | 
|                   parse={(v) => v} | 
|                   autoFocus | 
|                   readOnly | 
|                 /> | 
|                 <TextInput label="table.field.transfer.type" source="type$" readOnly/> | 
|                 <SelectInput | 
|                   label="table.field.transfer.source" | 
|                   source="source" | 
|                   readOnly | 
|                   choices={[ | 
|                     { id: 1, name: "ERP系统" }, | 
|                     { id: 2, name: "WMS系统生成" }, | 
|                     { id: 3, name: "EXCEL导入 " }, | 
|                     { id: 4, name: "QMS系统" }, | 
|                   ]} | 
|                 /> | 
|                 <SelectInput | 
|                   label="table.field.transfer.exceStatus" | 
|                   source="exceStatus$" | 
|                   readOnly | 
|                   choices={[ | 
|                     { id: 0, name: "未执行" }, | 
|                     { id: 1, name: "执行中" }, | 
|                     { id: 2, name: "执行完成" }, | 
|                   ]} | 
|                 /> | 
|               </Stack> | 
|               <Stack direction="row" gap={2}> | 
|                 <NumberInput | 
|                   label="table.field.transfer.orgWareId" | 
|                   source="orgWareId" | 
|                   readOnly | 
|                 /> | 
|                 <TextInput | 
|                   label="table.field.transfer.orgWareName" | 
|                   source="orgWareName" | 
|                   readOnly | 
|                   parse={(v) => v} | 
|                 /> | 
|                 <NumberInput | 
|                   label="table.field.transfer.tarWareId" | 
|                   source="tarWareId" | 
|                   readOnly | 
|                 /> | 
|                 <TextInput | 
|                   label="table.field.transfer.tarWareName" | 
|                   source="tarWareName" | 
|                   readOnly | 
|                   parse={(v) => v} | 
|                 /> | 
|               </Stack> | 
|               <Stack direction="row" gap={2}> | 
|                 <NumberInput | 
|                   label="table.field.transfer.orgAreaId" | 
|                   source="orgAreaId" | 
|                   readOnly | 
|                 /> | 
|                 <TextInput | 
|                   label="table.field.transfer.orgAreaName" | 
|                   source="orgAreaName" | 
|                   readOnly | 
|                   parse={(v) => v} | 
|                 /> | 
|                 <NumberInput | 
|                   label="table.field.transfer.tarAreaId" | 
|                   source="tarAreaId" | 
|                   readOnly | 
|                 /> | 
|                 <TextInput | 
|                   label="table.field.transfer.tarAreaName" | 
|                   source="tarAreaName" | 
|                   readOnly | 
|                   parse={(v) => v} | 
|                 /> | 
|               </Stack> | 
|             </Grid> | 
|           </Grid> | 
|         </SimpleForm> | 
|       </Edit> | 
|       <TransferItemList /> | 
|     </> | 
|   ); | 
| }; | 
|   | 
| export default TransferEdit; |