From a8ab542c3f3bbb304f6fd7e66897433df65a2b3e Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期三, 28 二月 2024 16:28:30 +0800
Subject: [PATCH] 完善出入库日志记录
---
src/main/webapp/static/js/pla/plaDetl.js | 201 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 186 insertions(+), 15 deletions(-)
diff --git a/src/main/webapp/static/js/pla/plaDetl.js b/src/main/webapp/static/js/pla/plaDetl.js
index 284a720..28312ed 100644
--- a/src/main/webapp/static/js/pla/plaDetl.js
+++ b/src/main/webapp/static/js/pla/plaDetl.js
@@ -7,22 +7,20 @@
var checkStatus = [];
var dataCheck = [];
var admin;
+var printData = [];
+var layDate;
function getCol() {
var cols = [
{field: 'id', title: 'id', align: 'center',hide:true}
- ,{type: 'checkbox'}
+ ,{type: 'checkbox',totalRow:true}
+ ,{field:'id', width:80, title: '', sort: true, totalRowText: '鍚堣锛�',hide: true}
,{field: 'pakinTime$', title: '鍏ュ簱鏃堕棿', align: 'center' , sort:true}
- ,{field: 'owner', align: 'center',title: '涓讳綋',edit:true}
- ,{field: 'type', align: 'center',title: '鐗╄祫绫诲埆',hide:true,edit:true}
- ,{field: 'proOrderNo', align: 'center',title: '鐢熶骇璁㈠崟缂栧彿',hide:true,edit:true}
- ,{field: 'workshop', align: 'center',title: '鐢熶骇杞﹂棿',hide:true,edit:true}
- ,{field: 'line', align: 'center',title: '鐢熶骇绾�',hide:true,edit:true}
,{field: 'matnr', align: 'center',title: '瀛樿揣缂栫爜',hide:true,edit:true}
,{field: 'brand', align: 'center',title: '鐗屽彿',edit:true}
,{field: 'batch', align: 'center',title: '鎵瑰彿',edit:true, width: 150, sort:true}
,{field: 'packageNo', align: 'center',title: '鍖呰鍙�',edit:true, sort:true}
,{field: 'proDate', align: 'center',title: '鐢熶骇鏃ユ湡',edit:true, width: 100}
- ,{field: 'weight', align: 'center',title: '閲嶉噺KG',edit:true}
+ ,{field: 'weight', align: 'center',title: '閲嶉噺KG',edit:true,totalRow:true}
,{field: 'packageType', align: 'center',title: '鍖呰绫诲瀷',edit:true}
,{field: 'zpalletType', align: 'center',title: '鎵樼洏绫诲瀷',edit:true}
,{field: 'filmWrap', align: 'center',title: '缂犺啘',edit:true,hide:true}
@@ -49,13 +47,19 @@
,{field: 'position', align: 'center',title: '瀛樻斁浣嶇疆',edit:true,hide:true}
,{field: 'stash', align: 'center',title: '浠撳簱',edit:true,hide:true}
,{field: 'locNo', align: 'center',title: '搴撲綅',edit:true}
- ,{field: 'weightAnfme', align: 'center',title: '鍓╀綑閲嶉噺锛圞G锛�',edit:true}
+ ,{field: 'owner', align: 'center',title: '涓讳綋',edit:true}
+ ,{field: 'type', align: 'center',title: '鐗╄祫绫诲埆',hide:true,edit:true}
+ ,{field: 'proOrderNo', align: 'center',title: '鐢熶骇璁㈠崟缂栧彿',hide:true,edit:true}
+ ,{field: 'workshop', align: 'center',title: '鐢熶骇杞﹂棿',hide:true,edit:true}
+ ,{field: 'line', align: 'center',title: '鐢熶骇绾�',hide:true,edit:true}
+ ,{field: 'weightAnfme', align: 'center',title: '鍓╀綑閲嶉噺锛圞G锛�',edit:true,totalRow:true}
,{field: 'qtyAnfme', align: 'center',title: '寰呭嚭搴撻噸閲忥紙KG锛�',hide:true}
,{field: 'status', align: 'center',title: '鐘舵��', templet: setState ,edit:true}
,{field: 'stockFreeze', align: 'center',title: '搴撳瓨鍐荤粨', templet: '#stockFreezeTpl'}
,{field: 'stockFreezeBy', align: 'center',title: '鎿嶄綔浜哄憳',hide:true}
,{field: 'stockFreezeDate$', align: 'center',title: '鎿嶄綔鏃ユ湡',hide:true}
,{align: 'center', title: '娴佽浆鏄庣粏', toolbar: '#tbLook'}
+ ,{field: 'createTime$', title: '鍒涘缓鏃堕棿', align: 'center' , sort:true}
// ,{field: 'orderNo', align: 'center',title: '鍗曞彿', hide:true}
// ,{field: 'pakoutTime', align: 'center',title: '鍑哄簱鏃堕棿', hide:true}
// ,{field: 'orderWeight', align: 'center',title: '閲嶉噺', hide:true}
@@ -86,15 +90,21 @@
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
-}).extend({
- dropdown: 'dropdown/dropdown',
}).use(['table','laydate', 'form', 'admin', 'dropdown'], function() {
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
- var layDate = layui.laydate;
+ laydate = layui.laydate;
var form = layui.form;
admin = layui.admin;
+
+ // 鏃ユ湡鏃堕棿鑼冨洿
+ laydate.render({
+ elem: '#ID-laydate-range-datetime',
+ type: 'datetime',
+ range: true
+ });
+
// 鏁版嵁娓叉煋
tableIns = table.render({
@@ -102,12 +112,30 @@
headers: {token: localStorage.getItem('token')},
url: baseUrl+'/pla/list/auth?step=2',
page: true,
+ totalRow: true, // 寮�鍚悎璁¤
+ height: function(){
+ var otherHeight = $('.function-area').outerHeight() + $('#search-box').outerHeight(); // 鑷畾涔夊叾浠栧尯鍩熺殑楂樺害
+ console.log($(window).height() - otherHeight);
+ return $(window).height() - otherHeight - 100; // 杩斿洖 number 绫诲瀷
+ },
+ //height: 'full',
limit: 16,
- limits: [16, 30, 50, 100, 200, 500],
+ limits: [ 50, 100, 200, 500,2000,5000,10000],
even: true,
toolbar: '#toolbar',
cellMinWidth: 50,
- cols: [getCol()],
+ cols: [function(){
+ var arr = getCol();
+
+ // 鍒濆鍖栫瓫閫夌姸鎬�
+ var local = layui.data('table-filter-test'); // 鑾峰彇瀵瑰簲鐨勬湰鍦拌褰�
+ layui.each(arr, function(index, item){
+ if(item.field in local){
+ item.hide = local[item.field];
+ }
+ });
+ return arr;
+ }() ],
request: {
pageName: 'curr',
pageSize: 'limit'
@@ -118,13 +146,25 @@
'code': res.code,
'msg': res.msg,
'count': res.data.total,
- 'data': res.data.records
+ 'data': res.data.records,
}
},
response: {
statusCode: 200
},
done: function(res, curr, count) {
+ // 璁板綍绛涢�夌姸鎬�
+ var that = this;
+ that.elem.next().on('mousedown', 'input[lay-filter="LAY_TABLE_TOOL_COLS"]+', function(){
+ var input = $(this).prev()[0];
+ // 姝ゅ琛ㄥ悕鍙换鎰忓畾涔�
+ layui.data('table-filter-test', {
+ key: input.name
+ ,value: input.checked
+ })
+ });
+
+ //$(".lavui-table-grid-down").hide();
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
@@ -140,7 +180,43 @@
res.data[_index][data.value] = 'N';
}
});
+ let headerTop = $('.layui-table-header').offset().top; //鑾峰彇琛ㄦ牸澶村埌鏂囨。椤堕儴鐨勮窛绂�
+ let headerPage = $('.layui-table-page').offset().top; //鑾峰彇琛ㄦ牸搴曢儴鏂囨。椤堕儴鐨勮窛绂�
+ $(window).scroll(function () {
+ if ((headerTop - $(window).scrollTop()) < 0) { //瓒呰繃浜�
+ $('.layui-table-header').addClass('table-header-fixed'); //娣诲姞鏍峰紡锛屽浐瀹氫綇琛ㄥご
+ } else { //娌¤秴杩�
+ $('.layui-table-header').removeClass('table-header-fixed'); //绉婚櫎鏍峰紡
+ }
+ });
}
+ });
+
+ // 澶嶉�夋浜嬩欢
+ table.on('checkbox(plaDetl)', function(obj){
+ // console.log(obj); // 鏌ョ湅瀵硅薄鎵�鏈夋垚鍛�
+ // console.log(obj.checked); // 褰撳墠鏄惁閫変腑鐘舵��
+ // console.log(obj.data); // 閫変腑琛岀殑鐩稿叧鏁版嵁
+ // console.log(obj.type); // 鑻ヨЕ鍙戠殑鏄叏閫夛紝鍒欎负锛歛ll锛涜嫢瑙﹀彂鐨勬槸鍗曢�夛紝鍒欎负锛歰ne
+ var checkStatus = table.checkStatus(obj.config.id)
+ var selectedNum = checkStatus.data.length;
+ var weightAll = 0;
+ var weightAnfmeAll = 0;
+
+ for (var i in checkStatus.data){
+ weightAll += checkStatus.data[i].weight;
+ weightAnfmeAll += checkStatus.data[i].weightAnfme;
+ }
+
+ $('.layui-table-total').find('.laytable-cell-1-0-1').text(selectedNum);
+ $('.layui-table-total').find('.laytable-cell-1-0-9').text(weightAll);
+ $('.layui-table-total').find('.laytable-cell-1-0-41').text(weightAnfmeAll);
+
+ });
+
+ // 琛屽崟鍑讳簨浠�( 鍙屽嚮浜嬩欢涓�: rowDouble )
+ table.on('row(plaDetl)', function(obj){
+
});
table.on('tool(plaDetl)', function (obj) {
@@ -204,13 +280,14 @@
});
}
});
-
}
+
})
// 鐩戝惉澶村伐鍏锋爮浜嬩欢
table.on('toolbar(plaDetl)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id)
+ printData = checkStatus;
switch(obj.event) {
case 'updateData':
var data = checkStatus.data;
@@ -349,8 +426,92 @@
});
}
break;
+ // 鎵归噺鎵撳嵃
+ case "btnPrintBatch":
+ printMatCodeNos = [];
+ var data = checkStatus.data;
+ if (data.length === 0){
+ layer.msg('璇烽�夋嫨鎵撳嵃鏁版嵁');
+ } else {
+ layer.open({
+ type: 1,
+ area: ['600px', '750px'],
+ title: '鎵归噺鎵撳嵃 [鏁伴噺'+ data.length +']',
+ shadeClose: true,
+ content: $('#printDataDiv'),
+ success: function(layero, index){
+ for (var i = 0; i<data.length;i++) {
+ printMatCodeNos.push(data[i].matnr);
+ }
+ },
+ end: function () {
+ }
+ });
+ }
+ break;
}
})
+
+ // 妯℃澘閫夋嫨
+ 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;
+ var templateDom = $("#templatePreview"+templateNo);
+ var className = templateDom.attr("class");
+ layer.closeAll();
+ for (let i=0;i<printData.data.length;i++){
+ if (className === 'template-barcode') {
+ printData.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1¶m="+(printData.data[i].batch+";"+printData.data[i].packageNo)
+ } else {
+ printData.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m="+(printData.data[i].batch+";"+printData.data[i].packageNo)
+ }
+ }
+ var tpl = templateDom.html();
+ var template = Handlebars.compile(tpl);
+ var html = template(printData);
+ var box = $("#box");
+ box.html(html);box.show();
+ box.print({mediaPrint:true});
+ box.hide();
+ // $.ajax({
+ // url: baseUrl+"/pla/print/auth",
+ // headers: {'token': localStorage.getItem('token')},
+ // data: JSON.stringify(printData.data),
+ // contentType:'application/json;charset=UTF-8',
+ // 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)
+ // }
+ // }
+ // })
+ });
// 鎼滅储鏍忔悳绱簨浠�
form.on('submit(search)', function (data) {
@@ -403,6 +564,14 @@
}
});
}
+
+ $(document).on('click','#updateZpallet',function (){
+ debugger;
+ })
+ $("[name='layTableCheckbox']").click(function(){ // 閫氳繃name灞炴�ч�夊彇鍏冪礌锛屽苟娣诲姞鐐瑰嚮浜嬩欢
+ alert("Hello World!"); // 鍦ㄦ帶鍒跺彴杈撳嚭鎻愮ず淇℃伅
+ debugger
+ });
@@ -760,5 +929,7 @@
var res = JSON.parse(evt.target.responseText);
layer.msg(res.msg, {icon: 2});
}
+function clearTable(){
+}
--
Gitblit v1.9.1