Commit 7ace67b2d7448d95d867bcd9687edd3cc952d936

Authored by 娄高锋
1 parent 8c109cbd

用js导出的方法改成了和其他表一样的导出方式

src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -1843,7 +1843,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1843 1843 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("气候") != -1){
1844 1844 qhbc++;
1845 1845 // qhlc = qhlc.add(lc);
1846   - }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("外援") != -1){
  1846 + }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("援外") != -1){
1847 1847 wybc++;
1848 1848 // wylc = wylc.add(lc);
1849 1849 } else {
... ... @@ -3003,6 +3003,27 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3003 3003 tempMap.put("zdzdl", (bcs>0?df.format((double)zdzd/bcs*100):0)+"%");
3004 3004 resList.add(tempMap);
3005 3005 }
  3006 +
  3007 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  3008 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3009 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3010 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3011 + Map<String,Object> m = new HashMap<String, Object>();
  3012 + ReportUtils ee = new ReportUtils();
  3013 + try {
  3014 + listI.add(resList.iterator());
  3015 + m.put("date1", startDate);
  3016 + m.put("date2", endDate);
  3017 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  3018 + ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime.xls",
  3019 + path+"export/发车到站准点率" + sdfSimple.format(sdfMonth.parse(startDate)) +
  3020 + (startDate.equals(endDate)?"":"-"+sdfSimple.format(sdfMonth.parse(endDate))) + ".xls");
  3021 + } catch (Exception e) {
  3022 + // TODO: handle exception
  3023 + e.printStackTrace();
  3024 + }
  3025 + }
  3026 +
3006 3027 } else if(map.get("flag").toString().trim().equals("1")) {
3007 3028 for(String xl : keyMap.keySet()){
3008 3029 List<List<Map<String, Object>>> list1 = keyMap.get(xl);
... ... @@ -3031,17 +3052,61 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3031 3052 resList.add(tempMap);
3032 3053 }
3033 3054 }
  3055 +
  3056 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  3057 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3058 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3059 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3060 + Map<String,Object> m = new HashMap<String, Object>();
  3061 + ReportUtils ee = new ReportUtils();
  3062 + try {
  3063 + listI.add(resList.iterator());
  3064 + m.put("date1", startDate);
  3065 + m.put("date2", endDate);
  3066 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  3067 + ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime1.xls",
  3068 + path+"export/发车到站准点率明细.xls");
  3069 + } catch (Exception e) {
  3070 + // TODO: handle exception
  3071 + e.printStackTrace();
  3072 + }
  3073 + }
  3074 +
3034 3075 } else if(map.get("flag").toString().trim().equals("2")) {
  3076 + int i = 0;
3035 3077 for(String xl : keyMap.keySet()){
3036 3078 List<List<Map<String, Object>>> list1 = keyMap.get(xl);
3037 3079 if(list1.size() == 0 || list1.get(0).size() == 0)
3038 3080 continue;
3039 3081 for(List<Map<String, Object>> list2 : list1){
3040 3082 for(Map<String, Object> m : list2){
  3083 + m.put("no", ++i);
  3084 + if(m.containsKey("line"))
  3085 + line = m.get("line").toString();
3041 3086 resList.add(m);
3042 3087 }
3043 3088 }
3044 3089 }
  3090 +
  3091 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  3092 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3093 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3094 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3095 + Map<String,Object> m = new HashMap<String, Object>();
  3096 + ReportUtils ee = new ReportUtils();
  3097 + try {
  3098 + listI.add(resList.iterator());
  3099 + m.put("date", startDate);
  3100 + m.put("line", line);
  3101 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  3102 + ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime2.xls",
  3103 + path+"export/发车到站准点率详细"+sdfSimple.format(sdfMonth.parse(startDate))+".xls");
  3104 + } catch (Exception e) {
  3105 + // TODO: handle exception
  3106 + e.printStackTrace();
  3107 + }
  3108 + }
  3109 +
3045 3110 }
3046 3111  
3047 3112 return resList;
... ...
src/main/java/com/bsth/service/report/impl/SheetServiceImpl.java
... ... @@ -44,6 +44,7 @@ import com.bsth.util.BatchSaveUtils;
44 44 import com.bsth.util.ComparableChild;
45 45 import com.bsth.util.ComparableReal;
46 46 import com.bsth.util.ReportRelatedUtils;
  47 +import com.bsth.util.ReportUtils;
