master
lion 3 years ago
parent c628770d30
commit 3f3638f3d0

@ -84,7 +84,10 @@
foreground: '#000000',
});
var canvas = qrcode.find('canvas').get(0);
var img = new Image();
var img = new Image();
var str = decodeURI(decodeURI(printObji['zichanmingcheng']))
var wzlx = decodeURI(decodeURI(printObji['wuzileixing']))
var zcbm = decodeURI(decodeURI(printObji['wuzibianma']))
img.src = canvas.toDataURL('image/png');
img.onload = function() {
canvas.width = canvaswidth;
@ -98,10 +101,14 @@
ctx.textAlign = 'left';
//文字描述
ctx.fillText("苏州河道管理处", 100, 30);
ctx.fillText("物资编码:" + decodeURI(decodeURI(printObji['wuzibianma'])), qrcodeleft + 120, 65);
ctx.fillText("资产名称:" + decodeURI(decodeURI(printObji['zichanmingcheng'])), qrcodeleft + 120, 95);
ctx.fillText("物资类型:" + decodeURI(decodeURI(printObji['wuzileixing'])), qrcodeleft + 120, 125);
// ctx.fillText("入库数量:" + printObji['rukushuliang'], qrcodeleft + 140, 155);
ctx.fillText("物资编码:" + zcbm, qrcodeleft + 120, 65);
ctx.fillText("物资类型:" + wzlx, qrcodeleft + 120, 155);
if(str.length<=4){
ctx.fillText("资产名称:"+str, qrcodeleft + 120, 95);
}else{
ctx.fillText("资产名称:"+str.substring(0,4), qrcodeleft + 120, 95);
ctx.fillText(str.substring(4,str.length), qrcodeleft + 120, 125);
}
ctx.drawImage(img, qrcodeleft, qrcodetop);
var data = canvas.toDataURL('image/png', 1);
var imgOk = new Image();

Loading…
Cancel
Save