|  |  | 
 |  |  |                 <input class="layui-input" type="text" name="mat_no" placeholder="请输入" autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |  | 
 |  |  |         <div class="layui-inline"> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input class="layui-input" type="text" name="condition" 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> | 
 |  |  | 
 |  |  |     </div> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  |  | 
 |  |  | <div class="layui-form"> | 
 |  |  |     <table class="layui-hide" id="matCode" lay-filter="matCode"></table> | 
 |  |  | </div> | 
 |  |  | 
 |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/pakStore/pakStore.js" charset="utf-8"></script> | 
 |  |  |  | 
 |  |  | </body> | 
 |  |  | <script> | 
 |  |  |     var initCountVal = 1; | 
 |  |  |     var matCodeData = []; | 
 |  |  |  | 
 |  |  |     var pageCurr; | 
 |  |  |     layui.use(['table','laydate', 'form'], function() { | 
 |  |  |         var table = layui.table; | 
 |  |  |         var $ = layui.jquery; | 
 |  |  |         var layer = layui.layer; | 
 |  |  |         var form = layui.form; | 
 |  |  |         // 物料查询数据表 | 
 |  |  |         matQueryTable = table.render({ | 
 |  |  | 
 |  |  |                 {field: 'matName', align: 'center', title: '物料名称'}, | 
 |  |  |                 {field: 'str1', align: 'center', title: '物料单位'}, | 
 |  |  |                 {field: 'str2', align: 'center', title: '物料规格'}, | 
 |  |  |                 {field: 'count', title: '数量', align: 'center', edit:'text', width: 100} | 
 |  |  |             ]], | 
 |  |  |             request: { | 
 |  |  |                 pageName: 'curr', | 
 |  |  | 
 |  |  |                 if (res.code === 403) { | 
 |  |  |                     top.location.href = baseUrl + "/"; | 
 |  |  |                 } | 
 |  |  |                 $('td[data-field=count] div').html("1"); | 
 |  |  |                 setMatCodeData(res.data); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         // 页面修改 | 
 |  |  |         table.on('edit(matCode)', function (obj) { | 
 |  |  |             updateMatCodeData(obj.data.matNo, Number(obj.value)); | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         // 监听排序事件 | 
 |  |  |         table.on('sort(matCode)', function (obj) { | 
 |  |  |             var searchData = {}; | 
 |  |  |             $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |                 searchData[this.name] = this.value; | 
 |  |  |             }); | 
 |  |  |             searchData['orderByField'] = obj.field; | 
 |  |  |             searchData['orderByType'] = obj.type; | 
 |  |  |             tableIns.reload({ | 
 |  |  |                 where: searchData, | 
 |  |  |                 page: { | 
 |  |  |                     curr: 1 | 
 |  |  |                 }, | 
 |  |  |                 done: function (res, curr, count) { | 
 |  |  |                     if (res.code === 403) { | 
 |  |  |                         top.location.href = baseUrl+"/"; | 
 |  |  |                     } | 
 |  |  |                     pageCurr=curr; | 
 |  |  |                     limit(); | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         // 监听头工具栏事件 | 
 |  |  |         table.on('toolbar(matCode)', function (obj) { | 
 |  |  |             var checkStatus = table.checkStatus(obj.config.id); | 
 |  |  |             var data = checkStatus.data; | 
 |  |  |             switch(obj.event) { | 
 |  |  |                 case 'confirm': | 
 |  |  |                     console.log(checkStatus); | 
 |  |  |                     if (data.length === 0){ | 
 |  |  |                         layer.msg("请选择数据"); | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |                     parent.addTableData(data); | 
 |  |  |                     break; | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  | 
 |  |  |         }); | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     function setMatCodeData(data) { | 
 |  |  |         matCodeData = data; | 
 |  |  |         for (var i=0;i<matCodeData.length;i++){ | 
 |  |  |             matCodeData[i]["count"] = initCountVal; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     function updateMatCodeData(matNo, count) { | 
 |  |  |         for (var i=0;i<matCodeData.length;i++){ | 
 |  |  |             if (matCodeData[i]["matNo"] === matNo){ | 
 |  |  |                 matCodeData[i]["count"] = count; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         console.log(matCodeData); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     function tableReload(child) { | 
 |  |  |         var searchData = {}; | 
 |  |  |         $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  | 
 |  |  |                 if (res.code === 403) { | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 } | 
 |  |  |                 $('td[data-field=count] div').html("1"); | 
 |  |  |                 setMatCodeData(res.data); | 
 |  |  |                 pageCurr=curr; | 
 |  |  |                 if (res.data.length === 0 && count !== 0) { | 
 |  |  |                     tableIns.reload({ |