|  |  | 
 |  |  |     <!-- 搜索栏 --> | 
 |  |  |     <div id="search-box" class="layui-form layui-card-header"> | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline cool-auto-complete"> | 
 |  |  |                 <input id="crnNo" class="layui-input" name="crnNo" type="text" placeholder="请输入" autocomplete="off" style="display: none"> | 
 |  |  |                 <input id="crnNo$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="堆垛机号" onfocus=this.blur()> | 
 |  |  |                 <div class="cool-auto-complete-window"> | 
 |  |  |                     <input class="cool-auto-complete-window-input" data-key="basCrnpQueryBycrnNo" onkeyup="autoLoad(this.getAttribute('data-key'))"> | 
 |  |  |                     <select class="cool-auto-complete-window-select" data-key="basCrnpQueryBycrnNoSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> | 
 |  |  |                     </select> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input class="layui-input" type="text" name="loc_no" placeholder="库位号" autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input class="layui-input" type="text" name="matnr" placeholder="商品编号"  autocomplete="off"> | 
 |  |  |                 <input class="layui-input" type="text" name="brand" placeholder="包装组号"  autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input class="layui-input" type="text" name="maktx" placeholder="物料描述" autocomplete="off"> | 
 |  |  |                 <input class="layui-input" type="text" name="model" placeholder="卷号" autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input class="layui-input" type="text" name="unit" placeholder="箱号" autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input class="layui-input" type="text" name="matnr" placeholder="空箱" autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input class="layui-input" type="text" name="batch" placeholder="尺寸" autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input class="layui-input" type="text" name="memo" placeholder="备注" autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <!-- 日期范围 --> | 
 |  |  | 
 |  |  |         <!-- 待添加 --> | 
 |  |  |         <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block"> | 
 |  |  |             <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> | 
 |  |  |             <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  | </fieldset> | 
 |  |  | 
 |  |  | </body> | 
 |  |  | <script> | 
 |  |  |  | 
 |  |  |     var pageCurr; | 
 |  |  |     function getCol() { | 
 |  |  |         var cols = [ | 
 |  |  |             {type: 'checkbox'} | 
 |  |  |             ,{field: 'locNo$', align: 'center',title: '库位号'} | 
 |  |  |             {type: 'checkbox', merge: ['locNo']} | 
 |  |  |             ,{field: 'locNo', align: 'center',title: '库位号', merge: true, style: 'font-weight: bold'} | 
 |  |  |             // ,{field: 'locNo$', align: 'center',title: '库位号'} | 
 |  |  |         ]; | 
 |  |  |         cols.push.apply(cols, detlCols); | 
 |  |  |         cols.push({field: 'modiUser$', align: 'center',title: '修改人员', hide: true} | 
 |  |  | 
 |  |  |  | 
 |  |  |     layui.config({ | 
 |  |  |         base: baseUrl + "/static/layui/lay/modules/" | 
 |  |  |     }).use(['table','laydate', 'form', 'admin'], function() { | 
 |  |  |     }).use(['table','laydate', 'form', 'admin', 'tableMerge'], 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 tableMerge = layui.tableMerge; | 
 |  |  |         var dataSource = [] | 
 |  |  |  | 
 |  |  |         // 数据渲染 | 
 |  |  |         locDetlTableIns = table.render({ | 
 |  |  | 
 |  |  |             headers: {token: localStorage.getItem('token')}, | 
 |  |  |             url: baseUrl+'/stock/out/list/auth', | 
 |  |  |             page: true, | 
 |  |  |             limit: 10, | 
 |  |  |             limits: [16, 30, 50, 100, 200, 500], | 
 |  |  |             limit: 16, | 
 |  |  |             even: true, | 
 |  |  |             toolbar: '#toolbar', | 
 |  |  |             cellMinWidth: 50, | 
 |  |  | 
 |  |  |                 pageSize: 'limit' | 
 |  |  |             }, | 
 |  |  |             parseData: function (res) { | 
 |  |  |                 dataSource = res.data.records | 
 |  |  |                 return { | 
 |  |  |                     'code': res.code, | 
 |  |  |                     'msg': res.msg, | 
 |  |  | 
 |  |  |                 statusCode: 200 | 
 |  |  |             }, | 
 |  |  |             done: function(res, curr, count) { | 
 |  |  |                 tableMerge.render(this); | 
 |  |  |                 if (res.code === 403) { | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 } | 
 |  |  |                 pageCurr=curr; | 
 |  |  |                 form.on('checkbox(tableCheckbox)', function (data) { | 
 |  |  |                     var _index = $(data.elem).attr('table-index')||0; | 
 |  |  |                     if(data.elem.checked){ | 
 |  |  |                         res.data[_index][data.value] = 'Y'; | 
 |  |  |                     }else{ | 
 |  |  |                         res.data[_index][data.value] = 'N'; | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         // 监听头工具栏事件 | 
 |  |  |         table.on('toolbar(stockOut)', function (obj) { | 
 |  |  |  | 
 |  |  |             var checkStatus = table.checkStatus(obj.config.id); | 
 |  |  |             var data = checkStatus.data; | 
 |  |  |             var dataList = [] | 
 |  |  |             for (var j = 0; j < data.length; j++) { | 
 |  |  |                 var locno = data[j].locNo | 
 |  |  |                 for(var i = 0;i < dataSource.length; i++) { | 
 |  |  |                     if (dataSource[i].locNo === locno) { | 
 |  |  |                         dataList.push(dataSource[i]) | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             switch(obj.event) { | 
 |  |  |                 case 'confirm': | 
 |  |  |                     if (data.length === 0){ | 
 |  |  |                         layer.msg("请选择数据"); | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |                     parent.addTableData(data); | 
 |  |  |  | 
 |  |  |                     const reqDate = [...new Set(dataList.map(obj => obj.brand))] | 
 |  |  |                     $.ajax({ | 
 |  |  |                         url: baseUrl+"/getLocDateByLocNo", | 
 |  |  |                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                         data: JSON.stringify(reqDate), | 
 |  |  |                         contentType:'application/json;charset=UTF-8', | 
 |  |  |                         dataType:'json', | 
 |  |  |                         method: 'POST', | 
 |  |  |                         success: function (res) { | 
 |  |  |                             if (res.code === 200){ | 
 |  |  |                                 parent.addTableData(res.data); | 
 |  |  |                             } 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(); | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         // 搜索栏重置事件 | 
 |  |  |         form.on('submit(reset)', function (data) { | 
 |  |  |             pageCurr = 1; | 
 |  |  |             clearFormVal($('#search-box')); | 
 |  |  |             tableReload(); | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  | 
 |  |  |         }); | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     function tableReload(child) { | 
 |  |  |     function tableReload() { | 
 |  |  |         var searchData = {}; | 
 |  |  |         $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |             searchData[this.name] = this.value; | 
 |  |  |         }); | 
 |  |  |         locDetlTableIns.reload({ | 
 |  |  |             where: searchData, | 
 |  |  |             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) { | 
 |  |  |                     locDetlTableIns.reload({ | 
 |  |  |                         where: searchData, | 
 |  |  |                         page: { | 
 |  |  |                             curr: pageCurr-1 | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                     pageCurr -= 1; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     function clearFormVal(el) { | 
 |  |  |         $(':input', el) | 
 |  |  |             .val('') | 
 |  |  |             .removeAttr('checked') | 
 |  |  |             .removeAttr('selected'); | 
 |  |  |     } | 
 |  |  | </script> | 
 |  |  | </html> |