From b8c980574e7868281624a244df93299e1aaa8596 Mon Sep 17 00:00:00 2001
From: verou <857149855@qq.com>
Date: 星期五, 21 三月 2025 10:09:40 +0800
Subject: [PATCH] fix:仓库和库区联动
---
rsf-admin/src/page/basicInfo/loc/InitModal.jsx | 16 ++---
rsf-admin/src/page/basicInfo/loc/LocCreate.jsx | 6 ++
rsf-admin/src/page/basicInfo/loc/BatchModal.jsx | 33 +++++++++-
rsf-admin/src/page/warehouseAreas/WarehouseAreasCreate.jsx | 1
rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx | 2
rsf-admin/src/page/warehouseAreas/WarehouseAreasEdit.jsx | 1
rsf-admin/package.json | 1
rsf-admin/src/page/basicInfo/loc/LocEdit.jsx | 6 ++
rsf-admin/pnpm-lock.yaml | 12 ++++
rsf-admin/.env | 4
rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx | 50 ++++++++++++----
11 files changed, 102 insertions(+), 30 deletions(-)
diff --git a/rsf-admin/.env b/rsf-admin/.env
index a8ce658..9669b2c 100644
--- a/rsf-admin/.env
+++ b/rsf-admin/.env
@@ -1,3 +1,3 @@
-VITE_BASE_IP=192.168.4.24
-# VITE_BASE_IP=47.76.147.249
+# VITE_BASE_IP=192.168.4.24
+VITE_BASE_IP=47.76.147.249
VITE_BASE_PORT=8080
diff --git a/rsf-admin/package.json b/rsf-admin/package.json
index 18c05b2..3bf09ac 100644
--- a/rsf-admin/package.json
+++ b/rsf-admin/package.json
@@ -37,6 +37,7 @@
"react-router": "^6.22.0",
"react-router-dom": "^6.26.1",
"react-syntax-highlighter": "^15.5.0",
+ "react-to-print": "^3.0.5",
"three": "^0.155.0",
"tweedle.js": "^2.1.0"
},
diff --git a/rsf-admin/pnpm-lock.yaml b/rsf-admin/pnpm-lock.yaml
index c99442f..f66ce5c 100644
--- a/rsf-admin/pnpm-lock.yaml
+++ b/rsf-admin/pnpm-lock.yaml
@@ -89,6 +89,9 @@
react-syntax-highlighter:
specifier: ^15.5.0
version: 15.6.1(react@18.3.1)
+ react-to-print:
+ specifier: ^3.0.5
+ version: 3.0.5(react@18.3.1)
three:
specifier: ^0.155.0
version: 0.155.0
@@ -2244,6 +2247,11 @@
resolution: {integrity: sha512-OqJ2/vL7lEeV5zTJyG7kmARppUjiB9h9udl4qHQjjgEos66z00Ia0OckwYfRxCSFrW8RJIBnsBwQsHZbVPspqg==}
peerDependencies:
react: '>= 0.14.0'
+
+ react-to-print@3.0.5:
+ resolution: {integrity: sha512-Z15MwMOzYCHWi26CZeFNwflAg7Nr8uWD6FTj+EkfIOjYyjr0MXGbI0c7rF4Fgrbj3XG9hFndb1ourxpPz2RAiA==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ~19
react-transition-group@4.4.5:
resolution: {integrity: sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==}
@@ -4921,6 +4929,10 @@
react: 18.3.1
refractor: 3.6.0
+ react-to-print@3.0.5(react@18.3.1):
+ dependencies:
+ react: 18.3.1
+
react-transition-group@4.4.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
'@babel/runtime': 7.26.9
diff --git a/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx b/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx
index cee27c7..92b5fe3 100644
--- a/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx
+++ b/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx
@@ -19,6 +19,7 @@
useCreateController,
useListContext,
useRefresh,
+ SelectArrayInput
} from 'react-admin';
import {
Dialog,
@@ -38,7 +39,8 @@
TableCell,
Tooltip,
IconButton,
- styled
+ styled,
+
} from '@mui/material';
@@ -53,7 +55,6 @@
import StatusSelectInput from "../../components/StatusSelectInput";
-
const InitModal = ({ open, setOpen }) => {
const refresh = useRefresh();
const translate = useTranslate();
@@ -62,6 +63,7 @@
const notify = useNotify();
const [formData, setFormData] = useState({
+ "warehouseId": null,
"areaId": null,
"type": null,
'status': null
@@ -80,8 +82,10 @@
const reset = () => {
setFormData({
+ "warehouseId": null,
"areaId": null,
"type": null,
+ "typeIds": null,
'status': null
})
}
@@ -95,6 +99,7 @@
...prevData,
[name]: value
}));
+ refresh()
};
const removeEmptyKeys = (obj) => {
@@ -132,8 +137,25 @@
<Grid container spacing={2}>
<Grid item xs={4}>
<ReferenceInput
+ source="warehouseId"
+ reference="warehouse"
+ >
+ <AutocompleteInput
+ label="table.field.loc.warehouseId"
+ optionText="name"
+ onChange={(value) => handleChange(value, 'warehouseId')}
+ value={formData.warehouseId}
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>
+
+ </Grid>
+
+ <Grid item xs={4}>
+ <ReferenceInput
source="areaId"
reference="warehouseAreas"
+ filter={{ warehouseId: formData.warehouseId }}
>
<AutocompleteInput
label="table.field.loc.areaId"
@@ -147,14 +169,17 @@
</Grid>
<Grid item xs={4}>
- <DictionarySelect
+ {/* <DictionarySelect
label={translate("table.field.loc.type")}
name="type"
value={formData.type}
onChange={(e) => handleChange(e.target.value, 'type')}
size="small"
dictTypeCode="sys_loc_type"
- />
+ /> */}
+ <ReferenceArrayInput source="typeIds" reference="locType" >
+ <SelectArrayInput label="table.field.loc.type" onChange={(e) => handleChange(e.target.value, 'typeIds')} />
+ </ReferenceArrayInput>
</Grid>
<Grid item xs={4}>
diff --git a/rsf-admin/src/page/basicInfo/loc/InitModal.jsx b/rsf-admin/src/page/basicInfo/loc/InitModal.jsx
index 80c6a2b..eab60e8 100644
--- a/rsf-admin/src/page/basicInfo/loc/InitModal.jsx
+++ b/rsf-admin/src/page/basicInfo/loc/InitModal.jsx
@@ -19,6 +19,7 @@
useCreateController,
useListContext,
useRefresh,
+ SelectArrayInput
} from 'react-admin';
import {
Dialog,
@@ -70,7 +71,8 @@
"startBay": undefined,
"startLev": undefined,
"startRow": undefined,
- "type": ""
+ "type": "",
+ "typeIds": undefined,
});
const handleClose = (event, reason) => {
@@ -138,15 +140,9 @@
</Grid>
<Grid item xs={4}>
- <DictionarySelect
- label={translate("table.field.loc.type")}
- name="type"
- value={formData.type}
- onChange={(e) => handleChange(e.target.value, 'type')}
- size="small"
- validate={[required()]}
- dictTypeCode="sys_loc_type"
- />
+ <ReferenceArrayInput source="typeIds" reference="locType" >
+ <SelectArrayInput label="table.field.loc.type" onChange={(e) => handleChange(e.target.value, 'typeIds')} />
+ </ReferenceArrayInput>
</Grid>
<Grid item xs={4}>
diff --git a/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx b/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx
index 00e9108..9b368c1 100644
--- a/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx
+++ b/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx
@@ -54,7 +54,11 @@
notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } });
};
+ const [warehouseId, setWrehouseId] = useState();
+ const warehouseChange = (val) => {
+ setWrehouseId(val)
+ }
return (
@@ -98,6 +102,7 @@
label="table.field.loc.warehouseId"
optionText="name"
validate={[required()]}
+ onChange={warehouseChange}
filterToQuery={(val) => ({ name: val })}
/>
</ReferenceInput>
@@ -106,6 +111,7 @@
<ReferenceInput
source="areaId"
reference="warehouseAreas"
+ filter={{ warehouseId }}
>
<AutocompleteInput
label="table.field.loc.areaId"
diff --git a/rsf-admin/src/page/basicInfo/loc/LocEdit.jsx b/rsf-admin/src/page/basicInfo/loc/LocEdit.jsx
index 1505a82..89ad805 100644
--- a/rsf-admin/src/page/basicInfo/loc/LocEdit.jsx
+++ b/rsf-admin/src/page/basicInfo/loc/LocEdit.jsx
@@ -46,7 +46,11 @@
const LocEdit = () => {
const translate = useTranslate();
const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_type')) || [];
+ const [warehouseId, setWrehouseId] = useState();
+ const warehouseChange = (val) => {
+ setWrehouseId(val)
+ }
return (
<Edit
@@ -78,6 +82,7 @@
label="table.field.loc.warehouseId"
optionText="name"
validate={[required()]}
+ onChange={warehouseChange}
filterToQuery={(val) => ({ name: val })}
/>
</ReferenceInput>
@@ -86,6 +91,7 @@
<ReferenceInput
source="areaId"
reference="warehouseAreas"
+ filter={{ warehouseId }}
>
<AutocompleteInput
label="table.field.loc.areaId"
diff --git a/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx b/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx
index 9a461af..25a484e 100644
--- a/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx
@@ -52,8 +52,6 @@
import { DataGrid } from '@mui/x-data-grid';
import StatusSelectInput from "../../components/StatusSelectInput";
-
-
const InitModal = ({ open, setOpen }) => {
const refresh = useRefresh();
const translate = useTranslate();
diff --git a/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx b/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx
index 46c4d0d..7de55f8 100644
--- a/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx
@@ -29,11 +29,11 @@
TextField,
Box,
Button,
- Paper,
- TableContainer,
- Table,
- TableHead,
- TableBody,
+ Radio,
+ RadioGroup,
+ FormControlLabel,
+ FormControl,
+ FormLabel,
TableRow,
TableCell,
Tooltip,
@@ -52,15 +52,14 @@
import { DataGrid } from '@mui/x-data-grid';
import StatusSelectInput from "../../components/StatusSelectInput";
-
+import { useReactToPrint } from "react-to-print";
const InitModal = ({ open, setOpen }) => {
const refresh = useRefresh();
const translate = useTranslate();
-
-
const notify = useNotify();
-
+ const contentRef = useRef(null);
+ const reactToPrintFn = useReactToPrint({ contentRef });
const handleClose = (event, reason) => {
if (reason !== "backdropClick") {
@@ -68,16 +67,43 @@
}
};
+ const [value, setValue] = useState('temp1');
+
+ const handleChange = (event) => {
+ setValue(event.target.value);
+ };
+
+ const handlePrint = () => {
+ // handleClose()
+ reactToPrintFn()
+ };
+
return (
<Dialog open={open} maxWidth="sm" fullWidth>
<DialogCloseButton onClose={handleClose} />
<DialogTitle>{translate('toolbar.print')}</DialogTitle>
- <DialogContent sx={{ mt: 2 }}>
- 1
+ <DialogContent >
+ <FormControl >
+ <RadioGroup
+ row
+ aria-labelledby="demo-controlled-radio-buttons-group"
+ name="controlled-radio-buttons-group"
+ value={value}
+ onChange={handleChange}
+ size="small"
+ sx={{ justifyContent: 'center' }}
+ >
+ <FormControlLabel value="temp1" control={<Radio />} label="妯℃澘1" size="small" />
+ </RadioGroup>
+ </FormControl>
+
+ <Box>
+ <div ref={contentRef}>11</div>
+ </Box>
</DialogContent>
<DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
<Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
- <Button onClick={handleClose} variant="contained" startIcon={<SaveIcon />}>
+ <Button onClick={handlePrint} variant="contained" startIcon={<SaveIcon />}>
{translate('toolbar.confirm')}
</Button>
</Box>
diff --git a/rsf-admin/src/page/warehouseAreas/WarehouseAreasCreate.jsx b/rsf-admin/src/page/warehouseAreas/WarehouseAreasCreate.jsx
index ab4847f..ea0d05f 100644
--- a/rsf-admin/src/page/warehouseAreas/WarehouseAreasCreate.jsx
+++ b/rsf-admin/src/page/warehouseAreas/WarehouseAreasCreate.jsx
@@ -124,6 +124,7 @@
<AutocompleteInput
label="table.field.warehouseAreas.wareId"
optionText="name"
+ validate={[required()]}
filterToQuery={(val) => ({ name: val })}
/>
</ReferenceInput>
diff --git a/rsf-admin/src/page/warehouseAreas/WarehouseAreasEdit.jsx b/rsf-admin/src/page/warehouseAreas/WarehouseAreasEdit.jsx
index fcf1745..e197ebd 100644
--- a/rsf-admin/src/page/warehouseAreas/WarehouseAreasEdit.jsx
+++ b/rsf-admin/src/page/warehouseAreas/WarehouseAreasEdit.jsx
@@ -96,6 +96,7 @@
<AutocompleteInput
label="table.field.warehouseAreas.wareId"
optionText="name"
+ validate={[required()]}
filterToQuery={(val) => ({ name: val })}
/>
</ReferenceInput>
--
Gitblit v1.9.1