From 7fd4de087a1b9629d419e3178a5321eeb50dd75d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 13 三月 2021 16:14:04 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/mat/mat.js | 86 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 85 insertions(+), 1 deletions(-)
diff --git a/src/main/webapp/static/js/mat/mat.js b/src/main/webapp/static/js/mat/mat.js
index ae347e5..2233719 100644
--- a/src/main/webapp/static/js/mat/mat.js
+++ b/src/main/webapp/static/js/mat/mat.js
@@ -1,4 +1,5 @@
var pageCurr;
+var printMatCodeNos = [];
layui.use(['table','laydate', 'form'], function(){
var table = layui.table;
var $ = layui.jquery;
@@ -23,9 +24,9 @@
// ,{field: 'id', align: 'center',title: 'ID'}
// ,{field: 'uuid', align: 'center',title: '缂栧彿'}
// ,{field: 'nodeId$', align: 'center',title: '鎵�灞炲尯鍩�',event: 'nodeId', style: 'cursor:pointer'}
+ ,{field: 'tagId$', align: 'center',title: '褰掔被', templet: '#tagTpl'}
,{field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿'}
,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О', minWidth: 300}
- ,{field: 'tagId$', align: 'center',title: '鎵�灞炲綊绫�', templet: '#tagTpl'}
// ,{field: 'name', align: 'center',title: '鍚嶇О'}
,{field: 'specs', align: 'center',title: '瑙勬牸'}
,{field: 'model', align: 'center',title: '鍨嬪彿', hide: true}
@@ -184,6 +185,29 @@
});
});
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 () {
+ }
+ });
+ }
+ break;
}
});
@@ -191,6 +215,23 @@
table.on('tool(mat)', function(obj){
var data = obj.data;
switch (obj.event) {
+ // 鎵撳嵃
+ case "btnPrint":
+ printMatCodeNos = [];
+ layer.open({
+ type: 1,
+ title: data.matnr + ' [鏁伴噺锛�1]',
+ area: ['500px'],
+ shadeClose: true,
+ content: $('#printDataDiv'),
+ success: function(layero, index){
+ layer.iframeAuto(index);
+ printMatCodeNos.push(data.matnr);
+ },
+ end: function () {
+ }
+ });
+ break;
// 璇︽儏
case 'detail':
layer.open({
@@ -232,6 +273,49 @@
}
});
+ // 妯℃澘閫夋嫨
+ 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+"/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;
+ } 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);
+ let 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)
+ }
+ }
+ })
+ })
+
// 鏁版嵁淇濆瓨鍔ㄤ綔
form.on('submit(save)', function () {
if (banMsg != null){
--
Gitblit v1.9.1