|
|
<!DOCTYPE html
|
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
<head>
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
<title>打印</title>
|
|
|
<script language="javascript" src="/admin/jquery.js"></script>
|
|
|
<script language="javascript" src="/admin/jquery.qrcode.js"></script>
|
|
|
|
|
|
<script>
|
|
|
//二维码宽高
|
|
|
var qrcodewidth = 100;
|
|
|
var qrcodeheight = 100;
|
|
|
var qrcodeleft = 30;
|
|
|
var qrcodetop = 50;
|
|
|
//canvas宽高
|
|
|
var canvaswidth = 302;
|
|
|
var canvasheight = 188;
|
|
|
var VUE_APP_BASE_API = window.location.protocol+"//"+window.location.host;
|
|
|
// var VUE_APP_BASE_API="http://192.168.60.99:9004"
|
|
|
//文字描述位置
|
|
|
var textleft = qrcodewidth / 2;
|
|
|
var texttop = qrcodeheight + 70;
|
|
|
// 打印日期
|
|
|
var date = new Date()
|
|
|
var year = date.getFullYear()
|
|
|
var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : '0'+(date.getMonth() + 1)
|
|
|
var day = date.getDate()
|
|
|
var printDate = year + '-'+month+'-'+day
|
|
|
$(function() {
|
|
|
$(".wrap").html("")
|
|
|
var ids = getIds('ids').split(",")
|
|
|
for (var i = 0; i < ids.length; i++) {
|
|
|
getListByid(i + 1, ids[i])
|
|
|
}
|
|
|
})
|
|
|
|
|
|
function getListByid(index, id) {
|
|
|
$.ajax({
|
|
|
type: "get",
|
|
|
timeout: 15000,
|
|
|
async: false,
|
|
|
contentType: 'application/json',
|
|
|
data: {
|
|
|
id: id,
|
|
|
},
|
|
|
url: VUE_APP_BASE_API+'/api/admin/inventory/show',
|
|
|
dataType: "json",
|
|
|
success: function(result) {
|
|
|
var printObj = result
|
|
|
// var fenleiName = printObj['wuzibianma_material_infos_wuzibianma_relation']['fenlei_detail']?
|
|
|
// printObj['wuzibianma_material_infos_wuzibianma_relation']['fenlei_detail']['name']:''
|
|
|
var guige = printObj['wuzibianma_material_infos_wuzibianma_relation']['wuziguige']?printObj['wuzibianma_material_infos_wuzibianma_relation']['wuziguige']:''
|
|
|
var xinghao = printObj['wuzibianma_material_infos_wuzibianma_relation']['guigexinghao']?printObj['wuzibianma_material_infos_wuzibianma_relation']['guigexinghao']:""
|
|
|
var shunxuhao = printObj['shunxuhao']?"-"+printObj['shunxuhao']:''
|
|
|
var stocks_items = printObj['stocks_items']&&printObj['stocks_items'].length>0?printObj['stocks_items'][0]:''
|
|
|
var chanquan = stocks_items.chanquanxinxi_detail?stocks_items.chanquanxinxi_detail.value:'市河道处'
|
|
|
var gudingzichanbianma = printObj['gudingzichanbianma']? printObj['gudingzichanbianma']:''
|
|
|
var jiliangdanwei = printObj['jiliangdanwei']? printObj['jiliangdanwei']:''
|
|
|
|
|
|
|
|
|
$(".wrap").append("<li id='page" + index + "' style='width: 9cm; height: 5cm;font-size: 16px;font-weight:bold;background-color: #fff;'>" +
|
|
|
"<p style='text-align:center;margin-bottom:0;padding-top:5px;'><span style='text-align:left;display:inline-block;width:3cm'>"+printDate+"</span>"+
|
|
|
"<span style='text-align:left;display:inline-block;width:6cm'>"+chanquan+"</span></p>"+
|
|
|
"<div style='padding:5px 15px;'>"+
|
|
|
"<img src='"+printObj['path']+"' style='width:3cm; height:3cm;display: inline-block'>"+
|
|
|
"<div style='display:inline-block;vertical-align: top;width:170px;font-size:14px'>"+
|
|
|
"<p style='margin:0'>类别:"+printObj['material_info_type']+"</p>"+
|
|
|
"<p style='margin:0'>物资名称:"+printObj['zichanmingcheng']+"</p>"+
|
|
|
"<p style='margin:0'>规格:"+guige+"</p>"+
|
|
|
"<p style='margin:0'>型号:"+xinghao+"</p>"+
|
|
|
"<p style='margin:0'><span>批次:"+printObj['rukupici']+"</span><span>"+(printObj['wuzileixing']==='一物一码'?'同批数量:':'数量:')+"</span>"+printObj['total_num']+jiliangdanwei+"</p>"+
|
|
|
"<p style='margin:0'>"+(printObj['wuzileixing']==='一物一码'?'批内序号:'+shunxuhao:'')+"</p>"+
|
|
|
"</div>"+
|
|
|
"</div>"+
|
|
|
"<p style='padding:15px;padding-top:0;margin:0;text-align:left'>"+(gudingzichanbianma?'固定资产编码:'+gudingzichanbianma:'')+"</p>"+
|
|
|
"</li>")
|
|
|
|
|
|
// createCode("#page" + index, printObj)
|
|
|
$(".load").remove()
|
|
|
},
|
|
|
complete: function(xhr, textStatus) {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
function doPrint(obj) {
|
|
|
if ($(obj).hasClass("disabled")) {
|
|
|
alert("已经打印过了,如要重新打印请刷新本页");
|
|
|
return false;
|
|
|
}
|
|
|
$(obj).addClass("disabled");
|
|
|
var myDoc = {
|
|
|
settings: {
|
|
|
topMargin: 0,
|
|
|
leftMargin: 0,
|
|
|
bottomMargin: 0,
|
|
|
rightMargin: 0
|
|
|
}, // 设置上下左距页边距为10毫米,注意,单位是 1/10毫米
|
|
|
documents: document,
|
|
|
marginIgnored: true,
|
|
|
copyrights: '杰创软件拥有版权 www.jatools.com'
|
|
|
};
|
|
|
document.getElementById("jatoolsPrinter").print(myDoc, false); // 直接打印,不弹出打印机设置对话框
|
|
|
// delCookie('objs')
|
|
|
}
|
|
|
|
|
|
function delCookie(name)
|
|
|
|
|
|
{
|
|
|
|
|
|
var exp = new Date();
|
|
|
|
|
|
exp.setTime(exp.getTime() - 1);
|
|
|
|
|
|
var cval = getCookie(name);
|
|
|
|
|
|
if (cval != null)
|
|
|
|
|
|
document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
|
|
|
|
|
|
}
|
|
|
|
|
|
function getCookie(cookieName) {
|
|
|
//获取所有的cookie "psw=1234we; rememberme=true; user=Annie"
|
|
|
var totalCookie = document.cookie;
|
|
|
//获取参数所在的位置
|
|
|
var cookieStartAt = totalCookie.indexOf(cookieName + "=");
|
|
|
//判断参数是否存在 不存在直接返回
|
|
|
if (cookieStartAt == -1) {
|
|
|
return;
|
|
|
}
|
|
|
//获取参数值的开始位置
|
|
|
var valueStartAt = totalCookie.indexOf("=", cookieStartAt) + 1;
|
|
|
//以;来获取参数值的结束位置
|
|
|
var valueEndAt = totalCookie.indexOf(";", cookieStartAt);
|
|
|
//如果没有;则是最后一位
|
|
|
if (valueEndAt == -1) {
|
|
|
valueEndAt = totalCookie.length;
|
|
|
}
|
|
|
//截取参数值的字符串
|
|
|
var cookieValue = unescape(totalCookie.substring(valueStartAt, valueEndAt));
|
|
|
return cookieValue;
|
|
|
}
|
|
|
|
|
|
function getIds(name) {
|
|
|
var reg = new RegExp("(^|&)" + name.toLowerCase() + "=([^&]*)(&|$)");
|
|
|
var r = window.location.search.substr(1).toLowerCase().match(reg);
|
|
|
if (r != null) {
|
|
|
return unescape(r[2].replace(new RegExp(/(%25)/g), '%').replace(new RegExp(/(%25)/g), '%'));
|
|
|
}
|
|
|
return null
|
|
|
}
|
|
|
</script>
|
|
|
<style>
|
|
|
body {
|
|
|
font-family: "微软雅黑";
|
|
|
font-size: 12px;
|
|
|
padding: 0;
|
|
|
margin: 0;
|
|
|
background: #000;
|
|
|
}
|
|
|
.load{
|
|
|
color: #fff;
|
|
|
font-size: 20px;
|
|
|
}
|
|
|
ul,
|
|
|
li {
|
|
|
padding: 0;
|
|
|
margin: 0;
|
|
|
list-style: none;
|
|
|
}
|
|
|
|
|
|
.clear {
|
|
|
clear: both;
|
|
|
}
|
|
|
|
|
|
.bar {
|
|
|
position: fixed;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
height: 60px;
|
|
|
background: #333;
|
|
|
color: #fff;
|
|
|
line-height: 20px;
|
|
|
width: 100%;
|
|
|
}
|
|
|
|
|
|
.bar A {
|
|
|
color: #fff;
|
|
|
text-decoration: underline;
|
|
|
}
|
|
|
|
|
|
.bar A:hover {
|
|
|
text-decoration: none;
|
|
|
color: #ccc;
|
|
|
}
|
|
|
|
|
|
.bar .wp {
|
|
|
width: 1000px;
|
|
|
margin: auto;
|
|
|
position: relative;
|
|
|
}
|
|
|
|
|
|
.bar .wp .left {
|
|
|
float: left;
|
|
|
}
|
|
|
|
|
|
.bar .wp .right {
|
|
|
float: right;
|
|
|
padding-top: 20px;
|
|
|
}
|
|
|
|
|
|
.lists {
|
|
|
padding-top: 80px;
|
|
|
padding-bottom: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.lists li {
|
|
|
/* float: left; */
|
|
|
margin-left: 20px;
|
|
|
margin-bottom: 10px;
|
|
|
/* color:#fff; */
|
|
|
font-size: 18px;
|
|
|
background-color: #fff;
|
|
|
}
|
|
|
.lists li>p{
|
|
|
text-align:center;
|
|
|
margin-bottom:0;
|
|
|
padding-top:10px;
|
|
|
}
|
|
|
.lists li>div{
|
|
|
padding:15px;
|
|
|
}
|
|
|
.lists li>div img{
|
|
|
display: inline-block
|
|
|
}
|
|
|
.lists li>div div{
|
|
|
display:inline-block;
|
|
|
vertical-align: top;
|
|
|
width:180px
|
|
|
}
|
|
|
.lists li>div div p{
|
|
|
margin:0
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="lists">
|
|
|
<!-- <div class="load">加载中...</div> -->
|
|
|
<ul class="wrap">
|
|
|
|
|
|
<div class="clear"></div>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="bar">
|
|
|
<div class="wp">
|
|
|
<div class="left">生成打印单<br />
|
|
|
本打印功能只能在IE浏览器使用,非IE浏览器请采用兼容模式<br />
|
|
|
使用之前需要安装插件(<a href="/admin/jatoolsPrinter_free.zip" target="_blank">点击下载</a>),并正确设置打印机
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
<input type="button" value="打印" onClick='doPrint(this);'>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<OBJECT ID="jatoolsPrinter" CLASSID="CLSID:B43D3361-D075-4BE2-87FE-057188254255"
|
|
|
codebase="jatoolsPrinter.cab#version=8,6,0,0">
|
|
|
</OBJECT>
|
|
|
</body>
|
|
|
</html>
|