|  |  |  | 
|---|
|  |  |  | import DialogCloseButton from "@/page/components/DialogCloseButton"; | 
|---|
|  |  |  | import StatusSelectInput from "@/page/components/StatusSelectInput"; | 
|---|
|  |  |  | import MemoInput from "@/page/components/MemoInput"; | 
|---|
|  |  |  | import { tr } from "date-fns/locale"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import TreeSelectInput from "@/page/components/TreeSelectInput"; | 
|---|
|  |  |  | import request from '@/utils/request'; | 
|---|
|  |  |  | function CustomTabPanel(props) { | 
|---|
|  |  |  | const { children, value, index, ...other } = props; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const [value, setValue] = React.useState(0); | 
|---|
|  |  |  | const [dynamicFields, setDynamicFields] = useState([]); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | useEffect(() => { | 
|---|
|  |  |  | getDynamicFields(); | 
|---|
|  |  |  | }, []); | 
|---|
|  |  |  | const getDynamicFields = async () => { | 
|---|
|  |  |  | const { | 
|---|
|  |  |  | data: { code, data, msg }, | 
|---|
|  |  |  | } = await request.get("/fields/enable/list"); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | setDynamicFields(data || []) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | const handleChange = (event, newValue) => { | 
|---|
|  |  |  | setValue(newValue); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | 
|---|
|  |  |  | //     if (!values.shipperId) errors.shipperId = translate('form.matnr.shipper'); | 
|---|
|  |  |  | //     if (!values.groupId) errors.groupId = translate('form.matnr.groupId'); | 
|---|
|  |  |  | //     if (!values.code) errors.code = translate('form.matnr.code'); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //     return errors; | 
|---|
|  |  |  | // }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <Grid item xs={6} display="flex" gap={1}> | 
|---|
|  |  |  | <ReferenceInput | 
|---|
|  |  |  | source="shipperId" | 
|---|
|  |  |  | reference="shipper" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <ReferenceInput source="shipperId" reference="companys" filter={{ type: 'shipper' }}> | 
|---|
|  |  |  | <AutocompleteInput | 
|---|
|  |  |  | label="table.field.matnr.shipperId" | 
|---|
|  |  |  | optionText="name" | 
|---|
|  |  |  | validate={[required()]} | 
|---|
|  |  |  | filterToQuery={(val) => ({ name: val })} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ReferenceInput> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <Grid item xs={6} display="flex" gap={1}> | 
|---|
|  |  |  | <ReferenceInput | 
|---|
|  |  |  | <TreeSelectInput | 
|---|
|  |  |  | label="table.field.matnr.groupId" | 
|---|
|  |  |  | resource={'matnrGroup'} | 
|---|
|  |  |  | source="groupId" | 
|---|
|  |  |  | reference="matnrGroup" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <AutocompleteInput | 
|---|
|  |  |  | label="table.field.matnr.groupId" | 
|---|
|  |  |  | optionText="name" | 
|---|
|  |  |  | validate={[required()]} | 
|---|
|  |  |  | filterToQuery={(val) => ({ name: val })} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ReferenceInput> | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <Grid item xs={6} display="flex" gap={1}> | 
|---|
|  |  |  | <TextInput | 
|---|
|  |  |  | label="table.field.matnr.platCode" | 
|---|
|  |  |  | source="platCode" | 
|---|
|  |  |  | validate={[required()]} | 
|---|
|  |  |  | parse={v => v} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | 
|---|
|  |  |  | <Grid item xs={6} display="flex" gap={1}> | 
|---|
|  |  |  | <SelectInput | 
|---|
|  |  |  | label="table.field.matnr.isLabelMange" | 
|---|
|  |  |  | source="isLabelMange" | 
|---|
|  |  |  | source="flagLabelMange" | 
|---|
|  |  |  | choices={[ | 
|---|
|  |  |  | { id: 0, name: ' 否' }, | 
|---|
|  |  |  | { id: 1, name: ' 是' }, | 
|---|
|  |  |  | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | {dynamicFields.map((item) => { | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Grid key={item.id} item xs={6} display="flex" gap={1}> | 
|---|
|  |  |  | <TextInput | 
|---|
|  |  |  | label={item.fieldsAlise} | 
|---|
|  |  |  | source={item.fields} | 
|---|
|  |  |  | validate={item.unique === 1 ? required() : false} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | })} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <Grid item xs={6} display="flex" gap={1}> | 
|---|
|  |  |  | <StatusSelectInput /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <Grid container rowSpacing={2} columnSpacing={2}> | 
|---|
|  |  |  | <Grid item xs={6} display="flex" gap={1}> | 
|---|
|  |  |  | <ReferenceInput | 
|---|
|  |  |  | source="rglarId" | 
|---|
|  |  |  | reference="batchRegular" | 
|---|
|  |  |  | source="rglar_id" | 
|---|
|  |  |  | reference="serialRule" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <AutocompleteInput | 
|---|
|  |  |  | label="table.field.matnr.rglarId" | 
|---|
|  |  |  | optionText="code" | 
|---|
|  |  |  | filterToQuery={(val) => ({ code: val })} | 
|---|
|  |  |  | optionText="name" | 
|---|
|  |  |  | filterToQuery={(val) => ({ name: val })} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ReferenceInput> | 
|---|
|  |  |  | </Grid> | 
|---|