skyouc
6 天以前 543d35f102cc067ba1178ff177881e68110bda72
rsf-admin/src/page/basicInfo/basContainer/PrintModal.jsx
@@ -53,8 +53,8 @@
import StatusSelectInput from "../../components/StatusSelectInput";
import { useReactToPrint } from "react-to-print";
import jsbarcode from 'jsbarcode'
import { el } from "date-fns/locale";
// import jsbarcode from 'jsbarcode'
import Barcode from 'react-barcode';
import { padding } from "@mui/system";
const PrintModal = ({ open, setOpen, rows }) => {
@@ -130,7 +130,7 @@
                            }}
                        >
                            <tbody>
                                <tr style={{ height: '94px' ,padding: '5px', }}>
                                <tr style={{ height: '94px', padding: '5px', }}>
                                    <td
                                        align="center"
                                        className="barcode"
@@ -173,26 +173,30 @@
const PrintTemp = ({ rows }) => {
    const notify = useNotify();
    const [data, setData] = useState([]);
    const [barcodeConfig, setBarcodeConfig] = useState({
        width: 2,
        height: 100,
        displayValue: true
    });
    const http = async () => {
        const res = await request.post(`/basContainer/many/${rows?.join()}`);
        if (res?.data?.code === 200) {
            let val = res.data.data.map((el => {
                return {
                    barcode: '/img/barcode.jpeg',
                    barcode: el.code,
                    code: el.code,
                    name: el.name,
                    memo: el.memo
                }
            }))
            setData(val)
            setTimeout(() => {
                val.forEach((el) => {
                    jsbarcode(`#barcode${el.code}`, el.code, { height: 30 });
                });
            }, 10);
            // setTimeout(() => {
            //     val.forEach((el) => {
            //         jsbarcode(`#barcode${el.code}`, el.code, { height: 30 });
            //     });
            // }, 10);
        } else {
            notify(res.data.msg);
        }
@@ -231,11 +235,7 @@
                                colSpan={9}
                                style={{ border: '1px solid black' }}
                            >
                                {/* <img id={"barcode" + item.code} style={{ width: '70%', verticalAlign: 'middle' }} /> */}
                                <img className="template-code" src={item.barcode} style={{ width: '90%', verticalAlign: 'middle' }} alt="Barcode" />
                                <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}>
                                    <span>{item.code}</span>
                                </div>
                                <Barcode value={item.code} {...barcodeConfig} />
                            </td>
                        </tr>
                    </tbody>