|  |  |  | 
|---|
|  |  |  | var pageCurr; | 
|---|
|  |  |  | var type; | 
|---|
|  |  |  | layui.use(['table','laydate', 'form'], function(){ | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | 
|---|
|  |  |  | toolbar: '#toolbar', | 
|---|
|  |  |  | cellMinWidth: 50, | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | ,{field: 'ymd', align: 'center', title: '日期', sort: true} | 
|---|
|  |  |  | // {type: 'checkbox'} | 
|---|
|  |  |  | {field: 'ymd', align: 'center', title: '日期'} | 
|---|
|  |  |  | ,{field: 'source_sta_no', align: 'center',title: '站点'} | 
|---|
|  |  |  | ,{field: 'sto_qty', align: 'center',title: '入库次数'} | 
|---|
|  |  |  | ,{field: 'ret_qty', align: 'center',title: '出库次数'} | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | done: function(res, curr, count) { | 
|---|
|  |  |  | if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl; | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | pageCurr=curr; | 
|---|
|  |  |  | limit(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/report/viewInOutList/count", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | contentType:'application/json;charset=UTF-8', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | $("#countNumIn").text(res.data.in + '次'); | 
|---|
|  |  |  | $("#countNumOut").text(res.data.out + '次'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | done: function (res, curr, count) { | 
|---|
|  |  |  | if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl; | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | pageCurr=curr; | 
|---|
|  |  |  | limit(); | 
|---|
|  |  |  | 
|---|
|  |  |  | var checkStatus = table.checkStatus(obj.config.id); | 
|---|
|  |  |  | switch(obj.event) { | 
|---|
|  |  |  | case 'exportData': | 
|---|
|  |  |  | layer.confirm('确定导出Excel吗', function(){ | 
|---|
|  |  |  | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
|---|
|  |  |  | var titles=[]; | 
|---|
|  |  |  | var fields=[]; | 
|---|
|  |  |  | obj.config.cols[0].map(function (col) { | 
|---|
|  |  |  | 
|---|
|  |  |  | contentType:'application/json;charset=UTF-8', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | table.exportFile(titles,res.data,'xls'); | 
|---|
|  |  |  | } else if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl; | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | // 搜索栏搜索事件 | 
|---|
|  |  |  | form.on('submit(search)', function (data) { | 
|---|
|  |  |  | pageCurr = 1; | 
|---|
|  |  |  | tableReload(false); | 
|---|
|  |  |  | tableReload(false,false); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 搜索栏重置事件 | 
|---|
|  |  |  | form.on('submit(reset)', function (data) { | 
|---|
|  |  |  | pageCurr = 1; | 
|---|
|  |  |  | type = 1; | 
|---|
|  |  |  | clearFormVal($('#search-box')); | 
|---|
|  |  |  | $('#detlTable').css("display", 'none'); | 
|---|
|  |  |  | tableReload(false,true); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 时间选择器 | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#ymd\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#wrkDate\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#ioTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#crnStrTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#crnEndTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#plcStrTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#crnPosTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#refIotime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#modiTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#appeTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#errorTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#logErrTime\\$', | 
|---|
|  |  |  | type: 'datetime' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '.layui-laydate-range' | 
|---|
|  |  |  | ,type: 'datetime' | 
|---|
|  |  |  | ,range: true | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | parent.layer.closeAll(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function tableReload(child) { | 
|---|
|  |  |  | function tableReload(child,isReset) { | 
|---|
|  |  |  | var searchData = {}; | 
|---|
|  |  |  | $.each($('#search-box [name]').serializeArray(), function() { | 
|---|
|  |  |  | searchData[this.name] = this.value; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if(isReset){ | 
|---|
|  |  |  | searchData["type"] = "1"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | (child ? parent.tableIns : tableIns).reload({ | 
|---|
|  |  |  | where: searchData, | 
|---|
|  |  |  | page: { | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | done: function (res, curr, count) { | 
|---|
|  |  |  | if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl; | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | pageCurr=curr; | 
|---|
|  |  |  | if (res.data.length === 0 && count !== 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | limit(child); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 显示库存总数量 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/report/viewInOutList/date/count", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | contentType:'application/json;charset=UTF-8', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | data: JSON.stringify(searchData), | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | $("#countNumIn").text(res.data.in + '次'); | 
|---|
|  |  |  | $("#countNumOut").text(res.data.out + '次'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function setFormVal(el, data, showImg) { | 
|---|