Commit 52dd1a8223cfe70dcbde52764bdc25824f9e992b
1 parent
f4d790dc
LGF 导出
Showing
3 changed files
with
22 additions
and
5 deletions
src/main/resources/static/pages/forms/mould/statisticsDaily_.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/waybill_qingpu.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/statisticsDaily .html
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | </div> | 37 | </div> |
| 38 | <div class="form-group"> | 38 | <div class="form-group"> |
| 39 | <input class="btn btn-default" type="button" id="query" value="查询"/> | 39 | <input class="btn btn-default" type="button" id="query" value="查询"/> |
| 40 | -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | 40 | + <input class="btn btn-default" type="button" id="export" value="导出"/> |
| 41 | </div> | 41 | </div> |
| 42 | </form> | 42 | </form> |
| 43 | </div> | 43 | </div> |
| @@ -156,6 +156,8 @@ | @@ -156,6 +156,8 @@ | ||
| 156 | 156 | ||
| 157 | <script> | 157 | <script> |
| 158 | $(function(){ | 158 | $(function(){ |
| 159 | + $('#export').attr('disabled', "true"); | ||
| 160 | + | ||
| 159 | // 关闭左侧栏 | 161 | // 关闭左侧栏 |
| 160 | if (!$('body').hasClass('page-sidebar-closed')) | 162 | if (!$('body').hasClass('page-sidebar-closed')) |
| 161 | $('.menu-toggler.sidebar-toggler').click(); | 163 | $('.menu-toggler.sidebar-toggler').click(); |
| @@ -176,17 +178,32 @@ | @@ -176,17 +178,32 @@ | ||
| 176 | }) | 178 | }) |
| 177 | 179 | ||
| 178 | 180 | ||
| 181 | + var line = $("#line").val(); | ||
| 182 | + var xlName = $("#select2-line-container").html(); | ||
| 183 | + var date = $("#date").val(); | ||
| 179 | $("#query").on("click",function(){ | 184 | $("#query").on("click",function(){ |
| 180 | - var line = $("#line").val(); | ||
| 181 | - var xlName = $("#select2-line-container").html(); | ||
| 182 | - var date = $("#date").val(); | ||
| 183 | - $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName},function(result){ | 185 | + line = $("#line").val(); |
| 186 | + xlName = $("#select2-line-container").html(); | ||
| 187 | + date = $("#date").val(); | ||
| 188 | + $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){ | ||
| 184 | // 把数据填充到模版中 | 189 | // 把数据填充到模版中 |
| 185 | var tbodyHtml = template('statisticsDaily',{list:result}); | 190 | var tbodyHtml = template('statisticsDaily',{list:result}); |
| 186 | // 把渲染好的模版html文本追加到表格中 | 191 | // 把渲染好的模版html文本追加到表格中 |
| 187 | $('#forms .statisticsDaily').html(tbodyHtml); | 192 | $('#forms .statisticsDaily').html(tbodyHtml); |
| 193 | + | ||
| 194 | + if(result.length == 0) | ||
| 195 | + $("#export").attr('disabled',"true"); | ||
| 196 | + else | ||
| 197 | + $("#export").removeAttr("disabled"); | ||
| 188 | }); | 198 | }); |
| 189 | }); | 199 | }); |
| 200 | + | ||
| 201 | + $("#export").on("click",function(){ | ||
| 202 | + $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"export"},function(result){ | ||
| 203 | + window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD")); | ||
| 204 | + }); | ||
| 205 | + }); | ||
| 206 | + | ||
| 190 | }); | 207 | }); |
| 191 | </script> | 208 | </script> |
| 192 | <script type="text/html" id="statisticsDaily"> | 209 | <script type="text/html" id="statisticsDaily"> |