|
|
|
|
@ -9,8 +9,8 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
//二维码宽高
|
|
|
|
|
var qrcodewidth = 110;
|
|
|
|
|
var qrcodeheight = 110;
|
|
|
|
|
var qrcodewidth = 100;
|
|
|
|
|
var qrcodeheight = 100;
|
|
|
|
|
var qrcodeleft = 30;
|
|
|
|
|
var qrcodetop = 50;
|
|
|
|
|
//canvas宽高
|
|
|
|
|
@ -85,7 +85,7 @@
|
|
|
|
|
});
|
|
|
|
|
var canvas = qrcode.find('canvas').get(0);
|
|
|
|
|
var img = new Image();
|
|
|
|
|
var str = decodeURI(decodeURI(printObji['zichanmingcheng']))
|
|
|
|
|
var str = decodeURI(decodeURI(printObji['zichanmingcheng'])).replace(/\s+/g,'')
|
|
|
|
|
var wzlx = decodeURI(decodeURI(printObji['wuzileixing']))
|
|
|
|
|
var zcbm = decodeURI(decodeURI(printObji['wuzibianma']))
|
|
|
|
|
img.src = canvas.toDataURL('image/png');
|
|
|
|
|
@ -101,14 +101,14 @@
|
|
|
|
|
ctx.textAlign = 'left';
|
|
|
|
|
//文字描述
|
|
|
|
|
ctx.fillText("苏州河道管理处", 100, 30);
|
|
|
|
|
ctx.fillText("物资编码:" + zcbm, qrcodeleft + 120, 65);
|
|
|
|
|
if(str.length<=4){
|
|
|
|
|
ctx.fillText("物资类型:" + wzlx, qrcodeleft + 120, 95);
|
|
|
|
|
ctx.fillText("资产名称:"+str, qrcodeleft + 120, 125);
|
|
|
|
|
ctx.fillText("编码:" + zcbm, qrcodeleft + 110, 65);
|
|
|
|
|
if(str.length<=6){
|
|
|
|
|
ctx.fillText("类型:" + wzlx, qrcodeleft + 110, 95);
|
|
|
|
|
ctx.fillText("名称:"+str, qrcodeleft + 110, 125);
|
|
|
|
|
}else{
|
|
|
|
|
ctx.fillText("物资类型:" + wzlx, qrcodeleft + 120, 95);
|
|
|
|
|
ctx.fillText("资产名称:"+str.substring(0,4), qrcodeleft + 120, 125);
|
|
|
|
|
ctx.fillText(str.substring(4,str.length), qrcodeleft + 120, 155);
|
|
|
|
|
ctx.fillText("类型:" + wzlx, qrcodeleft + 110, 95);
|
|
|
|
|
ctx.fillText("名称:"+str.substring(0,6), qrcodeleft + 110, 125);
|
|
|
|
|
ctx.fillText(str.substring(6,str.length), qrcodeleft + 110, 155);
|
|
|
|
|
}
|
|
|
|
|
ctx.drawImage(img, qrcodeleft, qrcodetop);
|
|
|
|
|
var data = canvas.toDataURL('image/png', 1);
|
|
|
|
|
|