| | |
| | | , 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; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | /* 表格数据重载 */ |