47 48 import com.google.common.util.concurrent.AbstractScheduledService.Scheduler;
48 49  
49 50 @Service
... ... @@ -611,6 +612,24 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
611 612 }
612 613  
613 614 }
  615 +
  616 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  617 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  618 + Map<String, Object> m = new HashMap<String, Object>();
  619 + m.put("date", date);
  620 + m.put("endDate", endDate);
  621 + ReportUtils ee = new ReportUtils();
  622 + try {
  623 + listI.add(listmap.iterator());
  624 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  625 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "sheetList.xls",
  626 + path + "export/发车准点率"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  627 + } catch (Exception e) {
  628 + // TODO: handle exception
  629 + e.printStackTrace();
  630 + }
  631 + }
  632 +
614 633 return listmap;
615 634 }
616 635  
... ... @@ -738,7 +757,33 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
738 757 // TODO Auto-generated catch block
739 758 e.printStackTrace();
740 759 }
741   -
  760 + }
  761 +
  762 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  763 + Map<String, Object> m = new HashMap<String, Object>();
  764 + ReportUtils ee = new ReportUtils();
  765 + try {
  766 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  767 + for(int i = 0; i < list.size(); i++){
  768 + Map<String, Object> temp = new HashMap<String, Object>();
  769 + Sheet s = list.get(i);
  770 + temp.put("id", i+1);
  771 + temp.put("date", s.getDate());
  772 + temp.put("line", s.getLine());
  773 + temp.put("zdname", s.getZdname());
  774 + temp.put("jhsj", s.getJhsj());
  775 + temp.put("sjsj", s.getSjsj());
  776 + temp.put("sfzd", s.getSfzd());
  777 + tempList.add(temp);
  778 + }
  779 + listI.add(tempList.iterator());
  780 + m.put("date", sheet.getDate());
  781 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  782 + ee.excelReplace(listI, new Object[]{m}, path + "mould/sheetList2.xls",
  783 + path + "export/发车准点率"+sheet.getDate().replaceAll("-", "")+".xls");
  784 + } catch (Exception e) {
  785 + // TODO: handle exception
  786 + e.printStackTrace();
742 787 }
743 788  
744 789 return list;
... ... @@ -800,6 +845,24 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
800 845 listmap.add(newmap);
801 846 }
802 847 }
  848 +
  849 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  850 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  851 + Map<String, Object> m = new HashMap<String, Object>();
  852 + m.put("date", date);
  853 + m.put("endDate", endDate);
  854 + ReportUtils ee = new ReportUtils();
  855 + try {
  856 + listI.add(listmap.iterator());
  857 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  858 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "sheetList1.xls",
  859 + path + "export/发车准点率"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  860 + } catch (Exception e) {
  861 + // TODO: handle exception
  862 + e.printStackTrace();
  863 + }
  864 + }
  865 +
803 866 return listmap;
804 867 }
805 868  
... ...
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
... ... @@ -1344,7 +1344,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1344 1344 tempMap.put("date", date.substring(5));
1345 1345 tempMap.put("line", xlName);
1346 1346 List<Long> up1 = new ArrayList<Long>();
1347   - List<Long> up2 = new ArrayList<Long>();;
  1347 + List<Long> up2 = new ArrayList<Long>();
1348 1348 List<Long> dn1 = new ArrayList<Long>();
1349 1349 List<Long> dn2 = new ArrayList<Long>();
1350 1350 Map<Long, ScheduleRealInfo> up1Map = new HashMap<Long, ScheduleRealInfo>();
... ... @@ -1484,7 +1484,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1484 1484 }
1485 1485  
1486 1486 try {
1487   - String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"
  1487 + String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"
1488 1488 + " a.cc_service, a.remarks, a.adjust_exps, b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b on a.xl_bm = b.line"
1489 1489 + " where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'"
1490 1490 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'";
... ... @@ -1501,6 +1501,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1501 1501 schedule.setScheduleDateStr(rs.getString("schedule_date_str"));
1502 1502 schedule.setRealExecDate(rs.getString("real_exec_date"));
1503 1503 schedule.setXlName(rs.getString("xl_name"));
  1504 + schedule.setXlBm(rs.getString("xl_bm"));
1504 1505 schedule.setFcsj(rs.getString("fcsj"));
1505 1506 schedule.setFcsjActual(rs.getString("fcsj_actual"));
1506 1507 schedule.setZdsj(rs.getString("zdsj"));
... ... @@ -1552,6 +1553,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1552 1553 }
1553 1554  
1554 1555 Map<String, Map<String, List<ScheduleRealInfo>>> keyMap = new HashMap<String, Map<String,List<ScheduleRealInfo>>>();
  1556 + Map<String, String> xlMap = new HashMap<String, String>();
