|  |  |  | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | ,{field: 'id', align: 'center',title: 'ID',hide : true} | 
|---|
|  |  |  | ,{field: 'uuid', align: 'center',title: '编号',hide: true} | 
|---|
|  |  |  | ,{field: 'status$', align: 'center',title: '打印情况',hide: false} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: '物料编码',hide: false} | 
|---|
|  |  |  | ,{field: 'batch', align: 'center',title: '批次',hide: false} | 
|---|
|  |  |  | ,{field: 'anfme', align: 'center',title: '重量(kg)',hide: false} | 
|---|
|  |  |  | ,{field: 'locNo', align: 'center',title: '库位号',hide: false} | 
|---|
|  |  |  | ,{field: 'status$', align: 'center',title: '打印情况', width:100,hide: false} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: '物料编码', width:180,hide: false} | 
|---|
|  |  |  | ,{field: 'batch', align: 'center',title: '批次', width:100,hide: false} | 
|---|
|  |  |  | ,{field: 'anfme', align: 'center',title: '重量(kg)', width:100,hide: false} | 
|---|
|  |  |  | ,{field: 'locNo', align: 'center',title: '库位号', width:120,hide: false} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '商品名称',hide: false} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: '添加时间',hide: true} | 
|---|
|  |  |  | ,{field: 'createBy$', align: 'center',title: '添加人员',hide: true} | 
|---|
|  |  |  | ,{field: 'updateTime$', align: 'center',title: '修改时间',hide: false} | 
|---|
|  |  |  | ,{field: 'updateBy$', align: 'center',title: '修改人员',hide: false} | 
|---|
|  |  |  | ,{field: 'owner$', align: 'center',title: '货主',hide: false} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: '入库时间', width:120,hide: false} | 
|---|
|  |  |  | ,{field: 'createBy$', align: 'center',title: '入库人员', width:100,hide: false} | 
|---|
|  |  |  | ,{field: 'updateTime$', align: 'center',title: '打印时间', width:120,hide: false} | 
|---|
|  |  |  | ,{field: 'updateBy$', align: 'center',title: '打印人员',hide: false} | 
|---|
|  |  |  | ,{field: 'memo', align: 'center',title: '备注',hide: false} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | // 批量打印 | 
|---|
|  |  |  | case "btnPrintBatch": | 
|---|
|  |  |  | printMatCodeNos = []; | 
|---|
|  |  |  | var data = checkStatus; | 
|---|
|  |  |  | if (data.length === 0){ | 
|---|
|  |  |  | layer.msg('请选择打印数据'); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: '批量打印 [数量'+ data.length +']', | 
|---|
|  |  |  | area: ['500px'], | 
|---|
|  |  |  | shadeClose: true, | 
|---|
|  |  |  | content: $('#printDataDiv'), | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | for (var i = 0; i<data.length;i++) { | 
|---|
|  |  |  | printMatCodeNos.push(data[i].id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | end: function () { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | table.on('tool(locInPrintMat)', function(obj){ | 
|---|
|  |  |  | var data = obj.data; | 
|---|
|  |  |  | switch (obj.event) { | 
|---|
|  |  |  | case 'btnPrint': | 
|---|
|  |  |  | layer.msg("废弃") | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | // btnPrint(data.id, data.orderNo, 4); | 
|---|
|  |  |  | case 'edit': | 
|---|
|  |  |  | showEditModel(data); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | 
|---|
|  |  |  | tableReload(false); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 模板选择 | 
|---|
|  |  |  | form.on('radio(selectTemplateRadio)', function (data) { | 
|---|
|  |  |  | $('.template-preview').hide(); | 
|---|
|  |  |  | $('#template-preview-'+data.value).show(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 开始打印 | 
|---|
|  |  |  | form.on('submit(doPrint)', function (data) { | 
|---|
|  |  |  | var templateNo = data.field.selectTemplate; | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/loc/in/mat/print/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: {param: printMatCodeNos}, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | async: false, | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | for (let i=0;i<res.data.length;i++){ | 
|---|
|  |  |  | var templateDom = $("#templatePreview"+templateNo); | 
|---|
|  |  |  | var className = templateDom.attr("class"); | 
|---|
|  |  |  | if (className === 'template-barcode') { | 
|---|
|  |  |  | res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1¶m=" | 
|---|
|  |  |  | +res.data[i].matnr+";" +res.data[i].batch+";" | 
|---|
|  |  |  | +res.data[i].anfme+";" +res.data[i].locNo+";" | 
|---|
|  |  |  | +res.data[i].ownerId+";"+res.data[i].maktx+";" | 
|---|
|  |  |  | +res.data[i].id; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m=" | 
|---|
|  |  |  | +res.data[i].matnr+";" +res.data[i].batch+";" | 
|---|
|  |  |  | +res.data[i].anfme+";" +res.data[i].locNo+";" | 
|---|
|  |  |  | +res.data[i].ownerId+";"+res.data[i].maktx+";" | 
|---|
|  |  |  | +res.data[i].id; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var tpl = templateDom.html(); | 
|---|
|  |  |  | var template = Handlebars.compile(tpl); | 
|---|
|  |  |  | var html = template(res); | 
|---|
|  |  |  | var box = $("#box"); | 
|---|
|  |  |  | box.html(html);box.show(); | 
|---|
|  |  |  | box.print({mediaPrint:true}); | 
|---|
|  |  |  | box.hide(); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 时间选择器 | 
|---|
|  |  |  | function layDateRender(data) { | 
|---|
|  |  |  | setTimeout(function () { | 
|---|