Commit 3086b197d53f533e74965a30aed74f881efcba88

Authored by 娄高锋
1 parent fa9e32d3

LGF 添加导出功能

src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -635,7 +635,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf @@ -635,7 +635,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf
635 635
636 } 636 }
637 637
638 - List<Object[]> list = scheduleRealInfoRepository.historyMessage(line,d,t, code); 638 + List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, code);
639 for(Object[] obj:list){ 639 for(Object[] obj:list){
640 if(obj != null){ 640 if(obj != null){
641 obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); 641 obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
@@ -671,7 +671,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -671,7 +671,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
671 e.printStackTrace(); 671 e.printStackTrace();
672 } 672 }
673 } 673 }
674 - 674 +
  675 + if(type != null && type.length() != 0 && type.equals("export_msg")){
  676 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  677 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  678 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  679 + Map<String,Object> m = new HashMap<String, Object>();
  680 + ReportUtils ee = new ReportUtils();
  681 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  682 + for(int i = 0; i < list.size(); i++){
  683 + Map<String, Object> map = new HashMap<String, Object>();
  684 + Object[] obj = list.get(i);
  685 + map.put("num", i + 1);
  686 + map.put("line", obj[4]);
  687 + map.put("clZbh", obj[0]);
  688 + map.put("sender", obj[1]);
  689 + map.put("date", obj[3]);
  690 + map.put("text", obj[2]);
  691 + newList.add(map);
  692 + }
  693 + try {
  694 + listI.add(newList.iterator());
  695 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  696 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\message.xls",
  697 + path+"export\\调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  698 + } catch (Exception e) {
  699 + // TODO: handle exception
  700 + e.printStackTrace();
  701 + }
  702 + }
675 return list; 703 return list;
676 } 704 }
677 705
@@ -1314,17 +1342,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1314,17 +1342,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1314 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 1342 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1315 Map<String,Object> m = new HashMap<String, Object>(); 1343 Map<String,Object> m = new HashMap<String, Object>();
1316 ReportUtils ee = new ReportUtils(); 1344 ReportUtils ee = new ReportUtils();
1317 - m.put("startDate", startDate);  
1318 - m.put("endDate", endDate); 1345 + m.put("dates", startDate + " 至 " + endDate);
  1346 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1347 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1348 + for(ScheduleRealInfo schedule : list){
  1349 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1350 + tempMap.put("xlName", schedule.getXlName()!=null?schedule.getXlName():"");
  1351 + tempMap.put("lpName", schedule.getLpName()!=null?schedule.getLpName():"");
  1352 + tempMap.put("clZbh", schedule.getClZbh()!=null?schedule.getClZbh():"");
  1353 + tempMap.put("jName", schedule.getjName()!=null?schedule.getjName():"");
  1354 + tempMap.put("sName", schedule.getsName()!=null?schedule.getsName():"");
  1355 + tempMap.put("fcsj", schedule.getFcsj()!=null?schedule.getFcsj():"");
  1356 + tempMap.put("fcsjActual", schedule.getFcsjActual()!=null?schedule.getFcsjActual():"");
  1357 + tempMap.put("zdsj", schedule.getZdsj()!=null?schedule.getZdsj():"");
  1358 + tempMap.put("zdsjActual", schedule.getZdsjActual()!=null?schedule.getZdsjActual():"");
  1359 + if(schedule.getUpdateBy() != null){
  1360 + if(schedule.getUpdateBy().getName() != null)
  1361 + tempMap.put("userName", schedule.getUpdateBy().getName());
  1362 + else
  1363 + tempMap.put("userName", "");
  1364 + } else {
  1365 + tempMap.put("userName", "");
  1366 + }
  1367 + if(schedule.getUpdateDate() != null){
  1368 + tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));
  1369 + } else {
  1370 + tempMap.put("updateDate", "");
  1371 + }
  1372 + tempMap.put("remarks", schedule.getRemarks()!=null?schedule.getRemarks():"");
  1373 + tempList.add(tempMap);
  1374 + }
1319 try { 1375 try {
1320 - listI.add(list.iterator()); 1376 + listI.add(tempList.iterator());
1321 String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; 1377 String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
1322 ee.excelReplace(listI, new Object[] { m }, path+"mould\\correctForm.xls", 1378 ee.excelReplace(listI, new Object[] { m }, path+"mould\\correctForm.xls",
1323 - path+"export\\" + URLEncoder.encode("修正报表", "UTF-8") + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); 1379 + path+"export\\修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
1324 } catch (Exception e) { 1380 } catch (Exception e) {
1325 // TODO: handle exception 1381 // TODO: handle exception
1326 e.printStackTrace(); 1382 e.printStackTrace();
1327 } 1383 }
  1384 + Map<String, Object> map = tempList.get(tempList.size() - 1);
  1385 + System.out.println("tempMap:" + map);
1328 } 1386 }
1329 1387
1330 return list; 1388 return list;
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
@@ -17,6 +17,7 @@ import java.util.List; @@ -17,6 +17,7 @@ import java.util.List;
17 import java.util.Map; 17 import java.util.Map;
18 import java.util.Set; 18 import java.util.Set;
19 19
  20 +import org.drools.compiler.lang.DRL5Expressions.type_return;
20 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
21 import org.springframework.jdbc.core.JdbcTemplate; 22 import org.springframework.jdbc.core.JdbcTemplate;
22 import org.springframework.jdbc.core.RowMapper; 23 import org.springframework.jdbc.core.RowMapper;
@@ -1012,6 +1013,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1012,6 +1013,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1012 String line = map.get("line").toString(); 1013 String line = map.get("line").toString();
1013 String date = map.get("date").toString(); 1014 String date = map.get("date").toString();
1014 String code = map.get("code").toString(); 1015 String code = map.get("code").toString();
  1016 + String type = map.get("type").toString();
1015 1017
1016 if(date.length() == 0) 1018 if(date.length() == 0)
1017 date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 1019 date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
@@ -1042,8 +1044,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1042,8 +1044,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1042 if(company.length() != 0){ 1044 if(company.length() != 0){
1043 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; 1045 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
1044 } 1046 }
1045 - sql += " order by fcsj";  
1046 - 1047 + sql += " order by xl_name, fcsj";
  1048 +
1047 list = jdbcTemplate.query(sql, 1049 list = jdbcTemplate.query(sql,
1048 new RowMapper<Map<String, Object>>(){ 1050 new RowMapper<Map<String, Object>>(){
1049 @Override 1051 @Override
@@ -1072,8 +1074,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1072,8 +1074,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1072 e.printStackTrace(); 1074 e.printStackTrace();
1073 } 1075 }
1074 1076
  1077 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1078 + List<String> keyList = new ArrayList<String>();
1075 for(Map<String, Object> m : list){ 1079 for(Map<String, Object> m : list){
1076 String key = m.get("line") + "/" + m.get("clZbh") + "/" + m.get("jGh") + "/" + m.get("jName"); 1080 String key = m.get("line") + "/" + m.get("clZbh") + "/" + m.get("jGh") + "/" + m.get("jName");
  1081 + if(!keyList.contains(m.get("line").toString())){
  1082 + keyList.add(m.get("line").toString());
  1083 + }
1077 if(!keyMap.containsKey(key)) 1084 if(!keyMap.containsKey(key))
1078 keyMap.put(key, new ArrayList<Map<String, Object>>()); 1085 keyMap.put(key, new ArrayList<Map<String, Object>>());
1079 keyMap.get(key).add(m); 1086 keyMap.get(key).add(m);
@@ -1120,7 +1127,58 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1120,7 +1127,58 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1120 tempMap.put("sjf", sjf); 1127 tempMap.put("sjf", sjf);
1121 tempMap.put("wqr", wqr); 1128 tempMap.put("wqr", wqr);
1122 tempMap.put("workList", keyMap.get(key)); 1129 tempMap.put("workList", keyMap.get(key));
1123 - resList.add(tempMap); 1130 + tempList.add(tempMap);
  1131 + }
  1132 +
  1133 + for(String key : keyList){
  1134 + for(Map<String, Object> m : tempList){
  1135 + if(key.equals(m.get("line").toString())){
  1136 + resList.add(m);
  1137 + }
  1138 + }
  1139 + }
  1140 +
  1141 + if(type.equals("export")){
  1142 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1143 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1144 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1145 + Map<String,Object> m = new HashMap<String, Object>();
  1146 + ReportUtils ee = new ReportUtils();
  1147 + try {
  1148 + listI.add(resList.iterator());
  1149 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1150 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\commandState.xls",
  1151 + path+"export\\指令状态分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1152 + } catch (Exception e) {
  1153 + // TODO: handle exception
  1154 + e.printStackTrace();
  1155 + }
  1156 + }
  1157 +
  1158 + if(type.equals("export1")){
  1159 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1160 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1161 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1162 + Map<String,Object> m = new HashMap<String, Object>();
  1163 + ReportUtils ee = new ReportUtils();
  1164 + String jsy = map.get("jsy").toString();
  1165 + try {
  1166 + for(Map<String, Object> map1 : resList){
  1167 + if(jsy.equals(map1.get("jsy").toString())){
  1168 + List<Map<String, Object>> temp = (List<Map<String, Object>>)map1.get("workList");
  1169 + listI.add(temp.iterator());
  1170 + m.put("detail", "日期:" + map1.get("date") + " 公司:" + map1.get("company")
  1171 + + " 分公司:" + map1.get("subCompany") + " 线路:" + map1.get("line")
  1172 + + " 车辆:" + map1.get("clZbh") + " 人员:" + map1.get("jsy"));
  1173 + }
  1174 + }
  1175 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1176 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\commandState1.xls",
  1177 + path+"export\\指令状态明细" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1178 + } catch (Exception e) {
  1179 + // TODO: handle exception
  1180 + e.printStackTrace();
  1181 + }
1124 } 1182 }
1125 1183
1126 return resList; 1184 return resList;
src/main/resources/static/pages/forms/mould/commandState.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/commandState1.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/correctForm.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/message.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/commandState.html
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 </div> 50 </div>
51 <div class="form-group" style="margin-left: 9px"> 51 <div class="form-group" style="margin-left: 9px">
52 <input class="btn btn-default" type="button" id="query" value="筛选"/> 52 <input class="btn btn-default" type="button" id="query" value="筛选"/>
53 -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> 53 + <input class="btn btn-default" type="button" id="export" value="导出"/>
54 </div> 54 </div>
55 </form> 55 </form>
56 </div> 56 </div>
@@ -74,16 +74,23 @@ @@ -74,16 +74,23 @@
74 74
75 </tbody> 75 </tbody>
76 </table> 76 </table>
  77 + <div id="box">&nbsp;</div>
77 <div id="works_hidden" class="hidden"> 78 <div id="works_hidden" class="hidden">
78 <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span> 79 <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
79 <span class="item-label" style="width: 80px;margin-left: 60px;">日期 </span> 80 <span class="item-label" style="width: 80px;margin-left: 60px;">日期 </span>
80 <span class="item-label" style="width: 80px;" id="date1"></span> 81 <span class="item-label" style="width: 80px;" id="date1"></span>
  82 + <span class="item-label" style="width: 80px;margin-left: 60px;">公司 </span>
  83 + <span class="item-label" style="width: 80px;" id="company2"></span>
  84 + <span class="item-label" style="width: 80px;margin-left: 60px;">分公司 </span>
  85 + <span class="item-label" style="width: 80px;" id="subCompany2"></span>
81 <span class="item-label" style="width: 80px;margin-left: 60px;">线路 </span> 86 <span class="item-label" style="width: 80px;margin-left: 60px;">线路 </span>
82 <span class="item-label" style="width: 80px;" id="line1"></span> 87 <span class="item-label" style="width: 80px;" id="line1"></span>
83 <span class="item-label" style="width: 80px;margin-left: 60px;">车辆 </span> 88 <span class="item-label" style="width: 80px;margin-left: 60px;">车辆 </span>
84 <span class="item-label" style="width: 80px;" id="clZbh1"></span> 89 <span class="item-label" style="width: 80px;" id="clZbh1"></span>
85 <span class="item-label" style="width: 80px;margin-left: 60px;">人员 </span> 90 <span class="item-label" style="width: 80px;margin-left: 60px;">人员 </span>
86 <span class="item-label" style="width: 80px;" id="jsy1"></span> 91 <span class="item-label" style="width: 80px;" id="jsy1"></span>
  92 + <span class="item-label" style="width: 80px;margin-left: 60px;"></span>
  93 + <input class="btn btn-default" type="button" id="export1" value="导出当前明细"/>
87 </div> 94 </div>
88 <table class="table table-bordered table-hover table-checkable" id="works"> 95 <table class="table table-bordered table-hover table-checkable" id="works">
89 <thead> 96 <thead>
@@ -112,6 +119,7 @@ @@ -112,6 +119,7 @@
112 119
113 <script> 120 <script>
114 $(function(){ 121 $(function(){
  122 + $('#export').attr('disabled', "true");
115 var list; 123 var list;
116 124
117 // 关闭左侧栏 125 // 关闭左侧栏
@@ -136,7 +144,7 @@ @@ -136,7 +144,7 @@
136 $.get('/basic/lineCode2Name',function(result){ 144 $.get('/basic/lineCode2Name',function(result){
137 var data=[]; 145 var data=[];
138 146
139 - data.push({id: "", text: "全部线路"}); 147 + data.push({id: " ", text: "全部线路"});
140 for(var code in result){ 148 for(var code in result){
141 data.push({id: code, text: result[code]}); 149 data.push({id: code, text: result[code]});
142 } 150 }
@@ -217,16 +225,26 @@ @@ -217,16 +225,26 @@
217 225
218 $("#query").on("click",jsDoQuery); 226 $("#query").on("click",jsDoQuery);
219 227
  228 + var line = "";
  229 + var date = $("#date").val();
  230 + var code = $("#code").val();
  231 + var company = $("#company").val();
  232 + var subCompany = $("#subCompany").val();
220 function jsDoQuery(pagination){ 233 function jsDoQuery(pagination){
221 var params = {}; 234 var params = {};
222 - var line = $("#line").val();  
223 - if(line = " ") 235 + line = $("#line").val();
  236 + if(line == " ")
224 line = ""; 237 line = "";
  238 + date = $("#date").val();
  239 + code = $("#code").val();
  240 + company = $("#company").val();
  241 + subCompany = $("#subCompany").val();
225 params['line'] = line; 242 params['line'] = line;
226 - params['date'] = $("#date").val();  
227 - params['code'] = $("#code").val();  
228 - params['company'] = $("#company").val();  
229 - params['subCompany'] = $("#subCompany").val(); 243 + params['date'] = date;
  244 + params['code'] = code;
  245 + params['type'] = "query";
  246 + params['company'] = company;
  247 + params['subCompany'] = subCompany;
230 $("#forms .hidden").removeClass("hidden"); 248 $("#forms .hidden").removeClass("hidden");
231 $get('/pcpc/commandState', params, function(result){ 249 $get('/pcpc/commandState', params, function(result){
232 // 把数据填充到模版中 250 // 把数据填充到模版中
@@ -235,29 +253,69 @@ @@ -235,29 +253,69 @@
235 // 把渲染好的模版html文本追加到表格中 253 // 把渲染好的模版html文本追加到表格中
236 $('#forms tbody').html(tbodyHtml); 254 $('#forms tbody').html(tbodyHtml);
237 255
  256 + if(result.length == 0){
  257 + $('#export').attr('disabled', "true");
  258 + } else {
  259 + $("#export").removeAttr("disabled");
  260 + }
  261 +
  262 + $("#works_hidden").removeClass("hidden");
  263 + $("#works .hidden").removeClass("hidden");
  264 + $("#works_hidden").addClass("hidden");
  265 + $("#works").addClass("hidden");
  266 +
238 }); 267 });
239 } 268 }
240 269
241 $("#export").on("click",function(){ 270 $("#export").on("click",function(){
242 - $('#forms').tableExport({ type: 'excel', escape: 'false',filename:'(2016-02-29_2016-03-06)'}); 271 + var params = {};
  272 + params['line'] = line;
  273 + params['date'] = date;
  274 + params['code'] = code;
  275 + params['type'] = "export";
  276 + params['company'] = company;
  277 + params['subCompany'] = subCompany;
  278 + $get('/pcpc/commandState', params, function(result){
  279 + window.open("/downloadFile/download?fileName=指令状态分析"+moment(date).format("YYYYMMDD"));
  280 + });
243 }); 281 });
244 282
  283 + var jsy = "";
245 $("#forms tbody").on("click","a",function(){ 284 $("#forms tbody").on("click","a",function(){
246 - var jsy = $(this).html(); 285 + jsy = $(this).html();
247 $.each(list, function(i, g){ 286 $.each(list, function(i, g){
248 if(jsy == g.jsy){ 287 if(jsy == g.jsy){
249 $("#date1").html(g.date); 288 $("#date1").html(g.date);
250 $("#line1").html(g.line); 289 $("#line1").html(g.line);
251 $("#clZbh1").html(g.clZbh); 290 $("#clZbh1").html(g.clZbh);
252 $("#jsy1").html(g.jsy); 291 $("#jsy1").html(g.jsy);
  292 + $("#company2").html(g.company);
  293 + $("subCompany2").html(g.subCompany);
253 $("#works_hidden").removeClass("hidden"); 294 $("#works_hidden").removeClass("hidden");
254 - $("#works .hidden").removeClass("hidden"); 295 + $("#works").removeClass("hidden");
255 // 把数据填充到模版中 296 // 把数据填充到模版中
256 var tbodyHtml = template('list_workList',{list:g.workList}); 297 var tbodyHtml = template('list_workList',{list:g.workList});
257 // 把渲染好的模版html文本追加到表格中 298 // 把渲染好的模版html文本追加到表格中
258 $('#works tbody').html(tbodyHtml); 299 $('#works tbody').html(tbodyHtml);
259 } 300 }
260 }); 301 });
  302 +
  303 + $("html,body").animate({scrollTop:$("#box").offset().top},1000);
  304 +
  305 + });
  306 +
  307 + $("#export1").on("click",function(){
  308 + var params = {};
  309 + params['jsy'] = jsy;
  310 + params['line'] = line;
  311 + params['date'] = date;
  312 + params['code'] = code;
  313 + params['type'] = "export1";
  314 + params['company'] = company;
  315 + params['subCompany'] = subCompany;
  316 + $get('/pcpc/commandState', params, function(result){
  317 + window.open("/downloadFile/download?fileName=指令状态明细"+moment(date).format("YYYYMMDD"));
  318 + });
261 }); 319 });
262 320
263 321
src/main/resources/static/pages/forms/statement/correctForm.html
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 </div> 49 </div>
50 <div class="form-group"> 50 <div class="form-group">
51 <input class="btn btn-default" type="button" id="query" value="筛选"/> 51 <input class="btn btn-default" type="button" id="query" value="筛选"/>
52 -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> 52 + <input class="btn btn-default" type="button" id="export" value="导出"/>
53 </div> 53 </div>
54 </form> 54 </form>
55 </div> 55 </div>
src/main/resources/static/pages/forms/statement/historyMessage.html
@@ -139,7 +139,7 @@ @@ -139,7 +139,7 @@
139 code = $("#code").val(); 139 code = $("#code").val();
140 var type = "query"; 140 var type = "query";
141 $(".hidden").removeClass("hidden"); 141 $(".hidden").removeClass("hidden");
142 - $get('/realSchedule/historyMessage',{line:line,date:date,code:code},function(result){ 142 + $get('/realSchedule/historyMessage',{line:line,date:date,code:code,type:type},function(result){
143 // 把数据填充到模版中 143 // 把数据填充到模版中
144 var tbodyHtml = template('list_history',{list:result}); 144 var tbodyHtml = template('list_history',{list:result});
145 // 把渲染好的模版html文本追加到表格中 145 // 把渲染好的模版html文本追加到表格中
src/main/resources/static/pages/report/message/message.html
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 </div> 41 </div>
42 <div class="form-group" style="display: inline-block;margin-left: 15px;"> 42 <div class="form-group" style="display: inline-block;margin-left: 15px;">
43 <input class="btn btn-default" type="button" id="query" value="查询"/> 43 <input class="btn btn-default" type="button" id="query" value="查询"/>
44 -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> 44 + <input class="btn btn-default" type="button" id="export" value="导出"/>
45 <input class="btn btn-default" type="button" id="print" value="打印"/> 45 <input class="btn btn-default" type="button" id="print" value="打印"/>
46 <!-- <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> --> 46 <!-- <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> -->
47 </div> 47 </div>
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 <tr class="hidden"> 73 <tr class="hidden">
74 <th>序号</th> 74 <th>序号</th>
75 <th>线路</th> 75 <th>线路</th>
76 - <th>路牌</th> 76 +<!-- <th>路牌</th> -->
77 <th>运营车辆</th> 77 <th>运营车辆</th>
78 <th>发送人</th> 78 <th>发送人</th>
79 <th>发送时间</th> 79 <th>发送时间</th>
@@ -93,7 +93,11 @@ @@ -93,7 +93,11 @@
93 </div> 93 </div>
94 94
95 <script> 95 <script>
96 - $(function(){ 96 + $(function(){
  97 + $('#print').attr('disabled', "true");
  98 + $('#export').attr('disabled', "true");
  99 + $('#printArea').hide();
  100 +
97 // 关闭左侧栏 101 // 关闭左侧栏
98 if (!$('body').hasClass('page-sidebar-closed')) 102 if (!$('body').hasClass('page-sidebar-closed'))
99 $('.menu-toggler.sidebar-toggler').click(); 103 $('.menu-toggler.sidebar-toggler').click();
@@ -106,11 +110,11 @@ @@ -106,11 +110,11 @@
106 var year = d.getFullYear(); 110 var year = d.getFullYear();
107 var month = d.getMonth() + 1; 111 var month = d.getMonth() + 1;
108 var day = d.getDate(); 112 var day = d.getDate();
109 - if(month > 9){  
110 - $("#date").val(year + "-" + month + "-" + day);  
111 - } else {  
112 - $("#date").val(year + "-0" + month + "-" + day);  
113 - } 113 + if(month < 9)
  114 + month = "0" + month;
  115 + if(day < 9)
  116 + day = "0" + day;
  117 + $("#date").val(year + "-" + month + "-" + day);
114 118
115 $.get('/basic/lineCode2Name',function(result){ 119 $.get('/basic/lineCode2Name',function(result){
116 var data=[]; 120 var data=[];
@@ -161,17 +165,23 @@ @@ -161,17 +165,23 @@
161 } 165 }
162 }); 166 });
163 167
164 - var date = ''; 168 + var date = '';
  169 + var line = $("#line").val();
165 $("#query").on("click",function(){ 170 $("#query").on("click",function(){
166 - var line = $("#line").val(); 171 + line = $("#line").val();
167 date = $("#date").val(); 172 date = $("#date").val();
168 - var code=$("#code").val(); 173 + var code = $("#code").val();
169 $(".hidden").removeClass("hidden"); 174 $(".hidden").removeClass("hidden");
170 $get('/report/historyMessageCount',{line:line,date:date,code:code},function(result){ 175 $get('/report/historyMessageCount',{line:line,date:date,code:code},function(result){
171 // 把数据填充到模版中 176 // 把数据填充到模版中
172 var tbodyHtml = template('list_msg_info',{list:result}); 177 var tbodyHtml = template('list_msg_info',{list:result});
173 // 把渲染好的模版html文本追加到表格中 178 // 把渲染好的模版html文本追加到表格中
174 - $('#info_msg tbody').html(tbodyHtml); 179 + $('#info_msg tbody').html(tbodyHtml);
  180 +
  181 + $('#print').attr('disabled', "true");
  182 + $('#export').attr('disabled', "true");
  183 + $('#printArea').hide();
  184 +
175 }); 185 });
176 }); 186 });
177 187
@@ -185,21 +195,28 @@ @@ -185,21 +195,28 @@
185 params[index] = $(this).text(); 195 params[index] = $(this).text();
186 }); 196 });
187 jName = params[1]; 197 jName = params[1];
188 - var line = $("#line").val(); 198 + line = $("#line").val();
189 date = $("#date").val(); 199 date = $("#date").val();
190 - $get('/realSchedule/historyMessage',{line:line,date:date,code:jName},function(result){ 200 + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"query"},function(result){
191 var list_history_msg = template('list_history_msg',{list:result}); 201 var list_history_msg = template('list_history_msg',{list:result});
192 // 把渲染好的模版html文本追加到表格中 202 // 把渲染好的模版html文本追加到表格中
193 - $('#forms tbody').html(list_history_msg); 203 + $('#forms tbody').html(list_history_msg);
  204 +
  205 + if(result.length == 0){
  206 + $('#export').attr('disabled', "true");
  207 + $('#print').attr('disabled', "true");
  208 + } else {
  209 + $("#export").removeAttr("disabled");
  210 + $("#print").removeAttr("disabled");
  211 + }
  212 + $('#printArea').show();
  213 +
194 }); 214 });
195 }); 215 });
196 216
197 $("#export").on("click",function(){ 217 $("#export").on("click",function(){
198 - if(params.length < 1){  
199 - return;  
200 - }  
201 - $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){  
202 - window.open("/downloadFile/download?fileName="+jName); 218 + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"export_msg"},function(result){
  219 + window.open("/downloadFile/download?fileName=调度消息分析"+moment(date).format("YYYYMMDD"));
203 }); 220 });
204 }); 221 });
205 222
@@ -236,7 +253,7 @@ @@ -236,7 +253,7 @@
236 <tr> 253 <tr>
237 <td>{{i+1}}</td> 254 <td>{{i+1}}</td>
238 <td>{{obj[4]}}</td> 255 <td>{{obj[4]}}</td>
239 - <td>{{obj[6]}}</td> 256 + <!--<td>{{obj[6]}}</td>-->
240 <td>{{obj[0]}}</td> 257 <td>{{obj[0]}}</td>
241 <td>{{obj[1]}}</td> 258 <td>{{obj[1]}}</td>
242 <td>{{obj[3]}}</td> 259 <td>{{obj[3]}}</td>