From 765e72ab71b29c3d23300cd5ac624827f26eab64 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期一, 07 四月 2025 17:39:24 +0800
Subject: [PATCH] 组拖源修改
---
rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx | 96 +++++++++++++++++++++++++++++++++--------------
1 files changed, 67 insertions(+), 29 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx
index bffec91..15f2f0a 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx
@@ -19,6 +19,7 @@
required,
useRecordContext,
DeleteButton,
+ useNotify,
} from 'react-admin';
import PropTypes from 'prop-types';
import { useWatch, useFormContext } from "react-hook-form";
@@ -29,7 +30,8 @@
import CustomerTopToolBar from "@/page/components/EditTopToolBar";
import MemoInput from "@/page/components/MemoInput";
import StatusSelectInput from "@/page/components/StatusSelectInput";
-
+import TreeSelectInput from "@/page/components/TreeSelectInput";
+import request from '@/utils/request';
const FormToolbar = () => {
const { getValues } = useFormContext();
return (
@@ -72,6 +74,24 @@
const MatnrEdit = () => {
const translate = useTranslate();
const [value, setValue] = React.useState(0);
+
+ const notify = useNotify();
+ 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);
};
@@ -80,7 +100,7 @@
redirect="list"
mutationMode={EDIT_MODE}
actions={<CustomerTopToolBar />}
- aside={<EditBaseAside />}
+ title={"menu.matnr"}
>
<SimpleForm
shouldUnregister
@@ -122,13 +142,8 @@
/>
</Grid>
<Grid item xs={6} display="flex" gap={1}>
- <ReferenceInput
- source="shipperId"
- reference="shipper"
- perPage={REFERENCE_INPUT_PAGESIZE}
- >
+ <ReferenceInput source="shipperId" reference="companys" filter={{ type: 'shipper' }}>
<AutocompleteInput
- validate={[required()]}
label="table.field.matnr.shipperId"
optionText="name"
filterToQuery={(val) => ({ name: val })}
@@ -136,32 +151,26 @@
</ReferenceInput>
</Grid>
<Grid item xs={6} display="flex" gap={1}>
- <ReferenceInput
+ {/* <ReferenceInput
source="groupId"
reference="matnrGroup"
perPage={REFERENCE_INPUT_PAGESIZE}
>
<AutocompleteInput
label="table.field.matnr.groupId"
- optionText="code"
+ optionText="label"
validate={[required()]}
filterToQuery={(val) => ({ code: val })}
/>
- </ReferenceInput>
+ </ReferenceInput> */}
+
+ <TreeSelectInput
+ label="table.field.matnr.groupId"
+ resource={'matnrGroup'}
+ source="groupId"
+ />
</Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <ReferenceInput
- source="rglarId"
- reference="batchRegular"
- perPage={REFERENCE_INPUT_PAGESIZE}
- >
- <AutocompleteInput
- label="table.field.matnr.rglarId"
- optionText="code"
- filterToQuery={(val) => ({ code: val })}
- />
- </ReferenceInput>
- </Grid>
+
<Grid item xs={6} display="flex" gap={1}>
<TextInput
label="table.field.matnr.platCode"
@@ -245,7 +254,7 @@
<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: ' 鏄�' },
@@ -253,6 +262,18 @@
validate={required()}
/>
</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>
+ )
+ })}
@@ -297,15 +318,32 @@
source="valid"
/>
</Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <SelectInput
+ label="table.field.matnr.flagCheck"
+ source="flagCheck"
+ choices={[
+ { id: 0, name: ' 鍚�' },
+ { id: 1, name: ' 鏄�' },
+ ]}
+ />
+ </Grid>
</Grid>
</CustomTabPanel>
<CustomTabPanel value={value} index={2}>
<Grid container rowSpacing={2} columnSpacing={2}>
<Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.matnr.flagCheck"
- source="flagCheck"
- />
+ <ReferenceInput
+ source="rglar_id"
+ reference="serialRule"
+ perPage={REFERENCE_INPUT_PAGESIZE}
+ >
+ <AutocompleteInput
+ label="table.field.matnr.rglarId"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>
</Grid>
</Grid>
</CustomTabPanel>
--
Gitblit v1.9.1