Commit 70d5cecbbb9222802646fd1cb51925a97459cbe0

Authored by 娄高锋
1 parent b927425a

首末班准点率加明细导出

src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
... ... @@ -75,12 +75,11 @@
75 75 </table>
76 76 </div>
77 77 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
78   - <input class="btn btn-default hidden" type="button" id="exportMap" value="导出明细1" style="float: right;"/>
  78 + <input class="btn btn-default hidden" type="button" id="exportMap" value="导出明细" style="float: right;"/>
79 79 <table class="table table-bordered table-hover table-checkable" id="map">
80 80 <thead>
81 81 <tr class="hidden">
82   - <th style="display: none;"></th>
83   - <th rowspan="2">日期</th>
  82 + <th rowspan="2" align="center">日期</th>
84 83 <th rowspan="2">线路</th>
85 84 <th colspan="4">上行首发</th>
86 85 <th colspan="4">上行末发</th>
... ... @@ -88,8 +87,7 @@
88 87 <th colspan="4">下行末发</th>
89 88 </tr>
90 89 <tr class="hidden">
91   - <th style="display: none;"></th>
92   - <th>站点</th>
  90 + <th align="center">站点</th>
93 91 <th>计发</th>
94 92 <th>实发</th>
95 93 <th>快慢</th>
... ... @@ -112,12 +110,11 @@
112 110 </tbody>
113 111 </table>
114 112  
115   - <input class="btn btn-default hidden" type="button" id="exportSumMap" value="导出明细2" style="float: right;"/>
  113 + <input class="btn btn-default hidden" type="button" id="exportSumMap" value="导出明细" style="float: right;"/>
116 114 <table class="table table-bordered table-hover table-checkable" id="sumMap">
117 115 <thead>
118 116 <tr class="hidden">
119   - <th style="display: none;"></th>
120   - <th>序号</th>
  117 + <th align="center">序号</th>
121 118 <th>日期</th>
122 119 <th>分公司</th>
123 120 <th>线路</th>
... ... @@ -138,6 +135,7 @@
138 135 </div>
139 136 </div>
140 137  
  138 +<script type="text/javascript" src="js/jquery.table2excel.min.js"></script>
141 139 <script>
142 140 $(function(){
143 141 $('#export').attr('disabled', "true");
... ... @@ -249,9 +247,9 @@
249 247 var tbodyHtml = template('list_maps',{list:g.map});
250 248 $('#map tbody').html(tbodyHtml);
251 249 $("#sumMap tr").addClass("hidden");
252   -// $("#exportSumMap").addClass("hidden");
  250 + $("#exportSumMap").addClass("hidden");
253 251 $("#map .hidden").removeClass("hidden");
254   -// $("#exportMap").removeClass("hidden");
  252 + $("#exportMap").removeClass("hidden");
255 253 $("html,body").animate({scrollTop:$("#map").offset().top},1000);
256 254 }
257 255 });
... ... @@ -262,9 +260,9 @@
262 260 var tbodyHtml = template('list_sumMaps',{list:g.map});
263 261 $('#sumMap tbody').html(tbodyHtml);
264 262 $("#map tr").addClass("hidden");
265   -// $("#exportMap").addClass("hidden");
  263 + $("#exportMap").addClass("hidden");
266 264 $("#sumMap .hidden").removeClass("hidden");
267   -// $("#exportSumMap").removeClass("hidden");
  265 + $("#exportSumMap").removeClass("hidden");
268 266 $("html,body").animate({scrollTop:$("#sumMap").offset().top},1000);
269 267 }
270 268 });
... ... @@ -332,6 +330,28 @@
332 330 });
333 331 });
334 332  
  333 + $("#exportMap").on("click",function(){
  334 + $("#map").table2excel({
  335 + exclue: ".noExl",
  336 + name: "Excel Document Name.xlsx",
  337 + filename: "线路首末班",
  338 + exclude_img: true,
  339 + exclude_links: true,
  340 + exclude_inputs: true
  341 + });
  342 + });
  343 +
  344 + $("#exportSumMap").on("click",function(){
  345 + $("#sumMap").table2excel({
  346 + exclue: ".noExl",
  347 + name: "Excel Document Name.xlsx",
  348 + filename: "首末班误点班次",
  349 + exclude_img: true,
  350 + exclude_links: true,
  351 + exclude_inputs: true
  352 + });
  353 + });
  354 +
335 355  
336 356 });
337 357  
... ... @@ -423,7 +443,7 @@
423 443 <td>{{obj.firstOrLast}}</td>
424 444 <td>{{obj.jhfc}}</td>
425 445 <td>{{obj.sjfc}}</td>
426   - <td>{{obj.delay}}</td>
  446 + <td> {{obj.delay}}</td>
