From 35c422aa74e47a2ee4bea49e6799fefac1b63713 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期五, 21 三月 2025 13:39:47 +0800 Subject: [PATCH] Merge branch 'front' into devlop --- rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 108 insertions(+), 12 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx b/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx index 46c4d0d..a2863a9 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,113 @@ } }; + 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} 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> + </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> -- Gitblit v1.9.1