| | |
| | | var pageCurr; |
| | | |
| | | function getCol() { |
| | | var cols = [ |
| | | {field: 'oneday', align: 'center', title: '入库日期', width: 200} |
| | |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var param = '?'; |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | exportData[this.name] = this.value; |
| | | param += this.name + '=' + this.value + '&'; |
| | | }); |
| | | var param = { |
| | | fields: fields, |
| | | exportData: exportData |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/report/viewWorkInExport.action", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | window.location.href = baseUrl + "/report/download/in" + param; |
| | | 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) |
| | | } |
| | | } |
| | | }); |
| | | // var param = { |
| | | // fields: fields, |
| | | // exportData: exportData |
| | | // }; |
| | | // $.ajax({ |
| | | // url: baseUrl + "/report/download/in", |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // data: JSON.stringify(param), |
| | | // responseType: "blob", |
| | | // contentType: 'application/json;charset=UTF-8', |
| | | // method: 'POST', |
| | | // success: function (res) { |
| | | // layer.closeAll(); |
| | | // if (res.code === 200) { |
| | | // var blob = new Blob([response], { type: 'application/vnd.ms-excel' }); |
| | | // var link = document.createElement('a'); |
| | | // link.href = URL.createObjectURL(blob); |
| | | // link.download = 'exported_file.xls'; // 设置下载文件名 |
| | | // link.click(); |
| | | // } else if (res.code === 403) { |
| | | // top.location.href = baseUrl + "/"; |
| | | // } else { |
| | | // layer.msg(res.msg) |
| | | // } |
| | | // } |
| | | // }); |
| | | }); |
| | | break; |
| | | } |