427 447 <td>{{obj.remarks1}}</td>
428 448 </tr>
429 449 {{/each}}
... ...
src/main/resources/static/pages/forms/statement/js/jquery.table2excel.min.js 0 → 100644
  1 +/*
  2 + * jQuery table2excel - v1.1.1
  3 + * jQuery plugin to export an .xls file in browser from an HTML table
  4 + * https://github.com/rainabba/jquery-table2excel
  5 + *
  6 + * Made by rainabba
  7 + * Under MIT License
  8 + */
  9 +!function(a,b,c,d){function e(b,c){this.element=b,this.settings=a.extend({},k,c),this._defaults=k,this._name=j,this.init()}function f(a){return a.filename?a.filename:"table2excel"}function g(a){var b=/(\s+alt\s*=\s*"([^"]*)"|\s+alt\s*=\s*'([^']*)')/i;return a.replace(/<img[^>]*>/gi,function(a){var c=b.exec(a);return null!==c&&c.length>=2?c[2]:""})}function h(a){return a.replace(/<a[^>]*>|<\/a>/gi,"")}function i(a){var b=/(\s+value\s*=\s*"([^"]*)"|\s+value\s*=\s*'([^']*)')/i;return a.replace(/<input[^>]*>|<\/input>/gi,function(a){var c=b.exec(a);return null!==c&&c.length>=2?c[2]:""})}var j="table2excel",k={exclude:".noExl",name:"Table2Excel",filename:"table2excel",fileext:".xls",exclude_img:!0,exclude_links:!0,exclude_inputs:!0};e.prototype={init:function(){var b=this;b.template={head:'<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8"><head>\x3c!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets>',sheet:{head:"<x:ExcelWorksheet><x:Name>",tail:"</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>"},mid:"</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--\x3e</head><body>",table:{head:"<table>",tail:"</table>"},foot:"</body></html>"},b.tableRows=[],a(b.element).each(function(c,d){var e="";a(d).find("tr").not(b.settings.exclude).each(function(c,d){e+="<tr>",a(d).find("td,th").not(b.settings.exclude).each(function(c,d){var f={rows:a(this).attr("rowspan"),cols:a(this).attr("colspan"),flag:a(d).find(b.settings.exclude)};f.flag.length>0?e+="<td> </td>":f.rows&f.cols?e+="<td>"+a(d).html()+"</td>":(e+="<td",f.rows>0&&(e+=" rowspan='"+f.rows+"' "),f.cols>0&&(e+=" colspan='"+f.cols+"' "),e+="/>"+a(d).html()+"</td>")}),e+="</tr>",console.log(e)}),b.settings.exclude_img&&(e=g(e)),b.settings.exclude_links&&(e=h(e)),b.settings.exclude_inputs&&(e=i(e)),b.tableRows.push(e)}),b.tableToExcel(b.tableRows,b.settings.name,b.settings.sheetName)},tableToExcel:function(d,e,g){var h,i,j,k=this,l="";if(k.format=function(a,b){return a.replace(/{(\w+)}/g,function(a,c){return b[c]})},g=void 0===g?"Sheet":g,k.ctx={worksheet:e||"Worksheet",table:d,sheetName:g},l=k.template.head,a.isArray(d))for(h in d)l+=k.template.sheet.head+g+h+k.template.sheet.tail;if(l+=k.template.mid,a.isArray(d))for(h in d)l+=k.template.table.head+"{table"+h+"}"+k.template.table.tail;l+=k.template.foot;for(h in d)k.ctx["table"+h]=d[h];if(delete k.ctx.table,!c.documentMode){var m=new Blob([k.format(l,k.ctx)],{type:"application/vnd.ms-excel"});b.URL=b.URL||b.webkitURL,i=b.URL.createObjectURL(m),j=c.createElement("a"),j.download=f(k.settings),j.href=i,c.body.appendChild(j),j.click(),c.body.removeChild(j)}else if("undefined"!=typeof Blob){l=k.format(l,k.ctx),l=[l];var n=new Blob(l,{type:"text/html"});b.navigator.msSaveBlob(n,f(k.settings))}else txtArea1.document.open("text/html","replace"),txtArea1.document.write(k.format(l,k.ctx)),txtArea1.document.close(),txtArea1.focus(),sa=txtArea1.document.execCommand("SaveAs",!0,f(k.settings));return!0}},a.fn[j]=function(b){var c=this;return c.each(function(){a.data(c,"plugin_"+j)||a.data(c,"plugin_"+j,new e(this,b))}),c}}(jQuery,window,document);
0 10 \ No newline at end of file
... ...