| <!DOCTYPE html> | 
| <html> | 
|   | 
| <head> | 
|     <meta charset="utf-8"> | 
|     <title>物料信息录入</title> | 
|     <meta name="renderer" content="webkit"> | 
|     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|     <meta name="viewport" | 
|         content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"> | 
|     <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all"> | 
|     <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all"> | 
|     <link rel="stylesheet" href="../../css/public.css" media="all"> | 
|     <style> | 
|         .rightMargin { | 
|             margin-right: 0px; | 
|         } | 
|   | 
|         .buJu { | 
|             margin-top: 10px; | 
|             display: flex; | 
|             flex-direction: row-reverse; | 
|         } | 
|   | 
|         .beiJing { | 
|             background-color: #fafafa; | 
|             padding-top: 5px; | 
|             border-radius: 3px; | 
|             box-shadow: inset 0 0 3px 1px #ccc; | 
|         } | 
|   | 
|         /* 表格下拉小箭头隐藏 */ | 
|         .layui-table-grid-down { | 
|             display: none; | 
|         } | 
|     </style> | 
|     <script> | 
|         // 这里是需要在页面渲染之前执行的代码 | 
|         document.addEventListener("DOMContentLoaded", function() { | 
|              | 
|             //获取table默认显示数 | 
|             pageCntFirst(); | 
|             //判断是否开启table列表列宽调整功能。 | 
|             GetIsSetColW(); | 
|         }); | 
|       </script> | 
| </head> | 
|   | 
|   | 
| <body> | 
|   | 
|     <div class="layui-fluid" style="padding: 3px;"> | 
|         <div class="layui-card"> | 
|             <div class="layui-form layui-card-header layuiadmin-card-header-auto"> | 
|                 <div class="layui-form-item"> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">箱 号</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <input type="text" id="BoxNo" name="BoxNo" placeholder="箱号" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <!-- <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">盒 号</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <input type="text" id="BoxNo2" name="BoxNo2" placeholder="盒号" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> --> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">支 号</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <input type="text" id="BoxNo3" name="BoxNo3" placeholder="支号" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">物品编码</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <input type="text" id="SkuNo" name="SkuNo" placeholder="物料编码" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">批次号</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <div class="layui-input-inline" style="margin-right: 0;"> | 
|                                 <input type="text" id="LotNo" name="LotNo" placeholder="批次号" autocomplete="off" | 
|                                     class="layui-input"> | 
|                             </div> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">批次描述</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <div class="layui-input-inline" style="margin-right: 0;"> | 
|                                 <input type="text" id="LotText" name="LotText" placeholder="批次描述" autocomplete="off" | 
|                                     class="layui-input"> | 
|                             </div> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">实际数量</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <input type="number" id="Qty" name="Qty" placeholder="实际数量" autocomplete="off" | 
|                                 class="layui-input" min="0" value="0" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"> | 
|                         </div> | 
|                     </div> | 
|   | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label">生产日期</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" autocomplete="off" name="ProductionTime" id="ProductionTime" | 
|                                 class="layui-input" placeholder="生产日期"> | 
|                         </div> | 
|                     </div> | 
|   | 
|   | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label">抽检标记</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <div class="layui-input-inline" style="margin-right: 0;"> | 
|                                 <select name="InspectMark" id="InspectMark" lay-filter="InspectMark" lay-search> | 
|                                     <option value=""></option> | 
|                                     <option value="0">否</option> | 
|                                     <option value="1">是</option> | 
|   | 
|                                 </select> | 
|                             </div> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">零箱标记</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <div class="layui-input-inline" style="margin-right: 0;"> | 
|                                 <select name="BitBoxMark" id="BitBoxMark" lay-filter="BitBoxMark" lay-search> | 
|                                     <option value=""></option> | 
|                                     <option value="0">否</option> | 
|                                     <option value="1">是</option> | 
|                                 </select> | 
|                             </div> | 
|                         </div> | 
|                     </div> | 
|   | 
|                     <div class="layui-inline"> | 
|                         <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit | 
|                             lay-filter="LAY-app-contlist-search"> | 
|                             <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索 | 
|                         </button> | 
|                     </div> | 
|                 </div> | 
|             </div> | 
|             <div class="layui-card-body"> | 
|                 <!-- <button type="button" class="layui-btn layui-btn-sm" id="daoru1"> | 
|                     导入 | 
|                 </button> --> | 
|                 <div class="position-relative"> | 
|                     <table id="Box-list" lay-filter="Box-list"></table> | 
|                     <!--#region 自定义表头 --> | 
|                     <div class="headerSetIcon"> | 
|                         <button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols"> | 
|                             <i class="layui-icon"></i> | 
|                         </button> | 
|                     </div> | 
|                     <!-- #endregion --> | 
|   | 
|                     <!-- #region 自定义表头 --> | 
|                     <script type="text/html" id="templetProductionTime"> | 
|                         {{# function GetBtn3(d){ | 
|                                 return formatDate2(d.ProductionTime); | 
|                             }     | 
|                         }} | 
|                         {{ GetBtn3(d) }} | 
|                     </script> | 
|   | 
|                     <script type="text/html" id="templetExpirationTime"> | 
|                         {{# function GetBtn4(d){ | 
|                                 return formatDate2(d.ExpirationTime); | 
|                             }     | 
|                         }} | 
|                         {{ GetBtn4(d) }} | 
|                     </script> | 
|   | 
|                     <script type="text/html" id="templetInspectMark"> | 
|                         {{# function GetBtn5(d){ | 
|                                 switch (d.InspectMark) { | 
|                                     case "0": return '<button class="layui-btn layui-btn-radius layui-btn-xs">否</button>'; | 
|                                     case "1": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-danger ">是</button>';  | 
|                                     default: return ""; | 
|                                 }     | 
|                             }     | 
|                         }} | 
|                         {{ GetBtn5(d) }} | 
|                     </script> | 
|   | 
|                     <script type="text/html" id="templetBitBoxMark"> | 
|                         {{# function GetBtn6(d){ | 
|                                 switch (d.BitBoxMark) { | 
|                                     case "0": return '<button class="layui-btn layui-btn-radius layui-btn-xs">否</button>'; | 
|                                     case "1": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-danger">是</button>';  | 
|                                     default: return ""; | 
|                                 }     | 
|                             }     | 
|                         }} | 
|                         {{ GetBtn6(d) }} | 
|                     </script> | 
|   | 
|                     <script type="text/html" id="templetCreateTime"> | 
|                         {{# function GetBtn7(d){ | 
|                                 return formatDate(d.CreateTime); | 
|                             }     | 
|                         }} | 
|                         {{ GetBtn7(d) }} | 
|                     </script> | 
|                     <!-- #endregion --> | 
|                 </div>                 | 
|   | 
|                 <script type="text/html" id="toolbarDemo"> | 
|                     <button style="margin-right: 5px;" class="layui-btn layui-btn-sm layuiadmin-btn-list addClass" lay-event="add" > | 
|                         <i class="layui-icon"></i>添加 | 
|                     </button> | 
|   | 
|                     <button style="margin-right: 5px;" id="daoru" class="layui-btn layui-btn-sm layuiadmin-btn-list DaoRuClass" lay-event="import" > | 
|                         <i class="layui-icon"></i>导入 | 
|                     </button> | 
|                 </script> | 
|   | 
|                 <script type="text/html" id="toolbarDemoList"> | 
|                     {{# function GetBtn2(d){ | 
|                             var html = ''; | 
|                             if(d.Origin == "录入" || d.Origin == "导入"){  | 
|                                 html = `<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del">  | 
|                                     <i class="layui-icon layui-icon-delete"></i>删除</a>`;  | 
|                                  | 
|                             } | 
|                             return html; | 
|                         }  | 
|                     }} | 
|                     {{ GetBtn2(d) }} | 
|                 </script> | 
|             </div> | 
|   | 
|         </div> | 
|     </div> | 
|   | 
|   | 
|     <script src="../../layuiadmin/layui/layui.js"></script> | 
|     <script src="../../js/public.js"></script> | 
|     <script src="../../js/jquery-3.5.1.min.js"></script> | 
|     <script src="../../js/jquery.cookie.js"></script> | 
|     <script> | 
|         layui.extend({ | 
|             excel: '../../layuiadmin/layui/layui_exts/excel' // {/}的意思即代表采用自有路径,即不跟随 base 路径 | 
|         }) | 
|   | 
|         layui.config({ | 
|             base: '../../layuiadmin/' //静态资源所在路径 | 
|         }).extend({ | 
|             index: 'lib/index' //主入口模块 | 
|         }).use(['index', 'form', 'layer', 'table', 'laydate', 'upload', 'excel'], function () { | 
|             var form = layui.form, | 
|                 table = layui.table, | 
|                 layer = layui.layer, | 
|                 laydate = layui.laydate; | 
|             var upload = layui.upload; | 
|   | 
|             laydate.render({ | 
|                 elem: '#ProductionTime' | 
|                 , format: 'yyyy-MM-dd' //可任意组合 | 
|             }); | 
|   | 
|             // 搜索方法 | 
|             form.on('submit(LAY-app-contlist-search)', function (data) { | 
|                 bindTable();  | 
|                  | 
|             });   | 
|   | 
|             // 页面加载绑定Table | 
|             bindTable(); | 
|   | 
|              | 
|             // 添加导入按钮单机事件 | 
|             table.on('toolbar(Box-list)', function (obj) { | 
|                 switch (obj.event) { | 
|                     case 'add':    // 添加箱支关系 | 
|                         // 代码区域 | 
|                         var param = getBoxInforVlues(); | 
|                         if (param != "") { | 
|                             console.log(param); | 
|                             sendData(IP + "/BllAsn/AddBllBoxInfo", param, 'post', function (res) { | 
|                                 if (res.code == 0) { //成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 1, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { | 
|                                         bindTable(); | 
|                                     }); | 
|                                 } else { //不成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 2, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { doing = true }); | 
|                                 }  | 
|                             }); | 
|                         } | 
|                         break; | 
|                      | 
|                     default: break; | 
|                 } | 
|             }); | 
|   | 
|   | 
|             // 删除箱支信息 | 
|             table.on('tool(Box-list)', function (obj) { | 
|                 var data = obj.data; | 
|                 switch (obj.event) { | 
|                     case "del": | 
|                         layer.confirm('确定删除箱支明细吗?', function (index) { | 
|                             // 代码区域 | 
|                             var param = { | 
|                                 Id: data.Id, | 
|                                 Status: "0", | 
|                             }; | 
|                             console.log(param); | 
|                             sendData(IP + "/BllAsn/DelBllBoxInfo", param, 'post', function (res) { | 
|                                 if (res.code == 0) { //成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 1, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { | 
|                                         bindTable(); | 
|                                         doing = true | 
|                                     }); | 
|                                 } else { //不成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 2, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { doing = true }); | 
|                                 } | 
|                             }); | 
|                         }); | 
|   | 
|                         break; | 
|                     default: break; | 
|                 } | 
|             }); | 
|   | 
|             //#region 事件方法 | 
|             // 查询录入的箱支关系 | 
|             //#region 自定义表头 | 
|             var TotalColsArr = [[ | 
|                         {field: 'BoxNo',title: '箱号',align: 'center',fixed: 'left',width: 220, "disabled": true},  | 
|                         {field: 'BoxNo2',title: '盒号',align: 'center',fixed: 'left'},  | 
|                         {field: 'BoxNo3',title: '支号',align: 'center',fixed: 'left',width: 220, "disabled": true},  | 
|                         {field: 'SkuNo',title: '物料编码',align: 'center',fixed: 'left',width: 140, "disabled": true},  | 
|                         {field: 'SkuName',title: '物料名称',align: 'center',fixed: 'left',width: 240, "disabled": true},  | 
|                         {field: 'LotNo',title: '批次号',align: 'center',width: 155,},  | 
|                         {field: 'Qty',title: '数量',align: 'center',width: 100,}, | 
|                         {field: 'LotText',title: '批次描述',align: 'center',width: 165},  | 
|                         {field: 'ProductionTime',title: '生产日期',align: 'center',width: 160,templet: '#templetProductionTime'},  | 
|                         {field: 'ExpirationTime',title: '过期日期',align: 'center',width: 160,templet: '#templetExpirationTime'},  | 
|                         {field: 'SupplierLot',title: '供货批次',align: 'center',width: 155},  | 
|                         {field: 'InspectMark',title: '抽检标记',align: 'center',templet: '#templetInspectMark',width: 90},  | 
|                         {field: 'BitBoxMark',title: '零箱标记',align: 'center',templet: '#templetBitBoxMark',width: 90},  | 
|                         {field: 'Origin',title: '来源',align: 'center',}, | 
|                         {field: 'CreateUserName',title: '创建人',align: 'center',width: 100},  | 
|                         {field: 'CreateTime',title: '创建时间',align: 'center',width: 160,templet: '#templetCreateTime'}, | 
|                         {field:'caozuo',title: '操作',fixed: 'right',width: 100,align: 'center',toolbar: '#toolbarDemoList', "disabled": true} | 
|                     ]]; | 
|             var TotalColsSysArr=encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码 | 
|             //#endregion | 
|             function bindTable() { | 
|                 //#region 原始非自定义列 | 
|                 // var param = { | 
|                 //     BoxNo: $("#BoxNo").val(), | 
|                 //     // BoxNo2: $("#BoxNo2").val(), | 
|                 //     BoxNo3: $("#BoxNo3").val(), | 
|                 //     SkuNo: $("#SkuNo").val(), | 
|                 //     LotNo: $("#LotNo").val(), | 
|                 //     LotText: $("#LotText").val(), | 
|                 //     ProductionTime: $("#ProductionTime").val(), | 
|                 //     InspectMark: $("#InspectMark").val(), | 
|                 //     BitBoxMark: $("#BitBoxMark").val(), | 
|                 //     // Origin: "录入", | 
|                 // }; | 
|   | 
|                 // table.render({ | 
|                 //     elem: '#Box-list', | 
|                 //     url: IP + "/BllAsn/GetBllBoxInfoList", | 
|                 //     method: 'POST', | 
|                 //     height: 'full-136', | 
|                 //     id: 'Box-list', | 
|                 //     where: param, | 
|                 //     contentType: 'application/json', | 
|                 //     toolbar: '#toolbarDemo', | 
|                 //     defaultToolbar: [], //'filter','print', 'exports' | 
|                 //     headers: { ToKen: $.cookie('token') }, | 
|                 //     page: true, | 
|                 //     even: true, | 
|                 //     limit: pageCnt, | 
|                 //     limits: pageLimits, | 
|                 //     cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增 | 
|                 //     done: function (res) { | 
|                 //         setRight(); | 
|                 //     }, | 
|                 //     cols: [ | 
|                 //         [{ | 
|                 //             field: 'BoxNo', | 
|                 //             title: '箱号', | 
|                 //             align: 'center', | 
|                 //             fixed: 'left', | 
|                 //             width: 220 | 
|                 //         }, { | 
|                 //             field: 'BoxNo2', | 
|                 //             title: '盒号', | 
|                 //             align: 'center', | 
|                 //             fixed: 'left', | 
|                 //             hide:true | 
|                 //         }, { | 
|                 //             field: 'BoxNo3', | 
|                 //             title: '支号', | 
|                 //             align: 'center', | 
|                 //             fixed: 'left', | 
|                 //             width: 220 | 
|                 //         }, { | 
|                 //             field: 'SkuNo', | 
|                 //             title: '物料编码', | 
|                 //             align: 'center', | 
|                 //             fixed: 'left', | 
|                 //             width: 140 | 
|                 //         }, { | 
|                 //             field: 'SkuName', | 
|                 //             title: '物料名称', | 
|                 //             align: 'center', | 
|                 //             fixed: 'left', | 
|                 //             width: 240 | 
|                 //         }, { | 
|                 //             field: 'LotNo', | 
|                 //             title: '批次号', | 
|                 //             align: 'center', | 
|                 //             width: 155, | 
|                 //         }, { | 
|                 //             field: 'Qty', | 
|                 //             title: '数量', | 
|                 //             align: 'center', | 
|                 //             width: 100, | 
|                 //         }, { | 
|                 //             field: 'LotText', | 
|                 //             title: '批次描述', | 
|                 //             align: 'center', | 
|                 //             width: 165 | 
|   | 
|                 //         }, { | 
|                 //             field: 'ProductionTime', | 
|                 //             title: '生产日期', | 
|                 //             align: 'center', | 
|                 //             width: 160, | 
|                 //             templet: function (d) { | 
|                 //                 return formatDate2(d.ProductionTime); | 
|                 //             } | 
|                 //         }, { | 
|                 //             field: 'ExpirationTime', | 
|                 //             title: '过期日期', | 
|                 //             align: 'center', | 
|                 //             width: 160, | 
|                 //             templet: function (d) { | 
|                 //                 return formatDate2(d.ExpirationTime); | 
|                 //             } | 
|                 //         }, { | 
|                 //             field: 'SupplierLot', | 
|                 //             title: '供货批次', | 
|                 //             align: 'center', | 
|                 //             width: 155 | 
|                 //         }, { | 
|                 //             field: 'InspectMark', | 
|                 //             title: '抽检标记', | 
|                 //             align: 'center', | 
|                 //             templet: function (d) { | 
|                 //                 switch (d.InspectMark) { | 
|                 //                     case "0": return '<button class="layui-btn layui-btn-radius layui-btn-xs">否</button>'; | 
|                 //                     case "1": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-danger ">是</button>';  | 
|                 //                     default: return ""; | 
|                 //                 } | 
|                 //             }, | 
|                 //             width: 90 | 
|                 //         }, { | 
|                 //             field: 'BitBoxMark', | 
|                 //             title: '零箱标记', | 
|                 //             align: 'center', | 
|                 //             templet: function (d) { | 
|                 //                 switch (d.BitBoxMark) { | 
|                 //                     case "0": return '<button class="layui-btn layui-btn-radius layui-btn-xs">否</button>'; | 
|                 //                     case "1": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-danger">是</button>';  | 
|                 //                     default: return ""; | 
|                 //                 } | 
|                 //             }, | 
|                 //             width: 90 | 
|                 //         }, { | 
|                 //             field: 'Origin', | 
|                 //             title: '来源', | 
|                 //             align: 'center', | 
|                 //         }, { | 
|                 //             field: 'CreateUserName', | 
|                 //             title: '创建人', | 
|                 //             align: 'center', | 
|                 //             width: 100 | 
|                 //         }, { | 
|                 //             field: 'CreateTime', | 
|                 //             title: '创建时间', | 
|                 //             align: 'center', | 
|                 //             width: 160, | 
|                 //             templet: function (d) { | 
|                 //                 return formatDate(d.CreateTime); | 
|                 //             } | 
|                 //         }, { | 
|                 //             title: '操作', | 
|                 //             fixed: 'right', | 
|                 //             width: 100, | 
|                 //             align: 'center', | 
|                 //             toolbar: '#toolbarDemoList' | 
|                 //         }] | 
|                 //     ], | 
|   | 
|                 // }); | 
|                 //#endregion | 
|   | 
|                 //#region 自定义表头 | 
|                 var colsJson | 
|                 var param1={ | 
|                     Href:'BllAsn/GetBllBoxInfoList' | 
|                 }; | 
|                 sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function(res) { | 
|                     if (res.code == 0){                             | 
|                         if(res.data=='' || res.data==undefined || res.data==null){ | 
|                             colsJson=TotalColsArr | 
|                         }else{ | 
|                             colsJson= eval(res.data); | 
|                         } | 
|                     }else{ | 
|                         colsJson=TotalColsArr | 
|                     } | 
|                     var param = { | 
|                         BoxNo: $("#BoxNo").val(), | 
|                         // BoxNo2: $("#BoxNo2").val(), | 
|                         BoxNo3: $("#BoxNo3").val(), | 
|                         SkuNo: $("#SkuNo").val(), | 
|                         LotNo: $("#LotNo").val(), | 
|                         LotText: $("#LotText").val(), | 
|                         ProductionTime: $("#ProductionTime").val(), | 
|                         InspectMark: $("#InspectMark").val(), | 
|                         BitBoxMark: $("#BitBoxMark").val(), | 
|                         // Origin: "录入", | 
|                     }; | 
|                     table.render({ | 
|                         elem: '#Box-list', | 
|                         url: IP + "/BllAsn/GetBllBoxInfoList", | 
|                         method: 'POST', | 
|                         height: 'full-136', | 
|                         id: 'Box-list', | 
|                         where: param, | 
|                         contentType: 'application/json', | 
|                         toolbar: '#toolbarDemo', | 
|                         defaultToolbar: [], //'filter','print', 'exports' | 
|                         headers: { ToKen: $.cookie('token') }, | 
|                         page: true, | 
|                         even: true, | 
|                         limit: pageCnt, | 
|                         limits: pageLimits, | 
|                         cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增 | 
|                         done: function (res) { | 
|                             setRight(); | 
|                             //自定义列宽 | 
|                             SetTableColW('Box-list','BllAsn/GetBllBoxInfoList',TotalColsSysArr);     | 
|                         }, | 
|                         cols: colsJson | 
|                     }); | 
|   | 
|                     //绑定导入 | 
|                     upload.render({ | 
|                         elem: '#daoru' //绑定元素 | 
|                         , url: '' //上传接口 | 
|                         , auto: false  //是否选完文件后自动上传。如果设定 false,那么需要设置 bindAction 参数来指向一个其它按钮提交上传 | 
|                         , exts: 'slx|excel|xlsx'  //允许上传的文件后缀  | 
|                         , accept: 'file' //指定允许上传时校验的文件类型 | 
|                         //, bindAction: '#daoru' //指向一个按钮触发上传 | 
|                         , choose: function (obj) {// 选择文件回调 | 
|                             console.log(obj); | 
|                             var files = obj.pushFile(); //将每次选择的文件追加到文件队列 | 
|                             var fileArr = Object.values(files);// 注意这里的数据需要是数组,所以需要转换一下 | 
|                             console.log(fileArr) | 
|                             // 用完就清理掉,避免多次选中相同文件时出现问题 | 
|                             for (var index in files) { | 
|                                 console.log(index); | 
|                                 if (files.hasOwnProperty(index)) { | 
|                                     delete files[index]; | 
|                                 } | 
|                             } | 
|                             console.log("abs"); | 
|                             uploadExcel(fileArr); // 如果只需要最新选择的文件,可以这样写: uploadExcel([files.pop()]) | 
|                         } | 
|                         , done: function (res) { | 
|                             console.log(res); | 
|                             //上传完毕回调 | 
|                         } | 
|                         , error: function (res) { | 
|                             console.log(res); | 
|                             //请求异常回调 | 
|                         } | 
|                     }); | 
|                 }); | 
|                 //#endregion | 
|             } | 
|   | 
|             // 权限设置 | 
|             function setRight() { | 
|                 $(function () { | 
|                     $(".addClass").hide(); | 
|                     $(".DaoRuClass").hide(); | 
|                     $(".delClass").hide();  | 
|                 }); | 
|                 sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) { | 
|                     if (res.code == 0) { //成功  | 
|                         for (var k = 0; k < res.data.length; k++) { | 
|                             if (res.data[k].MenuName == "添加箱支录入") { | 
|                                 $(function () { | 
|                                     $(".addClass").show(); | 
|                                 }); | 
|                             } | 
|                             if (res.data[k].MenuName == "导入箱支录入") { | 
|                                 $(function () { | 
|                                     $(".DaoRuClass").show(); | 
|                                 }); | 
|                             } | 
|                             if (res.data[k].MenuName == "删除箱支录入") { | 
|                                 $(function () { | 
|                                     $(".delClass").show();  | 
|                                 }); | 
|                             } | 
|                         } | 
|                     } else { //不成功 | 
|                         layer.msg('获取权限信息失败', { | 
|                             icon: 2, | 
|                             time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                         }, function () { }); | 
|                     } | 
|                 }); | 
|             } | 
|   | 
|             // 获取箱支信息 | 
|             function getBoxInforVlues() { | 
|                 var msg = ""; | 
|                 if ($("#BoxNo").val() == "") { | 
|                     layer.msg("请输入箱码!", { | 
|                         icon: 2, | 
|                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                     }); | 
|                     return msg; | 
|                 } | 
|                 // if ($("#BoxNo2").val() == "") { | 
|                 //     layer.msg("请输入盒码!", { | 
|                 //         icon: 2, | 
|                 //         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                 //     }); | 
|                 //     return msg; | 
|                 // } | 
|                 if ($("#BoxNo3").val() == "") { | 
|                     layer.msg("请输入支码!", { | 
|                         icon: 2, | 
|                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                     }); | 
|                     return msg; | 
|                 } | 
|                 if ($("#SkuNo").val() == "") { | 
|                     layer.msg("请输入物料编码!", { | 
|                         icon: 2, | 
|                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                     }); | 
|                     return msg; | 
|                 } | 
|                 if ($("#LotNo").val() == "") { | 
|                     layer.msg("请输入批次号!", { | 
|                         icon: 2, | 
|                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                     }); | 
|                     return msg; | 
|                 } | 
|                 if ($("#Qty").val() == "") { | 
|                     layer.msg("请输入实际数量!", { | 
|                         icon: 2, | 
|                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                     }); | 
|                     return msg; | 
|                 } | 
|   | 
|                 var param = { | 
|                     BoxNo: $("#BoxNo").val(), | 
|                     // BoxNo2: $("#BoxNo2").val(), | 
|                     BoxNo3: $("#BoxNo3").val(), | 
|                     SkuNo: $("#SkuNo").val(), | 
|                     LotNo: $("#LotNo").val(), | 
|                     LotText: $("#LotText").val(), | 
|                     Qty: parseInt($("#Qty").val()), | 
|                     ProductionTime: $("#ProductionTime").val(), | 
|                     InspectMark: $("#InspectMark").val(), | 
|                     BitBoxMark: $("#BitBoxMark").val(), | 
|                     Origin: "录入", | 
|                 }; | 
|   | 
|                 return param; | 
|             } | 
|   | 
|             // 导入箱支关系 | 
|             function uploadExcel(files) { | 
|                 console.log("123"); | 
|                 var list = []; | 
|                 try { | 
|                     var excel = layui.excel; | 
|                     excel.importExcel(files, { | 
|                         // 读取数据的同时梳理数据 | 
|                         fields: { | 
|                             'BoxNo': 'A', //箱号 | 
|                             'BoxNo2': 'B', //盒号 | 
|                             'BoxNo3': 'C', //支号 | 
|                             'Qty': 'D', //数量 | 
|                             'SkuNo': 'E', //物料号 | 
|                             'LotNo': 'F', //批次 | 
|                             'LotText': 'G', //批次描述 | 
|                             'ProductionTime': 'H', //生产日期 | 
|                             'InspectMark': 'I',  //检验标记 | 
|                             'BitBoxMark': 'J', //零箱标记 | 
|                         } | 
|                     }, | 
|                         function (data) { | 
|                             console.log(data); | 
|                             // var arr = new Array(); | 
|                             //excel第一行不读取、设置为标题 | 
|                             for (i = 1; i < data[0].Sheet1.length; i++) { | 
|   | 
|                                 var Qty = 0; | 
|                                 if (isIntNum(data[0].Sheet1[i].Qty)) { | 
|                                     Qty = parseInt(data[0].Sheet1[i].Qty); | 
|                                 } | 
|   | 
|                                 var InspectMark = "0"; | 
|                                 var BitBoxMark = "0"; | 
|                                 if (data[0].Sheet1[i].InspectMark == "是") { | 
|                                     InspectMark = "1"; | 
|                                 } | 
|                                 if (data[0].Sheet1[i].BitBoxMark == "是") { | 
|                                     BitBoxMark = "1"; | 
|                                 } | 
|                                 var tt = { | 
|                                     BoxNo: data[0].Sheet1[i].BoxNo, | 
|                                     BoxNo2: data[0].Sheet1[i].BoxNo2, | 
|                                     BoxNo3: data[0].Sheet1[i].BoxNo3, | 
|                                     Qty: Qty, | 
|                                     SkuNo: data[0].Sheet1[i].SkuNo, | 
|                                     LotNo: data[0].Sheet1[i].LotNo, | 
|                                     LotText: data[0].Sheet1[i].LotText, | 
|                                     ProductionTime: data[0].Sheet1[i].ProductionTime, | 
|                                     InspectMark: InspectMark, | 
|                                     BitBoxMark: BitBoxMark, | 
|                                 }; | 
|                                 list.push(tt); | 
|                                 console.log(data[0].Sheet1[i].ProductionTime); | 
|                             } | 
|                             console.log(list); | 
|                             var param = { | 
|                                 "OperType": "Add", | 
|                                 "ListBoxInfo": list, | 
|                             } | 
|                             console.log(param) | 
|                             layer.load();//打开loading | 
|                             sendData(IP + "/BllAsn/ImportBllBoxInfo", param, 'post', function (res) { | 
|                                 layer.closeAll(); //关闭loading | 
|                                 if (res.code == 0) { //成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 1, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { | 
|                                         bindTable(); | 
|                                         doing = true | 
|                                     }); | 
|                                 } else { //不成功 | 
|                                     if(res.msg==undefined){ | 
|                                         layer.msg("后台正在导入中,请稍后查看结果", { | 
|                                             icon: 2, | 
|                                             time: 3000 //2秒关闭(如果不配置,默认是3秒) | 
|                                         }, function () { bindTable();doing = true }); | 
|                                     }else{ | 
|                                         layer.msg(res.msg, { | 
|                                             icon: 2, | 
|                                             time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                         }, function () { bindTable();doing = true }); | 
|                                     }                                     | 
|                                 } | 
|                             }); | 
|                         }); | 
|                 } catch (e) { | 
|                     layer.alert(e.message); | 
|                 } | 
|   | 
|             } | 
|             //#endregion | 
|   | 
|             //#region 自定义表头 | 
|             //自定义表头             | 
|             active = { | 
|                 customCols: function(){ | 
|                     layer.open({ | 
|                         type: 2, | 
|                         title: '自定义列', | 
|                         content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetBllBoxInfoList&ColsSysArr='+TotalColsSysArr, | 
|                         maxmin: false, | 
|                         resize: false, | 
|                         area: ['970px', '650px'] | 
|                     }); | 
|                 }, | 
|             }; | 
|             $('.layui-btn').on('click', function() { | 
|                 var type = $(this).data('type'); | 
|                 active[type] ? active[type].call(this) : ''; | 
|             }); | 
|             //#endregion | 
|         }) | 
|     </script> | 
| </body> | 
|   | 
| </html> |