From 53d6be638c61eaa478e05a8c4710227f0867ee40 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期六, 22 三月 2025 14:43:38 +0800
Subject: [PATCH] no message
---
rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx | 172 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 99 insertions(+), 73 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx b/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx
index 299e9d7..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={{ 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