From 0916bb4ea987c0599b6af6bb8dd251a071770e05 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期四, 23 十月 2025 14:32:15 +0800
Subject: [PATCH] 通用下拉选择框值从视图获取
---
src/main/webapp/static/js/picking/picking.js | 252 ++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 221 insertions(+), 31 deletions(-)
diff --git a/src/main/webapp/static/js/picking/picking.js b/src/main/webapp/static/js/picking/picking.js
index 1f288b2..13e3129 100644
--- a/src/main/webapp/static/js/picking/picking.js
+++ b/src/main/webapp/static/js/picking/picking.js
@@ -1,6 +1,9 @@
var pageCurr;
var printMatCodeNos = [];
var ordernoo = "123";
+var insTbCount = 0;
+var selectedData = [];
+var selectType = 'one';
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
}).use(['table','laydate', 'form', 'admin', 'layer'], function(){
@@ -11,6 +14,12 @@
var form = layui.form;
var admin = layui.admin;
+ layDate.render({
+ elem: '.layui-laydate-range'
+ ,type: 'datetime'
+ ,range: true
+ });
+
// 鏁版嵁娓叉煋
tableIns = table.render({
elem: '#saasLog',
@@ -20,21 +29,20 @@
limit: 15,
limits: [15, 30, 50, 100, 200, 500],
// toolbar: '#toolbar',
- cellMinWidth: 50,
+ // cellMinWidth: 50,
height: 'full-120',
cols: [[
- // {type: 'checkbox'}
- {type: 'numbers'}
+ {type: 'checkbox'}
+ ,{type: 'numbers', title: '搴忓彿'}
,{field: 'wrkNo', align: 'center',title: 'id', hide:true}
- ,{field: 'docNum',title: '鎷h揣鍗曞彿' , templet: '#orderNoTpl'}
+ ,{field: 'doc_num',title: '鎷h揣鍗曞彿' }
,{align: 'center', title: '浜岀淮鐮�', toolbar: '#operate', width: 200 , hide:true}
,{align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 160, width: 160}
,{field: 'status$', align: 'center',title: '鐘舵��'}
- ,{field: 'owner$', align: 'center',title: '璐т富'}
- ,{field: 'payment$', align: 'center',title: '璐х墿褰㈡��'}
- // ,{field: 'custName', align: 'center',title: '瀹㈡埛鍚嶇О', width: 160}
- ,{field: 'createTime$', align: 'center',title: '鎿嶄綔鏃堕棿'}
- ,{align: 'center', title: '鎿嶄綔', toolbar: '#operate'}
+ ,{field: 'custName', align: 'center',title: '瀹㈡埛鍚嶇О', width: 160}
+ ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿'}
+ ,{field: 'updateTime$', align: 'center',title: '鍑哄簱鏃堕棿'}
+ ,{align: 'center', title: '鎿嶄綔', toolbar: '#operate',width: 300}
]],
request: {
@@ -42,7 +50,6 @@
pageSize: 'limit'
},
parseData: function (res) {
- console.log(res);
return {
'code': res.code,
'msg': res.msg,
@@ -59,6 +66,27 @@
}
pageCurr=curr;
limit();
+
+ var index = -1;
+ $("[data-field='status$']").children().each(function () {
+ index++;
+ if ($(this).text() === '鏈嚭搴�') {
+ $('tr').eq(index).css("color", 'red');
+ }
+ });
+
+ // 閲嶆柊鍕鹃��
+ var selectedOrderNos = selectedData.map(item => item.doc_num);
+ var indexArr = []
+ res.data.forEach(function (item,index) {
+ if (selectedOrderNos.includes(item.doc_num)) {
+ indexArr.push(index)
+ }
+ })
+
+ table.setRowChecked('saasLog',{
+ index: indexArr
+ });
}
});
@@ -78,15 +106,25 @@
// 鐩戝惉琛屽伐鍏蜂簨浠�
table.on('tool(saasLog)', function(obj){
var data = obj.data;
+ console.log(data);
switch (obj.event) {
case "btnPrint":
- btnPrint(data.wrkNo, data.docNum, 4);
+ btnPrint(data.wrkNo, data.doc_num, 4);
break;
case "wrkTrace":
- btnPrint(data.wrkNo, data.docNum, 4);
+ btnPrint(data.wrkNo, data.doc_num, 4);
break;
case "btnPrint2":
- btnPrint2(data.wrkNo, data.docNum, 4);
+ btnPrint2(data.wrkNo, data.doc_num, 4);
+ break;
+ case "del":
+ doDel(data);
+ break;
+ case "printExcel":
+ printExcel(data);
+ break;
+ case "exportExcel2":
+ exportExcel2(data);
break;
case "look":
var $a = $(obj.tr).find('a[lay-event="look"]');
@@ -95,42 +133,43 @@
var left = offset.left;
layer.open({
type: 1,
- title: false,
- area: '1200px',
- offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'],
+ title: '鍗曟嵁鏄庣粏',
+ area: '1500px',
+ offset: [top + 'px', (left - 450 + $a.outerWidth()) + 'px'],
shade: .01,
shadeClose: true,
fixed: false,
content: '<table id="lookSSXMTable" lay-filter="lookSSXMTable"></table>',
success: function (layero) {
table.render({
+ id:'lookSSXMTable',
elem: '#lookSSXMTable',
headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/ManPakOut/list/auth',
+ url: baseUrl+'/ManPakOut/list/auth1',
where: {
- doc_num: data.docNum,
+ doc_num: data.doc_num,
uuid: data.uuid
},
page: true,
cellMinWidth: 100,
cols: [[
{type: 'numbers'}
- ,{field: 'id', align: 'center',title: 'id', hide:true}
+ ,{field: 'wrkNo', align: 'center',title: 'id', hide:true}
,{field: 'docNum', align: 'center',title: '鎷h揣鍗曞彿'}
,{field: 'uuid', align: 'center',title: 'uuid'}
,{field: 'locNo', align: 'center',title: '搴撲綅'}
- ,{field: 'matnr', align: 'center',title: '鐗╂枡鍙�'}
- ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О'}
+ ,{field: 'batch', align: 'center',title: '鎵瑰彿'}
+ ,{field: 'barcode', align: 'center',title: '鍖呭彿'}
+ // ,{field: 'matnr', align: 'center',title: '鐗╂枡鍙�'}
+ ,{field: 'maktx', align: 'center',title: '鐗屽彿'}
,{field: 'anfme', align: 'center',title: '鏁伴噺'}
- ,{field: 'owner$', align: 'center',title: '璐т富'}
- ,{field: 'payment$', align: 'center',title: '璐х墿褰㈡��'}
- ,{field: 'owner', align: 'center',title: '璐т富', hide:true}
- ,{field: 'payment', align: 'center',title: '璐х墿褰㈡��', hide:true}
- ,{field: 'createTime$', align: 'center',title: '鎿嶄綔鏃堕棿'}
+ ,{field: 'updateTime$', align: 'center',title: '鎿嶄綔鏃堕棿'}
,{field: 'count', align: 'center',title: '瀹屾垚鏁�'}
,{field: 'status$', align: 'center',title: '鐘舵��'}
,{field: 'memo', align: 'center',title: '澶囨敞'}
+ ,{field: 'specs', align: 'center',title: '鍙戣揣鏃堕棿'}
,{field: 'createBy', align: 'center',title: '', hide:true}
+ ,{align: 'center', title: '鎿嶄綔', toolbar: '#operateDetl'}
]],
request: {
pageName: 'curr',
@@ -147,8 +186,18 @@
response: {
statusCode: 200
},
- done: function () {
+ done: function (res) {
$(layero).find('.layui-table-view').css('margin', '0');
+
+ var index = -1;
+ $("[data-field='status$']").children().each(function () {
+ index++;
+ if ($(this).text() === '鏈嚭搴�') {
+ $('tr').eq(index).css("color", 'red');
+ }
+ });
+
+
},
size: ''
});
@@ -157,17 +206,113 @@
}
});
+ table.on('tool(lookSSXMTable)', function(obj) {
+ var data = obj.data;
+ console.log(data);
+ switch (obj.event) {
+ case "delDetl":
+ layer.confirm('纭畾瑕佸垹闄ゅ悧锛�', {
+ shade: .1,
+ skin: 'layui-layer-admin'
+ }, function (i) {
+ layer.close(i);
+ layer.load(2);
+ $.ajax({
+ url: baseUrl+"/pakout/deleteDetl/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data:{
+ wrkNo:data.wrkNo
+ },
+ method: 'GET',
+ success: function (res) {
+ layer.closeAll('loading');
+ if (res.code === 200){
+ tableIns.reload({page: {curr: 1}});
+ layer.msg(res.msg, {icon: 1});
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ })
+ })
+ break;
+ }
+ })
+
// 鎼滅储
form.on('submit(search)', function (data) {
pageCurr = 1;
tableReload(false);
});
+ // 澶嶉�夋鍕鹃�変簨浠�
+ table.on('checkbox(saasLog)', function (obj) {
+ if (obj.type === 'all' && obj.checked) {
+ selectType = 'all'
+ } else if (obj.type === 'one' && obj.checked) {
+ selectType = 'one'
+ selectedData.push(obj.data); // 閫変腑鏃朵繚瀛樻暟鎹�
+ } else if (obj.type === 'one' && !obj.checked && obj.index !== undefined) {
+ selectType = 'one'
+ selectedData = selectedData.filter(item => item.doc_num !== obj.data.doc_num); // 鍙栨秷鏃剁Щ闄ゆ暟鎹�
+ } else if (obj.type === 'all' && !obj.checked && obj.index === undefined) {
+ selectType = 'one'
+ selectedData = [];
+ }
+ });
+
// 閲嶇疆
form.on('submit(reset)', function (data) {
pageCurr = 1;
+ selectedData = []
+ selectType = 'one'
clearFormVal($('#search-box'));
tableReload(false);
+ });
+
+ // 瀵煎嚭
+ form.on('submit(exportExcel)', function (data) {
+ layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function () {
+ layer.closeAll();
+ layer.load(1, {shade: [0.1, '#fff']});
+ var reqData = {};
+ reqData.type = selectType;
+ if (reqData.type === 'one') {
+ if (selectedData.length === 0) {
+ layer.msg('璇峰厛鍕鹃�夋暟鎹�')
+ layer.closeAll('loading');
+ return
+ }
+ reqData.docNumList = selectedData.map(item => item.doc_num);
+ } else {
+ var searchData = {};
+ $.each($('#search-box [name]').serializeArray(), function() {
+ searchData[this.name] = this.value;
+ });
+ reqData.queryWhere = searchData
+ }
+ $.ajax({
+ url: baseUrl + "/pakOut/excelExport3/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify(reqData),
+ contentType: 'application/json;charset=UTF-8',
+ method: 'POST',
+ xhrFields: {
+ responseType: 'blob' // 澶勭悊杩斿洖鐨勬枃浠舵祦
+ },
+ success: function (res) {
+ var link = document.createElement('a');
+ link.href = URL.createObjectURL(res); // 浣跨敤 Blob 瀵硅薄鐢熸垚涓存椂 URL
+ link.download = new Date().getTime() + '.xlsx'; // 璁剧疆涓嬭浇鐨勬枃浠跺悕
+ document.body.appendChild(link);
+ link.click(); // 瑙﹀彂涓嬭浇
+ document.body.removeChild(link);
+ }
+ });
+ layer.closeAll('loading');
+ });
});
// 鏃堕棿閫夋嫨鍣�
@@ -266,10 +411,9 @@
for (let i = 0; i < res.data.length; i++){
sum += res.data[i].anfme;
- console.log("sum:"+res.data.anfme);
-
}
json.anfmeSum = sum;
+ json.custName = json.data[0].custName;
var barcodeUrl = baseUrl + "/ManPakOut/code/auth?type=1¶m=" + res.data[0].docNum;
console.log("barcodeUrl:"+barcodeUrl);
json.barcodeUrl = barcodeUrl;
@@ -278,9 +422,9 @@
var className = templateDom.attr("class");
if (className === 'template-barcode') {
- json.data[i]["barcodeUrl"] = baseUrl + "/ManPakOut/code/auth?type=2¶m=" + (json.data[i].docNum+";"+json.data[i].matnr+";"+json.data[i].maktx+";"+json.data[i].anfme+";"+json.data[i].locNo+";");
+ json.data[i]["barcodeUrl"] = baseUrl + "/ManPakOut/code/auth?type=2¶m=" + (json.data[i].docNum+";"+json.data[i].matnr+";"+json.data[i].batch+";"+json.data[i].anfme+";"+json.data[i].locNo+";"+json.data[i].barcode+";"+json.data[i].nodeId+";"+json.data[i].wrkNo+";"+json.data[i].maktx);
} else {
- json.data[i]["barcodeUrl"] = baseUrl + "/ManPakOut/code/auth?type=2¶m=" + (json.data[i].docNum+";"+json.data[i].matnr+";"+json.data[i].maktx+";"+json.data[i].anfme+";"+json.data[i].locNo+";");
+ json.data[i]["barcodeUrl"] = baseUrl + "/ManPakOut/code/auth?type=2¶m=" + (json.data[i].docNum+";"+json.data[i].matnr+";"+json.data[i].batch+";"+json.data[i].anfme+";"+json.data[i].locNo+";"+json.data[i].barcode+";"+json.data[i].nodeId+";"+json.data[i].wrkNo+";"+json.data[i].maktx);
}
}
var tpl = templateDom.html();
@@ -300,7 +444,53 @@
})
}
+ function doDel(data) {
+ console.log(data)
+ layer.confirm('纭畾瑕佸垹闄ゅ悧锛�', {
+ shade: .1,
+ skin: 'layui-layer-admin'
+ }, function (i) {
+ layer.close(i);
+ layer.load(2);
+ $.ajax({
+ url: baseUrl+"/pakout/delete/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data:{
+ docNum:data.doc_num
+ },
+ method: 'GET',
+ success: function (res) {
+ layer.closeAll('loading');
+ if (res.code === 200){
+ tableIns.reload({page: {curr: 1}});
+ layer.msg(res.msg, {icon: 1});
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ })
+ });
+ }
+ function printExcel(data){
+ layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ layer.closeAll();
+ layer.load(1, {shade: [0.1,'#fff']});
+ location.href = baseUrl+"/pakout/printExport/auth?orderNo="+data.doc_num;
+ layer.closeAll('loading');
+ });
+ }
+
+ function exportExcel2(data){
+ layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ layer.closeAll();
+ layer.load(1, {shade: [0.1,'#fff']});
+ location.href = baseUrl+"/pakOut/exportExcel2/auth?orderNo="+data.doc_num;
+ layer.closeAll('loading');
+ });
+ }
});
--
Gitblit v1.9.1