|  |  |  | 
|---|
|  |  |  | useRecordContext, | 
|---|
|  |  |  | 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.js"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from "@/config/setting.js"; | 
|---|
|  |  |  | import EditBaseAside from "../../components/EditBaseAside.jsx"; | 
|---|
|  |  |  | import CustomerTopToolBar from "../../components/EditTopToolBar.jsx"; | 
|---|
|  |  |  | import MemoInput from "../../components/MemoInput.jsx"; | 
|---|
|  |  |  | 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: "space-between" }}> | 
|---|
|  |  |  | <Toolbar sx={{ justifyContent: "flex-end" }}> | 
|---|
|  |  |  | <SaveButton /> | 
|---|
|  |  |  | <DeleteButton mutationMode="optimistic" /> | 
|---|
|  |  |  | </Toolbar> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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={<FormToolbar />} | 
|---|
|  |  |  | toolbar={false} | 
|---|
|  |  |  | mode="onTouched" | 
|---|
|  |  |  | defaultValues={{}} | 
|---|
|  |  |  | // validate={(values) => { }} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <Grid | 
|---|
|  |  |  | container | 
|---|
|  |  |  | width={{ xs: "100%", xl: "80%" }} | 
|---|
|  |  |  | width={{ xs: "100%", xl: "90%", }} | 
|---|
|  |  |  | rowSpacing={3} | 
|---|
|  |  |  | columnSpacing={3} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <Grid item xs={12} md={8}> | 
|---|
|  |  |  | <Grid item xs={24} md={16}> | 
|---|
|  |  |  | <Typography variant="h6" gutterBottom> | 
|---|
|  |  |  | {translate("common.edit.title.main")} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | 
|---|
|  |  |  | source="code" | 
|---|
|  |  |  | parse={(v) => v} | 
|---|
|  |  |  | autoFocus | 
|---|
|  |  |  | readOnly | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Stack> | 
|---|
|  |  |  | <Stack direction="row" gap={2}> | 
|---|
|  |  |  | <NumberInput label="table.field.transfer.type" source="type" /> | 
|---|
|  |  |  | <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系统生成" }, | 
|---|
|  |  |  | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <SelectInput | 
|---|
|  |  |  | label="table.field.transfer.exceStatus" | 
|---|
|  |  |  | source="exceStatus" | 
|---|
|  |  |  | source="exceStatus$" | 
|---|
|  |  |  | readOnly | 
|---|
|  |  |  | choices={[ | 
|---|
|  |  |  | { id: 0, name: "未执行" }, | 
|---|
|  |  |  | { id: 1, name: "执行中" }, | 
|---|
|  |  |  | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | 
|---|
|  |  |  | <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> | 
|---|