From 53415d2c1e4145b8c11fdb0596edaabef9fc3d7b Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期五, 21 三月 2025 15:05:51 +0800 Subject: [PATCH] Merge branch 'front' of http://47.97.1.152:5880/r/wms-master into front --- rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx | 27 ++++-- rsf-admin/public/img/barcode.jpeg | 0 rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx | 172 ++++++++++++++++++++++++------------------ 3 files changed, 116 insertions(+), 83 deletions(-) diff --git a/rsf-admin/public/img/barcode.jpeg b/rsf-admin/public/img/barcode.jpeg new file mode 100644 index 0000000..7de22eb --- /dev/null +++ b/rsf-admin/public/img/barcode.jpeg Binary files differ diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx index 3a836ee..9f4d75c 100644 --- a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx @@ -4,10 +4,11 @@ SavedQueriesList, FilterLiveSearch, useNotify, - useListContext + useListContext, + SearchInput } from 'react-admin'; import BookmarkIcon from '@mui/icons-material/BookmarkBorder'; -import { Box, Typography, Card, CardContent, useTheme, TextField } from '@mui/material'; +import { Box, Typography, Card, CardContent, useTheme, Input } from '@mui/material'; import { RichTreeView } from "@mui/x-tree-view/RichTreeView"; import { TreeItem2 } from "@mui/x-tree-view/TreeItem2"; @@ -19,6 +20,7 @@ const [selectedOption, setSelectedOption] = useState(null); const [treeData, setTreeData] = useState([]); const [defaultIds, setDefaultIds] = useState(['29']); + const [condition, setCondition] = useState(''); const haveChildren = (item) => { if (Array.isArray(item)) { @@ -38,15 +40,17 @@ return item; }; useEffect(() => { - request.post('/matnrGroup/tree') + http() + }, [condition]); + + const http = () => { + request.post('/matnrGroup/tree', { condition }) .then(res => { if (res?.data?.code === 200) { let data = res.data.data; let items = haveChildren(data) - setTreeData(items) setDefaultIds([items.at(0).id]) - } else { notify(res.data.msg); @@ -56,12 +60,12 @@ notify('Error fetching tree data'); }); - }, []); + } const handleNodeSelect = (event, nodeId) => { setFilters({ groupId: nodeId }); }; - const handleSearch = () => { - console.log('Search Input:', selectedOption); + const handleSearch = (e) => { + setCondition(e.target.value) }; @@ -96,8 +100,11 @@ }} > <CardContent> - <SavedQueriesList icon={<BookmarkIcon />} /> - <FilterLiveSearch source="condition" /> + <Input + placeholder="鎼滅储鐗╂枡鍒嗗尯" + sx={{ '--Input-focused': 1, marginBottom: '10px' }} + onChange={handleSearch} + /> <RichTreeView defaultExpandedItems={defaultIds} expansionTrigger="iconContainer" diff --git a/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx b/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx index a2863a9..83df0e0 100644 --- a/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx @@ -54,7 +54,7 @@ import { useReactToPrint } from "react-to-print"; -const InitModal = ({ open, setOpen }) => { +const PrintModal = ({ open, setOpen }) => { const refresh = useRefresh(); const translate = useTranslate(); const notify = useNotify(); @@ -98,76 +98,17 @@ </FormControl> <Box> - <div ref={contentRef} style={{ display: 'flex', justifyContent: 'center' }}> - <table - className="contain" - style={{ - overflow: 'hidden', - fontSize: 'small', - tableLayout: 'fixed', - width: '280px', - borderCollapse: 'collapse', // 鍚堝苟杈规 - border: '1px solid black' // 璁剧疆琛ㄦ牸鏁翠綋杈规 - }} - > - <tbody> - <tr style={{ height: '74px' }}> - <td - align="center" - colSpan={3} - style={{ border: '1px solid black' }} // 璁剧疆鍗曞厓鏍艰竟妗� - > - 鍟嗗搧缂栫爜 - </td> - <td - align="center" - className="barcode" - colSpan={9} - style={{ border: '1px solid black' }} - > - {/* <img className="template-code" src={barcodeUrl} style={{ width: '90%' }} alt="Barcode" /> */} - <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}> - <span>{'matnr'}</span> - </div> - </td> - </tr> - <tr style={{ height: '74px' }}> - <td - align="center" - colSpan={3} - style={{ border: '1px solid black' }} - > - 鍟嗗搧 - </td> - <td - align="center" - colSpan={5} - style={{ - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - border: '1px solid black' - }} - > - {'maktx'} - </td> - <td - align="center" - colSpan={2} - style={{ border: '1px solid black' }} - > - 澶囨敞 - </td> - <td - align="center" - colSpan={2} - style={{ border: '1px solid black' }} - > - {'memo'} - </td> - </tr> - </tbody> - </table> + <div style={{ textAlign: 'center' }}> + <PrintTemp /> + </div> + <style>{` + @media print { + .print-content { + display: block!important; + } + }`} </style> + <div ref={contentRef} className="print-content" style={{ textAlign: 'center', display: 'none' }}> + <PrintTemp /> </div> </Box> </DialogContent> @@ -178,8 +119,93 @@ </Button> </Box> </DialogActions> - </Dialog> + </Dialog > ); } -export default InitModal; \ No newline at end of file +export default PrintModal; + +const PrintTemp = (props) => { + const [data, setData] = useState([{ + barcode: '/img/barcode.jpeg', + product: 'xxxxxx-xx/xx', + remark: 'xx' + }]); + return ( + <> + {data.map((item, index) => ( + <table + key={index} + className="contain" + style={{ + overflow: 'hidden', + fontSize: 'small', + tableLayout: 'fixed', + width: '280px', + borderCollapse: 'collapse', + borderSpacing: 0, + margin: '0 auto', + marginTop: '10px', + }} + > + <tbody> + <tr style={{ height: '74px' }}> + <td align="center" colSpan={3} style={{ border: '1px solid black' }} > + 鍟嗗搧缂栫爜 + </td> + <td + align="center" + className="barcode" + colSpan={9} + style={{ border: '1px solid black' }} + > + <img className="template-code" src={item.barcode} style={{ width: '90%', verticalAlign: 'middle' }} alt="Barcode" /> + <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}> + <span>{'xxxxxx'}</span> + </div> + </td> + </tr> + <tr style={{ height: '74px' }}> + <td + align="center" + colSpan={3} + style={{ border: '1px solid black' }} + > + 鍟嗗搧 + </td> + <td + align="center" + colSpan={5} + style={{ + overflow: 'hidden', + whiteSpace: 'nowrap', + textOverflow: 'ellipsis', + border: '1px solid black' + }} + > + {item.product} + </td> + <td + align="center" + colSpan={2} + style={{ border: '1px solid black' }} + > + 澶囨敞 + </td> + <td + align="center" + colSpan={2} + style={{ border: '1px solid black' }} + > + {item.remark} + </td> + </tr> + </tbody> + </table> + ))} + + </> + ) +} + + -- Gitblit v1.9.1