Commit 459611b174ab0646cc056f85091f8e058f428dec
Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang
Showing
3 changed files
with
29 additions
and
2 deletions
src/main/java/com/bsth/controller/DownloadController.java
| ... | ... | @@ -100,4 +100,29 @@ public class DownloadController |
| 100 | 100 | os.close(); |
| 101 | 101 | file.delete(); |
| 102 | 102 | } |
| 103 | + | |
| 104 | + | |
| 105 | + @RequestMapping("downloadModel") | |
| 106 | + public void downloadModel(HttpServletResponse response,String fileName) | |
| 107 | + throws IOException { | |
| 108 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | |
| 109 | + fileName =fileName + ".xls"; | |
| 110 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | |
| 111 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | |
| 112 | +// String filename = file.getName();// 获取日志文件名称 | |
| 113 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | |
| 114 | + byte[] buffer = new byte[fis.available()]; | |
| 115 | + fis.read(buffer); | |
| 116 | + fis.close(); | |
| 117 | + response.reset(); | |
| 118 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | |
| 119 | + response.addHeader("Content-Length", "" + file.length()); | |
| 120 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | |
| 121 | + response.setContentType("application/octet-stream"); | |
| 122 | + os.write(buffer);// 输出文件 | |
| 123 | + os.flush(); | |
| 124 | + os.close(); | |
| 125 | + } | |
| 126 | + | |
| 127 | + | |
| 103 | 128 | } | ... | ... |
src/main/resources/static/pages/electricity/jdl/list.html
| ... | ... | @@ -117,7 +117,7 @@ |
| 117 | 117 | }); |
| 118 | 118 | |
| 119 | 119 | //提交 |
| 120 | - $('tr.filter .filter-submit').on('click', function () { | |
| 120 | + $('tr.filter .filter-submit').on('click', function () { | |
| 121 | 121 | var gsbm = $('#gsbm').val(); |
| 122 | 122 | var fgsbm = $('#fgsbm').val(); |
| 123 | 123 | if ($("#rq").val() == "" || $("#rq").val() ==null){ | ... | ... |
src/main/resources/static/pages/electricity/jdl/upload.html
| ... | ... | @@ -79,6 +79,8 @@ |
| 79 | 79 | layer.close(j); |
| 80 | 80 | alert(data.result); |
| 81 | 81 | // alert("文件导入成功"); |
| 82 | + $('#uploadFile').modal('hide'); | |
| 83 | + $('tr.filter .filter-submit').click(); | |
| 82 | 84 | }, |
| 83 | 85 | error : function(data, status, e) { |
| 84 | 86 | layer.close(j); |
| ... | ... | @@ -88,7 +90,7 @@ |
| 88 | 90 | }); |
| 89 | 91 | |
| 90 | 92 | $('#downLoad').on('click', function(){ |
| 91 | - window.open("/downloadFile/download?fileName=import_Jdl"); | |
| 93 | + window.open("/downloadFile/downloadModel?fileName=import_Jdl"); | |
| 92 | 94 | }); |
| 93 | 95 | |
| 94 | 96 | function getCurrSelNode(){ | ... | ... |