1555 1557 String companyName = "", subCompanyName = "";
1556 1558  
1557 1559 for(ScheduleRealInfo s : list){
... ... @@ -1569,6 +1571,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1569 1571 companyName = s.getGsName();
1570 1572 if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0)
1571 1573 subCompanyName = s.getFgsName();
  1574 + xlMap.put(xlName, s.getXlBm());
1572 1575 }
1573 1576  
1574 1577 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
... ... @@ -1589,9 +1592,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1589 1592 String date = dateMap.get(l);
1590 1593 Map<String, Object> temp = new HashMap<String, Object>();
1591 1594 temp.put("date", date.substring(5));
  1595 + temp.put("dates", date);
1592 1596 temp.put("line", xlName);
  1597 + temp.put("xlbm", xlMap.get(xlName));
1593 1598 List<Long> up1 = new ArrayList<Long>();
1594   - List<Long> up2 = new ArrayList<Long>();;
  1599 + List<Long> up2 = new ArrayList<Long>();
1595 1600 List<Long> dn1 = new ArrayList<Long>();
1596 1601 List<Long> dn2 = new ArrayList<Long>();
1597 1602 Map<Long, ScheduleRealInfo> up1Map = new HashMap<Long, ScheduleRealInfo>();
... ... @@ -1638,6 +1643,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1638 1643 } else {
1639 1644 Map<String, Object> m = new HashMap<String, Object>();
1640 1645 m.put("date", date.substring(5));
  1646 + m.put("dates", date);
1641 1647 m.put("line", xlName);
1642 1648 m.put("firstOrLast", "上行首发");
1643 1649 m.put("qdz", s1.getQdzName());
... ... @@ -1654,6 +1660,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1654 1660 } else {
1655 1661 Map<String, Object> m = new HashMap<String, Object>();
1656 1662 m.put("date", date.substring(5));
  1663 + m.put("dates", date);
1657 1664 m.put("line", xlName);
1658 1665 m.put("firstOrLast", "上行末发");
1659 1666 m.put("qdz", s3.getQdzName());
... ... @@ -1698,6 +1705,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1698 1705 } else {
1699 1706 Map<String, Object> m = new HashMap<String, Object>();
1700 1707 m.put("date", date.substring(5));
  1708 + m.put("dates", date);
1701 1709 m.put("line", xlName);
1702 1710 m.put("firstOrLast", "下行首发");
1703 1711 m.put("qdz", s1.getQdzName());
... ... @@ -1715,6 +1723,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1715 1723 } else {
1716 1724 Map<String, Object> m = new HashMap<String, Object>();
1717 1725 m.put("date", date.substring(5));
  1726 + m.put("dates", date);
1718 1727 m.put("line", xlName);
1719 1728 m.put("firstOrLast", "下行末发");
1720 1729 m.put("qdz", s3.getQdzName());
... ... @@ -1744,8 +1753,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1744 1753 tempMap.put("map", tempList);
1745 1754 tempMap.put("company", companyName);
1746 1755 tempMap.put("subCompany", subCompanyName);
1747   - tempMap.put("date", dates);
  1756 + tempMap.put("xlbm", xlMap.get(xlName));
1748 1757 tempMap.put("line", xlName);
  1758 + tempMap.put("date", dates);
1749 1759 tempMap.put("jhbc", jhbc);
1750 1760 tempMap.put("sjbc", sjbc);
1751 1761 tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc *100)) + "%");
... ... @@ -1790,6 +1800,36 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1790 1800 // TODO: handle exception
1791 1801 e.printStackTrace();
1792 1802 }
  1803 + } else if(type.equals("exportMap")){
  1804 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1805 + Map<String,Object> m = new HashMap<String, Object>();
  1806 + ReportUtils ee = new ReportUtils();
  1807 + try {
  1808 + if(resList.size() > 0)
  1809 + listI.add(((List<Map<String, Object>>)resList.get(0).get("map")).iterator());
  1810 + listI.add(resList.iterator());
  1811 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  1812 + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_map.xls",
  1813 + path+"export/线路首末班明细.xls");
  1814 + } catch (Exception e) {
  1815 + // TODO: handle exception
  1816 + e.printStackTrace();
  1817 + }
  1818 + } else if(type.equals("delay_export")){
  1819 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1820 + Map<String,Object> m = new HashMap<String, Object>();
  1821 + ReportUtils ee = new ReportUtils();
  1822 + try {
  1823 + if(resList.size() > 0)
  1824 + listI.add(((List<Map<String, Object>>)resList.get(resList.size() - 1).get("map")).iterator());
  1825 + listI.add(resList.iterator());
  1826 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  1827 + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_delay.xls",
  1828 + path+"export/首末班误点班次.xls");
  1829 + } catch (Exception e) {
  1830 + // TODO: handle exception
  1831 + e.printStackTrace();
  1832 + }
