You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
7.4 KiB

3 years ago
<!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>
3 years ago
<script language="javascript" src="/admin/jquery.js"></script>
<script language="javascript" src="/admin/jquery.qrcode.js"></script>
3 years ago
<script>
//二维码宽高
3 years ago
var qrcodewidth = 100;
var qrcodeheight = 100;
3 years ago
var qrcodeleft = 30;
var qrcodetop = 50;
//canvas宽高
3 years ago
var canvaswidth = 302;
var canvasheight = 188;
2 years ago
var VUE_APP_BASE_API = window.location.protocol+"//"+window.location.host;
// var VUE_APP_BASE_API="http://192.168.60.99:9004"
3 years ago
//文字描述位置
var textleft = qrcodewidth / 2;
var texttop = qrcodeheight + 70;
$(function() {
3 years ago
$(".wrap").html("")
3 years ago
var ids = getIds('ids').split(",")
for (var i = 0; i < ids.length; i++) {
getListByid(i + 1, ids[i])
3 years ago
}
})
3 years ago
function getListByid(index, id) {
$.ajax({
type: "get",
timeout: 15000,
async: false,
contentType: 'application/json',
data: {
id: id,
table_name: 'inventorys'
},
url: VUE_APP_BASE_API+'/api/admin/base-form/show',
3 years ago
dataType: "json",
success: function(result) {
var printObj = result
2 years ago
$(".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;'>苏州河道处</p>"+
"<div style='padding:15px;padding-top:5px'>"+
"<img src='"+printObj['path']+"' style='width:3cm; height:3cm;display: inline-block'>"+
"<div style='display:inline-block;vertical-align: top;width:170px'>"+
"<p style='margin:0'>编码:"+printObj['wuzibianma']+"</p>"+
"<p style='margin:0'>类型:"+printObj['wuzileixing']+"</p>"+
"<p style='margin:0'>名称:"+printObj['zichanmingcheng']+"</p>"+
2 years ago
"<p style='margin:0'>型号:"+printObj['guigexinghao']+"</p>"+
"</div>"+
"</div>"+
"</li>")
// createCode("#page" + index, printObj)
3 years ago
$(".load").remove()
},
complete: function(xhr, textStatus) {
}
});
}
3 years ago
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'
};
3 years ago
document.getElementById("jatoolsPrinter").print(myDoc, false); // 直接打印,不弹出打印机设置对话框
3 years ago
// delCookie('objs')
3 years ago
}
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;
}
3 years ago
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
}
3 years ago
</script>
<style>
body {
font-family: "微软雅黑";
font-size: 12px;
padding: 0;
margin: 0;
background: #000;
}
3 years ago
.load{
color: #fff;
font-size: 20px;
}
3 years ago
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; */
3 years ago
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
}
3 years ago
</style>
</head>
<body>
3 years ago
<div class="lists">
<!-- <div class="load">加载中...</div> -->
3 years ago
<ul class="wrap">
<div class="clear"></div>
</ul>
</div>
<div class="bar">
<div class="wp">
<div class="left">生成打印单<br />
本打印功能只能在IE浏览器使用非IE浏览器请采用兼容模式<br />
3 years ago
使用之前需要安装插件(<a href="/admin/jatoolsPrinter_free.zip" target="_blank">点击下载</a>),并正确设置打印机
3 years ago
</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>
3 years ago
</html>