|  |  | 
 |  |  | var matCodeLayerIdx; | 
 |  |  | var data = []; | 
 |  |  | var checkStatus = []; | 
 |  |  | var dataCheck = []; | 
 |  |  | var admin; | 
 |  |  | function getCol() { | 
 |  |  |     var cols = [ | 
 |  |  |         {field: 'id', title: 'id', align: 'center',hide:true} | 
 |  |  |         ,{type: 'checkbox'} | 
 |  |  |         ,{field: 'pakinTime', title: '入库时间', align: 'center'} | 
 |  |  |         ,{field: 'batch', align: 'center',title: '批号'} | 
 |  |  |         ,{field: 'packageNo', align: 'center',title: '包号'} | 
 |  |  |         ,{field: 'brand', align: 'center',title: '牌号'} | 
 |  |  |         ,{field: 'weight', align: 'center',title: '重量(KG)', hide:true} | 
 |  |  |         ,{field: 'workshop', align: 'center',title: '生产车间', hide:true} | 
 |  |  |         ,{field: 'line', align: 'center',title: '生产线', hide:true} | 
 |  |  |         ,{field: 'packageType', align: 'center',title: '包装类型', hide:true} | 
 |  |  |         ,{field: 'zpalletType', align: 'center',title: '托盘类型', hide:true} | 
 |  |  |         ,{field: 'fingerMelting', align: 'center',title: '熔指(g/10min)'} | 
 |  |  |         ,{field: 'fusingPoint', align: 'center',title: '熔点(℃)'} | 
 |  |  |         ,{field: 'vadf1', align: 'center',title: '挥发份1(%)', hide:true} | 
 |  |  |         ,{field: 'vadf2', align: 'center',title: '挥发份2(%)', hide:true} | 
 |  |  |         ,{field: 'yellowness', align: 'center',title: '黄度',  hide:true} | 
 |  |  |         ,{field: 'opacity', align: 'center',title: '不透明度(0-100%)', hide:true} | 
 |  |  |         ,{field: 'water', align: 'center',title: '水分(ppm)', hide:true} | 
 |  |  |         ,{field: 'l', align: 'center',title: 'l值', edit: true} | 
 |  |  |         ,{field: 'a', align: 'center',title: 'a值', edit: true} | 
 |  |  |         ,{field: 'b', align: 'center',title: 'b值', edit: true} | 
 |  |  |         ,{field: 'fillIn', align: 'center',title: '填充(%)', edit: true} | 
 |  |  |         ,{field: 'massState', align: 'center',title: '质量状态', hide:true} | 
 |  |  |         ,{field: 'problem', align: 'center',title: '质量问题', hide:true} | 
 |  |  |         ,{field: 'stash', align: 'center',title: '仓库', edit:true} | 
 |  |  |         ,{field: 'locNo', align: 'center',title: '库位', edit:true} | 
 |  |  |         ,{field: 'weightAnfme', align: 'center',title: '剩余重量(KG)', edit:true} | 
 |  |  |         ,{field: 'status', align: 'center',title: '状态', edit:true} | 
 |  |  |         ,{field: 'createUser', align: 'center',title: '单号', edit:true} | 
 |  |  |         ,{field: 'createUser', align: 'center',title: '出库时间', edit:true} | 
 |  |  |         ,{field: 'createUser', align: 'center',title: '重量', edit:true} | 
 |  |  |         ,{field: 'createUser', align: 'center',title: '经办人', edit:true} | 
 |  |  |         ,{field: 'createUser', align: 'center',title: '流转形式', edit:true} | 
 |  |  |         ,{field: 'createUser', align: 'center',title: '客户名称', edit:true} | 
 |  |  |         ,{field: 'createUser', align: 'center',title: '调拨到', edit:true} | 
 |  |  |         ,{field: 'createUser', align: 'center',title: '备注', edit:true} | 
 |  |  |         ,{field: 'pakinTime$', title: '入库时间', align: 'center'} | 
 |  |  |         ,{field: 'owner', align: 'center',title: '主体',edit:true} | 
 |  |  |         ,{field: 'type', align: 'center',title: '物资类别',hide:true,edit:true} | 
 |  |  |         ,{field: 'proOrderNo', align: 'center',title: '单号',hide:true,edit:true} | 
 |  |  |         ,{field: 'matnr', align: 'center',title: '存货编码',hide:true,edit:true} | 
 |  |  |         ,{field: 'batch', align: 'center',title: '批号',edit:true} | 
 |  |  |         ,{field: 'packageNo', align: 'center',title: '包号',edit:true} | 
 |  |  |         ,{field: 'brand', align: 'center',title: '牌号',edit:true} | 
 |  |  |         ,{field: 'weight', align: 'center',title: '重量(KG)',edit:true} | 
 |  |  |         ,{field: 'workshop', align: 'center',title: '生产车间',hide:true,edit:true} | 
 |  |  |         ,{field: 'line', align: 'center',title: '生产线',hide:true,edit:true} | 
 |  |  |         ,{field: 'proDate', align: 'center',title: '生产日期',edit:true} | 
 |  |  |         ,{field: 'packageType', align: 'center',title: '包装类型',edit:true} | 
 |  |  |         ,{field: 'zpalletType', align: 'center',title: '托盘类型',edit:true} | 
 |  |  |         ,{field: 'filmWrap', align: 'center',title: '缠膜',edit:true} | 
 |  |  |         ,{field: 'fingerMelting', align: 'center',title: '熔指(g/10min)',edit:true} | 
 |  |  |         ,{field: 'fusingPoint', align: 'center',title: '熔点(℃)',edit:true} | 
 |  |  |         ,{field: 'vadf1', align: 'center',title: '挥发份1(%)', hide:true,edit:true} | 
 |  |  |         ,{field: 'vadf2', align: 'center',title: '挥发份2(%)', hide:true,edit:true} | 
 |  |  |         ,{field: 'yellowness', align: 'center',title: '黄度',edit:true} | 
 |  |  |         ,{field: 'opacity', align: 'center',title: '不透明度(0-100%)',edit:true} | 
 |  |  |         ,{field: 'water', align: 'center',title: '水分(ppm)', hide:true,edit:true} | 
 |  |  |         ,{field: 'l', align: 'center',title: 'l值', hide:true,edit:true} | 
 |  |  |         ,{field: 'a', align: 'center',title: 'a值', hide:true,edit:true} | 
 |  |  |         ,{field: 'b', align: 'center',title: 'b值', hide:true,edit:true} | 
 |  |  |         ,{field: 'fillIn', align: 'center',title: '填充(%)',hide:true,edit:true} | 
 |  |  |         ,{field: 'str1', align: 'center',title: '拉伸强度MPa',hide:true,edit:true} | 
 |  |  |         ,{field: 'str2', align: 'center',title: '断裂伸长率%',hide:true,edit:true} | 
 |  |  |         ,{field: 'str3', align: 'center',title: '缺口冲击KJ/m2',hide:true,edit:true} | 
 |  |  |         ,{field: 'str4', align: 'center',title: '维卡℃',hide:true,edit:true} | 
 |  |  |         ,{field: 'str5', align: 'center',title: '半结晶时间min',hide:true,edit:true} | 
 |  |  |         ,{field: 'str6', align: 'center',title: '结晶度%',hide:true,edit:true} | 
 |  |  |         ,{field: 'massState', align: 'center',title: '质量状态',edit:true} | 
 |  |  |         ,{field: 'problem', align: 'center',title: '备注',edit:true} | 
 |  |  |         ,{field: 'stash', align: 'center',title: '仓库',edit:true} | 
 |  |  |         ,{field: 'locNo', align: 'center',title: '库位',edit:true} | 
 |  |  |         ,{field: 'weightAnfme', align: 'center',title: '剩余重量(KG)',edit:true} | 
 |  |  |         ,{field: 'qtyAnfme', align: 'center',title: '待出库重量(KG)',hide:true} | 
 |  |  |         ,{field: 'status', align: 'center',title: '状态', templet: setState ,edit:true} | 
 |  |  |         ,{align: 'center', title: '流转明细', toolbar: '#tbLook'} | 
 |  |  |         ,{field: 'orderNo', align: 'center',title: '单号', hide:true} | 
 |  |  |         ,{field: 'pakoutTime', align: 'center',title: '出库时间', hide:true} | 
 |  |  |         ,{field: 'orderWeight', align: 'center',title: '重量', hide:true} | 
 |  |  |         ,{field: 'handlerBy', align: 'center',title: '经办人', hide:true} | 
 |  |  |         ,{field: 'transfer', align: 'center',title: '流转形式', hide:true} | 
 |  |  |         ,{field: 'customer', align: 'center',title: '客户名称', hide:true} | 
 |  |  |         ,{field: 'allocate', align: 'center',title: '调拨到', hide:true} | 
 |  |  |         ,{field: 'memo', align: 'center',title: '备注', hide:true} | 
 |  |  |     ]; | 
 |  |  |     return cols; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function setState(data){ | 
 |  |  |     if(data.status === "待入库"){ | 
 |  |  |         return  "<span style='color: orange'>待入库</span>" | 
 |  |  |     }else if(data.status === "已入库"){ | 
 |  |  |         return  "<span style='color: blue'>已入库</span>" | 
 |  |  |     }else if(data.status === "待出库"){ | 
 |  |  |         return  "<span style='color: red'>待出库</span>" | 
 |  |  |     }else if(data.status === "部分出库"){ | 
 |  |  |         return  "<span style='color: black'>部分出库</span>" | 
 |  |  |     }else if(data.status === "全部出库"){ | 
 |  |  |         return  "<span style='color: gray'>全部出库</span>" | 
 |  |  |     }else if(data.status === "暂入库"){ | 
 |  |  |         return  "<span style='color: purple'>暂入库</span>" | 
 |  |  |     } | 
 |  |  | } | 
 |  |  |  | 
 |  |  | layui.config({ | 
 |  |  |     base: baseUrl + "/static/layui/lay/modules/" | 
 |  |  | }).use(['table','laydate', 'form', 'admin'], function() { | 
 |  |  | }).extend({ | 
 |  |  |     dropdown: 'dropdown/dropdown', | 
 |  |  | }).use(['table','laydate', 'form', 'admin', 'dropdown'], function() { | 
 |  |  |     var table = layui.table; | 
 |  |  |     var $ = layui.jquery; | 
 |  |  |     var layer = layui.layer; | 
 |  |  |     var layDate = layui.laydate; | 
 |  |  |     var form = layui.form; | 
 |  |  |     var admin = layui.admin; | 
 |  |  |     admin = layui.admin; | 
 |  |  |  | 
 |  |  |     // 数据渲染 | 
 |  |  |     tableIns = table.render({ | 
 |  |  |         elem: '#plaDetl', | 
 |  |  |         headers: {token: localStorage.getItem('token')}, | 
 |  |  |         url: baseUrl+'/pla/list/auth?step=3', | 
 |  |  |         url: baseUrl+'/pla/list/auth?step=2', | 
 |  |  |         page: true, | 
 |  |  |         limit: 16, | 
 |  |  |         limits: [16, 30, 50, 100, 200, 500], | 
 |  |  | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     table.on('tool(plaDetl)', function (obj) { | 
 |  |  |         var data = obj.data; | 
 |  |  |         var layEvent = obj.event; | 
 |  |  |         if (layEvent === 'look') { | 
 |  |  |             var $a = $(obj.tr).find('a[lay-event="look"]'); | 
 |  |  |             var offset = $a.offset(); | 
 |  |  |             var top = offset.top; | 
 |  |  |             var left = offset.left; | 
 |  |  |             layer.open({ | 
 |  |  |                 type: 1, | 
 |  |  |                 title: false, | 
 |  |  |                 area: '1200px', | 
 |  |  |                 offset: ['600px', (left - 1200 + $a.outerWidth()) + 'px'], | 
 |  |  |                 shade: .01, | 
 |  |  |                 shadeClose: true, | 
 |  |  |                 fixed: false, | 
 |  |  |                 content: '<table id="lookSSXMTable" lay-filter="lookSSXMTable"></table>', | 
 |  |  |                 success: function (layero) { | 
 |  |  |                     table.render({ | 
 |  |  |                         elem: '#lookSSXMTable', | 
 |  |  |                         headers: {token: localStorage.getItem('token')}, | 
 |  |  |                         url: baseUrl+'/plaQty/list/auth', | 
 |  |  |                         where: { | 
 |  |  |                             batch: data.batch, | 
 |  |  |                             package_no: data.packageNo | 
 |  |  |                         }, | 
 |  |  |                         page: true, | 
 |  |  |                         cellMinWidth: 100, | 
 |  |  |                         cols: [[ | 
 |  |  |                             {type: 'numbers'}, | 
 |  |  |                             {field: 'orderNo', title: '单号'}, | 
 |  |  |                             {field: 'pakoutTime', title: '出库时间'}, | 
 |  |  |                             {field: 'orderWeight', title: '重量'}, | 
 |  |  |                             {field: 'handlerBy', title: '经办人'}, | 
 |  |  |                             {field: 'transfer', title: '流转形式'}, | 
 |  |  |                             {field: 'customer', title: '客户名称'}, | 
 |  |  |                             {field: 'allocate', title: '调拨到'}, | 
 |  |  |                             {field: 'memo', title: '备注'}, | 
 |  |  |                         ]], | 
 |  |  |                         request: { | 
 |  |  |                             pageName: 'curr', | 
 |  |  |                             pageSize: 'limit' | 
 |  |  |                         }, | 
 |  |  |                         parseData: function (res) { | 
 |  |  |                             return { | 
 |  |  |                                 'code': res.code, | 
 |  |  |                                 'msg': res.msg, | 
 |  |  |                                 'count': res.data.total, | 
 |  |  |                                 'data': res.data.records | 
 |  |  |                             } | 
 |  |  |                         }, | 
 |  |  |                         response: { | 
 |  |  |                             statusCode: 200 | 
 |  |  |                         }, | 
 |  |  |                         done: function () { | 
 |  |  |                             $(layero).find('.layui-table-view').css('margin', '0'); | 
 |  |  |                         }, | 
 |  |  |                         size: '' | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     // 监听头工具栏事件 | 
 |  |  |     table.on('toolbar(plaDetl)', function (obj) { | 
 |  |  |         var checkStatus = table.checkStatus(obj.config.id) | 
 |  |  |         switch(obj.event) { | 
 |  |  |             case 'updateData': | 
 |  |  |                 var data = checkStatus.data; | 
 |  |  |                 if (data.length === 0){ | 
 |  |  |                     layer.msg('请选择数据'); | 
 |  |  |                 } else { | 
 |  |  |                     layer.confirm('确定修改'+(data.length===1?'此':data.length)+'条数据吗', function(){ | 
 |  |  |                         $.ajax({ | 
 |  |  |                             url: baseUrl+"/pla/update/auth", | 
 |  |  |                             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                             data: JSON.stringify(data), | 
 |  |  |                             contentType:'application/json;charset=UTF-8', | 
 |  |  |                             method: 'POST', | 
 |  |  |                             traditional:true, | 
 |  |  |                             success: function (res) { | 
 |  |  |                                 if (res.code === 200){ | 
 |  |  |                                     layer.closeAll(); | 
 |  |  |                                     tableReload(false); | 
 |  |  |                                 } else if (res.code === 403){ | 
 |  |  |                                     top.location.href = baseUrl+"/"; | 
 |  |  |                                 } else { | 
 |  |  |                                     layer.msg(res.msg) | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         }) | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |                 break; | 
 |  |  |             case "deleteData": | 
 |  |  |                 var data = checkStatus.data; | 
 |  |  |                 if (data.length === 0){ | 
 |  |  |                     layer.msg('请选择数据'); | 
 |  |  |                 } else { | 
 |  |  |                     layer.confirm('确定删除'+(data.length===1?'此':data.length)+'条数据吗', function(){ | 
 |  |  |                         $.ajax({ | 
 |  |  |                             url: baseUrl+"/pla/delete/auth", | 
 |  |  |                             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                             data: JSON.stringify(data), | 
 |  |  |                             contentType:'application/json;charset=UTF-8', | 
 |  |  |                             method: 'POST', | 
 |  |  |                             traditional:true, | 
 |  |  |                             success: function (res) { | 
 |  |  |                                 if (res.code === 200){ | 
 |  |  |                                     layer.closeAll(); | 
 |  |  |                                     tableReload(false); | 
 |  |  |                                 } else if (res.code === 403){ | 
 |  |  |                                     top.location.href = baseUrl+"/"; | 
 |  |  |                                 } else { | 
 |  |  |                                     layer.msg(res.msg) | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         }) | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |                 break; | 
 |  |  |             case "viladate": | 
 |  |  |                 var data = checkStatus.data; | 
 |  |  |                 if (data.length === 0){ | 
 |  |  |                     layer.msg('请选择数据'); | 
 |  |  |                 } else { | 
 |  |  |                     layer.confirm('确定校验'+(data.length===1?'此':data.length)+'条数据吗', function(){ | 
 |  |  |                         $.ajax({ | 
 |  |  |                             url: baseUrl+"/pla/viladate/auth", | 
 |  |  |                             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                             data: JSON.stringify(data), | 
 |  |  |                             contentType:'application/json;charset=UTF-8', | 
 |  |  |                             method: 'POST', | 
 |  |  |                             traditional:true, | 
 |  |  |                             success: function (res) { | 
 |  |  |                                 if (res.code === 200){ | 
 |  |  |                                     layer.closeAll(); | 
 |  |  |                                     tableReload(false); | 
 |  |  |                                 } else if (res.code === 403){ | 
 |  |  |                                     top.location.href = baseUrl+"/"; | 
 |  |  |                                 } else { | 
 |  |  |                                     layer.msg(res.msg) | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         }) | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |         } | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     // 搜索栏搜索事件 | 
 |  |  |     form.on('submit(search)', function (data) { | 
 |  |  |         pageCurr = 1; | 
 |  |  |         tableReload(false); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 重置事件 | 
 |  |  |     form.on('submit(reset)', function (data) { | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 重载表格 | 
 |  |  |     function tableReload() { | 
 |  |  |         tableIns.reload({data: matCodeData}); | 
 |  |  |     // function tableReload() { | 
 |  |  |     //     tableIns.reload({data: matCodeData}); | 
 |  |  |     // } | 
 |  |  |     function tableReload(child) { | 
 |  |  |         var searchData = { | 
 |  |  |         }; | 
 |  |  |         $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |             searchData[this.name] = this.value; | 
 |  |  |         }); | 
 |  |  |         (child ? parent.tableIns : tableIns).reload({ | 
 |  |  |             where: searchData, | 
 |  |  |             page: { | 
 |  |  |                 curr: pageCurr | 
 |  |  |             }, | 
 |  |  |             done: function (res, curr, count) { | 
 |  |  |                 if (res.code === 403) { | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 } | 
 |  |  |                 pageCurr=curr; | 
 |  |  |                 if (res.data.length === 0 && count !== 0) { | 
 |  |  |                     tableIns.reload({ | 
 |  |  |                         where: searchData, | 
 |  |  |                         page: { | 
 |  |  |                             curr: pageCurr-1 | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                     pageCurr -= 1; | 
 |  |  |                 } | 
 |  |  |                 limit(child); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |                     layer.msg("有未填写字段"); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 data[i].step = 3; | 
 |  |  |                 dataSave.push(data[i]); | 
 |  |  |             }else { | 
 |  |  |                 dataOld.push(data[i]); | 
 |  |  | 
 |  |  |         }) | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     $(document).on('click','#rework', function () { | 
 |  |  |         let data = table.cache.plaDetl; | 
 |  |  |         let dataSave = []; | 
 |  |  |         let dataOld = []; | 
 |  |  |         for(var i=0; i<data.length; i++){ | 
 |  |  |             if(data[i].LAY_CHECKED){ | 
 |  |  |                 dataSave.push(data[i]); | 
 |  |  |             }else { | 
 |  |  |                 dataOld.push(data[i]); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if(!dataSave || dataSave.length < 1){ | 
 |  |  |             layer.msg("未勾选,请先勾选需要重做的库存"); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         layer.confirm('确定重做选中的库存吗?', { | 
 |  |  |             shade: .1, | 
 |  |  |             skin: 'layui-layer-admin' | 
 |  |  |         }, function (i) { | 
 |  |  |             layer.close(i); | 
 |  |  |             $.ajax({ | 
 |  |  |                 url: baseUrl+"/pla/rework/auth", | 
 |  |  |                 headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                 data: JSON.stringify(dataSave), | 
 |  |  |                 contentType:'application/json;charset=UTF-8', | 
 |  |  |                 method: 'POST', | 
 |  |  |                 async: false, | 
 |  |  |                 success: function (res) { | 
 |  |  |                     if (res.code === 200){ | 
 |  |  |                         layer.msg("提交成功"); | 
 |  |  |                         table.reload('productionInfoTable',{ | 
 |  |  |                             data: dataOld | 
 |  |  |                         }) | 
 |  |  |                     } else if (res.code === 403){ | 
 |  |  |  | 
 |  |  |                     }else { | 
 |  |  |                         layer.msg(res.msg, {icon: 2}) | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             }) | 
 |  |  |         }) | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     $(document).on('click','#updateZpallet', function () { | 
 |  |  |         let data = table.cache.plaDetl; | 
 |  |  |         let dataSave = []; | 
 |  |  |         let dataOld = []; | 
 |  |  |         for(var i=0; i<data.length; i++){ | 
 |  |  |             if(data[i].LAY_CHECKED){ | 
 |  |  |                 data[i].step = 1; | 
 |  |  |                 dataSave.push(data[i]); | 
 |  |  |             }else { | 
 |  |  |                 dataOld.push(data[i]); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         dataCheck = dataSave; | 
 |  |  |  | 
 |  |  |         if(!dataSave || dataSave.length < 1){ | 
 |  |  |             layer.msg("未勾选,请先勾选需要更改的库存"); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         layer.open({ | 
 |  |  |             type: 2, | 
 |  |  |             title: '换包装/托盘/缠膜', | 
 |  |  |             maxmin: true, | 
 |  |  |             area: ['500px', top.detailHeight], | 
 |  |  |             shadeClose: false, | 
 |  |  |             content: 'update.html', | 
 |  |  |             success: function(layero, index){ | 
 |  |  |                 layer.getChildFrame('#data-detail-submit-edit', index).hide(); | 
 |  |  |                 top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false); | 
 |  |  |                 layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |  | 
 |  |  |                 var iframe = window['layui-layer-iframe' + index]; | 
 |  |  |                 iframe.child(dataSave) | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     $(document).on('click','#sellout', function () { | 
 |  |  |  | 
 |  |  |         var data = table.cache.plaDetl; | 
 |  |  |         var dataSave = []; | 
 |  |  |         var dataOld = []; | 
 |  |  |         var brand; | 
 |  |  |  | 
 |  |  |         for(var i=0; i<data.length; i++){ | 
 |  |  |             if(data[i].LAY_CHECKED){ | 
 |  |  |                 if(data[i].status === "待入库" || data[i].status === "全部出库"|| data[i].weightAnfme <= data[i].qtyAnfme){ | 
 |  |  |                     layer.msg("选中的明细还未入库或者已全部出库或者没有剩余可出重量,请重新选择"); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 brand = brand ? brand : data[i].brand; | 
 |  |  |  | 
 |  |  |                 if( brand != data[i].brand){ | 
 |  |  |                     layer.msg("选中的明细中含有多种牌号,请重新选择"); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 dataSave.push(data[i]); | 
 |  |  |             }else { | 
 |  |  |                 dataOld.push(data[i]); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         dataCheck = dataSave; | 
 |  |  |  | 
 |  |  |         if(!dataSave || dataSave.length < 1){ | 
 |  |  |             layer.msg("未勾选,请先勾选需要更改的库存"); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         layer.open({ | 
 |  |  |             type: 2, | 
 |  |  |             title: '出库', | 
 |  |  |             maxmin: true, | 
 |  |  |             area: ['800px', top.detailHeight], | 
 |  |  |             shadeClose: false, | 
 |  |  |             content: 'sellout.html', | 
 |  |  |             success: function(layero, index){ | 
 |  |  |                 //layer.getChildFrame('#data-detail-submit-edit', index).hide(); | 
 |  |  |                 top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false); | 
 |  |  |                 layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |  | 
 |  |  |                 var iframe = window['layui-layer-iframe' + index]; | 
 |  |  |                 iframe.child(dataSave) | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     $(document).on('click','#pickup', function () { | 
 |  |  |  | 
 |  |  |         let data = table.cache.plaDetl; | 
 |  |  |         let dataSave = []; | 
 |  |  |         let dataOld = []; | 
 |  |  |         for(var i=0; i<data.length; i++){ | 
 |  |  |             if(data[i].LAY_CHECKED){ | 
 |  |  |                 if(data[i].status === "待入库" || data[i].status === "全部出库"){ | 
 |  |  |                     layer.msg("选中的明细还未入库或者已全部出库,请重新选择"); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 dataSave.push(data[i]); | 
 |  |  |             }else { | 
 |  |  |                 dataOld.push(data[i]); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         dataCheck = dataSave; | 
 |  |  |  | 
 |  |  |         if(!dataSave || dataSave.length < 1){ | 
 |  |  |             layer.msg("未勾选,请先勾选需要更改的库存"); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         if(dataSave.length > 1){ | 
 |  |  |             layer.msg("请勾选一条库存明细"); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         layer.open({ | 
 |  |  |             type: 2, | 
 |  |  |             title: '卖出', | 
 |  |  |             maxmin: true, | 
 |  |  |             area: ['800px', top.detailHeight], | 
 |  |  |             shadeClose: false, | 
 |  |  |             content: 'pickup.html', | 
 |  |  |             success: function(layero, index){ | 
 |  |  |                 //layer.getChildFrame('#data-detail-submit-edit', index).hide(); | 
 |  |  |                 top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false); | 
 |  |  |                 layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |  | 
 |  |  |                 var iframe = window['layui-layer-iframe' + index]; | 
 |  |  |                 iframe.child(dataSave) | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     $(document).on('click','#returned', function () { | 
 |  |  |  | 
 |  |  |         layer.open({ | 
 |  |  |             type: 2, | 
 |  |  |             title: '退回', | 
 |  |  |             maxmin: true, | 
 |  |  |             area: ['800px', '800px'], | 
 |  |  |             shadeClose: false, | 
 |  |  |             content: 'returned.html', | 
 |  |  |             success: function(layero, index){ | 
 |  |  |                 layer.getChildFrame('#data-detail-submit-edit', index).hide(); | 
 |  |  |                 top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false); | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  | }) | 
 |  |  |  | 
 |  |  | // 关闭动作 | 
 |  |  | $(document).on('click','#data-detail-close', function () { | 
 |  |  |     parent.layer.closeAll(); | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | // excel导入模板下载 | 
 |  |  | function excelMouldDownload(){ | 
 |  |  |     layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |     location.href = baseUrl + "/pla/excel/import/mould"; | 
 |  |  |     layer.closeAll('loading'); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | // excel导入 | 
 |  |  | function importExcel() { | 
 |  |  |     $("#importExcel").trigger("click"); | 
 |  |  | } | 
 |  |  | function upload(obj){ | 
 |  |  |     if(!obj.files) { | 
 |  |  |         return; | 
 |  |  |     } | 
 |  |  |     var file = obj.files[0]; | 
 |  |  |     admin.confirm('确认同步 [' + file.name +'] 文件吗?', function (index) { | 
 |  |  |         layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |         var url = baseUrl + "/pla/excel/import/auth"; | 
 |  |  |         var form = new FormData(); | 
 |  |  |         form.append("file", file); | 
 |  |  |         xhr = new XMLHttpRequest(); | 
 |  |  |         xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。 | 
 |  |  |         xhr.setRequestHeader('token', localStorage.getItem('token')); | 
 |  |  |         xhr.onload = uploadComplete; //请求完成 | 
 |  |  |         xhr.onerror =  uploadFailed; //请求失败 | 
 |  |  |         xhr.onloadend = function () { // // 上传完成重置文件流 | 
 |  |  |             layer.closeAll('loading'); | 
 |  |  |             $("#importExcel").val(""); | 
 |  |  |         }; | 
 |  |  |         // xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】 | 
 |  |  |         xhr.upload.onloadstart = function(){//上传开始执行方法 | 
 |  |  |             ot = new Date().getTime();   //设置上传开始时间 | 
 |  |  |             oloaded = 0;//设置上传开始时,以上传的文件大小为0 | 
 |  |  |         }; | 
 |  |  |         xhr.send(form); | 
 |  |  |     }, function(index){ | 
 |  |  |         $("#importExcel").val(""); | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  | function uploadComplete(evt) { | 
 |  |  |     var res = JSON.parse(evt.target.responseText); | 
 |  |  |     if(res.code === 200) { | 
 |  |  |         layer.msg(res.msg, {icon: 1}); | 
 |  |  |         loadTree(""); | 
 |  |  |     } else { | 
 |  |  |         layer.msg(res.msg, {icon: 2}); | 
 |  |  |     } | 
 |  |  | } | 
 |  |  | function uploadFailed(evt) { | 
 |  |  |     var res = JSON.parse(evt.target.responseText); | 
 |  |  |     layer.msg(res.msg, {icon: 2}); | 
 |  |  | } | 
 |  |  |  | 
 |  |  |  |