1793 1833 }
1794 1834  
1795 1835 return resList;
... ...
src/main/resources/static/pages/forms/mould/firstAndLastBus_delay.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/firstAndLastBus_map.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/onTime.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/onTime1.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/onTime2.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/sheetList.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/sheetList1.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/sheetList2.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/firstAndLastBus_delay.html
... ... @@ -230,7 +230,7 @@
230 230 // 把渲染好的模版html文本追加到表格中
231 231 $('#forms tbody').html(tbodyHtml);
232 232  
233   - if(result.length == 0)
  233 + if(list.length == 0)
234 234 $("#export").attr('disabled',"true");
235 235 else
236 236 $("#export").removeAttr("disabled");
... ... @@ -240,13 +240,32 @@
240 240 }
241 241  
242 242 $("#export").on("click",function(){
243   - $("#forms").table2excel({
244   - exclue: ".noExl",
245   - name: "Excel Document Name.xlsx",
246   - filename: "首末班误点班次",
247   - exclude_img: true,
248   - exclude_links: true,
249   - exclude_inputs: true
  243 +// $("#forms").table2excel({
  244 +// exclue: ".noExl",
  245 +// name: "Excel Document Name.xlsx",
  246 +// filename: "首末班误点班次",
  247 +// exclude_img: true,
  248 +// exclude_links: true,
  249 +// exclude_inputs: true
  250 +// });
  251 + var i = layer.load(2);
  252 + var params = {};
  253 + company = $("#company").val();
  254 + subCompany = $("#subCompany").val();
  255 + line = $("#line").val();
  256 + startDate = $("#startDate").val();
  257 + endDate = $("#endDate").val();
  258 + if(line == " ")
  259 + line = "";
  260 + params['company'] = company;
  261 + params['subCompany'] = subCompany;
  262 + params['line'] = line;
  263 + params['startDate'] = startDate;
  264 + params['endDate'] = endDate;
  265 + params['type'] = "delay_export";
  266 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  267 + window.open("/downloadFile/download?fileName=首末班误点班次");
  268 + layer.close(i);
250 269 });
251 270 });
252 271  
... ...
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
... ... @@ -239,11 +239,13 @@
239 239 });
240 240  
241 241 var list;
  242 + var tempLine;
