From 1e26a7575d9969e728b0aa01466f490409cb173c Mon Sep 17 00:00:00 2001 From: chengsc <Demo@DESKTOP-CPA90BF> Date: 星期五, 18 十月 2024 18:41:30 +0800 Subject: [PATCH] Merge branch 'master' into csc --- Pda/View/HouseDataSetting/stockQuery.html | 890 ++++++++++++++++++++++++++++++----------------------------- 1 files changed, 452 insertions(+), 438 deletions(-) diff --git a/Pda/View/HouseDataSetting/stockQuery.html b/Pda/View/HouseDataSetting/stockQuery.html index 28514ac..3630232 100644 --- a/Pda/View/HouseDataSetting/stockQuery.html +++ b/Pda/View/HouseDataSetting/stockQuery.html @@ -1,144 +1,158 @@ <!DOCTYPE html> <html> - <head> - <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" /> - <meta charset="UTF-8" /> - <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=1, user-scalable=no" /> --> - <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665" /> --> - <meta http-equiv="X-UA-Compatible" content="ie=edge" /> - <title>Boxline PDA</title> - <link rel="stylesheet" href="/layui/css/layui.css" /> - <link rel="stylesheet" href="/css/style.css" /> - <script src="/js/adaptive.js"></script> - - <link rel="stylesheet" href="/css/my.css" /> - <style type="text/css"> - .layui-form-label { - width: 20%; - } - .layui-input-block { - width: 80%; - margin-left: 20%; - } - .div-tbl-title { - width: 98%; - margin: auto; - /* background-color: #4476A7; */ - height: 30px; - margin-top: 20px; - } - .div-tbl-title table { - width: 100%; - height: 30px; - } - .div-tbl-title td { - width: 50%; - height: 30px; - line-height: 30px; - } - .div-tbl-title span { - float: left; - width: 60%; - height: 30px; - line-height: 30px; - } - .div-tbl-title input { - float: left; - width: 40%; - height: 30px; - line-height: 30px; - border: none; - } - .layout-tbl-paging { - margin-top: 0; - } - .layout-bill-info { - height: auto; - } - .btn-ok { - border: none; - color: #FFFFFF; - background-color: #0a93e3; - width: 48%; - height: 36px; - border-radius: 5px; - float: left; - margin: 0 1%; - margin-left: 25%; - } - .btn-ok:active { - opacity: 0.8; - } - td{ - word-break: break-all; word-wrap:break-word; - } - </style> - <link rel="stylesheet" href="/css/adapter.css" /> - </head> - <body> - <div id="" class="main-content"> - <div id="" class="layout-title" > - <table border="" cellspacing="" cellpadding=""> - <tr> - <td class="img-back"><a href="../index.html"><img src="/assets/back.jpg" ></a></td> - <td class="title-text">搴撳瓨鏌ヨ</td> - <td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg" ></td> - </tr> - </table> +<head> + <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" /> + <meta charset="UTF-8" /> + <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=1, user-scalable=no" /> --> + <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665" /> --> + <meta http-equiv="X-UA-Compatible" content="ie=edge" /> + <title>搴撳瓨鏌ヨ</title> + + <link rel="stylesheet" href="/layui/css/layui.css" /> + <link rel="stylesheet" href="/css/style.css" /> + <script src="/js/adaptive.js"></script> + + <link rel="stylesheet" href="/css/my.css" /> + <style type="text/css"> + .layui-form-label { + width: 20%; + } + + .layui-input-block { + width: 80%; + margin-left: 20%; + } + + .div-tbl-title { + width: 98%; + margin: auto; + /* background-color: #4476A7; */ + height: 30px; + margin-top: 20px; + } + + .div-tbl-title table { + width: 100%; + height: 30px; + } + + .div-tbl-title td { + width: 50%; + height: 30px; + line-height: 30px; + } + + .div-tbl-title span { + float: left; + width: 60%; + height: 30px; + line-height: 30px; + } + + .div-tbl-title input { + float: left; + width: 40%; + height: 30px; + line-height: 30px; + border: none; + } + + .layout-tbl-paging { + margin-top: 0; + } + + .layout-bill-info { + height: auto; + } + + .btn-ok { + border: none; + color: #FFFFFF; + background-color: #0a93e3; + width: 48%; + height: 36px; + border-radius: 5px; + float: left; + margin: 0 1%; + margin-left: 25%; + } + + .btn-ok:active { + opacity: 0.8; + } + + td { + word-break: break-all; + word-wrap: break-word; + } + </style> + <link rel="stylesheet" href="/css/adapter.css" /> +</head> + +<body> + <div id="" class="main-content"> + <div id="" class="layout-title"> + <table border="" cellspacing="" cellpadding=""> + <tr> + <td class="img-back"><a href="../index.html"><img src="/assets/back.jpg"></a></td> + <td class="title-text">搴撳瓨鏌ヨ</td> + <td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg"></td> + </tr> + </table> + </div> + <div id="" class="layout-sub-content"> + <div id="menuList" class="menu"> + <ul class="" style="text-align: center;"> + <li><a href="../index.html">涓婚〉</a></li> + <li><a href="../login.html">閲嶆柊鐧诲綍</a></li> + </ul> </div> - <div id="" class="layout-sub-content"> - <div id="menuList" class="menu"> - <ul class="" style="text-align: center;"> - <li><a href="../index.html">涓婚〉</a></li> - <li><a href="../login.html">閲嶆柊鐧诲綍</a></li> - </ul> - </div> - - <div id="" class="layout-bill-info"> - <form class="layui-form" action="" style="height: auto;"> - <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> - <label class="layui-form-label">鍌ㄤ綅鍦板潃</label> - <div class="layui-input-block"> - <input id="LocatNo" type="text" lay-verify="stock" placeholder="鍌ㄤ綅鍦板潃" - autocomplete="off" class="layui-input"> - </div> + + <div id="" class="layout-bill-info"> + <form class="layui-form" action="" style="height: auto;"> + <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> + <label class="layui-form-label">鍌ㄤ綅鍦板潃</label> + <div class="layui-input-block"> + <input id="LocatNo" type="text" lay-verify="stock" placeholder="鍌ㄤ綅鍦板潃" autocomplete="off" + class="layui-input"> </div> - <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> - <label class="layui-form-label">鎵樼洏鏉$爜</label> - <div class="layui-input-block"> - <input id="PalletNo" type="text" lay-verify="stock" placeholder="鎵樼洏鏉$爜" - autocomplete="off" class="layui-input"> - </div> + </div> + <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> + <label class="layui-form-label">鎵樼洏鏉$爜</label> + <div class="layui-input-block"> + <input id="PalletNo" type="text" lay-verify="stock" placeholder="鎵樼洏鏉$爜" autocomplete="off" + class="layui-input"> </div> - <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> - <label class="layui-form-label">鐗╂枡缂栫爜</label> - <div class="layui-input-block"> - <input id="SkuNo" type="text" lay-verify="stock" - autocomplete="off" class="layui-input" style="border: 0px; " disabled> - </div> + </div> + <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> + <label class="layui-form-label">鐗╂枡缂栫爜</label> + <div class="layui-input-block"> + <input id="SkuNo" type="text" lay-verify="stock" autocomplete="off" class="layui-input" + style="border: 0px; " disabled> </div> - <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> - <label class="layui-form-label">鐗╂枡鍚嶇О</label> - <div class="layui-input-block"> - <input id="SkuName" type="text" lay-verify="stock" - autocomplete="off" class="layui-input" style="border: 0px;" disabled> - </div> + </div> + <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> + <label class="layui-form-label">鐗╂枡鍚嶇О</label> + <div class="layui-input-block"> + <input id="SkuName" type="text" lay-verify="stock" autocomplete="off" class="layui-input" + style="border: 0px;" disabled> </div> - <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> - <label class="layui-form-label">鐗╂枡瑙勬牸</label> - <div class="layui-input-block"> - <input id="Standard" type="text" lay-verify="stock" - autocomplete="off" class="layui-input" style="border: 0px;" disabled> - </div> + </div> + <div id="" class="layui-form-item layout-input" style="margin-top: 5px;"> + <label class="layui-form-label">鐗╂枡瑙勬牸</label> + <div class="layui-input-block"> + <input id="Standard" type="text" lay-verify="stock" autocomplete="off" class="layui-input" + style="border: 0px;" disabled> </div> - <div id="" class="" style="width: 100%;height: 36px;margin-top: 15px;"> - <button id="btnQuery" class="btn-ok" type="button">鏌ヨ</button> - </div> - </form> - </div> - - <!-- <div id="" class="div-tbl-title"> + </div> + <div id="" class="" style="width: 100%;height: 36px;margin-top: 15px;"> + <button id="btnQuery" class="btn-ok" type="button">鏌ヨ</button> + </div> + </form> + </div> + + <!-- <div id="" class="div-tbl-title"> <table border="0" cellspacing="" cellpadding="" style="width: 100%;"> <tr> <td> @@ -158,320 +172,320 @@ </tr> </table> </div> --> - - <div id="" class="layout-tbl-paging" style="margin-top: 5px;"> - <!-- <p class="box-list-title">宸茬粦瀹氱瀛愬垪琛�</p> --> - <table id="tableBoxList" class="tbl-box-list" border="1px" > - <tr> - <th >鐗╁搧鎵规</th> - <th >搴撳瓨<br>鏁伴噺</th> - <th >閿佸畾<br>鏁伴噺</th> - <th >鍐荤粨<br>鏁伴噺</th> - </tr> - <tr id="boxCell" style="display: none;"> - - <td name="LotNo">鐗╂枡鎵规</td> - <td name="Qty">鍓╀綑鏁伴噺</td> - <td name="LockQty">閿佸畾鏁伴噺</td> - <td name="FrozenQty">鍐荤粨鏁伴噺</td> - </tr> - </table> - - <!-- 鍒嗛〉 --> - <table id="tableBoxPages" class="tbl-box-pages" cellspacing="" cellpadding=""> - <tr > - <td class="page-prev">涓婁竴椤�</td> - <td class="page-num page-num-select">1</td> - <td class="page-num">2</td> - <td class="page-num">3</td> - <td class="page-num">4</td> - <td class="page-num">5</td> - <td class="page-next">涓嬩竴椤�</td> - </tr> - </table> - - </div> + + <div id="" class="layout-tbl-paging" style="margin-top: 5px;"> + <!-- <p class="box-list-title">宸茬粦瀹氱瀛愬垪琛�</p> --> + <table id="tableBoxList" class="tbl-box-list" border="1px"> + <tr> + <th>鐗╁搧鎵规</th> + <th>搴撳瓨<br>鏁伴噺</th> + <th>閿佸畾<br>鏁伴噺</th> + <th>鍐荤粨<br>鏁伴噺</th> + </tr> + <tr id="boxCell" style="display: none;"> + + <td name="LotNo">鐗╂枡鎵规</td> + <td name="Qty">鍓╀綑鏁伴噺</td> + <td name="LockQty">閿佸畾鏁伴噺</td> + <td name="FrozenQty">鍐荤粨鏁伴噺</td> + </tr> + </table> + + <!-- 鍒嗛〉 --> + <table id="tableBoxPages" class="tbl-box-pages" cellspacing="" cellpadding=""> + <tr> + <td class="page-prev">涓婁竴椤�</td> + <td class="page-num page-num-select">1</td> + <td class="page-num">2</td> + <td class="page-num">3</td> + <td class="page-num">4</td> + <td class="page-num">5</td> + <td class="page-next">涓嬩竴椤�</td> + </tr> + </table> + </div> </div> - - <script src="/js/jquery-3.5.1.min.js"></script> - <script src="/layui/layui.js"></script> - <script src="/js/public.js"></script> - <script src="/js/jquery.cookie.js"></script> - <script> - layui.use(['form', 'jquery'], function() { - var form = layui.form - - //褰撳墠鍒嗛〉 - var curPageIndex = 1 - var tableData = null - - //鎵�閫夊叆搴撳崟鐨勮缁嗕俊鎭� - //console.log($.cookie('userId')); - // if (!$.cookie('userId')) { - // layer.msg('鐧婚檰澶辨晥锛岃閲嶆柊鐧婚檰', { - // icon: 2, - // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - // }, function() { - // location.href = "login.html"; - // //鍥炶皟 - // }); - // } - - $("#menuImg").click(function(e){ - //console.log("menuImg") - e.stopPropagation() - - if($("#menuList").is(":hidden")){ - $("#menuList").show() - }else{ - $("#menuList").hide() - } - }) - $('body').click(function(){ - // //console.log("body") + </div> + + <script src="/js/jquery-3.5.1.min.js"></script> + <script src="/layui/layui.js"></script> + <script src="/js/public.js"></script> + <script src="/js/jquery.cookie.js"></script> + <script> + layui.use(['form', 'jquery'], function () { + var form = layui.form + + //褰撳墠鍒嗛〉 + var curPageIndex = 1 + var tableData = null + + //鎵�閫夊叆搴撳崟鐨勮缁嗕俊鎭� + //console.log($.cookie('userId')); + // if (!$.cookie('userId')) { + // layer.msg('鐧婚檰澶辨晥锛岃閲嶆柊鐧婚檰', { + // icon: 2, + // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + // }, function() { + // location.href = "login.html"; + // //鍥炶皟 + // }); + // } + + $("#menuImg").click(function (e) { + //console.log("menuImg") + e.stopPropagation() + + if ($("#menuList").is(":hidden")) { + $("#menuList").show() + } else { $("#menuList").hide() - }) - - function clear(){ - $("#LocatNo").val(''); - $("#PalletNo").val(''); - $("#SkuNo").val(""); - $("#SkuName").val(""); - $("#Standard").val(""); - - //鍏堟竻绌轰竴涓嬬瀛愬垪琛� - let trs = $("#tableBoxList tr") - let len = trs.length - //console.log("tr 鏁伴噺 + " + trs.length) - for(i=len - 1; i >=2; i--){ - trs[i].remove(); - } } - - $("#btnQuery").click(function(){ - if($('#LocatNo').val() == '' && $('#PalletNo').val() == ''){ - layer.msg("璇疯緭鍏ュ偍浣嶅湴鍧�鎴栨墭鐩樻潯鐮�", { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function() {}); + }) + $('body').click(function () { + // //console.log("body") + $("#menuList").hide() + }) + + function clear() { + $("#LocatNo").val(''); + $("#PalletNo").val(''); + $("#SkuNo").val(""); + $("#SkuName").val(""); + $("#Standard").val(""); + + //鍏堟竻绌轰竴涓嬬瀛愬垪琛� + let trs = $("#tableBoxList tr") + let len = trs.length + //console.log("tr 鏁伴噺 + " + trs.length) + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + } + + $("#btnQuery").click(function () { + if ($('#LocatNo').val() == '' && $('#PalletNo').val() == '') { + layer.msg("璇疯緭鍏ュ偍浣嶅湴鍧�鎴栨墭鐩樻潯鐮�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + clear(); + return + } + var param = { + LocatNo: $('#LocatNo').val(), + PalletNo: $('#PalletNo').val(), + }; + sendData(IP + "/PdaCr/GetStockQueryList", param, 'get', function (res) { + console.log("搴撳瓨鏌ヨ锛�", res) + if (res.code == 0) { //鎴愬姛 clear(); - return - } - var param = { - LocatNo: $('#LocatNo').val(), - PalletNo: $('#PalletNo').val(), - }; - sendData(IP + "/PdaCr/GetStockQueryList", param, 'get', function(res) { - console.log("搴撳瓨鏌ヨ锛�",res) - if (res.code == 0) { //鎴愬姛 - clear(); - $("#LocatNo").val(res.data[0].LocatNo); - $("#PalletNo").val(res.data[0].PalletNo); - $("#SkuNo").val(res.data[0].SkuNo); - $("#SkuName").val(res.data[0].SkuName); - $("#Standard").val(res.data[0].Standard); - tableData = deepCopy(res.data) - refreshTable() - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function() { - clear(); - let trs = $("#tableBoxList tr") - let len = trs.length - //console.log("tr 鏁伴噺 + " + trs.length) - for(i=len - 1; i >=2; i--){ - trs[i].remove(); - } - }); - } - }); - }) - - function refreshTable() { - //鍏堟竻绌轰竴涓嬬瀛愬垪琛� - let trs = $("#tableBoxList tr") - let len = trs.length - //console.log("tr 鏁伴噺 + " + trs.length) - for(i=len - 1; i >=2; i--){ - trs[i].remove(); - } - - //璁剧疆鎵樼洏鍙� - // $("#palletCode").val($.cookie('stockCode')) - - if (tableData.length > 0) { //鎴愬姛 - // $("#boxNum").val(tableData.length) - var list = tableData - var arrTrs = new Array() - let idx = 0 - for(var i in list) { - // list[i].BoxCode - var tr = $("#boxCell").eq(0).clone(); - tr.appendTo("#tableBoxList"); - // tr.attr('id', list[i].BoxCode) - idx++; - tr.attr('index', idx) - - tr.find("td[name='LotNo']").html(list[i].LotNo); - tr.find("td[name='Qty']").html(list[i].Qty); - tr.find("td[name='LockQty']").html(list[i].LockQty); - tr.find("td[name='FrozenQty']").html(list[i].FrozenQty); - // tr.find("td[name='InspectQty']").html(list[i].InspectQty); - - - // //console.log("boxcode is "+tr.find("td[name='boxcode']").html()) - tr.show(); - arrTrs[i] = tr - } - - //璁剧疆鍒嗛〉 - setPages(1, list.length) + $("#LocatNo").val(res.data[0].LocatNo); + $("#PalletNo").val(res.data[0].PalletNo); + $("#SkuNo").val(res.data[0].SkuNo); + $("#SkuName").val(res.data[0].SkuName); + $("#Standard").val(res.data[0].Standard); + tableData = deepCopy(res.data) + refreshTable() } else { //涓嶆垚鍔� - // $("#boxNum").val(0) - layer.msg("鏃犳暟鎹�", { + layer.msg(res.msg, { icon: 2, time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function() {}); - setPages(1, 0) + }, function () { + clear(); + let trs = $("#tableBoxList tr") + let len = trs.length + //console.log("tr 鏁伴噺 + " + trs.length) + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + }); } - } - - //璁剧疆鍒嗛〉 - function setPages(pageIndex, boxNum){ - if(boxNum <= 0){ - //鍒楄〃涓虹┖锛岄殣钘忓垎椤甸〉鐮� - $("#tableBoxPages").hide() - return - } - - let pageNum = Math.floor(boxNum / 10); - if(boxNum % 10 > 0){ - pageNum += 1; - } - //console.log("pageNum is " + pageNum) - - $("#tableBoxPages").find("tr").remove() - let table = $("#tableBoxPages") - $("<tr></tr>").appendTo("#tableBoxPages") - - // let newTr = table.append("<tr></tr>") - // newTr.append("<td class='page-prev'>涓婁竴椤�</td>") - $("<td id='prevPage' class='page-prev'>涓婁竴椤�</td>").appendTo("#tableBoxPages tr") - $("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function(){ - onClickPrevPage() - }) - for(i=1; i < pageNum + 1; i++){ - // newTr.append("<td class='page-num'>"+ i +"</td>") - $("<td class='page-num'>"+ i +"</td>").appendTo("#tableBoxPages tr") - } - // newTr.append("<td class='page-next'>涓嬩竴椤�</td>") - $("<td id='nextPage' class='page-next'>涓嬩竴椤�</td>").appendTo("#tableBoxPages tr") - $("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function(){ - onClickNextPage() - }) - // pages.show() - $("#tableBoxPages").show() - - setCurPage(1) - } - - //璁剧疆褰撳墠鍒嗛〉 - function setCurPage(pageIndex){ - let totalTrNum = $("#tableBoxList tr").length - if(totalTrNum <= 2 ){ - //console.log("tableBoxList 涓虹┖ totalTrNum: " + totalTrNum) - //curPageIndex = 1 - return - } - - let pageNum = getBoxPageNum() - if(pageIndex > pageNum){ - //console.log("璁剧疆鐨勯〉鐮佽秴鍑洪〉鏁�, pageIndex : " + pageIndex) - //curPageIndex = 1 - return - } - - let startIndex = (pageIndex - 1) * 10 + 1 - let n = totalTrNum - startIndex - let endIndex = 0 - if(n > 9){ - endIndex = startIndex + 9 - }else{ - endIndex = startIndex + n - } - //console.log("startIndex is "+startIndex) - //console.log("endIndex is "+endIndex) - //startIndex =2 - //endIndex = 2 - let trs = $("#tableBoxList tr") - //console.log("琛屾暟 "+trs.length) - let d = 0 - for(let i = 2; i < trs.length; i++){ - //console.log("琛岀储寮� " + trs.eq(i).attr('index')) - let t = trs.eq(i) - d = t.attr('index') - if(d >= startIndex && d <= endIndex){ - //console.log("闇�瑕佹樉绀�") - //鏄剧ず琛� - t.show() - }else{ - //闅愯棌琛� - t.hide() - } - } - - curPageIndex = pageIndex - - let ptr = $("#tableBoxPages tr") - for(let i = 1; i < pageNum+1; i++){ - ptr.eq(0).find("td").eq(i).removeClass("page-num-select") - if(i == curPageIndex){ - ptr.eq(0).find("td").eq(i).addClass("page-num-select") - } - } - //console.log("totalTrNum is " + totalTrNum) - } - - function onClickPrevPage(){ - //console.log("涓婁竴椤垫寜閽鐐瑰嚮") - if(curPageIndex == 1){ - return - } - setCurPage(curPageIndex - 1) - } - - function onClickNextPage(){ - //console.log("涓嬩竴椤垫寜閽鐐瑰嚮") - let n = getBoxPageNum() - if(curPageIndex == n){ - return - } - setCurPage(curPageIndex + 1) - } - - function getBoxPageNum() - { - let num = $("#tableBoxList tr").length - if(num <= 2 ){ - return 0 - } - - let pageNum = Math.floor(num / 10); - if(num % 10 > 0){ - pageNum += 1; - } - - return pageNum - } - - - form.verify({ - stock: [/^[\S]{6}$/, '鎵樼洏鏉$爜蹇呴』涓哄叚浣嶅瓧绗�'] }); }) - </script> - </body> -</html> + + function refreshTable() { + //鍏堟竻绌轰竴涓嬬瀛愬垪琛� + let trs = $("#tableBoxList tr") + let len = trs.length + //console.log("tr 鏁伴噺 + " + trs.length) + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + + //璁剧疆鎵樼洏鍙� + // $("#palletCode").val($.cookie('stockCode')) + + if (tableData.length > 0) { //鎴愬姛 + // $("#boxNum").val(tableData.length) + var list = tableData + var arrTrs = new Array() + let idx = 0 + for (var i in list) { + // list[i].BoxCode + var tr = $("#boxCell").eq(0).clone(); + tr.appendTo("#tableBoxList"); + // tr.attr('id', list[i].BoxCode) + idx++; + tr.attr('index', idx) + + tr.find("td[name='LotNo']").html(list[i].LotNo); + tr.find("td[name='Qty']").html(list[i].Qty); + tr.find("td[name='LockQty']").html(list[i].LockQty); + tr.find("td[name='FrozenQty']").html(list[i].FrozenQty); + // tr.find("td[name='InspectQty']").html(list[i].InspectQty); + + + // //console.log("boxcode is "+tr.find("td[name='boxcode']").html()) + tr.show(); + arrTrs[i] = tr + } + + //璁剧疆鍒嗛〉 + setPages(1, list.length) + } else { //涓嶆垚鍔� + // $("#boxNum").val(0) + layer.msg("鏃犳暟鎹�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + setPages(1, 0) + } + } + + //璁剧疆鍒嗛〉 + function setPages(pageIndex, boxNum) { + if (boxNum <= 0) { + //鍒楄〃涓虹┖锛岄殣钘忓垎椤甸〉鐮� + $("#tableBoxPages").hide() + return + } + + let pageNum = Math.floor(boxNum / 10); + if (boxNum % 10 > 0) { + pageNum += 1; + } + //console.log("pageNum is " + pageNum) + + $("#tableBoxPages").find("tr").remove() + let table = $("#tableBoxPages") + $("<tr></tr>").appendTo("#tableBoxPages") + + // let newTr = table.append("<tr></tr>") + // newTr.append("<td class='page-prev'>涓婁竴椤�</td>") + $("<td id='prevPage' class='page-prev'>涓婁竴椤�</td>").appendTo("#tableBoxPages tr") + $("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function () { + onClickPrevPage() + }) + for (i = 1; i < pageNum + 1; i++) { + // newTr.append("<td class='page-num'>"+ i +"</td>") + $("<td class='page-num'>" + i + "</td>").appendTo("#tableBoxPages tr") + } + // newTr.append("<td class='page-next'>涓嬩竴椤�</td>") + $("<td id='nextPage' class='page-next'>涓嬩竴椤�</td>").appendTo("#tableBoxPages tr") + $("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function () { + onClickNextPage() + }) + // pages.show() + $("#tableBoxPages").show() + + setCurPage(1) + } + + //璁剧疆褰撳墠鍒嗛〉 + function setCurPage(pageIndex) { + let totalTrNum = $("#tableBoxList tr").length + if (totalTrNum <= 2) { + //console.log("tableBoxList 涓虹┖ totalTrNum: " + totalTrNum) + //curPageIndex = 1 + return + } + + let pageNum = getBoxPageNum() + if (pageIndex > pageNum) { + //console.log("璁剧疆鐨勯〉鐮佽秴鍑洪〉鏁�, pageIndex : " + pageIndex) + //curPageIndex = 1 + return + } + + let startIndex = (pageIndex - 1) * 10 + 1 + let n = totalTrNum - startIndex + let endIndex = 0 + if (n > 9) { + endIndex = startIndex + 9 + } else { + endIndex = startIndex + n + } + //console.log("startIndex is "+startIndex) + //console.log("endIndex is "+endIndex) + //startIndex =2 + //endIndex = 2 + let trs = $("#tableBoxList tr") + //console.log("琛屾暟 "+trs.length) + let d = 0 + for (let i = 2; i < trs.length; i++) { + //console.log("琛岀储寮� " + trs.eq(i).attr('index')) + let t = trs.eq(i) + d = t.attr('index') + if (d >= startIndex && d <= endIndex) { + //console.log("闇�瑕佹樉绀�") + //鏄剧ず琛� + t.show() + } else { + //闅愯棌琛� + t.hide() + } + } + + curPageIndex = pageIndex + + let ptr = $("#tableBoxPages tr") + for (let i = 1; i < pageNum + 1; i++) { + ptr.eq(0).find("td").eq(i).removeClass("page-num-select") + if (i == curPageIndex) { + ptr.eq(0).find("td").eq(i).addClass("page-num-select") + } + } + //console.log("totalTrNum is " + totalTrNum) + } + + function onClickPrevPage() { + //console.log("涓婁竴椤垫寜閽鐐瑰嚮") + if (curPageIndex == 1) { + return + } + setCurPage(curPageIndex - 1) + } + + function onClickNextPage() { + //console.log("涓嬩竴椤垫寜閽鐐瑰嚮") + let n = getBoxPageNum() + if (curPageIndex == n) { + return + } + setCurPage(curPageIndex + 1) + } + + function getBoxPageNum() { + let num = $("#tableBoxList tr").length + if (num <= 2) { + return 0 + } + + let pageNum = Math.floor(num / 10); + if (num % 10 > 0) { + pageNum += 1; + } + + return pageNum + } + + + form.verify({ + stock: [/^[\S]{6}$/, '鎵樼洏鏉$爜蹇呴』涓哄叚浣嶅瓧绗�'] + }); + }) + </script> +</body> + +</html> \ No newline at end of file -- Gitblit v1.8.0