Files
WMS/HHWMS.Web/Areas/Configs/Views/Print/Index.cshtml
T
2023-09-05 00:47:02 +08:00

87 lines
3.4 KiB
Plaintext

<el-row id="print">
<el-input v-model="code"
placeholder="请扫描散料盒编码">
</el-input>
<el-button type="primary" @@click="print">打印</el-button>
</el-row>
<script>
$(document).ready(function () {
let code1 = [{
qrcode: '18279822586'
}];
let template1 = {
"panels": [
{
"index": 0,
"name": 1,
"height": 25,
"width": 35,
"paperHeader": 49.5,
"paperFooter": 65.65656565656563,
"printElements": [
{
"options": {
"left": 12.5,
"top": 7.5,
"height": 55,
"width": 70,
"title": "文本",
"field": "qrcode",
"right": 79.99609375,
"bottom": 59.2421875,
"vCenter": 44.99609375,
"hCenter": 31.7421875,
"coordinateSync": false,
"widthHeightSync": false,
"textType": "qrcode",
"barcodeMode": "CODE39",
"qrCodeLevel": 0
},
"printElementType": {
"title": "这是更新后的元素",
"type": "text"
}
}
],
"paperNumberLeft": 69,
"paperNumberTop": 48,
"paperNumberDisabled": true,
"paperNumberContinue": true,
"watermarkOptions": {
"content": "vue-plugin-hiprint",
"rotate": 25,
"timestamp": true,
"format": "YYYY-MM-DD HH:mm"
}
}
]
}
let testhiprintTemplate = new hiprint.PrintTemplate({
template: template1
});
console.log(testhiprintTemplate);
let $html = testhiprintTemplate.getSimpleHtml(code1);
console.log($html);
});
var app = new Vue({
el: "#print",
data() {
return {
code: '123',
}
},
mettods: {
print() {
// this.$print(undefined, template, "123123", {})
$html.jqprint({
debug: false, //如果是true则可以显示iframe查看效果(iframe默认高和宽都很小,可以再源码中调大),默认是false
importCSS: true, //true表示引进原来的页面的css,默认是true。(如果是true,先会找$("link[media=print]"),若没有会去找$("link")中的css文件)
printContainer: true, //表示如果原来选择的对象必须被纳入打印(注意:设置为false可能会打破你的CSS规则)。
operaSupport: false //表示如果插件也必须支持歌opera浏览器,在这种情况下,它提供了建立一个临时的打印选项卡。默认是true
});
}
}
})
</script>