reportmes.html 4.94 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <head th:include="include :: header"></head>
    <title></title>
    <!--<link href="css/bootstrap.min.css" rel="stylesheet" />-->
    <!--<link href="css/font-awesome.min.css" rel="stylesheet" />-->
    <!--&lt;!&ndash;[if IE]>-->
    <!--<link href="css/font-awesome-ie7.min.css" rel="stylesheet" />-->
    <!--<![endif]&ndash;&gt;-->
    <style type="text/css">
        .table-bordered td, .table-bordered th {r
        border: 1px solid #000 !important;
        }
        .table tbody tr td{
            padding: 3px;
            text-align: center;
        }
        @media print {
            .noprint {
                display: none;
            }
        }
    </style>
</head>

<body id="ddd">
<div class="noprint container" style="text-align:right; padding: 20px;float: right">
    <span style="padding-left:20px;"><button type="button" onClick="a()"><i class="fa fa-print"></i> 打印</button></span>
</div>
<div class="container" style=" width:320px;/*height:228px;*/color: #333">
    <div class="row">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="dy-report table table-bordered"
               th:each="row:${receiptDetailMaterialCodes}" style="border: none;">
            <caption style="font-size:18px;text-align:center; color:#333; padding-bottom: 3px;"></caption>

            <tbody>
            <tr>
                <td colspan="2" scope="col" style="display:none;">
                    <span th:text="${row.materialCode}" ></span>
                </td>
            </tr>
            <tr style="vertical-align:middle;">
                <td style="text-align:center;border:none !important">
                    <span ><img></img></span>
                </td>
            </tr>

            </tbody>

        </table>
    </div>
</div>
<div th:include="include :: footer"></div>
<script charset="utf-8" type="text/javascript" th:src="@{/js/barcode/JsBarcode.all.js} "></script>
<script charset="utf-8" type="text/javascript" th:src="@{/js/jquery-1.4.4.min.js}"></script>
<script charset="utf-8" type="text/javascript" th:src="@{/js/jquery.jqprint-0.3.js}"></script>
<script type="text/javascript">

    $(function () {
        print_qrcode()
    });

    function a(){
        $("#ddd").jqprint();
        print_qrcode();
        window.print();
    }
    function print_qrcode(){
        $('.dy-report').each(function (i,item) {
            // var barcodeText=$(this).children()[1].children[0].innerText;
            // barcodeText=barcodeText.substring(5);
            let barcodeText = $(item.querySelector('span')).text();
            JsBarcode($(this).children()[1].querySelector("img"), barcodeText, barcodeStyle);
        });
    }

    var  barcodeStyle = {
        format: "CODE128",//选择要使用的条形码类型
        width:1,//设置条之间的宽度
        height:40,//高度
        displayValue:true,//是否在条形码下方显示文字
        // text:"456",//覆盖显示的文本
        // fontOptions:"bold italic",//使文字加粗体或变斜体
        font:"monospace",//设置文本的字体fantasy
        textAlign:"center",//设置文本的水平对齐方式
        textPosition:"bottom",//设置文本的垂直位置
        textMargin:1,//设置条形码和文本之间的间距
        fontSize:12,//设置文本的大小
        background:"#ffffff",//设置条形码的背景
        lineColor:"#000000",//设置条和文本的颜色。
        margin:1//设置条形码周围的空白边距
    };



    /*function a() {
        // $("#ddd").jqprint();
        $(".qrcode").children().remove();
        print_qrcode();
        window.print();
    }
    function print_qrcode(){
        $('.dy-report').each(function (i,item) {
            var company=$(this).children()[1].children[0].innerText;
            //var code16=$(this).children()[1].children[1].innerText;
            var name=$(this).children()[1].children[1].innerText;
            var spec=$(this).children()[1].children[2].innerText;
            //var project=$(this).children()[1].children[5].innerText;
            company=company.substring(5);
            //code16=code16.substring(5);
            name=name.substring(5);
            spec=spec.substring(5);
            //project=project.substring(5);
            var reg=/\t/;
            name=name.replace(reg,"");
            var qty=$(this).find('input').val();
            // var code_text=company+'/'+ code16 +'/' +name+'/'+spec+'/'+qty+'/'+project;
            var code_text=company+'/'+ name +'/'+ spec +'/'+qty;
            var QRcode=new QRCode($(this).find('.qrcode')[0],{
                text:code_text,
                width:56,
                height:56,
                correctLevel:QRCode.CorrectLevel.L
            });
        });
    }*/

</script>

</body>
</html>