| | |
| | | allLike(LocNormalLog.class, param.keySet(), wrapper, condition); |
| | | return R.ok(locNormalLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | //excel导出 |
| | | @RequestMapping("/locNomal/normalReportExport.action") |
| | | @ManagerAuth(memo = "日入库明细统计导出") |
| | | public R normalReportExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | @SuppressWarnings("unchecked") |
| | | List<LocNormalReport> list = JSONObject.parseArray(param.getJSONArray("exportData").toJSONString(), LocNormalReport.class); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | } |
| | |
| | | , type: 'datetime' |
| | | , range: true |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(locNormal)', function (obj) { |
| | | switch(obj.event) { |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var param = { |
| | | fields: fields, |
| | | exportData: locNormalList |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/locNomal/normalReportExport.action", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles,res.data,'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | /* 表格数据重载 */ |
| | |
| | | .btn-remove { |
| | | display: none; |
| | | } |
| | | |
| | | #btn-export { |
| | | margin-top: 10px; |
| | | } |
| | | </style> |
| | | <body> |
| | | <div> |
| | |
| | | </div> |
| | | |
| | | <!-- 表格 --> |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="locNormal" lay-filter="locNormal"></table> |
| | | </div> |
| | | <table class="layui-hide" id="locNormal" lay-filter="locNormal"></table> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" >导出</button> |
| | | </div> |
| | | </script> |
| | | |
| | | </div> |
| | | |