From 82b8c1133e96d7e4b9af4ddbc6ef7c6fb583aa5e Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期六, 31 八月 2024 10:12:42 +0800 Subject: [PATCH] # --- src/main/webapp/static/js/nodeLoc/nodeLoc.js | 123 ++++++++++++++++++++++++---------------- 1 files changed, 73 insertions(+), 50 deletions(-) diff --git a/src/main/webapp/static/js/nodeLoc/nodeLoc.js b/src/main/webapp/static/js/nodeLoc/nodeLoc.js index d144f92..237d9d4 100644 --- a/src/main/webapp/static/js/nodeLoc/nodeLoc.js +++ b/src/main/webapp/static/js/nodeLoc/nodeLoc.js @@ -8,6 +8,7 @@ ]; cols.push.apply(cols, matCols); cols.push( + {fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150} ) return cols; @@ -62,6 +63,7 @@ {field: 'parentName', align: 'center',title: '搴撳尯', hide: false}, {field: 'createBy$', align: 'center',title: '鍒涘缓浜�', hide: false}, {field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿', hide: false}, + // {field: 'status', align: 'center',title: '搴撲綅鍐荤粨', templet: '#stockFreezeTpl'}, {field: 'type$', align: 'center',title: '绫诲瀷', templet: '#tagTpl', hide: false} ]], request: { @@ -83,6 +85,7 @@ if (res.code === 403) { top.location.href = baseUrl+"/"; } + tableData = table.cache.mat; pageCurr=curr; limit(); form.on('checkbox(tableCheckbox)', function (data) { @@ -191,29 +194,39 @@ }); break; // 鎵归噺鎵撳嵃 - case "btnPrintBatch": - printMatCodeNos = []; - var data = checkStatus.data; - 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].matnr); - } - }, - end: function () { - } - }); + case "printBatch": + var checkRows = checkStatus.data; + printContent = []; + if (checkRows.length === 0) { + layer.msg('璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁'); + return; } + printContent = checkRows.map(function (d) { + if (!d.LAY_INDETERMINATE && d.type === 3) { + return d.name; + } else { + return null; + } + }); + layer.open({ + type: 1, + title: '鎵归噺鎵撳嵃 [鏁伴噺'+ printContent.length +']', + area: ['500px'], + shadeClose: true, + content: $('#printDataDiv'), + success: function(layero, index){ + }, + end: function () { + } + }); break; } + }); + + // 妯℃澘閫夋嫨 + form.on('radio(selectTemplateRadio)', function (data) { + $('.template-preview').hide(); + $('#template-preview-'+data.value).show(); }); // 鐩戝惉琛屽伐鍏蜂簨浠� @@ -325,38 +338,34 @@ // 寮�濮嬫墦鍗� form.on('submit(doPrint)', function (data) { var templateNo = data.field.selectTemplate; - $.ajax({ - url: baseUrl+"/node/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; - } else { - res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m="+res.data[i].matnr; - } - } - 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) + var data = []; + var type = 1; + for (var i = 0; i<printContent.length; i ++) { + if (printContent[i] != null && printContent[i] !== '') { + var barcodeUrl; + var templateDom = $("#templatePreview"+templateNo); + var className = templateDom.attr("class"); + type = className === 'template-barcode' ? 1 : 2; + if (type === 1) { + barcodeUrl = baseUrl+"/mac/code/auth?type="+type+"¶m="+printContent[i]+"&width="+200+"&height="+70; + } else { + barcodeUrl = baseUrl+"/mac/code/auth?type="+2+"¶m="+printContent[i]+"&width="+400+"&height="+180; } + data.push({ + item: printContent[i], + barcodeUrl: barcodeUrl + }) } - }) + } + var templateDom = $("#templatePreview"+templateNo); + var tpl = templateDom.html(); + var template = Handlebars.compile(tpl); + var html = template({data: data}); + var box = $("#box"); + box.html(html); + box.show(); + box.print({mediaPrint:true}); + box.hide(); }); // 鎼滅储鏍忔悳绱簨浠� @@ -381,6 +390,20 @@ elem: '#updateTime\\$', type: 'datetime' }); + //搴撲綅鍐荤粨 + form.on('switch(stockFreezeSwitch)', function (obj) { + let index = obj.othis.parents('tr').attr("data-index"); + console.log(index); + let data = tableData[index]; + data[this.stockFreeze] = obj.elem.checked?1:0; + http.post(baseUrl + "/node/updateStatus", { + name: data.name, + status: data[this.stockFreeze] + }, function (res) { + layer.msg(res.msg, {icon: 1}); + tableIns.reload(); + }); + }) }); -- Gitblit v1.9.1