242 243 $("#forms tbody").on("click","a",function(){
243 244 var index = $(this).parent().parent().index();
244 245 if(index < list.length - 1){
245 246 $.each(list, function(i, g){
246 247 if(index == i){
  248 + tempLine = g.xlbm;
247 249 var tbodyHtml = template('list_maps',{list:g.map});
248 250 $('#map tbody').html(tbodyHtml);
249 251 $("#sumMap tr").addClass("hidden");
... ... @@ -304,11 +306,13 @@
304 306 $("#sumMap tr").addClass("hidden");
305 307 $("#exportMap").addClass("hidden");
306 308 $("#exportSumMap").addClass("hidden");
  309 + var i = layer.load(2);
307 310 $get('/pcpc/firstAndLastBus_sum', params, function(result){
308 311 // 把数据填充到模版中
309 312 var tbodyHtml = template('list_firstAndLastBus_sum',{list:result});
310 313 // 把渲染好的模版html文本追加到表格中
311 314 $('#forms tbody').html(tbodyHtml);
  315 + layer.close(i);
312 316  
313 317 list = result;
314 318  
... ... @@ -327,30 +331,56 @@
327 331 params['startDate'] = startDate;
328 332 params['endDate'] = endDate;
329 333 params['type'] = "export";
  334 + var i = layer.load(2);
330 335 $get('/pcpc/firstAndLastBus_sum', params, function(result){
331 336 window.open("/downloadFile/download?fileName=线路首末班准点率"+moment(startDate).format("YYYYMMDD")+(startDate==endDate?"":("-"+moment(endDate).format("YYYYMMDD"))));
  337 + layer.close(i);
332 338 });
333 339 });
334 340  
335 341 $("#exportMap").on("click",function(){
336   - $("#map").table2excel({
337   - exclue: ".noExl",
338   - name: "Excel Document Name.xlsx",
339   - filename: "线路首末班",
340   - exclude_img: true,
341   - exclude_links: true,
342   - exclude_inputs: true
  342 +// $("#map").table2excel({
  343 +// exclue: ".noExl",
  344 +// name: "Excel Document Name.xlsx",
  345 +// filename: "线路首末班",
  346 +// exclude_img: true,
  347 +// exclude_links: true,
  348 +// exclude_inputs: true
  349 +// });
  350 + var i = layer.load(2);
  351 + var params = {};
  352 + params['company'] = company;
  353 + params['subCompany'] = subCompany;
  354 + params['line'] = tempLine;
  355 + params['startDate'] = startDate;
  356 + params['endDate'] = endDate;
  357 + params['type'] = "exportMap";
  358 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  359 + window.open("/downloadFile/download?fileName=线路首末班明细");
  360 + layer.close(i);
343 361 });
344 362 });
345 363  
346 364 $("#exportSumMap").on("click",function(){
347   - $("#sumMap").table2excel({
348   - exclue: ".noExl",
349   - name: "Excel Document Name.xlsx",
350   - filename: "首末班误点班次",
351   - exclude_img: true,
352   - exclude_links: true,
353   - exclude_inputs: true
  365 +// $("#sumMap").table2excel({
  366 +// exclue: ".noExl",
  367 +// name: "Excel Document Name.xlsx",
  368 +// filename: "首末班误点班次",
  369 +// exclude_img: true,
  370 +// exclude_links: true,
  371 +// exclude_inputs: true
  372 +// });
  373 + var i = layer.load(2);
  374 + var params = {};
  375 + params['company'] = company;
  376 + params['subCompany'] = subCompany;
  377 + params['line'] = line;
  378 + params['startDate'] = startDate;
  379 + params['endDate'] = endDate;
  380 + params['type'] = "delay_export";
  381 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  382 + window.open("/downloadFile/download?fileName=首末班误点班次");
  383 + layer.close(i);
354 384 });
355 385 });
356 386  
... ...
src/main/resources/static/pages/punctual/list.html
... ... @@ -75,22 +75,31 @@
75 75 });
76 76 });
77 77 $("#exportList").on('click',function(){
78   - $("#forms_2").table2excel({
79   - // 不被导出的表格行的CSS class类
80   - exclude: ".noExl",
81   - // 导出的Excel文档的名称,(没看到作用)
82   - name: "Excel Document Name.xlsx",
83   - // Excel文件的名称
84   - filename: "发车到站准点率"
  78 +// $("#forms_2").table2excel({
  79 +// // 不被导出的表格行的CSS class类
  80 +// exclude: ".noExl",
  81 +// // 导出的Excel文档的名称,(没看到作用)
  82 +// name: "Excel Document Name.xlsx",
  83 +// // Excel文件的名称
  84 +// filename: "发车到站准点率"
  85 +// });
  86 + var date = no.split("_")[0];
  87 + var endDate = date;
  88 + var line = no.split("_")[1];
  89 + var fgs=$('#fgsdm').val();
  90 + var gs=$('#gsdm').val();
  91 + $get('/busInterval/onTime',{line:line,startDate:date,endDate:endDate,gs:gs,fgs:fgs,flag:2,type:"export"},function(result){
  92 + window.open("/downloadFile/download?fileName=发车到站准点率详细"+moment(date).format("YYYYMMDD"));
85 93 });
86   - });
  94 +
  95 + });
87 96  
88 97 });
89 98 </script>
90 99 <script type="text/html" id="onTime_2">
91 100 {{each list as obj i}}
92 101 <tr>
93   - <td>{{i+1}}</td>
  102 + <td>{{obj.no}}</td>
