Commit 5cb4c35f by yyq1988

台账明细增加二维码功能

parent 8f2d9b23
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<table id="detail_table"></table> <table id="detail_table"></table>
<script> <script>
var selector = "#detail_table"; var selector = "#detail_table";
var LODOP;
function initTable() { function initTable() {
var data = []; var data = [];
$(selector).bootstrapTable({ $(selector).bootstrapTable({
...@@ -70,15 +70,39 @@ ...@@ -70,15 +70,39 @@
url: '${ctx}/warehouse/ledger/ledger/infoDate?batchNum='+ row.batchNum+'&ledger.id=${ledger.id}', url: '${ctx}/warehouse/ledger/ledger/infoDate?batchNum='+ row.batchNum+'&ledger.id=${ledger.id}',
page: true, page: true,
columns: [ columns: [
{checkbox:true},
{field: 'code', title: '物资编码'},
{field: 'name', title: '物资名称'}, {field: 'name', title: '物资名称'},
{field: 'type.name', title: '品名代码'}, {field: 'type.name', title: '品名代码'},
{field: 'model', title: '型号'}, {field: 'model', title: '型号'},
{field: 'batchNum', title: '批次号'}, {field: 'batchNum', title: '批次号'},
{field: 'shelves.name', title: '货架'}, {field: 'shelves.name', title: '货架'},
{field: 'code', title: '物资编码'},
{field: 'amount', title: '单价'}, {field: 'amount', title: '单价'},
{
field: 'qr.url',
title: '二维码',
sortable: true,
sortName: 'qr.url',
formatter: function (){
return '<a class="view-qrcode">查看</a>&nbsp;&nbsp;<a class="print">打印</a>';
},
events: {
'click .view-qrcode': function (e,value,row){
jp.showPic('${ctxPath}'+row.qr.url)
},
'click .print': function (e,value,row){
onPrint(row);
}
}
}
] ]
}) });
$('#table').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#batchPrintBtn').prop('disabled', ! $('#table').bootstrapTable('getSelections').length);
});
}, },
}) })
} }
...@@ -148,11 +172,39 @@ ...@@ -148,11 +172,39 @@
function getTableData() { function getTableData() {
return $(selector).bootstrapTable('getData'); return $(selector).bootstrapTable('getData');
} }
function initLodop(){
LODOP = getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
}
function onPrint(row) {
if(!LODOP){
initLodop();
}
LODOP.PRINT_INIT("打印货品");
LODOP.SET_PRINT_PAGESIZE(1,400,600,0);
if(!row){
var selections = $("#table").bootstrapTable('getSelections');
selections.forEach(function(item){
LODOP.NewPage();
var imgUrl = "${ctxPath}/" + item.qr.url;
LODOP.ADD_PRINT_IMAGE('0%',"0%","100%","100%","<img width='150' border='0' src='"+imgUrl+"' />");
});
LODOP.PREVIEW();
return;
}
LODOP.NewPage();
var imgUrl = "${ctxPath}/" + row.qr.url;
LODOP.ADD_PRINT_IMAGE('0%',"0%","100%","100%","<img width='150' border='0' src='"+imgUrl+"' />");
LODOP.PREVIEW();
}
</script> </script>
<script id="detailTpl" type="text/html"> <script id="detailTpl" type="text/html">
<br> <br>
<div class="container-fluid"> <div class="container-fluid">
<button id="batchPrintBtn" class="btn btn-primary" onclick="onPrint()" disabled>批量打印</button>
<table id="table"></table> <table id="table"></table>
</div> </div>
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment