Commit 847da57b5bd9c7eba24e56e077b97b14310a510f

Authored by 娄高锋
1 parent 7b74fdeb

路单线路明细月报表、年报表,关掉线路授权条件(也可以在页面端打开传参)。

src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
@@ -90,4 +90,22 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ @@ -90,4 +90,22 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ
90 "and c.xl in (select l.lineCode from Line l where l.destroy in (?6)) order by c.fgsdm,c.xl,c.rqStr") 90 "and c.xl in (select l.lineCode from Line l where l.destroy in (?6)) order by c.fgsdm,c.xl,c.rqStr")
91 List<CalcWaybill> scheduleByDateAndLineTjPx(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy); 91 List<CalcWaybill> scheduleByDateAndLineTjPx(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
92 92
  93 +
  94 + //按照时间段统计,公司下线路 (驾驶员)(全部线路)
  95 + @Query(value="select DISTINCT c from CalcWaybill c where c.rqStr between ?1 and ?2 and c.gsdm in(?3) and c.fgsdm in(?4) " +
  96 + "and c.xl in (select l.lineCode from Line l where l.destroy in (?5)) order by c.jGh,c.fgsdm,c.xl,c.rqStr")
  97 + List<CalcWaybill> scheduleByJsy2AllLine(String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
  98 + //按照时间段统计,公司下线路 (售票员)(全部线路)
  99 + @Query(value="select DISTINCT c from CalcWaybill c where c.rqStr between ?1 and ?2 and c.gsdm in(?3) and c.fgsdm in(?4) and c.sGh <> null and c.sGh <> '' " +
  100 + "and c.xl in (select l.lineCode from Line l where l.destroy in (?5)) order by c.sGh,c.fgsdm,c.xl,c.rqStr")
  101 + List<CalcWaybill> scheduleBySpy2AllLine(String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
  102 + //按照时间段统计,公司下线路 (车辆自编号)(全部线路)
  103 + @Query(value="select DISTINCT c from CalcWaybill c where c.rqStr between ?1 and ?2 and c.gsdm in(?3) and c.fgsdm in(?4) " +
  104 + "and c.xl in (select l.lineCode from Line l where l.destroy in (?5)) order by c.cl,c.fgsdm,c.xl,c.rqStr")
  105 + List<CalcWaybill> scheduleByZbh2AllLine(String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
  106 + //按照时间段统计,公司下线路 排序不同(全部线路)
  107 + @Query(value="select DISTINCT c from CalcWaybill c where c.rqStr between ?1 and ?2 and c.gsdm in(?3) and c.fgsdm in(?4) " +
  108 + "and c.xl in (select l.lineCode from Line l where l.destroy in (?5)) order by c.fgsdm,c.xl,c.rqStr")
  109 + List<CalcWaybill> scheduleByDateAndLineTjPxAllLine(String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
  110 +
93 } 111 }
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -45,6 +45,7 @@ import org.springframework.beans.BeanUtils; @@ -45,6 +45,7 @@ import org.springframework.beans.BeanUtils;
45 import org.springframework.beans.factory.annotation.Autowired; 45 import org.springframework.beans.factory.annotation.Autowired;
46 import org.springframework.jdbc.core.JdbcTemplate; 46 import org.springframework.jdbc.core.JdbcTemplate;
47 import org.springframework.jdbc.core.RowMapper; 47 import org.springframework.jdbc.core.RowMapper;
  48 +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
48 import org.springframework.stereotype.Service; 49 import org.springframework.stereotype.Service;
49 50
50 import javax.transaction.Transactional; 51 import javax.transaction.Transactional;
@@ -1930,7 +1931,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1930,7 +1931,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1930 fgsdm.add(fgsdms[i]); 1931 fgsdm.add(fgsdms[i]);
1931 } 1932 }
1932 } 1933 }
1933 -// String line= null;  
1934 List<String> line= new ArrayList<>(); 1934 List<String> line= new ArrayList<>();
1935 String lineStr = ""; 1935 String lineStr = "";
1936 if(map.get("lineCode")!=null){ 1936 if(map.get("lineCode")!=null){
@@ -1960,18 +1960,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1960,18 +1960,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1960 if(map.get("itemDetails")!=null){ 1960 if(map.get("itemDetails")!=null){
1961 itemDetails=map.get("itemDetails").toString().trim(); 1961 itemDetails=map.get("itemDetails").toString().trim();
1962 } 1962 }
1963 -// Boolean item=false;  
1964 - /*String item="";  
1965 - if(map.get("item")!=null){  
1966 - if("dh".equals(map.get("item").toString().trim()))  
1967 - item=" where c.sfdc = 1";  
1968 -// item=false;  
1969 - else if ("dh".equals(map.get("item").toString().trim()))  
1970 - item=" where c.sfdc = 0";  
1971 -// item=true;  
1972 - else  
1973 - item="";  
1974 - }*/  
1975 String timeType=map.get("timeType").toString().trim(); 1963 String timeType=map.get("timeType").toString().trim();
1976 1964
1977 List<List<String>> resList = new ArrayList<>(); 1965 List<List<String>> resList = new ArrayList<>();
@@ -2005,24 +1993,34 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -2005,24 +1993,34 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2005 } 1993 }
2006 1994
2007 int flag = 0; 1995 int flag = 0;
2008 - if("jsy".equals(statisticalObj)){  
2009 - flag = 1;  
2010 - list = calcRepository.scheduleByJsy2(line, startDate, endDate, gsdm, fgsdm, destroy);  
2011 - } else if("cwy".equals(statisticalObj)){  
2012 - flag = 2;  
2013 - list = calcRepository.scheduleBySpy2(line, startDate, endDate, gsdm, fgsdm, destroy);  
2014 - } else if("cl".equals(statisticalObj)){  
2015 - flag = 3;  
2016 - list = calcRepository.scheduleByZbh2(line, startDate, endDate, gsdm, fgsdm, destroy);  
2017 - } else if("xl".equals(statisticalObj)){  
2018 - flag = 4;  
2019 - list = calcRepository.scheduleByDateAndLineTjPx(line,startDate,endDate,gsdm,fgsdm, destroy);  
2020 - /*if(line.equals("")){  
2021 - //查询所有线路  
2022 - }else{  
2023 - //查询单条线路  
2024 - list = calcRepository.scheduleByDateAndLineTjPx2(line,startDate,endDate);  
2025 - }*/ 1996 + if(!lineStr.equals("")){
  1997 + if("jsy".equals(statisticalObj)){
  1998 + flag = 1;
  1999 + list = calcRepository.scheduleByJsy2(line, startDate, endDate, gsdm, fgsdm, destroy);
  2000 + } else if("cwy".equals(statisticalObj)){
  2001 + flag = 2;
  2002 + list = calcRepository.scheduleBySpy2(line, startDate, endDate, gsdm, fgsdm, destroy);
  2003 + } else if("cl".equals(statisticalObj)){
  2004 + flag = 3;
  2005 + list = calcRepository.scheduleByZbh2(line, startDate, endDate, gsdm, fgsdm, destroy);
  2006 + } else if("xl".equals(statisticalObj)){
  2007 + flag = 4;
  2008 + list = calcRepository.scheduleByDateAndLineTjPx(line, startDate, endDate, gsdm, fgsdm, destroy);
  2009 + }
  2010 + } else {
  2011 + if("jsy".equals(statisticalObj)){
  2012 + flag = 1;
  2013 + list = calcRepository.scheduleByJsy2AllLine(startDate, endDate, gsdm, fgsdm, destroy);
  2014 + } else if("cwy".equals(statisticalObj)){
  2015 + flag = 2;
  2016 + list = calcRepository.scheduleBySpy2AllLine(startDate, endDate, gsdm, fgsdm, destroy);
  2017 + } else if("cl".equals(statisticalObj)){
  2018 + flag = 3;
  2019 + list = calcRepository.scheduleByZbh2AllLine(startDate, endDate, gsdm, fgsdm, destroy);
  2020 + } else if("xl".equals(statisticalObj)){
  2021 + flag = 4;
  2022 + list = calcRepository.scheduleByDateAndLineTjPxAllLine(startDate, endDate, gsdm, fgsdm, destroy);
  2023 + }
2026 } 2024 }
2027 2025
2028 2026
@@ -2041,28 +2039,50 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -2041,28 +2039,50 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2041 // 只有在选择 车辆,驾驶员查询时才有 2039 // 只有在选择 车辆,驾驶员查询时才有
2042 // 把油量和电量数据查出来,封装成Map,计算时直接取 2040 // 把油量和电量数据查出来,封装成Map,计算时直接取
2043 if(flag != 2 ){ 2041 if(flag != 2 ){
  2042 + Map<String, Object> named_yl = new HashMap<String, Object>();
  2043 + Map<String, Object> named_dl = new HashMap<String, Object>();
  2044 + Map<String, Object> named_ql = new HashMap<String, Object>();
  2045 + named_yl.put("startDate", startDate);
  2046 + named_yl.put("endDate", endDate);
  2047 + named_dl.put("startDate", startDate);
  2048 + named_dl.put("endDate", endDate);
  2049 + named_ql.put("startDate", startDate);
  2050 + named_ql.put("endDate", endDate);
  2051 +
2044 String linesql=""; 2052 String linesql="";
2045 if(!lineStr.equals("")){ 2053 if(!lineStr.equals("")){
2046 - linesql +=" and xlbm in("+lineStr+") "; 2054 +// linesql +=" and xlbm in("+lineStr+") ";
  2055 + linesql +=" and xlbm in(:line) ";
  2056 + named_yl.put("line", line);
  2057 + named_dl.put("line", line);
  2058 + named_ql.put("line", line);
2047 } 2059 }
2048 if(!gsdmStr.equals("")){ 2060 if(!gsdmStr.equals("")){
2049 - linesql +=" and ssgsdm in("+gsdmStr+") "; 2061 +// linesql +=" and ssgsdm in("+gsdmStr+") ";
  2062 + linesql +=" and ssgsdm in(:gsdm) ";
  2063 + named_yl.put("gsdm", gsdm);
  2064 + named_dl.put("gsdm", gsdm);
  2065 + named_ql.put("gsdm", gsdm);
2050 } 2066 }
2051 if(!fgsdmStr.equals("")){ 2067 if(!fgsdmStr.equals("")){
2052 - linesql +=" and fgsdm in("+fgsdmStr+") "; 2068 +// linesql +=" and fgsdm in("+fgsdmStr+") ";
  2069 + linesql +=" and fgsdm in(:fgsdm) ";
  2070 + named_yl.put("fgsdm", fgsdm);
  2071 + named_dl.put("fgsdm", fgsdm);
  2072 + named_ql.put("fgsdm", fgsdm);
2053 } 2073 }
2054 String ylsql="SELECT * FROM bsth_c_ylb" 2074 String ylsql="SELECT * FROM bsth_c_ylb"
2055 -// String ylsql="SELECT id,xlbm,nbbm,jsy,jzl,czyl,jzyl,yh,sh,fgsdm FROM bsth_c_ylb"  
2056 - + " WHERE rq >= '"+startDate+"' and rq <= '"+endDate+"' " 2075 + + " WHERE rq >= :startDate and rq <= :endDate "
2057 + linesql; 2076 + linesql;
2058 String dlSal= " SELECT * FROM bsth_c_dlb" 2077 String dlSal= " SELECT * FROM bsth_c_dlb"
2059 -// String dlSal= " SELECT id,xlbm,nbbm,jsy,cdl,czcd,jzcd,hd,sh,fgsdm FROM bsth_c_dlb"  
2060 - + " WHERE rq >= '"+startDate+"' and rq <= '"+endDate+"' " 2078 + + " WHERE rq >= :startDate and rq <= :endDate "
2061 + linesql; 2079 + linesql;
2062 String qlSal= " SELECT * FROM bsth_c_qlb" 2080 String qlSal= " SELECT * FROM bsth_c_qlb"
2063 - + " WHERE rq >= '"+startDate+"' and rq <= '"+endDate+"' " 2081 + + " WHERE rq >= :startDate and rq <= :endDate "
2064 + linesql; 2082 + linesql;
2065 - List<Ylb> ylbList = jdbcTemplate.query(ylsql, new RowMapper<Ylb>() { 2083 + NamedParameterJdbcTemplate namedJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
  2084 + List<Ylb> ylbList = namedJdbcTemplate.query(ylsql, named_yl, new RowMapper<Ylb>() {
  2085 +// List<Ylb> ylbList = jdbcTemplate.query(ylsql, new RowMapper<Ylb>() {
2066 @Override 2086 @Override
2067 public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException{ 2087 public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException{
2068 Ylb ylb = new Ylb(); 2088 Ylb ylb = new Ylb();
@@ -2089,7 +2109,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -2089,7 +2109,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2089 return ylb; 2109 return ylb;
2090 } 2110 }
2091 }); 2111 });
2092 - List<Dlb> dlbList = jdbcTemplate.query(dlSal, new RowMapper<Dlb>() { 2112 + List<Dlb> dlbList = namedJdbcTemplate.query(dlSal, named_dl, new RowMapper<Dlb>() {
  2113 +// List<Dlb> dlbList = jdbcTemplate.query(dlSal, new RowMapper<Dlb>() {
2093 @Override 2114 @Override
2094 public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { 2115 public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
2095 Dlb dlb = new Dlb();Date rq = null; 2116 Dlb dlb = new Dlb();Date rq = null;
@@ -2113,7 +2134,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -2113,7 +2134,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2113 return dlb; 2134 return dlb;
2114 } 2135 }
2115 }); 2136 });
2116 - List<Qlb> qlbList = jdbcTemplate.query(qlSal, new RowMapper<Qlb>() { 2137 + List<Qlb> qlbList = namedJdbcTemplate.query(qlSal, named_ql, new RowMapper<Qlb>() {
  2138 +// List<Qlb> qlbList = jdbcTemplate.query(qlSal, new RowMapper<Qlb>() {
2117 @Override 2139 @Override
2118 public Qlb mapRow(ResultSet arg0, int arg1) throws SQLException { 2140 public Qlb mapRow(ResultSet arg0, int arg1) throws SQLException {
2119 Qlb qlb = new Qlb();Date rq = null; 2141 Qlb qlb = new Qlb();Date rq = null;
src/main/resources/static/pages/forms/calc/calcDetailMonthly.html
1 -<style type="text/css">  
2 - .table-bordered {  
3 - border: 1px solid; }  
4 - .table-bordered > thead > tr > th,  
5 - .table-bordered > thead > tr > td,  
6 - .table-bordered > tbody > tr > th,  
7 - .table-bordered > tbody > tr > td,  
8 - .table-bordered > tfoot > tr > th,  
9 - .table-bordered > tfoot > tr > td {  
10 - border: 1px solid;  
11 - text-align: center; }  
12 - .table-bordered > thead > tr > th,  
13 - .table-bordered > thead > tr > td {  
14 - border-bottom-width: 2px; }  
15 -  
16 - .table > tbody + tbody {  
17 - border-top: 1px solid; }  
18 -  
19 -  
20 - #analy_body tr> td >span{  
21 - word-break: keep-all;white-space:nowrap;  
22 - }  
23 -  
24 - #analy_body td{  
25 - min-width: 100px;  
26 - max-width: 100px;  
27 - width: 100px;  
28 - }  
29 -  
30 - #analy_body{  
31 - margin-top: 20px;  
32 - height: 620px;  
33 - width: 100%  
34 - }  
35 -  
36 -  
37 - .table_head::-webkit-scrollbar {  
38 - display:none  
39 - }  
40 -  
41 - .table_head{  
42 - min-width: 906px;  
43 - width: 100%;  
44 - overflow: hidden;  
45 - }  
46 -  
47 - .table_body{  
48 - width:101%;  
49 - height:580px;  
50 - overflow: auto;  
51 - margin-top: -20px;  
52 - }  
53 -</style>  
54 -<div class="page-head">  
55 - <div class="page-title">  
56 - <h1>路单线路明细月报表</h1>  
57 - </div>  
58 -</div>  
59 -  
60 -<!--<div class="row">-->  
61 -<div class=" row col-md-12 portlet light bordered" style="height:calc(100% - 38px)">  
62 - <div class="">  
63 - <form class="form-inline" >  
64 - <div style="display: inline-block; margin-left: 13px;" id="gsdmDiv_daily">  
65 - <span class="item-label" style="width: 80px;">&#12288;&#12288;公司: </span>  
66 - <select class="form-control" name="company" id="gsdm" style="width: 150px;"></select>  
67 - </div>  
68 - <div style="display: inline-block; margin-left: 13px;" id="fgsdmDiv_daily">  
69 - <span class="item-label" style="width: 80px;">&#12288;分公司: </span>  
70 - <select class="form-control" name="fgsdm" id="fgsdm" style="width: 150px;"></select>  
71 - </div>  
72 - <!--<div style="display: inline-block;margin-left: 33px;">  
73 - <span class="item-label" style="width: 80px;">&#12288;&#12288;线路: </span>  
74 - <select class="form-control" name="line" id="line" style="width: 180px;"></select>  
75 - </div>-->  
76 - <div style="display: inline-block;margin-left: 13px;" class="date-picker">  
77 - <span class="item-label" style="width: 80px;">&#12288;&#12288;时间: </span>  
78 - <input class="form-control" type="text" id="startDate" style="width: 150px;" /> -  
79 - <input class="form-control" type="text" id="endDate" style="width: 150px;" />  
80 - <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->  
81 - <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->  
82 - </div>  
83 -  
84 - <div style="margin-top: 2px"></div>  
85 -  
86 - <div style="display: inline-block; margin-left: 13px;">  
87 - <span class="item-label" style="width: 80px;">线路性质: </span>  
88 - <select class="form-control" name="destroy" id="destroy" style="width: 150px;">  
89 - <option value="0,1">全部线路</option>  
90 - <option value="0">营运线路</option>  
91 - <option value="1">非营运线路</option>  
92 - </select>  
93 - </div>  
94 - <div style="display: inline-block;margin-left: 13px;">  
95 - <span class="item-label" style="width: 80px;">统计对象: </span>  
96 - <select class="form-control" name="statisticalObj" id="statisticalObj" style="width: 150px;">  
97 - <option value="cl">车辆</option>  
98 - <option value="jsy">驾驶员</option>  
99 - <option value="cwy">乘务员</option>  
100 - <option value="xl">线路</option>  
101 - </select>  
102 - </div>  
103 -  
104 - <div style="display: inline-block; margin-left: 13px;" >  
105 - <span class="item-label" style="width: 80px;">统计项目: </span>  
106 - <select class="form-control" name="statisticalItem" id="statisticalItem" style="width: 150px;">  
107 - <option value="yh">油耗</option>  
108 - <option value="dh">电耗</option>  
109 - <option value="qh">氢耗</option>  
110 - <option value="gl">公里</option>  
111 - <option value="bc">班次</option>  
112 - </select>  
113 - </div>  
114 - <div style="display: inline-block; margin-left: 13px;" >  
115 - <span class="item-label" style="width: 80px;">项目明细: </span>  
116 - <select class="form-control" name="itemDetails" id="itemDetails" style="width: 150px;"></select>  
117 - </div>  
118 - <div class="form-group" style="display: inline-block;margin-left: 22px;">  
119 - <input class="btn btn-default" type="button" id="query" value="筛选"/>  
120 - <input class="btn btn-default" type="button" id="export" value="导出"/>  
121 - </div>  
122 - </form>  
123 - </div>  
124 -  
125 - <div id="analy_body">  
126 - <div class="table_head" id="table_head">  
127 - <table class="table table-bordered table-hover table-checkable " id="forms_head">  
128 - <thead>  
129 - </thead>  
130 - </table>  
131 - </div>  
132 - <div class="table_body" id="table_body">  
133 - <table class="table table-bordered table-hover table-checkable" id="forms_body">  
134 - <tbody>  
135 - </tbody>  
136 - </table>  
137 - </div>  
138 - </div>  
139 -</div>  
140 -<script >  
141 - $(function(){  
142 - $('#export').attr('disabled', "true");  
143 - // 关闭左侧栏  
144 - if (!$('body').hasClass('page-sidebar-closed'))  
145 - $('.menu-toggler.sidebar-toggler').click();  
146 -  
147 - var table_body1 = document.getElementById("table_body");  
148 - table_body1.onscroll = function(){  
149 - var table_body1_left = this.scrollLeft;  
150 - document.getElementById("table_head").scrollLeft = table_body1_left;  
151 - };  
152 -  
153 - var d = new Date();  
154 - d.setTime(d.getTime() - 4*1000*60*60*24);//只能查4天以前的数据  
155 - var year = d.getFullYear();  
156 - var month = d.getMonth() + 1;  
157 - var day = d.getDate();  
158 - if(month < 10)  
159 - month = "0" + month;  
160 - if(day < 10)  
161 - day = "0" + day;  
162 - //时间  
163 - var dateTime=year + "-" + month + "-" + day;  
164 - $("#startDate").val(dateTime);  
165 - $("#endDate").val(dateTime);  
166 -  
167 - $("#endDate").datetimepicker({  
168 - format : 'YYYY-MM-DD',  
169 - locale : 'zh-cn',  
170 - maxDate : dateTime  
171 - });  
172 - $("#startDate").datetimepicker({  
173 - format : 'YYYY-MM-DD',  
174 - locale : 'zh-cn',  
175 - maxDate : dateTime  
176 - });  
177 -  
178 - var lineAll="";  
179 - var datas = {}; //查询条件  
180 -  
181 - /**用户分配的线路*/  
182 - $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {  
183 - lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);  
184 - });  
185 -  
186 - var tempData = {};  
187 -  
188 - $.get('/user/companyData', function(result){  
189 - var obj = result;  
190 - var options = '';  
191 - for(var i = 0; i < obj.length; i++){  
192 - options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';  
193 - }  
194 -  
195 - if(obj.length ==0){  
196 - $("#gsdmDiv_daily").css('display','none');  
197 - }else if(obj.length ==1){  
198 - $("#gsdmDiv_daily").css('display','none');  
199 - if(obj[0].children.length == 1 || obj[0].children.length == 0){  
200 - fage=false;  
201 - $('#gsdmDiv_daily').css('display','none');  
202 - }  
203 - }  
204 - $('#gsdm').html(options);  
205 - updateCompany();  
206 - });  
207 - $("#gsdm").on("change",updateCompany);  
208 -  
209 - function updateCompany(){  
210 - var company = $('#gsdm').val();  
211 - $.get('/user/companyData', function(obj) {  
212 - var option = '';  
213 - var allC = "";  
214 - for (var i = 0; i < obj.length; i++) {  
215 - if (obj[i].companyCode == company) {  
216 - var children = obj[i].children;  
217 - for (var j = 0; j < children.length; j++) {  
218 - allC += children[j].code+",";  
219 - option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';  
220 - }  
221 - }  
222 - }  
223 -  
224 - var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;  
225 - $('#fgsdm').html(options);  
226 - });  
227 - }  
228 -  
229 - // 项目明细选项列  
230 - // 触发默认选项  
231 - updateItem();  
232 - $("#statisticalItem").on("change",updateItem);  
233 - function updateItem() {  
234 - var item = $('#statisticalItem').val();  
235 - var options = '';  
236 - if(item == "yh"){  
237 - options += '<option value="jzlAll">加注量[全部]</option>' +  
238 - '<option value="jzl0">加注量[0#]</option>'+  
239 - '<option value="jzl-10">加注量[-10#]</option>'+  
240 - '<option value="yhl">油耗量</option>'+  
241 - '<option value="cccy">出场存油</option>'+  
242 - '<option value="jccy">进场存油</option>'+  
243 - '<option value="bglyh">百公里油耗</option>';  
244 - } else if(item == "gl"){  
245 - options += '<option value="zgl">总公里</option>' +  
246 - '<option value="jhgl">计划公里</option>';  
247 - /*'<option value="jclm">进场路码</option>'+  
248 - '<option value="cclm">出场路码</option>'*/  
249 - } else if(item == "bc"){  
250 - options += '<option value="sjbc">实际班次</option>' +  
251 - '<option value="jhbc">计划班次</option>';  
252 - } else if(item == "dh"){  
253 - options += '<option value="dh">耗电量</option>';  
254 - options += '<option value="cdl">充电量</option>';  
255 - options += '<option value="cccd">出场存电</option>';  
256 - options += '<option value="jccd">进场存电</option>';  
257 - options += '<option value="bgldh">百公里电耗</option>';  
258 - } else if(item == "qh"){  
259 - options += '<option value="qh">耗氢量</option>';  
260 - options += '<option value="cql">充氢量</option>';  
261 - options += '<option value="cccq">出场存氢</option>';  
262 - options += '<option value="jccq">进场存氢</option>';  
263 - options += '<option value="bglqh">百公里氢耗</option>';  
264 - }  
265 - $('#itemDetails').html(options);  
266 - }  
267 -  
268 - //线路名称  
269 - var lineName = '';  
270 - $("#query").on("click",function(){  
271 - var gsdm = $("#gsdm").val();  
272 - var fgsdm = $("#fgsdm").val();  
273 - var startDate = $("#startDate").val();  
274 - var endDate = $("#endDate").val();  
275 - var statisticalObj = $("#statisticalObj").val();  
276 - //开始和结束时间  
277 - var startTime = Date.parse(new Date(startDate));  
278 - var endTime = Date.parse(new Date(endDate));  
279 -  
280 - datas = {}; // 清空之前数据  
281 - datas.gsdm = gsdm;  
282 - datas.fgsdm = fgsdm;  
283 - datas.lineCode = lineAll;  
284 - datas.timeType = "m";  
285 - datas.startDate = startDate;  
286 - datas.endDate = endDate;  
287 - datas.destroy = $("#destroy").val();  
288 - datas.statisticalObj = $("#statisticalObj").val();  
289 - datas.itemDetails = $("#itemDetails").val();  
290 - var itemDetails = datas.itemDetails,  
291 - type = "加注量[全部]";  
292 - if(itemDetails=="jzl0"){  
293 - type = "加注量[0#]"  
294 - } else if(itemDetails=="jzl-10"){  
295 - type = "加注量[-10#]"  
296 - } else if(itemDetails=="yhl"){  
297 - type = "油耗量"  
298 - } else if(itemDetails=="cccy"){  
299 - type = "出场存油"  
300 - } else if(itemDetails=="jccy"){  
301 - type = "进场存油"  
302 - } else if(itemDetails=="bglyh"){  
303 - type = "百公里油耗"  
304 - } else if(itemDetails=="zgl"){  
305 - type = "总公里"  
306 - } else if(itemDetails=="jhgl"){  
307 - type = "计划公里"  
308 - } else if(itemDetails=="jclm"){  
309 - type = "进场路码"  
310 - } else if(itemDetails=="cclm"){  
311 - type = "出场路码"  
312 - } else if(itemDetails=="sjbc"){  
313 - type = "实际班次"  
314 - } else if(itemDetails=="jhbc"){  
315 - type = "计划班次"  
316 - } else if(itemDetails=="dh"){  
317 - type = "耗电量"  
318 - } else if(itemDetails=="cdl"){  
319 - type = "充电量"  
320 - } else if(itemDetails=="cccd"){  
321 - type = "出场存电"  
322 - } else if(itemDetails=="jccd"){  
323 - type = "进场存电"  
324 - } else if(itemDetails=="bgldh"){  
325 - type = "百公里电耗"  
326 - } else if(itemDetails=="qh"){  
327 - type = "耗氢量"  
328 - } else if(itemDetails=="cql"){  
329 - type = "充氢量"  
330 - } else if(itemDetails=="cccq"){  
331 - type = "出场存氢"  
332 - } else if(itemDetails=="jccq"){  
333 - type = "进场存氢"  
334 - } else if(itemDetails=="bglqh"){  
335 - type = "百公里氢耗"  
336 - }  
337 - datas.name = datas.startDate+"-"+datas.endDate+"-路单线路明细月报表("+type+")";  
338 - if(startDate==null || startDate =="" ||endDate==null || endDate ==""){  
339 - layer.msg('请选择时间段!');  
340 - }else if(endTime<startTime){  
341 - layer.msg('结束日期不能小于开始日期!');  
342 - }else {  
343 - if (endDate.substring(0, 7) != startDate.substring(0, 7)) {  
344 - layer.msg("请查询同月份数据!");  
345 - return;  
346 - } else {  
347 - var lodingI = layer.load(2);  
348 - $get('/calcWaybill/calcDetailMonthly', datas, function (rs) {  
349 - if (rs.length <=0) {  
350 - layer.close(lodingI);  
351 - layer.open({  
352 - title: '提示'  
353 - , content: '没有您要查询的数据,请重新选择参数!'  
354 - });  
355 - $("#export").attr('disabled',"true");  
356 - return;  
357 - }else  
358 - $("#export").removeAttr("disabled");  
359 - var htmlHead = "<tr><td colspan='"+rs[0].length+"'>"+datas.name+"</td></tr>", htmlBody = "";  
360 - var rsLength = rs.length;  
361 - rs.forEach(function (o, i) {  
362 - var html = "<tr>"  
363 - o.forEach(function (td, j) {  
364 - var colspan;  
365 - if (i == rsLength - 1 && j == 0) {  
366 - colspan = (statisticalObj == "xl" ? "colspan='3'" : "colspan='5'");  
367 - if(statisticalObj == "cl")  
368 - colspan = "colspan='6'";  
369 - }  
370 - html += "<td " + colspan + ">" + td + "</td>"  
371 - });  
372 - html += "</tr>"  
373 - if (i == 0) {  
374 - htmlHead += html;  
375 - } else  
376 - htmlBody += html;  
377 - });  
378 - $('#forms_head thead').html(htmlHead);  
379 - $('#forms_body tbody').html(htmlBody);  
380 - layer.close(lodingI);  
381 - });  
382 - }  
383 - }  
384 - });  
385 -  
386 - $("#export").on("click",function(){  
387 - $post("/report/calcDetailMonthlyE",datas,function(result){  
388 - window.open("/downloadFile/download?fileName="+datas.name);  
389 - });  
390 - });  
391 - });  
392 -</script>  
393 -<!--<script type="application/javascript" src="/pages/forms/calc/calcDetailMonthly.js"></script>--> 1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid;
  11 + text-align: center; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +
  19 +
  20 + #analy_body tr> td >span{
  21 + word-break: keep-all;white-space:nowrap;
  22 + }
  23 +
  24 + #analy_body td{
  25 + min-width: 100px;
  26 + max-width: 100px;
  27 + width: 100px;
  28 + }
  29 +
  30 + #analy_body{
  31 + margin-top: 20px;
  32 + height: 620px;
  33 + width: 100%
  34 + }
  35 +
  36 +
  37 + .table_head::-webkit-scrollbar {
  38 + display:none
  39 + }
  40 +
  41 + .table_head{
  42 + min-width: 906px;
  43 + width: 100%;
  44 + overflow: hidden;
  45 + }
  46 +
  47 + .table_body{
  48 + width:101%;
  49 + height:580px;
  50 + overflow: auto;
  51 + margin-top: -20px;
  52 + }
  53 +</style>
  54 +<div class="page-head">
  55 + <div class="page-title">
  56 + <h1>路单线路明细月报表</h1>
  57 + </div>
  58 +</div>
  59 +
  60 +<!--<div class="row">-->
  61 +<div class=" row col-md-12 portlet light bordered" style="height:calc(100% - 38px)">
  62 + <div class="">
  63 + <form class="form-inline" >
  64 + <div style="display: inline-block; margin-left: 13px;" id="gsdmDiv_daily">
  65 + <span class="item-label" style="width: 80px;">&#12288;&#12288;公司: </span>
  66 + <select class="form-control" name="company" id="gsdm" style="width: 150px;"></select>
  67 + </div>
  68 + <div style="display: inline-block; margin-left: 13px;" id="fgsdmDiv_daily">
  69 + <span class="item-label" style="width: 80px;">&#12288;分公司: </span>
  70 + <select class="form-control" name="fgsdm" id="fgsdm" style="width: 150px;"></select>
  71 + </div>
  72 + <!--<div style="display: inline-block;margin-left: 33px;">
  73 + <span class="item-label" style="width: 80px;">&#12288;&#12288;线路: </span>
  74 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  75 + </div>-->
  76 + <div style="display: inline-block;margin-left: 13px;" class="date-picker">
  77 + <span class="item-label" style="width: 80px;">&#12288;&#12288;时间: </span>
  78 + <input class="form-control" type="text" id="startDate" style="width: 150px;" /> -
  79 + <input class="form-control" type="text" id="endDate" style="width: 150px;" />
  80 + <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->
  81 + <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->
  82 + </div>
  83 +
  84 + <div style="margin-top: 2px"></div>
  85 +
  86 + <div style="display: inline-block; margin-left: 13px;">
  87 + <span class="item-label" style="width: 80px;">线路性质: </span>
  88 + <select class="form-control" name="destroy" id="destroy" style="width: 150px;">
  89 + <option value="0,1">全部线路</option>
  90 + <option value="0">营运线路</option>
  91 + <option value="1">非营运线路</option>
  92 + </select>
  93 + </div>
  94 + <div style="display: inline-block;margin-left: 13px;">
  95 + <span class="item-label" style="width: 80px;">统计对象: </span>
  96 + <select class="form-control" name="statisticalObj" id="statisticalObj" style="width: 150px;">
  97 + <option value="cl">车辆</option>
  98 + <option value="jsy">驾驶员</option>
  99 + <option value="cwy">乘务员</option>
  100 + <option value="xl">线路</option>
  101 + </select>
  102 + </div>
  103 +
  104 + <div style="display: inline-block; margin-left: 13px;" >
  105 + <span class="item-label" style="width: 80px;">统计项目: </span>
  106 + <select class="form-control" name="statisticalItem" id="statisticalItem" style="width: 150px;">
  107 + <option value="yh">油耗</option>
  108 + <option value="dh">电耗</option>
  109 + <option value="qh">氢耗</option>
  110 + <option value="gl">公里</option>
  111 + <option value="bc">班次</option>
  112 + </select>
  113 + </div>
  114 + <div style="display: inline-block; margin-left: 13px;" >
  115 + <span class="item-label" style="width: 80px;">项目明细: </span>
  116 + <select class="form-control" name="itemDetails" id="itemDetails" style="width: 150px;"></select>
  117 + </div>
  118 + <div class="form-group" style="display: inline-block;margin-left: 22px;">
  119 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  120 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  121 + </div>
  122 + </form>
  123 + </div>
  124 +
  125 + <div id="analy_body">
  126 + <div class="table_head" id="table_head">
  127 + <table class="table table-bordered table-hover table-checkable " id="forms_head">
  128 + <thead>
  129 + </thead>
  130 + </table>
  131 + </div>
  132 + <div class="table_body" id="table_body">
  133 + <table class="table table-bordered table-hover table-checkable" id="forms_body">
  134 + <tbody>
  135 + </tbody>
  136 + </table>
  137 + </div>
  138 + </div>
  139 +</div>
  140 +<script >
  141 + $(function(){
  142 + $('#export').attr('disabled', "true");
  143 + // 关闭左侧栏
  144 + if (!$('body').hasClass('page-sidebar-closed'))
  145 + $('.menu-toggler.sidebar-toggler').click();
  146 +
  147 + var table_body1 = document.getElementById("table_body");
  148 + table_body1.onscroll = function(){
  149 + var table_body1_left = this.scrollLeft;
  150 + document.getElementById("table_head").scrollLeft = table_body1_left;
  151 + };
  152 +
  153 + var d = new Date();
  154 + d.setTime(d.getTime() - 4*1000*60*60*24);//只能查4天以前的数据
  155 + var year = d.getFullYear();
  156 + var month = d.getMonth() + 1;
  157 + var day = d.getDate();
  158 + if(month < 10)
  159 + month = "0" + month;
  160 + if(day < 10)
  161 + day = "0" + day;
  162 + //时间
  163 + var dateTime=year + "-" + month + "-" + day;
  164 + $("#startDate").val(dateTime);
  165 + $("#endDate").val(dateTime);
  166 +
  167 + $("#endDate").datetimepicker({
  168 + format : 'YYYY-MM-DD',
  169 + locale : 'zh-cn',
  170 + maxDate : dateTime
  171 + });
  172 + $("#startDate").datetimepicker({
  173 + format : 'YYYY-MM-DD',
  174 + locale : 'zh-cn',
  175 + maxDate : dateTime
  176 + });
  177 +
  178 + var lineAll="";
  179 + var datas = {}; //查询条件
  180 +
  181 + /**用户分配的线路(注释掉就是查询全部线路)*/
  182 +// $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
  183 +// lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
  184 +// });
  185 +
  186 + var tempData = {};
  187 +
  188 + $.get('/user/companyData', function(result){
  189 + var obj = result;
  190 + var options = '';
  191 + for(var i = 0; i < obj.length; i++){
  192 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  193 + }
  194 +
  195 + if(obj.length ==0){
  196 + $("#gsdmDiv_daily").css('display','none');
  197 + }else if(obj.length ==1){
  198 + $("#gsdmDiv_daily").css('display','none');
  199 + if(obj[0].children.length == 1 || obj[0].children.length == 0){
  200 + fage=false;
  201 + $('#gsdmDiv_daily').css('display','none');
  202 + }
  203 + }
  204 + $('#gsdm').html(options);
  205 + updateCompany();
  206 + });
  207 + $("#gsdm").on("change",updateCompany);
  208 +
  209 + function updateCompany(){
  210 + var company = $('#gsdm').val();
  211 + $.get('/user/companyData', function(obj) {
  212 + var option = '';
  213 + var allC = "";
  214 + for (var i = 0; i < obj.length; i++) {
  215 + if (obj[i].companyCode == company) {
  216 + var children = obj[i].children;
  217 + for (var j = 0; j < children.length; j++) {
  218 + allC += children[j].code+",";
  219 + option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
  220 + }
  221 + }
  222 + }
  223 +
  224 + var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
  225 + $('#fgsdm').html(options);
  226 + });
  227 + }
  228 +
  229 + // 项目明细选项列
  230 + // 触发默认选项
  231 + updateItem();
  232 + $("#statisticalItem").on("change",updateItem);
  233 + function updateItem() {
  234 + var item = $('#statisticalItem').val();
  235 + var options = '';
  236 + if(item == "yh"){
  237 + options += '<option value="jzlAll">加注量[全部]</option>' +
  238 + '<option value="jzl0">加注量[0#]</option>'+
  239 + '<option value="jzl-10">加注量[-10#]</option>'+
  240 + '<option value="yhl">油耗量</option>'+
  241 + '<option value="cccy">出场存油</option>'+
  242 + '<option value="jccy">进场存油</option>'+
  243 + '<option value="bglyh">百公里油耗</option>';
  244 + } else if(item == "gl"){
  245 + options += '<option value="zgl">总公里</option>' +
  246 + '<option value="jhgl">计划公里</option>';
  247 + /*'<option value="jclm">进场路码</option>'+
  248 + '<option value="cclm">出场路码</option>'*/
  249 + } else if(item == "bc"){
  250 + options += '<option value="sjbc">实际班次</option>' +
  251 + '<option value="jhbc">计划班次</option>';
  252 + } else if(item == "dh"){
  253 + options += '<option value="dh">耗电量</option>';
  254 + options += '<option value="cdl">充电量</option>';
  255 + options += '<option value="cccd">出场存电</option>';
  256 + options += '<option value="jccd">进场存电</option>';
  257 + options += '<option value="bgldh">百公里电耗</option>';
  258 + } else if(item == "qh"){
  259 + options += '<option value="qh">耗氢量</option>';
  260 + options += '<option value="cql">充氢量</option>';
  261 + options += '<option value="cccq">出场存氢</option>';
  262 + options += '<option value="jccq">进场存氢</option>';
  263 + options += '<option value="bglqh">百公里氢耗</option>';
  264 + }
  265 + $('#itemDetails').html(options);
  266 + }
  267 +
  268 + //线路名称
  269 + var lineName = '';
  270 + $("#query").on("click",function(){
  271 + var gsdm = $("#gsdm").val();
  272 + var fgsdm = $("#fgsdm").val();
  273 + var startDate = $("#startDate").val();
  274 + var endDate = $("#endDate").val();
  275 + var statisticalObj = $("#statisticalObj").val();
  276 + //开始和结束时间
  277 + var startTime = Date.parse(new Date(startDate));
  278 + var endTime = Date.parse(new Date(endDate));
  279 +
  280 + datas = {}; // 清空之前数据
  281 + datas.gsdm = gsdm;
  282 + datas.fgsdm = fgsdm;
  283 + datas.lineCode = lineAll;
  284 + datas.timeType = "m";
  285 + datas.startDate = startDate;
  286 + datas.endDate = endDate;
  287 + datas.destroy = $("#destroy").val();
  288 + datas.statisticalObj = $("#statisticalObj").val();
  289 + datas.itemDetails = $("#itemDetails").val();
  290 + var itemDetails = datas.itemDetails,
  291 + type = "加注量[全部]";
  292 + if(itemDetails=="jzl0"){
  293 + type = "加注量[0#]"
  294 + } else if(itemDetails=="jzl-10"){
  295 + type = "加注量[-10#]"
  296 + } else if(itemDetails=="yhl"){
  297 + type = "油耗量"
  298 + } else if(itemDetails=="cccy"){
  299 + type = "出场存油"
  300 + } else if(itemDetails=="jccy"){
  301 + type = "进场存油"
  302 + } else if(itemDetails=="bglyh"){
  303 + type = "百公里油耗"
  304 + } else if(itemDetails=="zgl"){
  305 + type = "总公里"
  306 + } else if(itemDetails=="jhgl"){
  307 + type = "计划公里"
  308 + } else if(itemDetails=="jclm"){
  309 + type = "进场路码"
  310 + } else if(itemDetails=="cclm"){
  311 + type = "出场路码"
  312 + } else if(itemDetails=="sjbc"){
  313 + type = "实际班次"
  314 + } else if(itemDetails=="jhbc"){
  315 + type = "计划班次"
  316 + } else if(itemDetails=="dh"){
  317 + type = "耗电量"
  318 + } else if(itemDetails=="cdl"){
  319 + type = "充电量"
  320 + } else if(itemDetails=="cccd"){
  321 + type = "出场存电"
  322 + } else if(itemDetails=="jccd"){
  323 + type = "进场存电"
  324 + } else if(itemDetails=="bgldh"){
  325 + type = "百公里电耗"
  326 + } else if(itemDetails=="qh"){
  327 + type = "耗氢量"
  328 + } else if(itemDetails=="cql"){
  329 + type = "充氢量"
  330 + } else if(itemDetails=="cccq"){
  331 + type = "出场存氢"
  332 + } else if(itemDetails=="jccq"){
  333 + type = "进场存氢"
  334 + } else if(itemDetails=="bglqh"){
  335 + type = "百公里氢耗"
  336 + }
  337 + datas.name = datas.startDate+"-"+datas.endDate+"-路单线路明细月报表("+type+")";
  338 + if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
  339 + layer.msg('请选择时间段!');
  340 + }else if(endTime<startTime){
  341 + layer.msg('结束日期不能小于开始日期!');
  342 + }else {
  343 + if (endDate.substring(0, 7) != startDate.substring(0, 7)) {
  344 + layer.msg("请查询同月份数据!");
  345 + return;
  346 + } else {
  347 + var lodingI = layer.load(2);
  348 + $get('/calcWaybill/calcDetailMonthly', datas, function (rs) {
  349 + if (rs.length <=0) {
  350 + layer.close(lodingI);
  351 + layer.open({
  352 + title: '提示'
  353 + , content: '没有您要查询的数据,请重新选择参数!'
  354 + });
  355 + $("#export").attr('disabled',"true");
  356 + return;
  357 + }else
  358 + $("#export").removeAttr("disabled");
  359 + var htmlHead = "<tr><td colspan='"+rs[0].length+"'>"+datas.name+"</td></tr>", htmlBody = "";
  360 + var rsLength = rs.length;
  361 + rs.forEach(function (o, i) {
  362 + var html = "<tr>"
  363 + o.forEach(function (td, j) {
  364 + var colspan;
  365 + if (i == rsLength - 1 && j == 0) {
  366 + colspan = (statisticalObj == "xl" ? "colspan='3'" : "colspan='5'");
  367 + if(statisticalObj == "cl")
  368 + colspan = "colspan='6'";
  369 + }
  370 + html += "<td " + colspan + ">" + td + "</td>"
  371 + });
  372 + html += "</tr>"
  373 + if (i == 0) {
  374 + htmlHead += html;
  375 + } else
  376 + htmlBody += html;
  377 + });
  378 + $('#forms_head thead').html(htmlHead);
  379 + $('#forms_body tbody').html(htmlBody);
  380 + layer.close(lodingI);
  381 + });
  382 + }
  383 + }
  384 + });
  385 +
  386 + $("#export").on("click",function(){
  387 + $post("/report/calcDetailMonthlyE",datas,function(result){
  388 + window.open("/downloadFile/download?fileName="+datas.name);
  389 + });
  390 + });
  391 + });
  392 +</script>
  393 +<!--<script type="application/javascript" src="/pages/forms/calc/calcDetailMonthly.js"></script>-->
src/main/resources/static/pages/forms/calc/calcDetailYear.html
1 -<style type="text/css">  
2 - .table-bordered {  
3 - border: 1px solid; }  
4 - .table-bordered > thead > tr > th,  
5 - .table-bordered > thead > tr > td,  
6 - .table-bordered > tbody > tr > th,  
7 - .table-bordered > tbody > tr > td,  
8 - .table-bordered > tfoot > tr > th,  
9 - .table-bordered > tfoot > tr > td {  
10 - border: 1px solid;  
11 - text-align: center; }  
12 - .table-bordered > thead > tr > th,  
13 - .table-bordered > thead > tr > td {  
14 - border-bottom-width: 2px; }  
15 -  
16 - .table > tbody + tbody {  
17 - border-top: 1px solid; }  
18 -  
19 -  
20 - #analy_body tr> td >span{  
21 - word-break: keep-all;white-space:nowrap;  
22 - }  
23 -  
24 - #analy_body td{  
25 - min-width: 100px;  
26 - max-width: 100px;  
27 - width: 100px;  
28 - }  
29 -  
30 - #analy_body{  
31 - margin-top: 20px;  
32 - height: 620px;  
33 - width: 100%  
34 - }  
35 -  
36 -  
37 - .table_head::-webkit-scrollbar {  
38 - display:none  
39 - }  
40 -  
41 - .table_head{  
42 - min-width: 906px;  
43 - width: 100%;  
44 - overflow: hidden;  
45 - }  
46 -  
47 - .table_body{  
48 - width:101%;  
49 - height:580px;  
50 - overflow: auto;  
51 - margin-top: -20px;  
52 - }  
53 -</style>  
54 -<div class="page-head">  
55 - <div class="page-title">  
56 - <h1>路单线路明细年报表</h1>  
57 - </div>  
58 -</div>  
59 -  
60 -<!--<div class="row">-->  
61 -<div class=" row col-md-12 portlet light bordered" style="height:calc(100% - 38px)">  
62 - <div class="">  
63 - <form class="form-inline" >  
64 - <div style="display: inline-block; margin-left: 13px;" id="gsdmDiv_daily">  
65 - <span class="item-label" style="width: 80px;">&#12288;&#12288;公司: </span>  
66 - <select class="form-control" name="company" id="gsdm" style="width: 150px;"></select>  
67 - </div>  
68 - <div style="display: inline-block; margin-left: 13px;" id="fgsdmDiv_daily">  
69 - <span class="item-label" style="width: 80px;">&#12288;分公司: </span>  
70 - <select class="form-control" name="fgsdm" id="fgsdm" style="width: 150px;"></select>  
71 - </div>  
72 - <!--<div style="display: inline-block;margin-left: 33px;">  
73 - <span class="item-label" style="width: 80px;">&#12288;&#12288;线路: </span>  
74 - <select class="form-control" name="line" id="line" style="width: 180px;"></select>  
75 - </div>-->  
76 - <div style="display: inline-block;margin-left: 13px;" class="date-picker">  
77 - <span class="item-label" style="width: 80px;">&#12288;&#12288;时间: </span>  
78 - <input class="form-control" type="text" id="startDate" style="width: 150px;" /> -  
79 - <input class="form-control" type="text" id="endDate" style="width: 150px;" />  
80 - <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->  
81 - <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->  
82 - </div>  
83 -  
84 - <div style="margin-top: 2px"></div>  
85 -  
86 - <div style="display: inline-block; margin-left: 13px;">  
87 - <span class="item-label" style="width: 80px;">线路性质: </span>  
88 - <select class="form-control" name="destroy" id="destroy" style="width: 150px;">  
89 - <option value="0,1">全部线路</option>  
90 - <option value="0">营运线路</option>  
91 - <option value="1">非营运线路</option>  
92 - </select>  
93 - </div>  
94 - <div style="display: inline-block;margin-left: 13px;">  
95 - <span class="item-label" style="width: 80px;">统计对象: </span>  
96 - <select class="form-control" name="statisticalObj" id="statisticalObj" style="width: 150px;">  
97 - <option value="cl">车辆</option>  
98 - <option value="jsy">驾驶员</option>  
99 - <option value="cwy">乘务员</option>  
100 - <option value="xl">线路</option>  
101 - </select>  
102 - </div>  
103 -  
104 - <div style="display: inline-block; margin-left: 13px;" >  
105 - <span class="item-label" style="width: 80px;">统计项目: </span>  
106 - <select class="form-control" name="statisticalItem" id="statisticalItem" style="width: 150px;">  
107 - <option value="yh">油耗</option>  
108 - <option value="dh">电耗</option>  
109 - <option value="qh">氢耗</option>  
110 - <option value="gl">公里</option>  
111 - <option value="bc">班次</option>  
112 - </select>  
113 - </div>  
114 - <div style="display: inline-block; margin-left: 13px;" >  
115 - <span class="item-label" style="width: 80px;">项目明细: </span>  
116 - <select class="form-control" name="itemDetails" id="itemDetails" style="width: 150px;"></select>  
117 - </div>  
118 - <div class="form-group" style="display: inline-block;margin-left: 22px;">  
119 - <input class="btn btn-default" type="button" id="query" value="筛选"/>  
120 - <input class="btn btn-default" type="button" id="export" value="导出"/>  
121 - </div>  
122 - </form>  
123 - </div>  
124 -  
125 - <div id="analy_body">  
126 - <div class="table_head" id="table_head">  
127 - <table class="table table-bordered table-hover table-checkable " id="forms_head">  
128 - <thead>  
129 - </thead>  
130 - </table>  
131 - </div>  
132 - <div class="table_body" id="table_body">  
133 - <table class="table table-bordered table-hover table-checkable" id="forms_body">  
134 - <tbody>  
135 - </tbody>  
136 - </table>  
137 - </div>  
138 - </div>  
139 -</div>  
140 -<script >  
141 - $(function(){  
142 - $('#export').attr('disabled', "true");  
143 - // 关闭左侧栏  
144 - if (!$('body').hasClass('page-sidebar-closed'))  
145 - $('.menu-toggler.sidebar-toggler').click();  
146 -  
147 - var table_body1 = document.getElementById("table_body");  
148 - table_body1.onscroll = function(){  
149 - var table_body1_left = this.scrollLeft;  
150 - document.getElementById("table_head").scrollLeft = table_body1_left;  
151 - };  
152 -  
153 - var d = new Date();  
154 - var year = d.getFullYear();  
155 - var month = d.getMonth() + 1;  
156 - if(month < 10)  
157 - month = "0" + month;  
158 - //时间  
159 - var dateTime=year + "-" + month;  
160 - $("#startDate").val(dateTime);  
161 - $("#endDate").val(dateTime);  
162 -  
163 - $("#endDate").datetimepicker({  
164 - format : 'YYYY-MM',  
165 - locale : 'zh-cn',  
166 - maxDate : dateTime  
167 - });  
168 - $("#startDate").datetimepicker({  
169 - format : 'YYYY-MM',  
170 - locale : 'zh-cn',  
171 - maxDate : dateTime  
172 - });  
173 -  
174 -  
175 - var lineAll="",lineNoD="",lineD="";  
176 - var datas = {}; //查询条件  
177 -  
178 -  
179 - /**用户分配的线路*/  
180 - $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {  
181 - lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);  
182 - /* $.get('/line/all', function (lines) {  
183 - $.each(lines,function () {  
184 -  
185 - });  
186 -  
187 - });*/  
188 - });  
189 -  
190 - var tempData = {};  
191 -  
192 - $.get('/user/companyData', function(result){  
193 - var obj = result;  
194 - var options = '';  
195 - for(var i = 0; i < obj.length; i++){  
196 - options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';  
197 - }  
198 -  
199 - if(obj.length ==0){  
200 - $("#gsdmDiv_daily").css('display','none');  
201 - }else if(obj.length ==1){  
202 - $("#gsdmDiv_daily").css('display','none');  
203 - if(obj[0].children.length == 1 || obj[0].children.length == 0){  
204 - fage=false;  
205 - $('#gsdmDiv_daily').css('display','none');  
206 - }  
207 - }  
208 - $('#gsdm').html(options);  
209 - updateCompany();  
210 - });  
211 - $("#gsdm").on("change",updateCompany);  
212 -  
213 - function updateCompany(){  
214 - var company = $('#gsdm').val();  
215 - $.get('/user/companyData', function(obj) {  
216 - var option = '';  
217 - var allC = "";  
218 - for (var i = 0; i < obj.length; i++) {  
219 - if (obj[i].companyCode == company) {  
220 - var children = obj[i].children;  
221 - for (var j = 0; j < children.length; j++) {  
222 - allC += children[j].code+",";  
223 - option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';  
224 - }  
225 - }  
226 - }  
227 -  
228 - var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;  
229 - $('#fgsdm').html(options);  
230 - });  
231 - }  
232 -  
233 - // 项目明细选项列  
234 - // 触发默认选项  
235 - updateItem();  
236 - $("#statisticalItem").on("change",updateItem);  
237 - var item ="";  
238 - function updateItem() {  
239 - item = $('#statisticalItem').val();  
240 - var options = '';  
241 - if(item == "yh"){  
242 - options += '<option value="jzlAll">加注量[全部]</option>' +  
243 - '<option value="jzl0">加注量[0#]</option>'+  
244 - '<option value="jzl-10">加注量[-10#]</option>'+  
245 - '<option value="yhl">油耗量</option>'+  
246 - '<option value="cccy">出场存油</option>'+  
247 - '<option value="jccy">进场存油</option>'+  
248 - '<option value="bglyh">百公里油耗</option>';  
249 - } else if(item == "gl"){  
250 - options += '<option value="zgl">总公里</option>' +  
251 - '<option value="jhgl">计划公里</option>';  
252 - /*'<option value="jclm">进场路码</option>'+  
253 - '<option value="cclm">出场路码</option>'*/  
254 - } else if(item == "bc"){  
255 - options += '<option value="sjbc">实际班次</option>' +  
256 - '<option value="jhbc">计划班次</option>';  
257 - } else if(item == "dh"){  
258 - options += '<option value="dh">耗电量</option>';  
259 - options += '<option value="cdl">充电量</option>';  
260 - options += '<option value="cccd">出场存电</option>';  
261 - options += '<option value="jccd">进场存电</option>';  
262 - options += '<option value="bgldh">百公里电耗</option>';  
263 - } else if(item == "qh"){  
264 - options += '<option value="qh">耗氢量</option>';  
265 - options += '<option value="cql">充氢量</option>';  
266 - options += '<option value="cccq">出场存氢</option>';  
267 - options += '<option value="jccq">进场存氢</option>';  
268 - options += '<option value="bglqh">百公里氢耗</option>';  
269 - }  
270 - $('#itemDetails').html(options);  
271 - }  
272 -  
273 - //线路名称  
274 - var lineName = '';  
275 - $("#query").on("click",function(){  
276 - var gsdm = $("#gsdm").val();  
277 - var fgsdm = $("#fgsdm").val();  
278 - var startDate = $("#startDate").val();  
279 - var endDate = $("#endDate").val();  
280 - var statisticalObj = $("#statisticalObj").val();  
281 - //开始和结束时间  
282 - var startTime = Date.parse(new Date(startDate));  
283 - var endTime = Date.parse(new Date(endDate));  
284 -  
285 - datas = {}; // 清空之前数据  
286 - datas.timeType = "y";  
287 - datas.gsdm = gsdm;  
288 - datas.fgsdm = fgsdm;  
289 - datas.lineCode = lineAll;  
290 - datas.startDate = startDate;  
291 - datas.endDate = endDate;  
292 - datas.destroy = $("#destroy").val();  
293 - datas.statisticalObj = $("#statisticalObj").val();  
294 - datas.itemDetails = $("#itemDetails").val();  
295 - datas.item = item;  
296 -  
297 - var itemDetails = datas.itemDetails,  
298 - type = "加注量[全部]";  
299 - if(itemDetails=="jzl0"){  
300 - type = "加注量[0#]"  
301 - } else if(itemDetails=="jzl-10"){  
302 - type = "加注量[-10#]"  
303 - } else if(itemDetails=="yhl"){  
304 - type = "油耗量"  
305 - } else if(itemDetails=="cccy"){  
306 - type = "出场存油"  
307 - } else if(itemDetails=="jccy"){  
308 - type = "进场存油"  
309 - } else if(itemDetails=="bglyh"){  
310 - type = "百公里油耗"  
311 - } else if(itemDetails=="zgl"){  
312 - type = "总公里"  
313 - } else if(itemDetails=="jhgl"){  
314 - type = "计划公里"  
315 - } else if(itemDetails=="jclm"){  
316 - type = "进场路码"  
317 - } else if(itemDetails=="cclm"){  
318 - type = "出场路码"  
319 - } else if(itemDetails=="sjbc"){  
320 - type = "实际班次"  
321 - } else if(itemDetails=="jhbc"){  
322 - type = "计划班次"  
323 - } else if(itemDetails=="dh"){  
324 - type = "耗电量"  
325 - } else if(itemDetails=="cdl"){  
326 - type = "充电量"  
327 - } else if(itemDetails=="cccd"){  
328 - type = "出场存电"  
329 - } else if(itemDetails=="jccd"){  
330 - type = "进场存电"  
331 - } else if(itemDetails=="bgldh"){  
332 - type = "百公里电耗"  
333 - } else if(itemDetails=="qh"){  
334 - type = "耗氢量"  
335 - } else if(itemDetails=="cql"){  
336 - type = "充氢量"  
337 - } else if(itemDetails=="cccq"){  
338 - type = "出场存氢"  
339 - } else if(itemDetails=="jccq"){  
340 - type = "进场存氢"  
341 - } else if(itemDetails=="bglqh"){  
342 - type = "百公里氢耗"  
343 - }  
344 - datas.name = datas.startDate+"-"+datas.endDate+"-路单线路明细年报表("+type+")";  
345 - if(startDate==null || startDate =="" ||endDate==null || endDate ==""){  
346 - layer.msg('请选择时间段!');  
347 - }else if(endTime<startTime){  
348 - layer.msg('结束日期不能小于开始日期!');  
349 - }else {  
350 - if (endDate.substring(0, 4) != startDate.substring(0, 4)) {  
351 - layer.msg("请查询同年份数据!");  
352 - return;  
353 - } else {  
354 - var lodingI = layer.load(2);  
355 - $get('/calcWaybill/calcDetailMonthly', datas, function (rs) {  
356 - if (rs.length <=0) {  
357 - layer.close(lodingI);  
358 - layer.open({  
359 - title: '提示'  
360 - , content: '没有您要查询的数据,请重新选择参数!'  
361 - });  
362 - $("#export").attr('disabled',"true");  
363 - return;  
364 - }else  
365 - $("#export").removeAttr("disabled");  
366 - var htmlHead = "<tr><td colspan='"+rs[0].length+"'>"+datas.name+"</td></tr>", htmlBody = "";  
367 - var rsLength = rs.length;  
368 - rs.forEach(function (o, i) {  
369 - var html = "<tr>"  
370 - o.forEach(function (td, j) {  
371 - var colspan;  
372 - if (i == rsLength - 1 && j == 0) {  
373 - colspan = (statisticalObj == "xl" ? "colspan='3'" : "colspan='5'");  
374 - if(statisticalObj == "cl")  
375 - colspan = "colspan='6'";  
376 - }  
377 - html += "<td " + colspan + ">" + td + "</td>"  
378 - });  
379 - html += "</tr>"  
380 - if (i == 0) {  
381 - htmlHead += html;  
382 - } else  
383 - htmlBody += html;  
384 - });  
385 - $('#forms_head thead').html(htmlHead);  
386 - $('#forms_body tbody').html(htmlBody);  
387 - layer.close(lodingI);  
388 - });  
389 - }  
390 - }  
391 - });  
392 -  
393 - $("#export").on("click",function(){  
394 - $post("/report/calcDetailMonthlyE",datas,function(result){  
395 - window.open("/downloadFile/download?fileName="+datas.name);  
396 - });  
397 - });  
398 - });  
399 -</script>  
400 -<!--<script type="application/javascript" src="/pages/forms/calc/calcDetailMonthly.js"></script>--> 1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid;
  11 + text-align: center; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +
  19 +
  20 + #analy_body tr> td >span{
  21 + word-break: keep-all;white-space:nowrap;
  22 + }
  23 +
  24 + #analy_body td{
  25 + min-width: 100px;
  26 + max-width: 100px;
  27 + width: 100px;
  28 + }
  29 +
  30 + #analy_body{
  31 + margin-top: 20px;
  32 + height: 620px;
  33 + width: 100%
  34 + }
  35 +
  36 +
  37 + .table_head::-webkit-scrollbar {
  38 + display:none
  39 + }
  40 +
  41 + .table_head{
  42 + min-width: 906px;
  43 + width: 100%;
  44 + overflow: hidden;
  45 + }
  46 +
  47 + .table_body{
  48 + width:101%;
  49 + height:580px;
  50 + overflow: auto;
  51 + margin-top: -20px;
  52 + }
  53 +</style>
  54 +<div class="page-head">
  55 + <div class="page-title">
  56 + <h1>路单线路明细年报表</h1>
  57 + </div>
  58 +</div>
  59 +
  60 +<!--<div class="row">-->
  61 +<div class=" row col-md-12 portlet light bordered" style="height:calc(100% - 38px)">
  62 + <div class="">
  63 + <form class="form-inline" >
  64 + <div style="display: inline-block; margin-left: 13px;" id="gsdmDiv_daily">
  65 + <span class="item-label" style="width: 80px;">&#12288;&#12288;公司: </span>
  66 + <select class="form-control" name="company" id="gsdm" style="width: 150px;"></select>
  67 + </div>
  68 + <div style="display: inline-block; margin-left: 13px;" id="fgsdmDiv_daily">
  69 + <span class="item-label" style="width: 80px;">&#12288;分公司: </span>
  70 + <select class="form-control" name="fgsdm" id="fgsdm" style="width: 150px;"></select>
  71 + </div>
  72 + <!--<div style="display: inline-block;margin-left: 33px;">
  73 + <span class="item-label" style="width: 80px;">&#12288;&#12288;线路: </span>
  74 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  75 + </div>-->
  76 + <div style="display: inline-block;margin-left: 13px;" class="date-picker">
  77 + <span class="item-label" style="width: 80px;">&#12288;&#12288;时间: </span>
  78 + <input class="form-control" type="text" id="startDate" style="width: 150px;" /> -
  79 + <input class="form-control" type="text" id="endDate" style="width: 150px;" />
  80 + <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->
  81 + <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->
  82 + </div>
  83 +
  84 + <div style="margin-top: 2px"></div>
  85 +
  86 + <div style="display: inline-block; margin-left: 13px;">
  87 + <span class="item-label" style="width: 80px;">线路性质: </span>
  88 + <select class="form-control" name="destroy" id="destroy" style="width: 150px;">
  89 + <option value="0,1">全部线路</option>
  90 + <option value="0">营运线路</option>
  91 + <option value="1">非营运线路</option>
  92 + </select>
  93 + </div>
  94 + <div style="display: inline-block;margin-left: 13px;">
  95 + <span class="item-label" style="width: 80px;">统计对象: </span>
  96 + <select class="form-control" name="statisticalObj" id="statisticalObj" style="width: 150px;">
  97 + <option value="cl">车辆</option>
  98 + <option value="jsy">驾驶员</option>
  99 + <option value="cwy">乘务员</option>
  100 + <option value="xl">线路</option>
  101 + </select>
  102 + </div>
  103 +
  104 + <div style="display: inline-block; margin-left: 13px;" >
  105 + <span class="item-label" style="width: 80px;">统计项目: </span>
  106 + <select class="form-control" name="statisticalItem" id="statisticalItem" style="width: 150px;">
  107 + <option value="yh">油耗</option>
  108 + <option value="dh">电耗</option>
  109 + <option value="qh">氢耗</option>
  110 + <option value="gl">公里</option>
  111 + <option value="bc">班次</option>
  112 + </select>
  113 + </div>
  114 + <div style="display: inline-block; margin-left: 13px;" >
  115 + <span class="item-label" style="width: 80px;">项目明细: </span>
  116 + <select class="form-control" name="itemDetails" id="itemDetails" style="width: 150px;"></select>
  117 + </div>
  118 + <div class="form-group" style="display: inline-block;margin-left: 22px;">
  119 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  120 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  121 + </div>
  122 + </form>
  123 + </div>
  124 +
  125 + <div id="analy_body">
  126 + <div class="table_head" id="table_head">
  127 + <table class="table table-bordered table-hover table-checkable " id="forms_head">
  128 + <thead>
  129 + </thead>
  130 + </table>
  131 + </div>
  132 + <div class="table_body" id="table_body">
  133 + <table class="table table-bordered table-hover table-checkable" id="forms_body">
  134 + <tbody>
  135 + </tbody>
  136 + </table>
  137 + </div>
  138 + </div>
  139 +</div>
  140 +<script >
  141 + $(function(){
  142 + $('#export').attr('disabled', "true");
  143 + // 关闭左侧栏
  144 + if (!$('body').hasClass('page-sidebar-closed'))
  145 + $('.menu-toggler.sidebar-toggler').click();
  146 +
  147 + var table_body1 = document.getElementById("table_body");
  148 + table_body1.onscroll = function(){
  149 + var table_body1_left = this.scrollLeft;
  150 + document.getElementById("table_head").scrollLeft = table_body1_left;
  151 + };
  152 +
  153 + var d = new Date();
  154 + var year = d.getFullYear();
  155 + var month = d.getMonth() + 1;
  156 + if(month < 10)
  157 + month = "0" + month;
  158 + //时间
  159 + var dateTime=year + "-" + month;
  160 + $("#startDate").val(dateTime);
  161 + $("#endDate").val(dateTime);
  162 +
  163 + $("#endDate").datetimepicker({
  164 + format : 'YYYY-MM',
  165 + locale : 'zh-cn',
  166 + maxDate : dateTime
  167 + });
  168 + $("#startDate").datetimepicker({
  169 + format : 'YYYY-MM',
  170 + locale : 'zh-cn',
  171 + maxDate : dateTime
  172 + });
  173 +
  174 +
  175 + var lineAll="",lineNoD="",lineD="";
  176 + var datas = {}; //查询条件
  177 +
  178 +
  179 + /**用户分配的线路(注释掉就是查询全部线路)*/
  180 +// $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
  181 +// lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
  182 +// });
  183 +
  184 + var tempData = {};
  185 +
  186 + $.get('/user/companyData', function(result){
  187 + var obj = result;
  188 + var options = '';
  189 + for(var i = 0; i < obj.length; i++){
  190 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  191 + }
  192 +
  193 + if(obj.length ==0){
  194 + $("#gsdmDiv_daily").css('display','none');
  195 + }else if(obj.length ==1){
  196 + $("#gsdmDiv_daily").css('display','none');
  197 + if(obj[0].children.length == 1 || obj[0].children.length == 0){
  198 + fage=false;
  199 + $('#gsdmDiv_daily').css('display','none');
  200 + }
  201 + }
  202 + $('#gsdm').html(options);
  203 + updateCompany();
  204 + });
  205 + $("#gsdm").on("change",updateCompany);
  206 +
  207 + function updateCompany(){
  208 + var company = $('#gsdm').val();
  209 + $.get('/user/companyData', function(obj) {
  210 + var option = '';
  211 + var allC = "";
  212 + for (var i = 0; i < obj.length; i++) {
  213 + if (obj[i].companyCode == company) {
  214 + var children = obj[i].children;
  215 + for (var j = 0; j < children.length; j++) {
  216 + allC += children[j].code+",";
  217 + option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
  218 + }
  219 + }
  220 + }
  221 +
  222 + var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
  223 + $('#fgsdm').html(options);
  224 + });
  225 + }
  226 +
  227 + // 项目明细选项列
  228 + // 触发默认选项
  229 + updateItem();
  230 + $("#statisticalItem").on("change",updateItem);
  231 + var item ="";
  232 + function updateItem() {
  233 + item = $('#statisticalItem').val();
  234 + var options = '';
  235 + if(item == "yh"){
  236 + options += '<option value="jzlAll">加注量[全部]</option>' +
  237 + '<option value="jzl0">加注量[0#]</option>'+
  238 + '<option value="jzl-10">加注量[-10#]</option>'+
  239 + '<option value="yhl">油耗量</option>'+
  240 + '<option value="cccy">出场存油</option>'+
  241 + '<option value="jccy">进场存油</option>'+
  242 + '<option value="bglyh">百公里油耗</option>';
  243 + } else if(item == "gl"){
  244 + options += '<option value="zgl">总公里</option>' +
  245 + '<option value="jhgl">计划公里</option>';
  246 + /*'<option value="jclm">进场路码</option>'+
  247 + '<option value="cclm">出场路码</option>'*/
  248 + } else if(item == "bc"){
  249 + options += '<option value="sjbc">实际班次</option>' +
  250 + '<option value="jhbc">计划班次</option>';
  251 + } else if(item == "dh"){
  252 + options += '<option value="dh">耗电量</option>';
  253 + options += '<option value="cdl">充电量</option>';
  254 + options += '<option value="cccd">出场存电</option>';
  255 + options += '<option value="jccd">进场存电</option>';
  256 + options += '<option value="bgldh">百公里电耗</option>';
  257 + } else if(item == "qh"){
  258 + options += '<option value="qh">耗氢量</option>';
  259 + options += '<option value="cql">充氢量</option>';
  260 + options += '<option value="cccq">出场存氢</option>';
  261 + options += '<option value="jccq">进场存氢</option>';
  262 + options += '<option value="bglqh">百公里氢耗</option>';
  263 + }
  264 + $('#itemDetails').html(options);
  265 + }
  266 +
  267 + //线路名称
  268 + var lineName = '';
  269 + $("#query").on("click",function(){
  270 + var gsdm = $("#gsdm").val();
  271 + var fgsdm = $("#fgsdm").val();
  272 + var startDate = $("#startDate").val();
  273 + var endDate = $("#endDate").val();
  274 + var statisticalObj = $("#statisticalObj").val();
  275 + //开始和结束时间
  276 + var startTime = Date.parse(new Date(startDate));
  277 + var endTime = Date.parse(new Date(endDate));
  278 +
  279 + datas = {}; // 清空之前数据
  280 + datas.timeType = "y";
  281 + datas.gsdm = gsdm;
  282 + datas.fgsdm = fgsdm;
  283 + datas.lineCode = lineAll;
  284 + datas.startDate = startDate;
  285 + datas.endDate = endDate;
  286 + datas.destroy = $("#destroy").val();
  287 + datas.statisticalObj = $("#statisticalObj").val();
  288 + datas.itemDetails = $("#itemDetails").val();
  289 + datas.item = item;
  290 +
  291 + var itemDetails = datas.itemDetails,
  292 + type = "加注量[全部]";
  293 + if(itemDetails=="jzl0"){
  294 + type = "加注量[0#]"
  295 + } else if(itemDetails=="jzl-10"){
  296 + type = "加注量[-10#]"
  297 + } else if(itemDetails=="yhl"){
  298 + type = "油耗量"
  299 + } else if(itemDetails=="cccy"){
  300 + type = "出场存油"
  301 + } else if(itemDetails=="jccy"){
  302 + type = "进场存油"
  303 + } else if(itemDetails=="bglyh"){
  304 + type = "百公里油耗"
  305 + } else if(itemDetails=="zgl"){
  306 + type = "总公里"
  307 + } else if(itemDetails=="jhgl"){
  308 + type = "计划公里"
  309 + } else if(itemDetails=="jclm"){
  310 + type = "进场路码"
  311 + } else if(itemDetails=="cclm"){
  312 + type = "出场路码"
  313 + } else if(itemDetails=="sjbc"){
  314 + type = "实际班次"
  315 + } else if(itemDetails=="jhbc"){
  316 + type = "计划班次"
  317 + } else if(itemDetails=="dh"){
  318 + type = "耗电量"
  319 + } else if(itemDetails=="cdl"){
  320 + type = "充电量"
  321 + } else if(itemDetails=="cccd"){
  322 + type = "出场存电"
  323 + } else if(itemDetails=="jccd"){
  324 + type = "进场存电"
  325 + } else if(itemDetails=="bgldh"){
  326 + type = "百公里电耗"
  327 + } else if(itemDetails=="qh"){
  328 + type = "耗氢量"
  329 + } else if(itemDetails=="cql"){
  330 + type = "充氢量"
  331 + } else if(itemDetails=="cccq"){
  332 + type = "出场存氢"
  333 + } else if(itemDetails=="jccq"){
  334 + type = "进场存氢"
  335 + } else if(itemDetails=="bglqh"){
  336 + type = "百公里氢耗"
  337 + }
  338 + datas.name = datas.startDate+"-"+datas.endDate+"-路单线路明细年报表("+type+")";
  339 + if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
  340 + layer.msg('请选择时间段!');
  341 + }else if(endTime<startTime){
  342 + layer.msg('结束日期不能小于开始日期!');
  343 + }else {
  344 + if (endDate.substring(0, 4) != startDate.substring(0, 4)) {
  345 + layer.msg("请查询同年份数据!");
  346 + return;
  347 + } else {
  348 + var lodingI = layer.load(2);
  349 + $get('/calcWaybill/calcDetailMonthly', datas, function (rs) {
  350 + if (rs.length <=0) {
  351 + layer.close(lodingI);
  352 + layer.open({
  353 + title: '提示'
  354 + , content: '没有您要查询的数据,请重新选择参数!'
  355 + });
  356 + $("#export").attr('disabled',"true");
  357 + return;
  358 + }else
  359 + $("#export").removeAttr("disabled");
  360 + var htmlHead = "<tr><td colspan='"+rs[0].length+"'>"+datas.name+"</td></tr>", htmlBody = "";
  361 + var rsLength = rs.length;
  362 + rs.forEach(function (o, i) {
  363 + var html = "<tr>"
  364 + o.forEach(function (td, j) {
  365 + var colspan;
  366 + if (i == rsLength - 1 && j == 0) {
  367 + colspan = (statisticalObj == "xl" ? "colspan='3'" : "colspan='5'");
  368 + if(statisticalObj == "cl")
  369 + colspan = "colspan='6'";
  370 + }
  371 + html += "<td " + colspan + ">" + td + "</td>"
  372 + });
  373 + html += "</tr>"
  374 + if (i == 0) {
  375 + htmlHead += html;
  376 + } else
  377 + htmlBody += html;
  378 + });
  379 + $('#forms_head thead').html(htmlHead);
  380 + $('#forms_body tbody').html(htmlBody);
  381 + layer.close(lodingI);
  382 + });
  383 + }
  384 + }
  385 + });
  386 +
  387 + $("#export").on("click",function(){
  388 + $post("/report/calcDetailMonthlyE",datas,function(result){
  389 + window.open("/downloadFile/download?fileName="+datas.name);
  390 + });
  391 + });
  392 + });
  393 +</script>
  394 +<!--<script type="application/javascript" src="/pages/forms/calc/calcDetailMonthly.js"></script>-->