94 103 <td>{{obj.zd}}</td>
95 104 <td>{{obj.clzbh}}</td>
96 105 <td>{{obj.jsy}}</td>
... ...
src/main/resources/static/pages/punctual/onTime.html
... ... @@ -98,7 +98,7 @@
98 98 </table>
99 99 </div>
100 100  
101   - <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  101 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px" id="forms_1_div">
102 102 <input class="btn btn-default hidden" type="button" id="export_1" value="导出"/>
103 103 <table class="table table-bordered table-hover table-checkable" id="forms_1">
104 104 <thead>
... ... @@ -269,19 +269,27 @@
269 269 $('#forms_h tbody').html(template('onTime_h',{list:result}));
270 270 $('.btn-onTime').on('click', showSheetList);
271 271 layer.close(i);
  272 +
  273 + $("#forms_1_div").addClass("hidden");
  274 + if(result.length == 0)
  275 + $("#export").attr('disabled',"true");
  276 + else
  277 + $("#export").removeAttr("disabled");
272 278 });
273 279 });
  280 + var line1;
274 281 function showSheetList(){
275   - var line = $(this).data('id');
  282 + line1 = $(this).data('id');
276 283 var date = $("#date").val();
277 284 var endDate = $("#endDate").val();
278 285 var fgs=$('#fgsdm').val();
279 286 var gs=$('#gsdm').val();
280 287 var i = layer.load(2);
281   - $get('/busInterval/onTime',{line:line,startDate:date,endDate:endDate,gs:gs,fgs:fgs,flag:1},function(result){
  288 + $get('/busInterval/onTime',{line:line1,startDate:date,endDate:endDate,gs:gs,fgs:fgs,flag:1},function(result){
282 289 var onTime = template('onTime_1',{list:result});
283 290 $('#forms_1 tbody').html(onTime);
284 291 $('#forms_1_h tbody').html(template('onTime_1_h',{list:result}));
  292 + $("#forms_1_div").removeClass("hidden");
285 293 $("#forms_1 .hidden").removeClass("hidden");
286 294 $('.btn-onTime_1').on('click', openSheetList);
287 295 $("#export_1").removeClass("hidden");
... ... @@ -312,30 +320,47 @@
312 320 });
313 321 }
314 322 $("#export").on("click",function(){
  323 +// $("#forms_h").table2excel({
  324 +// // 不被导出的表格行的CSS class类
  325 +// exclude: ".noExl",
  326 +// // 导出的Excel文档的名称,(没看到作用)
  327 +// name: "Excel Document Name.xlsx",
  328 +// // Excel文件的名称
  329 +// filename: date+"-"+endDate+"发车到站准点率"
  330 +// });
  331 + var line = $("#line").val();
315 332 var date = $("#date").val();
316 333 var endDate = $("#endDate").val();
317   - $("#forms_h").table2excel({
318   - // 不被导出的表格行的CSS class类
319   - exclude: ".noExl",
320   - // 导出的Excel文档的名称,(没看到作用)
321   - name: "Excel Document Name.xlsx",
322   - // Excel文件的名称
323   - filename: date+"-"+endDate+"发车到站准点率"
  334 + var fgs=$('#fgsdm').val();
  335 + var gs=$('#gsdm').val();
  336 + var i = layer.load(2);
  337 + $get('/busInterval/onTime',{line:line,startDate:date,endDate:endDate,gs:gs,fgs:fgs,type:"export"},function(result){
  338 + window.open("/downloadFile/download?fileName=发车到站准点率"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  339 + layer.close(i);
324 340 });
325 341 })
326 342  
327 343 $("#export_1").on("click",function(){
  344 +// var date = $("#date").val();
  345 +// var endDate = $("#endDate").val();
  346 +// $("#forms_1_h").table2excel({
  347 +// // 不被导出的表格行的CSS class类
  348 +// exclude: ".noExl",
  349 +// // 导出的Excel文档的名称,(没看到作用)
  350 +// name: "Excel Document Name.xlsx",
  351 +// // Excel文件的名称
  352 +// filename: date+"-"+endDate+"发车到站准点率"
  353 +// });
328 354 var date = $("#date").val();
329 355 var endDate = $("#endDate").val();
330   - $("#forms_1_h").table2excel({
331   - // 不被导出的表格行的CSS class类
332   - exclude: ".noExl",
333   - // 导出的Excel文档的名称,(没看到作用)
334   - name: "Excel Document Name.xlsx",
335   - // Excel文件的名称
336   - filename: date+"-"+endDate+"发车到站准点率"
  356 + var fgs=$('#fgsdm').val();
  357 + var gs=$('#gsdm').val();
  358 + var i = layer.load(2);
  359 + $get('/busInterval/onTime',{line:line1,startDate:date,endDate:endDate,gs:gs,fgs:fgs,flag:1,type:"export"},function(result){
  360 + window.open("/downloadFile/download?fileName=发车到站准点率明细");
  361 + layer.close(i);
337 362 });
338   - })
  363 + });
339 364  
340 365 });
341 366 </script>
... ...
src/main/resources/static/pages/report/sheet/list.html
... ... @@ -56,25 +56,30 @@
56 56 if (!$('body').hasClass('page-sidebar-closed'))
57 57 $('.menu-toggler.sidebar-toggler').click();
58 58 var no="";
59   - $("#sheetList").on('init', function (e, id) {
60   - no=id;
61   - $get('/sheet/sheetList',{id:id},function(result){
  59 + var date = "";
  60 + $("#sheetList").on('init', function (e, id) {
  61 + no=id.split(",")[0];
  62 + var dates = id.split(",")[1].split("-");
  63 + date = dates[0] + dates[1] + dates[2];
  64 + $get('/sheet/sheetList',{id:no},function(result){
62 65 var sheetList_2 = template('sheetList_2',{list:result});
63 66 $('#forms_2 tbody').html(sheetList_2);
64 67 });
65   - })
66   - $("#exportList").on('click',function(){
67   - $("#forms_2").table2excel({
68   - // 不被导出的表格行的CSS class类
69   - exclude: ".noExl",
70   - // 导出的Excel文档的名称,(没看到作用)
71   - name: "Excel Document Name.xlsx",
72   - // Excel文件的名称
73   - filename: "班次准点率"
74   - });
75   -// $get('/sheet/exportList',params,function(result){
76   -// window.open("/downloadFile/download?fileName=班次车辆人员月报表"+moment($("#startDate").val()).format("YYYYMMDD"));
  68 + })
  69 + $("#exportList").on('click',function(){
  70 +// $("#forms_2").table2excel({
  71 +// // 不被导出的表格行的CSS class类
  72 +// exclude: ".noExl",
  73 +// // 导出的Excel文档的名称,(没看到作用)
  74 +// name: "Excel Document Name.xlsx",
  75 +// // Excel文件的名称
  76 +// filename: "班次准点率"
77 77 // });
  78 + var i = layer.load(2);
  79 + $get('/sheet/exportList',{id:no},function(result){
  80 + window.open("/downloadFile/download?fileName=发车准点率"+date);
  81 + layer.close(i);
  82 + });
78 83 });
79 84  
80 85  
... ...
src/main/resources/static/pages/report/sheet/sheetList.html
... ... @@ -31,7 +31,7 @@
31 31 <span class="item-label" style="width: 80px;">公司: </span>
32 32 <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
33 33 </div>
34   - <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv">
  34 + <div style="display: inline-block; margin-left: 38px;" id="fgsdmDiv">
35 35 <span class="item-label" style="width: 80px;">分公司: </span>
36 36 <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
37 37 </div>
... ... @@ -51,6 +51,7 @@
51 51 </div>
52 52  
53 53 <div class="form-group">
  54 + <input type="hidden" id="id"/>
54 55 <input class="btn btn-default" type="button" id="query" value="查询"/>
55 56 <input class="btn btn-default" type="button" id="export" value="导出"/>
56 57 </div>
... ... @@ -244,9 +245,9 @@
244 245 $("#fgsdm").attr("disabled", true);
245 246 }
246 247 });
  248 +
  249 + $("#export").attr('disabled',"true");
247 250  
248   -
249   -
250 251 //查询
251 252 $("#query").on('click',function(){
252 253 var line = $("#line").val();
... ... @@ -263,14 +264,19 @@
263 264 $('#forms_h tbody').html(sheetList_h);
264 265 $('.btn-sheetList').on('click', showSheetList);
265 266 layer.close(i);
  267 + if(result.length == 0)
  268 + $("#export").attr('disabled',"true");
  269 + else
  270 + $("#export").removeAttr("disabled");
266 271 });
267   -// $post('/sheet/saveListSheet',function(result){
  272 +// $post('/sheet/saveListSheet',function(result){
268 273 // });
269 274 });
270 275 function showSheetList(){
271 276 var id = $(this).data('id');
272 277 var date = $("#date").val();
273 278 var endDate = $("#endDate").val();
  279 + $("#id").val(id);
274 280 $get('/sheet/listSheet',{id:id,date:date,endDate:endDate},function(result){
275 281 var sheetList = template('sheetList_1',{list:result});
276 282 var sheetList_h = template('sheetList_1_h',{list:result});
... ... @@ -285,6 +291,7 @@
285 291 }
286 292 function openSheetList(){
287 293 var id = $(this).data('id');
  294 + id += ","+$(this).data('date');
288 295 $.get('/pages/report/sheet/list.html', function (content) {
289 296 layer.open({
290 297 type: 1,
... ... @@ -300,29 +307,43 @@
300 307 });
301 308 }
302 309 $("#export").on("click",function(){
  310 + var line = $("#line").val();
303 311 var date = $("#date").val();
304 312 var endDate = $("#endDate").val();
305   - $("#forms_h").table2excel({
306   - // 不被导出的表格行的CSS class类
307   - exclude: ".noExl",
308   - // 导出的Excel文档的名称,(没看到作用)
309   - name: "Excel Document Name.xlsx",
310   - // Excel文件的名称
311   - filename: date+"-"+endDate+"班次准点率"
  313 + var fgs=$('#fgsdm').val();
  314 + var gs=$('#gsdm').val();
  315 + var i = layer.load(2);
  316 + $get('/sheet/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs,type:"export"},function(result){
  317 + window.open("/downloadFile/download?fileName=发车准点率"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  318 + layer.close(i);
312 319 });
313   - })
  320 +// $("#forms_h").table2excel({
  321 +// // 不被导出的表格行的CSS class类
  322 +// exclude: ".noExl",
  323 +// // 导出的Excel文档的名称,(没看到作用)
  324 +// name: "Excel Document Name.xlsx",
  325 +// // Excel文件的名称
  326 +// filename: date+"-"+endDate+"班次准点率"
  327 +// });
  328 + });
314 329  
315 330 $("#export_1").on("click",function(){
  331 + var id = $("#id").val();
316 332 var date = $("#date").val();
317 333 var endDate = $("#endDate").val();
318   - $("#forms_1_h").table2excel({
319   - // 不被导出的表格行的CSS class类
320   - exclude: ".noExl",
321   - // 导出的Excel文档的名称,(没看到作用)
322   - name: "Excel Document Name.xlsx",
323   - // Excel文件的名称
324   - filename: date+"-"+endDate+"班次准点率"
  334 + var i = layer.load(2);
  335 + $get('/sheet/listSheet',{id:id,date:date,endDate:endDate,type:"export"},function(result){
  336 + window.open("/downloadFile/download?fileName=发车准点率"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  337 + layer.close(i);
325 338 });
  339 +// $("#forms_1_h").table2excel({
  340 +// // 不被导出的表格行的CSS class类
  341 +// exclude: ".noExl",
  342 +// // 导出的Excel文档的名称,(没看到作用)
  343 +// name: "Excel Document Name.xlsx",
  344 +// // Excel文件的名称
  345 +// filename: date+"-"+endDate+"班次准点率"
  346 +// });
326 347 })
327 348  
328 349 });
... ... @@ -379,7 +400,7 @@
379 400 <td>{{obj.zdlv}}</td>
380 401 <td>
381 402 <button type="button" class="btn btn-sm blue btn-sheetList_1"
382   - data-id="{{obj.id}}">详细</button>
  403 + data-id="{{obj.id}}" data-date="{{obj.date}}">详细</button>
383 404 </td>
384 405 </tr>
385 406 {{/each}}
... ...