| <!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 type="text/css"> | 
|         .layui-table-view .layui-table[lay-size=sm] .layui-table-cell { | 
|             height: auto; | 
|             line-height: 23px; | 
|         } | 
|   | 
|         /* 表格下拉小箭头隐藏 */ | 
|         .layui-table-grid-down { | 
|             display: none; | 
|         } | 
|   | 
|         /* 样式用于美化图片展示 */ | 
|         .layui-table-cell img { | 
|             max-width: 100px; | 
|             max-height: 100px; | 
|         } | 
|     </style> | 
|     <script> | 
|         // 这里是需要在页面渲染之前执行的代码 | 
|         document.addEventListener("DOMContentLoaded", function () { | 
|             //获取table默认显示数 | 
|             pageCntFirst(); | 
|             //判断是否开启table列表列宽调整功能。 | 
|             GetIsSetColW(); | 
|         }); | 
|     </script> | 
| </head> | 
|   | 
| <body id="body"> | 
|   | 
|     <div class="layui-fluid" style="padding-bottom: 0;"> | 
|         <div class="layui-card"> | 
|             <div class="layui-form layui-card-header layuiadmin-card-header-auto" id="top"> | 
|                 <div class="layui-form-item"> | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">请验号</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" id="QcNo" name="QcNo" placeholder="请验号" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">入库单号</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" id="ASNNo" name="ASNNo" placeholder="入库单号" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">物料编码</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" id="SkuNo" name="SkuNo" placeholder="物料编码" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">物料名称</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" id="SkuName" name="SkuName" placeholder="物料名称" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">执行状态</label> | 
|                         <div class="layui-input-inline"> | 
|                             <select name="Status" id="Status" lay-search> | 
|                                 <option value=""></option> | 
|                                 <option value="0">待请验</option> | 
|                                 <option value="1">待出库</option> | 
|                                 <option value="2">待取样</option> | 
|                                 <option value="3">已完成</option> | 
|                             </select> | 
|                         </div> | 
|                     </div> | 
|   | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">批次号</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" id="LotNo" name="LotNo" placeholder="批次号" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">供货批次</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" id="SupplierLot" name="SupplierLot" placeholder="供货批次" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|   | 
|   | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">开始日期</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" autocomplete="off" name="StartTime" id="StartTime" class="layui-input" | 
|                                 placeholder="开始日期"> | 
|                         </div> | 
|   | 
|                     </div> | 
|                     <div class="layui-inline"> | 
|                         <label class="layui-form-label" style="width: 60px;">结束日期</label> | 
|                         <div class="layui-input-inline"> | 
|                             <input type="text" autocomplete="off" name="EndTime" id="EndTime" class="layui-input" | 
|                                 placeholder="结束时间"> | 
|                         </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 style="display: none;" id="UploadImageView"> | 
|   | 
|                         <div id="UploadImage" style="margin-left: 35px;margin-top: 30px;"> | 
|                             <label>上传图片:</label><button type="button" class="layui-btn" id="uploadBtn" | 
|                                 style="margin-left: 20px;">浏览</button> | 
|                             <button type="button" class="layui-btn" id="upload" style="margin-left: 20px;">上传</button> | 
|   | 
|                         </div> | 
|                     </div> | 
|   | 
|                     <div style="display: none;" id="ImagesShowView"> | 
|                         <div id="ImagesShow"> | 
|   | 
|                         </div> | 
|                     </div> | 
|   | 
|                     <!-- 确认出库口弹窗 --> | 
|                     <div class="layui-inline" id="divPickingArea" style="display: none; padding-top: 10px;"> | 
|                         <label class="layui-form-label">出库口</label> | 
|                         <div class="layui-input-inline" style="width: 220px;"> | 
|                             <select name="PickingArea" id="PickingArea" lay-search> | 
|                                 <option value=""></option> | 
|                                 <option value="B020101">B020101</option> | 
|                                 <option value="B050101">B050101</option> | 
|                             </select> | 
|                         </div> | 
|                     </div> | 
|                 </div> | 
|             </div> | 
|   | 
|             <div class="layui-card-body"> | 
|                 <div style="position: relative;"> | 
|                     <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> | 
|                         <ul class="layui-tab-title" id="tab"> | 
|                             <li class="layui-this">请验</li> | 
|                             <li>取样</li> | 
|                         </ul> | 
|   | 
|                         <div id="center"></div> | 
|   | 
|                         <div class="layui-tab-content"> | 
|                             <div class="layui-tab-item layui-show"> | 
|                                 <div class="position-relative"><!-- class="position-relative" --><!-- 自定义表头加上 --> | 
|                                     <table id="InspectionRequest" lay-filter="InspectionRequest"></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 --> | 
|                                 </div> | 
|                             </div> | 
|                             <div class="layui-tab-item"> | 
|                                 <div class="position-relative"><!-- class="position-relative" --><!-- 自定义表头加上 --> | 
|                                     <table id="SamplingDetails" lay-filter="SamplingDetails"></table> | 
|                                     <!-- #region 自定义表头 --> | 
|                                     <div class="headerSetIcon"> | 
|                                         <button class="layui-btn layui-btn-primary layui-btn-sm" | 
|                                             data-type="customCols2"> | 
|                                             <i class="layui-icon"></i> | 
|                                         </button> | 
|                                     </div> | 
|                                     <!-- #endregion --> | 
|                                 </div> | 
|   | 
|                             </div> | 
|                         </div> | 
|                     </div> | 
|                 </div> | 
|   | 
|                 <!-- #region 自定义表头 --> | 
|                 <script type="text/html" id="templetStatus"> | 
|                     {{# function GetBtn3(d){ | 
|                         switch (d.Status) { | 
|                             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-danger layui-btn-xs">待出库</button>'; | 
|                             case "2": return '<button class="layui-btn layui-btn-radius layui-btn-warm layui-btn-xs">待取样</button>'; | 
|                             case "3": return '<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">已完成</button>'; | 
|                             default: return ""; | 
|                         } | 
|                         }     | 
|                     }} | 
|                     {{ GetBtn3(d) }} | 
|                 </script> | 
|   | 
|                 <script type="text/html" id="templetCompleteTime"> | 
|                     {{# function GetBtn5(d){ | 
|                             return formatDate(d.RequestTime); | 
|                         }     | 
|                     }} | 
|                     {{ GetBtn5(d) }} | 
|                 </script> | 
|   | 
|                 <script type="text/html" id="templetCreateTime"> | 
|                     {{# function GetBtn6(d){ | 
|                             return formatDate(d.CreateTime); | 
|                         }     | 
|                     }} | 
|                     {{ GetBtn6(d) }} | 
|                 </script> | 
|   | 
|                 <script type="text/html" id="templetUpdateTime"> | 
|                     {{# function GetBtn9(d){ | 
|                             return formatDate(d.UpdateTime); | 
|                         }     | 
|                     }} | 
|                     {{ GetBtn9(d) }} | 
|                 </script> | 
|   | 
|                 <!-- 主表操作按钮 --> | 
|                 <script type="text/html" id="InspectionRequestList"> | 
|                     {{# function GetInspectionRequesBtn(d){ | 
|                             var html = '';  | 
|                             switch (d.Status) { | 
|                                 case "0" : | 
|                                     html += `<a class="layui-btn layui-btn-normal layui-btn-xs shangClass" lay-event="upImage"> | 
|                                     <i class="layui-icon layui-icon-add"></i>上传</a> `; | 
|                                     html += `<a class="layui-btn layui-btn-normal layui-btn-xs chaClass" lay-event="ViewImage"> | 
|                                         <i class="layui-icon layui-icon-add"></i>查看</a> `; | 
|                                     html += `<a class="layui-btn layui-btn-normal layui-btn-xs addClass" lay-event="add"> | 
|                                             <i class="layui-icon layui-icon-add"></i>请验</a> `; | 
|                                     html += `<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del"> | 
|                                             <i class="layui-icon layui-icon-delete"></i>删除</a>`; | 
|                                     break;  | 
|                                 case "1" : | 
|                                     html += `<a class="layui-btn layui-btn-normal layui-btn-xs editClass" lay-event="edit"> | 
|                                             <i class="layui-icon layui-icon-edit"></i>出库</a> `; | 
|                                     html += `<a class="layui-btn layui-btn-normal layui-btn-xs clossClass" lay-event="closs">   | 
|                                             <i class="layui-icon layui-icon-ok"></i>关单</a>`;  | 
|                                     break;  | 
|   | 
|                                 case "2": | 
|                                     html += `<a class="layui-btn layui-btn-normal layui-btn-xs editClass" lay-event="edit"> | 
|                                         <i class="layui-icon layui-icon-edit"></i>出库</a> `; | 
|                                     html += `<a class="layui-btn layui-btn-normal layui-btn-xs clossClass" lay-event="closs">   | 
|                                         <i class="layui-icon layui-icon-ok"></i>关单</a>`;  | 
|                             break;  | 
|                                 default :  | 
|                                 break;  | 
|                             } | 
|                             return html; | 
|                         }  | 
|                     }} | 
|                     {{ GetInspectionRequesBtn(d) }} | 
|                 </script> | 
|   | 
|                 <!-- 取样操作按钮 --> | 
|                 <script type="text/html" id="SamplingDetailsList"> | 
|                     {{# function GetSamplingDetailsBtn(d){  | 
|                             var html = '';  | 
|   | 
|                             switch (d.Status) { | 
|                                 case "0": | 
|                                 case "1": | 
|                                 case "2":  | 
|                                     html += `<a class="layui-btn layui-btn-danger layui-btn-xs " lay-event="delete"> | 
|                                             <i class="layui-icon layui-icon-delete"></i>删除</a> `; | 
|                                     break;  | 
|                                 default :  | 
|                                 break;  | 
|                             } | 
|                             return html; | 
|                         }  | 
|                     }} | 
|                     {{ GetSamplingDetailsBtn(d) }} | 
|                 </script> | 
|                 <!-- #endregion --> | 
|             </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 type="text/javascript"> | 
|   | 
|     </script> | 
|     <script> | 
|         layui.config({ | 
|             base: '../../layuiadmin/' //静态资源所在路径 | 
|         }).extend({ | 
|             index: 'lib/index' //主入口模块 | 
|         }).use(['index', 'table', 'laypage', 'element', 'layer', 'laydate', 'upload'], function () { | 
|             var table = layui.table, | 
|                 form = layui.form, | 
|                 element = layui.element, | 
|                 laypage = layui.laypage, | 
|                 layer = layui.layer, | 
|                 laydate = layui.laydate, | 
|                 upload = layui.upload; | 
|             var h1 = GetTableTabHeight(); | 
|             laydate.render({ | 
|                 elem: '#StartTime' | 
|                 , format: 'yyyy-MM-dd' //可任意组合 | 
|             }); | 
|             laydate.render({ | 
|                 elem: '#EndTime' | 
|                 , format: 'yyyy-MM-dd' //可任意组合 | 
|             }); | 
|             //tab切换判断值 | 
|             var yemianid = 0; | 
|             //接受全局变量 | 
|             let quanSkuNo = 0; | 
|             // 获取table高度 | 
|             // var h1 = GetTableTopHeight(); | 
|             // var h2 = GetTableBottomHeight(); | 
|             // console.log(h1); | 
|             // console.log(h2); | 
|   | 
|   | 
|             bindInspectionRequest(); | 
|             bindSamplingDetails(); | 
|   | 
|             //获取仓库下拉框信息 | 
|             synData(IP + "/Sys/GetWarehouseDic", {}, 'get', function (res) { | 
|                 if (res.code == 0) { //成功 | 
|                     for (var i = 0; i < res.data.length; i++) { | 
|   | 
|                         $("#WareHouseNo").append('<option value =' + res.data[i].WareHouseNo + '>' + res.data[i].WareHouseNo + '-' + | 
|                             res.data[i].WareHouseName + '</option>'); | 
|                     } | 
|                     // $("#WareHouseNo option[value='" + res.data[0].WareHouseNo + "']").attr("selected", "selected") | 
|                     form.render('select'); | 
|                 } else { //不成功 | 
|                     layer.msg(res.msg, { | 
|                         icon: 2, | 
|                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                     }, function () { }); | 
|                 } | 
|             }); | 
|   | 
|             // 查询事件 | 
|             form.on('select(getWareHouseNo)', function (data) { | 
|                 if ($("#WareHouseNo").val() == "W01") { | 
|                     //获取巷道下拉框信息 | 
|                     synData(IP + "/Sys/GetRoadwayList", {}, 'get', function (res) { | 
|                         if (res.code == 0) { //成功 | 
|                             for (var i = 0; i < res.data.length; i++) { | 
|   | 
|                                 $("#RoadwayNo").append('<option value =' + res.data[i].RoadwayNo + '>' + res.data[i].RoadwayNo + '-' + | 
|                                     res.data[i].RoadwayName + '</option>'); | 
|                             } | 
|                             // $("#RoadwayNo option[value='" + res.data[0].RoadwayNo + "']").attr("selected", "selected") | 
|                             form.render('select'); | 
|                         } else { //不成功 | 
|                             layer.msg(res.msg, { | 
|                                 icon: 2, | 
|                                 time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                             }, function () { }); | 
|                         } | 
|                     }); | 
|                 } | 
|                 else { | 
|                     $("#RoadwayNo").html(''); | 
|                     $("#RoadwayNo").append('<option value=""></option>'); | 
|                     form.render('select'); | 
|                 } | 
|   | 
|             }); | 
|   | 
|             // 渲染总表 | 
|             //#region 自定义表头 | 
|             var TotalColsArr = [[ | 
|                 { field: '', title: '序号', type: 'numbers', width: 60, align: 'center', fixed: 'left', "disabled": true }, | 
|                 { field: 'QcNo', title: '请验编号', align: 'center', width: 180, "disabled": true }, | 
|                 { field: 'ASNNo', title: '入库单号', align: 'center', width: 180, "disabled": true }, | 
|                 { field: 'SkuNo', title: '物料编码', align: 'center', with: 100 }, | 
|                 { field: 'SkuName', title: '物料名称', align: 'center', width: 100 }, | 
|                 { field: 'LotNo', title: '批次号', align: 'center', width: 100 }, | 
|                 { field: 'SupplierLot', title: '供货批次', align: 'center', width: 100 }, | 
|                 { field: 'Qty', title: '到货数量', align: 'center', width: 100 }, | 
|                 { field: 'SamplingQty', title: '取样量', align: 'center', width: 100 }, | 
|                 { field: 'Status', title: '执行状态', align: 'center', width: 90, templet: '#templetStatus' }, | 
|                 { field: 'RequestTime', title: '请验日期', align: 'center', width: 165, templet: '#templetCompleteTime' }, | 
|                 { field: 'RequestUser', title: '请验人', align: 'center', width: 165 }, | 
|                 { | 
|                     field: 'UDF5', title: '图片', align: 'center', width: 100, templet: function (d) { | 
|                         return d.image ? '<img src="' + d.image + '" alt="图片">' : '无图片'; | 
|                     } | 
|                 }, | 
|                 // { field: 'UDF2', title: '自定义2', align: 'center', width: 100 }, | 
|                 // { field: 'UDF3', title: '自定义3', align: 'center', width: 100 }, | 
|                 // { field: 'UDF4', title: '自定义4', align: 'center', width: 100 }, | 
|                 // { field: 'UDF5', title: '自定义5', align: 'center', width: 100 }, | 
|   | 
|                 { field: 'CreateTime', title: '创建时间', align: 'center', width: 165, templet: '#templetCreateTime' }, | 
|                 { field: 'CreateUserName', title: '创建人', align: 'center', width: 165 }, | 
|                 { field: 'UpdateTime', title: '完成日期', align: 'center', width: 165, templet: '#templetUpdateTime' }, | 
|                 { field: 'UpdateUserName', title: '关单人', align: 'center', width: 165 }, | 
|   | 
|                 { field: 'caozuo', title: '操作', fixed: 'right', width: 270, align: 'center', toolbar: '#InspectionRequestList', "disabled": true } | 
|             ]]; | 
|             var TotalColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码 | 
|             //#endregion | 
|             function bindInspectionRequest() { | 
|                 //#region 自定义表头 | 
|                 var colsJson | 
|                 var param1 = { | 
|                     Href: 'BllQuality/GetInspectionRequest' | 
|                 }; | 
|                 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 = { | 
|                         QcNo: $("#QcNo").val(), | 
|                         ASNNo: $("#ASNNo").val(), | 
|                         SkuNo: $("#SkuNo").val(), | 
|                         SkuName: $("#SkuName").val(), | 
|                         Status: $("#Status").val(), | 
|                         LotNo: $("#LotNo").val(), | 
|                         SupplierLot: $("#SupplierLot").val(), | 
|                         StartTime: $("#StartTime").val(), | 
|                         EndTime: $("#EndTime").val() | 
|                     }; | 
|                     table.render({ | 
|                         id: 'InspectionRequest', | 
|                         elem: '#InspectionRequest', | 
|                         height: h1, | 
|                         url: IP + "/BllQuality/GetInspectionRequest", | 
|                         method: 'post', | 
|                         contentType: 'application/json', | 
|                         headers: { ToKen: $.cookie('token') }, | 
|                         where: param, | 
|                         page: true, | 
|                         even: true, | 
|                         limit: pageCnt,     // 默认多少页 | 
|                         limits: pageLimits,    // 默认数组[10,20,30,40,50] | 
|                         cellMinWidth: 60,   // 全局定义常规单元格的最小宽度,layui 2.2.1 新增 | 
|                         done: function () { | 
|                             setRight() | 
|                             //自定义列宽 | 
|                             SetTableColW('InspectionRequest', 'BllQuality/GetInspectionRequest', TotalColsSysArr); | 
|                         }, | 
|                         cols: colsJson | 
|                     }); | 
|                 }); | 
|                 //#endregion | 
|   | 
|                 var aaa = $(".layui-table-body.layui-table-main tr"); | 
|   | 
|             } | 
|   | 
|             // 添加按钮权限 | 
|             function setRight() { | 
|                 $(function () { | 
|                     $(".shangClass").hide(); | 
|                     $(".chaClass").hide(); | 
|                     $(".addClass").hide(); | 
|                     $(".editClass").hide(); | 
|                     $(".delClass").hide(); | 
|                     $(".clossClass").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 () { | 
|                                     $(".shangClass").show(); | 
|                                 }); | 
|                             } | 
|                             if (res.data[k].MenuName == "查看") { | 
|                                 $(function () { | 
|                                     $(".chaClass").show(); | 
|                                 }); | 
|                             } | 
|                             if (res.data[k].MenuName == "请验") { | 
|                                 $(function () { | 
|                                     $(".addClass").show(); | 
|                                 }); | 
|                             } | 
|                             if (res.data[k].MenuName == "出库") { | 
|                                 $(function () { | 
|                                     $(".editClass").show(); | 
|                                 }); | 
|                             } | 
|                             if (res.data[k].MenuName == "删除") { | 
|                                 $(function () { | 
|                                     $(".delClass").show(); | 
|                                 }); | 
|                             } | 
|   | 
|                             if (res.data[k].MenuName == "完成") { | 
|                                 $(function () { | 
|                                     $(".clossClass").show(); | 
|                                 }); | 
|                             } | 
|                         } | 
|                     } else { //不成功 | 
|                         layer.msg('获取权限信息失败', { | 
|                             icon: 2, | 
|                             time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                         }, function () { }); | 
|                     } | 
|                 }); | 
|             } | 
|             var isChongFu = true; | 
|             // 总表按钮单击事件 | 
|             table.on('tool(InspectionRequest)', function (obj) { | 
|                 var data = obj.data; | 
|                 switch (obj.event) { | 
|                     case "upImage": | 
|                         layer.open({ | 
|                             type: 1, | 
|                             title: '上传图片', | 
|                             content: $('#UploadImageView'), | 
|                             maxmin: true, | 
|                             area: ['350px', '215px'], | 
|                             btn: ['确定'], | 
|                             success: function (index, layero) { | 
|                                 upload.render({ | 
|                                     elem: '#uploadBtn', | 
|                                     url: IP + '/BllQuality/UploadImage', | 
|                                     accept: 'images', | 
|                                     exts: 'jpg|png|gif', | 
|                                     multiple: false, | 
|                                     size: 1024 * 5, // 5MB | 
|                                     auto: false, | 
|                                     bindAction: '#upload', | 
|                                     headers: { ToKen: $.cookie('token') }, | 
|                                     xhrFields: { | 
|                                         withCredentials: true // 携带cookie | 
|                                     }, | 
|                                     before: function () { | 
|                                         this.data = { | 
|                                             qualityId: data.Id | 
|                                         }; | 
|                                         layer.load(1, { shade: [0.5, '#000'] }); | 
|                                     }, | 
|                                     done: function (res) { | 
|                                         layer.closeAll('loading'); | 
|                                         if (res.code == 0) { | 
|                                             layer.msg('上传成功', { icon: 1 }); | 
|                                             // 上传成功后的回调,如刷新表格等 | 
|                                             // table.reload('LAY-app-content-list'); | 
|                                         } else { | 
|                                             layer.msg(res.msg || '上传失败', { icon: 2 }); | 
|                                         } | 
|                                     }, | 
|                                     error: function () { | 
|                                         layer.closeAll('loading'); | 
|                                         layer.msg('上传失败', { icon: 2 }); | 
|                                     } | 
|                                 }); | 
|                             } | 
|                         }); | 
|                         break; | 
|                     case "ViewImage": | 
|                         layer.open({ | 
|                             type: 1, | 
|                             title: '查看图片', | 
|                             content: $('#ImagesShowView'), | 
|                             maxmin: true, | 
|                             area: ['650px', '315px'], | 
|                             btn: ['确定'], | 
|                             success: function (index, layero) { | 
|                                 getImage(data.Id); | 
|                             } | 
|                         }); | 
|                         break; | 
|                     case "add": | 
|                         layer.confirm('确定要发起请验?', function (index) { | 
|                             var param = { | 
|                                 Id: data.id, | 
|                                 Code: data.QcNo, | 
|                             }; | 
|                             sendData(IP + "/UpApi/SendInspectionRequest", param, 'post', function (res) { | 
|                                 if (res.Success == "0") { //成功 | 
|                                     layer.msg(res.Message, { | 
|                                         icon: 1, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { | 
|                                         bindInspectionRequest(); | 
|                                     }); | 
|                                 } else { //不成功 | 
|                                     layer.msg(res.Message, { | 
|                                         icon: 2, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }); | 
|                                 } | 
|                             }); | 
|                         }); | 
|                         break; | 
|                     case "del": | 
|                         layer.confirm('确定删除此条信息吗?', function (index) { | 
|                             var param = { | 
|                                 Code: data.QcNo, | 
|                             }; | 
|                             sendData(IP + "/BllQuality/DelInspectionRequest", param, 'post', function (res) { | 
|                                 if (res.code == 0) { //成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 1, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { | 
|                                         bindInspectionRequest(); | 
|                                     }); | 
|                                 } else { //不成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 2, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }); | 
|                                 } | 
|                             }); | 
|                         }); | 
|                         break; | 
|                     case "edit": | 
|                         $("#PickingArea").val('') | 
|                         form.render('select'); | 
|                         layer.open({ | 
|                             type: 1, | 
|                             title: '确认出库口', | 
|                             content: $('#divPickingArea'), | 
|                             maxmin: true, | 
|                             area: ['350px', '285px'], | 
|                             btn: ['确定', '取消'], | 
|                             yes: function (index, layero) { | 
|                                 var pa = $('#PickingArea').val(); | 
|                                 if (isChongFu == true) { | 
|                                     isChongFu = false; | 
|                                     if (pa == null) { | 
|                                         layer.msg("请勿重复点击", { | 
|                                             icon: 2, | 
|                                             time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                         }); | 
|                                         return; | 
|                                     } | 
|                                     if ($("#PickingArea").val() == '') { | 
|                                         layer.msg("请选择出库口", { | 
|                                             icon: 2, | 
|                                             time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                         }); | 
|                                         isChongFu = true; | 
|                                         return; | 
|                                     } | 
|                                     var param = { | 
|                                         Id: data.Id, | 
|                                         Code: pa, | 
|                                     }; | 
|                                     sendData(IP + "/BllQuality/OutWhInspectionRequest", param, 'post', function (res) { | 
|                                         if (res.code == 0) { //成功 | 
|                                             layer.msg(res.msg, { | 
|                                                 icon: 1, | 
|                                                 time: 3000 //1秒关闭(如果不配置,默认是3秒) | 
|                                             }, function () { | 
|                                                 bindInspectionRequest(); | 
|                                                 isChongFu = true; | 
|                                             }); | 
|                                         } else { //不成功 | 
|                                             layer.msg(res.msg, { | 
|                                                 icon: 2, | 
|                                                 time: 3000 //2秒关闭(如果不配置,默认是3秒) | 
|                                             }, function () { | 
|                                                 isChongFu = true; | 
|                                             }); | 
|                                         } | 
|                                         layer.close(index); | 
|                                     }); | 
|                                 } else { | 
|                                     layer.msg("请勿重复点击", { | 
|                                         icon: 2, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }); | 
|                                 } | 
|                             } | 
|                         }); | 
|                         break; | 
|                     case "closs": | 
|                         layer.confirm('是否完成物料请验', function (index) { | 
|                             var param = { | 
|                                 Code: data.QcNo, | 
|                             }; | 
|                             sendData(IP + "/BllQuality/ClossInspectionRequest", param, 'post', function (res) { | 
|                                 if (res.code == 0) { //成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 1, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { | 
|                                         bindInspectionRequest(); | 
|                                     }); | 
|                                 } else { //不成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 2, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }); | 
|                                 } | 
|                             }); | 
|                         }); | 
|                         break; | 
|                     default: break; | 
|                 } | 
|             }); | 
|   | 
|             function getImage(id) { | 
|                 var param = { | 
|                     Id: id | 
|                 } | 
|                 sendData(IP + "/BllQuality/GetImage", param, 'post', function (res) { | 
|                     if (res.code == 0) { //成功 | 
|                         $("#ImagesShow").html(''); | 
|                         res.data.forEach(function (item) { | 
|                             $("#ImagesShow").append('<div>' + | 
|                                 '<a href=' + item + ' target="_blank" class="image-item"><img src="' + item + '"  /></a>' + | 
|                                 '<button class="layui-btn layui-btn-primary layui-btn-sm delete-btn" data-type="customCols" data_Url=' + item + ' >删除</button>' + | 
|                                 '</div>'); | 
|                         }) | 
|                         $('.delete-btn').on('click', function () { | 
|                             var item = $(this); | 
|                             var QualityId = id; | 
|                             var imageUrl = item.attr('data_Url'); | 
|                             layer.confirm('确定删除吗?', function (index) { | 
|                                 var param = { | 
|                                     QualityId: QualityId, | 
|                                     ImageUrl: imageUrl | 
|                                 } | 
|                                 sendData(IP + "/BllQuality/DeleteImage", param, 'post', function (res) { | 
|                                     if (res.code == 0) { //成功 | 
|                                         layer.msg(res.msg, { | 
|                                             icon: 1, | 
|                                             time: 1000 //2秒关闭(如果不配置,默认是3秒) | 
|                                         }, function () { | 
|                                             getImage(id); | 
|                                         }); | 
|                                     } else { | 
|                                         layer.msg(res.msg, { | 
|                                             icon: 2, | 
|                                             time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                         }); | 
|                                     } | 
|                                 }); | 
|                             }) | 
|                         }); | 
|                     } else { //不成功 | 
|                         $("#ImagesShow").html(''); | 
|                         res.msg, { | 
|                             icon: 2, | 
|                             time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                         } | 
|                     } | 
|                 }) | 
|             } | 
|   | 
|             // 取样明细单机事件 | 
|             table.on('tool(SamplingDetails)', function (obj) { | 
|                 var data = obj.data; | 
|                 switch (obj.event) { | 
|                     case "delete": | 
|                         // 取样信息不可撤销,此函数暂不开放 | 
|                         layer.confirm('是否删除取样', function (index) { | 
|                             var param = { | 
|                                 QcNo: parseInt(data.QcNo), | 
|                             }; | 
|                             sendData(IP + "/BllQuality/DelSamplingDetails", param, 'post', function (res) { | 
|                                 if (res.code == 0) { //成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 1, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }, function () { | 
|                                         bindInspectionRequest(); | 
|                                     }); | 
|                                 } else { //不成功 | 
|                                     layer.msg(res.msg, { | 
|                                         icon: 2, | 
|                                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                     }); | 
|                                 } | 
|                             }); | 
|                         }); | 
|                         break; | 
|                     default: break; | 
|                 } | 
|             }) | 
|   | 
|   | 
|             // 渲染明细表 | 
|             //#region 自定义表头 | 
|             var DetailColsArr = [[ | 
|                 { field: '', title: '序号', type: 'numbers', width: 60, align: 'center', fixed: 'left', "disabled": true }, | 
|                 { field: 'QcNo', title: '请验编号', align: 'center', width: 180, "disabled": true }, | 
|                 { field: 'ASNNo', title: '入库单号', align: 'center', width: 180, "disabled": true }, | 
|                 { field: 'SkuNo', title: '物料编码', align: 'center', with: 100 }, | 
|                 { field: 'SkuName', title: '物料名称', align: 'center', width: 100 }, | 
|                 { field: 'Standard', title: '规格', align: 'center', width: 100 }, | 
|                 { field: 'LotNo', title: '批次号', align: 'center', width: 100 }, | 
|                 { field: 'SupplierLot', title: '供货批次', align: 'center', width: 100 }, | 
|                 { field: 'PalletNo', title: '托盘号', align: 'center', width: 120 }, | 
|                 { field: 'BoxNo', title: '箱号', align: 'center', width: 220 }, | 
|                 { field: 'BoxNo2', title: '盒号', align: 'center', width: 220 }, | 
|                 { field: 'BoxNo3', title: '支号', align: 'center', width: 220 }, | 
|                 { field: 'CompleteQty', title: '取样数量', align: 'center', width: 105, }, | 
|                 // { field: 'UDF1', title: '自定义1', align: 'center', width: 100 }, | 
|                 // { field: 'UDF2', title: '自定义2', align: 'center', width: 100 }, | 
|                 // { field: 'UDF3', title: '自定义3', align: 'center', width: 100 }, | 
|                 // { field: 'UDF4', title: '自定义4', align: 'center', width: 100 }, | 
|                 // { field: 'UDF5', title: '自定义5', align: 'center', width: 100 }, | 
|   | 
|                 { field: 'CreateTime', title: '取样日期', align: 'center', width: 165, templet: '#templetCreateTime' }, | 
|                 { field: 'CreateUserName', title: '取样人', align: 'center', width: 165 }, | 
|                 { field: 'UpdateTime', title: '更新日期', align: 'center', width: 165, templet: '#templetUpdateTime' }, | 
|                 { field: 'UpdateUserName', title: '更新人', align: 'center', width: 165 }, | 
|   | 
|                 //{ field: 'caozuo', title: '操作', fixed: 'right', width: 80, align: 'center', toolbar: '#SamplingDetailsList', "disabled": true } | 
|             ]]; | 
|             var DetailColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(DetailColsArr)))//将表头数据进行url编码 | 
|             //#endregion | 
|             function bindSamplingDetails(QcNoStr) { | 
|                 //#region 自定义表头 | 
|                 var colsJson2 | 
|                 var param1 = { | 
|                     Href: 'BllQuality/GetSamplingDetails' | 
|                 }; | 
|                 sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function (res) { | 
|                     if (res.code == 0) { | 
|                         if (res.data == '' || res.data == undefined || res.data == null) { | 
|                             colsJson2 = DetailColsArr | 
|                         } else { | 
|                             colsJson2 = eval(res.data); | 
|                         } | 
|                     } else { | 
|                         colsJson2 = DetailColsArr | 
|                     } | 
|                     var param = { | 
|                         QcNo: QcNoStr, | 
|                         ASNNo: $("#ASNNo").val(), | 
|                         SkuNo: $("#SkuNo").val(), | 
|                         SkuName: $("#SkuName").val(), | 
|                         Status: $("#Status").val(), | 
|                         LotNo: $("#LotNo").val(), | 
|                         SupplierLot: $("#SupplierLot").val(), | 
|                         StartTime: $("#StartTime").val(), | 
|                         EndTime: $("#EndTime").val() | 
|                     }; | 
|                     table.render({ | 
|                         id: 'SamplingDetails', | 
|                         elem: '#SamplingDetails', | 
|                         height: h1, | 
|                         url: IP + "/BllQuality/GetSamplingDetails", | 
|                         method: 'post', | 
|                         contentType: 'application/json', | 
|                         headers: { ToKen: $.cookie('token') }, | 
|                         where: param, | 
|                         page: true, | 
|                         limit: pageCnt,                  // 默认多少页 | 
|                         limits: pageLimits,                // 默认数组[10,20,30,40,50] | 
|                         cellMinWidth: 60,                 // 全局定义常规单元格的最小宽度,layui 2.2.1 新增 | 
|                         even: true, | 
|                         done: function () { | 
|                             // 添加按钮权限 | 
|                             setRight() | 
|                             //自定义列宽 | 
|                             SetTableColW('SamplingDetails', 'BllQuality/GetSamplingDetails', DetailColsSysArr); | 
|                         }, | 
|                         cols: colsJson2 | 
|                     }); | 
|                 }); | 
|                 //#endregion | 
|             } | 
|   | 
|             // 页面监控,点击查询加载入库总单 | 
|             form.on('submit(LAY-app-contlist-search)', function (data) { | 
|   | 
|                 if (yemianid == 0) { | 
|                     bindInspectionRequest(); | 
|                 } else if (yemianid == 1) { | 
|                     bindSamplingDetails(quanSkuNo); | 
|                 } | 
|             }); | 
|   | 
|             //触发行双击事件 | 
|             table.on('rowDouble(InspectionRequest)', function (obj) { | 
|                 $(".layui-tab-title>li").attr("class", ""); | 
|                 $('.layui-tab-title>li').eq(1).attr('class', 'layui-this'); | 
|                 $('.layui-tab-content .layui-tab-item').attr('class', 'layui-tab-item') | 
|                 $('.layui-tab-content .layui-tab-item').eq(1).attr('class', 'layui-tab-item layui-show') | 
|   | 
|                 quanSkuNo = obj.data.QcNo; | 
|                 bindSamplingDetails(obj.data.QcNo); | 
|                 yemianid = 1; | 
|             }); | 
|             var active = { | 
|                 //#region 自定义表头 | 
|                 customCols: function () { | 
|                     layer.open({ | 
|                         type: 2, | 
|                         title: '自定义列', | 
|                         content: '../SystemSettings/HeaderSetting.html?Href=BllQuality/GetInspectionRequest&ColsSysArr=' + TotalColsSysArr, | 
|                         maxmin: false, | 
|                         resize: false, | 
|                         area: ['970px', '650px'] | 
|                     }); | 
|                 }, | 
|                 customCols2: function () { | 
|                     layer.open({ | 
|                         type: 2, | 
|                         title: '自定义列', | 
|                         content: '../SystemSettings/HeaderSetting.html?Href=BllQuality/GetSamplingDetails&ColsSysArr=' + DetailColsSysArr, | 
|                         maxmin: false, | 
|                         resize: false, | 
|                         area: ['970px', '650px'] | 
|                     }); | 
|                 } | 
|                 //#endregion | 
|             }; | 
|             $(".layui-btn").on("click", function () { | 
|                 var type = $(this).data("type"); | 
|                 active[type] ? active[type].call(this) : ""; | 
|             }); | 
|             var doing = true; | 
|   | 
|             //监听Tab切换,以改变地址hash值 | 
|             element.on('tab(docDemoTabBrief)', function (data) { | 
|                 yemianid = data.index | 
|                 if (yemianid == 0) { | 
|                     bindInspectionRequest(); | 
|                 } else if (yemianid == 1) { | 
|                     bindSamplingDetails(quanSkuNo); | 
|                 } | 
|             }); | 
|   | 
|         }); | 
|     </script> | 
|   | 
| </body> | 
|   | 
| </html> |