From d559780d63e92b9cbbdf82b819cbc8bc9053da80 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期二, 16 三月 2021 08:18:59 +0800 Subject: [PATCH] # --- src/main/webapp/static/js/custOrder/custOrder.js | 257 +++++++++++++++++++++++++++------------------------ 1 files changed, 136 insertions(+), 121 deletions(-) diff --git a/src/main/webapp/static/js/custOrder/custOrder.js b/src/main/webapp/static/js/custOrder/custOrder.js index 2fd9c5f..d3a2c81 100644 --- a/src/main/webapp/static/js/custOrder/custOrder.js +++ b/src/main/webapp/static/js/custOrder/custOrder.js @@ -14,18 +14,15 @@ } }); } - layui.config({ - base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰� -}).extend({ - index: 'lib/index' //涓诲叆鍙fā鍧� -}).use(['table', 'laydate', 'form'], function(){ + base: baseUrl + "/static/layui/lay/modules/" // 閰嶇疆妯″潡鎵�鍦ㄧ殑鐩綍 +}).use(['table', 'laydate', 'form', 'tableX'], function(){ var table = layui.table; var $ = layui.jquery; var layer = layui.layer; var layDate = layui.laydate; var form = layui.form; - var admin = layui.admin; + var tableX = layui.tableX; // 鏁版嵁娓叉煋 tableIns = table.render({ @@ -77,6 +74,7 @@ top.location.href = baseUrl+"/"; } pageCurr=curr; + tableX.merges('custOrder', [1, 11]); limit(); form.on('checkbox(tableCheckbox)', function (data) { var _index = $(data.elem).attr('table-index')||0; @@ -116,20 +114,6 @@ table.on('toolbar(custOrder)', function (obj) { var checkStatus = table.checkStatus(obj.config.id); switch(obj.event) { - case 'addData': - layer.open({ - type: 2, - title: '鏂板', - maxmin: true, - area: [top.detailWidth, top.detailHeight], - content: 'custOrder_detail.html', - success: function(layero, index){ - layer.getChildFrame('#data-detail-submit-edit', index).hide(); - clearFormVal(layer.getChildFrame('#detail', index)); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); - } - }); - break; case 'deleteData': var data = checkStatus.data; if (data.length === 0){ @@ -203,7 +187,7 @@ switch (obj.event) { // 鎷h揣 case 'stockOut': - + var loadIndex = layer.load(2); $.ajax({ url: baseUrl + "/work/stock/out/preview", headers: {'token': localStorage.getItem('token')}, @@ -213,92 +197,76 @@ }), method: 'POST', success: function (res) { - console.log(res); + layer.close(loadIndex); + // 鎴愬姛 + if (res.code === 200){ + layer.open({ + type: 1 + ,title: false + ,closeBtn: false + ,offset: '100px' + // ,area: ['800px','450px'] + ,area: '800px' + ,shade: 0.5 + ,shadeClose: true + ,id: 'LAY_layuipro' + ,btn: ['绔嬪嵆鐢熸垚', '绋嶅悗澶勭悊'] + ,btnAlign: 'c' + ,moveType: 1 //鎷栨嫿妯″紡锛�0鎴栬��1 + ,content: $('#stoukOutPreview') + ,success: function(layero, index){ + table.render({ + elem: '#stoPreTab', + data: res.data, + page: true, + cellMinWidth: 100, + // ,width: admin.screen() > 1 ? 892 : '' + height: 432, + cols: [[ + {field: 'title', title: '鍟嗗搧', align: 'center'}, + {field: 'anfme', title: '鎬绘暟閲�', align: 'center', style: 'font-weight: bold', width: 80}, + {field: 'locNo', title: '璐т綅', align: 'center'}, + {field: 'prior$', title: '鎺ㄨ崘璐т綅', align: 'center', width: 100}, + {field: 'reduce', title: '鏁伴噺', align: 'center', width: 80, style: 'font-weight: bold'}, + {field: 'remQty', title: '浣欓噺', align: 'center', width: 80}, + ]], + done: function () { + tableX.merges('stoPreTab', [0,1]); + $('.layui-table-body.layui-table-main').css("overflow", "auto") + } + }); + + } + ,yes: function(index, layero){ + //鎸夐挳銆愰┈涓婃嫞璐с�戠殑鍥炶皟 + stockOut(data.number); + } + ,btn2: function(index, layero){ + //鎸夐挳銆愮◢鍚庡鐞嗐�戠殑鍥炶皟 + //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴 + } + }); + // 缂烘枡 + } else if (res.code === 20001) { + layer.confirm(res.msg, { + shadeClose: true + , area: ['400px'] + , btn: ['搴撳瓨璋冩嫧', '鍙栨秷'] + }, function() { + // todo 搴撳瓨璋冩嫧 + layer.closeAll(); + }, function() { + // printPakouts(data.number); + layer.closeAll(); + } + ) + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + } else { + layer.msg(res.msg, {icon: 1}) + } } }) - // layer.open({ - // type: 1 - // ,title: false - // ,closeBtn: false - // ,offset: '100px' - // ,area: '300px;' - // ,shade: 0.5 - // ,id: 'LAY_layuipro' - // ,btn: ['鐏�熷洿瑙�', '娈嬪繊鎷掔粷'] - // ,btnAlign: 'c' - // ,moveType: 1 //鎷栨嫿妯″紡锛�0鎴栬��1 - // ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">浣犵煡閬撳悧锛熶翰锛�<br>layer 鈮� layui<br><br>layer鍙槸浣滀负Layui鐨勪竴涓脊灞傛ā鍧楋紝鐢变簬鍏剁敤鎴峰熀鏁拌緝澶э紝鎵�浠ュ父甯镐細鏈変汉浠ヤ负layui鏄痩ayerui<br><br>layer铏界劧宸茶 Layui 鏀剁紪涓哄唴缃殑寮瑰眰妯″潡锛屼絾浠嶇劧浼氫綔涓轰竴涓嫭绔嬬粍浠跺叏鍔涚淮鎶ゃ�佸崌绾с��<br><br>鎴戜滑姝ゅ悗鐨勫緛閫旀槸鏄熻景澶ф捣 ^_^</div>' - // ,success: function(layero){ - // var btn = layero.find('.layui-layer-btn'); - // btn.find('.layui-layer-btn0').attr({ - // href: 'http://www.layui.com/' - // ,target: '_blank' - // }); - // } - // }); - - // layer.confirm(data.number + ' 璁㈠崟寮�濮嬫嫞璐э紵', {shadeClose: true}, function(){ - // layer.closeAll(); - // $.ajax({ - // url: baseUrl+"/work/stock/out", - // headers: {'token': localStorage.getItem('token')}, - // contentType:'application/json;charset=UTF-8', - // data: JSON.stringify({ - // number: data.number - // }), - // method: 'POST', - // success: function (res) { - // // 鎴愬姛 - // if (res.code === 200){ - // layer.confirm(res.msg, { - // shadeClose: true - // , btn: ['鎵撳嵃鎷h揣鍗�'] - // }, function() { - // layer.closeAll(); - // printPakouts(data.number); - // } - // ) - // // 缂烘枡 - // } else if (res.code === 20001) { - // layer.confirm(res.msg, { - // shadeClose: true - // , btn: ['搴撳瓨璋冩嫧', '鍙栨秷'] - // }, function() { - // // todo 搴撳瓨璋冩嫧 - // layer.closeAll(); - // }, function() { - // // printPakouts(data.number); - // layer.closeAll(); - // } - // ) - // } else if (res.code === 403){ - // top.location.href = baseUrl+"/"; - // } else { - // layer.msg(res.msg) - // } - // $(".layui-laypage-btn")[0].click(); - // } - // }) - // }); - break; - // 璇︽儏 - case 'detail': - layer.open({ - type: 2, - title: '璇︽儏', - maxmin: true, - area: [top.detailWidth, top.detailHeight], - shadeClose: true, - content: 'custOrder_detail.html', - success: function(layero, index){ - setFormVal(layer.getChildFrame('#detail', index), data, true); - top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); - layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); - layero.find('iframe')[0].contentWindow.layui.form.render('select'); - layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); - } - }); break; // 鎵撳嵃 case 'print': @@ -310,6 +278,53 @@ } }); + + // 寮�濮嬫嫞璐� + function stockOut(number) { + // layer.confirm(number + ' 璁㈠崟寮�濮嬫嫞璐э紵', {shadeClose: true}, function(){ + layer.closeAll(); + $.ajax({ + url: baseUrl+"/work/stock/out", + headers: {'token': localStorage.getItem('token')}, + contentType:'application/json;charset=UTF-8', + data: JSON.stringify({ + number: number + }), + method: 'POST', + success: function (res) { + // 鎴愬姛 + if (res.code === 200){ + layer.confirm(res.msg, { + shadeClose: true + , btn: ['鎵撳嵃鎷h揣鍗�'] + }, function() { + layer.closeAll(); + printPakouts(number); + } + ) + // 缂烘枡 + } else if (res.code === 20001) { + layer.confirm(res.msg, { + shadeClose: true + , btn: ['搴撳瓨璋冩嫧', '鍙栨秷'] + }, function() { + // todo 搴撳瓨璋冩嫧 + layer.closeAll(); + }, function() { + // printPakouts(data.number); + layer.closeAll(); + } + ) + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + } else { + layer.msg(res.msg) + } + $(".layui-laypage-btn")[0].click(); + } + }) + // }); + } // 鎵撳嵃鎷h揣鍗� function printPakouts(docNumber) { @@ -472,22 +487,22 @@ page: { curr: pageCurr }, - done: function (res, curr, count) { - if (res.code === 403) { - top.location.href = baseUrl+"/"; - } - pageCurr=curr; - if (res.data.length === 0 && count !== 0) { - tableIns.reload({ - where: searchData, - page: { - curr: pageCurr-1 - } - }); - pageCurr -= 1; - } - limit(child); - } + // done: function (res, curr, count) { + // if (res.code === 403) { + // top.location.href = baseUrl+"/"; + // } + // pageCurr=curr; + // if (res.data.length === 0 && count !== 0) { + // tableIns.reload({ + // where: searchData, + // page: { + // curr: pageCurr-1 + // } + // }); + // pageCurr -= 1; + // } + // limit(child); + // } }); } -- Gitblit v1.9.1