Commit a575cb1b3abfb47ddffab66e6555488d9e54493f
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
35 changed files
with
3709 additions
and
1091 deletions
src/main/java/com/bsth/controller/calc/CalcExportController.java
| ... | ... | @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController; |
| 16 | 16 | import com.bsth.common.ResponseCode; |
| 17 | 17 | import com.bsth.entity.calc.CalcWaybill; |
| 18 | 18 | import com.bsth.entity.mcy_forms.Waybillday; |
| 19 | +import com.bsth.service.calc.CalcLbStatuAnalyService; | |
| 19 | 20 | import com.bsth.service.calc.CalcMixService; |
| 20 | 21 | import com.bsth.service.calc.CalcWaybillService; |
| 21 | 22 | import com.bsth.util.ReportUtils; |
| ... | ... | @@ -26,6 +27,9 @@ public class CalcExportController { |
| 26 | 27 | |
| 27 | 28 | @Autowired |
| 28 | 29 | CalcWaybillService service; |
| 30 | + | |
| 31 | + @Autowired | |
| 32 | + CalcLbStatuAnalyService lbService; | |
| 29 | 33 | |
| 30 | 34 | @Autowired |
| 31 | 35 | CalcMixService clacMixService; |
| ... | ... | @@ -204,5 +208,84 @@ public class CalcExportController { |
| 204 | 208 | } |
| 205 | 209 | return resMap; |
| 206 | 210 | } |
| 211 | + | |
| 212 | + @RequestMapping(value = "/lbStatuAnalyExport", method = RequestMethod.GET) | |
| 213 | + public Map<String, Object> lbStatuAnalyExport(@RequestParam Map<String, Object> map) { | |
| 214 | + | |
| 215 | + String gsdm=""; | |
| 216 | + if(map.get("company")!=null){ | |
| 217 | + gsdm=map.get("company").toString().trim(); | |
| 218 | + } | |
| 219 | + String fgsdm=""; | |
| 220 | + if(map.get("subCompany")!=null){ | |
| 221 | + fgsdm=map.get("subCompany").toString().trim(); | |
| 222 | + } | |
| 223 | + String line=""; | |
| 224 | + if(map.get("line")!=null){ | |
| 225 | + line=map.get("line").toString().trim(); | |
| 226 | + } | |
| 227 | + String lineName=""; | |
| 228 | + if(map.get("lineName")!=null){ | |
| 229 | + lineName=map.get("lineName").toString().trim(); | |
| 230 | + } | |
| 231 | + String date=""; | |
| 232 | + if(map.get("startDate")!=null){ | |
| 233 | + date=map.get("startDate").toString().trim(); | |
| 234 | + } | |
| 235 | + String date2=""; | |
| 236 | + if(map.get("endDate")!=null){ | |
| 237 | + date2=map.get("endDate").toString().trim(); | |
| 238 | + } | |
| 239 | + String sfyy=""; | |
| 240 | + if(map.get("sfyy")!=null){ | |
| 241 | + sfyy=map.get("sfyy").toString().trim(); | |
| 242 | + } | |
| 243 | + String type=""; | |
| 244 | + if(map.get("type")!=null){ | |
| 245 | + type=map.get("type").toString().trim(); | |
| 246 | + } | |
| 247 | + | |
| 248 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 249 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 250 | + List<Map<String, Object>> list = lbService.lbStatuAnaly(gsdm, fgsdm, line, date, date2, sfyy, type); | |
| 251 | + | |
| 252 | + for(int i = 0; i < list.size(); i++){ | |
| 253 | + Map<String, Object> temp = list.get(i); | |
| 254 | + temp.put("i", i+1); | |
| 255 | + if(!temp.containsKey("date") || temp.get("date") == null){ | |
| 256 | + temp.put("date", ""); | |
| 257 | + } | |
| 258 | + if(!temp.containsKey("company") || temp.get("company") == null){ | |
| 259 | + temp.put("company", ""); | |
| 260 | + } | |
| 261 | + if(!temp.containsKey("subCompany") || temp.get("subCompany") == null){ | |
| 262 | + temp.put("subCompany", ""); | |
| 263 | + } | |
| 264 | + resList.add(temp); | |
| 265 | + } | |
| 266 | + | |
| 267 | + String Data = date.replaceAll("-", ""); | |
| 268 | + if(!date.equals(date2)){ | |
| 269 | + Data = date.replaceAll("-", "") + "-" + date2.replaceAll("-", ""); | |
| 270 | + } | |
| 271 | + | |
| 272 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 273 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 274 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 275 | + Map<String,Object> mm = new HashMap<String, Object>(); | |
| 276 | + ReportUtils ee = new ReportUtils(); | |
| 277 | + | |
| 278 | + try { | |
| 279 | + listI.add(resList.iterator()); | |
| 280 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 281 | + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcLbStatuAnaly.xls", | |
| 282 | + path+"export/"+Data+"-"+lineName+"-烂班情况分析表(统计).xls"); | |
| 283 | + resMap.put("status", ResponseCode.SUCCESS); | |
| 284 | + } catch (Exception e) { | |
| 285 | + e.printStackTrace(); | |
| 286 | + resMap.put("status", ResponseCode.ERROR); | |
| 287 | + } | |
| 288 | + return resMap; | |
| 289 | + } | |
| 207 | 290 | |
| 208 | 291 | } | ... | ... |
src/main/java/com/bsth/controller/calc/CalcLbStatuAnalyController.java
0 → 100644
| 1 | +package com.bsth.controller.calc; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import com.bsth.controller.BaseController; | |
| 7 | +import com.bsth.entity.calc.CalcLbStatuAnaly; | |
| 8 | +import com.bsth.service.calc.CalcLbStatuAnalyService; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 12 | +import org.springframework.web.bind.annotation.RestController; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Created by 19/03/18. | |
| 16 | + */ | |
| 17 | +@RestController | |
| 18 | +@RequestMapping("calcLbStatuAnaly") | |
| 19 | +public class CalcLbStatuAnalyController extends BaseController<CalcLbStatuAnaly, Integer> { | |
| 20 | + | |
| 21 | + @Autowired | |
| 22 | + private CalcLbStatuAnalyService service; | |
| 23 | + | |
| 24 | + | |
| 25 | + @RequestMapping(value="/lbStatuAnaly") | |
| 26 | + public List<Map<String,Object>> lbStatuAnaly(@RequestParam Map<String, Object> map){ | |
| 27 | + String gsdm=""; | |
| 28 | + if(map.get("company")!=null){ | |
| 29 | + gsdm=map.get("company").toString().trim(); | |
| 30 | + } | |
| 31 | + String fgsdm=""; | |
| 32 | + if(map.get("subCompany")!=null){ | |
| 33 | + fgsdm=map.get("subCompany").toString().trim(); | |
| 34 | + } | |
| 35 | + String line=""; | |
| 36 | + if(map.get("line")!=null){ | |
| 37 | + line=map.get("line").toString().trim(); | |
| 38 | + } | |
| 39 | + String date=""; | |
| 40 | + if(map.get("startDate")!=null){ | |
| 41 | + date=map.get("startDate").toString().trim(); | |
| 42 | + } | |
| 43 | + String date2=""; | |
| 44 | + if(map.get("endDate")!=null){ | |
| 45 | + date2=map.get("endDate").toString().trim(); | |
| 46 | + } | |
| 47 | + String sfyy=""; | |
| 48 | + if(map.get("sfyy")!=null){ | |
| 49 | + sfyy=map.get("sfyy").toString().trim(); | |
| 50 | + } | |
| 51 | + String type=""; | |
| 52 | + if(map.get("type")!=null){ | |
| 53 | + type=map.get("type").toString().trim(); | |
| 54 | + } | |
| 55 | + return service.lbStatuAnaly(gsdm,fgsdm,line,date,date2,sfyy,type); | |
| 56 | + } | |
| 57 | + | |
| 58 | +} | ... | ... |
src/main/java/com/bsth/entity/calc/CalcLbStatuAnaly.java
0 → 100644
| 1 | +package com.bsth.entity.calc; | |
| 2 | + | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +import javax.persistence.Entity; | |
| 6 | +import javax.persistence.GeneratedValue; | |
| 7 | +import javax.persistence.Id; | |
| 8 | +import javax.persistence.Table; | |
| 9 | + | |
| 10 | +@Entity | |
| 11 | +@Table(name = "calc_lb_statu_analy") | |
| 12 | +public class CalcLbStatuAnaly { | |
| 13 | + /* 主键*/ | |
| 14 | + @Id | |
| 15 | + @GeneratedValue | |
| 16 | + private Long id; | |
| 17 | + /* 公司代码*/ | |
| 18 | + private String gsdm; | |
| 19 | + /* 公司名称*/ | |
| 20 | + private String gsname; | |
| 21 | + /* 分公司代码*/ | |
| 22 | + private String fgsdm; | |
| 23 | + /* 分公司名称*/ | |
| 24 | + private String fgsname; | |
| 25 | + /* 日期*/ | |
| 26 | + private Date rq; | |
| 27 | + /* 日期字符串*/ | |
| 28 | + private String rqStr; | |
| 29 | + /* 线路编码*/ | |
| 30 | + private String xl; | |
| 31 | + /* 线路名称*/ | |
| 32 | + private String xlName; | |
| 33 | + /* 计划班次*/ | |
| 34 | + private int jhbc; | |
| 35 | + /* 实际班次*/ | |
| 36 | + private int sjbc; | |
| 37 | + /* 计划里程*/ | |
| 38 | + private Double jhlc; | |
| 39 | + /* 实际公里*/ | |
| 40 | + private Double sjlc; | |
| 41 | + /* 路阻(烂班班次)*/ | |
| 42 | + private int lzbc; | |
| 43 | + /* 路阻(烂班里程)*/ | |
| 44 | + private Double lzlc; | |
| 45 | + /* 吊慢(烂班班次)*/ | |
| 46 | + private int dmbc; | |
| 47 | + /* 吊慢(烂班里程)*/ | |
| 48 | + private Double dmlc; | |
| 49 | + /* 故障(烂班班次)*/ | |
| 50 | + private int gzbc; | |
| 51 | + /* 故障(烂班里程)*/ | |
| 52 | + private Double gzlc; | |
| 53 | + /* 纠纷(烂班班次)*/ | |
| 54 | + private int jfbc; | |
| 55 | + /* 纠纷(烂班里程)*/ | |
| 56 | + private Double jflc; | |
| 57 | + /* 肇事(烂班班次)*/ | |
| 58 | + private int zsbc; | |
| 59 | + /* 肇事(烂班里程)*/ | |
| 60 | + private Double zslc; | |
| 61 | + /* 缺人(烂班班次)*/ | |
| 62 | + private int qrbc; | |
| 63 | + /* 缺人(烂班里程)*/ | |
| 64 | + private Double qrlc; | |
| 65 | + /* 缺车(烂班班次)*/ | |
| 66 | + private int qcbc; | |
| 67 | + /* 缺车(烂班里程)*/ | |
| 68 | + private Double qclc; | |
| 69 | + /* 客稀(烂班班次)*/ | |
| 70 | + private int kxbc; | |
| 71 | + /* 客稀(烂班里程)*/ | |
| 72 | + private Double kxlc; | |
| 73 | + /* 气候(烂班班次)*/ | |
| 74 | + private int qhbc; | |
| 75 | + /* 气候(烂班里程)*/ | |
| 76 | + private Double qhlc; | |
| 77 | + /* 援外(烂班班次)*/ | |
| 78 | + private int ywbc; | |
| 79 | + /* 援外(烂班里程)*/ | |
| 80 | + private Double ywlc; | |
| 81 | + /* 其他(烂班班次)*/ | |
| 82 | + private int qtbc; | |
| 83 | + /* 其他(烂班里程)*/ | |
| 84 | + private Double qtlc; | |
| 85 | + /* 备注*/ | |
| 86 | + private String remark; | |
| 87 | + | |
| 88 | + | |
| 89 | + public Long getId() { | |
| 90 | + return id; | |
| 91 | + } | |
| 92 | + public void setId(Long id) { | |
| 93 | + this.id = id; | |
| 94 | + } | |
| 95 | + public String getGsdm() { | |
| 96 | + return gsdm; | |
| 97 | + } | |
| 98 | + public void setGsdm(String gsdm) { | |
| 99 | + this.gsdm = gsdm; | |
| 100 | + } | |
| 101 | + public String getGsname() { | |
| 102 | + return gsname; | |
| 103 | + } | |
| 104 | + public void setGsname(String gsname) { | |
| 105 | + this.gsname = gsname; | |
| 106 | + } | |
| 107 | + public String getFgsdm() { | |
| 108 | + return fgsdm; | |
| 109 | + } | |
| 110 | + public void setFgsdm(String fgsdm) { | |
| 111 | + this.fgsdm = fgsdm; | |
| 112 | + } | |
| 113 | + public String getFgsname() { | |
| 114 | + return fgsname; | |
| 115 | + } | |
| 116 | + public void setFgsname(String fgsname) { | |
| 117 | + this.fgsname = fgsname; | |
| 118 | + } | |
| 119 | + public Date getRq() { | |
| 120 | + return rq; | |
| 121 | + } | |
| 122 | + public void setRq(Date rq) { | |
| 123 | + this.rq = rq; | |
| 124 | + } | |
| 125 | + public String getRqStr() { | |
| 126 | + return rqStr; | |
| 127 | + } | |
| 128 | + public void setRqStr(String rqStr) { | |
| 129 | + this.rqStr = rqStr; | |
| 130 | + } | |
| 131 | + public String getXl() { | |
| 132 | + return xl; | |
| 133 | + } | |
| 134 | + public void setXl(String xl) { | |
| 135 | + this.xl = xl; | |
| 136 | + } | |
| 137 | + public String getXlName() { | |
| 138 | + return xlName; | |
| 139 | + } | |
| 140 | + public void setXlName(String xlName) { | |
| 141 | + this.xlName = xlName; | |
| 142 | + } | |
| 143 | + public int getJhbc() { | |
| 144 | + return jhbc; | |
| 145 | + } | |
| 146 | + public void setJhbc(int jhbc) { | |
| 147 | + this.jhbc = jhbc; | |
| 148 | + } | |
| 149 | + public int getSjbc() { | |
| 150 | + return sjbc; | |
| 151 | + } | |
| 152 | + public void setSjbc(int sjbc) { | |
| 153 | + this.sjbc = sjbc; | |
| 154 | + } | |
| 155 | + public Double getJhlc() { | |
| 156 | + return jhlc; | |
| 157 | + } | |
| 158 | + public void setJhlc(Double jhlc) { | |
| 159 | + this.jhlc = jhlc; | |
| 160 | + } | |
| 161 | + public Double getSjlc() { | |
| 162 | + return sjlc; | |
| 163 | + } | |
| 164 | + public void setSjlc(Double sjlc) { | |
| 165 | + this.sjlc = sjlc; | |
| 166 | + } | |
| 167 | + public int getLzbc() { | |
| 168 | + return lzbc; | |
| 169 | + } | |
| 170 | + public void setLzbc(int lzbc) { | |
| 171 | + this.lzbc = lzbc; | |
| 172 | + } | |
| 173 | + public Double getLzlc() { | |
| 174 | + return lzlc; | |
| 175 | + } | |
| 176 | + public void setLzlc(Double lzlc) { | |
| 177 | + this.lzlc = lzlc; | |
| 178 | + } | |
| 179 | + public int getDmbc() { | |
| 180 | + return dmbc; | |
| 181 | + } | |
| 182 | + public void setDmbc(int dmbc) { | |
| 183 | + this.dmbc = dmbc; | |
| 184 | + } | |
| 185 | + public Double getDmlc() { | |
| 186 | + return dmlc; | |
| 187 | + } | |
| 188 | + public void setDmlc(Double dmlc) { | |
| 189 | + this.dmlc = dmlc; | |
| 190 | + } | |
| 191 | + public int getGzbc() { | |
| 192 | + return gzbc; | |
| 193 | + } | |
| 194 | + public void setGzbc(int gzbc) { | |
| 195 | + this.gzbc = gzbc; | |
| 196 | + } | |
| 197 | + public Double getGzlc() { | |
| 198 | + return gzlc; | |
| 199 | + } | |
| 200 | + public void setGzlc(Double gzlc) { | |
| 201 | + this.gzlc = gzlc; | |
| 202 | + } | |
| 203 | + public int getJfbc() { | |
| 204 | + return jfbc; | |
| 205 | + } | |
| 206 | + public void setJfbc(int jfbc) { | |
| 207 | + this.jfbc = jfbc; | |
| 208 | + } | |
| 209 | + public Double getJflc() { | |
| 210 | + return jflc; | |
| 211 | + } | |
| 212 | + public void setJflc(Double jflc) { | |
| 213 | + this.jflc = jflc; | |
| 214 | + } | |
| 215 | + public int getZsbc() { | |
| 216 | + return zsbc; | |
| 217 | + } | |
| 218 | + public void setZsbc(int zsbc) { | |
| 219 | + this.zsbc = zsbc; | |
| 220 | + } | |
| 221 | + public Double getZslc() { | |
| 222 | + return zslc; | |
| 223 | + } | |
| 224 | + public void setZslc(Double zslc) { | |
| 225 | + this.zslc = zslc; | |
| 226 | + } | |
| 227 | + public int getQrbc() { | |
| 228 | + return qrbc; | |
| 229 | + } | |
| 230 | + public void setQrbc(int qrbc) { | |
| 231 | + this.qrbc = qrbc; | |
| 232 | + } | |
| 233 | + public Double getQrlc() { | |
| 234 | + return qrlc; | |
| 235 | + } | |
| 236 | + public void setQrlc(Double qrlc) { | |
| 237 | + this.qrlc = qrlc; | |
| 238 | + } | |
| 239 | + public int getQcbc() { | |
| 240 | + return qcbc; | |
| 241 | + } | |
| 242 | + public void setQcbc(int qcbc) { | |
| 243 | + this.qcbc = qcbc; | |
| 244 | + } | |
| 245 | + public Double getQclc() { | |
| 246 | + return qclc; | |
| 247 | + } | |
| 248 | + public void setQclc(Double qclc) { | |
| 249 | + this.qclc = qclc; | |
| 250 | + } | |
| 251 | + public int getKxbc() { | |
| 252 | + return kxbc; | |
| 253 | + } | |
| 254 | + public void setKxbc(int kxbc) { | |
| 255 | + this.kxbc = kxbc; | |
| 256 | + } | |
| 257 | + public Double getKxlc() { | |
| 258 | + return kxlc; | |
| 259 | + } | |
| 260 | + public void setKxlc(Double kxlc) { | |
| 261 | + this.kxlc = kxlc; | |
| 262 | + } | |
| 263 | + public int getQhbc() { | |
| 264 | + return qhbc; | |
| 265 | + } | |
| 266 | + public void setQhbc(int qhbc) { | |
| 267 | + this.qhbc = qhbc; | |
| 268 | + } | |
| 269 | + public Double getQhlc() { | |
| 270 | + return qhlc; | |
| 271 | + } | |
| 272 | + public void setQhlc(Double qhlc) { | |
| 273 | + this.qhlc = qhlc; | |
| 274 | + } | |
| 275 | + public int getYwbc() { | |
| 276 | + return ywbc; | |
| 277 | + } | |
| 278 | + public void setYwbc(int ywbc) { | |
| 279 | + this.ywbc = ywbc; | |
| 280 | + } | |
| 281 | + public Double getYwlc() { | |
| 282 | + return ywlc; | |
| 283 | + } | |
| 284 | + public void setYwlc(Double ywlc) { | |
| 285 | + this.ywlc = ywlc; | |
| 286 | + } | |
| 287 | + public int getQtbc() { | |
| 288 | + return qtbc; | |
| 289 | + } | |
| 290 | + public void setQtbc(int qtbc) { | |
| 291 | + this.qtbc = qtbc; | |
| 292 | + } | |
| 293 | + public Double getQtlc() { | |
| 294 | + return qtlc; | |
| 295 | + } | |
| 296 | + public void setQtlc(Double qtlc) { | |
| 297 | + this.qtlc = qtlc; | |
| 298 | + } | |
| 299 | + public String getRemark() { | |
| 300 | + return remark; | |
| 301 | + } | |
| 302 | + public void setRemark(String remark) { | |
| 303 | + this.remark = remark; | |
| 304 | + } | |
| 305 | + | |
| 306 | +} | ... | ... |
src/main/java/com/bsth/repository/calc/CalcLbStatuAnalyRepository.java
0 → 100644
| 1 | +package com.bsth.repository.calc; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import javax.transaction.Transactional; | |
| 6 | + | |
| 7 | +import com.bsth.entity.calc.CalcLbStatuAnaly; | |
| 8 | +import com.bsth.repository.BaseRepository; | |
| 9 | + | |
| 10 | +import org.springframework.data.jpa.repository.Modifying; | |
| 11 | +import org.springframework.data.jpa.repository.Query; | |
| 12 | +import org.springframework.stereotype.Repository; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * | |
| 16 | + */ | |
| 17 | +@Repository | |
| 18 | +public interface CalcLbStatuAnalyRepository extends BaseRepository<CalcLbStatuAnaly, Integer>{ | |
| 19 | + | |
| 20 | + //按照时间段统计,公司下线路 | |
| 21 | + @Query(value="select DISTINCT c from CalcLbStatuAnaly c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.xl") | |
| 22 | + List<CalcLbStatuAnaly> selectByDateAndLine(String line,String date,String date2,String gsdm,String fgsdm); | |
| 23 | + | |
| 24 | + //按照时间段统计,单条线路 | |
| 25 | + @Query(value="select DISTINCT c from CalcLbStatuAnaly c where c.xl = ?1 and c.rqStr between ?2 and ?3 order by c.xl") | |
| 26 | + List<CalcLbStatuAnaly> selectByDateAndLine(String line,String date,String date2); | |
| 27 | + | |
| 28 | + //按照日期和线路删除数据 | |
| 29 | + @Modifying | |
| 30 | + @Transactional | |
| 31 | + @Query(value = "delete CalcLbStatuAnaly c where c.rqStr=?1 and c.xl=?2") | |
| 32 | + void deleteByDateAndLine(String date, String line); | |
| 33 | + | |
| 34 | + //按照日期删除数据 | |
| 35 | + @Modifying | |
| 36 | + @Transactional | |
| 37 | + @Query(value = "delete CalcLbStatuAnaly c where c.rqStr=?1") | |
| 38 | + void deleteByDate(String date); | |
| 39 | + | |
| 40 | +} | ... | ... |
src/main/java/com/bsth/service/calc/CalcLbStatuAnalyService.java
0 → 100644
| 1 | +package com.bsth.service.calc; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import com.bsth.entity.calc.CalcLbStatuAnaly; | |
| 7 | +import com.bsth.service.BaseService; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by 19/03/18. | |
| 11 | + */ | |
| 12 | +public interface CalcLbStatuAnalyService extends BaseService<CalcLbStatuAnaly, Integer> { | |
| 13 | + | |
| 14 | + List<Map<String, Object>> lbStatuAnaly(String gsdm, String fgsdm, String line, String date, String date2, String sfyy, String type); | |
| 15 | + | |
| 16 | +} | ... | ... |
src/main/java/com/bsth/service/calc/impl/CalcLbStatuAnalyServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.calc.impl; | |
| 2 | + | |
| 3 | +import java.util.ArrayList; | |
| 4 | +import java.util.Collections; | |
| 5 | +import java.util.Comparator; | |
| 6 | +import java.util.HashMap; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +import com.bsth.entity.calc.CalcLbStatuAnaly; | |
| 11 | +import com.bsth.repository.calc.CalcLbStatuAnalyRepository; | |
| 12 | +import com.bsth.service.LineService; | |
| 13 | +import com.bsth.service.calc.CalcLbStatuAnalyService; | |
| 14 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 15 | +import com.bsth.util.Arith; | |
| 16 | + | |
| 17 | +import org.slf4j.Logger; | |
| 18 | +import org.slf4j.LoggerFactory; | |
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 20 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 21 | +import org.springframework.stereotype.Service; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * Created by 19/03/18. | |
| 25 | + */ | |
| 26 | +@Service | |
| 27 | +public class CalcLbStatuAnalyServiceImpl extends BaseServiceImpl<CalcLbStatuAnaly, Integer> implements CalcLbStatuAnalyService { | |
| 28 | + | |
| 29 | + @Autowired | |
| 30 | + private CalcLbStatuAnalyRepository calcRepository; | |
| 31 | + | |
| 32 | + @Autowired | |
| 33 | + private LineService lineService; | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + JdbcTemplate jdbcTemplate; | |
| 37 | + | |
| 38 | + | |
| 39 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 40 | + | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public List<Map<String, Object>> lbStatuAnaly(String gsdm, String fgsdm, | |
| 44 | + String line, String date, String date2, String sfyy, String type) { | |
| 45 | + // TODO Auto-generated method stub | |
| 46 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 47 | + List<CalcLbStatuAnaly> query = calcRepository.selectByDateAndLine(line, date, date2, gsdm, fgsdm); | |
| 48 | + Map<String, Boolean> lineNature = lineService.lineNature(); | |
| 49 | + Map<String, List<CalcLbStatuAnaly>> keyMap = new HashMap<String, List<CalcLbStatuAnaly>>(); | |
| 50 | + List<String> keyList = new ArrayList<String>(); | |
| 51 | + | |
| 52 | + String[] Date1 = date.split("-"); | |
| 53 | + String[] Date2 = date2.split("-"); | |
| 54 | + String Date = ""; | |
| 55 | + if(date.equals(date2)) | |
| 56 | + Date = Date1[0] + "年" + Date1[1] + "月" + Date1[2] + "日"; | |
| 57 | + else | |
| 58 | + Date = Date1[0] + "年" + Date1[1] + "月" + Date1[2] + "日 - " | |
| 59 | + + Date2[0] + "年" + Date2[1] + "月" + Date2[2] + "日"; | |
| 60 | + | |
| 61 | + for(CalcLbStatuAnaly lb : query){ | |
| 62 | + String xlBm = lb.getXl(); | |
| 63 | + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){ | |
| 64 | + if(sfyy.equals("1") && !lineNature.get(xlBm)){ | |
| 65 | + continue; | |
| 66 | + } else if(sfyy.equals("2") && lineNature.get(xlBm)){ | |
| 67 | + continue; | |
| 68 | + } | |
| 69 | + } else if(sfyy.equals("2")){ | |
| 70 | + continue; | |
| 71 | + } | |
| 72 | + | |
| 73 | + String key = lb.getGsdm() + "/" + lb.getFgsdm() + "/" + lb.getXl(); | |
| 74 | + | |
| 75 | + if(!keyMap.containsKey(key)){ | |
| 76 | + keyMap.put(key, new ArrayList<CalcLbStatuAnaly>()); | |
| 77 | + keyList.add(key); | |
| 78 | + } | |
| 79 | + keyMap.get(key).add(lb); | |
| 80 | + } | |
| 81 | + | |
| 82 | + Collections.sort(keyList, new Comparator<String>() { | |
| 83 | + | |
| 84 | + public int compare(String o1, String o2) { | |
| 85 | + | |
| 86 | + Long a = 0l; | |
| 87 | + Long b = 0l; | |
| 88 | + String[] split1 = o1.split("/"); | |
| 89 | + String[] split2 = o2.split("/"); | |
| 90 | + char[] charArray1 = split1[2].toCharArray(); | |
| 91 | + char[] charArray2 = split2[2].toCharArray(); | |
| 92 | + for(int i = 0; i < charArray1.length; i++){ | |
| 93 | + long temp = 1l; | |
| 94 | + for(int j = 0; j < i; j++) | |
| 95 | + temp *= 10; | |
| 96 | + a += (long)charArray1[charArray1.length - 1 - i] * temp; | |
| 97 | + } | |
| 98 | + for(int i = 0; i < charArray2.length; i++){ | |
| 99 | + long temp = 1l; | |
| 100 | + for(int j = 0; j < i; j++) | |
| 101 | + temp *= 10; | |
| 102 | + b += (long)charArray2[charArray2.length - 1 - i] * temp; | |
| 103 | + } | |
| 104 | + | |
| 105 | + return a.compareTo(b); | |
| 106 | + } | |
| 107 | + }); | |
| 108 | + Collections.sort(keyList, new Comparator<String>() { | |
| 109 | + | |
| 110 | + public int compare(String o1, String o2) { | |
| 111 | + | |
| 112 | + Long a = 0l; | |
| 113 | + Long b = 0l; | |
| 114 | + String[] split1 = o1.split("/"); | |
| 115 | + String[] split2 = o2.split("/"); | |
| 116 | + char[] charArray1 = split1[1].toCharArray(); | |
| 117 | + char[] charArray2 = split2[1].toCharArray(); | |
| 118 | + for(int i = 0; i < charArray1.length; i++){ | |
| 119 | + long temp = 1l; | |
| 120 | + for(int j = 0; j < i; j++) | |
| 121 | + temp *= 10; | |
| 122 | + a += (long)charArray1[charArray1.length - 1 - i] * temp; | |
| 123 | + } | |
| 124 | + for(int i = 0; i < charArray2.length; i++){ | |
| 125 | + long temp = 1l; | |
| 126 | + for(int j = 0; j < i; j++) | |
| 127 | + temp *= 10; | |
| 128 | + b += (long)charArray2[charArray2.length - 1 - i] * temp; | |
| 129 | + } | |
| 130 | + | |
| 131 | + return a.compareTo(b); | |
| 132 | + } | |
| 133 | + }); | |
| 134 | + | |
| 135 | + String company = "", subCompany = "", lineName = ""; | |
| 136 | + Map<String, Object> lastMap = new HashMap<String, Object>(); | |
| 137 | + lastMap.put("line", "合计"); | |
| 138 | + for(String key : keyList){ | |
| 139 | + List<CalcLbStatuAnaly> list = keyMap.get(key); | |
| 140 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 141 | + company = ""; | |
| 142 | + subCompany = ""; | |
| 143 | + lineName = ""; | |
| 144 | + for(CalcLbStatuAnaly lb : list){ | |
| 145 | + if(lb.getGsname() != null && company.trim().length() == 0) | |
| 146 | + company = lb.getGsname(); | |
| 147 | + if(lb.getFgsname() != null && subCompany.trim().length() == 0) | |
| 148 | + subCompany = lb.getFgsname(); | |
| 149 | + if(lb.getXlName() != null && lineName.trim().length() == 0) | |
| 150 | + lineName = lb.getXlName(); | |
| 151 | + m.put("jhbc", Arith.add(m.get("jhbc")!=null?m.get("jhbc"):"0", lb.getJhbc())); | |
| 152 | + m.put("sjbc", Arith.add(m.get("sjbc")!=null?m.get("sjbc"):"0", lb.getSjbc())); | |
| 153 | + m.put("jhlc", Arith.add(m.get("jhlc")!=null?m.get("jhlc"):"0", lb.getJhlc()!=null?lb.getJhlc():"0")); | |
| 154 | + m.put("sjlc", Arith.add(m.get("sjlc")!=null?m.get("sjlc"):"0", lb.getSjlc()!=null?lb.getSjlc():"0")); | |
| 155 | + m.put("lzbc", Arith.add(m.get("lzbc")!=null?m.get("lzbc"):"0", lb.getLzbc())); | |
| 156 | + m.put("lzlc", Arith.add(m.get("lzlc")!=null?m.get("lzlc"):"0", lb.getLzlc()!=null?lb.getLzlc():"0")); | |
| 157 | + m.put("dmbc", Arith.add(m.get("dmbc")!=null?m.get("dmbc"):"0", lb.getDmbc())); | |
| 158 | + m.put("dmlc", Arith.add(m.get("dmlc")!=null?m.get("dmlc"):"0", lb.getDmlc()!=null?lb.getDmlc():"0")); | |
| 159 | + m.put("gzbc", Arith.add(m.get("gzbc")!=null?m.get("gzbc"):"0", lb.getGzbc())); | |
| 160 | + m.put("gzlc", Arith.add(m.get("gzlc")!=null?m.get("gzlc"):"0", lb.getGzlc()!=null?lb.getGzlc():"0")); | |
| 161 | + m.put("jfbc", Arith.add(m.get("jfbc")!=null?m.get("jfbc"):"0", lb.getJfbc())); | |
| 162 | + m.put("jflc", Arith.add(m.get("jflc")!=null?m.get("jflc"):"0", lb.getJflc()!=null?lb.getJflc():"0")); | |
| 163 | + m.put("zsbc", Arith.add(m.get("zsbc")!=null?m.get("zsbc"):"0", lb.getZsbc())); | |
| 164 | + m.put("zslc", Arith.add(m.get("zslc")!=null?m.get("zslc"):"0", lb.getZslc()!=null?lb.getZslc():"0")); | |
| 165 | + m.put("qrbc", Arith.add(m.get("qrbc")!=null?m.get("qrbc"):"0", lb.getQrbc())); | |
| 166 | + m.put("qrlc", Arith.add(m.get("qrlc")!=null?m.get("qrlc"):"0", lb.getQrlc()!=null?lb.getQrlc():"0")); | |
| 167 | + m.put("qcbc", Arith.add(m.get("qcbc")!=null?m.get("qcbc"):"0", lb.getQcbc())); | |
| 168 | + m.put("qclc", Arith.add(m.get("qclc")!=null?m.get("qclc"):"0", lb.getQclc()!=null?lb.getQclc():"0")); | |
| 169 | + m.put("kxbc", Arith.add(m.get("kxbc")!=null?m.get("kxbc"):"0", lb.getKxbc())); | |
| 170 | + m.put("kxlc", Arith.add(m.get("kxlc")!=null?m.get("kxlc"):"0", lb.getKxlc()!=null?lb.getKxlc():"0")); | |
| 171 | + m.put("qhbc", Arith.add(m.get("qhbc")!=null?m.get("qhbc"):"0", lb.getQhbc())); | |
| 172 | + m.put("qhlc", Arith.add(m.get("qhlc")!=null?m.get("qhlc"):"0", lb.getQhlc()!=null?lb.getQhlc():"0")); | |
| 173 | + m.put("ywbc", Arith.add(m.get("ywbc")!=null?m.get("ywbc"):"0", lb.getYwbc())); | |
| 174 | + m.put("ywlc", Arith.add(m.get("ywlc")!=null?m.get("ywlc"):"0", lb.getYwlc()!=null?lb.getYwlc():"0")); | |
| 175 | + m.put("qtbc", Arith.add(m.get("qtbc")!=null?m.get("qtbc"):"0", lb.getQtbc())); | |
| 176 | + m.put("qtlc", Arith.add(m.get("qtlc")!=null?m.get("qtlc"):"0", lb.getQtlc()!=null?lb.getQtlc():"0")); | |
| 177 | + } | |
| 178 | + m.put("date", Date); | |
| 179 | + m.put("company", company); | |
| 180 | + m.put("subCompany", subCompany); | |
| 181 | + m.put("line", lineName); | |
| 182 | + resList.add(m); | |
| 183 | + | |
| 184 | + lastMap.put("jhbc", Arith.add(m.get("jhbc")!=null?m.get("jhbc"):"0", lastMap.get("jhbc")!=null?lastMap.get("jhbc"):"0")); | |
| 185 | + lastMap.put("sjbc", Arith.add(m.get("sjbc")!=null?m.get("sjbc"):"0", lastMap.get("sjbc")!=null?lastMap.get("sjbc"):"0")); | |
| 186 | + lastMap.put("jhlc", Arith.add(m.get("jhlc")!=null?m.get("jhlc"):"0", lastMap.get("jhlc")!=null?lastMap.get("jhlc"):"0")); | |
| 187 | + lastMap.put("sjlc", Arith.add(m.get("sjlc")!=null?m.get("sjlc"):"0", lastMap.get("sjlc")!=null?lastMap.get("sjlc"):"0")); | |
| 188 | + lastMap.put("lzbc", Arith.add(m.get("lzbc")!=null?m.get("lzbc"):"0", lastMap.get("lzbc")!=null?lastMap.get("lzbc"):"0")); | |
| 189 | + lastMap.put("lzlc", Arith.add(m.get("lzlc")!=null?m.get("lzlc"):"0", lastMap.get("lzlc")!=null?lastMap.get("lzlc"):"0")); | |
| 190 | + lastMap.put("dmbc", Arith.add(m.get("dmbc")!=null?m.get("dmbc"):"0", lastMap.get("dmbc")!=null?lastMap.get("dmbc"):"0")); | |
| 191 | + lastMap.put("dmlc", Arith.add(m.get("dmlc")!=null?m.get("dmlc"):"0", lastMap.get("dmlc")!=null?lastMap.get("dmlc"):"0")); | |
| 192 | + lastMap.put("gzbc", Arith.add(m.get("gzbc")!=null?m.get("gzbc"):"0", lastMap.get("gzbc")!=null?lastMap.get("gzbc"):"0")); | |
| 193 | + lastMap.put("gzlc", Arith.add(m.get("gzlc")!=null?m.get("gzlc"):"0", lastMap.get("gzlc")!=null?lastMap.get("gzlc"):"0")); | |
| 194 | + lastMap.put("jfbc", Arith.add(m.get("jfbc")!=null?m.get("jfbc"):"0", lastMap.get("jfbc")!=null?lastMap.get("jfbc"):"0")); | |
| 195 | + lastMap.put("jflc", Arith.add(m.get("jflc")!=null?m.get("jflc"):"0", lastMap.get("jflc")!=null?lastMap.get("jflc"):"0")); | |
| 196 | + lastMap.put("zsbc", Arith.add(m.get("zsbc")!=null?m.get("zsbc"):"0", lastMap.get("zsbc")!=null?lastMap.get("zsbc"):"0")); | |
| 197 | + lastMap.put("zslc", Arith.add(m.get("zslc")!=null?m.get("zslc"):"0", lastMap.get("zslc")!=null?lastMap.get("zslc"):"0")); | |
| 198 | + lastMap.put("qrbc", Arith.add(m.get("qrbc")!=null?m.get("qrbc"):"0", lastMap.get("qrbc")!=null?lastMap.get("qrbc"):"0")); | |
| 199 | + lastMap.put("qrlc", Arith.add(m.get("qrlc")!=null?m.get("qrlc"):"0", lastMap.get("qrlc")!=null?lastMap.get("qrlc"):"0")); | |
| 200 | + lastMap.put("qcbc", Arith.add(m.get("qcbc")!=null?m.get("qcbc"):"0", lastMap.get("qcbc")!=null?lastMap.get("qcbc"):"0")); | |
| 201 | + lastMap.put("qclc", Arith.add(m.get("qclc")!=null?m.get("qclc"):"0", lastMap.get("qclc")!=null?lastMap.get("qclc"):"0")); | |
| 202 | + lastMap.put("kxbc", Arith.add(m.get("kxbc")!=null?m.get("kxbc"):"0", lastMap.get("kxbc")!=null?lastMap.get("kxbc"):"0")); | |
| 203 | + lastMap.put("kxlc", Arith.add(m.get("kxlc")!=null?m.get("kxlc"):"0", lastMap.get("kxlc")!=null?lastMap.get("kxlc"):"0")); | |
| 204 | + lastMap.put("qhbc", Arith.add(m.get("qhbc")!=null?m.get("qhbc"):"0", lastMap.get("qhbc")!=null?lastMap.get("qhbc"):"0")); | |
| 205 | + lastMap.put("qhlc", Arith.add(m.get("qhlc")!=null?m.get("qhlc"):"0", lastMap.get("qhlc")!=null?lastMap.get("qhlc"):"0")); | |
| 206 | + lastMap.put("ywbc", Arith.add(m.get("ywbc")!=null?m.get("ywbc"):"0", lastMap.get("ywbc")!=null?lastMap.get("ywbc"):"0")); | |
| 207 | + lastMap.put("ywlc", Arith.add(m.get("ywlc")!=null?m.get("ywlc"):"0", lastMap.get("ywlc")!=null?lastMap.get("ywlc"):"0")); | |
| 208 | + lastMap.put("qtbc", Arith.add(m.get("qtbc")!=null?m.get("qtbc"):"0", lastMap.get("qtbc")!=null?lastMap.get("qtbc"):"0")); | |
| 209 | + lastMap.put("qtlc", Arith.add(m.get("qtlc")!=null?m.get("qtlc"):"0", lastMap.get("qtlc")!=null?lastMap.get("qtlc"):"0")); | |
| 210 | + } | |
| 211 | + | |
| 212 | + if(resList.size() > 0){ | |
| 213 | + resList.add(lastMap); | |
| 214 | + for(Map<String, Object> m : resList){ | |
| 215 | + if(Arith.compareTo(m.get("sjbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 216 | + m.put("bcbfb", Arith.div(Arith.mul(m.get("sjbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 217 | + } else { | |
| 218 | + m.put("bcbfb", "0%"); | |
| 219 | + } | |
| 220 | + if(Arith.compareTo(m.get("sjlc"), 0) == 1 && Arith.compareTo(m.get("jhlc"), 0) == 1){ | |
| 221 | + m.put("lcbfb", Arith.div(Arith.mul(m.get("sjlc"), 100), m.get("jhlc"), 2) + "%"); | |
| 222 | + } else { | |
| 223 | + m.put("lcbfb", "0%"); | |
| 224 | + } | |
| 225 | + if(Arith.compareTo(m.get("lzbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 226 | + m.put("lzbfb", Arith.div(Arith.mul(m.get("lzbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 227 | + } else { | |
| 228 | + m.put("lzbfb", "0%"); | |
| 229 | + } | |
| 230 | + if(Arith.compareTo(m.get("dmbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 231 | + m.put("dmbfb", Arith.div(Arith.mul(m.get("dmbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 232 | + } else { | |
| 233 | + m.put("dmbfb", "0%"); | |
| 234 | + } | |
| 235 | + if(Arith.compareTo(m.get("gzbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 236 | + m.put("gzbfb", Arith.div(Arith.mul(m.get("gzbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 237 | + } else { | |
| 238 | + m.put("gzbfb", "0%"); | |
| 239 | + } | |
| 240 | + if(Arith.compareTo(m.get("jfbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 241 | + m.put("jfbfb", Arith.div(Arith.mul(m.get("jfbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 242 | + } else { | |
| 243 | + m.put("jfbfb", "0%"); | |
| 244 | + } | |
| 245 | + if(Arith.compareTo(m.get("zsbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 246 | + m.put("zsbfb", Arith.div(Arith.mul(m.get("zsbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 247 | + } else { | |
| 248 | + m.put("zsbfb", "0%"); | |
| 249 | + } | |
| 250 | + if(Arith.compareTo(m.get("qrbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 251 | + m.put("qrbfb", Arith.div(Arith.mul(m.get("qrbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 252 | + } else { | |
| 253 | + m.put("qrbfb", "0%"); | |
| 254 | + } | |
| 255 | + if(Arith.compareTo(m.get("qcbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 256 | + m.put("qcbfb", Arith.div(Arith.mul(m.get("qcbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 257 | + } else { | |
| 258 | + m.put("qcbfb", "0%"); | |
| 259 | + } | |
| 260 | + if(Arith.compareTo(m.get("kxbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 261 | + m.put("kxbfb", Arith.div(Arith.mul(m.get("kxbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 262 | + } else { | |
| 263 | + m.put("kxbfb", "0%"); | |
| 264 | + } | |
| 265 | + if(Arith.compareTo(m.get("qhbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 266 | + m.put("qhbfb", Arith.div(Arith.mul(m.get("qhbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 267 | + } else { | |
| 268 | + m.put("qhbfb", "0%"); | |
| 269 | + } | |
| 270 | + if(Arith.compareTo(m.get("ywbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 271 | + m.put("ywbfb", Arith.div(Arith.mul(m.get("ywbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 272 | + } else { | |
| 273 | + m.put("ywbfb", "0%"); | |
| 274 | + } | |
| 275 | + if(Arith.compareTo(m.get("qtbc"), 0) == 1 && Arith.compareTo(m.get("jhbc"), 0) == 1){ | |
| 276 | + m.put("qtbfb", Arith.div(Arith.mul(m.get("qtbc"), 100), m.get("jhbc"), 2) + "%"); | |
| 277 | + } else { | |
| 278 | + m.put("qtbfb", "0%"); | |
| 279 | + } | |
| 280 | + } | |
| 281 | + } | |
| 282 | + | |
| 283 | + return resList; | |
| 284 | + } | |
| 285 | + | |
| 286 | +} | ... | ... |
src/main/java/com/bsth/service/calc/impl/CalcMixServiceImpl.java
| ... | ... | @@ -306,9 +306,9 @@ public class CalcMixServiceImpl implements CalcMixService { |
| 306 | 306 | m.put("hyl", Arith.add(m.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0)); |
| 307 | 307 | m.put("jzl", Arith.add(m.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0)); |
| 308 | 308 | m.put("sh", Arith.add(m.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0)); |
| 309 | - last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl"))); | |
| 310 | - last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl"))); | |
| 311 | - last.put("sh", Arith.add(last.get("sh"), m.get("sh"))); | |
| 309 | + last.put("hyl", Arith.add(last.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0)); | |
| 310 | + last.put("jzl", Arith.add(last.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0)); | |
| 311 | + last.put("sh", Arith.add(last.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0)); | |
| 312 | 312 | } else { |
| 313 | 313 | Map<String, Object> m = new HashMap<String, Object>(); |
| 314 | 314 | m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ... | ... |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| ... | ... | @@ -16,6 +16,7 @@ import com.bsth.entity.LineVersions; |
| 16 | 16 | import com.bsth.entity.directive.D80; |
| 17 | 17 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 18 | 18 | import com.bsth.repository.CarParkRepository; |
| 19 | +import com.bsth.repository.LineRepository; | |
| 19 | 20 | import com.bsth.repository.LineVersionsRepository; |
| 20 | 21 | import com.bsth.repository.StationRepository; |
| 21 | 22 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| ... | ... | @@ -87,6 +88,9 @@ public class GpsServiceImpl implements GpsService { |
| 87 | 88 | @Autowired |
| 88 | 89 | LineVersionsRepository lineVersionsRepository; |
| 89 | 90 | |
| 91 | + @Autowired | |
| 92 | + LineRepository lineRepository; | |
| 93 | + | |
| 90 | 94 | // 历史gps查询 |
| 91 | 95 | @Override |
| 92 | 96 | public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) { |
| ... | ... | @@ -228,50 +232,68 @@ public class GpsServiceImpl implements GpsService { |
| 228 | 232 | //查询GPS数据 |
| 229 | 233 | JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 230 | 234 | List<Map<String, Object>> dataList = jdbcTemplate_ms.queryForList(sql.toString()); |
| 231 | - if (!dataList.isEmpty()){ | |
| 232 | 235 | |
| 233 | - int lineId=Integer.parseInt(map_get_str(dataList.get(0), "LINE_ID")); | |
| 234 | - List<LineVersions> lvs=lineVersionsRepository.findBylineId(lineId); | |
| 235 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); | |
| 236 | - List<Map<String,Object>> vlist=new ArrayList<>(); | |
| 237 | - Map<String,Object> vMap; | |
| 238 | - if (lvs!=null&&!lvs.isEmpty()){ | |
| 239 | - for (LineVersions lv : lvs) { | |
| 240 | - vMap=new HashMap(); | |
| 241 | - Long sd=lv.getStartDate().getTime(); | |
| 242 | - Long ed=lv.getEndDate().getTime(); | |
| 243 | - if (sd<st&&et<ed){ | |
| 244 | - vMap.put("version",lv.getVersions()); | |
| 245 | - vMap.put("vtime","all"); | |
| 246 | - vlist.add(vMap); | |
| 247 | - }else if(sd<st&&et>ed&&st<ed){ | |
| 248 | - vMap.put("version",lv.getVersions()); | |
| 249 | - vMap.put("endTime",lv.getEndDate().getTime()); | |
| 250 | - vlist.add(vMap); | |
| 251 | - }else if(st<sd&&et<ed&&sd<et){ | |
| 252 | - vMap.put("version",lv.getVersions()); | |
| 253 | - vMap.put("startTime",lv.getStartDate().getTime()); | |
| 254 | - vlist.add(vMap); | |
| 255 | - } | |
| 256 | - } | |
| 257 | - } | |
| 258 | - rsMap.put("lineVerson",vlist); | |
| 259 | - } | |
| 260 | 236 | Float lon, lat; |
| 261 | 237 | Location bdLoc, gdLoc; |
| 262 | 238 | int inOutStop; |
| 263 | 239 | long serviceState; |
| 264 | 240 | ArrivalEntity arrival; |
| 265 | - | |
| 241 | + Set<String> lineSet=new HashSet(); | |
| 242 | + List<Map<String,Object>> lineSwitch=new ArrayList<>(); | |
| 243 | + | |
| 244 | + List<Map> gpsNotValidList=new ArrayList(); | |
| 245 | + List<Map> versionSwitchList=new ArrayList(); | |
| 246 | + List<Map> gpsEqualsZeroList=new ArrayList(); | |
| 247 | + Map<String,Object> zeroMap=null; | |
| 248 | + Map<String,Object> gpsNotValidMap=null; | |
| 249 | + boolean isFirstNotValid=true; | |
| 250 | + boolean isFirstLonlatZero=true; | |
| 266 | 251 | Map<String, Object> map = null; |
| 267 | 252 | for(Map<String, Object> rs : dataList){ |
| 253 | + int index=dataList.indexOf(rs); | |
| 254 | + if (index< dataList.size()-1&&!map_get_str( rs,"LINE_ID").equals(map_get_str( dataList.get(index+1),"LINE_ID"))){ | |
| 255 | + Map<String,Object> LSmap=new HashMap<>(); | |
| 256 | + String name=lineRepository.findOne(Integer.valueOf(map_get_str( rs,"LINE_ID"))).getName(); | |
| 257 | + String NextName=lineRepository.findOne(Integer.valueOf(map_get_str( dataList.get(index+1),"LINE_ID"))).getName(); | |
| 258 | + LSmap.put("abnormalType","linesSwitch"); | |
| 259 | + LSmap.put("line_line",name+"-->"+NextName); | |
| 260 | + LSmap.put("st",map_get_long(rs, "TS")); | |
| 261 | + LSmap.put("et",index== dataList.size()-1?map_get_long(rs, "TS"):map_get_long( dataList.get(index+1), "TS")); | |
| 262 | + lineSwitch.add(LSmap); | |
| 263 | + } | |
| 268 | 264 | serviceState = map_get_long(rs, "SERVICE_STATE"); |
| 269 | - if(getGpsValid(serviceState) == 1) | |
| 270 | - continue; | |
| 265 | + if(getGpsValid(serviceState) == 1){ | |
| 266 | + if (isFirstNotValid) { | |
| 267 | + gpsNotValidMap=new HashMap<>(); | |
| 268 | + gpsNotValidMap.put("abnormalType","gpsNotValid"); | |
| 269 | + gpsNotValidMap.put("st",map_get_long(rs,"TS")); | |
| 270 | + isFirstNotValid=false; | |
| 271 | + } | |
| 272 | + if (index== dataList.size()-1||index< dataList.size()-1&&getGpsValid(map_get_long(dataList.get(index+1), "SERVICE_STATE"))!=1){ | |
| 273 | + gpsNotValidMap.put("et",map_get_long(rs,"TS")); | |
| 274 | + gpsNotValidList.add(gpsNotValidMap); | |
| 275 | + isFirstNotValid=true; | |
| 276 | + gpsNotValidMap=null; | |
| 277 | + } | |
| 278 | + } | |
| 279 | + //continue; | |
| 271 | 280 | |
| 272 | 281 | map = new HashMap<>(); |
| 273 | 282 | lon = map_get_float(rs, "LON"); |
| 274 | 283 | lat = map_get_float(rs, "LAT"); |
| 284 | + if (lon==0||lat==0){ | |
| 285 | + if (isFirstLonlatZero){ | |
| 286 | + zeroMap=new HashMap<>(); | |
| 287 | + zeroMap.put("abnormalType","gpsZero"); | |
| 288 | + zeroMap.put("st",map_get_long(rs,"TS")); | |
| 289 | + isFirstLonlatZero=false; | |
| 290 | + } | |
| 291 | + if (index<dataList.size()-1&&(map_get_float(dataList.get(index+1),"LON")!=0&&map_get_float(dataList.get(index+1),"LAT")!=0)){ | |
| 292 | + zeroMap.put("et",map_get_long(rs,"TS")); | |
| 293 | + gpsEqualsZeroList.add(zeroMap); | |
| 294 | + isFirstLonlatZero=true; | |
| 295 | + } | |
| 296 | + } | |
| 275 | 297 | // 高德坐标 |
| 276 | 298 | gdLoc = TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(lon, lat)); |
| 277 | 299 | map.put("gcj_lon", gdLoc.getLng()); |
| ... | ... | @@ -292,7 +314,7 @@ public class GpsServiceImpl implements GpsService { |
| 292 | 314 | |
| 293 | 315 | map.put("lineId", map_get_str(rs, "LINE_ID")); |
| 294 | 316 | map.put("speed", map_get_float(rs,"SPEED_GPS")); |
| 295 | - | |
| 317 | + lineSet.add(map_get_str(rs, "LINE_ID")); | |
| 296 | 318 | inOutStop = Integer.parseInt(rs.get("INOUT_STOP").toString()); |
| 297 | 319 | map.put("inout_stop", inOutStop); |
| 298 | 320 | |
| ... | ... | @@ -310,6 +332,48 @@ public class GpsServiceImpl implements GpsService { |
| 310 | 332 | map.put("section_code", map_get_str(rs,"SECTION_CODE")); |
| 311 | 333 | list.add(map); |
| 312 | 334 | } |
| 335 | + | |
| 336 | + if (lineSet.size()>0){ | |
| 337 | + for (String s : lineSet) { | |
| 338 | + int lineId=Integer.parseInt(s); | |
| 339 | + List<LineVersions> lvs=lineVersionsRepository.findBylineId(lineId); | |
| 340 | + List<Map<String,Object>> vlist=new ArrayList<>(); | |
| 341 | + Map<String,Object> vMap; | |
| 342 | + Long qt=0L; | |
| 343 | + if (lvs!=null&&!lvs.isEmpty()){ | |
| 344 | + for (LineVersions lv : lvs) { | |
| 345 | + vMap=new HashMap(); | |
| 346 | + Long sd=lv.getStartDate().getTime(); | |
| 347 | + Long ed=lv.getEndDate().getTime(); | |
| 348 | + if (sd<st&&et<ed){ | |
| 349 | + vMap.put("version",lv.getVersions()); | |
| 350 | + vMap.put("vtime","all"); | |
| 351 | + vlist.add(vMap); | |
| 352 | + }else if(sd<st&&et>ed&&st<ed){ | |
| 353 | + vMap.put("version",lv.getVersions()); | |
| 354 | + vMap.put("endTime",lv.getEndDate().getTime()); | |
| 355 | + vMap.put("abnormalType","versionSwitch"); | |
| 356 | + vMap.put("st",lv.getEndDate().getTime()); | |
| 357 | + //vMap.put("et",lvs.indexOf(lv)==lvs.size()-1?lv.getEndDate().getTime():lvs.get(lvs.indexOf(lv)+1).getStartDate().getTime()); | |
| 358 | + qt=lv.getEndDate().getTime(); | |
| 359 | + vlist.add(vMap); | |
| 360 | + }else if(st<sd&&et<ed&&sd<et){ | |
| 361 | + vMap.put("version",lv.getVersions()); | |
| 362 | + vMap.put("startTime",lv.getStartDate().getTime()); | |
| 363 | + vlist.add(vMap); | |
| 364 | + } | |
| 365 | + } | |
| 366 | + } | |
| 367 | + rsMap.put("lineVerson",vlist); | |
| 368 | + if (vlist.size()>1){ | |
| 369 | + Map<String,Object> VSmap=new HashMap<>(); | |
| 370 | + VSmap.put("abnormalType","vserionSwitch"); | |
| 371 | + VSmap.put("st",qt); | |
| 372 | + versionSwitchList.add(VSmap); | |
| 373 | + } | |
| 374 | + } | |
| 375 | + | |
| 376 | + } | |
| 313 | 377 | // 按时间排序 |
| 314 | 378 | Collections.sort(list, new Comparator<Map<String, Object>>() { |
| 315 | 379 | |
| ... | ... | @@ -321,6 +385,9 @@ public class GpsServiceImpl implements GpsService { |
| 321 | 385 | |
| 322 | 386 | rsMap.put("list", list); |
| 323 | 387 | rsMap.put("dcs", dcs); |
| 388 | + rsMap.put("gpsNotValid",gpsNotValidList); | |
| 389 | + rsMap.put("lineSwitch",lineSwitch); | |
| 390 | + rsMap.put("lonlatZero",gpsEqualsZeroList); | |
| 324 | 391 | return rsMap; |
| 325 | 392 | } |
| 326 | 393 | |
| ... | ... | @@ -749,6 +816,9 @@ public class GpsServiceImpl implements GpsService { |
| 749 | 816 | rs.put("sumMileage", new DecimalFormat(".##").format(sum / 1000)); |
| 750 | 817 | rs.put("dcs", gpsMap.get("dcs")); |
| 751 | 818 | rs.put("lineVerson",gpsMap.get("lineVerson")); |
| 819 | + rs.put("gpsInvalid",gpsMap.get("gpsNotValid")); | |
| 820 | + rs.put("gpslineSwitch",gpsMap.get("lineSwitch")); | |
| 821 | + rs.put("gpslonlatex",gpsMap.get("lonlatZero")); | |
| 752 | 822 | } catch (Exception e) { |
| 753 | 823 | logger.error("", e); |
| 754 | 824 | rs.put("status", ResponseCode.ERROR); | ... | ... |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -306,10 +306,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 306 | 306 | String sql = "select id,cc_id,mileage_type,destroy,destroy_reason," + |
| 307 | 307 | " mileage,type1,type2,schedule from bsth_c_s_child_task" + |
| 308 | 308 | " where 1=1"; |
| 309 | - if(schedule1 != null && schedule1 > 0){ | |
| 309 | + if(schedule1 != null && schedule1 >= 0){ | |
| 310 | 310 | sql += " and schedule >= '"+schedule1+"'"; |
| 311 | 311 | } |
| 312 | - if(schedule2 != null && schedule2 > 0){ | |
| 312 | + if(schedule2 != null && schedule2 >= 0){ | |
| 313 | 313 | sql += " and schedule <= '"+schedule2+"'"; |
| 314 | 314 | } |
| 315 | 315 | |
| ... | ... | @@ -520,9 +520,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 520 | 520 | continue; |
| 521 | 521 | Map<String, List<ScheduleRealInfo>> keyMap2 = new HashMap<String, List<ScheduleRealInfo>>(); |
| 522 | 522 | for(ScheduleRealInfo schedule : keyMap.get(key)){ |
| 523 | - if(companyName.length() == 0 && schedule.getGsName() != null) | |
| 523 | + if(companyName.trim().length() == 0 && schedule.getGsName() != null) | |
| 524 | 524 | companyName = schedule.getGsName(); |
| 525 | - if(subCompanyName.length() == 0 && schedule.getFgsName() != null) | |
| 525 | + if(subCompanyName.trim().length() == 0 && schedule.getFgsName() != null) | |
| 526 | 526 | subCompanyName = schedule.getFgsName(); |
| 527 | 527 | String date = schedule.getScheduleDateStr(); |
| 528 | 528 | if(!keyMap2.containsKey(date)) |
| ... | ... | @@ -1061,7 +1061,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1061 | 1061 | continue; |
| 1062 | 1062 | } |
| 1063 | 1063 | String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" |
| 1064 | - + schedule.getLpName() + "/" + schedule.getFgsName(); | |
| 1064 | + + schedule.getLpName() + "/" + schedule.getFgsBm(); | |
| 1065 | 1065 | if(model.length() != 0){ |
| 1066 | 1066 | if(ttSet.contains(schedule.getSpId())){ |
| 1067 | 1067 | if(!keyMap.containsKey(key)) |
| ... | ... | @@ -1099,10 +1099,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1099 | 1099 | long jhyssj1 = 0, sjyssj1 = 0; |
| 1100 | 1100 | double jhlc = 0, sjlc = 0; |
| 1101 | 1101 | for(ScheduleRealInfo schedule : list2){ |
| 1102 | - if(companyName.length() == 0 && schedule.getGsName() != null){ | |
| 1102 | + if(companyName.trim().length() == 0 && schedule.getGsName() != null){ | |
| 1103 | 1103 | companyName = schedule.getGsName(); |
| 1104 | 1104 | } |
| 1105 | - if(subCompanyName.length() == 0 && schedule.getFgsName() != null){ | |
| 1105 | + if(subCompanyName.trim().length() == 0 && schedule.getFgsName() != null){ | |
| 1106 | 1106 | subCompanyName = schedule.getFgsName(); |
| 1107 | 1107 | } |
| 1108 | 1108 | long fcsj = schedule.getFcsjT(); |
| ... | ... | @@ -1887,7 +1887,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1887 | 1887 | continue; |
| 1888 | 1888 | } |
| 1889 | 1889 | |
| 1890 | - String key = schedule.getXlName() + "/" + schedule.getFgsName(); | |
| 1890 | + String key = schedule.getXlName() + "/" + schedule.getFgsBm(); | |
| 1891 | 1891 | if(!keyMap.containsKey(key)) |
| 1892 | 1892 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 1893 | 1893 | keyMap.get(key).add(schedule); |
| ... | ... | @@ -1978,9 +1978,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1978 | 1978 | qtlc = new BigDecimal("0"); |
| 1979 | 1979 | String companyName = "", subCompanyName = ""; |
| 1980 | 1980 | for(ScheduleRealInfo schedule : keyMap.get(key)){ |
| 1981 | - if(schedule.getGsName() != null && companyName.length() == 0) | |
| 1981 | + if(schedule.getGsName() != null && companyName.trim().length() == 0) | |
| 1982 | 1982 | companyName = schedule.getGsName(); |
| 1983 | - if(schedule.getFgsName() != null && subCompanyName.length() == 0) | |
| 1983 | + if(schedule.getFgsName() != null && subCompanyName.trim().length() == 0) | |
| 1984 | 1984 | subCompanyName = schedule.getFgsName(); |
| 1985 | 1985 | BigDecimal lc = new BigDecimal("0"); |
| 1986 | 1986 | if(schedule.getJhlcOrig() != null && schedule.getJhlcOrig() > 0.1d){ |
| ... | ... | @@ -2071,7 +2071,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2071 | 2071 | String[] keys = key.split("/"); |
| 2072 | 2072 | tempMap.put("date", Date); |
| 2073 | 2073 | tempMap.put("company", companyName); |
| 2074 | - tempMap.put("subCompany", keys[1]); | |
| 2074 | + tempMap.put("subCompany", subCompanyName); | |
| 2075 | +// tempMap.put("subCompany", keys[1]); | |
| 2075 | 2076 | tempMap.put("times", sfqr == 1 ? times : "全日"); |
| 2076 | 2077 | tempMap.put("line", keys[0]); |
| 2077 | 2078 | tempMap.put("jhbc", jhbc); |
| ... | ... | @@ -2338,17 +2339,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2338 | 2339 | continue; |
| 2339 | 2340 | } |
| 2340 | 2341 | |
| 2341 | - String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlBm(); | |
| 2342 | + String key = schedule.getGsBm() + "/" + schedule.getFgsBm() + "/" + schedule.getXlBm(); | |
| 2342 | 2343 | if(!keyMap.containsKey(key)) |
| 2343 | 2344 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 2344 | 2345 | keyMap.get(key).add(schedule); |
| 2345 | 2346 | } |
| 2347 | + | |
| 2346 | 2348 | for(String key : keyMap.keySet()){ |
| 2349 | + String companyName = "", subCompanyName = ""; | |
| 2347 | 2350 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 2348 | 2351 | List<ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>(); |
| 2349 | 2352 | int sjbc = 0, sddf = 0, zddf = 0, |
| 2350 | 2353 | dxtz = 0, lbtz = 0; |
| 2351 | 2354 | for(ScheduleRealInfo schedule : keyMap.get(key)){ |
| 2355 | + if(schedule.getGsName() != null && companyName.trim().length() == 0) | |
| 2356 | + companyName = schedule.getGsName(); | |
| 2357 | + if(schedule.getFgsName() != null && subCompanyName.trim().length() == 0) | |
| 2358 | + subCompanyName = schedule.getFgsName(); | |
| 2352 | 2359 | boolean flag = false; |
| 2353 | 2360 | if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null |
| 2354 | 2361 | && schedule.getStatus() != -1 && !schedule.isCcService()){ |
| ... | ... | @@ -2373,8 +2380,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2373 | 2380 | } |
| 2374 | 2381 | tempMap.put("date", date); |
| 2375 | 2382 | String[] keys = key.split("/"); |
| 2376 | - tempMap.put("company", keys[0]); | |
| 2377 | - tempMap.put("subCompany", keys[1]); | |
| 2383 | + tempMap.put("company", companyName); | |
| 2384 | + tempMap.put("subCompany", subCompanyName); | |
| 2385 | +// tempMap.put("company", keys[0]); | |
| 2386 | +// tempMap.put("subCompany", keys[1]); | |
| 2378 | 2387 | tempMap.put("line", keys[2]); |
| 2379 | 2388 | tempMap.put("sjbc", sjbc); |
| 2380 | 2389 | tempMap.put("sddf", sddf); |
| ... | ... | @@ -3108,7 +3117,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 3108 | 3117 | continue; |
| 3109 | 3118 | } |
| 3110 | 3119 | |
| 3111 | - String xl = s.getXlName() + "/" + s.getFgsName(); | |
| 3120 | + String xl = s.getXlName() + "/" + s.getFgsBm(); | |
| 3112 | 3121 | String dateStr = s.getScheduleDateStr(); |
| 3113 | 3122 | if(!sches.containsKey(xl)){ |
| 3114 | 3123 | sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>()); |
| ... | ... | @@ -3138,12 +3147,19 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 3138 | 3147 | List<List<Map<String, Object>>> lists = new ArrayList<List<Map<String, Object>>>(); |
| 3139 | 3148 | Map<Long, ScheduleRealInfo> keyTemp = new HashMap<Long, ScheduleRealInfo>(); |
| 3140 | 3149 | for(Long time : timeList){ |
| 3150 | + String companyName = "", subCompanyName = ""; | |
| 3141 | 3151 | List<Long> keyList = new ArrayList<Long>(); |
| 3142 | 3152 | String date = timeTemp.get(time); |
| 3143 | 3153 | List<ScheduleRealInfo> sche2 = sche1.get(date); |
| 3144 | 3154 | for(ScheduleRealInfo s : sche2){ |
| 3145 | 3155 | if(s.getFcsj()!=null && s.getFcsj().trim().length() > 0 |
| 3146 | 3156 | && s.getFcsj().contains(":")){ |
| 3157 | + | |
| 3158 | + if(s.getGsName() != null && companyName.trim().length() == 0) | |
| 3159 | + companyName = s.getGsName(); | |
| 3160 | + if(s.getFgsName() != null && subCompanyName.trim().length() == 0) | |
| 3161 | + subCompanyName = s.getFgsName(); | |
| 3162 | + | |
| 3147 | 3163 | String[] split = s.getFcsj().split(":"); |
| 3148 | 3164 | Long key = Long.valueOf(s.getXlDir())*1500 + Long.valueOf(split[0])*60 + Long.valueOf(split[1]); |
| 3149 | 3165 | while(keyTemp.containsKey(key)){ |
| ... | ... | @@ -3158,8 +3174,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 3158 | 3174 | for(Long l : keyList){ |
| 3159 | 3175 | ScheduleRealInfo s = keyTemp.get(l); |
| 3160 | 3176 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 3161 | - temp.put("gs", s.getGsName()); | |
| 3162 | - temp.put("fgs", s.getFgsName()); | |
| 3177 | + temp.put("gs", companyName); | |
| 3178 | + temp.put("fgs", subCompanyName); | |
| 3179 | +// temp.put("gs", s.getGsName()); | |
| 3180 | +// temp.put("fgs", s.getFgsName()); | |
| 3163 | 3181 | temp.put("fgsBm", s.getFgsBm()); |
| 3164 | 3182 | temp.put("date", date); |
| 3165 | 3183 | temp.put("xlbm", s.getXlBm()); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -568,7 +568,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 568 | 568 | |
| 569 | 569 | //公司 和 分公司名称 |
| 570 | 570 | t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); |
| 571 | - t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getGsBm() + "_" + t.getFgsBm())); | |
| 571 | + t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm()+ "_" + t.getGsBm() )); | |
| 572 | 572 | |
| 573 | 573 | //t.setScheduleDateStr(schDate); |
| 574 | 574 | t.setScheduleDate(sdfyyyyMMdd.parse(t.getScheduleDateStr())); | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -8,9 +8,10 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
| 8 | 8 | spring.jpa.database= MYSQL |
| 9 | 9 | spring.jpa.show-sql= true |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://127.0.0.1/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 11 | +#spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | +spring.datasource.url= jdbc:mysql://192.168.168.222/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | 13 | spring.datasource.username= root |
| 13 | -spring.datasource.password= | |
| 14 | +spring.datasource.password= root | |
| 14 | 15 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 15 | 16 | #spring.datasource.username= root |
| 16 | 17 | #spring.datasource.password= root | ... | ... |
src/main/resources/fatso/package.json
src/main/resources/static/pages/base/timesmodel/js/gantt.js
| ... | ... | @@ -77,6 +77,7 @@ |
| 77 | 77 | CSMap = getMaxCarAndStopSpace1(map); |
| 78 | 78 | } else if (map.baseRes == '3') { // 主站停站使用v2_2版本 |
| 79 | 79 | _paramObj = Main_v2.getFactory().createParameterObj(map, dataMap); // TODO:暂时使用v2_1版本的方法,通用的,后续再放到v2_2版本中 |
| 80 | + console.log(_paramObj); | |
| 80 | 81 | map.clzs = InternalScheduleObj_v2_2.calcuClzx(_paramObj); |
| 81 | 82 | CSMap = getMaxCarAndStopSpace1(map); |
| 82 | 83 | } |
| ... | ... | @@ -186,7 +187,7 @@ |
| 186 | 187 | return _rtnBcArray; |
| 187 | 188 | }; |
| 188 | 189 | |
| 189 | - // Main_v2_2.exportExcelConfig(_dfun); | |
| 190 | + Main_v2_2.exportExcelConfig(_paramObj, _dfun); | |
| 190 | 191 | } |
| 191 | 192 | |
| 192 | 193 | // 关闭弹出层 | ... | ... |
src/main/resources/static/pages/forms/calc/calcLbStatuAnaly.html
0 → 100644
| 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 | + .table-bordered > thead > tr > th, | |
| 12 | + .table-bordered > thead > tr > td { | |
| 13 | + border-bottom-width: 2px; } | |
| 14 | + .table > tbody + tbody { | |
| 15 | + border-top: 1px solid; } | |
| 16 | + #forms > tbody > tr{ | |
| 17 | + background-color: #FFFFFF; | |
| 18 | + } | |
| 19 | +</style> | |
| 20 | + | |
| 21 | +<div class="page-head"> | |
| 22 | + <div class="page-title"> | |
| 23 | + <h1>烂班情况分析表(统计)</h1> | |
| 24 | + </div> | |
| 25 | +</div> | |
| 26 | + | |
| 27 | +<div class="row"> | |
| 28 | + <div class="col-md-12"> | |
| 29 | + <div class="portlet light porttlet-fit bordered"> | |
| 30 | + <div class="portlet-title"> | |
| 31 | + <form id="history" class="form-inline" action=""> | |
| 32 | + <div style="display: inline-block;margin-left: 5px;"> | |
| 33 | + <span class="item-label" style="width: 80px;">烂班原因: </span> | |
| 34 | + <input class="form-control" type="checkbox" id="totalLb" style="width: 20px;" checked="true"/>全选 | |
| 35 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="0" checked="true"/>路阻 | |
| 36 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="1" checked="true"/>吊慢 | |
| 37 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="2" checked="true"/>故障 | |
| 38 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="3" checked="true"/>纠纷 | |
| 39 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="4" checked="true"/>肇事 | |
| 40 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="5" checked="true"/>缺人 | |
| 41 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="6" checked="true"/>缺车 | |
| 42 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="7" checked="true"/>客稀 | |
| 43 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="8" checked="true"/>气候 | |
| 44 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="9" checked="true"/>援外 | |
| 45 | + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="10" checked="true"/>其他 | |
| 46 | + </div> | |
| 47 | + <div style="margin-top: 5px"></div> | |
| 48 | + <div style="display: inline-block; margin-left: 33px;" id="company1"> | |
| 49 | + <span class="item-label" style="width: 80px;">公司: </span> | |
| 50 | + <select class="form-control" name="company" id="company" style="width: 140px;"></select> | |
| 51 | + </div> | |
| 52 | + <div style="display: inline-block; margin-left: 24px;" id="subCompany1"> | |
| 53 | + <span class="item-label" style="width: 80px;">分公司: </span> | |
| 54 | + <select class="form-control" name="subCompany" id="subCompany" style="width: 140px;"></select> | |
| 55 | + </div> | |
| 56 | + <div style="display: inline-block; margin-left: 10px;"> | |
| 57 | + <span class="item-label" style="width: 80px;">选择线路: </span> | |
| 58 | + <select class="form-control" name="line" id="line" style="width: 150px;"></select> | |
| 59 | + </div> | |
| 60 | + <div style="margin-top: 10px"></div> | |
| 61 | + <div style="display: inline-block; margin-left: 5px"> | |
| 62 | + <span class="item-label" style="width: 80px;">是否营运: </span> | |
| 63 | + <select class="form-control" name="sfyy" id="sfyy" style="width: 140px;"> | |
| 64 | + <option value="0">全部线路</option> | |
| 65 | + <option value="1" selected="selected">营运线路</option> | |
| 66 | + <option value="2">非营运线路</option> | |
| 67 | + </select> | |
| 68 | + </div> | |
| 69 | + <div style="display: inline-block;margin-left: 10px;"> | |
| 70 | + <span class="item-label" style="width: 80px;">开始时间: </span> | |
| 71 | + <input class="form-control" type="text" id="startDate" style="width: 140px;"/> | |
| 72 | + </div> | |
| 73 | + <div style="display: inline-block;margin-left: 10px;"> | |
| 74 | + <span class="item-label" style="width: 80px;">结束时间: </span> | |
| 75 | + <input class="form-control" type="text" id="endDate" style="width: 140px;"/> | |
| 76 | + </div> | |
| 77 | + <div class="form-group" style="margin-left: 10px"> | |
| 78 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | |
| 79 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 80 | + </div> | |
| 81 | + </form> | |
| 82 | + </div> | |
| 83 | + <div class="portlet-body"> | |
| 84 | + <div class="table-container" id="table" style="margin-top: 0px;overflow:auto;min-width: 906px;"> | |
| 85 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | |
| 86 | + <thead> | |
| 87 | + | |
| 88 | + </thead> | |
| 89 | + <tbody> | |
| 90 | + | |
| 91 | + </tbody> | |
| 92 | + </table> | |
| 93 | + <div style="text-align: right;"> | |
| 94 | + <ul id="pagination" class="pagination"></ul> | |
| 95 | + </div> | |
| 96 | + </div> | |
| 97 | + </div> | |
| 98 | + </div> | |
| 99 | + </div> | |
| 100 | +</div> | |
| 101 | + | |
| 102 | +<script> | |
| 103 | + $(function(){ | |
| 104 | + $('#export').attr('disabled', "true"); | |
| 105 | + | |
| 106 | + // 关闭左侧栏 | |
| 107 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 108 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 109 | + | |
| 110 | + | |
| 111 | + var d = new Date(); | |
| 112 | + d.setTime(d.getTime() - 1*1000*60*60*24); | |
| 113 | + var year = d.getFullYear(); | |
| 114 | + var month = d.getMonth() + 1; | |
| 115 | + var day = d.getDate(); | |
| 116 | + if(month < 10) | |
| 117 | + month = "0" + month; | |
| 118 | + if(day < 10) | |
| 119 | + day = "0" + day; | |
| 120 | + var dateTime = year + "-" + month + "-" + day; | |
| 121 | + $("#startDate").datetimepicker({ | |
| 122 | + format : 'YYYY-MM-DD', | |
| 123 | + locale : 'zh-cn', | |
| 124 | + maxDate : dateTime | |
| 125 | + }); | |
| 126 | + $("#endDate").datetimepicker({ | |
| 127 | + format : 'YYYY-MM-DD', | |
| 128 | + locale : 'zh-cn', | |
| 129 | + maxDate : dateTime | |
| 130 | + }); | |
| 131 | + $("#startDate").val(dateTime); | |
| 132 | + $("#endDate").val(dateTime); | |
| 133 | + | |
| 134 | + | |
| 135 | + var fage=false; | |
| 136 | + var xlList; | |
| 137 | + var obj = []; | |
| 138 | + | |
| 139 | + $.get('/report/lineList',function(result){ | |
| 140 | + xlList=result; | |
| 141 | + $.get('/user/companyData', function(result){ | |
| 142 | + obj = result; | |
| 143 | + var options = ''; | |
| 144 | + for(var i = 0; i < obj.length; i++){ | |
| 145 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | |
| 146 | + } | |
| 147 | + | |
| 148 | + if(obj.length ==0){ | |
| 149 | + $("#company1").css('display','none'); | |
| 150 | + }else if(obj.length ==1){ | |
| 151 | + $("#company1").css('display','none'); | |
| 152 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | |
| 153 | + $('#subCompany1').css('display','none'); | |
| 154 | + } | |
| 155 | + $('#company').html(options); | |
| 156 | + updateCompany(); | |
| 157 | + }); | |
| 158 | + }) | |
| 159 | + $("#company").on("change",updateCompany); | |
| 160 | + function updateCompany(){ | |
| 161 | + var company = $('#company').val(); | |
| 162 | + var options = '<option value="">全部分公司</option>'; | |
| 163 | + for(var i = 0; i < obj.length; i++){ | |
| 164 | + if(obj[i].companyCode == company){ | |
| 165 | + var children = obj[i].children; | |
| 166 | + for(var j = 0; j < children.length; j++){ | |
| 167 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 168 | + } | |
| 169 | + } | |
| 170 | + } | |
| 171 | + $('#subCompany').html(options); | |
| 172 | + } | |
| 173 | + | |
| 174 | + var tempData = {}; | |
| 175 | + $.get('/report/lineList',function(xlList){ | |
| 176 | + var data = []; | |
| 177 | + data.push({id: " ", text: "全部线路"}); | |
| 178 | + $.get('/user/companyData', function(result){ | |
| 179 | + for(var i = 0; i < result.length; i++){ | |
| 180 | + var companyCode = result[i].companyCode; | |
| 181 | + var children = result[i].children; | |
| 182 | + for(var j = 0; j < children.length; j++){ | |
| 183 | + var code = children[j].code; | |
| 184 | + for(var k=0;k < xlList.length;k++ ){ | |
| 185 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | |
| 186 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | |
| 187 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | |
| 188 | + } | |
| 189 | + } | |
| 190 | + } | |
| 191 | + } | |
| 192 | + initPinYinSelect2('#line',data,''); | |
| 193 | + | |
| 194 | + }); | |
| 195 | + }); | |
| 196 | + | |
| 197 | + $("#line").on("change", function(){ | |
| 198 | + if($("#line").val() == " "){ | |
| 199 | + $("#company").attr("disabled", false); | |
| 200 | + $("#subCompany").attr("disabled", false); | |
| 201 | + } else { | |
| 202 | + var temp = tempData[$("#line").val()].split(":"); | |
| 203 | + $("#company").val(temp[0]); | |
| 204 | + updateCompany(); | |
| 205 | +// $("#subCompany").val(temp[1]); | |
| 206 | + $("#subCompany").val(""); | |
| 207 | + $("#company").attr("disabled", true); | |
| 208 | +// $("#subCompany").attr("disabled", true); | |
| 209 | + } | |
| 210 | + }); | |
| 211 | + | |
| 212 | + var lb = 0; //标志是否有选择至少一个烂班类型 | |
| 213 | + $("#totalLb").on("change", function(){ | |
| 214 | + var reason = $("input[name='reason']"); | |
| 215 | + var checked = this.checked; | |
| 216 | + $.each(reason, function(i, g){ | |
| 217 | + g.checked = checked; | |
| 218 | + }); | |
| 219 | + if(checked == true) | |
| 220 | + lb = 33; | |
| 221 | + else | |
| 222 | + lb = 0; | |
| 223 | + }); | |
| 224 | + | |
| 225 | + $("input[name='reason']").on("change", function(){ | |
| 226 | + var totalLb = $("#totalLb")[0]; | |
| 227 | + totalLb.checked = true; | |
| 228 | + lb = 0; | |
| 229 | + $.each($("input[name='reason']"), function(i, g){ | |
| 230 | + if(g.checked == false){ | |
| 231 | + totalLb.checked = false; | |
| 232 | + }else{ | |
| 233 | + lb += 3; | |
| 234 | + } | |
| 235 | + }); | |
| 236 | + }); | |
| 237 | + | |
| 238 | + $("#query").on("click",jsDoQuery); | |
| 239 | + | |
| 240 | + var sfyy = 1; | |
| 241 | + var line = $("#line").val(); | |
| 242 | + var startDate = $("#startDate").val(); | |
| 243 | + var endDate = $("#endDate").val(); | |
| 244 | + var company = $("#company").val(); | |
| 245 | + var subCompany = $("#subCompany").val(); | |
| 246 | + var lineName = $('#line option:selected').text(); | |
| 247 | + function jsDoQuery(pagination){ | |
| 248 | + if($("#startDate").val().trim().length == 0 || $("#endDate").val().trim().length == 0){ | |
| 249 | + layer.msg("请选择日期"); | |
| 250 | + return; | |
| 251 | + } | |
| 252 | + var reason = $("input[name='reason']"); | |
| 253 | + var params = {}; | |
| 254 | + if(line == " ") | |
| 255 | + line = ""; | |
| 256 | +// line = $("#line").val(); | |
| 257 | + sfyy = $("#sfyy").val(); | |
| 258 | + startDate = $("#startDate").val(); | |
| 259 | + endDate = $("#endDate").val(); | |
| 260 | + company = $("#company").val(); | |
| 261 | + subCompany = $("#subCompany").val(); | |
| 262 | + params['line'] = line; | |
| 263 | + params['sfyy'] = sfyy; | |
| 264 | + params['startDate'] = startDate; | |
| 265 | + params['endDate'] = endDate; | |
| 266 | + params['company'] = company; | |
| 267 | + params['subCompany'] = subCompany; | |
| 268 | + params['type'] = "query"; | |
| 269 | + lineName = $('#line option:selected').text(); | |
| 270 | + if(lineName == "全部线路") | |
| 271 | + lineName = $('#subCompany option:selected').text(); | |
| 272 | + var i = layer.load(2); | |
| 273 | +// $(".hidden").removeClass("hidden"); | |
| 274 | + $get('/calcLbStatuAnaly/lbStatuAnaly', params, function(result){ | |
| 275 | + // 把数据填充到模版中 | |
| 276 | + var tbodyHtml = template('list_lbAnaly',{list:result, reason:reason, lb:lb}); | |
| 277 | + // 把渲染好的模版html文本追加到表格中 | |
| 278 | + $('#forms').html(tbodyHtml); | |
| 279 | + layer.close(i); | |
| 280 | + | |
| 281 | + _w_table_rowspan("#forms", 1); | |
| 282 | + _w_table_rowspan("#forms", 2); | |
| 283 | + _w_table_rowspan("#forms", 3); | |
| 284 | + _w_table_rowspan("#forms", 4); | |
| 285 | +// _w_table_rowspan("#forms", 5); | |
| 286 | + | |
| 287 | + if(result.length == 0) | |
| 288 | + $('#export').attr('disabled', "true"); | |
| 289 | + else | |
| 290 | + $("#export").removeAttr("disabled"); | |
| 291 | + | |
| 292 | + if($("#forms").height()+70 > $(window).height()-110){ | |
| 293 | + $("#table").height($(window).height()-110); | |
| 294 | + } else { | |
| 295 | + $("#table").height($("#forms").height()+70); | |
| 296 | + } | |
| 297 | + }); | |
| 298 | + } | |
| 299 | + | |
| 300 | + $("#export").on("click", function(){ | |
| 301 | + if($("#startDate").val().trim().length == 0 || $("#endDate").val().trim().length == 0){ | |
| 302 | + layer.msg("请选择日期"); | |
| 303 | + return; | |
| 304 | + } | |
| 305 | + var params = {}; | |
| 306 | + params['line'] = line; | |
| 307 | + params['sfyy'] = sfyy; | |
| 308 | + params['startDate'] = startDate; | |
| 309 | + params['endDate'] = endDate; | |
| 310 | + params['company'] = company; | |
| 311 | + params['subCompany'] = subCompany; | |
| 312 | + params['type'] = "export"; | |
| 313 | + params['lineName'] = lineName; | |
| 314 | + var i = layer.load(2); | |
| 315 | + $get('/calc_export/lbStatuAnalyExport', params, function(result){ | |
| 316 | + var dd = ""; | |
| 317 | + if(startDate == endDate){ | |
| 318 | + dd = moment(startDate).format("YYYYMMDD"); | |
| 319 | + } else { | |
| 320 | + dd = moment(startDate).format("YYYYMMDD") | |
| 321 | + +"-"+moment(endDate).format("YYYYMMDD"); | |
| 322 | + } | |
| 323 | + window.open("/downloadFile/download?fileName=" | |
| 324 | + +dd+"-"+lineName+"-烂班情况分析表(统计)"); | |
| 325 | + layer.close(i); | |
| 326 | + }); | |
| 327 | + }); | |
| 328 | + | |
| 329 | + | |
| 330 | + $("#line").on("change", function(){ | |
| 331 | + line = $("#line").val(); | |
| 332 | + if(line == " ") | |
| 333 | + line = ""; | |
| 334 | + }); | |
| 335 | + $('#startDate').on("blur", function(){ | |
| 336 | + startDate = $("#startDate").val(); | |
| 337 | + endDate = $("#endDate").val(); | |
| 338 | + }); | |
| 339 | + $('#endDate').on("blur", function(){ | |
| 340 | + startDate = $("#startDate").val(); | |
| 341 | + endDate = $("#endDate").val(); | |
| 342 | + }); | |
| 343 | + | |
| 344 | + | |
| 345 | + /** | |
| 346 | + * 将模块List 转换为树结构 | |
| 347 | + * @param arr | |
| 348 | + * @returns {Array} | |
| 349 | + */ | |
| 350 | + function createTreeData(arr){ | |
| 351 | + var treeData = []; | |
| 352 | + var len = arr.length; | |
| 353 | + for(var i = 0; i < len; i ++){ | |
| 354 | + var pId = arr[i].pId; | |
| 355 | + arr[i].text = arr[i].name; | |
| 356 | + if(!pId){ | |
| 357 | + treeData.push(arr[i]); | |
| 358 | + } | |
| 359 | + | |
| 360 | + for(var j = 0; j < len; j ++){ | |
| 361 | + if(pId == arr[j].id){ | |
| 362 | + if(!arr[j].children) | |
| 363 | + arr[j].children = []; | |
| 364 | + arr[j].children.push(arr[i]); | |
| 365 | + break; | |
| 366 | + } | |
| 367 | + } | |
| 368 | + } | |
| 369 | + return treeData; | |
| 370 | + } | |
| 371 | + | |
| 372 | + function _w_table_rowspan(_w_table_id, _w_table_colnum){ | |
| 373 | + _w_table_firsttd = ""; | |
| 374 | + _w_table_currenttd = ""; | |
| 375 | + _w_table_SpanNum = 0; | |
| 376 | + _w_table_Obj = jQuery(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")"); | |
| 377 | + _w_table_Obj.each(function(i){ | |
| 378 | + if(i==0){ | |
| 379 | + _w_table_firsttd = jQuery(this); | |
| 380 | + _w_table_SpanNum = 1; | |
| 381 | + }else{ | |
| 382 | + _w_table_currenttd = jQuery(this); | |
| 383 | + if(_w_table_firsttd.text()==_w_table_currenttd.text()){ | |
| 384 | + _w_table_SpanNum++; | |
| 385 | + _w_table_currenttd.hide(); //remove(); | |
| 386 | + _w_table_firsttd.attr("rowSpan",_w_table_SpanNum); | |
| 387 | + }else{ | |
| 388 | + _w_table_firsttd = jQuery(this); | |
| 389 | + _w_table_SpanNum = 1; | |
| 390 | + } | |
| 391 | + } | |
| 392 | + }); | |
| 393 | + } | |
| 394 | + | |
| 395 | + | |
| 396 | + }); | |
| 397 | + | |
| 398 | +</script> | |
| 399 | +<script type="text/html" id="list_lbAnaly"> | |
| 400 | +<thead> | |
| 401 | + <tr> | |
| 402 | + <th class="hidden"></th> | |
| 403 | + <th rowspan="3" style=" width:120px;">日期</th> | |
| 404 | + <th rowspan="3">公司</th> | |
| 405 | + <th rowspan="3">分公司</th> | |
| 406 | + <th rowspan="3">线路</th> | |
| 407 | + <th rowspan="2" colspan="3">总班次</th> | |
| 408 | + <th rowspan="2" colspan="3">总营运公里</th> | |
| 409 | + {{if lb != 0}} | |
| 410 | + <th colspan={{lb}}>烂班原因</th> | |
| 411 | + {{/if}} | |
| 412 | + </tr> | |
| 413 | + <tr> | |
| 414 | + <th class="hidden"></th> | |
| 415 | + {{if reason[0].checked == true}}<th colspan="3">路阻</th>{{/if}} | |
| 416 | + {{if reason[1].checked == true}}<th colspan="3">吊慢</th>{{/if}} | |
| 417 | + {{if reason[2].checked == true}}<th colspan="3">故障</th>{{/if}} | |
| 418 | + {{if reason[3].checked == true}}<th colspan="3">纠纷</th>{{/if}} | |
| 419 | + {{if reason[4].checked == true}}<th colspan="3">肇事</th>{{/if}} | |
| 420 | + {{if reason[5].checked == true}}<th colspan="3">缺人</th>{{/if}} | |
| 421 | + {{if reason[6].checked == true}}<th colspan="3">缺车</th>{{/if}} | |
| 422 | + {{if reason[7].checked == true}}<th colspan="3">客稀</th>{{/if}} | |
| 423 | + {{if reason[8].checked == true}}<th colspan="3">气候</th>{{/if}} | |
| 424 | + {{if reason[9].checked == true}}<th colspan="3">援外</th>{{/if}} | |
| 425 | + {{if reason[10].checked == true}}<th colspan="3">其他</th>{{/if}} | |
| 426 | + </tr> | |
| 427 | + <tr> | |
| 428 | + <th class="hidden"></th> | |
| 429 | + <th>计划</th><th>实际</th><th>百分比</th> | |
| 430 | + <th>计划</th><th>实际</th><th>百分比</th> | |
| 431 | + {{if reason[0].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 432 | + {{if reason[1].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 433 | + {{if reason[2].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 434 | + {{if reason[3].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 435 | + {{if reason[4].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 436 | + {{if reason[5].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 437 | + {{if reason[6].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 438 | + {{if reason[7].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 439 | + {{if reason[8].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 440 | + {{if reason[9].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 441 | + {{if reason[10].checked==true}}<th>烂班班次</th><th>烂班公里</th><th>百分比</th>{{/if}} | |
| 442 | + </tr> | |
| 443 | +</thead> | |
| 444 | +<tbody> | |
| 445 | + {{each list as obj i}} | |
| 446 | + <tr> | |
| 447 | + {{if obj.line!='合计'}} | |
| 448 | + <td>{{obj.date}}</td> | |
| 449 | + <td>{{obj.company}}</td> | |
| 450 | + <td>{{obj.subCompany}}</td> | |
| 451 | + <td>{{obj.line}}</td> | |
| 452 | + {{/if}} | |
| 453 | + {{if obj.line=='合计'}} | |
| 454 | + <td colspan="4">{{obj.line}}</td> | |
| 455 | + {{/if}} | |
| 456 | + <td>{{obj.jhbc}}</td><td>{{obj.sjbc}}</td><td>{{obj.bcbfb}}</td> | |
| 457 | + <td>{{obj.jhlc}}</td><td>{{obj.sjlc}}</td><td>{{obj.lcbfb}}</td> | |
| 458 | + {{if reason[0].checked==true}}<td>{{obj.lzbc}}</td><td>{{obj.lzlc}}</td><td>{{obj.lzbfb}}</td>{{/if}} | |
| 459 | + {{if reason[1].checked==true}}<td>{{obj.dmbc}}</td><td>{{obj.dmlc}}</td><td>{{obj.dmbfb}}</td>{{/if}} | |
| 460 | + {{if reason[2].checked==true}}<td>{{obj.gzbc}}</td><td>{{obj.gzlc}}</td><td>{{obj.gzbfb}}</td>{{/if}} | |
| 461 | + {{if reason[3].checked==true}}<td>{{obj.jfbc}}</td><td>{{obj.jflc}}</td><td>{{obj.jfbfb}}</td>{{/if}} | |
| 462 | + {{if reason[4].checked==true}}<td>{{obj.zsbc}}</td><td>{{obj.zslc}}</td><td>{{obj.zsbfb}}</td>{{/if}} | |
| 463 | + {{if reason[5].checked==true}}<td>{{obj.qrbc}}</td><td>{{obj.qrlc}}</td><td>{{obj.qrbfb}}</td>{{/if}} | |
| 464 | + {{if reason[6].checked==true}}<td>{{obj.qcbc}}</td><td>{{obj.qclc}}</td><td>{{obj.qcbfb}}</td>{{/if}} | |
| 465 | + {{if reason[7].checked==true}}<td>{{obj.kxbc}}</td><td>{{obj.kxlc}}</td><td>{{obj.kxbfb}}</td>{{/if}} | |
| 466 | + {{if reason[8].checked==true}}<td>{{obj.qhbc}}</td><td>{{obj.qhlc}}</td><td>{{obj.qhbfb}}</td>{{/if}} | |
| 467 | + {{if reason[9].checked==true}}<td>{{obj.ywbc}}</td><td>{{obj.ywlc}}</td><td>{{obj.ywbfb}}</td>{{/if}} | |
| 468 | + {{if reason[10].checked==true}}<td>{{obj.qtbc}}</td><td>{{obj.qtlc}}</td><td>{{obj.qtbfb}}</td>{{/if}} | |
| 469 | + </tr> | |
| 470 | + {{/each}} | |
| 471 | + {{if list.length == 0}} | |
| 472 | + <tr> | |
| 473 | + <td colspan="44"><h6 class="muted">没有找到相关数据</h6></td> | |
| 474 | + </tr> | |
| 475 | + {{/if}} | |
| 476 | +</tbody> | |
| 477 | +</script> | |
| 0 | 478 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forms/calc/calcjsyspy.html
| ... | ... | @@ -89,7 +89,6 @@ |
| 89 | 89 | <th>实际空驶里程</th> |
| 90 | 90 | <th>烂班里程</th> |
| 91 | 91 | <th>临加营运里程</th> |
| 92 | - <th>临加空驶里程</th> | |
| 93 | 92 | </tr> |
| 94 | 93 | </thead> |
| 95 | 94 | <tbody> |
| ... | ... | @@ -302,7 +301,6 @@ |
| 302 | 301 | <td>{{obj.sjfyylc}}</td> |
| 303 | 302 | <td>{{obj.lblc}}</td> |
| 304 | 303 | <td>{{obj.ljyylc}}</td> |
| 305 | - <td>{{obj.ljfyylc}}</td> | |
| 306 | 304 | </tr> |
| 307 | 305 | {{/each}} |
| 308 | 306 | {{if list.length == 0}} | ... | ... |
src/main/resources/static/pages/forms/calc/calcsingledata.html
| ... | ... | @@ -186,10 +186,10 @@ |
| 186 | 186 | var temp = tempData[$("#line").val()].split(":"); |
| 187 | 187 | $("#gsdmSing").val(temp[0]); |
| 188 | 188 | updateCompany(); |
| 189 | -// $("#fgsdmSing").val(temp[1]); | |
| 190 | - $("#fgsdmSing").val(""); | |
| 189 | + $("#fgsdmSing").val(temp[1]); | |
| 190 | +// $("#fgsdmSing").val(""); | |
| 191 | 191 | $("#gsdmSing").attr("disabled", true); |
| 192 | -// $("#fgsdmSing").attr("disabled", true); | |
| 192 | + $("#fgsdmSing").attr("disabled", true); | |
| 193 | 193 | } |
| 194 | 194 | }); |
| 195 | 195 | ... | ... |
src/main/resources/static/pages/forms/mould/calcLbStatuAnaly.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/calcjsyspy.xls
No preview for this file type
src/main/resources/static/pages/permission/user/authorize.html
| ... | ... | @@ -312,8 +312,6 @@ |
| 312 | 312 | <form> |
| 313 | 313 | <div class="uk-margin"> |
| 314 | 314 | <div class="uk-inline" > |
| 315 | - <!--<span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span>--> | |
| 316 | - <!--<input class="uk-input role_search_input" type="text" placeholder="搜索角色">--> | |
| 317 | 315 | </div> |
| 318 | 316 | </div> |
| 319 | 317 | </form> |
| ... | ... | @@ -329,8 +327,6 @@ |
| 329 | 327 | <form> |
| 330 | 328 | <div class="uk-margin"> |
| 331 | 329 | <div class="uk-inline" > |
| 332 | - <!--<span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span>--> | |
| 333 | - <!--<input class="uk-input user_search_input" type="text" placeholder="搜索用户">--> | |
| 334 | 330 | </div> |
| 335 | 331 | </div> |
| 336 | 332 | </form> |
| ... | ... | @@ -349,16 +345,16 @@ |
| 349 | 345 | </div> |
| 350 | 346 | </div> |
| 351 | 347 | |
| 352 | -<script id="authorize-role-list-temp" type="text/html"> | |
| 348 | +<script id="authorize-role-list-temp1" type="text/html"> | |
| 353 | 349 | {{each list as r i}} |
| 354 | - <li data-id="{{r.id}}" data-name="{{r.roleName}}" data-code="{{r.codeUp}}">{{r.roleName}} | |
| 355 | - <span class="role-code">{{r.codeName}}</span> | |
| 356 | - <div class="ct_li_desc">{{r.createDateStr}}</div> | |
| 357 | - <span class="uk-badge">{{r.count}}</span> | |
| 358 | - </li> | |
| 350 | + <li data-id="{{r.id}}" data-name="{{r.roleName}}" data-code="{{r.codeUp}}">{{r.roleName}} | |
| 351 | + <span class="role-code">{{r.codeName}}</span> | |
| 352 | + <div class="ct_li_desc">{{r.createDateStr}}</div> | |
| 353 | + <span class="uk-badge">{{r.count}}</span> | |
| 354 | + </li> | |
| 359 | 355 | {{/each}} |
| 360 | 356 | </script> |
| 361 | -<script id="authorize-user-list-temp" type="text/html"> | |
| 357 | +<script id="authorize-user-list-temp1" type="text/html"> | |
| 362 | 358 | {{each list as u i}} |
| 363 | 359 | <li class="uk-animation-fade uk-animation-fast" data-name="{{u.name}}" data-code="{{u.userNameUp}}" data-id="{{u.id}}">{{u.name}}<span class="role-code">{{u.userName}}</span></li> |
| 364 | 360 | {{/each}} |
| ... | ... | @@ -481,9 +477,9 @@ |
| 481 | 477 | var userA={}; |
| 482 | 478 | for(var i=0,u;u=rs[i++];){ |
| 483 | 479 | if (u.id==userId){ |
| 484 | - discard_field(u); | |
| 485 | - u.userNameUp=u.userName.toUpperCase(); | |
| 486 | - u.lastLoginDateStr=moment(u.lastLoginDate).format('YYYY-MM-DD HH:ss'); | |
| 480 | + discard_field(u); | |
| 481 | + u.userNameUp=u.userName.toUpperCase(); | |
| 482 | + u.lastLoginDateStr=moment(u.lastLoginDate).format('YYYY-MM-DD HH:ss'); | |
| 487 | 483 | userA[0]=u; |
| 488 | 484 | } |
| 489 | 485 | } |
| ... | ... | @@ -514,14 +510,14 @@ |
| 514 | 510 | } |
| 515 | 511 | |
| 516 | 512 | function render_role_list(list) { |
| 517 | - var htmlStr = template('authorize-role-list-temp', {list: list}); | |
| 513 | + var htmlStr = template('authorize-role-list-temp1', {list: list}); | |
| 518 | 514 | $('ul.role-list').html(htmlStr); |
| 519 | 515 | up_scroll(); |
| 520 | 516 | } |
| 521 | 517 | |
| 522 | 518 | |
| 523 | 519 | function render_user_list(list) { |
| 524 | - var htmlStr = template('authorize-user-list-temp', {list: list}); | |
| 520 | + var htmlStr = template('authorize-user-list-temp1', {list: list}); | |
| 525 | 521 | $('ul.user-list').html(htmlStr); |
| 526 | 522 | up_scroll(); |
| 527 | 523 | } |
| ... | ... | @@ -604,7 +600,7 @@ |
| 604 | 600 | |
| 605 | 601 | var groupBy = function (list, field) { |
| 606 | 602 | var rs = {}, |
| 607 | - key; | |
| 603 | + key; | |
| 608 | 604 | $.each(list, function () { |
| 609 | 605 | key = this[field]; |
| 610 | 606 | if (!rs[key]) | ... | ... |
src/main/resources/static/pages/report/inoutstation/js/Blob.js
| 1 | -/* Blob.js | |
| 2 | - * A Blob implementation. | |
| 3 | - * 2014-07-24 | |
| 4 | - * | |
| 5 | - * By Eli Grey, http://eligrey.com | |
| 6 | - * By Devin Samarin, https://github.com/dsamarin | |
| 7 | - * License: X11/MIT | |
| 8 | - * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md | |
| 9 | - */ | |
| 10 | - | |
| 11 | -/*global self, unescape */ | |
| 12 | -/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true, | |
| 13 | - plusplus: true */ | |
| 14 | - | |
| 15 | -/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */ | |
| 16 | - | |
| 17 | -(function (view) { | |
| 18 | - "use strict"; | |
| 19 | - | |
| 20 | - view.URL = view.URL || view.webkitURL; | |
| 21 | - | |
| 22 | - if (view.Blob && view.URL) { | |
| 23 | - try { | |
| 24 | - new Blob; | |
| 25 | - return; | |
| 26 | - } catch (e) {} | |
| 27 | - } | |
| 28 | - | |
| 29 | - // Internally we use a BlobBuilder implementation to base Blob off of | |
| 30 | - // in order to support older browsers that only have BlobBuilder | |
| 31 | - var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) { | |
| 32 | - var | |
| 33 | - get_class = function(object) { | |
| 34 | - return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1]; | |
| 35 | - } | |
| 36 | - , FakeBlobBuilder = function BlobBuilder() { | |
| 37 | - this.data = []; | |
| 38 | - } | |
| 39 | - , FakeBlob = function Blob(data, type, encoding) { | |
| 40 | - this.data = data; | |
| 41 | - this.size = data.length; | |
| 42 | - this.type = type; | |
| 43 | - this.encoding = encoding; | |
| 44 | - } | |
| 45 | - , FBB_proto = FakeBlobBuilder.prototype | |
| 46 | - , FB_proto = FakeBlob.prototype | |
| 47 | - , FileReaderSync = view.FileReaderSync | |
| 48 | - , FileException = function(type) { | |
| 49 | - this.code = this[this.name = type]; | |
| 50 | - } | |
| 51 | - , file_ex_codes = ( | |
| 52 | - "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR " | |
| 53 | - + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR" | |
| 54 | - ).split(" ") | |
| 55 | - , file_ex_code = file_ex_codes.length | |
| 56 | - , real_URL = view.URL || view.webkitURL || view | |
| 57 | - , real_create_object_URL = real_URL.createObjectURL | |
| 58 | - , real_revoke_object_URL = real_URL.revokeObjectURL | |
| 59 | - , URL = real_URL | |
| 60 | - , btoa = view.btoa | |
| 61 | - , atob = view.atob | |
| 62 | - | |
| 63 | - , ArrayBuffer = view.ArrayBuffer | |
| 64 | - , Uint8Array = view.Uint8Array | |
| 65 | - | |
| 66 | - , origin = /^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/ | |
| 67 | - ; | |
| 68 | - FakeBlob.fake = FB_proto.fake = true; | |
| 69 | - while (file_ex_code--) { | |
| 70 | - FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1; | |
| 71 | - } | |
| 72 | - // Polyfill URL | |
| 73 | - if (!real_URL.createObjectURL) { | |
| 74 | - URL = view.URL = function(uri) { | |
| 75 | - var | |
| 76 | - uri_info = document.createElementNS("http://www.w3.org/1999/xhtml", "a") | |
| 77 | - , uri_origin | |
| 78 | - ; | |
| 79 | - uri_info.href = uri; | |
| 80 | - if (!("origin" in uri_info)) { | |
| 81 | - if (uri_info.protocol.toLowerCase() === "data:") { | |
| 82 | - uri_info.origin = null; | |
| 83 | - } else { | |
| 84 | - uri_origin = uri.match(origin); | |
| 85 | - uri_info.origin = uri_origin && uri_origin[1]; | |
| 86 | - } | |
| 87 | - } | |
| 88 | - return uri_info; | |
| 89 | - }; | |
| 90 | - } | |
| 91 | - URL.createObjectURL = function(blob) { | |
| 92 | - var | |
| 93 | - type = blob.type | |
| 94 | - , data_URI_header | |
| 95 | - ; | |
| 96 | - if (type === null) { | |
| 97 | - type = "application/octet-stream"; | |
| 98 | - } | |
| 99 | - if (blob instanceof FakeBlob) { | |
| 100 | - data_URI_header = "data:" + type; | |
| 101 | - if (blob.encoding === "base64") { | |
| 102 | - return data_URI_header + ";base64," + blob.data; | |
| 103 | - } else if (blob.encoding === "URI") { | |
| 104 | - return data_URI_header + "," + decodeURIComponent(blob.data); | |
| 105 | - } if (btoa) { | |
| 106 | - return data_URI_header + ";base64," + btoa(blob.data); | |
| 107 | - } else { | |
| 108 | - return data_URI_header + "," + encodeURIComponent(blob.data); | |
| 109 | - } | |
| 110 | - } else if (real_create_object_URL) { | |
| 111 | - return real_create_object_URL.call(real_URL, blob); | |
| 112 | - } | |
| 113 | - }; | |
| 114 | - URL.revokeObjectURL = function(object_URL) { | |
| 115 | - if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) { | |
| 116 | - real_revoke_object_URL.call(real_URL, object_URL); | |
| 117 | - } | |
| 118 | - }; | |
| 119 | - FBB_proto.append = function(data/*, endings*/) { | |
| 120 | - var bb = this.data; | |
| 121 | - // decode data to a binary string | |
| 122 | - if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) { | |
| 123 | - var | |
| 124 | - str = "" | |
| 125 | - , buf = new Uint8Array(data) | |
| 126 | - , i = 0 | |
| 127 | - , buf_len = buf.length | |
| 128 | - ; | |
| 129 | - for (; i < buf_len; i++) { | |
| 130 | - str += String.fromCharCode(buf[i]); | |
| 131 | - } | |
| 132 | - bb.push(str); | |
| 133 | - } else if (get_class(data) === "Blob" || get_class(data) === "File") { | |
| 134 | - if (FileReaderSync) { | |
| 135 | - var fr = new FileReaderSync; | |
| 136 | - bb.push(fr.readAsBinaryString(data)); | |
| 137 | - } else { | |
| 138 | - // async FileReader won't work as BlobBuilder is sync | |
| 139 | - throw new FileException("NOT_READABLE_ERR"); | |
| 140 | - } | |
| 141 | - } else if (data instanceof FakeBlob) { | |
| 142 | - if (data.encoding === "base64" && atob) { | |
| 143 | - bb.push(atob(data.data)); | |
| 144 | - } else if (data.encoding === "URI") { | |
| 145 | - bb.push(decodeURIComponent(data.data)); | |
| 146 | - } else if (data.encoding === "raw") { | |
| 147 | - bb.push(data.data); | |
| 148 | - } | |
| 149 | - } else { | |
| 150 | - if (typeof data !== "string") { | |
| 151 | - data += ""; // convert unsupported types to strings | |
| 152 | - } | |
| 153 | - // decode UTF-16 to binary string | |
| 154 | - bb.push(unescape(encodeURIComponent(data))); | |
| 155 | - } | |
| 156 | - }; | |
| 157 | - FBB_proto.getBlob = function(type) { | |
| 158 | - if (!arguments.length) { | |
| 159 | - type = null; | |
| 160 | - } | |
| 161 | - return new FakeBlob(this.data.join(""), type, "raw"); | |
| 162 | - }; | |
| 163 | - FBB_proto.toString = function() { | |
| 164 | - return "[object BlobBuilder]"; | |
| 165 | - }; | |
| 166 | - FB_proto.slice = function(start, end, type) { | |
| 167 | - var args = arguments.length; | |
| 168 | - if (args < 3) { | |
| 169 | - type = null; | |
| 170 | - } | |
| 171 | - return new FakeBlob( | |
| 172 | - this.data.slice(start, args > 1 ? end : this.data.length) | |
| 173 | - , type | |
| 174 | - , this.encoding | |
| 175 | - ); | |
| 176 | - }; | |
| 177 | - FB_proto.toString = function() { | |
| 178 | - return "[object Blob]"; | |
| 179 | - }; | |
| 180 | - FB_proto.close = function() { | |
| 181 | - this.size = 0; | |
| 182 | - delete this.data; | |
| 183 | - }; | |
| 184 | - return FakeBlobBuilder; | |
| 185 | - }(view)); | |
| 186 | - | |
| 187 | - view.Blob = function(blobParts, options) { | |
| 188 | - var type = options ? (options.type || "") : ""; | |
| 189 | - var builder = new BlobBuilder(); | |
| 190 | - if (blobParts) { | |
| 191 | - for (var i = 0, len = blobParts.length; i < len; i++) { | |
| 192 | - builder.append(blobParts[i]); | |
| 193 | - } | |
| 194 | - } | |
| 195 | - return builder.getBlob(type); | |
| 196 | - }; | |
| 197 | -}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this)); | |
| 1 | +/* Blob.js | |
| 2 | + * A Blob implementation. | |
| 3 | + * 2014-07-24 | |
| 4 | + * | |
| 5 | + * By Eli Grey, http://eligrey.com | |
| 6 | + * By Devin Samarin, https://github.com/dsamarin | |
| 7 | + * License: X11/MIT | |
| 8 | + * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md | |
| 9 | + */ | |
| 10 | + | |
| 11 | +/*global self, unescape */ | |
| 12 | +/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true, | |
| 13 | + plusplus: true */ | |
| 14 | + | |
| 15 | +/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */ | |
| 16 | + | |
| 17 | +(function (view) { | |
| 18 | + "use strict"; | |
| 19 | + | |
| 20 | + view.URL = view.URL || view.webkitURL; | |
| 21 | + | |
| 22 | + if (view.Blob && view.URL) { | |
| 23 | + try { | |
| 24 | + new Blob; | |
| 25 | + return; | |
| 26 | + } catch (e) {} | |
| 27 | + } | |
| 28 | + | |
| 29 | + // Internally we use a BlobBuilder implementation to base Blob off of | |
| 30 | + // in order to support older browsers that only have BlobBuilder | |
| 31 | + var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) { | |
| 32 | + var | |
| 33 | + get_class = function(object) { | |
| 34 | + return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1]; | |
| 35 | + } | |
| 36 | + , FakeBlobBuilder = function BlobBuilder() { | |
| 37 | + this.data = []; | |
| 38 | + } | |
| 39 | + , FakeBlob = function Blob(data, type, encoding) { | |
| 40 | + this.data = data; | |
| 41 | + this.size = data.length; | |
| 42 | + this.type = type; | |
| 43 | + this.encoding = encoding; | |
| 44 | + } | |
| 45 | + , FBB_proto = FakeBlobBuilder.prototype | |
| 46 | + , FB_proto = FakeBlob.prototype | |
| 47 | + , FileReaderSync = view.FileReaderSync | |
| 48 | + , FileException = function(type) { | |
| 49 | + this.code = this[this.name = type]; | |
| 50 | + } | |
| 51 | + , file_ex_codes = ( | |
| 52 | + "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR " | |
| 53 | + + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR" | |
| 54 | + ).split(" ") | |
| 55 | + , file_ex_code = file_ex_codes.length | |
| 56 | + , real_URL = view.URL || view.webkitURL || view | |
| 57 | + , real_create_object_URL = real_URL.createObjectURL | |
| 58 | + , real_revoke_object_URL = real_URL.revokeObjectURL | |
| 59 | + , URL = real_URL | |
| 60 | + , btoa = view.btoa | |
| 61 | + , atob = view.atob | |
| 62 | + | |
| 63 | + , ArrayBuffer = view.ArrayBuffer | |
| 64 | + , Uint8Array = view.Uint8Array | |
| 65 | + | |
| 66 | + , origin = /^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/ | |
| 67 | + ; | |
| 68 | + FakeBlob.fake = FB_proto.fake = true; | |
| 69 | + while (file_ex_code--) { | |
| 70 | + FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1; | |
| 71 | + } | |
| 72 | + // Polyfill URL | |
| 73 | + if (!real_URL.createObjectURL) { | |
| 74 | + URL = view.URL = function(uri) { | |
| 75 | + var | |
| 76 | + uri_info = document.createElementNS("http://www.w3.org/1999/xhtml", "a") | |
| 77 | + , uri_origin | |
| 78 | + ; | |
| 79 | + uri_info.href = uri; | |
| 80 | + if (!("origin" in uri_info)) { | |
| 81 | + if (uri_info.protocol.toLowerCase() === "data:") { | |
| 82 | + uri_info.origin = null; | |
| 83 | + } else { | |
| 84 | + uri_origin = uri.match(origin); | |
| 85 | + uri_info.origin = uri_origin && uri_origin[1]; | |
| 86 | + } | |
| 87 | + } | |
| 88 | + return uri_info; | |
| 89 | + }; | |
| 90 | + } | |
| 91 | + URL.createObjectURL = function(blob) { | |
| 92 | + var | |
| 93 | + type = blob.type | |
| 94 | + , data_URI_header | |
| 95 | + ; | |
| 96 | + if (type === null) { | |
| 97 | + type = "application/octet-stream"; | |
| 98 | + } | |
| 99 | + if (blob instanceof FakeBlob) { | |
| 100 | + data_URI_header = "data:" + type; | |
| 101 | + if (blob.encoding === "base64") { | |
| 102 | + return data_URI_header + ";base64," + blob.data; | |
| 103 | + } else if (blob.encoding === "URI") { | |
| 104 | + return data_URI_header + "," + decodeURIComponent(blob.data); | |
| 105 | + } if (btoa) { | |
| 106 | + return data_URI_header + ";base64," + btoa(blob.data); | |
| 107 | + } else { | |
| 108 | + return data_URI_header + "," + encodeURIComponent(blob.data); | |
| 109 | + } | |
| 110 | + } else if (real_create_object_URL) { | |
| 111 | + return real_create_object_URL.call(real_URL, blob); | |
| 112 | + } | |
| 113 | + }; | |
| 114 | + URL.revokeObjectURL = function(object_URL) { | |
| 115 | + if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) { | |
| 116 | + real_revoke_object_URL.call(real_URL, object_URL); | |
| 117 | + } | |
| 118 | + }; | |
| 119 | + FBB_proto.append = function(data/*, endings*/) { | |
| 120 | + var bb = this.data; | |
| 121 | + // decode data to a binary string | |
| 122 | + if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) { | |
| 123 | + var | |
| 124 | + str = "" | |
| 125 | + , buf = new Uint8Array(data) | |
| 126 | + , i = 0 | |
| 127 | + , buf_len = buf.length | |
| 128 | + ; | |
| 129 | + for (; i < buf_len; i++) { | |
| 130 | + str += String.fromCharCode(buf[i]); | |
| 131 | + } | |
| 132 | + bb.push(str); | |
| 133 | + } else if (get_class(data) === "Blob" || get_class(data) === "File") { | |
| 134 | + if (FileReaderSync) { | |
| 135 | + var fr = new FileReaderSync; | |
| 136 | + bb.push(fr.readAsBinaryString(data)); | |
| 137 | + } else { | |
| 138 | + // async FileReader won't work as BlobBuilder is sync | |
| 139 | + throw new FileException("NOT_READABLE_ERR"); | |
| 140 | + } | |
| 141 | + } else if (data instanceof FakeBlob) { | |
| 142 | + if (data.encoding === "base64" && atob) { | |
| 143 | + bb.push(atob(data.data)); | |
| 144 | + } else if (data.encoding === "URI") { | |
| 145 | + bb.push(decodeURIComponent(data.data)); | |
| 146 | + } else if (data.encoding === "raw") { | |
| 147 | + bb.push(data.data); | |
| 148 | + } | |
| 149 | + } else { | |
| 150 | + if (typeof data !== "string") { | |
| 151 | + data += ""; // convert unsupported types to strings | |
| 152 | + } | |
| 153 | + // decode UTF-16 to binary string | |
| 154 | + bb.push(unescape(encodeURIComponent(data))); | |
| 155 | + } | |
| 156 | + }; | |
| 157 | + FBB_proto.getBlob = function(type) { | |
| 158 | + if (!arguments.length) { | |
| 159 | + type = null; | |
| 160 | + } | |
| 161 | + return new FakeBlob(this.data.join(""), type, "raw"); | |
| 162 | + }; | |
| 163 | + FBB_proto.toString = function() { | |
| 164 | + return "[object BlobBuilder]"; | |
| 165 | + }; | |
| 166 | + FB_proto.slice = function(start, end, type) { | |
| 167 | + var args = arguments.length; | |
| 168 | + if (args < 3) { | |
| 169 | + type = null; | |
| 170 | + } | |
| 171 | + return new FakeBlob( | |
| 172 | + this.data.slice(start, args > 1 ? end : this.data.length) | |
| 173 | + , type | |
| 174 | + , this.encoding | |
| 175 | + ); | |
| 176 | + }; | |
| 177 | + FB_proto.toString = function() { | |
| 178 | + return "[object Blob]"; | |
| 179 | + }; | |
| 180 | + FB_proto.close = function() { | |
| 181 | + this.size = 0; | |
| 182 | + delete this.data; | |
| 183 | + }; | |
| 184 | + return FakeBlobBuilder; | |
| 185 | + }(view)); | |
| 186 | + | |
| 187 | + view.Blob = function(blobParts, options) { | |
| 188 | + var type = options ? (options.type || "") : ""; | |
| 189 | + var builder = new BlobBuilder(); | |
| 190 | + if (blobParts) { | |
| 191 | + for (var i = 0, len = blobParts.length; i < len; i++) { | |
| 192 | + builder.append(blobParts[i]); | |
| 193 | + } | |
| 194 | + } | |
| 195 | + return builder.getBlob(type); | |
| 196 | + }; | |
| 197 | +}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this)); | ... | ... |
src/main/resources/static/pages/report/inoutstation/js/FileSaver.js
| 1 | -/* FileSaver.js | |
| 2 | - * A saveAs() FileSaver implementation. | |
| 3 | - * 2014-08-29 | |
| 4 | - * | |
| 5 | - * By Eli Grey, http://eligrey.com | |
| 6 | - * License: X11/MIT | |
| 7 | - * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md | |
| 8 | - */ | |
| 9 | - | |
| 10 | -/*global self */ | |
| 11 | -/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */ | |
| 12 | - | |
| 13 | -/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ | |
| 14 | - | |
| 15 | -var saveAs = saveAs | |
| 16 | - // IE 10+ (native saveAs) | |
| 17 | - || (typeof navigator !== "undefined" && | |
| 18 | - navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator)) | |
| 19 | - // Everyone else | |
| 20 | - || (function(view) { | |
| 21 | - "use strict"; | |
| 22 | - // IE <10 is explicitly unsupported | |
| 23 | - if (typeof navigator !== "undefined" && | |
| 24 | - /MSIE [1-9]\./.test(navigator.userAgent)) { | |
| 25 | - return; | |
| 26 | - } | |
| 27 | - var | |
| 28 | - doc = view.document | |
| 29 | - // only get URL when necessary in case Blob.js hasn't overridden it yet | |
| 30 | - , get_URL = function() { | |
| 31 | - return view.URL || view.webkitURL || view; | |
| 32 | - } | |
| 33 | - , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") | |
| 34 | - , can_use_save_link = "download" in save_link | |
| 35 | - , click = function(node) { | |
| 36 | - var event = doc.createEvent("MouseEvents"); | |
| 37 | - event.initMouseEvent( | |
| 38 | - "click", true, false, view, 0, 0, 0, 0, 0 | |
| 39 | - , false, false, false, false, 0, null | |
| 40 | - ); | |
| 41 | - node.dispatchEvent(event); | |
| 42 | - } | |
| 43 | - , webkit_req_fs = view.webkitRequestFileSystem | |
| 44 | - , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem | |
| 45 | - , throw_outside = function(ex) { | |
| 46 | - (view.setImmediate || view.setTimeout)(function() { | |
| 47 | - throw ex; | |
| 48 | - }, 0); | |
| 49 | - } | |
| 50 | - , force_saveable_type = "application/octet-stream" | |
| 51 | - , fs_min_size = 0 | |
| 52 | - // See https://code.google.com/p/chromium/issues/detail?id=375297#c7 for | |
| 53 | - // the reasoning behind the timeout and revocation flow | |
| 54 | - , arbitrary_revoke_timeout = 10 | |
| 55 | - , revoke = function(file) { | |
| 56 | - var revoker = function() { | |
| 57 | - if (typeof file === "string") { // file is an object URL | |
| 58 | - get_URL().revokeObjectURL(file); | |
| 59 | - } else { // file is a File | |
| 60 | - file.remove(); | |
| 61 | - } | |
| 62 | - }; | |
| 63 | - if (view.chrome) { | |
| 64 | - revoker(); | |
| 65 | - } else { | |
| 66 | - setTimeout(revoker, arbitrary_revoke_timeout); | |
| 67 | - } | |
| 68 | - } | |
| 69 | - , dispatch = function(filesaver, event_types, event) { | |
| 70 | - event_types = [].concat(event_types); | |
| 71 | - var i = event_types.length; | |
| 72 | - while (i--) { | |
| 73 | - var listener = filesaver["on" + event_types[i]]; | |
| 74 | - if (typeof listener === "function") { | |
| 75 | - try { | |
| 76 | - listener.call(filesaver, event || filesaver); | |
| 77 | - } catch (ex) { | |
| 78 | - throw_outside(ex); | |
| 79 | - } | |
| 80 | - } | |
| 81 | - } | |
| 82 | - } | |
| 83 | - , FileSaver = function(blob, name) { | |
| 84 | - // First try a.download, then web filesystem, then object URLs | |
| 85 | - var | |
| 86 | - filesaver = this | |
| 87 | - , type = blob.type | |
| 88 | - , blob_changed = false | |
| 89 | - , object_url | |
| 90 | - , target_view | |
| 91 | - , dispatch_all = function() { | |
| 92 | - dispatch(filesaver, "writestart progress write writeend".split(" ")); | |
| 93 | - } | |
| 94 | - // on any filesys errors revert to saving with object URLs | |
| 95 | - , fs_error = function() { | |
| 96 | - // don't create more object URLs than needed | |
| 97 | - if (blob_changed || !object_url) { | |
| 98 | - object_url = get_URL().createObjectURL(blob); | |
| 99 | - } | |
| 100 | - if (target_view) { | |
| 101 | - target_view.location.href = object_url; | |
| 102 | - } else { | |
| 103 | - var new_tab = view.open(object_url, "_blank"); | |
| 104 | - if (new_tab == undefined && typeof safari !== "undefined") { | |
| 105 | - //Apple do not allow window.open, see http://bit.ly/1kZffRI | |
| 106 | - view.location.href = object_url | |
| 107 | - } | |
| 108 | - } | |
| 109 | - filesaver.readyState = filesaver.DONE; | |
| 110 | - dispatch_all(); | |
| 111 | - revoke(object_url); | |
| 112 | - } | |
| 113 | - , abortable = function(func) { | |
| 114 | - return function() { | |
| 115 | - if (filesaver.readyState !== filesaver.DONE) { | |
| 116 | - return func.apply(this, arguments); | |
| 117 | - } | |
| 118 | - }; | |
| 119 | - } | |
| 120 | - , create_if_not_found = {create: true, exclusive: false} | |
| 121 | - , slice | |
| 122 | - ; | |
| 123 | - filesaver.readyState = filesaver.INIT; | |
| 124 | - if (!name) { | |
| 125 | - name = "download"; | |
| 126 | - } | |
| 127 | - if (can_use_save_link) { | |
| 128 | - object_url = get_URL().createObjectURL(blob); | |
| 129 | - save_link.href = object_url; | |
| 130 | - save_link.download = name; | |
| 131 | - click(save_link); | |
| 132 | - filesaver.readyState = filesaver.DONE; | |
| 133 | - dispatch_all(); | |
| 134 | - revoke(object_url); | |
| 135 | - return; | |
| 136 | - } | |
| 137 | - // Object and web filesystem URLs have a problem saving in Google Chrome when | |
| 138 | - // viewed in a tab, so I force save with application/octet-stream | |
| 139 | - // http://code.google.com/p/chromium/issues/detail?id=91158 | |
| 140 | - // Update: Google errantly closed 91158, I submitted it again: | |
| 141 | - // https://code.google.com/p/chromium/issues/detail?id=389642 | |
| 142 | - if (view.chrome && type && type !== force_saveable_type) { | |
| 143 | - slice = blob.slice || blob.webkitSlice; | |
| 144 | - blob = slice.call(blob, 0, blob.size, force_saveable_type); | |
| 145 | - blob_changed = true; | |
| 146 | - } | |
| 147 | - // Since I can't be sure that the guessed media type will trigger a download | |
| 148 | - // in WebKit, I append .download to the filename. | |
| 149 | - // https://bugs.webkit.org/show_bug.cgi?id=65440 | |
| 150 | - if (webkit_req_fs && name !== "download") { | |
| 151 | - name += ".download"; | |
| 152 | - } | |
| 153 | - if (type === force_saveable_type || webkit_req_fs) { | |
| 154 | - target_view = view; | |
| 155 | - } | |
| 156 | - if (!req_fs) { | |
| 157 | - fs_error(); | |
| 158 | - return; | |
| 159 | - } | |
| 160 | - fs_min_size += blob.size; | |
| 161 | - req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) { | |
| 162 | - fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) { | |
| 163 | - var save = function() { | |
| 164 | - dir.getFile(name, create_if_not_found, abortable(function(file) { | |
| 165 | - file.createWriter(abortable(function(writer) { | |
| 166 | - writer.onwriteend = function(event) { | |
| 167 | - target_view.location.href = file.toURL(); | |
| 168 | - filesaver.readyState = filesaver.DONE; | |
| 169 | - dispatch(filesaver, "writeend", event); | |
| 170 | - revoke(file); | |
| 171 | - }; | |
| 172 | - writer.onerror = function() { | |
| 173 | - var error = writer.error; | |
| 174 | - if (error.code !== error.ABORT_ERR) { | |
| 175 | - fs_error(); | |
| 176 | - } | |
| 177 | - }; | |
| 178 | - "writestart progress write abort".split(" ").forEach(function(event) { | |
| 179 | - writer["on" + event] = filesaver["on" + event]; | |
| 180 | - }); | |
| 181 | - writer.write(blob); | |
| 182 | - filesaver.abort = function() { | |
| 183 | - writer.abort(); | |
| 184 | - filesaver.readyState = filesaver.DONE; | |
| 185 | - }; | |
| 186 | - filesaver.readyState = filesaver.WRITING; | |
| 187 | - }), fs_error); | |
| 188 | - }), fs_error); | |
| 189 | - }; | |
| 190 | - dir.getFile(name, {create: false}, abortable(function(file) { | |
| 191 | - // delete file if it already exists | |
| 192 | - file.remove(); | |
| 193 | - save(); | |
| 194 | - }), abortable(function(ex) { | |
| 195 | - if (ex.code === ex.NOT_FOUND_ERR) { | |
| 196 | - save(); | |
| 197 | - } else { | |
| 198 | - fs_error(); | |
| 199 | - } | |
| 200 | - })); | |
| 201 | - }), fs_error); | |
| 202 | - }), fs_error); | |
| 203 | - } | |
| 204 | - , FS_proto = FileSaver.prototype | |
| 205 | - , saveAs = function(blob, name) { | |
| 206 | - return new FileSaver(blob, name); | |
| 207 | - } | |
| 208 | - ; | |
| 209 | - FS_proto.abort = function() { | |
| 210 | - var filesaver = this; | |
| 211 | - filesaver.readyState = filesaver.DONE; | |
| 212 | - dispatch(filesaver, "abort"); | |
| 213 | - }; | |
| 214 | - FS_proto.readyState = FS_proto.INIT = 0; | |
| 215 | - FS_proto.WRITING = 1; | |
| 216 | - FS_proto.DONE = 2; | |
| 217 | - | |
| 218 | - FS_proto.error = | |
| 219 | - FS_proto.onwritestart = | |
| 220 | - FS_proto.onprogress = | |
| 221 | - FS_proto.onwrite = | |
| 222 | - FS_proto.onabort = | |
| 223 | - FS_proto.onerror = | |
| 224 | - FS_proto.onwriteend = | |
| 225 | - null; | |
| 226 | - | |
| 227 | - return saveAs; | |
| 228 | -}( | |
| 229 | - typeof self !== "undefined" && self | |
| 230 | - || typeof window !== "undefined" && window | |
| 231 | - || this.content | |
| 232 | -)); | |
| 233 | -// `self` is undefined in Firefox for Android content script context | |
| 234 | -// while `this` is nsIContentFrameMessageManager | |
| 235 | -// with an attribute `content` that corresponds to the window | |
| 236 | - | |
| 237 | -if (typeof module !== "undefined" && module !== null) { | |
| 238 | - module.exports = saveAs; | |
| 239 | -} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) { | |
| 240 | - define([], function() { | |
| 241 | - return saveAs; | |
| 242 | - }); | |
| 243 | -} | |
| 1 | +/* FileSaver.js | |
| 2 | + * A saveAs() FileSaver implementation. | |
| 3 | + * 2014-08-29 | |
| 4 | + * | |
| 5 | + * By Eli Grey, http://eligrey.com | |
| 6 | + * License: X11/MIT | |
| 7 | + * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md | |
| 8 | + */ | |
| 9 | + | |
| 10 | +/*global self */ | |
| 11 | +/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */ | |
| 12 | + | |
| 13 | +/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ | |
| 14 | + | |
| 15 | +var saveAs = saveAs | |
| 16 | + // IE 10+ (native saveAs) | |
| 17 | + || (typeof navigator !== "undefined" && | |
| 18 | + navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator)) | |
| 19 | + // Everyone else | |
| 20 | + || (function(view) { | |
| 21 | + "use strict"; | |
| 22 | + // IE <10 is explicitly unsupported | |
| 23 | + if (typeof navigator !== "undefined" && | |
| 24 | + /MSIE [1-9]\./.test(navigator.userAgent)) { | |
| 25 | + return; | |
| 26 | + } | |
| 27 | + var | |
| 28 | + doc = view.document | |
| 29 | + // only get URL when necessary in case Blob.js hasn't overridden it yet | |
| 30 | + , get_URL = function() { | |
| 31 | + return view.URL || view.webkitURL || view; | |
| 32 | + } | |
| 33 | + , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") | |
| 34 | + , can_use_save_link = "download" in save_link | |
| 35 | + , click = function(node) { | |
| 36 | + var event = doc.createEvent("MouseEvents"); | |
| 37 | + event.initMouseEvent( | |
| 38 | + "click", true, false, view, 0, 0, 0, 0, 0 | |
| 39 | + , false, false, false, false, 0, null | |
| 40 | + ); | |
| 41 | + node.dispatchEvent(event); | |
| 42 | + } | |
| 43 | + , webkit_req_fs = view.webkitRequestFileSystem | |
| 44 | + , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem | |
| 45 | + , throw_outside = function(ex) { | |
| 46 | + (view.setImmediate || view.setTimeout)(function() { | |
| 47 | + throw ex; | |
| 48 | + }, 0); | |
| 49 | + } | |
| 50 | + , force_saveable_type = "application/octet-stream" | |
| 51 | + , fs_min_size = 0 | |
| 52 | + // See https://code.google.com/p/chromium/issues/detail?id=375297#c7 for | |
| 53 | + // the reasoning behind the timeout and revocation flow | |
| 54 | + , arbitrary_revoke_timeout = 10 | |
| 55 | + , revoke = function(file) { | |
| 56 | + var revoker = function() { | |
| 57 | + if (typeof file === "string") { // file is an object URL | |
| 58 | + get_URL().revokeObjectURL(file); | |
| 59 | + } else { // file is a File | |
| 60 | + file.remove(); | |
| 61 | + } | |
| 62 | + }; | |
| 63 | + if (view.chrome) { | |
| 64 | + revoker(); | |
| 65 | + } else { | |
| 66 | + setTimeout(revoker, arbitrary_revoke_timeout); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + , dispatch = function(filesaver, event_types, event) { | |
| 70 | + event_types = [].concat(event_types); | |
| 71 | + var i = event_types.length; | |
| 72 | + while (i--) { | |
| 73 | + var listener = filesaver["on" + event_types[i]]; | |
| 74 | + if (typeof listener === "function") { | |
| 75 | + try { | |
| 76 | + listener.call(filesaver, event || filesaver); | |
| 77 | + } catch (ex) { | |
| 78 | + throw_outside(ex); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + } | |
| 82 | + } | |
| 83 | + , FileSaver = function(blob, name) { | |
| 84 | + // First try a.download, then web filesystem, then object URLs | |
| 85 | + var | |
| 86 | + filesaver = this | |
| 87 | + , type = blob.type | |
| 88 | + , blob_changed = false | |
| 89 | + , object_url | |
| 90 | + , target_view | |
| 91 | + , dispatch_all = function() { | |
| 92 | + dispatch(filesaver, "writestart progress write writeend".split(" ")); | |
| 93 | + } | |
| 94 | + // on any filesys errors revert to saving with object URLs | |
| 95 | + , fs_error = function() { | |
| 96 | + // don't create more object URLs than needed | |
| 97 | + if (blob_changed || !object_url) { | |
| 98 | + object_url = get_URL().createObjectURL(blob); | |
| 99 | + } | |
| 100 | + if (target_view) { | |
| 101 | + target_view.location.href = object_url; | |
| 102 | + } else { | |
| 103 | + var new_tab = view.open(object_url, "_blank"); | |
| 104 | + if (new_tab == undefined && typeof safari !== "undefined") { | |
| 105 | + //Apple do not allow window.open, see http://bit.ly/1kZffRI | |
| 106 | + view.location.href = object_url | |
| 107 | + } | |
| 108 | + } | |
| 109 | + filesaver.readyState = filesaver.DONE; | |
| 110 | + dispatch_all(); | |
| 111 | + revoke(object_url); | |
| 112 | + } | |
| 113 | + , abortable = function(func) { | |
| 114 | + return function() { | |
| 115 | + if (filesaver.readyState !== filesaver.DONE) { | |
| 116 | + return func.apply(this, arguments); | |
| 117 | + } | |
| 118 | + }; | |
| 119 | + } | |
| 120 | + , create_if_not_found = {create: true, exclusive: false} | |
| 121 | + , slice | |
| 122 | + ; | |
| 123 | + filesaver.readyState = filesaver.INIT; | |
| 124 | + if (!name) { | |
| 125 | + name = "download"; | |
| 126 | + } | |
| 127 | + if (can_use_save_link) { | |
| 128 | + object_url = get_URL().createObjectURL(blob); | |
| 129 | + save_link.href = object_url; | |
| 130 | + save_link.download = name; | |
| 131 | + click(save_link); | |
| 132 | + filesaver.readyState = filesaver.DONE; | |
| 133 | + dispatch_all(); | |
| 134 | + revoke(object_url); | |
| 135 | + return; | |
| 136 | + } | |
| 137 | + // Object and web filesystem URLs have a problem saving in Google Chrome when | |
| 138 | + // viewed in a tab, so I force save with application/octet-stream | |
| 139 | + // http://code.google.com/p/chromium/issues/detail?id=91158 | |
| 140 | + // Update: Google errantly closed 91158, I submitted it again: | |
| 141 | + // https://code.google.com/p/chromium/issues/detail?id=389642 | |
| 142 | + if (view.chrome && type && type !== force_saveable_type) { | |
| 143 | + slice = blob.slice || blob.webkitSlice; | |
| 144 | + blob = slice.call(blob, 0, blob.size, force_saveable_type); | |
| 145 | + blob_changed = true; | |
| 146 | + } | |
| 147 | + // Since I can't be sure that the guessed media type will trigger a download | |
| 148 | + // in WebKit, I append .download to the filename. | |
| 149 | + // https://bugs.webkit.org/show_bug.cgi?id=65440 | |
| 150 | + if (webkit_req_fs && name !== "download") { | |
| 151 | + name += ".download"; | |
| 152 | + } | |
| 153 | + if (type === force_saveable_type || webkit_req_fs) { | |
| 154 | + target_view = view; | |
| 155 | + } | |
| 156 | + if (!req_fs) { | |
| 157 | + fs_error(); | |
| 158 | + return; | |
| 159 | + } | |
| 160 | + fs_min_size += blob.size; | |
| 161 | + req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) { | |
| 162 | + fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) { | |
| 163 | + var save = function() { | |
| 164 | + dir.getFile(name, create_if_not_found, abortable(function(file) { | |
| 165 | + file.createWriter(abortable(function(writer) { | |
| 166 | + writer.onwriteend = function(event) { | |
| 167 | + target_view.location.href = file.toURL(); | |
| 168 | + filesaver.readyState = filesaver.DONE; | |
| 169 | + dispatch(filesaver, "writeend", event); | |
| 170 | + revoke(file); | |
| 171 | + }; | |
| 172 | + writer.onerror = function() { | |
| 173 | + var error = writer.error; | |
| 174 | + if (error.code !== error.ABORT_ERR) { | |
| 175 | + fs_error(); | |
| 176 | + } | |
| 177 | + }; | |
| 178 | + "writestart progress write abort".split(" ").forEach(function(event) { | |
| 179 | + writer["on" + event] = filesaver["on" + event]; | |
| 180 | + }); | |
| 181 | + writer.write(blob); | |
| 182 | + filesaver.abort = function() { | |
| 183 | + writer.abort(); | |
| 184 | + filesaver.readyState = filesaver.DONE; | |
| 185 | + }; | |
| 186 | + filesaver.readyState = filesaver.WRITING; | |
| 187 | + }), fs_error); | |
| 188 | + }), fs_error); | |
| 189 | + }; | |
| 190 | + dir.getFile(name, {create: false}, abortable(function(file) { | |
| 191 | + // delete file if it already exists | |
| 192 | + file.remove(); | |
| 193 | + save(); | |
| 194 | + }), abortable(function(ex) { | |
| 195 | + if (ex.code === ex.NOT_FOUND_ERR) { | |
| 196 | + save(); | |
| 197 | + } else { | |
| 198 | + fs_error(); | |
| 199 | + } | |
| 200 | + })); | |
| 201 | + }), fs_error); | |
| 202 | + }), fs_error); | |
| 203 | + } | |
| 204 | + , FS_proto = FileSaver.prototype | |
| 205 | + , saveAs = function(blob, name) { | |
| 206 | + return new FileSaver(blob, name); | |
| 207 | + } | |
| 208 | + ; | |
| 209 | + FS_proto.abort = function() { | |
| 210 | + var filesaver = this; | |
| 211 | + filesaver.readyState = filesaver.DONE; | |
| 212 | + dispatch(filesaver, "abort"); | |
| 213 | + }; | |
| 214 | + FS_proto.readyState = FS_proto.INIT = 0; | |
| 215 | + FS_proto.WRITING = 1; | |
| 216 | + FS_proto.DONE = 2; | |
| 217 | + | |
| 218 | + FS_proto.error = | |
| 219 | + FS_proto.onwritestart = | |
| 220 | + FS_proto.onprogress = | |
| 221 | + FS_proto.onwrite = | |
| 222 | + FS_proto.onabort = | |
| 223 | + FS_proto.onerror = | |
| 224 | + FS_proto.onwriteend = | |
| 225 | + null; | |
| 226 | + | |
| 227 | + return saveAs; | |
| 228 | +}( | |
| 229 | + typeof self !== "undefined" && self | |
| 230 | + || typeof window !== "undefined" && window | |
| 231 | + || this.content | |
| 232 | +)); | |
| 233 | +// `self` is undefined in Firefox for Android content script context | |
| 234 | +// while `this` is nsIContentFrameMessageManager | |
| 235 | +// with an attribute `content` that corresponds to the window | |
| 236 | + | |
| 237 | +if (typeof module !== "undefined" && module !== null) { | |
| 238 | + module.exports = saveAs; | |
| 239 | +} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) { | |
| 240 | + define([], function() { | |
| 241 | + return saveAs; | |
| 242 | + }); | |
| 243 | +} | ... | ... |
src/main/resources/static/pages/report/inoutstation/js/tableExport.js
| 1 | - | |
| 2 | - | |
| 3 | -(function(view){ | |
| 4 | - "use strict"; | |
| 5 | - var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; | |
| 6 | - var fromCharCode = String.fromCharCode; | |
| 7 | - var INVALID_CHARACTER_ERR = ( function() { | |
| 8 | - // fabricate a suitable error object | |
| 9 | - try { | |
| 10 | - document.createElement('$'); | |
| 11 | - } catch (error) { | |
| 12 | - return error; | |
| 13 | - } | |
| 14 | - }()); | |
| 15 | - | |
| 16 | - // encoder | |
| 17 | - var btoa = function(string) { | |
| 18 | - var a, b, b1, b2, b3, b4, c, i = 0, len = string.length, max = Math.max, result = ''; | |
| 19 | - | |
| 20 | - while (i < len) { | |
| 21 | - a = string.charCodeAt(i++) || 0; | |
| 22 | - b = string.charCodeAt(i++) || 0; | |
| 23 | - c = string.charCodeAt(i++) || 0; | |
| 24 | - | |
| 25 | - if (max(a, b, c) > 0xFF) { | |
| 26 | - throw INVALID_CHARACTER_ERR; | |
| 27 | - } | |
| 28 | - | |
| 29 | - b1 = (a >> 2) & 0x3F; | |
| 30 | - b2 = ((a & 0x3) << 4) | ((b >> 4) & 0xF); | |
| 31 | - b3 = ((b & 0xF) << 2) | ((c >> 6) & 0x3); | |
| 32 | - b4 = c & 0x3F; | |
| 33 | - | |
| 34 | - if (!b) { | |
| 35 | - b3 = b4 = 64; | |
| 36 | - } else if (!c) { | |
| 37 | - b4 = 64; | |
| 38 | - } | |
| 39 | - result += characters.charAt(b1) + characters.charAt(b2) + characters.charAt(b3) + characters.charAt(b4); | |
| 40 | - } | |
| 41 | - return result; | |
| 42 | - }; | |
| 43 | - | |
| 44 | - //获取dom文本 | |
| 45 | - var getText = function( el ){ | |
| 46 | - var s = el.textContent || el.innerText; | |
| 47 | - return s == null ? "" : s.replace( /^\s*(.*?)\s+$/, "$1"); | |
| 48 | - }; | |
| 49 | - view.tableExport = function(tableId, filename, type){ | |
| 50 | - var doc = view.document, | |
| 51 | - table = doc.getElementById(tableId), | |
| 52 | - charSet = doc.characterSet | |
| 53 | - | |
| 54 | - var uri = { | |
| 55 | - json: 'application/json;charset='+charSet, | |
| 56 | - txt: 'csv/txt;charset='+charSet, | |
| 57 | - csv: 'csv/txt;charset='+charSet, | |
| 58 | - doc: 'application/vnd.ms-doc', | |
| 59 | - excel: 'application/vnd.ms-excel' | |
| 60 | - }; | |
| 61 | - | |
| 62 | - var base64 = function(s) { | |
| 63 | - return btoa(unescape(encodeURIComponent(s))); | |
| 64 | - }; | |
| 65 | - var template = function(s, c) { | |
| 66 | - return s.replace(/{(\w+)}/g, function(m, p) { | |
| 67 | - return c[p]; | |
| 68 | - }); | |
| 69 | - }; | |
| 70 | - | |
| 71 | - var get_blob = function() { | |
| 72 | - return view.Blob; | |
| 73 | - } | |
| 74 | - | |
| 75 | - var fixCSVField = function(value) { | |
| 76 | - var fixedValue = value; | |
| 77 | - var addQuotes = (value.indexOf(',') !== -1) || (value.indexOf('\r') !== -1) || (value.indexOf('\n') !== -1); | |
| 78 | - var replaceDoubleQuotes = (value.indexOf('"') !== -1); | |
| 79 | - | |
| 80 | - if (replaceDoubleQuotes) { | |
| 81 | - fixedValue = fixedValue.replace(/"/g, '""'); | |
| 82 | - } | |
| 83 | - if (addQuotes || replaceDoubleQuotes) { | |
| 84 | - fixedValue = '"' + fixedValue + '"'; | |
| 85 | - } | |
| 86 | - return fixedValue; | |
| 87 | - }; | |
| 88 | - | |
| 89 | - var saveData = function(data){ | |
| 90 | - var BB = get_blob(); | |
| 91 | - saveAs(new BB([data], {type: uri[type]}), filename + "."+type); | |
| 92 | - }; | |
| 93 | - | |
| 94 | - var toCSV = function(){ | |
| 95 | - var data = "\ufeff"; | |
| 96 | - for (var i = 0, row; row = table.rows[i]; i++) { | |
| 97 | - for (var j = 0, col; col = row.cells[j]; j++) { | |
| 98 | - data = data + (j ? ',' : '') + fixCSVField(getText(col)); | |
| 99 | - } | |
| 100 | - data = data + "\r\n"; | |
| 101 | - } | |
| 102 | - saveData(data); | |
| 103 | - }; | |
| 104 | - | |
| 105 | - var toJson = function(){ | |
| 106 | - var jsonHeaderArray = []; | |
| 107 | - | |
| 108 | - if(table.tHead){ | |
| 109 | - for(var i =0,col; col = table.tHead.rows[0].cells[i]; i++){ | |
| 110 | - jsonHeaderArray.push(getText(col)); | |
| 111 | - } | |
| 112 | - } | |
| 113 | - | |
| 114 | - var jsonArray = []; | |
| 115 | - if(table.tBodies){ | |
| 116 | - for(var j=0,tbody; tbody = table.tBodies[j]; j++){ | |
| 117 | - for(var k =0, rowb; rowb= tbody.rows[k]; k++){ | |
| 118 | - var len = jsonArray.length; | |
| 119 | - jsonArray[len] = []; | |
| 120 | - for (var g = 0, colb; colb = rowb.cells[g]; g++) { | |
| 121 | - jsonArray[len].push(getText(colb)); | |
| 122 | - } | |
| 123 | - } | |
| 124 | - } | |
| 125 | - } | |
| 126 | - | |
| 127 | - var jsonExportArray = { | |
| 128 | - header: jsonHeaderArray, | |
| 129 | - data: jsonArray | |
| 130 | - }; | |
| 131 | - saveData(JSON.stringify(jsonExportArray)); | |
| 132 | - }; | |
| 133 | - | |
| 134 | - var toOffice = function(){ | |
| 135 | - var tmpl = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:'+type+'" xmlns="http://www.w3.org/TR/REC-html40">'; | |
| 136 | - tmpl += '<head><meta charset="'+charSet+'" /><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>'; | |
| 137 | - tmpl += '{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->'; | |
| 138 | - tmpl += '</head><body><table>{table}</table></body></html>'; | |
| 139 | - var office = '', | |
| 140 | - maph = [['<thead><tr>', '</tr></thead>'], ['<tbody><tr>', '</tr></tbody>'], ['<tr>', '</tr>']], | |
| 141 | - mapb = [['<th>', '</th>'],['<td>', '</td>']], | |
| 142 | - flag = +!table.tHead, | |
| 143 | - com = 1 - flag; | |
| 144 | - | |
| 145 | - for(var i=0, row; row = table.rows[i]; i++){ | |
| 146 | - flag = i > com ? 2 : flag; | |
| 147 | - office += maph[flag][0]; | |
| 148 | - for(var j =0, col; col = row.cells[j]; j++){ | |
| 149 | - office += mapb[+!!flag][0]+ getText(col) +mapb[+!!flag][1]; | |
| 150 | - } | |
| 151 | - office += maph[flag][1]; | |
| 152 | - flag++; | |
| 153 | - } | |
| 154 | - saveData(template(tmpl, {worksheet: 'Worksheet', table: office})); | |
| 155 | - }; | |
| 156 | - | |
| 157 | - var typeMap = { | |
| 158 | - json : toJson, | |
| 159 | - txt: toCSV, | |
| 160 | - csv: toCSV, | |
| 161 | - doc: toOffice, | |
| 162 | - docx: toOffice, | |
| 163 | - xls: toOffice, | |
| 164 | - xlsx: toOffice | |
| 165 | - }; | |
| 166 | - | |
| 167 | - typeMap[type](); | |
| 168 | - }; | |
| 169 | - | |
| 1 | + | |
| 2 | + | |
| 3 | +(function(view){ | |
| 4 | + "use strict"; | |
| 5 | + var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; | |
| 6 | + var fromCharCode = String.fromCharCode; | |
| 7 | + var INVALID_CHARACTER_ERR = ( function() { | |
| 8 | + // fabricate a suitable error object | |
| 9 | + try { | |
| 10 | + document.createElement('$'); | |
| 11 | + } catch (error) { | |
| 12 | + return error; | |
| 13 | + } | |
| 14 | + }()); | |
| 15 | + | |
| 16 | + // encoder | |
| 17 | + var btoa = function(string) { | |
| 18 | + var a, b, b1, b2, b3, b4, c, i = 0, len = string.length, max = Math.max, result = ''; | |
| 19 | + | |
| 20 | + while (i < len) { | |
| 21 | + a = string.charCodeAt(i++) || 0; | |
| 22 | + b = string.charCodeAt(i++) || 0; | |
| 23 | + c = string.charCodeAt(i++) || 0; | |
| 24 | + | |
| 25 | + if (max(a, b, c) > 0xFF) { | |
| 26 | + throw INVALID_CHARACTER_ERR; | |
| 27 | + } | |
| 28 | + | |
| 29 | + b1 = (a >> 2) & 0x3F; | |
| 30 | + b2 = ((a & 0x3) << 4) | ((b >> 4) & 0xF); | |
| 31 | + b3 = ((b & 0xF) << 2) | ((c >> 6) & 0x3); | |
| 32 | + b4 = c & 0x3F; | |
| 33 | + | |
| 34 | + if (!b) { | |
| 35 | + b3 = b4 = 64; | |
| 36 | + } else if (!c) { | |
| 37 | + b4 = 64; | |
| 38 | + } | |
| 39 | + result += characters.charAt(b1) + characters.charAt(b2) + characters.charAt(b3) + characters.charAt(b4); | |
| 40 | + } | |
| 41 | + return result; | |
| 42 | + }; | |
| 43 | + | |
| 44 | + //获取dom文本 | |
| 45 | + var getText = function( el ){ | |
| 46 | + var s = el.textContent || el.innerText; | |
| 47 | + return s == null ? "" : s.replace( /^\s*(.*?)\s+$/, "$1"); | |
| 48 | + }; | |
| 49 | + view.tableExport = function(tableId, filename, type){ | |
| 50 | + var doc = view.document, | |
| 51 | + table = doc.getElementById(tableId), | |
| 52 | + charSet = doc.characterSet | |
| 53 | + | |
| 54 | + var uri = { | |
| 55 | + json: 'application/json;charset='+charSet, | |
| 56 | + txt: 'csv/txt;charset='+charSet, | |
| 57 | + csv: 'csv/txt;charset='+charSet, | |
| 58 | + doc: 'application/vnd.ms-doc', | |
| 59 | + excel: 'application/vnd.ms-excel' | |
| 60 | + }; | |
| 61 | + | |
| 62 | + var base64 = function(s) { | |
| 63 | + return btoa(unescape(encodeURIComponent(s))); | |
| 64 | + }; | |
| 65 | + var template = function(s, c) { | |
| 66 | + return s.replace(/{(\w+)}/g, function(m, p) { | |
| 67 | + return c[p]; | |
| 68 | + }); | |
| 69 | + }; | |
| 70 | + | |
| 71 | + var get_blob = function() { | |
| 72 | + return view.Blob; | |
| 73 | + } | |
| 74 | + | |
| 75 | + var fixCSVField = function(value) { | |
| 76 | + var fixedValue = value; | |
| 77 | + var addQuotes = (value.indexOf(',') !== -1) || (value.indexOf('\r') !== -1) || (value.indexOf('\n') !== -1); | |
| 78 | + var replaceDoubleQuotes = (value.indexOf('"') !== -1); | |
| 79 | + | |
| 80 | + if (replaceDoubleQuotes) { | |
| 81 | + fixedValue = fixedValue.replace(/"/g, '""'); | |
| 82 | + } | |
| 83 | + if (addQuotes || replaceDoubleQuotes) { | |
| 84 | + fixedValue = '"' + fixedValue + '"'; | |
| 85 | + } | |
| 86 | + return fixedValue; | |
| 87 | + }; | |
| 88 | + | |
| 89 | + var saveData = function(data){ | |
| 90 | + var BB = get_blob(); | |
| 91 | + saveAs(new BB([data], {type: uri[type]}), filename + "."+type); | |
| 92 | + }; | |
| 93 | + | |
| 94 | + var toCSV = function(){ | |
| 95 | + var data = "\ufeff"; | |
| 96 | + for (var i = 0, row; row = table.rows[i]; i++) { | |
| 97 | + for (var j = 0, col; col = row.cells[j]; j++) { | |
| 98 | + data = data + (j ? ',' : '') + fixCSVField(getText(col)); | |
| 99 | + } | |
| 100 | + data = data + "\r\n"; | |
| 101 | + } | |
| 102 | + saveData(data); | |
| 103 | + }; | |
| 104 | + | |
| 105 | + var toJson = function(){ | |
| 106 | + var jsonHeaderArray = []; | |
| 107 | + | |
| 108 | + if(table.tHead){ | |
| 109 | + for(var i =0,col; col = table.tHead.rows[0].cells[i]; i++){ | |
| 110 | + jsonHeaderArray.push(getText(col)); | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + var jsonArray = []; | |
| 115 | + if(table.tBodies){ | |
| 116 | + for(var j=0,tbody; tbody = table.tBodies[j]; j++){ | |
| 117 | + for(var k =0, rowb; rowb= tbody.rows[k]; k++){ | |
| 118 | + var len = jsonArray.length; | |
| 119 | + jsonArray[len] = []; | |
| 120 | + for (var g = 0, colb; colb = rowb.cells[g]; g++) { | |
| 121 | + jsonArray[len].push(getText(colb)); | |
| 122 | + } | |
| 123 | + } | |
| 124 | + } | |
| 125 | + } | |
| 126 | + | |
| 127 | + var jsonExportArray = { | |
| 128 | + header: jsonHeaderArray, | |
| 129 | + data: jsonArray | |
| 130 | + }; | |
| 131 | + saveData(JSON.stringify(jsonExportArray)); | |
| 132 | + }; | |
| 133 | + | |
| 134 | + var toOffice = function(){ | |
| 135 | + var tmpl = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:'+type+'" xmlns="http://www.w3.org/TR/REC-html40">'; | |
| 136 | + tmpl += '<head><meta charset="'+charSet+'" /><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>'; | |
| 137 | + tmpl += '{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->'; | |
| 138 | + tmpl += '</head><body><table>{table}</table></body></html>'; | |
| 139 | + var office = '', | |
| 140 | + maph = [['<thead><tr>', '</tr></thead>'], ['<tbody><tr>', '</tr></tbody>'], ['<tr>', '</tr>']], | |
| 141 | + mapb = [['<th>', '</th>'],['<td>', '</td>']], | |
| 142 | + flag = +!table.tHead, | |
| 143 | + com = 1 - flag; | |
| 144 | + | |
| 145 | + for(var i=0, row; row = table.rows[i]; i++){ | |
| 146 | + flag = i > com ? 2 : flag; | |
| 147 | + office += maph[flag][0]; | |
| 148 | + for(var j =0, col; col = row.cells[j]; j++){ | |
| 149 | + office += mapb[+!!flag][0]+ getText(col) +mapb[+!!flag][1]; | |
| 150 | + } | |
| 151 | + office += maph[flag][1]; | |
| 152 | + flag++; | |
| 153 | + } | |
| 154 | + saveData(template(tmpl, {worksheet: 'Worksheet', table: office})); | |
| 155 | + }; | |
| 156 | + | |
| 157 | + var typeMap = { | |
| 158 | + json : toJson, | |
| 159 | + txt: toCSV, | |
| 160 | + csv: toCSV, | |
| 161 | + doc: toOffice, | |
| 162 | + docx: toOffice, | |
| 163 | + xls: toOffice, | |
| 164 | + xlsx: toOffice | |
| 165 | + }; | |
| 166 | + | |
| 167 | + typeMap[type](); | |
| 168 | + }; | |
| 169 | + | |
| 170 | 170 | })(window); |
| 171 | 171 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/scheduleApp/Gruntfile.js
| ... | ... | @@ -87,8 +87,10 @@ module.exports = function (grunt) { |
| 87 | 87 | 'module/common/dts2/guideboardGroup/saGuideboardgroup.js', // 路牌选择整合指令 |
| 88 | 88 | 'module/common/dts2/employeeGroup/saEmployeegroup.js', // 人员选饿整合指令 |
| 89 | 89 | 'module/common/dts2/bcGroup/saBcgroup.js', // 班次选择整合指令 |
| 90 | - 'module/common/dts2/ttinfotable/saTimeTable.js', // 时刻表显示指令 | |
| 91 | - 'module/common/dts2/ttinfotable/saTimeTableScrolly1.js', // 时刻表滚动1显示指令 | |
| 90 | + 'module/common/dts2/ttinfotable/saTimeTable.js', // 时刻表显示指令(编辑模式) | |
| 91 | + 'module/common/dts2/ttinfotable/saTimeTablePreView.js', // 时刻表显示指令(预览模式) | |
| 92 | + 'module/common/dts2/ttinfotable/saTimeTableScrolly1.js', // 时刻表滚动1显示指令(编辑模式) | |
| 93 | + 'module/common/dts2/ttinfotable/saTimeTableScrolly2.js', // 时刻表滚动2显示指令(预览模式) | |
| 92 | 94 | 'module/common/dts2/queryOption/saOrderOption.js', // saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的) |
| 93 | 95 | 'module/common/dts2/scheduleplan/saScpdate.js', // saScpdate指令(非通用指令,只在排班计划form中使用) |
| 94 | 96 | 'module/common/dts2/scheduleplan/saSrule.js', // saSrule指令(非通用指令,只在排班计划form中使用) | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreView.js
0 → 100644
| 1 | +/** | |
| 2 | + * saTimetablePreview指令,时刻表预览模式视图。 | |
| 3 | + */ | |
| 4 | +angular.module("ScheduleApp").directive( | |
| 5 | + "saTimetable2", | |
| 6 | + [ | |
| 7 | + '$timeout', | |
| 8 | + function($timeout) { | |
| 9 | + return { | |
| 10 | + restrict : 'E', | |
| 11 | + templateUrl : '/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreViewTemplate.html', | |
| 12 | + scope : { // 独立作用域 | |
| 13 | + // 使用外部数据源,内部重新组合显示 | |
| 14 | + ds : "=ngModel" | |
| 15 | + }, | |
| 16 | + controllerAs : "$saTimeTablePreviewCtrl", | |
| 17 | + bindToController: true, | |
| 18 | + controller : function() { | |
| 19 | + var self = this; | |
| 20 | + | |
| 21 | + // 内部班次时刻模型 | |
| 22 | + self.internalBcModel = { | |
| 23 | + up_qdz_name : "", // 上行起点站名字 | |
| 24 | + down_qdz_name : "", // 下行起点站名字 | |
| 25 | + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | |
| 26 | + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | |
| 27 | + }; | |
| 28 | + | |
| 29 | + // 内部各个路牌block车次链模型 | |
| 30 | + self.internalLpBlockModel = { | |
| 31 | + // key:路牌名字 | |
| 32 | + // value: 数组(按照发车时间排序) | |
| 33 | + // value 数据内对象 {fcsj:发车时间,isUp:是否上行,fcno:发车顺序号,index:对应的班次列表索引} | |
| 34 | + }; | |
| 35 | + | |
| 36 | + // TODO: | |
| 37 | + }, | |
| 38 | + | |
| 39 | + /**, | |
| 40 | + * compile阶段,angular还没有编译模版,根据需要可以修改模版dom | |
| 41 | + * @param tElem | |
| 42 | + * @param tAttrs | |
| 43 | + * @returns {{pre: Function, post: Function}} | |
| 44 | + */ | |
| 45 | + compile : function(tElem, tAttrs) { | |
| 46 | + // 获取属性 | |
| 47 | + var $attr_name = tAttrs["name"]; // 控件的名字 | |
| 48 | + if (!$attr_name) { | |
| 49 | + throw new Error("saTimeTablePreview指令 name属性required"); | |
| 50 | + } | |
| 51 | + | |
| 52 | + // 内部controlAs名字 | |
| 53 | + var ctrlAs = "$saTimeTablePreviewCtrl"; | |
| 54 | + | |
| 55 | + // TODO: | |
| 56 | + | |
| 57 | + //------------------ 内部方法 --------------------// | |
| 58 | + var date_wrap_prefix = "2000-01-01 "; // 包装日期的前缀 | |
| 59 | + var date_wrap_format = "YYYY-MM-DD HH:mm"; // 日期格式 | |
| 60 | + /** | |
| 61 | + * 将时间包装成日期,方便计算。 | |
| 62 | + * @param timeStr 时间格式,如 06:30 | |
| 63 | + * @returns moment对象 | |
| 64 | + */ | |
| 65 | + var _fun_WrapTime = function(timeStr) { | |
| 66 | + return moment( | |
| 67 | + date_wrap_prefix + timeStr, | |
| 68 | + date_wrap_format | |
| 69 | + ); | |
| 70 | + }; | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 点击班次html元素(dl),触发班次移动,如下: | |
| 74 | + * 1、点击上行班次,下一个下行班次在下行班次列表中移到中间位置 | |
| 75 | + * 2、点击下行班次,下一个上行班次在上行班次列表中移到中间位置 | |
| 76 | + * @param ctrl 内部控制器 | |
| 77 | + * @param index 班次索引 | |
| 78 | + * @param isUp 是否上行 | |
| 79 | + * @private | |
| 80 | + */ | |
| 81 | + var _fun_bcDDViewMove = function(ctrl, index, isUp) { | |
| 82 | + // 获取当前点击班次对象 | |
| 83 | + var oBc; | |
| 84 | + if (isUp) { | |
| 85 | + oBc = ctrl.internalBcModel.up_bc_list_asc[index]; | |
| 86 | + } else { | |
| 87 | + oBc = ctrl.internalBcModel.down_bc_list_asc[index]; | |
| 88 | + } | |
| 89 | + | |
| 90 | + // 找出车次链中的下一个班次索引,没有就undefined | |
| 91 | + var nextIndex = undefined; | |
| 92 | + var nextBlockBc = undefined; | |
| 93 | + var currentBlockBcIndex = undefined; | |
| 94 | + angular.forEach(ctrl.internalLpBlockModel[oBc.lpName], function(data, i) { | |
| 95 | + if (data.fcsj == oBc.fcsj) { | |
| 96 | + currentBlockBcIndex = i; | |
| 97 | + } | |
| 98 | + }); | |
| 99 | + if (currentBlockBcIndex != undefined && | |
| 100 | + currentBlockBcIndex < (ctrl.internalLpBlockModel[oBc.lpName].length - 1)) { | |
| 101 | + nextBlockBc = ctrl.internalLpBlockModel[oBc.lpName][currentBlockBcIndex + 1]; | |
| 102 | + nextIndex = nextBlockBc.index; | |
| 103 | + } | |
| 104 | + // 先删除click标记,再添加 | |
| 105 | + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data) { | |
| 106 | + delete data["isClick"]; | |
| 107 | + }); | |
| 108 | + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data) { | |
| 109 | + delete data["isClick"]; | |
| 110 | + }); | |
| 111 | + oBc.isClick = true; | |
| 112 | + if (nextIndex) { | |
| 113 | + if (nextBlockBc.isUp) { | |
| 114 | + ctrl.internalBcModel.up_bc_list_asc[nextIndex].isClick = true; | |
| 115 | + } else { | |
| 116 | + ctrl.internalBcModel.down_bc_list_asc[nextIndex].isClick = true; | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + // 移动,同方向不移动 | |
| 121 | + var clientHeight = angular.element("#temp").height() - 34; | |
| 122 | + if (nextBlockBc && isUp != nextBlockBc.isUp) { | |
| 123 | + if (isUp) { // 移动下行 | |
| 124 | + angular.element(".ttpv_table_scrollbar:eq(1)").animate( | |
| 125 | + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400); | |
| 126 | + } else { // 移动上行 | |
| 127 | + angular.element(".ttpv_table_scrollbar:eq(0)").animate( | |
| 128 | + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400); | |
| 129 | + } | |
| 130 | + } | |
| 131 | + | |
| 132 | + }; | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * 刷新内部数据。 | |
| 136 | + * @param ctrl 内部控制器对象($saTimeTablePreviewCtrl) | |
| 137 | + * @private | |
| 138 | + */ | |
| 139 | + var _fun_refreshInternalModel = function(ctrl) { | |
| 140 | + // 初始化内部数据 | |
| 141 | + ctrl.internalBcModel = { | |
| 142 | + up_qdz_name : "", // 上行起点站名字 | |
| 143 | + up_zdz_name : "", // 上行终点站名字 | |
| 144 | + down_qdz_name : "", // 下行起点站名字 | |
| 145 | + down_zdz_name : "", // 下行终点站名字 | |
| 146 | + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | |
| 147 | + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | |
| 148 | + }; | |
| 149 | + ctrl.internalLpBlockModel = { | |
| 150 | + | |
| 151 | + }; | |
| 152 | + | |
| 153 | + // ngModel传入的数据 | |
| 154 | + var dataSource = ctrl.ds.bcList; | |
| 155 | + | |
| 156 | + // 构造上下行班次列表,并确定上下行的首发站点 | |
| 157 | + angular.forEach(dataSource, function(bcObj) { | |
| 158 | + var _internalBcObj = {}; | |
| 159 | + // 构造内部班次对象 | |
| 160 | + _internalBcObj.lpName = bcObj.lp.lpName; // 路牌 | |
| 161 | + _internalBcObj.fcsj = bcObj.fcsj; // 发车时间 | |
| 162 | + _internalBcObj.ddsj = _fun_WrapTime(bcObj.fcsj).add(bcObj.bcsj, "m").format("HH:mm"); | |
| 163 | + _internalBcObj.qdzName = bcObj.qdzName; // 起点站名字 | |
| 164 | + _internalBcObj.zdzName = bcObj.zdzName; // 终点站名字 | |
| 165 | + _internalBcObj.bcType = bcObj.bcType; // 班次类型 | |
| 166 | + _internalBcObj.isTs = bcObj.isTS; // 是否停驶 | |
| 167 | + _internalBcObj.isFb = bcObj.isFB; // 是否分班 | |
| 168 | + _internalBcObj.remark = bcObj.remark; // 备注 | |
| 169 | + _internalBcObj._fcno = bcObj.fcno; // 发车顺序号 | |
| 170 | + | |
| 171 | + if (bcObj.xlDir == "0") { // 上行 | |
| 172 | + ctrl.internalBcModel.up_bc_list_asc.push(_internalBcObj); | |
| 173 | + // 确定起点站 | |
| 174 | + if (ctrl.internalBcModel.up_qdz_name == "") { | |
| 175 | + if (bcObj.bcType == "normal") { | |
| 176 | + ctrl.internalBcModel.up_qdz_name = bcObj.qdzName; | |
| 177 | + } | |
| 178 | + } | |
| 179 | + // 确定终点站 | |
| 180 | + if (ctrl.internalBcModel.up_zdz_name == "") { | |
| 181 | + if (bcObj.bcType == "normal") { | |
| 182 | + ctrl.internalBcModel.up_zdz_name = bcObj.zdzName; | |
| 183 | + } | |
| 184 | + } | |
| 185 | + } | |
| 186 | + if (bcObj.xlDir == "1") { // 下行 | |
| 187 | + ctrl.internalBcModel.down_bc_list_asc.push(_internalBcObj); | |
| 188 | + // 确定起点站 | |
| 189 | + if (ctrl.internalBcModel.down_qdz_name == "") { | |
| 190 | + if (bcObj.bcType == "normal") { | |
| 191 | + ctrl.internalBcModel.down_qdz_name = bcObj.qdzName; | |
| 192 | + } | |
| 193 | + } | |
| 194 | + // 确定终点站 | |
| 195 | + if (ctrl.internalBcModel.down_zdz_name == "") { | |
| 196 | + if (bcObj.bcType == "normal") { | |
| 197 | + ctrl.internalBcModel.down_zdz_name = bcObj.zdzName; | |
| 198 | + } | |
| 199 | + } | |
| 200 | + } | |
| 201 | + | |
| 202 | + }); | |
| 203 | + | |
| 204 | + // 发车时间升序排序上行班次 | |
| 205 | + ctrl.internalBcModel.up_bc_list_asc.sort(function(a, b) { | |
| 206 | + var a_wrapTime = _fun_WrapTime(a.fcsj); | |
| 207 | + var b_wrapTime = _fun_WrapTime(b.fcsj); | |
| 208 | + | |
| 209 | + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | |
| 210 | + // TODO:以后要配合首班车的发车时间判定 | |
| 211 | + if (a.fcsj.indexOf("00:") == 0 || | |
| 212 | + a.fcsj.indexOf("01:") == 0 || | |
| 213 | + a.fcsj.indexOf("02:") == 0) { | |
| 214 | + a_wrapTime.add(1, "day"); | |
| 215 | + } | |
| 216 | + if (b.fcsj.indexOf("00:") == 0 || | |
| 217 | + b.fcsj.indexOf("01:") == 0 || | |
| 218 | + b.fcsj.indexOf("02:") == 0) { | |
| 219 | + b_wrapTime.add(1, "day"); | |
| 220 | + } | |
| 221 | + | |
| 222 | + if (a_wrapTime.isBefore(b_wrapTime)) { | |
| 223 | + return -1; | |
| 224 | + } else if (a_wrapTime.isAfter(b_wrapTime)) { | |
| 225 | + return 1; | |
| 226 | + } else { | |
| 227 | + return 0; | |
| 228 | + } | |
| 229 | + | |
| 230 | + }); | |
| 231 | + // 发车时间升序排序下行班次 | |
| 232 | + ctrl.internalBcModel.down_bc_list_asc.sort(function(a, b) { | |
| 233 | + var a_wrapTime = _fun_WrapTime(a.fcsj); | |
| 234 | + var b_wrapTime = _fun_WrapTime(b.fcsj); | |
| 235 | + | |
| 236 | + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | |
| 237 | + // TODO:以后要配合首班车的发车时间判定 | |
| 238 | + if (a.fcsj.indexOf("00:") == 0 || | |
| 239 | + a.fcsj.indexOf("01:") == 0 || | |
| 240 | + a.fcsj.indexOf("02:") == 0) { | |
| 241 | + a_wrapTime.add(1, "day"); | |
| 242 | + } | |
| 243 | + if (b.fcsj.indexOf("00:") == 0 || | |
| 244 | + b.fcsj.indexOf("01:") == 0 || | |
| 245 | + b.fcsj.indexOf("02:") == 0) { | |
| 246 | + b_wrapTime.add(1, "day"); | |
| 247 | + } | |
| 248 | + | |
| 249 | + if (a_wrapTime.isBefore(b_wrapTime)) { | |
| 250 | + return -1; | |
| 251 | + } else if (a_wrapTime.isAfter(b_wrapTime)) { | |
| 252 | + return 1; | |
| 253 | + } else { | |
| 254 | + return 0; | |
| 255 | + } | |
| 256 | + }); | |
| 257 | + | |
| 258 | + // 构造路牌block车次链,按照发车顺序排序 | |
| 259 | + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data, index) { | |
| 260 | + if (!ctrl.internalLpBlockModel[data.lpName]) { | |
| 261 | + ctrl.internalLpBlockModel[data.lpName] = []; | |
| 262 | + } | |
| 263 | + ctrl.internalLpBlockModel[data.lpName].push({ | |
| 264 | + fcsj : data.fcsj, | |
| 265 | + isUp : true, | |
| 266 | + fcno : data._fcno, | |
| 267 | + index : index | |
| 268 | + }); | |
| 269 | + }); | |
| 270 | + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data, index) { | |
| 271 | + if (!ctrl.internalLpBlockModel[data.lpName]) { | |
| 272 | + ctrl.internalLpBlockModel[data.lpName] = []; | |
| 273 | + } | |
| 274 | + ctrl.internalLpBlockModel[data.lpName].push({ | |
| 275 | + fcsj : data.fcsj, | |
| 276 | + isUp : false, | |
| 277 | + fcno : data._fcno, | |
| 278 | + index : index | |
| 279 | + }); | |
| 280 | + }); | |
| 281 | + angular.forEach(ctrl.internalLpBlockModel, function(value, key) { | |
| 282 | + value.sort(function (a, b) { | |
| 283 | + if (a.fcno < b.fcno) { | |
| 284 | + return -1; | |
| 285 | + } else if (a.fcno > b.fcno) { | |
| 286 | + return 1; | |
| 287 | + } else { | |
| 288 | + return 0; | |
| 289 | + } | |
| 290 | + }); | |
| 291 | + }); | |
| 292 | + | |
| 293 | + | |
| 294 | + }; | |
| 295 | + | |
| 296 | + return { | |
| 297 | + pre : function(scope, element, attr) { | |
| 298 | + // TODO: | |
| 299 | + }, | |
| 300 | + post : function(scope, element, attr) { | |
| 301 | + // 班次html点击事件 | |
| 302 | + scope[ctrlAs].$$bcDD_Click = function(index, xlDir) { | |
| 303 | + _fun_bcDDViewMove(scope[ctrlAs], index, xlDir); | |
| 304 | + }; | |
| 305 | + | |
| 306 | + // 监控ngModel绑定的外部数据源的刷新状态变化 | |
| 307 | + scope.$watch( | |
| 308 | + function() { | |
| 309 | + return scope[ctrlAs].ds.refreshInfos; | |
| 310 | + }, | |
| 311 | + function(newValue, oldValue) { | |
| 312 | + if (newValue === undefined && oldValue === undefined) { | |
| 313 | + return; | |
| 314 | + } | |
| 315 | + console.log("saTimetable2 refresh"); | |
| 316 | + _fun_refreshInternalModel(scope[ctrlAs]); | |
| 317 | + }, | |
| 318 | + true | |
| 319 | + ); | |
| 320 | + } | |
| 321 | + }; | |
| 322 | + } | |
| 323 | + }; | |
| 324 | + } | |
| 325 | + ] | |
| 326 | +); | |
| 0 | 327 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreViewTemplate.html
0 → 100644
| 1 | +<style> | |
| 2 | + .ttpv_detail { | |
| 3 | + height: 100%; | |
| 4 | + } | |
| 5 | + .ttpv_detail .container-fluid { | |
| 6 | + height: 100%; | |
| 7 | + margin-left: 0; | |
| 8 | + } | |
| 9 | + .ttpv_detail .container-fluid>* { | |
| 10 | + padding: 0; | |
| 11 | + } | |
| 12 | + .ttpv_detail .container-fluid.top-container { | |
| 13 | + margin-top: 5px; | |
| 14 | + padding: 0; | |
| 15 | + } | |
| 16 | + | |
| 17 | + .ttpv_detail .detail-panel { | |
| 18 | + padding: 0; | |
| 19 | + height: 100%; | |
| 20 | + border: 1px solid #ddd; | |
| 21 | + background: #fafafa; | |
| 22 | + border-radius: 10px !important; | |
| 23 | + moz-user-select: -moz-none; | |
| 24 | + -moz-user-select: none; | |
| 25 | + -o-user-select: none; | |
| 26 | + -khtml-user-select: none; | |
| 27 | + -webkit-user-select: none; | |
| 28 | + -ms-user-select: none; | |
| 29 | + user-select: none; | |
| 30 | + } | |
| 31 | + | |
| 32 | + .ttpv_detail .detail-panel .detail-wrap { | |
| 33 | + height: calc(100% - 1px); | |
| 34 | + padding: 0; | |
| 35 | + | |
| 36 | + font-size: 14px; | |
| 37 | + color: #cccaca; | |
| 38 | + } | |
| 39 | + | |
| 40 | + .ttpv_detail .detail-panel .detail-wrap .detail-title { | |
| 41 | + margin: 7px 0 5px; | |
| 42 | + text-indent: 5px; | |
| 43 | + margin: 0; | |
| 44 | + height: 31px; | |
| 45 | + line-height: 31px; | |
| 46 | + color: #2765A7; | |
| 47 | + } | |
| 48 | + | |
| 49 | + .ttpv_detail .detail-panel .detail-wrap .detail-body { | |
| 50 | + height: calc(100% - 37px); | |
| 51 | + background: #fff; | |
| 52 | + } | |
| 53 | + | |
| 54 | + .ttpv_detail .detail-panel .detail-wrap .detail-body .ttpv_table_wrap { | |
| 55 | + width: 100%; | |
| 56 | + height: 100%; | |
| 57 | + border-left: 0; | |
| 58 | + border-bottom: 0; | |
| 59 | + overflow: auto; | |
| 60 | + } | |
| 61 | + | |
| 62 | +</style> | |
| 63 | + | |
| 64 | +<style> | |
| 65 | + /** 表格样式 */ | |
| 66 | + .ttpv_table { | |
| 67 | + position: relative; | |
| 68 | + padding-top: 34px; | |
| 69 | + font-size: 13px; | |
| 70 | + } | |
| 71 | + | |
| 72 | + .ttpv_table dl { | |
| 73 | + display: block; | |
| 74 | + /*width: 100%;*/ | |
| 75 | + margin: 0; | |
| 76 | + /*border-bottom: 1px solid;*/ | |
| 77 | + cursor: default; | |
| 78 | + } | |
| 79 | + .ttpv_table dl { | |
| 80 | + font-size: 0; | |
| 81 | + white-space: nowrap; | |
| 82 | + } | |
| 83 | + .ttpv_table dl { | |
| 84 | + transition: all .1s ease; | |
| 85 | + } | |
| 86 | + | |
| 87 | + .ttpv_table dl dd, .ttpv_table dl dt { | |
| 88 | + display: inline-block; | |
| 89 | + white-space: nowrap; | |
| 90 | + overflow: hidden; | |
| 91 | + text-overflow: ellipsis; | |
| 92 | + height: 100%; | |
| 93 | + line-height: 34px; | |
| 94 | + border-right: 1px solid; | |
| 95 | + text-indent: 5px; | |
| 96 | + } | |
| 97 | + .ttpv_table dl dd, .ttpv_table dl dt { | |
| 98 | + border-right-color: #dedede; | |
| 99 | + font-size: 13px; | |
| 100 | + /*border-bottom: 1px solid #dedede;*/ | |
| 101 | + border-top: 1px solid #dedede; | |
| 102 | + text-align: center; | |
| 103 | + } | |
| 104 | + | |
| 105 | + .ttpv_table > .ttpv_table_head { | |
| 106 | + position: absolute; | |
| 107 | + top: 0; | |
| 108 | + height: 34px; | |
| 109 | + background: #f5f5f5; | |
| 110 | + /*width: 100%;*/ | |
| 111 | + line-height: 34px; | |
| 112 | + z-index: 1; | |
| 113 | + } | |
| 114 | + .ttpv_table_head dl { | |
| 115 | + border-bottom: 2px solid #96b9d7; | |
| 116 | + color: #333333; | |
| 117 | + height: 34px; | |
| 118 | + background-color: #f5f5f5; | |
| 119 | + } | |
| 120 | + .ttpv_table_head dl dt { | |
| 121 | + font-weight: normal; | |
| 122 | + font-size: 12px; | |
| 123 | + } | |
| 124 | + | |
| 125 | + .ttpv_table_head dl dt:nth-of-type(1) { | |
| 126 | + width: 50px; | |
| 127 | + height: 34px; | |
| 128 | + } | |
| 129 | + .ttpv_table_head dl dt:nth-of-type(2) { | |
| 130 | + width: 55px; | |
| 131 | + height: 34px; | |
| 132 | + } | |
| 133 | + .ttpv_table_head dl dt:nth-of-type(3) { | |
| 134 | + width: 120px; | |
| 135 | + height: 34px; | |
| 136 | + } | |
| 137 | + .ttpv_table_head dl dt:nth-of-type(4) { | |
| 138 | + width: 100px; | |
| 139 | + height: 34px; | |
| 140 | + } | |
| 141 | + .ttpv_table_head dl dt:nth-of-type(5) { | |
| 142 | + width: 200px; | |
| 143 | + height: 34px; | |
| 144 | + } | |
| 145 | + | |
| 146 | + .ttpv_table > .ttpv_table_body { | |
| 147 | + /*width: 100%;*/ | |
| 148 | + position: absolute; | |
| 149 | + border-bottom: 1px solid #dedede; | |
| 150 | + } | |
| 151 | + | |
| 152 | + .ttpv_table_body dd.ists { | |
| 153 | + background: #105383 !important; | |
| 154 | + color: white !important; | |
| 155 | + } | |
| 156 | + .ttpv_table_body dd.region { | |
| 157 | + background: #686d7b !important; | |
| 158 | + color: white !important; | |
| 159 | + } | |
| 160 | + .ttpv_table_body dd.isfb { | |
| 161 | + background: #adff00 !important; | |
| 162 | + color: #501a1a !important; | |
| 163 | + } | |
| 164 | + | |
| 165 | + .ttpv_table_body dd.istsClick { | |
| 166 | + background: linear-gradient(to right,#8baabf,#105383,#808086)!important; | |
| 167 | + } | |
| 168 | + .ttpv_table_body dd.regionClick { | |
| 169 | + background: linear-gradient(to right,#8baabf,#686d7b,#a09997)!important; | |
| 170 | + } | |
| 171 | + .ttpv_table_body dd.isfbClick { | |
| 172 | + background: linear-gradient(to right,#8baabf,#adff00,#a09997)!important; | |
| 173 | + } | |
| 174 | + | |
| 175 | + .ttpv_table_body dl dd:nth-of-type(1) { | |
| 176 | + width: 50px; | |
| 177 | + height: 30px; | |
| 178 | + } | |
| 179 | + .ttpv_table_body dl dd:nth-of-type(2) { | |
| 180 | + width: 55px; | |
| 181 | + height: 30px; | |
| 182 | + } | |
| 183 | + .ttpv_table_body dl dd:nth-of-type(3) { | |
| 184 | + width: 120px; | |
| 185 | + height: 30px; | |
| 186 | + text-align: left; | |
| 187 | + } | |
| 188 | + .ttpv_table_body dl dd:nth-of-type(4) { | |
| 189 | + width: 100px; | |
| 190 | + height: 30px; | |
| 191 | + } | |
| 192 | + .ttpv_table_body dl dd:nth-of-type(5) { | |
| 193 | + width: 200px; | |
| 194 | + height: 30px; | |
| 195 | + } | |
| 196 | + | |
| 197 | + .ttpv_table_body dd:nth-of-type(1) { | |
| 198 | + color: #2765A7; | |
| 199 | + background: #eae8e8; | |
| 200 | + /*border-bottom: 1px solid #b3b3b3;*/ | |
| 201 | + border-right: 1px solid #b3b3b3; | |
| 202 | + text-indent: -3px; | |
| 203 | + } | |
| 204 | + .ttpv_table_body dd:nth-of-type(n + 2) { | |
| 205 | + color: #2765A7; | |
| 206 | + } | |
| 207 | + .ttpv_table_body dl:hover { | |
| 208 | + box-shadow: 0 0 4px #656c71; | |
| 209 | + background: #f5fbff; | |
| 210 | + } | |
| 211 | + .ttpv_table_body dl:hover dd:nth-of-type(1) { | |
| 212 | + background: #fafafa; | |
| 213 | + background: linear-gradient(to right, #fafafa, #f5fbff); | |
| 214 | + } | |
| 215 | + | |
| 216 | + .isClick { | |
| 217 | + background: #8baabf!important; | |
| 218 | + color: #fff!important; | |
| 219 | + } | |
| 220 | + | |
| 221 | +</style> | |
| 222 | + | |
| 223 | +<style> | |
| 224 | + /** 滚动条css样式 */ | |
| 225 | + | |
| 226 | + .ttpv_table_scrollbar::-webkit-scrollbar { | |
| 227 | + width: 18px; | |
| 228 | + height: 18px; | |
| 229 | + } | |
| 230 | + | |
| 231 | + .ttpv_table_scrollbar::-webkit-scrollbar-track, ::-webkit-scrollbar-thumb { | |
| 232 | + border-radius: 999px; | |
| 233 | + border: 5px solid transparent; | |
| 234 | + } | |
| 235 | + | |
| 236 | + .ttpv_table_scrollbar::-webkit-scrollbar-track { | |
| 237 | + box-shadow: 1px 1px 5px rgba(0, 0, 0, .2) inset; | |
| 238 | + } | |
| 239 | + | |
| 240 | + .ttpv_table_scrollbar::-webkit-scrollbar-thumb { | |
| 241 | + min-height: 20px; | |
| 242 | + background-clip: content-box; | |
| 243 | + box-shadow: 0 0 0 5px rgba(0, 0, 0, .2) inset; | |
| 244 | + } | |
| 245 | + | |
| 246 | + .ttpv_table_scrollbar::-webkit-scrollbar-corner { | |
| 247 | + background: transparent; | |
| 248 | + } | |
| 249 | +</style> | |
| 250 | + | |
| 251 | +<div class="ttpv_detail"> | |
| 252 | + <div class="container-fluid top-container"> | |
| 253 | + <div class="col-md-12 container-fluid"> | |
| 254 | + <div class="col-md-6" style="height: 100%; padding-right: 3px;"> | |
| 255 | + <div class="detail-panel"> | |
| 256 | + <div class="detail-wrap" > | |
| 257 | + <h3 class="detail-title"> | |
| 258 | + 上行: | |
| 259 | + {{$saTimeTablePreviewCtrl.internalBcModel.up_qdz_name}} | |
| 260 | + <i class="fa fa-angle-double-right" aria-hidden="true"></i> | |
| 261 | + {{$saTimeTablePreviewCtrl.internalBcModel.up_zdz_name}} | |
| 262 | + </h3> | |
| 263 | + <div id="temp" class="detail-body"> | |
| 264 | + <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".upFixHead"> | |
| 265 | + <div class="ttpv_table"> | |
| 266 | + <div class="ttpv_table_head upFixHead"> | |
| 267 | + <dl> | |
| 268 | + <dt>序号</dt> | |
| 269 | + <dt>路牌</dt> | |
| 270 | + <dt>发车时间</dt> | |
| 271 | + <dt>到达时间</dt> | |
| 272 | + <dt>备注</dt> | |
| 273 | + </dl> | |
| 274 | + </div> | |
| 275 | + <div class="ttpv_table_body"> | |
| 276 | + <dl ng-repeat="bc in $saTimeTablePreviewCtrl.internalBcModel.up_bc_list_asc track by $index" | |
| 277 | + ng-click="$saTimeTablePreviewCtrl.$$bcDD_Click($index, true)"> | |
| 278 | + <dd>{{$index + 1}}</dd> | |
| 279 | + <dd ng-class="{isClick : bc.isClick}"> | |
| 280 | + {{bc.lpName}} | |
| 281 | + </dd> | |
| 282 | + <dd ng-class="{ | |
| 283 | + ists: (bc.isTs && !bc.isClick), | |
| 284 | + istsClick: (bc.isTs && bc.isClick), | |
| 285 | + region: (bc.bcType == 'region' && !bc.isClick), | |
| 286 | + regionClick : (bc.bcType == 'region' && bc.isClick), | |
| 287 | + isfb: (bc.isFb && !bc.isClick), | |
| 288 | + isfbClick : (bc.isFb && bc.isClick), | |
| 289 | + isClick: bc.isClick}"> | |
| 290 | + {{bc.fcsj}} | |
| 291 | + <span class="badge" | |
| 292 | + style="border-radius: 2px !important; background-color: #f9a124;" | |
| 293 | + ng-show="bc.bcType == 'out'">出场</span> | |
| 294 | + <span class="badge" | |
| 295 | + style="border-radius: 2px !important; background-color: #f9a124;" | |
| 296 | + ng-show="bc.bcType == 'in'">进场</span> | |
| 297 | + </dd> | |
| 298 | + <dd ng-class="{isClick : bc.isClick}"> | |
| 299 | + {{bc.ddsj}} | |
| 300 | + </dd> | |
| 301 | + <dd ng-class="{isClick : bc.isClick}">{{bc.remark}}</dd> | |
| 302 | + </dl> | |
| 303 | + </div> | |
| 304 | + </div> | |
| 305 | + </div> | |
| 306 | + </div> | |
| 307 | + </div> | |
| 308 | + </div> | |
| 309 | + </div> | |
| 310 | + | |
| 311 | + <div class="col-md-6" style="height: 100%; padding-left: 3px;"> | |
| 312 | + <div class="detail-panel"> | |
| 313 | + <div class="detail-wrap" > | |
| 314 | + <h3 class="detail-title"> | |
| 315 | + 下行: | |
| 316 | + {{$saTimeTablePreviewCtrl.internalBcModel.down_qdz_name}} | |
| 317 | + <i class="fa fa-angle-double-right" aria-hidden="true"></i> | |
| 318 | + {{$saTimeTablePreviewCtrl.internalBcModel.down_zdz_name}} | |
| 319 | + </h3> | |
| 320 | + <div class="detail-body"> | |
| 321 | + <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".downFixHead"> | |
| 322 | + <div class="ttpv_table"> | |
| 323 | + <div class="ttpv_table_head downFixHead"> | |
| 324 | + <dl> | |
| 325 | + <dt>序号</dt> | |
| 326 | + <dt>路牌</dt> | |
| 327 | + <dt>发车时间</dt> | |
| 328 | + <dt>到达时间</dt> | |
| 329 | + <dt>备注</dt> | |
| 330 | + </dl> | |
| 331 | + </div> | |
| 332 | + <div class="ttpv_table_body"> | |
| 333 | + <dl ng-repeat="bc in $saTimeTablePreviewCtrl.internalBcModel.down_bc_list_asc track by $index" | |
| 334 | + ng-click="$saTimeTablePreviewCtrl.$$bcDD_Click($index, false)"> | |
| 335 | + <dd>{{$index + 1}}</dd> | |
| 336 | + <dd ng-class="{isClick : bc.isClick}"> | |
| 337 | + {{bc.lpName}} | |
| 338 | + </dd> | |
| 339 | + <dd ng-class="{ | |
| 340 | + ists: (bc.isTs && !bc.isClick), | |
| 341 | + istsClick: (bc.isTs && bc.isClick), | |
| 342 | + region: (bc.bcType == 'region' && !bc.isClick), | |
| 343 | + regionClick : (bc.bcType == 'region' && bc.isClick), | |
| 344 | + isfb: (bc.isFb && !bc.isClick), | |
| 345 | + isfbClick : (bc.isFb && bc.isClick), | |
| 346 | + isClick: bc.isClick}"> | |
| 347 | + {{bc.fcsj}} | |
| 348 | + <span class="badge" | |
| 349 | + style="border-radius: 2px !important; background-color: #f9a124;" | |
| 350 | + ng-show="bc.bcType == 'out'">出场</span> | |
| 351 | + <span class="badge" | |
| 352 | + style="border-radius: 2px !important; background-color: #f9a124;" | |
| 353 | + ng-show="bc.bcType == 'in'">进场</span> | |
| 354 | + </dd> | |
| 355 | + <dd ng-class="{isClick : bc.isClick}"> | |
| 356 | + {{bc.ddsj}} | |
| 357 | + </dd> | |
| 358 | + <dd ng-class="{isClick : bc.isClick}">{{bc.remark}}</dd> | |
| 359 | + </dl> | |
| 360 | + </div> | |
| 361 | + </div> | |
| 362 | + </div> | |
| 363 | + </div> | |
| 364 | + </div> | |
| 365 | + </div> | |
| 366 | + </div> | |
| 367 | + | |
| 368 | + </div> | |
| 369 | + </div> | |
| 370 | +</div> | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTableScrolly2.js
0 → 100644
| 1 | +/** | |
| 2 | + * 滚动事件控制指令。 | |
| 3 | + */ | |
| 4 | +angular.module('ScheduleApp').directive( | |
| 5 | + 'saTscrolly2', | |
| 6 | + [ | |
| 7 | + function() { | |
| 8 | + return { | |
| 9 | + restrict: 'A', | |
| 10 | + | |
| 11 | + compile: function(tElem, tAttrs) { | |
| 12 | + | |
| 13 | + return { | |
| 14 | + pre: function(scope, element, attr) { | |
| 15 | + // TODO: | |
| 16 | + //alert(element.find("#tooltipTest").html()); | |
| 17 | + //$compile(element.find("#tooltipTest"))(scope); | |
| 18 | + | |
| 19 | + }, | |
| 20 | + | |
| 21 | + post: function(scope, element, attr) { | |
| 22 | + //var head = element[0]; | |
| 23 | + | |
| 24 | + //console.log("llllllllload"); | |
| 25 | + //console.log(element.name); | |
| 26 | + | |
| 27 | + element.bind('scroll', function() { | |
| 28 | + //console.log("top=", angular.element(".tt_table_head").css("top")); | |
| 29 | + //console.log("left=", angular.element(".tt_table_head").css("left")); | |
| 30 | + //console.log("s top=" + element.scrollTop()); | |
| 31 | + | |
| 32 | + angular.element(attr.scrclass).css("top", element.scrollTop()); | |
| 33 | + // angular.element(".tt_table_head:eq(0)").css("left", element.scrollLeft()); | |
| 34 | + // angular.element(".tt_table_body:eq(0)").css("left", element.scrollLeft()); | |
| 35 | + | |
| 36 | + }); | |
| 37 | + } | |
| 38 | + | |
| 39 | + }; | |
| 40 | + } | |
| 41 | + } | |
| 42 | + } | |
| 43 | + ] | |
| 44 | +); | |
| 0 | 45 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
| ... | ... | @@ -4407,216 +4407,326 @@ angular.module('ScheduleApp').directive( |
| 4407 | 4407 | ] |
| 4408 | 4408 | ); |
| 4409 | 4409 | |
| 4410 | -/** | |
| 4411 | - * 滚动事件控制指令。 | |
| 4412 | - */ | |
| 4413 | -angular.module('ScheduleApp').directive( | |
| 4414 | - 'saTscrolly1', | |
| 4415 | - [ | |
| 4416 | - function() { | |
| 4417 | - return { | |
| 4418 | - restrict: 'A', | |
| 4419 | - | |
| 4420 | - compile: function(tElem, tAttrs) { | |
| 4421 | - | |
| 4422 | - return { | |
| 4423 | - pre: function(scope, element, attr) { | |
| 4424 | - // TODO: | |
| 4425 | - //alert(element.find("#tooltipTest").html()); | |
| 4426 | - //$compile(element.find("#tooltipTest"))(scope); | |
| 4427 | - | |
| 4428 | - }, | |
| 4429 | - | |
| 4430 | - post: function(scope, element, attr) { | |
| 4431 | - //var head = element[0]; | |
| 4432 | - | |
| 4433 | - //console.log("llllllllload"); | |
| 4434 | - //console.log(element.name); | |
| 4435 | - | |
| 4436 | - element.bind('scroll', function() { | |
| 4437 | - //console.log("top=", angular.element(".tt_table_head").css("top")); | |
| 4438 | - //console.log("left=", angular.element(".tt_table_head").css("left")); | |
| 4439 | - //console.log("s top=" + element.scrollTop()); | |
| 4440 | - | |
| 4441 | - angular.element(".tt_table_head").css("top", element.scrollTop()); | |
| 4442 | - angular.element(".tt_table_head:eq(0)").css("left", element.scrollLeft()); | |
| 4443 | - angular.element(".tt_table_body:eq(0)").css("left", element.scrollLeft()); | |
| 4444 | - | |
| 4445 | - }); | |
| 4446 | - } | |
| 4447 | - | |
| 4448 | - }; | |
| 4449 | - } | |
| 4450 | - } | |
| 4451 | - } | |
| 4452 | - ] | |
| 4453 | -); | |
| 4454 | 4410 | /** |
| 4455 | - * saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的) | |
| 4456 | - * 属性如下: | |
| 4457 | - * name(必须):控件的名字 | |
| 4458 | - * columns(必须,独立作用域):字段名字列表,格式:[{name:[字段名],desc:[字段描述]}...] | |
| 4459 | - * ordercolumns(必须,独立作用域):字段排序列表,格式:{order: '字段1,字段2',direction: 'ASC,DESC'} | |
| 4411 | + * saTimetablePreview指令,时刻表预览模式视图。 | |
| 4460 | 4412 | */ |
| 4461 | -angular.module('ScheduleApp').directive( | |
| 4462 | - 'saOrderoption', | |
| 4413 | +angular.module("ScheduleApp").directive( | |
| 4414 | + "saTimetable2", | |
| 4463 | 4415 | [ |
| 4464 | - function() { | |
| 4416 | + '$timeout', | |
| 4417 | + function($timeout) { | |
| 4465 | 4418 | return { |
| 4466 | - restrict: 'E', | |
| 4467 | - templateUrl: '/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html', | |
| 4468 | - scope: { | |
| 4469 | - columns: '=', | |
| 4470 | - ordercolumns: '=' | |
| 4419 | + restrict : 'E', | |
| 4420 | + templateUrl : '/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreViewTemplate.html', | |
| 4421 | + scope : { // 独立作用域 | |
| 4422 | + // 使用外部数据源,内部重新组合显示 | |
| 4423 | + ds : "=ngModel" | |
| 4471 | 4424 | }, |
| 4472 | - controllerAs: '$saOrderOptionCtrl', | |
| 4425 | + controllerAs : "$saTimeTablePreviewCtrl", | |
| 4473 | 4426 | bindToController: true, |
| 4474 | - controller: function() { | |
| 4427 | + controller : function() { | |
| 4475 | 4428 | var self = this; |
| 4476 | 4429 | |
| 4477 | - // 字段列表是否预载入 | |
| 4478 | - self.$$columns_loaded = false; | |
| 4479 | - // 字段排序是否预载入 | |
| 4480 | - self.$$ordercolumns_loaded = false; | |
| 4430 | + // 内部班次时刻模型 | |
| 4431 | + self.internalBcModel = { | |
| 4432 | + up_qdz_name : "", // 上行起点站名字 | |
| 4433 | + down_qdz_name : "", // 下行起点站名字 | |
| 4434 | + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | |
| 4435 | + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | |
| 4436 | + }; | |
| 4481 | 4437 | |
| 4438 | + // 内部各个路牌block车次链模型 | |
| 4439 | + self.internalLpBlockModel = { | |
| 4440 | + // key:路牌名字 | |
| 4441 | + // value: 数组(按照发车时间排序) | |
| 4442 | + // value 数据内对象 {fcsj:发车时间,isUp:是否上行,fcno:发车顺序号,index:对应的班次列表索引} | |
| 4443 | + }; | |
| 4482 | 4444 | |
| 4483 | - // 每组选项内部数据源 | |
| 4484 | - // 格式:[{column:[选中的字段名],dir:[ASC/DESC]}] | |
| 4485 | - self.$$selectgroupds = []; | |
| 4445 | + // TODO: | |
| 4446 | + }, | |
| 4486 | 4447 | |
| 4487 | - // TODO:选择事件 | |
| 4448 | + /**, | |
| 4449 | + * compile阶段,angular还没有编译模版,根据需要可以修改模版dom | |
| 4450 | + * @param tElem | |
| 4451 | + * @param tAttrs | |
| 4452 | + * @returns {{pre: Function, post: Function}} | |
| 4453 | + */ | |
| 4454 | + compile : function(tElem, tAttrs) { | |
| 4455 | + // 获取属性 | |
| 4456 | + var $attr_name = tAttrs["name"]; // 控件的名字 | |
| 4457 | + if (!$attr_name) { | |
| 4458 | + throw new Error("saTimeTablePreview指令 name属性required"); | |
| 4459 | + } | |
| 4488 | 4460 | |
| 4489 | - self.$$select_column_change = function() { | |
| 4490 | - self.$$refresh_selectgroupds(); | |
| 4491 | - }; | |
| 4461 | + // 内部controlAs名字 | |
| 4462 | + var ctrlAs = "$saTimeTablePreviewCtrl"; | |
| 4492 | 4463 | |
| 4493 | - self.$$select_dir_change = function() { | |
| 4494 | - self.$$refresh_selectgroupds(); | |
| 4495 | - }; | |
| 4464 | + // TODO: | |
| 4496 | 4465 | |
| 4497 | - self.$$add_option_click = function(index) { | |
| 4498 | - self.$$selectgroupds.splice(index, 0, { | |
| 4499 | - column: self.columns[0].name, | |
| 4500 | - dir: "ASC" | |
| 4501 | - }); | |
| 4502 | - self.$$refresh_selectgroupds(); | |
| 4503 | - }; | |
| 4504 | - self.$$del_option_click = function(index) { | |
| 4505 | - self.$$selectgroupds.splice(index, 1); | |
| 4506 | - self.$$refresh_selectgroupds(); | |
| 4466 | + //------------------ 内部方法 --------------------// | |
| 4467 | + var date_wrap_prefix = "2000-01-01 "; // 包装日期的前缀 | |
| 4468 | + var date_wrap_format = "YYYY-MM-DD HH:mm"; // 日期格式 | |
| 4469 | + /** | |
| 4470 | + * 将时间包装成日期,方便计算。 | |
| 4471 | + * @param timeStr 时间格式,如 06:30 | |
| 4472 | + * @returns moment对象 | |
| 4473 | + */ | |
| 4474 | + var _fun_WrapTime = function(timeStr) { | |
| 4475 | + return moment( | |
| 4476 | + date_wrap_prefix + timeStr, | |
| 4477 | + date_wrap_format | |
| 4478 | + ); | |
| 4507 | 4479 | }; |
| 4508 | 4480 | |
| 4509 | - // 刷新选项内部数据源 | |
| 4510 | - self.$$refresh_selectgroupds = function() { | |
| 4511 | - if (!self.$$columns_loaded || !self.$$ordercolumns_loaded || self.columns.length == 0) { | |
| 4512 | - // 没有载入完成,或者字段列表为空 | |
| 4513 | - return; | |
| 4481 | + /** | |
| 4482 | + * 点击班次html元素(dl),触发班次移动,如下: | |
| 4483 | + * 1、点击上行班次,下一个下行班次在下行班次列表中移到中间位置 | |
| 4484 | + * 2、点击下行班次,下一个上行班次在上行班次列表中移到中间位置 | |
| 4485 | + * @param ctrl 内部控制器 | |
| 4486 | + * @param index 班次索引 | |
| 4487 | + * @param isUp 是否上行 | |
| 4488 | + * @private | |
| 4489 | + */ | |
| 4490 | + var _fun_bcDDViewMove = function(ctrl, index, isUp) { | |
| 4491 | + // 获取当前点击班次对象 | |
| 4492 | + var oBc; | |
| 4493 | + if (isUp) { | |
| 4494 | + oBc = ctrl.internalBcModel.up_bc_list_asc[index]; | |
| 4495 | + } else { | |
| 4496 | + oBc = ctrl.internalBcModel.down_bc_list_asc[index]; | |
| 4514 | 4497 | } |
| 4515 | 4498 | |
| 4516 | - if (self.$$selectgroupds.length == 0) { // 默认添加一组排序 | |
| 4517 | - self.$$selectgroupds.push({ | |
| 4518 | - column: self.columns[0].name, | |
| 4519 | - dir: "ASC" | |
| 4520 | - }); | |
| 4499 | + // 找出车次链中的下一个班次索引,没有就undefined | |
| 4500 | + var nextIndex = undefined; | |
| 4501 | + var nextBlockBc = undefined; | |
| 4502 | + var currentBlockBcIndex = undefined; | |
| 4503 | + angular.forEach(ctrl.internalLpBlockModel[oBc.lpName], function(data, i) { | |
| 4504 | + if (data.fcsj == oBc.fcsj) { | |
| 4505 | + currentBlockBcIndex = i; | |
| 4506 | + } | |
| 4507 | + }); | |
| 4508 | + if (currentBlockBcIndex != undefined && | |
| 4509 | + currentBlockBcIndex < (ctrl.internalLpBlockModel[oBc.lpName].length - 1)) { | |
| 4510 | + nextBlockBc = ctrl.internalLpBlockModel[oBc.lpName][currentBlockBcIndex + 1]; | |
| 4511 | + nextIndex = nextBlockBc.index; | |
| 4521 | 4512 | } |
| 4522 | - | |
| 4523 | - // 重新计算ordercolumns | |
| 4524 | - | |
| 4525 | - var aColumn = []; | |
| 4526 | - var aDir = []; | |
| 4527 | - for (var i = 0; i < self.$$selectgroupds.length; i++) { | |
| 4528 | - aColumn.push(self.$$selectgroupds[i].column); | |
| 4529 | - aDir.push(self.$$selectgroupds[i].dir); | |
| 4513 | + // 先删除click标记,再添加 | |
| 4514 | + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data) { | |
| 4515 | + delete data["isClick"]; | |
| 4516 | + }); | |
| 4517 | + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data) { | |
| 4518 | + delete data["isClick"]; | |
| 4519 | + }); | |
| 4520 | + oBc.isClick = true; | |
| 4521 | + if (nextIndex) { | |
| 4522 | + if (nextBlockBc.isUp) { | |
| 4523 | + ctrl.internalBcModel.up_bc_list_asc[nextIndex].isClick = true; | |
| 4524 | + } else { | |
| 4525 | + ctrl.internalBcModel.down_bc_list_asc[nextIndex].isClick = true; | |
| 4526 | + } | |
| 4530 | 4527 | } |
| 4531 | - if (self.ordercolumns) { | |
| 4532 | - self.ordercolumns.order = aColumn.join(","); | |
| 4533 | - self.ordercolumns.direction = aDir.join(","); | |
| 4534 | - } else { | |
| 4535 | - self.ordercolumns = {order: aColumn.join(","), direction: aDir.join(",")} | |
| 4528 | + | |
| 4529 | + // 移动,同方向不移动 | |
| 4530 | + var clientHeight = angular.element("#temp").height() - 34; | |
| 4531 | + if (nextBlockBc && isUp != nextBlockBc.isUp) { | |
| 4532 | + if (isUp) { // 移动下行 | |
| 4533 | + angular.element(".ttpv_table_scrollbar:eq(1)").animate( | |
| 4534 | + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400); | |
| 4535 | + } else { // 移动上行 | |
| 4536 | + angular.element(".ttpv_table_scrollbar:eq(0)").animate( | |
| 4537 | + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400); | |
| 4538 | + } | |
| 4536 | 4539 | } |
| 4537 | 4540 | |
| 4538 | - } | |
| 4539 | - }, | |
| 4540 | - compile: function(tElem, tAttrs) { | |
| 4541 | - // 获取所有属性,并验证 | |
| 4542 | - var $name_attr = tAttrs['name']; // 控件的名字 | |
| 4543 | - if (!$name_attr) { | |
| 4544 | - throw "必须有名称属性"; | |
| 4545 | - } | |
| 4541 | + }; | |
| 4546 | 4542 | |
| 4547 | - // controlAs名字 | |
| 4548 | - var ctrlAs = '$saOrderOptionCtrl'; | |
| 4543 | + /** | |
| 4544 | + * 刷新内部数据。 | |
| 4545 | + * @param ctrl 内部控制器对象($saTimeTablePreviewCtrl) | |
| 4546 | + * @private | |
| 4547 | + */ | |
| 4548 | + var _fun_refreshInternalModel = function(ctrl) { | |
| 4549 | + // 初始化内部数据 | |
| 4550 | + ctrl.internalBcModel = { | |
| 4551 | + up_qdz_name : "", // 上行起点站名字 | |
| 4552 | + up_zdz_name : "", // 上行终点站名字 | |
| 4553 | + down_qdz_name : "", // 下行起点站名字 | |
| 4554 | + down_zdz_name : "", // 下行终点站名字 | |
| 4555 | + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | |
| 4556 | + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | |
| 4557 | + }; | |
| 4558 | + ctrl.internalLpBlockModel = { | |
| 4549 | 4559 | |
| 4550 | - // TODO: | |
| 4560 | + }; | |
| 4551 | 4561 | |
| 4562 | + // ngModel传入的数据 | |
| 4563 | + var dataSource = ctrl.ds.bcList; | |
| 4552 | 4564 | |
| 4565 | + // 构造上下行班次列表,并确定上下行的首发站点 | |
| 4566 | + angular.forEach(dataSource, function(bcObj) { | |
| 4567 | + var _internalBcObj = {}; | |
| 4568 | + // 构造内部班次对象 | |
| 4569 | + _internalBcObj.lpName = bcObj.lp.lpName; // 路牌 | |
| 4570 | + _internalBcObj.fcsj = bcObj.fcsj; // 发车时间 | |
| 4571 | + _internalBcObj.ddsj = _fun_WrapTime(bcObj.fcsj).add(bcObj.bcsj, "m").format("HH:mm"); | |
| 4572 | + _internalBcObj.qdzName = bcObj.qdzName; // 起点站名字 | |
| 4573 | + _internalBcObj.zdzName = bcObj.zdzName; // 终点站名字 | |
| 4574 | + _internalBcObj.bcType = bcObj.bcType; // 班次类型 | |
| 4575 | + _internalBcObj.isTs = bcObj.isTS; // 是否停驶 | |
| 4576 | + _internalBcObj.isFb = bcObj.isFB; // 是否分班 | |
| 4577 | + _internalBcObj.remark = bcObj.remark; // 备注 | |
| 4578 | + _internalBcObj._fcno = bcObj.fcno; // 发车顺序号 | |
| 4553 | 4579 | |
| 4554 | - return { | |
| 4555 | - pre: function(scope, element, attr) { | |
| 4580 | + if (bcObj.xlDir == "0") { // 上行 | |
| 4581 | + ctrl.internalBcModel.up_bc_list_asc.push(_internalBcObj); | |
| 4582 | + // 确定起点站 | |
| 4583 | + if (ctrl.internalBcModel.up_qdz_name == "") { | |
| 4584 | + if (bcObj.bcType == "normal") { | |
| 4585 | + ctrl.internalBcModel.up_qdz_name = bcObj.qdzName; | |
| 4586 | + } | |
| 4587 | + } | |
| 4588 | + // 确定终点站 | |
| 4589 | + if (ctrl.internalBcModel.up_zdz_name == "") { | |
| 4590 | + if (bcObj.bcType == "normal") { | |
| 4591 | + ctrl.internalBcModel.up_zdz_name = bcObj.zdzName; | |
| 4592 | + } | |
| 4593 | + } | |
| 4594 | + } | |
| 4595 | + if (bcObj.xlDir == "1") { // 下行 | |
| 4596 | + ctrl.internalBcModel.down_bc_list_asc.push(_internalBcObj); | |
| 4597 | + // 确定起点站 | |
| 4598 | + if (ctrl.internalBcModel.down_qdz_name == "") { | |
| 4599 | + if (bcObj.bcType == "normal") { | |
| 4600 | + ctrl.internalBcModel.down_qdz_name = bcObj.qdzName; | |
| 4601 | + } | |
| 4602 | + } | |
| 4603 | + // 确定终点站 | |
| 4604 | + if (ctrl.internalBcModel.down_zdz_name == "") { | |
| 4605 | + if (bcObj.bcType == "normal") { | |
| 4606 | + ctrl.internalBcModel.down_zdz_name = bcObj.zdzName; | |
| 4607 | + } | |
| 4608 | + } | |
| 4609 | + } | |
| 4556 | 4610 | |
| 4557 | - }, | |
| 4611 | + }); | |
| 4558 | 4612 | |
| 4559 | - post: function(scope, element, attr) { | |
| 4613 | + // 发车时间升序排序上行班次 | |
| 4614 | + ctrl.internalBcModel.up_bc_list_asc.sort(function(a, b) { | |
| 4615 | + var a_wrapTime = _fun_WrapTime(a.fcsj); | |
| 4616 | + var b_wrapTime = _fun_WrapTime(b.fcsj); | |
| 4560 | 4617 | |
| 4561 | - //--------------------- 监控属性方法 -------------------// | |
| 4562 | - // 监控字段名字列表 | |
| 4563 | - scope.$watch( | |
| 4564 | - function() { | |
| 4565 | - return scope[ctrlAs].columns; | |
| 4566 | - }, | |
| 4567 | - function(newValue, oldValue) { | |
| 4568 | - if (!scope[ctrlAs].$$columns_loaded) { | |
| 4569 | - // TODO:格式判定以后做,假设格式是对的 | |
| 4618 | + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | |
| 4619 | + // TODO:以后要配合首班车的发车时间判定 | |
| 4620 | + if (a.fcsj.indexOf("00:") == 0 || | |
| 4621 | + a.fcsj.indexOf("01:") == 0 || | |
| 4622 | + a.fcsj.indexOf("02:") == 0) { | |
| 4623 | + a_wrapTime.add(1, "day"); | |
| 4624 | + } | |
| 4625 | + if (b.fcsj.indexOf("00:") == 0 || | |
| 4626 | + b.fcsj.indexOf("01:") == 0 || | |
| 4627 | + b.fcsj.indexOf("02:") == 0) { | |
| 4628 | + b_wrapTime.add(1, "day"); | |
| 4629 | + } | |
| 4570 | 4630 | |
| 4631 | + if (a_wrapTime.isBefore(b_wrapTime)) { | |
| 4632 | + return -1; | |
| 4633 | + } else if (a_wrapTime.isAfter(b_wrapTime)) { | |
| 4634 | + return 1; | |
| 4635 | + } else { | |
| 4636 | + return 0; | |
| 4637 | + } | |
| 4571 | 4638 | |
| 4572 | - } | |
| 4639 | + }); | |
| 4640 | + // 发车时间升序排序下行班次 | |
| 4641 | + ctrl.internalBcModel.down_bc_list_asc.sort(function(a, b) { | |
| 4642 | + var a_wrapTime = _fun_WrapTime(a.fcsj); | |
| 4643 | + var b_wrapTime = _fun_WrapTime(b.fcsj); | |
| 4573 | 4644 | |
| 4574 | - scope[ctrlAs].$$columns_loaded = true; | |
| 4575 | - scope[ctrlAs].$$refresh_selectgroupds(); | |
| 4576 | - }, | |
| 4577 | - true | |
| 4578 | - ); | |
| 4579 | - // 监控字段排序列表 | |
| 4645 | + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | |
| 4646 | + // TODO:以后要配合首班车的发车时间判定 | |
| 4647 | + if (a.fcsj.indexOf("00:") == 0 || | |
| 4648 | + a.fcsj.indexOf("01:") == 0 || | |
| 4649 | + a.fcsj.indexOf("02:") == 0) { | |
| 4650 | + a_wrapTime.add(1, "day"); | |
| 4651 | + } | |
| 4652 | + if (b.fcsj.indexOf("00:") == 0 || | |
| 4653 | + b.fcsj.indexOf("01:") == 0 || | |
| 4654 | + b.fcsj.indexOf("02:") == 0) { | |
| 4655 | + b_wrapTime.add(1, "day"); | |
| 4656 | + } | |
| 4657 | + | |
| 4658 | + if (a_wrapTime.isBefore(b_wrapTime)) { | |
| 4659 | + return -1; | |
| 4660 | + } else if (a_wrapTime.isAfter(b_wrapTime)) { | |
| 4661 | + return 1; | |
| 4662 | + } else { | |
| 4663 | + return 0; | |
| 4664 | + } | |
| 4665 | + }); | |
| 4666 | + | |
| 4667 | + // 构造路牌block车次链,按照发车顺序排序 | |
| 4668 | + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data, index) { | |
| 4669 | + if (!ctrl.internalLpBlockModel[data.lpName]) { | |
| 4670 | + ctrl.internalLpBlockModel[data.lpName] = []; | |
| 4671 | + } | |
| 4672 | + ctrl.internalLpBlockModel[data.lpName].push({ | |
| 4673 | + fcsj : data.fcsj, | |
| 4674 | + isUp : true, | |
| 4675 | + fcno : data._fcno, | |
| 4676 | + index : index | |
| 4677 | + }); | |
| 4678 | + }); | |
| 4679 | + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data, index) { | |
| 4680 | + if (!ctrl.internalLpBlockModel[data.lpName]) { | |
| 4681 | + ctrl.internalLpBlockModel[data.lpName] = []; | |
| 4682 | + } | |
| 4683 | + ctrl.internalLpBlockModel[data.lpName].push({ | |
| 4684 | + fcsj : data.fcsj, | |
| 4685 | + isUp : false, | |
| 4686 | + fcno : data._fcno, | |
| 4687 | + index : index | |
| 4688 | + }); | |
| 4689 | + }); | |
| 4690 | + angular.forEach(ctrl.internalLpBlockModel, function(value, key) { | |
| 4691 | + value.sort(function (a, b) { | |
| 4692 | + if (a.fcno < b.fcno) { | |
| 4693 | + return -1; | |
| 4694 | + } else if (a.fcno > b.fcno) { | |
| 4695 | + return 1; | |
| 4696 | + } else { | |
| 4697 | + return 0; | |
| 4698 | + } | |
| 4699 | + }); | |
| 4700 | + }); | |
| 4701 | + | |
| 4702 | + | |
| 4703 | + }; | |
| 4704 | + | |
| 4705 | + return { | |
| 4706 | + pre : function(scope, element, attr) { | |
| 4707 | + // TODO: | |
| 4708 | + }, | |
| 4709 | + post : function(scope, element, attr) { | |
| 4710 | + // 班次html点击事件 | |
| 4711 | + scope[ctrlAs].$$bcDD_Click = function(index, xlDir) { | |
| 4712 | + _fun_bcDDViewMove(scope[ctrlAs], index, xlDir); | |
| 4713 | + }; | |
| 4714 | + | |
| 4715 | + // 监控ngModel绑定的外部数据源的刷新状态变化 | |
| 4580 | 4716 | scope.$watch( |
| 4581 | 4717 | function() { |
| 4582 | - return scope[ctrlAs].ordercolumns; | |
| 4718 | + return scope[ctrlAs].ds.refreshInfos; | |
| 4583 | 4719 | }, |
| 4584 | 4720 | function(newValue, oldValue) { |
| 4585 | - if (!scope[ctrlAs].$$ordercolumns_loaded) { | |
| 4586 | - if (newValue) { | |
| 4587 | - var aColumns = []; // 排序的字段 | |
| 4588 | - var aDirs = []; // 排序字段对应的排序方向 | |
| 4589 | - | |
| 4590 | - if (newValue.order) { | |
| 4591 | - aColumns = newValue.order.split(","); | |
| 4592 | - } | |
| 4593 | - if (newValue.direction) { | |
| 4594 | - aDirs = newValue.direction.split(","); | |
| 4595 | - } | |
| 4596 | - | |
| 4597 | - for (var i = 0; i < aColumns.length; i++) { | |
| 4598 | - if (i < aDirs.length) { | |
| 4599 | - scope[ctrlAs].$$selectgroupds.push({ | |
| 4600 | - column: aColumns[i], | |
| 4601 | - dir: aDirs[i] | |
| 4602 | - }); | |
| 4603 | - } else { | |
| 4604 | - scope[ctrlAs].$$selectgroupds.push({ | |
| 4605 | - column: aColumns[i], | |
| 4606 | - dir: 'ASC' | |
| 4607 | - }); | |
| 4608 | - } | |
| 4609 | - } | |
| 4610 | - } | |
| 4721 | + if (newValue === undefined && oldValue === undefined) { | |
| 4722 | + return; | |
| 4611 | 4723 | } |
| 4612 | - scope[ctrlAs].$$ordercolumns_loaded = true; | |
| 4613 | - scope[ctrlAs].$$refresh_selectgroupds(); | |
| 4614 | - | |
| 4724 | + console.log("saTimetable2 refresh"); | |
| 4725 | + _fun_refreshInternalModel(scope[ctrlAs]); | |
| 4615 | 4726 | }, |
| 4616 | 4727 | true |
| 4617 | 4728 | ); |
| 4618 | 4729 | } |
| 4619 | - | |
| 4620 | 4730 | }; |
| 4621 | 4731 | } |
| 4622 | 4732 | }; |
| ... | ... | @@ -4624,6 +4734,266 @@ angular.module('ScheduleApp').directive( |
| 4624 | 4734 | ] |
| 4625 | 4735 | ); |
| 4626 | 4736 | /** |
| 4737 | + * 滚动事件控制指令。 | |
| 4738 | + */ | |
| 4739 | +angular.module('ScheduleApp').directive( | |
| 4740 | + 'saTscrolly1', | |
| 4741 | + [ | |
| 4742 | + function() { | |
| 4743 | + return { | |
| 4744 | + restrict: 'A', | |
| 4745 | + | |
| 4746 | + compile: function(tElem, tAttrs) { | |
| 4747 | + | |
| 4748 | + return { | |
| 4749 | + pre: function(scope, element, attr) { | |
| 4750 | + // TODO: | |
| 4751 | + //alert(element.find("#tooltipTest").html()); | |
| 4752 | + //$compile(element.find("#tooltipTest"))(scope); | |
| 4753 | + | |
| 4754 | + }, | |
| 4755 | + | |
| 4756 | + post: function(scope, element, attr) { | |
| 4757 | + //var head = element[0]; | |
| 4758 | + | |
| 4759 | + //console.log("llllllllload"); | |
| 4760 | + //console.log(element.name); | |
| 4761 | + | |
| 4762 | + element.bind('scroll', function() { | |
| 4763 | + //console.log("top=", angular.element(".tt_table_head").css("top")); | |
| 4764 | + //console.log("left=", angular.element(".tt_table_head").css("left")); | |
| 4765 | + //console.log("s top=" + element.scrollTop()); | |
| 4766 | + | |
| 4767 | + angular.element(".tt_table_head").css("top", element.scrollTop()); | |
| 4768 | + angular.element(".tt_table_head:eq(0)").css("left", element.scrollLeft()); | |
| 4769 | + angular.element(".tt_table_body:eq(0)").css("left", element.scrollLeft()); | |
| 4770 | + | |
| 4771 | + }); | |
| 4772 | + } | |
| 4773 | + | |
| 4774 | + }; | |
| 4775 | + } | |
| 4776 | + } | |
| 4777 | + } | |
| 4778 | + ] | |
| 4779 | +); | |
| 4780 | +/** | |
| 4781 | + * 滚动事件控制指令。 | |
| 4782 | + */ | |
| 4783 | +angular.module('ScheduleApp').directive( | |
| 4784 | + 'saTscrolly2', | |
| 4785 | + [ | |
| 4786 | + function() { | |
| 4787 | + return { | |
| 4788 | + restrict: 'A', | |
| 4789 | + | |
| 4790 | + compile: function(tElem, tAttrs) { | |
| 4791 | + | |
| 4792 | + return { | |
| 4793 | + pre: function(scope, element, attr) { | |
| 4794 | + // TODO: | |
| 4795 | + //alert(element.find("#tooltipTest").html()); | |
| 4796 | + //$compile(element.find("#tooltipTest"))(scope); | |
| 4797 | + | |
| 4798 | + }, | |
| 4799 | + | |
| 4800 | + post: function(scope, element, attr) { | |
| 4801 | + //var head = element[0]; | |
| 4802 | + | |
| 4803 | + //console.log("llllllllload"); | |
| 4804 | + //console.log(element.name); | |
| 4805 | + | |
| 4806 | + element.bind('scroll', function() { | |
| 4807 | + //console.log("top=", angular.element(".tt_table_head").css("top")); | |
| 4808 | + //console.log("left=", angular.element(".tt_table_head").css("left")); | |
| 4809 | + //console.log("s top=" + element.scrollTop()); | |
| 4810 | + | |
| 4811 | + angular.element(attr.scrclass).css("top", element.scrollTop()); | |
| 4812 | + // angular.element(".tt_table_head:eq(0)").css("left", element.scrollLeft()); | |
| 4813 | + // angular.element(".tt_table_body:eq(0)").css("left", element.scrollLeft()); | |
| 4814 | + | |
| 4815 | + }); | |
| 4816 | + } | |
| 4817 | + | |
| 4818 | + }; | |
| 4819 | + } | |
| 4820 | + } | |
| 4821 | + } | |
| 4822 | + ] | |
| 4823 | +); | |
| 4824 | +/** | |
| 4825 | + * saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的) | |
| 4826 | + * 属性如下: | |
| 4827 | + * name(必须):控件的名字 | |
| 4828 | + * columns(必须,独立作用域):字段名字列表,格式:[{name:[字段名],desc:[字段描述]}...] | |
| 4829 | + * ordercolumns(必须,独立作用域):字段排序列表,格式:{order: '字段1,字段2',direction: 'ASC,DESC'} | |
| 4830 | + */ | |
| 4831 | +angular.module('ScheduleApp').directive( | |
| 4832 | + 'saOrderoption', | |
| 4833 | + [ | |
| 4834 | + function() { | |
| 4835 | + return { | |
| 4836 | + restrict: 'E', | |
| 4837 | + templateUrl: '/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html', | |
| 4838 | + scope: { | |
| 4839 | + columns: '=', | |
| 4840 | + ordercolumns: '=' | |
| 4841 | + }, | |
| 4842 | + controllerAs: '$saOrderOptionCtrl', | |
| 4843 | + bindToController: true, | |
| 4844 | + controller: function() { | |
| 4845 | + var self = this; | |
| 4846 | + | |
| 4847 | + // 字段列表是否预载入 | |
| 4848 | + self.$$columns_loaded = false; | |
| 4849 | + // 字段排序是否预载入 | |
| 4850 | + self.$$ordercolumns_loaded = false; | |
| 4851 | + | |
| 4852 | + | |
| 4853 | + // 每组选项内部数据源 | |
| 4854 | + // 格式:[{column:[选中的字段名],dir:[ASC/DESC]}] | |
| 4855 | + self.$$selectgroupds = []; | |
| 4856 | + | |
| 4857 | + // TODO:选择事件 | |
| 4858 | + | |
| 4859 | + self.$$select_column_change = function() { | |
| 4860 | + self.$$refresh_selectgroupds(); | |
| 4861 | + }; | |
| 4862 | + | |
| 4863 | + self.$$select_dir_change = function() { | |
| 4864 | + self.$$refresh_selectgroupds(); | |
| 4865 | + }; | |
| 4866 | + | |
| 4867 | + self.$$add_option_click = function(index) { | |
| 4868 | + self.$$selectgroupds.splice(index, 0, { | |
| 4869 | + column: self.columns[0].name, | |
| 4870 | + dir: "ASC" | |
| 4871 | + }); | |
| 4872 | + self.$$refresh_selectgroupds(); | |
| 4873 | + }; | |
| 4874 | + self.$$del_option_click = function(index) { | |
| 4875 | + self.$$selectgroupds.splice(index, 1); | |
| 4876 | + self.$$refresh_selectgroupds(); | |
| 4877 | + }; | |
| 4878 | + | |
| 4879 | + // 刷新选项内部数据源 | |
| 4880 | + self.$$refresh_selectgroupds = function() { | |
| 4881 | + if (!self.$$columns_loaded || !self.$$ordercolumns_loaded || self.columns.length == 0) { | |
| 4882 | + // 没有载入完成,或者字段列表为空 | |
| 4883 | + return; | |
| 4884 | + } | |
| 4885 | + | |
| 4886 | + if (self.$$selectgroupds.length == 0) { // 默认添加一组排序 | |
| 4887 | + self.$$selectgroupds.push({ | |
| 4888 | + column: self.columns[0].name, | |
| 4889 | + dir: "ASC" | |
| 4890 | + }); | |
| 4891 | + } | |
| 4892 | + | |
| 4893 | + // 重新计算ordercolumns | |
| 4894 | + | |
| 4895 | + var aColumn = []; | |
| 4896 | + var aDir = []; | |
| 4897 | + for (var i = 0; i < self.$$selectgroupds.length; i++) { | |
| 4898 | + aColumn.push(self.$$selectgroupds[i].column); | |
| 4899 | + aDir.push(self.$$selectgroupds[i].dir); | |
| 4900 | + } | |
| 4901 | + if (self.ordercolumns) { | |
| 4902 | + self.ordercolumns.order = aColumn.join(","); | |
| 4903 | + self.ordercolumns.direction = aDir.join(","); | |
| 4904 | + } else { | |
| 4905 | + self.ordercolumns = {order: aColumn.join(","), direction: aDir.join(",")} | |
| 4906 | + } | |
| 4907 | + | |
| 4908 | + } | |
| 4909 | + }, | |
| 4910 | + compile: function(tElem, tAttrs) { | |
| 4911 | + // 获取所有属性,并验证 | |
| 4912 | + var $name_attr = tAttrs['name']; // 控件的名字 | |
| 4913 | + if (!$name_attr) { | |
| 4914 | + throw "必须有名称属性"; | |
| 4915 | + } | |
| 4916 | + | |
| 4917 | + // controlAs名字 | |
| 4918 | + var ctrlAs = '$saOrderOptionCtrl'; | |
| 4919 | + | |
| 4920 | + // TODO: | |
| 4921 | + | |
| 4922 | + | |
| 4923 | + | |
| 4924 | + return { | |
| 4925 | + pre: function(scope, element, attr) { | |
| 4926 | + | |
| 4927 | + }, | |
| 4928 | + | |
| 4929 | + post: function(scope, element, attr) { | |
| 4930 | + | |
| 4931 | + //--------------------- 监控属性方法 -------------------// | |
| 4932 | + // 监控字段名字列表 | |
| 4933 | + scope.$watch( | |
| 4934 | + function() { | |
| 4935 | + return scope[ctrlAs].columns; | |
| 4936 | + }, | |
| 4937 | + function(newValue, oldValue) { | |
| 4938 | + if (!scope[ctrlAs].$$columns_loaded) { | |
| 4939 | + // TODO:格式判定以后做,假设格式是对的 | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + } | |
| 4943 | + | |
| 4944 | + scope[ctrlAs].$$columns_loaded = true; | |
| 4945 | + scope[ctrlAs].$$refresh_selectgroupds(); | |
| 4946 | + }, | |
| 4947 | + true | |
| 4948 | + ); | |
| 4949 | + // 监控字段排序列表 | |
| 4950 | + scope.$watch( | |
| 4951 | + function() { | |
| 4952 | + return scope[ctrlAs].ordercolumns; | |
| 4953 | + }, | |
| 4954 | + function(newValue, oldValue) { | |
| 4955 | + if (!scope[ctrlAs].$$ordercolumns_loaded) { | |
| 4956 | + if (newValue) { | |
| 4957 | + var aColumns = []; // 排序的字段 | |
| 4958 | + var aDirs = []; // 排序字段对应的排序方向 | |
| 4959 | + | |
| 4960 | + if (newValue.order) { | |
| 4961 | + aColumns = newValue.order.split(","); | |
| 4962 | + } | |
| 4963 | + if (newValue.direction) { | |
| 4964 | + aDirs = newValue.direction.split(","); | |
| 4965 | + } | |
| 4966 | + | |
| 4967 | + for (var i = 0; i < aColumns.length; i++) { | |
| 4968 | + if (i < aDirs.length) { | |
| 4969 | + scope[ctrlAs].$$selectgroupds.push({ | |
| 4970 | + column: aColumns[i], | |
| 4971 | + dir: aDirs[i] | |
| 4972 | + }); | |
| 4973 | + } else { | |
| 4974 | + scope[ctrlAs].$$selectgroupds.push({ | |
| 4975 | + column: aColumns[i], | |
| 4976 | + dir: 'ASC' | |
| 4977 | + }); | |
| 4978 | + } | |
| 4979 | + } | |
| 4980 | + } | |
| 4981 | + } | |
| 4982 | + scope[ctrlAs].$$ordercolumns_loaded = true; | |
| 4983 | + scope[ctrlAs].$$refresh_selectgroupds(); | |
| 4984 | + | |
| 4985 | + }, | |
| 4986 | + true | |
| 4987 | + ); | |
| 4988 | + } | |
| 4989 | + | |
| 4990 | + }; | |
| 4991 | + } | |
| 4992 | + }; | |
| 4993 | + } | |
| 4994 | + ] | |
| 4995 | +); | |
| 4996 | +/** | |
| 4627 | 4997 | * saScpdate指令(非通用指令,只在排班计划form中使用)。 |
| 4628 | 4998 | * 属性如下: |
| 4629 | 4999 | * name(必须):控件的名字 |
| ... | ... | @@ -4854,193 +5224,193 @@ angular.module('ScheduleApp').directive( |
| 4854 | 5224 | } |
| 4855 | 5225 | ] |
| 4856 | 5226 | ); |
| 4857 | -/** | |
| 4858 | - * saSrule指令(非通用指令,只在排班计划form中使用)。 | |
| 4859 | - * 属性如下: | |
| 4860 | - * name(必须):控件的名字 | |
| 4861 | - * xlid(必须):线路id | |
| 4862 | - * from(必须):独立作用域-绑定的开始时间属性名 | |
| 4863 | - * to(必须):独立作用域-绑定的结束时间属性名 | |
| 4864 | - * error(必须):独立作用域-绑定的错误描述属性名 | |
| 4865 | - */ | |
| 4866 | -angular.module('ScheduleApp').directive( | |
| 4867 | - 'saSrule', | |
| 4868 | - [ | |
| 4869 | - 'SchedulePlanManageService_g', | |
| 4870 | - function(service) { | |
| 4871 | - return { | |
| 4872 | - restrict: 'E', | |
| 4873 | - templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html', | |
| 4874 | - scope: { | |
| 4875 | - from: '=', | |
| 4876 | - to: '=', | |
| 4877 | - xlid: '=', | |
| 4878 | - error: '=' | |
| 4879 | - }, | |
| 4880 | - controllerAs: '$saSruleCtrl', | |
| 4881 | - bindToController: true, | |
| 4882 | - controller: function() { | |
| 4883 | - var self = this; | |
| 4884 | - | |
| 4885 | - // 内部ng-model值,用于和required配对 | |
| 4886 | - self.$$internalmodel = undefined; | |
| 4887 | - | |
| 4888 | - // 内部数据源(时刻表的一些信息) | |
| 4889 | - self.$$count = 0; | |
| 4890 | - self.$$qyCount = 0; | |
| 4891 | - self.$$qyErrorCount = 0; | |
| 4892 | - self.$$errorInfos = []; | |
| 4893 | - | |
| 4894 | - }, | |
| 4895 | - compile: function(tElem, tAttrs) { | |
| 4896 | - // 获取所有属性,并验证 | |
| 4897 | - var $name_attr = tAttrs['name']; // 控件的名字 | |
| 4898 | - if (!$name_attr) { | |
| 4899 | - throw "必须有名称属性"; | |
| 4900 | - } | |
| 4901 | - | |
| 4902 | - // controlAs名字 | |
| 4903 | - var ctrlAs = '$saSruleCtrl'; | |
| 4904 | - | |
| 4905 | - // 线路id | |
| 4906 | - var xl_id = undefined; | |
| 4907 | - // 开始时间 | |
| 4908 | - var from_date = undefined; | |
| 4909 | - // 结束时间 | |
| 4910 | - var to_date = undefined; | |
| 4911 | - | |
| 4912 | - // 内部添加required验证,将所有的错误应用到required验证上去 | |
| 4913 | - tElem.find("div").attr("required", ""); | |
| 4914 | - | |
| 4915 | - return { | |
| 4916 | - pre: function(scope, element, attr) { | |
| 4917 | - | |
| 4918 | - }, | |
| 4919 | - | |
| 4920 | - post: function(scope, element, attr) { | |
| 4921 | - // 属性值 | |
| 4922 | - if ($name_attr) { | |
| 4923 | - scope[ctrlAs]["$name_attr"] = $name_attr; | |
| 4924 | - } | |
| 4925 | - | |
| 4926 | - // 开始日期open属性,及方法 | |
| 4927 | - scope[ctrlAs].$$fromDateOpen = false; | |
| 4928 | - scope[ctrlAs].$$fromDate_open = function() { | |
| 4929 | - scope[ctrlAs].$$fromDateOpen = true; | |
| 4930 | - }; | |
| 4931 | - | |
| 4932 | - // 结束日期open属性,及方法 | |
| 4933 | - scope[ctrlAs].$$toDateOpen = false; | |
| 4934 | - scope[ctrlAs].$$toDate_open = function() { | |
| 4935 | - scope[ctrlAs].$$toDateOpen = true; | |
| 4936 | - }; | |
| 4937 | - | |
| 4938 | - // 内部模型刷新 | |
| 4939 | - scope[ctrlAs].$$internal_model_refresh = function() { | |
| 4940 | - if (!xl_id) { | |
| 4941 | - scope[ctrlAs].$$internalmodel = undefined; | |
| 4942 | - scope[ctrlAs].error = "线路必须选择"; | |
| 4943 | - return; | |
| 4944 | - } | |
| 4945 | - if (!from_date) { | |
| 4946 | - scope[ctrlAs].$$internalmodel = undefined; | |
| 4947 | - scope[ctrlAs].error = "开始日期必须选择"; | |
| 4948 | - return; | |
| 4949 | - } | |
| 4950 | - if (!to_date) { | |
| 4951 | - scope[ctrlAs].$$internalmodel = undefined; | |
| 4952 | - scope[ctrlAs].error = "结束日期必须选择"; | |
| 4953 | - return; | |
| 4954 | - } | |
| 4955 | - if (from_date > to_date) { | |
| 4956 | - scope[ctrlAs].$$internalmodel = undefined; | |
| 4957 | - scope[ctrlAs].error = "开始日期必须在结束日期之前"; | |
| 4958 | - return; | |
| 4959 | - } | |
| 4960 | - | |
| 4961 | - scope[ctrlAs].$$count = 0; | |
| 4962 | - scope[ctrlAs].$$qyCount = 0; | |
| 4963 | - scope[ctrlAs].$$qyErrorCount = 0; | |
| 4964 | - scope[ctrlAs].$$errorInfos = []; | |
| 4965 | - | |
| 4966 | - if (scope[ctrlAs].$$qyCount == 0) { | |
| 4967 | - scope[ctrlAs].$$internalmodel = undefined; | |
| 4968 | - scope[ctrlAs].error = "无可启用的规则数"; | |
| 4969 | - } | |
| 4970 | - | |
| 4971 | - var QClass = service.v_rules; | |
| 4972 | - QClass.val({xlid: xl_id, from: from_date, to: to_date}, | |
| 4973 | - function(result) { | |
| 4974 | - scope[ctrlAs].$$count = result.data.count; | |
| 4975 | - scope[ctrlAs].$$qyCount = result.data.qyCount; | |
| 4976 | - scope[ctrlAs].$$qyErrorCount = result.data.qyErrorCount; | |
| 4977 | - | |
| 4978 | - angular.forEach(result.data.errorInfos, function(obj) { | |
| 4979 | - scope[ctrlAs].$$errorInfos.push({ | |
| 4980 | - ruleId: obj.ruleId, | |
| 4981 | - clZbh: obj.clZbh, | |
| 4982 | - qyrq: moment(obj.qyrq).format("YYYY年MM月DD日"), | |
| 4983 | - infos: obj.errorDescList.join("") | |
| 4984 | - }); | |
| 4985 | - }); | |
| 4986 | - | |
| 4987 | - if (scope[ctrlAs].$$qyErrorCount > 0) { | |
| 4988 | - scope[ctrlAs].$$internalmodel = undefined; | |
| 4989 | - scope[ctrlAs].error = "有错误的规则"; | |
| 4990 | - } else { | |
| 4991 | - scope[ctrlAs].$$internalmodel = "ok"; | |
| 4992 | - scope[ctrlAs].$$errorInfos = []; | |
| 4993 | - } | |
| 4994 | - }, | |
| 4995 | - function() { | |
| 4996 | - scope[ctrlAs].$$internalmodel = undefined; | |
| 4997 | - scope[ctrlAs].error = "获取规则数据失败!"; | |
| 4998 | - } | |
| 4999 | - ); | |
| 5000 | - | |
| 5001 | - scope[ctrlAs].$$internalmodel = "ok"; | |
| 5002 | - }; | |
| 5003 | - | |
| 5004 | - scope[ctrlAs].$$internal_model_refresh(); // 初始执行 | |
| 5005 | - | |
| 5006 | - //--------------------- 监控属性方法 -------------------// | |
| 5007 | - // 监控线路id模型值变化 | |
| 5008 | - scope.$watch( | |
| 5009 | - function() { | |
| 5010 | - return scope[ctrlAs].xlid; | |
| 5011 | - }, | |
| 5012 | - function(newValue, oldValue) { | |
| 5013 | - xl_id = newValue; | |
| 5014 | - scope[ctrlAs].$$internal_model_refresh(); | |
| 5015 | - } | |
| 5016 | - ); | |
| 5017 | - | |
| 5018 | - // 监控开始时间模型值变化 | |
| 5019 | - scope.$watch( | |
| 5020 | - function() { | |
| 5021 | - return scope[ctrlAs].from; | |
| 5022 | - }, | |
| 5023 | - function(newValue, oldValue) { | |
| 5024 | - from_date = newValue; | |
| 5025 | - scope[ctrlAs].$$internal_model_refresh(); | |
| 5026 | - } | |
| 5027 | - ); | |
| 5028 | - // 监控结束时间模型值变化 | |
| 5029 | - scope.$watch( | |
| 5030 | - function() { | |
| 5031 | - return scope[ctrlAs].to; | |
| 5032 | - }, | |
| 5033 | - function(newValue, oldValue) { | |
| 5034 | - to_date = newValue; | |
| 5035 | - scope[ctrlAs].$$internal_model_refresh(); | |
| 5036 | - } | |
| 5037 | - ); | |
| 5038 | - } | |
| 5039 | - }; | |
| 5040 | - } | |
| 5041 | - }; | |
| 5042 | - } | |
| 5043 | - ] | |
| 5227 | +/** | |
| 5228 | + * saSrule指令(非通用指令,只在排班计划form中使用)。 | |
| 5229 | + * 属性如下: | |
| 5230 | + * name(必须):控件的名字 | |
| 5231 | + * xlid(必须):线路id | |
| 5232 | + * from(必须):独立作用域-绑定的开始时间属性名 | |
| 5233 | + * to(必须):独立作用域-绑定的结束时间属性名 | |
| 5234 | + * error(必须):独立作用域-绑定的错误描述属性名 | |
| 5235 | + */ | |
| 5236 | +angular.module('ScheduleApp').directive( | |
| 5237 | + 'saSrule', | |
| 5238 | + [ | |
| 5239 | + 'SchedulePlanManageService_g', | |
| 5240 | + function(service) { | |
| 5241 | + return { | |
| 5242 | + restrict: 'E', | |
| 5243 | + templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html', | |
| 5244 | + scope: { | |
| 5245 | + from: '=', | |
| 5246 | + to: '=', | |
| 5247 | + xlid: '=', | |
| 5248 | + error: '=' | |
| 5249 | + }, | |
| 5250 | + controllerAs: '$saSruleCtrl', | |
| 5251 | + bindToController: true, | |
| 5252 | + controller: function() { | |
| 5253 | + var self = this; | |
| 5254 | + | |
| 5255 | + // 内部ng-model值,用于和required配对 | |
| 5256 | + self.$$internalmodel = undefined; | |
| 5257 | + | |
| 5258 | + // 内部数据源(时刻表的一些信息) | |
| 5259 | + self.$$count = 0; | |
| 5260 | + self.$$qyCount = 0; | |
| 5261 | + self.$$qyErrorCount = 0; | |
| 5262 | + self.$$errorInfos = []; | |
| 5263 | + | |
| 5264 | + }, | |
| 5265 | + compile: function(tElem, tAttrs) { | |
| 5266 | + // 获取所有属性,并验证 | |
| 5267 | + var $name_attr = tAttrs['name']; // 控件的名字 | |
| 5268 | + if (!$name_attr) { | |
| 5269 | + throw "必须有名称属性"; | |
| 5270 | + } | |
| 5271 | + | |
| 5272 | + // controlAs名字 | |
| 5273 | + var ctrlAs = '$saSruleCtrl'; | |
| 5274 | + | |
| 5275 | + // 线路id | |
| 5276 | + var xl_id = undefined; | |
| 5277 | + // 开始时间 | |
| 5278 | + var from_date = undefined; | |
| 5279 | + // 结束时间 | |
| 5280 | + var to_date = undefined; | |
| 5281 | + | |
| 5282 | + // 内部添加required验证,将所有的错误应用到required验证上去 | |
| 5283 | + tElem.find("div").attr("required", ""); | |
| 5284 | + | |
| 5285 | + return { | |
| 5286 | + pre: function(scope, element, attr) { | |
| 5287 | + | |
| 5288 | + }, | |
| 5289 | + | |
| 5290 | + post: function(scope, element, attr) { | |
| 5291 | + // 属性值 | |
| 5292 | + if ($name_attr) { | |
| 5293 | + scope[ctrlAs]["$name_attr"] = $name_attr; | |
| 5294 | + } | |
| 5295 | + | |
| 5296 | + // 开始日期open属性,及方法 | |
| 5297 | + scope[ctrlAs].$$fromDateOpen = false; | |
| 5298 | + scope[ctrlAs].$$fromDate_open = function() { | |
| 5299 | + scope[ctrlAs].$$fromDateOpen = true; | |
| 5300 | + }; | |
| 5301 | + | |
| 5302 | + // 结束日期open属性,及方法 | |
| 5303 | + scope[ctrlAs].$$toDateOpen = false; | |
| 5304 | + scope[ctrlAs].$$toDate_open = function() { | |
| 5305 | + scope[ctrlAs].$$toDateOpen = true; | |
| 5306 | + }; | |
| 5307 | + | |
| 5308 | + // 内部模型刷新 | |
| 5309 | + scope[ctrlAs].$$internal_model_refresh = function() { | |
| 5310 | + if (!xl_id) { | |
| 5311 | + scope[ctrlAs].$$internalmodel = undefined; | |
| 5312 | + scope[ctrlAs].error = "线路必须选择"; | |
| 5313 | + return; | |
| 5314 | + } | |
| 5315 | + if (!from_date) { | |
| 5316 | + scope[ctrlAs].$$internalmodel = undefined; | |
| 5317 | + scope[ctrlAs].error = "开始日期必须选择"; | |
| 5318 | + return; | |
| 5319 | + } | |
| 5320 | + if (!to_date) { | |
| 5321 | + scope[ctrlAs].$$internalmodel = undefined; | |
| 5322 | + scope[ctrlAs].error = "结束日期必须选择"; | |
| 5323 | + return; | |
| 5324 | + } | |
| 5325 | + if (from_date > to_date) { | |
| 5326 | + scope[ctrlAs].$$internalmodel = undefined; | |
| 5327 | + scope[ctrlAs].error = "开始日期必须在结束日期之前"; | |
| 5328 | + return; | |
| 5329 | + } | |
| 5330 | + | |
| 5331 | + scope[ctrlAs].$$count = 0; | |
| 5332 | + scope[ctrlAs].$$qyCount = 0; | |
| 5333 | + scope[ctrlAs].$$qyErrorCount = 0; | |
| 5334 | + scope[ctrlAs].$$errorInfos = []; | |
| 5335 | + | |
| 5336 | + if (scope[ctrlAs].$$qyCount == 0) { | |
| 5337 | + scope[ctrlAs].$$internalmodel = undefined; | |
| 5338 | + scope[ctrlAs].error = "无可启用的规则数"; | |
| 5339 | + } | |
| 5340 | + | |
| 5341 | + var QClass = service.v_rules; | |
| 5342 | + QClass.val({xlid: xl_id, from: from_date, to: to_date}, | |
| 5343 | + function(result) { | |
| 5344 | + scope[ctrlAs].$$count = result.data.count; | |
| 5345 | + scope[ctrlAs].$$qyCount = result.data.qyCount; | |
| 5346 | + scope[ctrlAs].$$qyErrorCount = result.data.qyErrorCount; | |
| 5347 | + | |
| 5348 | + angular.forEach(result.data.errorInfos, function(obj) { | |
| 5349 | + scope[ctrlAs].$$errorInfos.push({ | |
| 5350 | + ruleId: obj.ruleId, | |
| 5351 | + clZbh: obj.clZbh, | |
| 5352 | + qyrq: moment(obj.qyrq).format("YYYY年MM月DD日"), | |
| 5353 | + infos: obj.errorDescList.join("") | |
| 5354 | + }); | |
| 5355 | + }); | |
| 5356 | + | |
| 5357 | + if (scope[ctrlAs].$$qyErrorCount > 0) { | |
| 5358 | + scope[ctrlAs].$$internalmodel = undefined; | |
| 5359 | + scope[ctrlAs].error = "有错误的规则"; | |
| 5360 | + } else { | |
| 5361 | + scope[ctrlAs].$$internalmodel = "ok"; | |
| 5362 | + scope[ctrlAs].$$errorInfos = []; | |
| 5363 | + } | |
| 5364 | + }, | |
| 5365 | + function() { | |
| 5366 | + scope[ctrlAs].$$internalmodel = undefined; | |
| 5367 | + scope[ctrlAs].error = "获取规则数据失败!"; | |
| 5368 | + } | |
| 5369 | + ); | |
| 5370 | + | |
| 5371 | + scope[ctrlAs].$$internalmodel = "ok"; | |
| 5372 | + }; | |
| 5373 | + | |
| 5374 | + scope[ctrlAs].$$internal_model_refresh(); // 初始执行 | |
| 5375 | + | |
| 5376 | + //--------------------- 监控属性方法 -------------------// | |
| 5377 | + // 监控线路id模型值变化 | |
| 5378 | + scope.$watch( | |
| 5379 | + function() { | |
| 5380 | + return scope[ctrlAs].xlid; | |
| 5381 | + }, | |
| 5382 | + function(newValue, oldValue) { | |
| 5383 | + xl_id = newValue; | |
| 5384 | + scope[ctrlAs].$$internal_model_refresh(); | |
| 5385 | + } | |
| 5386 | + ); | |
| 5387 | + | |
| 5388 | + // 监控开始时间模型值变化 | |
| 5389 | + scope.$watch( | |
| 5390 | + function() { | |
| 5391 | + return scope[ctrlAs].from; | |
| 5392 | + }, | |
| 5393 | + function(newValue, oldValue) { | |
| 5394 | + from_date = newValue; | |
| 5395 | + scope[ctrlAs].$$internal_model_refresh(); | |
| 5396 | + } | |
| 5397 | + ); | |
| 5398 | + // 监控结束时间模型值变化 | |
| 5399 | + scope.$watch( | |
| 5400 | + function() { | |
| 5401 | + return scope[ctrlAs].to; | |
| 5402 | + }, | |
| 5403 | + function(newValue, oldValue) { | |
| 5404 | + to_date = newValue; | |
| 5405 | + scope[ctrlAs].$$internal_model_refresh(); | |
| 5406 | + } | |
| 5407 | + ); | |
| 5408 | + } | |
| 5409 | + }; | |
| 5410 | + } | |
| 5411 | + }; | |
| 5412 | + } | |
| 5413 | + ] | |
| 5044 | 5414 | ); |
| 5045 | 5415 | /** |
| 5046 | 5416 | * saPlaninfoedit指令,排班明细编辑控件,用在调度执勤日报的修改功能 | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| ... | ... | @@ -344,7 +344,7 @@ angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', |
| 344 | 344 | return { |
| 345 | 345 | rest: $resource( |
| 346 | 346 | '/gic/:id', |
| 347 | - {order: 'xl,isCancel,lpNo', direction: 'DESC,ASC,ASC', id: '@id'}, | |
| 347 | + {order: 'xl.name,isCancel,lpNo', direction: 'DESC,ASC,ASC', id: '@id'}, | |
| 348 | 348 | { |
| 349 | 349 | list: { |
| 350 | 350 | method: 'GET', |
| ... | ... | @@ -417,7 +417,7 @@ angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', func |
| 417 | 417 | return { |
| 418 | 418 | rest: $resource( |
| 419 | 419 | '/rms/:id', |
| 420 | - {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id'}, | |
| 420 | + {order: 'rerunXl.name,isCancel', direction: 'ASC', id: '@id'}, | |
| 421 | 421 | { |
| 422 | 422 | list: { |
| 423 | 423 | method: 'GET', |
| ... | ... | @@ -791,6 +791,20 @@ angular.module('ScheduleApp').factory( |
| 791 | 791 | '/tidc/:id', |
| 792 | 792 | {order: 'createDate', direction: 'DESC', id: '@id'}, |
| 793 | 793 | { |
| 794 | + list: { | |
| 795 | + method: 'GET', | |
| 796 | + params: { | |
| 797 | + page: 0 | |
| 798 | + }, | |
| 799 | + transformResponse: function(rs) { | |
| 800 | + var dst = angular.fromJson(rs); | |
| 801 | + if (dst.status == 'SUCCESS') { | |
| 802 | + return dst.data; | |
| 803 | + } else { | |
| 804 | + return dst; // 业务错误留给控制器处理 | |
| 805 | + } | |
| 806 | + } | |
| 807 | + }, | |
| 794 | 808 | get: { |
| 795 | 809 | method: 'GET', |
| 796 | 810 | transformResponse: function(rs) { | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit3.html
| ... | ... | @@ -37,10 +37,13 @@ |
| 37 | 37 | <!--<i class="fa fa-arrow-down" aria-hidden="true"></i>--> |
| 38 | 38 | <!--<span style="padding-right: 10px;">下行班次</span>--> |
| 39 | 39 | <!--<i class="fa fa-circle-o-notch" aria-hidden="true"></i>--> |
| 40 | - <span style="padding-right: 10px;background: #105383;color: white;text-align: center;">停驶班次</span> | |
| 41 | - <span style="padding-right: 10px;background: #686d7b;color: white;text-align: center;">区间班次</span> | |
| 42 | - <!--<i class="fa fa-adjust" aria-hidden="true"></i>--> | |
| 43 | - <span style="padding-right: 10px;background: #adff00;color: #501a1a;text-align: center;">分班班次</span> | |
| 40 | + | |
| 41 | + <a href="javascript:" class="btn blue" style="padding-right: 5px;" ng-click="ctrl.switchView()"> | |
| 42 | + <i class="fa fa-exchange"></i> | |
| 43 | + {{ctrl.currentView.switchBtnMsg}} | |
| 44 | + </a> | |
| 45 | + | |
| 46 | + | |
| 44 | 47 | |
| 45 | 48 | <!--<div class="btn-group">--> |
| 46 | 49 | <!--<a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">--> |
| ... | ... | @@ -87,40 +90,67 @@ |
| 87 | 90 | </div> |
| 88 | 91 | |
| 89 | 92 | <div class="portlet-body"> |
| 90 | - <div style="padding-bottom: 5px;"> | |
| 91 | - <a href="javascript:" style="padding-right: 5px;" ng-click="ctrl.multiselect()"> | |
| 92 | - <i class="fa fa-file-excel-o"></i> | |
| 93 | - 批量选择 | |
| 94 | - </a> | |
| 95 | - <a href="javascript:" style="padding-right: 5px;" ng-click="ctrl.editInfos()"> | |
| 96 | - <i class="fa fa-pencil-square-o"></i> | |
| 97 | - 批量修改 | |
| 98 | - </a> | |
| 93 | + <div style="padding-bottom: 10px; height: 20px;"> | |
| 94 | + <div style="float: left"> | |
| 95 | + <a href="javascript:" style="padding-right: 5px;" | |
| 96 | + ng-click="ctrl.multiselect()" | |
| 97 | + ng-show="ctrl.currentView.btn1"> | |
| 98 | + <i class="fa fa-file-excel-o"></i> | |
| 99 | + 批量选择 | |
| 100 | + </a> | |
| 101 | + <a href="javascript:" style="padding-right: 5px;" | |
| 102 | + ng-click="ctrl.editInfos()" | |
| 103 | + ng-show="ctrl.currentView.btn2"> | |
| 104 | + <i class="fa fa-pencil-square-o"></i> | |
| 105 | + 批量修改 | |
| 106 | + </a> | |
| 107 | + | |
| 108 | + <a sweetalert | |
| 109 | + sweet-options="{title: '是否删除选定的班次?',text: '线路:' + ctrl.xlname + '</br>时刻表:' + ctrl.ttname + '</br>谨慎删除!', html: true,type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: '是',cancelButtonText: '取消'}" | |
| 110 | + sweet-on-confirm="ctrl.deleteInfos()" | |
| 111 | + style="padding-right: 5px;" | |
| 112 | + ng-show="ctrl.currentView.btn3"> | |
| 113 | + <i class="fa fa-trash"></i> | |
| 114 | + 批量删除 | |
| 115 | + </a> | |
| 116 | + <a href="javascript:" style="padding-right: 5px;" | |
| 117 | + ng-click="ctrl.clearsel()" | |
| 118 | + ng-show="ctrl.currentView.btn4"> | |
| 119 | + <i class="fa fa-eraser"></i> | |
| 120 | + 取消选择 | |
| 121 | + </a> | |
| 122 | + <a href="javascript:" style="padding-right: 5px;" | |
| 123 | + ng-click="ctrl.refresh()" | |
| 124 | + ng-show="ctrl.currentView.btn5"> | |
| 125 | + <i class="fa fa-refresh"></i> | |
| 126 | + 刷新数据 | |
| 127 | + </a> | |
| 128 | + </div> | |
| 129 | + | |
| 130 | + | |
| 131 | + <div style="float: right;"> | |
| 132 | + <span style="padding-right: 10px;background: #105383;color: white;text-align: center;">停驶班次</span> | |
| 133 | + <span style="padding-right: 10px;background: #686d7b;color: white;text-align: center;">区间班次</span> | |
| 134 | + <!--<i class="fa fa-adjust" aria-hidden="true"></i>--> | |
| 135 | + <span style="padding-right: 10px;background: #adff00;color: #501a1a;text-align: center;">分班班次</span> | |
| 136 | + </div> | |
| 99 | 137 | |
| 100 | - <a sweetalert | |
| 101 | - sweet-options="{title: '是否删除选定的班次?',text: '线路:' + ctrl.xlname + '</br>时刻表:' + ctrl.ttname + '</br>谨慎删除!', html: true,type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: '是',cancelButtonText: '取消'}" | |
| 102 | - sweet-on-confirm="ctrl.deleteInfos()" | |
| 103 | - style="padding-right: 5px;" > | |
| 104 | - <i class="fa fa-trash"></i> | |
| 105 | - 批量删除 | |
| 106 | - </a> | |
| 107 | - <a href="javascript:" style="padding-right: 5px;" ng-click="ctrl.clearsel()"> | |
| 108 | - <i class="fa fa-eraser"></i> | |
| 109 | - 取消选择 | |
| 110 | - </a> | |
| 111 | - <a href="javascript:" style="padding-right: 5px;" ng-click="ctrl.refresh()"> | |
| 112 | - <i class="fa fa-refresh"></i> | |
| 113 | - 刷行数据 | |
| 114 | - </a> | |
| 115 | 138 | </div> |
| 116 | 139 | |
| 117 | 140 | <!--<div ng-view></div>--> |
| 118 | - <div style="height: {{ctrl.ttHeight}}px;"> | |
| 141 | + <div style="height: {{ctrl.ttHeight}}px;" | |
| 142 | + ng-show="ctrl.currentView.viewId == 1"> | |
| 119 | 143 | <sa-Timetable name="tt" ng-model="ctrl.editInfo" ng-model-options="{ getterSetter: true }" celldbclick="ctrl.singleEditBcDetail"> |
| 120 | 144 | |
| 121 | 145 | </sa-Timetable> |
| 122 | 146 | </div> |
| 123 | 147 | |
| 148 | + <div style="height: {{ctrl.ttHeight}}px;" | |
| 149 | + ng-show="ctrl.currentView.viewId == 2"> | |
| 150 | + <sa-Timetable2 name="tt2" ng-model="ctrl.pvInfo" ng-model-options="{ getterSetter: true }" > | |
| 151 | + | |
| 152 | + </sa-Timetable2> | |
| 153 | + </div> | |
| 124 | 154 | |
| 125 | 155 | </div> |
| 126 | 156 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js
| ... | ... | @@ -12,7 +12,7 @@ angular.module('ScheduleApp').factory( |
| 12 | 12 | // 查询对象类 |
| 13 | 13 | var queryClass = service.rest; |
| 14 | 14 | |
| 15 | - // 时刻表信息 | |
| 15 | + // 时刻表信息(编辑视图使用) | |
| 16 | 16 | var editInfo = { |
| 17 | 17 | detailHeads: [], // 时刻表头信息 |
| 18 | 18 | detailInfos: [], // 时刻表明细信息 |
| ... | ... | @@ -20,6 +20,12 @@ angular.module('ScheduleApp').factory( |
| 20 | 20 | yydesc: "" // 营运汇总描述 |
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | + // 时刻表信息(预览视图使用) | |
| 24 | + var pvInfo = { | |
| 25 | + bcList : [], // 班次列表 | |
| 26 | + refreshInfos : undefined // 刷新信息 | |
| 27 | + }; | |
| 28 | + | |
| 23 | 29 | return { |
| 24 | 30 | getQueryClass: function() { |
| 25 | 31 | return queryClass; |
| ... | ... | @@ -27,6 +33,31 @@ angular.module('ScheduleApp').factory( |
| 27 | 33 | getEditInfo: function() { |
| 28 | 34 | return editInfo; |
| 29 | 35 | }, |
| 36 | + getPvInfo : function() { | |
| 37 | + return pvInfo; | |
| 38 | + }, | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 获取预览用的时刻表明细数据。 | |
| 42 | + * @param ttid 时刻表id | |
| 43 | + */ | |
| 44 | + refreshPvInfo : function(ttid) { | |
| 45 | + service.rest.list( | |
| 46 | + {page : 0, size : 1000, "ttinfo.id_eq" : ttid}, | |
| 47 | + function(result) { | |
| 48 | + if (result.content.length > 0) { | |
| 49 | + pvInfo.bcList = result.content; | |
| 50 | + if (pvInfo.refreshInfos == undefined) { | |
| 51 | + pvInfo.refreshInfos = { | |
| 52 | + count : 1 // 刷新次数 | |
| 53 | + }; | |
| 54 | + } else { | |
| 55 | + pvInfo.refreshInfos.count ++; | |
| 56 | + } | |
| 57 | + } | |
| 58 | + } | |
| 59 | + ); | |
| 60 | + }, | |
| 30 | 61 | |
| 31 | 62 | /** |
| 32 | 63 | * 获取编辑用的时刻表明细数据。 |
| ... | ... | @@ -269,6 +300,7 @@ angular.module('ScheduleApp').controller( |
| 269 | 300 | }; |
| 270 | 301 | |
| 271 | 302 | self.editInfo = undefined; |
| 303 | + self.pvInfo = undefined; | |
| 272 | 304 | |
| 273 | 305 | $scope.$watch( |
| 274 | 306 | function() { |
| ... | ... | @@ -280,6 +312,17 @@ angular.module('ScheduleApp').controller( |
| 280 | 312 | true |
| 281 | 313 | ); |
| 282 | 314 | |
| 315 | + $scope.$watch( | |
| 316 | + function() { | |
| 317 | + return service.getPvInfo(); | |
| 318 | + }, | |
| 319 | + function(n, o) { | |
| 320 | + self.pvInfo = n; | |
| 321 | + }, | |
| 322 | + true | |
| 323 | + ); | |
| 324 | + | |
| 325 | + | |
| 283 | 326 | // 清除选择 |
| 284 | 327 | self.clearsel = function() { |
| 285 | 328 | var ds = service.getEditInfo().detailInfos; |
| ... | ... | @@ -291,7 +334,39 @@ angular.module('ScheduleApp').controller( |
| 291 | 334 | }; |
| 292 | 335 | // 刷新时刻表数据 |
| 293 | 336 | self.refresh = function() { |
| 294 | - service.refreshEditInfo(self.xlid, self.ttid); | |
| 337 | + // TODO:目前只有2个视图,内部toggle,以后多个视图需传入viewId | |
| 338 | + if (self.currentView.viewId == 1) { | |
| 339 | + service.refreshEditInfo(self.xlid, self.ttid); | |
| 340 | + } else { | |
| 341 | + service.refreshPvInfo(self.ttid); | |
| 342 | + } | |
| 343 | + }; | |
| 344 | + | |
| 345 | + // 切换视图(编辑视图/预览视图) | |
| 346 | + self.viewInfos = { | |
| 347 | + "editView" : { | |
| 348 | + viewId : 1, | |
| 349 | + switchBtnMsg : "切换预览视图", | |
| 350 | + btn1 : true, | |
| 351 | + btn2 : true, | |
| 352 | + btn3 : true, | |
| 353 | + btn4 : true, | |
| 354 | + btn5 : true | |
| 355 | + }, | |
| 356 | + "preView" : { | |
| 357 | + viewId : 2, | |
| 358 | + switchBtnMsg : "切换编辑视图", | |
| 359 | + btn5 : true | |
| 360 | + } | |
| 361 | + }; | |
| 362 | + self.currentView = self.viewInfos["editView"]; // 默认编辑视图 | |
| 363 | + self.switchView = function() { | |
| 364 | + // TODO:目前只有2个视图,内部toggle,以后多个视图需传入viewId | |
| 365 | + if (self.currentView.viewId == 1) { | |
| 366 | + self.currentView = self.viewInfos["preView"]; | |
| 367 | + } else { | |
| 368 | + self.currentView = self.viewInfos["editView"]; | |
| 369 | + } | |
| 295 | 370 | }; |
| 296 | 371 | |
| 297 | 372 | self.ttHeight = 500; // 时刻表的高度 |
| ... | ... | @@ -431,8 +506,9 @@ angular.module('ScheduleApp').controller( |
| 431 | 506 | |
| 432 | 507 | }; |
| 433 | 508 | |
| 434 | - if (self.rflag) { // 是否刷新 | |
| 435 | - self.refresh(); // 刷新数据 | |
| 509 | + if (self.rflag) { // 是否初始刷新数据 | |
| 510 | + service.refreshEditInfo(self.xlid, self.ttid); | |
| 511 | + service.refreshPvInfo(self.ttid); | |
| 436 | 512 | } |
| 437 | 513 | |
| 438 | 514 | // TODO: | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/service.js
| ... | ... | @@ -108,6 +108,20 @@ angular.module('ScheduleApp').factory( |
| 108 | 108 | '/tidc/:id', |
| 109 | 109 | {order: 'createDate', direction: 'DESC', id: '@id'}, |
| 110 | 110 | { |
| 111 | + list: { | |
| 112 | + method: 'GET', | |
| 113 | + params: { | |
| 114 | + page: 0 | |
| 115 | + }, | |
| 116 | + transformResponse: function(rs) { | |
| 117 | + var dst = angular.fromJson(rs); | |
| 118 | + if (dst.status == 'SUCCESS') { | |
| 119 | + return dst.data; | |
| 120 | + } else { | |
| 121 | + return dst; // 业务错误留给控制器处理 | |
| 122 | + } | |
| 123 | + } | |
| 124 | + }, | |
| 111 | 125 | get: { |
| 112 | 126 | method: 'GET', |
| 113 | 127 | transformResponse: function(rs) { | ... | ... |
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/layout.html
| ... | ... | @@ -96,13 +96,21 @@ |
| 96 | 96 | <dl> |
| 97 | 97 | <dd> |
| 98 | 98 | {{if item.abnormalType == 'speed'}} |
| 99 | - {{if item.speed>=100}} | |
| 100 | - 速度异常 | |
| 101 | - {{else}} | |
| 102 | - 超速({{item.speed}}) | |
| 103 | - {{/if}} | |
| 99 | + {{if item.speed>=100}} | |
| 100 | + 速度异常 | |
| 101 | + {{else}} | |
| 102 | + 超速({{item.speed}}) | |
| 103 | + {{/if}} | |
| 104 | 104 | {{else if item.abnormalType == 'outbound'}} |
| 105 | 105 | 越界 |
| 106 | + {{else if item.abnormalType == 'gpsNotValid'}} | |
| 107 | + gps无效 | |
| 108 | + {{else if item.abnormalType == 'linesSwitch'}} | |
| 109 | + <span style="font-size:12px;-webkit-transform:scale(0.9);display:block;text-indent: 5px;">{{item.line_line}}</span> | |
| 110 | + {{else if item.abnormalType == 'versionSwitch'}} | |
| 111 | + 线路版本切换 | |
| 112 | + {{else if item.abnormalType == 'gpsZero'}} | |
| 113 | + 经纬度为0 | |
| 106 | 114 | {{/if}} |
| 107 | 115 | </dd> |
| 108 | 116 | <dd>{{item.st_str}}</dd> | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/left.html
| ... | ... | @@ -218,7 +218,7 @@ |
| 218 | 218 | fillTrailTable(rs.list);//填充行车轨迹表格 |
| 219 | 219 | fillArivalStationTable(rs.list);//填充到离站表格 |
| 220 | 220 | $('.sum_mileage_span', leftWrap).text('共约 ' + rs.sumMileage + ' 公里'); |
| 221 | - fillAbnormalTable(rs['outboundList'], rs['speedList']);//填充异常信息表格 | |
| 221 | + fillAbnormalTable(rs['outboundList'], rs['speedList'],rs['gpsInvalid'],rs['gpslineSwitch'],rs['lineVerson'],rs['gpslonlatex']);//填充异常信息表格 | |
| 222 | 222 | //准备播放 |
| 223 | 223 | rs.arrivalData = arrivalData; |
| 224 | 224 | $('.gps-play-back-panel-v3>div.right-panel .play-back-tools-wrap').trigger('ready-to-play', rs); |
| ... | ... | @@ -461,14 +461,21 @@ |
| 461 | 461 | for(var i = 0; i < arguments.length; i ++){ |
| 462 | 462 | array = array.concat(arguments[i]); |
| 463 | 463 | } |
| 464 | + var i=null; | |
| 464 | 465 | //格式化时间 |
| 465 | 466 | $.each(array, function () { |
| 467 | + if(!this.abnormalType&&this.version){ | |
| 468 | + i=array.indexOf(this); | |
| 469 | + } | |
| 466 | 470 | if(this.st) |
| 467 | 471 | this.st_str = moment(this.st).format('HH:mm.ss'); |
| 468 | 472 | if(this.et) |
| 469 | 473 | this.et_str = moment(this.et).format('HH:mm.ss'); |
| 470 | 474 | }); |
| 471 | 475 | |
| 476 | + if(i){ | |
| 477 | + array.splice(i,1); | |
| 478 | + } | |
| 472 | 479 | //排序 |
| 473 | 480 | array.sort(function (a, b) { |
| 474 | 481 | return a.st - b.st; | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/right.html
| ... | ... | @@ -84,7 +84,6 @@ |
| 84 | 84 | var currentVersion; |
| 85 | 85 | |
| 86 | 86 | $('.play-back-tools-wrap', rightWrap).on('ready-to-play', function (e, data) { |
| 87 | - debugger | |
| 88 | 87 | e.stopPropagation(); |
| 89 | 88 | //reset |
| 90 | 89 | reset(); |
| ... | ... | @@ -191,7 +190,6 @@ |
| 191 | 190 | $('.top-btn-list .play', rightWrap).on('click', function () { |
| 192 | 191 | if(toolsDisabled()) |
| 193 | 192 | return; |
| 194 | -debugger | |
| 195 | 193 | if(!$(this).hasClass('pause')){ |
| 196 | 194 | //第一次点击播放,清除一下 |
| 197 | 195 | if(play_before_flag){ |
| ... | ... | @@ -344,7 +342,6 @@ debugger |
| 344 | 342 | //从localStorage获取路段 |
| 345 | 343 | routes = JSON.parse(storage.getItem(lineCode+"_"+lineVersion + '_route')); |
| 346 | 344 | if(!routes){ |
| 347 | - debugger | |
| 348 | 345 | var name = gb_data_basic.lineCode2NameAll()[lineCode]; |
| 349 | 346 | notify_err("缺少" + name + "的路段信息,请选择" + name + "进入线调"); |
| 350 | 347 | return; | ... | ... |