2018-08-30
直接调用浏览器的打印方法
1、打印按钮
<a href="#" target="_self" οnclick="printme()">打印</a>
2、js
//打印 function printme() {$.messager.confirm('确认', '确认打印?', function (r) {if (r) { document.body.innerHTML = document.getElementById('div1').innerHTML + '<br/>';window.print();var OrderGUID = $("#OrderGUID").val();window.location.href = "../Details/?id=" + OrderGUID + "&Check=0";//打印记录 $.ajax({type: "post",anysc: false,url: '@Url.Action("AddPrintLog")',data: { OrderGUID: OrderGUID },success: function (da) {if (da > 0) {//alert(da.split('|')[0]);$.messager.alert('提示!', '成功!');//location.reload();window.location.href = "../Details/?id=" + OrderGUID + "&Check=0";} else if (da = -1) {$.messager.alert('提示!', '添加操作记录错误!');return false;}},});}});}

4、结果