From 30c34b32416f96520624d766075d2f820d420e04 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 21 八月 2025 15:46:38 +0800
Subject: [PATCH] 调拔单查询接口

---
 rsf-admin/src/page/basicInfo/matnr/MatnrCreate.jsx |  394 ++++++++++++++++++++++++++++++-------------------------
 1 files changed, 216 insertions(+), 178 deletions(-)

diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrCreate.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrCreate.jsx
index dd22896..f62588a 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrCreate.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrCreate.jsx
@@ -34,7 +34,7 @@
 import StatusSelectInput from "@/page/components/StatusSelectInput";
 import MemoInput from "@/page/components/MemoInput";
 import TreeSelectInput from "@/page/components/TreeSelectInput";
-
+import request from '@/utils/request';
 function CustomTabPanel(props) {
     const { children, value, index, ...other } = props;
 
@@ -69,7 +69,21 @@
     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);
     };
@@ -113,7 +127,7 @@
                     aria-labelledby="form-dialog-title"
                     fullWidth
                     disableRestoreFocus
-                    maxWidth="md"   // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
+                    maxWidth="xl"   // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
                 >
                     <Form >
                         <DialogTitle id="form-dialog-title" sx={{
@@ -136,141 +150,159 @@
                             </Tabs>
                             <CustomTabPanel value={value} index={0}>
                                 <Grid container rowSpacing={2} columnSpacing={2}>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.name"
-                                            validate={[required()]}
-                                            source="name"
-                                            parse={v => v}
-                                            autoFocus
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.code"
-                                            validate={[required()]}
-                                            source="code"
-                                            parse={v => v}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <ReferenceInput source="shipperId" reference="companys" filter={{ type: 'shipper' }}>
-                                            <AutocompleteInput
-                                                label="table.field.matnr.shipperId"
-                                                optionText="name"
+                                    <Grid item xs={12} display="flex" gap={1}>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.name"
                                                 validate={[required()]}
-                                                filterToQuery={(val) => ({ name: val })}
+                                                source="name"
+                                                parse={v => v}
+                                                autoFocus
                                             />
-                                        </ReferenceInput>
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.code"
+                                                validate={[required()]}
+                                                source="code"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <ReferenceInput source="shipperId" reference="companys" filter={{ type: 'shipper' }}>
+                                                <AutocompleteInput
+                                                    label="table.field.matnr.shipperId"
+                                                    optionText="name"
+                                                    filterToQuery={(val) => ({ name: val })}
+                                                />
+                                            </ReferenceInput>
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TreeSelectInput
+                                                label="table.field.matnr.groupId"
+                                                resource={'matnrGroup'}
+                                                source="groupId"
+                                            />
+                                        </Grid>
                                     </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TreeSelectInput
-                                            label="table.field.matnr.groupId"
-                                            resource={'matnrGroup'}
-                                            source="groupId"
-                                        />
+                                    <Grid item xs={12} display="flex" gap={1}>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.platCode"
+                                                source="platCode"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.spec"
+                                                source="spec"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.model"
+                                                source="model"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <NumberInput
+                                                label="table.field.matnr.weight"
+                                                source="weight"
+                                            />
+                                        </Grid>
                                     </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.platCode"
-                                            source="platCode"
-                                            validate={[required()]}
-                                            parse={v => v}
-                                        />
+                                    <Grid item xs={12} display="flex" gap={1}>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.color"
+                                                source="color"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.size"
+                                                source="size"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.describle"
+                                                source="describle"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <NumberInput
+                                                label="table.field.matnr.nromNum"
+                                                source="nromNum"
+                                            />
+                                        </Grid>
                                     </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.spec"
-                                            source="spec"
-                                            parse={v => v}
-                                        />
+                                    <Grid item xs={12} display="flex" gap={1}>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.unit"
+                                                source="unit"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.purUnit"
+                                                source="purchaseUnit"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <TextInput
+                                                label="table.field.matnr.stockUnit"
+                                                source="stockUnit"
+                                                parse={v => v}
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <SelectInput
+                                                label="table.field.matnr.stockLevel"
+                                                source="stockLevel"
+                                                choices={[
+                                                    { id: 0, name: ' A' },
+                                                    { id: 1, name: ' B' },
+                                                    { id: 2, name: 'C' },
+                                                ]}
+                                            />
+                                        </Grid>
                                     </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.model"
-                                            source="model"
-                                            parse={v => v}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <NumberInput
-                                            label="table.field.matnr.weight"
-                                            source="weight"
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.color"
-                                            source="color"
-                                            parse={v => v}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.size"
-                                            source="size"
-                                            parse={v => v}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.describle"
-                                            source="describle"
-                                            parse={v => v}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <NumberInput
-                                            label="table.field.matnr.nromNum"
-                                            source="nromNum"
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.unit"
-                                            source="unit"
-                                            parse={v => v}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.purUnit"
-                                            source="purchaseUnit"
-                                            parse={v => v}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <TextInput
-                                            label="table.field.matnr.stockUnit"
-                                            source="stockUnit"
-                                            parse={v => v}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <SelectInput
-                                            label="table.field.matnr.stockLevel"
-                                            source="stockLevel"
-                                            choices={[
-                                                { id: 0, name: ' A' },
-                                                { id: 1, name: ' B' },
-                                                { id: 2, name: 'C' },
-                                            ]}
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <SelectInput
-                                            label="table.field.matnr.isLabelMange"
-                                            source="isLabelMange"
-                                            choices={[
-                                                { id: 0, name: ' 鍚�' },
-                                                { id: 1, name: ' 鏄�' },
-                                            ]}
-                                        />
-                                    </Grid>
+                                    <Grid item xs={12} display="flex" gap={1}>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <SelectInput
+                                                label="table.field.matnr.isLabelMange"
+                                                source="flagLabelMange"
+                                                choices={[
+                                                    { id: 0, name: ' 鍚�' },
+                                                    { id: 1, name: ' 鏄�' },
+                                                ]}
+                                            />
+                                        </Grid>
 
-
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <StatusSelectInput />
+                                        {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>
                                     </Grid>
                                     <Grid item xs={12} display="flex" gap={1}>
                                         <Stack direction="column" spacing={1} width={'100%'}>
@@ -281,51 +313,57 @@
                             </CustomTabPanel>
                             <CustomTabPanel value={value} index={1}>
                                 <Grid container rowSpacing={2} columnSpacing={2}>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <NumberInput
-                                            label="table.field.matnr.safeQty"
-                                            source="safeQty"
-                                        />
+                                    <Grid item xs={12} display="flex" gap={1}>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <NumberInput
+                                                label="table.field.matnr.safeQty"
+                                                source="safeQty"
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <NumberInput
+                                                label="table.field.matnr.minQty"
+                                                source="minQty"
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <NumberInput
+                                                label="table.field.matnr.maxQty"
+                                                source="maxQty"
+                                            />
+                                        </Grid>
                                     </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <NumberInput
-                                            label="table.field.matnr.minQty"
-                                            source="minQty"
-                                        />
+                                    <Grid item xs={12} display="flex" gap={1}>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <NumberInput
+                                                label="table.field.matnr.stagn"
+                                                source="stagn"
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <NumberInput
+                                                label="table.field.matnr.valid"
+                                                source="valid"
+                                            />
+                                        </Grid>
+                                        <Grid item xs={6} display="flex" gap={1}>
+                                            <NumberInput
+                                                label="table.field.matnr.validWarn"
+                                                source="validWarn"
+                                            />
+                                        </Grid>
                                     </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <NumberInput
-                                            label="table.field.matnr.maxQty"
-                                            source="maxQty"
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <NumberInput
-                                            label="table.field.matnr.stagn"
-                                            source="stagn"
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <NumberInput
-                                            label="table.field.matnr.valid"
-                                            source="valid"
-                                        />
-                                    </Grid>
-                                    <Grid item xs={6} display="flex" gap={1}>
-                                        <NumberInput
-                                            label="table.field.matnr.validWarn"
-                                            source="validWarn"
-                                        />
-                                    </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 item xs={12} display="flex" gap={1}>
+                                        <Grid item xs={4} display="flex" gap={1}>
+                                            <SelectInput
+                                                label="table.field.matnr.flagCheck"
+                                                source="flagCheck"
+                                                choices={[
+                                                    { id: 0, name: ' 鍚�' },
+                                                    { id: 1, name: ' 鏄�' },
+                                                ]}
+                                            />
+                                        </Grid>
                                     </Grid>
                                 </Grid>
                             </CustomTabPanel>
@@ -333,13 +371,13 @@
                                 <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>
@@ -347,7 +385,7 @@
                             </CustomTabPanel>
                         </DialogContent>
                         <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
-                            <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }}  >
+                            <Toolbar sx={{ width: '100%', justifyContent: 'flex-end' }}  >
                                 <SaveButton />
                             </Toolbar>
                         </DialogActions>

--
Gitblit v1.9.1