浏览代码

后台机器类 机器列表

liujiankang 7 年之前
父节点
当前提交
dfcd35a425

+ 64 - 8
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/machine_List.ftl

@@ -9,15 +9,16 @@
 			.my-input::-webkit-input-placeholder,.my-select{color: #dcdcdc;}
 			.my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px;margin: 0 10px; -webkit-appearance:none;appearance:none;background: url(images/select-1.png) right center no-repeat;background-size:auto 100%;}
 			.my-btn-search{border: 1px solid #32a3d8;padding: 1px 25px;height: 32px;background-color: #32a3d8;color: #fff;}
+            .barcodeImg{margin:10px 0px}
 		</style>
 		<#include "/base/list_base.ftl">
 	</head>
 	<body>
 		<div class="text-c" style="margin-top: 20px;">
 			<form action="${path}/admin/machine/_machine_list" method="post">
-
-					<input class="my-input" type="text" name="printNumber" value="${printNumber!''}" placeholder="每个机器打印数量"/>
-					<button type="button" class="my-btn-search" style="margin-right: 50px;">打印</button>
+				 	<input class="my-input" type="text" id="printNumber" name="printNumber" value="3" placeholder="打印数量"/>
+                	<input class="my-input" type="hidden" id="settingNumber" name="settingNumber" value="3"/>
+					<button type="button" class="my-btn-search" onclick="setting();" style="margin-right: 50px;">设置</button>
 
 					<input class="my-input" type="text" name="machineBarcode" value="${machineBarcode!''}" placeholder="请输入机器编号"/>
 					<select class="my-select" name="machineIsPrint">
@@ -78,7 +79,7 @@
 					<#list page.dataList as list>
 						<tr>
 							<td class="text-c" width="100">${list.machineBarcode }</td>
-							<td class="text-c" width="100"><div id="${100000 + list_index}"><img style="width: 50px;height: 50px;" src="${list.machineQrcode }"></td>
+							<td class="text-c" width="100"><div id="${100000 + list_index}" onclick="print('${list.machineBarcode }','${list.machineQrcode }')"><img style="width: 50px;height: 50px;" src="${list.machineQrcode }"></td>
                             <td class="text-c" width="100">
 							<#if list.machineIsPrint == 1>
                                     未打印
@@ -115,12 +116,67 @@
 				</tbody>
 			</table>
 			<input type="hidden" value="${machineId!''}" name="machineId" id="machineId">
+            <input type="hidden" value="" name="codeId" id="codeId">
+            <div style="position: absolute;top: 80px;height: 23px;display:none;" id="bcTarget" class="barcodeImg"></div>
+			<div  style="display:none;" >
+				<div id="printlist">
+					<#--<div style="width: 227px;height: 142px;position: relative;margin-left: 20px;">
+						<span style="position: absolute;left: 10px;top:20px;font-size: 14px;">WaterO净饮水机</span>
+						<span style="position: absolute;left: 10px;top: 44px;font-size: 12px;">型号:wa-1x</span>
+						<span style="position: absolute;left: 10px;top: 60px;font-size: 12px;">S/N</span>
+                        <div style="position: absolute;top: 80px;height: 23px;" id="bcTarget" class="barcodeImg"></div>
+						&lt;#&ndash;<img style="position: absolute;left: 10px;top: 80px;height: 23px;" src="/common/images/barcode.jpg" />&ndash;&gt;
+						<span style="position: absolute;left: 10px;top: 108px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId"></span>
+						<img style="position: absolute;right: 10px;top:24px;width: 78px;height: 78px;" id="qrcodeImg" src="/common/images/qrcode.jpg" />
+						<span style="position: absolute;right: 26px;top: 108px;font-size: 12px;">no:4295</span>
+					</div>-->
+                </div>
+			</div>
 		</div>
 		<#include "/base/page_util.ftl">
-        <script type="text/javascript">
+        <script type="text/javascript" src="${path}/common/lib/jquery/1.9.1/jquery.PrintArea.js"></script>
+        <script type="text/javascript" src="${path}/common/lib/jquery/1.9.1/jquery-barcode.js"></script>
+
+		<script type="text/javascript">
+			//生成128条形码
+            function code128(barcode){
+                $("#codeId").val(barcode);
+                $("#bcTarget").empty().barcode($("#codeId").val(), "code128",{
+                    barWidth:1, barHeight:23,showHRI:false
+                });
+
+            }
+            function setting() {
+                var printNumber = $("#printNumber").val();
+                $("#settingNumber").val(printNumber);
+                alert("设置成功!");
+            }
+			function print(machineBarcode,machineQrcode){
+                var settingNumber = $("#settingNumber").val();
+                for (var i=0;i<settingNumber;i++){
+                    code128(machineBarcode);
+                    var barcodes = $("#bcTarget").html();
+                    /*$("#barcodeId").html(machineBarcode);
+                    $("#qrcodeImg").attr('src',machineQrcode);*/
+                    $("#printlist").append('<div style="width: 227px;height: 142px;position: relative;margin-left: 20px;">' +
+							'<span style="position: absolute;left: 10px;top:20px;font-size: 14px;">WaterO净饮水机</span>' +
+							'<span style="position: absolute;left: 10px;top: 44px;font-size: 12px;">型号:wa-1x</span>' +
+							'<span style="position: absolute;left: 10px;top: 60px;font-size: 12px;">S/N</span>' +
+							'<div style="position: absolute;top: 80px;height: 23px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
+							'<span style="position: absolute;left: 10px;top: 108px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
+							'<img style="position: absolute;right: 10px;top:24px;width: 78px;height: 78px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
+							'<span style="position: absolute;right: 26px;top: 108px;font-size: 12px;">no:4295</span> ' +
+							'</div>');
+
+
+                }
+                $("#printlist").printArea();
+                $("#printlist").html("");
+            }
+
             ref = setInterval(function(){
                 latestMachine();
-            },2000);
+            },200000);
             function  latestMachine() {
                 $.ajax({
                     cache: true,
@@ -162,8 +218,8 @@
                                 }
 
 								$("#listid").prepend('<tr>'
-                                        +'<td class="text-c" width="100">'+value.machineBarcode+'</td>'
-                                        +'<td class="text-c" width="100"><div id=""><img style="width: 50px;height: 50px;" src="'+value.machineQrcode+'"></td>'
+                                        +'<td class="text-c" width="100">value.machineBarcode</td>'
+                                        +'<td class="text-c" width="100"><div id="" onclick="print('+value.machineBarcode+')"><img style="width: 50px;height: 50px;" src="'+value.machineQrcode+'"></td>'
                                         +'<td class="text-c" width="100">'+machineIsPrint+'</td>'
                                         +'<td class="text-c" width="100">'+machineSalesState+'</td>'
 										+'<td class="text-c" width="100">'+machineSalesDate+'</td>'

文件差异内容过多而无法显示
+ 167 - 0
watero-rst-web/src/main/webapp/common/lib/jquery/1.9.1/jquery-1.4.4.min.js


文件差异内容过多而无法显示
+ 16 - 0
watero-rst-web/src/main/webapp/common/lib/jquery/1.9.1/jquery-barcode.js


+ 37 - 0
watero-rst-web/src/main/webapp/common/lib/jquery/1.9.1/jquery.PrintArea.js

@@ -0,0 +1,37 @@
+// JavaScript Document
+(function($) {
+var printAreaCount = 0;
+$.fn.printArea = function()
+{
+var ele = $(this);
+var idPrefix = "printArea_";
+removePrintArea( idPrefix + printAreaCount );
+printAreaCount++;
+var iframeId = idPrefix + printAreaCount;
+var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
+iframe = document.createElement('IFRAME');
+$(iframe).attr({ style : iframeStyle,
+id    : iframeId
+});
+document.body.appendChild(iframe);
+var doc = iframe.contentWindow.document;
+$(document).find("link")
+.filter(function(){
+return $(this).attr("rel").toLowerCase() == "stylesheet";
+})
+.each(function(){
+doc.write('<link type="text/css" rel="stylesheet" href="' +
+$(this).attr("href") + '" >');
+});
+doc.write('<div class="' + $(ele).attr("class") + '">' + $(ele).html() + '</div>');
+doc.close();
+var frameWindow = iframe.contentWindow;
+frameWindow.close();
+frameWindow.focus();
+frameWindow.print();
+}
+var removePrintArea = function(id)
+{
+$( "iframe#" + id ).remove();
+};
+})(jQuery);