Commit 8e0251f97b5ea4e6f573dfc58cd7eb3ca96cdd0f
Merge branch 'pudong' of http://222.66.0.204:8090//panzhaov5/bsth_control into pudong
Showing
23 changed files
with
2773 additions
and
1427 deletions
Too many changes to show.
To preserve performance only 23 of 26 files are displayed.
src/main/java/com/bsth/controller/calc/CalcExportController.java
| @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController; | @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 16 | import com.bsth.common.ResponseCode; | 16 | import com.bsth.common.ResponseCode; |
| 17 | import com.bsth.entity.calc.CalcWaybill; | 17 | import com.bsth.entity.calc.CalcWaybill; |
| 18 | import com.bsth.entity.mcy_forms.Waybillday; | 18 | import com.bsth.entity.mcy_forms.Waybillday; |
| 19 | +import com.bsth.service.calc.CalcLbStatuAnalyService; | ||
| 19 | import com.bsth.service.calc.CalcMixService; | 20 | import com.bsth.service.calc.CalcMixService; |
| 20 | import com.bsth.service.calc.CalcWaybillService; | 21 | import com.bsth.service.calc.CalcWaybillService; |
| 21 | import com.bsth.util.ReportUtils; | 22 | import com.bsth.util.ReportUtils; |
| @@ -26,6 +27,9 @@ public class CalcExportController { | @@ -26,6 +27,9 @@ public class CalcExportController { | ||
| 26 | 27 | ||
| 27 | @Autowired | 28 | @Autowired |
| 28 | CalcWaybillService service; | 29 | CalcWaybillService service; |
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + CalcLbStatuAnalyService lbService; | ||
| 29 | 33 | ||
| 30 | @Autowired | 34 | @Autowired |
| 31 | CalcMixService clacMixService; | 35 | CalcMixService clacMixService; |
| @@ -204,5 +208,84 @@ public class CalcExportController { | @@ -204,5 +208,84 @@ public class CalcExportController { | ||
| 204 | } | 208 | } |
| 205 | return resMap; | 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/repository/oil/YlbRepository.java
| @@ -46,7 +46,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -46,7 +46,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 46 | + " and y.xlbm like %?4% and y.nbbm like %?5%",nativeQuery=true) | 46 | + " and y.xlbm like %?4% and y.nbbm like %?5%",nativeQuery=true) |
| 47 | List<Ylb> listMaxRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); | 47 | List<Ylb> listMaxRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); |
| 48 | 48 | ||
| 49 | - @Query(value="select * from bsth_c_ylb where to_days(?1) -to_days(rq) <30 " | 49 | + @Query(value="select * from bsth_c_ylb where " |
| 50 | + + " DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= rq " | ||
| 50 | + " and rq< ?1 and ssgsdm like %?2%" | 51 | + " and rq< ?1 and ssgsdm like %?2%" |
| 51 | + " and fgsdm like %?3% and xlbm like %?4% and nbbm like %?5% " | 52 | + " and fgsdm like %?3% and xlbm like %?4% and nbbm like %?5% " |
| 52 | + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true) | 53 | + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true) |
| @@ -54,7 +55,7 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -54,7 +55,7 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 54 | 55 | ||
| 55 | @Query(value="select * from bsth_c_ylb where rq>=?1 " | 56 | @Query(value="select * from bsth_c_ylb where rq>=?1 " |
| 56 | + " and rq<= ?2 and ssgsdm =?3" | 57 | + " and rq<= ?2 and ssgsdm =?3" |
| 57 | - + " and fgsdm =?4 and xlbm like %?5% " | 58 | + + " and fgsdm like %?4% and xlbm like %?5% " |
| 58 | + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true) | 59 | + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true) |
| 59 | List<Ylb> listByMonthJcsx(String rq,String rq2,String gsbm,String fgsbm,String xlbm); | 60 | List<Ylb> listByMonthJcsx(String rq,String rq2,String gsbm,String fgsbm,String xlbm); |
| 60 | 61 | ||
| @@ -125,6 +126,12 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -125,6 +126,12 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 125 | List<Object[]> checkNbmmYl(String rq, String gsbm,String fgsbm,String xlbm,String nbbm); | 126 | List<Object[]> checkNbmmYl(String rq, String gsbm,String fgsbm,String xlbm,String nbbm); |
| 126 | 127 | ||
| 127 | 128 | ||
| 129 | + @Query(value="select nbbm,cs from (select nbbm,count(nbbm) as cs from (" | ||
| 130 | + + " select nbbm,fgsdm from bsth_c_ylb where rq=?1 " | ||
| 131 | + + " and ssgsdm like %?2% group by nbbm,fgsdm " | ||
| 132 | + + " ) t group by t.nbbm) x where x.cs >1 ",nativeQuery=true) | ||
| 133 | + List<Object[]> checkNbmmFgs(String rq, String gsbm); | ||
| 134 | + | ||
| 128 | @Query(value="select jzl,yh,sh from Ylb s " | 135 | @Query(value="select jzl,yh,sh from Ylb s " |
| 129 | + " where to_days(s.rq)=to_days(?1) " | 136 | + " where to_days(s.rq)=to_days(?1) " |
| 130 | + " and s.ssgsdm like %?2% " | 137 | + " and s.ssgsdm like %?2% " |
| @@ -155,7 +162,7 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -155,7 +162,7 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 155 | @Query(value="select s from Ylb s " | 162 | @Query(value="select s from Ylb s " |
| 156 | + " where to_days(s.rq)=to_days(?1) " | 163 | + " where to_days(s.rq)=to_days(?1) " |
| 157 | + " and s.ssgsdm =?2 " | 164 | + " and s.ssgsdm =?2 " |
| 158 | - + " and s.fgsdm =?3 " | 165 | + + " and s.fgsdm like %?3% " |
| 159 | + " and s.xlbm like %?4% " | 166 | + " and s.xlbm like %?4% " |
| 160 | + " and s.nbbm in ?5 order by nbbm,jcsx") | 167 | + " and s.nbbm in ?5 order by nbbm,jcsx") |
| 161 | List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); | 168 | List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); |
| @@ -163,7 +170,7 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -163,7 +170,7 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 163 | @Query(value="select s from Ylb s " | 170 | @Query(value="select s from Ylb s " |
| 164 | + " where s.rq=?1 " | 171 | + " where s.rq=?1 " |
| 165 | + " and s.ssgsdm =?2 " | 172 | + " and s.ssgsdm =?2 " |
| 166 | - + " and s.fgsdm =?3 " | 173 | + + " and s.fgsdm like %?3% " |
| 167 | + " and s.xlbm like %?4% " | 174 | + " and s.xlbm like %?4% " |
| 168 | + " and s.nbbm in ?5 order by nbbm,jcsx") | 175 | + " and s.nbbm in ?5 order by nbbm,jcsx") |
| 169 | List<Ylb> listYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); | 176 | List<Ylb> listYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); |
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/gps/GpsServiceImpl.java
| @@ -239,7 +239,6 @@ public class GpsServiceImpl implements GpsService { | @@ -239,7 +239,6 @@ public class GpsServiceImpl implements GpsService { | ||
| 239 | long serviceState; | 239 | long serviceState; |
| 240 | ArrivalEntity arrival; | 240 | ArrivalEntity arrival; |
| 241 | Set<String> lineSet=new HashSet(); | 241 | Set<String> lineSet=new HashSet(); |
| 242 | - String firstLineCode=""; | ||
| 243 | List<Map<String,Object>> lineSwitch=new ArrayList<>(); | 242 | List<Map<String,Object>> lineSwitch=new ArrayList<>(); |
| 244 | 243 | ||
| 245 | List<Map> gpsNotValidList=new ArrayList(); | 244 | List<Map> gpsNotValidList=new ArrayList(); |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| @@ -306,10 +306,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -306,10 +306,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 306 | String sql = "select id,cc_id,mileage_type,destroy,destroy_reason," + | 306 | String sql = "select id,cc_id,mileage_type,destroy,destroy_reason," + |
| 307 | " mileage,type1,type2,schedule from bsth_c_s_child_task" + | 307 | " mileage,type1,type2,schedule from bsth_c_s_child_task" + |
| 308 | " where 1=1"; | 308 | " where 1=1"; |
| 309 | - if(schedule1 != null && schedule1 > 0){ | 309 | + if(schedule1 != null && schedule1 >= 0){ |
| 310 | sql += " and schedule >= '"+schedule1+"'"; | 310 | sql += " and schedule >= '"+schedule1+"'"; |
| 311 | } | 311 | } |
| 312 | - if(schedule2 != null && schedule2 > 0){ | 312 | + if(schedule2 != null && schedule2 >= 0){ |
| 313 | sql += " and schedule <= '"+schedule2+"'"; | 313 | sql += " and schedule <= '"+schedule2+"'"; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| @@ -520,9 +520,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -520,9 +520,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 520 | continue; | 520 | continue; |
| 521 | Map<String, List<ScheduleRealInfo>> keyMap2 = new HashMap<String, List<ScheduleRealInfo>>(); | 521 | Map<String, List<ScheduleRealInfo>> keyMap2 = new HashMap<String, List<ScheduleRealInfo>>(); |
| 522 | for(ScheduleRealInfo schedule : keyMap.get(key)){ | 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 | companyName = schedule.getGsName(); | 524 | companyName = schedule.getGsName(); |
| 525 | - if(subCompanyName.length() == 0 && schedule.getFgsName() != null) | 525 | + if(subCompanyName.trim().length() == 0 && schedule.getFgsName() != null) |
| 526 | subCompanyName = schedule.getFgsName(); | 526 | subCompanyName = schedule.getFgsName(); |
| 527 | String date = schedule.getScheduleDateStr(); | 527 | String date = schedule.getScheduleDateStr(); |
| 528 | if(!keyMap2.containsKey(date)) | 528 | if(!keyMap2.containsKey(date)) |
| @@ -1061,7 +1061,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1061,7 +1061,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1061 | continue; | 1061 | continue; |
| 1062 | } | 1062 | } |
| 1063 | String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" | 1063 | String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" |
| 1064 | - + schedule.getLpName() + "/" + schedule.getFgsName(); | 1064 | + + schedule.getLpName() + "/" + schedule.getFgsBm(); |
| 1065 | if(model.length() != 0){ | 1065 | if(model.length() != 0){ |
| 1066 | if(ttSet.contains(schedule.getSpId())){ | 1066 | if(ttSet.contains(schedule.getSpId())){ |
| 1067 | if(!keyMap.containsKey(key)) | 1067 | if(!keyMap.containsKey(key)) |
| @@ -1099,10 +1099,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1099,10 +1099,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1099 | long jhyssj1 = 0, sjyssj1 = 0; | 1099 | long jhyssj1 = 0, sjyssj1 = 0; |
| 1100 | double jhlc = 0, sjlc = 0; | 1100 | double jhlc = 0, sjlc = 0; |
| 1101 | for(ScheduleRealInfo schedule : list2){ | 1101 | for(ScheduleRealInfo schedule : list2){ |
| 1102 | - if(companyName.length() == 0 && schedule.getGsName() != null){ | 1102 | + if(companyName.trim().length() == 0 && schedule.getGsName() != null){ |
| 1103 | companyName = schedule.getGsName(); | 1103 | companyName = schedule.getGsName(); |
| 1104 | } | 1104 | } |
| 1105 | - if(subCompanyName.length() == 0 && schedule.getFgsName() != null){ | 1105 | + if(subCompanyName.trim().length() == 0 && schedule.getFgsName() != null){ |
| 1106 | subCompanyName = schedule.getFgsName(); | 1106 | subCompanyName = schedule.getFgsName(); |
| 1107 | } | 1107 | } |
| 1108 | long fcsj = schedule.getFcsjT(); | 1108 | long fcsj = schedule.getFcsjT(); |
| @@ -1887,7 +1887,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1887,7 +1887,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1887 | continue; | 1887 | continue; |
| 1888 | } | 1888 | } |
| 1889 | 1889 | ||
| 1890 | - String key = schedule.getXlName() + "/" + schedule.getFgsName(); | 1890 | + String key = schedule.getXlName() + "/" + schedule.getFgsBm(); |
| 1891 | if(!keyMap.containsKey(key)) | 1891 | if(!keyMap.containsKey(key)) |
| 1892 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 1892 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 1893 | keyMap.get(key).add(schedule); | 1893 | keyMap.get(key).add(schedule); |
| @@ -1978,9 +1978,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1978,9 +1978,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1978 | qtlc = new BigDecimal("0"); | 1978 | qtlc = new BigDecimal("0"); |
| 1979 | String companyName = "", subCompanyName = ""; | 1979 | String companyName = "", subCompanyName = ""; |
| 1980 | for(ScheduleRealInfo schedule : keyMap.get(key)){ | 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 | companyName = schedule.getGsName(); | 1982 | companyName = schedule.getGsName(); |
| 1983 | - if(schedule.getFgsName() != null && subCompanyName.length() == 0) | 1983 | + if(schedule.getFgsName() != null && subCompanyName.trim().length() == 0) |
| 1984 | subCompanyName = schedule.getFgsName(); | 1984 | subCompanyName = schedule.getFgsName(); |
| 1985 | BigDecimal lc = new BigDecimal("0"); | 1985 | BigDecimal lc = new BigDecimal("0"); |
| 1986 | if(schedule.getJhlcOrig() != null && schedule.getJhlcOrig() > 0.1d){ | 1986 | if(schedule.getJhlcOrig() != null && schedule.getJhlcOrig() > 0.1d){ |
| @@ -2071,7 +2071,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2071,7 +2071,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2071 | String[] keys = key.split("/"); | 2071 | String[] keys = key.split("/"); |
| 2072 | tempMap.put("date", Date); | 2072 | tempMap.put("date", Date); |
| 2073 | tempMap.put("company", companyName); | 2073 | tempMap.put("company", companyName); |
| 2074 | - tempMap.put("subCompany", keys[1]); | 2074 | + tempMap.put("subCompany", subCompanyName); |
| 2075 | +// tempMap.put("subCompany", keys[1]); | ||
| 2075 | tempMap.put("times", sfqr == 1 ? times : "全日"); | 2076 | tempMap.put("times", sfqr == 1 ? times : "全日"); |
| 2076 | tempMap.put("line", keys[0]); | 2077 | tempMap.put("line", keys[0]); |
| 2077 | tempMap.put("jhbc", jhbc); | 2078 | tempMap.put("jhbc", jhbc); |
| @@ -2338,17 +2339,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2338,17 +2339,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2338 | continue; | 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 | if(!keyMap.containsKey(key)) | 2343 | if(!keyMap.containsKey(key)) |
| 2343 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 2344 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 2344 | keyMap.get(key).add(schedule); | 2345 | keyMap.get(key).add(schedule); |
| 2345 | } | 2346 | } |
| 2347 | + | ||
| 2346 | for(String key : keyMap.keySet()){ | 2348 | for(String key : keyMap.keySet()){ |
| 2349 | + String companyName = "", subCompanyName = ""; | ||
| 2347 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 2350 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 2348 | List<ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>(); | 2351 | List<ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>(); |
| 2349 | int sjbc = 0, sddf = 0, zddf = 0, | 2352 | int sjbc = 0, sddf = 0, zddf = 0, |
| 2350 | dxtz = 0, lbtz = 0; | 2353 | dxtz = 0, lbtz = 0; |
| 2351 | for(ScheduleRealInfo schedule : keyMap.get(key)){ | 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 | boolean flag = false; | 2359 | boolean flag = false; |
| 2353 | if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null | 2360 | if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null |
| 2354 | && schedule.getStatus() != -1 && !schedule.isCcService()){ | 2361 | && schedule.getStatus() != -1 && !schedule.isCcService()){ |
| @@ -2373,8 +2380,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2373,8 +2380,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2373 | } | 2380 | } |
| 2374 | tempMap.put("date", date); | 2381 | tempMap.put("date", date); |
| 2375 | String[] keys = key.split("/"); | 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 | tempMap.put("line", keys[2]); | 2387 | tempMap.put("line", keys[2]); |
| 2379 | tempMap.put("sjbc", sjbc); | 2388 | tempMap.put("sjbc", sjbc); |
| 2380 | tempMap.put("sddf", sddf); | 2389 | tempMap.put("sddf", sddf); |
| @@ -3108,7 +3117,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -3108,7 +3117,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 3108 | continue; | 3117 | continue; |
| 3109 | } | 3118 | } |
| 3110 | 3119 | ||
| 3111 | - String xl = s.getXlName() + "/" + s.getFgsName(); | 3120 | + String xl = s.getXlName() + "/" + s.getFgsBm(); |
| 3112 | String dateStr = s.getScheduleDateStr(); | 3121 | String dateStr = s.getScheduleDateStr(); |
| 3113 | if(!sches.containsKey(xl)){ | 3122 | if(!sches.containsKey(xl)){ |
| 3114 | sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>()); | 3123 | sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>()); |
| @@ -3138,12 +3147,19 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -3138,12 +3147,19 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 3138 | List<List<Map<String, Object>>> lists = new ArrayList<List<Map<String, Object>>>(); | 3147 | List<List<Map<String, Object>>> lists = new ArrayList<List<Map<String, Object>>>(); |
| 3139 | Map<Long, ScheduleRealInfo> keyTemp = new HashMap<Long, ScheduleRealInfo>(); | 3148 | Map<Long, ScheduleRealInfo> keyTemp = new HashMap<Long, ScheduleRealInfo>(); |
| 3140 | for(Long time : timeList){ | 3149 | for(Long time : timeList){ |
| 3150 | + String companyName = "", subCompanyName = ""; | ||
| 3141 | List<Long> keyList = new ArrayList<Long>(); | 3151 | List<Long> keyList = new ArrayList<Long>(); |
| 3142 | String date = timeTemp.get(time); | 3152 | String date = timeTemp.get(time); |
| 3143 | List<ScheduleRealInfo> sche2 = sche1.get(date); | 3153 | List<ScheduleRealInfo> sche2 = sche1.get(date); |
| 3144 | for(ScheduleRealInfo s : sche2){ | 3154 | for(ScheduleRealInfo s : sche2){ |
| 3145 | if(s.getFcsj()!=null && s.getFcsj().trim().length() > 0 | 3155 | if(s.getFcsj()!=null && s.getFcsj().trim().length() > 0 |
| 3146 | && s.getFcsj().contains(":")){ | 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 | String[] split = s.getFcsj().split(":"); | 3163 | String[] split = s.getFcsj().split(":"); |
| 3148 | Long key = Long.valueOf(s.getXlDir())*1500 + Long.valueOf(split[0])*60 + Long.valueOf(split[1]); | 3164 | Long key = Long.valueOf(s.getXlDir())*1500 + Long.valueOf(split[0])*60 + Long.valueOf(split[1]); |
| 3149 | while(keyTemp.containsKey(key)){ | 3165 | while(keyTemp.containsKey(key)){ |
| @@ -3158,8 +3174,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -3158,8 +3174,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 3158 | for(Long l : keyList){ | 3174 | for(Long l : keyList){ |
| 3159 | ScheduleRealInfo s = keyTemp.get(l); | 3175 | ScheduleRealInfo s = keyTemp.get(l); |
| 3160 | Map<String, Object> temp = new HashMap<String, Object>(); | 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 | temp.put("fgsBm", s.getFgsBm()); | 3181 | temp.put("fgsBm", s.getFgsBm()); |
| 3164 | temp.put("date", date); | 3182 | temp.put("date", date); |
| 3165 | temp.put("xlbm", s.getXlBm()); | 3183 | temp.put("xlbm", s.getXlBm()); |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| @@ -291,6 +291,26 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -291,6 +291,26 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 291 | String sxtj=map2.get("sxtj").toString(); | 291 | String sxtj=map2.get("sxtj").toString(); |
| 292 | if(sxtj.equals("0")){ | 292 | if(sxtj.equals("0")){ |
| 293 | listpb=listpbs; | 293 | listpb=listpbs; |
| 294 | + }else if (sxtj.equals("5")){ | ||
| 295 | + List<String> stringList=new ArrayList<String>(); | ||
| 296 | + | ||
| 297 | + List<Object[]> objectLists = repository.checkNbmmFgs(rq, gsbm); | ||
| 298 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 299 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 300 | + stringList.add(clbm); | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + for (int i = 0; i < stringList.size(); i++) { | ||
| 304 | + String strNbbm=stringList.get(i); | ||
| 305 | + for (int j = 0; j < listpbs.size(); j++) { | ||
| 306 | + Map<String, Object> map = listpbs.get(j); | ||
| 307 | + String mapNbbm=map.get("clZbh").toString(); | ||
| 308 | + if(strNbbm.equals(mapNbbm)){ | ||
| 309 | + listpb.add(map); | ||
| 310 | + } | ||
| 311 | + } | ||
| 312 | + } | ||
| 313 | + | ||
| 294 | }else{ | 314 | }else{ |
| 295 | List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); | 315 | List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); |
| 296 | List<String> stringList=new ArrayList<String>(); | 316 | List<String> stringList=new ArrayList<String>(); |
| @@ -1269,6 +1289,19 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1269,6 +1289,19 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1269 | else | 1289 | else |
| 1270 | listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | 1290 | listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); |
| 1271 | } | 1291 | } |
| 1292 | + }else if(sxtj.equals("5")){ | ||
| 1293 | + List<Object[]> objectLists = repository.checkNbmmFgs(rq, gsbm); | ||
| 1294 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1295 | + String clbm =objectLists.get(i)[0].toString(); | ||
| 1296 | + stringList.add(clbm); | ||
| 1297 | + } | ||
| 1298 | + | ||
| 1299 | + if (stringList.size() > 0) { | ||
| 1300 | + if (type.equals("1")) | ||
| 1301 | + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1302 | + else | ||
| 1303 | + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1304 | + } | ||
| 1272 | } else { | 1305 | } else { |
| 1273 | List<Object[]> objectLists; | 1306 | List<Object[]> objectLists; |
| 1274 | if (sxtj.equals("3")) { | 1307 | if (sxtj.equals("3")) { |
| @@ -1395,6 +1428,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1395,6 +1428,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1395 | try { | 1428 | try { |
| 1396 | List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | 1429 | List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); |
| 1397 | String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString()); | 1430 | String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString()); |
| 1431 | + String fgsbm="999"; | ||
| 1432 | + if(map.get("fgsbm")!=null){ | ||
| 1433 | + fgsbm=map.get("fgsbm").toString(); | ||
| 1434 | + } | ||
| 1398 | JSONArray jsonArray=JSONArray.parseArray(json); | 1435 | JSONArray jsonArray=JSONArray.parseArray(json); |
| 1399 | JSONObject jsonObject; | 1436 | JSONObject jsonObject; |
| 1400 | for (int x = 0; x < jsonArray.size(); x++) { | 1437 | for (int x = 0; x < jsonArray.size(); x++) { |
| @@ -1409,7 +1446,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1409,7 +1446,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1409 | String nbbm_eq = ylb.getNbbm(); | 1446 | String nbbm_eq = ylb.getNbbm(); |
| 1410 | Date rq_eq = ylb.getRq(); | 1447 | Date rq_eq = ylb.getRq(); |
| 1411 | // 得到一天总的加油和里程(根据车,时间) | 1448 | // 得到一天总的加油和里程(根据车,时间) |
| 1412 | - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),ylb.getFgsdm()); | 1449 | + List<Object[]> sumList=new ArrayList<Object[]>(); |
| 1450 | + if(fgsbm.equals("")) | ||
| 1451 | + sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),fgsbm); | ||
| 1452 | + else | ||
| 1453 | + sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),ylb.getFgsdm()); | ||
| 1454 | + | ||
| 1413 | // 保存总的加油量 | 1455 | // 保存总的加油量 |
| 1414 | Double jzl = 0.0; | 1456 | Double jzl = 0.0; |
| 1415 | // 保存总的里程 | 1457 | // 保存总的里程 |
| @@ -1431,9 +1473,14 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1431,9 +1473,14 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1431 | }*/ | 1473 | }*/ |
| 1432 | map.put("nbbm_eq", nbbm_eq); | 1474 | map.put("nbbm_eq", nbbm_eq); |
| 1433 | map.put("rq_eq", rq_eq); | 1475 | map.put("rq_eq", rq_eq); |
| 1434 | - | ||
| 1435 | - List<Ylb> iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"", | ||
| 1436 | - ylb.getNbbm(),"jcsx"); | 1476 | + List<Ylb> iterator2=null; |
| 1477 | + if(fgsbm.equals("")) | ||
| 1478 | + iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),fgsbm,"", | ||
| 1479 | + ylb.getNbbm(),"jcsx"); | ||
| 1480 | + else | ||
| 1481 | + iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"", | ||
| 1482 | + ylb.getNbbm(),"jcsx"); | ||
| 1483 | + | ||
| 1437 | // repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"", | 1484 | // repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"", |
| 1438 | // ylb.getNbbm(),"jcsx"); | 1485 | // ylb.getNbbm(),"jcsx"); |
| 1439 | DecimalFormat df = new DecimalFormat("#.00"); | 1486 | DecimalFormat df = new DecimalFormat("#.00"); |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -568,7 +568,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -568,7 +568,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 568 | 568 | ||
| 569 | //公司 和 分公司名称 | 569 | //公司 和 分公司名称 |
| 570 | t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); | 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 | //t.setScheduleDateStr(schDate); | 573 | //t.setScheduleDateStr(schDate); |
| 574 | t.setScheduleDate(sdfyyyyMMdd.parse(t.getScheduleDateStr())); | 574 | t.setScheduleDate(sdfyyyyMMdd.parse(t.getScheduleDateStr())); |
| @@ -590,6 +590,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -590,6 +590,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 590 | 590 | ||
| 591 | //计算班次实际执行时间 | 591 | //计算班次实际执行时间 |
| 592 | schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t); | 592 | schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t); |
| 593 | + //处理计达跨24点 | ||
| 594 | + LineConfig conf = lineConfigData.get(t.getXlBm()); | ||
| 595 | + if (t.getZdsj().compareTo(conf.getStartOpt()) < 0) { | ||
| 596 | + t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | ||
| 597 | + } | ||
| 593 | if (t.getZdsjT() < t.getFcsjT()) { | 598 | if (t.getZdsjT() < t.getFcsjT()) { |
| 594 | rs.put("status", ResponseCode.ERROR); | 599 | rs.put("status", ResponseCode.ERROR); |
| 595 | rs.put("msg", "起终点时间异常!"); | 600 | rs.put("msg", "起终点时间异常!"); |
src/main/resources/application-dev.properties
| @@ -8,9 +8,10 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | @@ -8,9 +8,10 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | ||
| 8 | spring.jpa.database= MYSQL | 8 | spring.jpa.database= MYSQL |
| 9 | spring.jpa.show-sql= true | 9 | spring.jpa.show-sql= true |
| 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver | 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 | spring.datasource.username= root | 13 | spring.datasource.username= root |
| 13 | -spring.datasource.password= | 14 | +spring.datasource.password= root |
| 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 15 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 15 | #spring.datasource.username= root | 16 | #spring.datasource.username= root |
| 16 | #spring.datasource.password= root | 17 | #spring.datasource.password= root |
src/main/resources/fatso/package.json
| 1 | -{ | ||
| 2 | - "name": "fatso", | ||
| 3 | - "version": "1.0.0", | ||
| 4 | - "description": "子页面js检查、合并、压缩等处理", | ||
| 5 | - "main": "start.js", | ||
| 6 | - "scripts": { | ||
| 7 | - "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | - }, | ||
| 9 | - "author": "panzhaov5", | ||
| 10 | - "license": "ISC", | ||
| 11 | - "dependencies": { | ||
| 12 | - "cheerio": "^0.20.0", | ||
| 13 | - "clean-css": "^4.0.12", | ||
| 14 | - "colors": "^1.3.3", | ||
| 15 | - "eventproxy": "^0.3.4", | ||
| 16 | - "uglify-js": "^2.6.2" | ||
| 17 | - } | ||
| 18 | -} | 1 | +{ |
| 2 | + "name": "fatso", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "子页面js检查、合并、压缩等处理", | ||
| 5 | + "main": "start.js", | ||
| 6 | + "scripts": { | ||
| 7 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | + }, | ||
| 9 | + "author": "panzhaov5", | ||
| 10 | + "license": "ISC", | ||
| 11 | + "dependencies": { | ||
| 12 | + "cheerio": "^0.20.0", | ||
| 13 | + "clean-css": "^4.0.12", | ||
| 14 | + "colors": "^1.3.3", | ||
| 15 | + "eventproxy": "^0.3.4", | ||
| 16 | + "uglify-js": "^2.6.2" | ||
| 17 | + } | ||
| 18 | +} |
src/main/resources/fatso/start.js
| @@ -16,7 +16,7 @@ var platform = process.platform; | @@ -16,7 +16,7 @@ var platform = process.platform; | ||
| 16 | var iswin = platform == 'win32'; | 16 | var iswin = platform == 'win32'; |
| 17 | var sp = platform == 'win32' ? '\\' : '/'; | 17 | var sp = platform == 'win32' ? '\\' : '/'; |
| 18 | //不参与的目录 | 18 | //不参与的目录 |
| 19 | -var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission' + sp + 'authorize_all', 'summary', 'history_sch', 'report' + sp + 'oil', 'base' + sp + 'geo_data_edit', 'base' + sp + 'carpark', 'forms', 'mforms', 'report', 'punctual', 'base' + sp + 'timesmodel'] | 19 | +var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission' + sp + 'authorize_all','permission' + sp + 'user', 'summary', 'history_sch', 'report' + sp + 'oil', 'base' + sp + 'geo_data_edit', 'base' + sp + 'carpark', 'forms', 'mforms', 'report', 'punctual', 'base' + sp + 'timesmodel'] |
| 20 | , ep = new EventProxy() | 20 | , ep = new EventProxy() |
| 21 | , pName = 'bsth_control' | 21 | , pName = 'bsth_control' |
| 22 | , path = process.cwd() | 22 | , path = process.cwd() |
src/main/resources/static/pages/base/timesmodel/js/v2_2/main_v2_2.js
| 1 | -/** | ||
| 2 | - * 主类(v2_2版本)。 | ||
| 3 | - */ | ||
| 4 | -var Main_v2_2 = function() { | ||
| 5 | - | ||
| 6 | - var _paramObj; // 参数对象 | ||
| 7 | - | ||
| 8 | - return { | ||
| 9 | - /** | ||
| 10 | - * 使用发车间隔策略生成时刻表。 | ||
| 11 | - * @param paramObj 参数对象 | ||
| 12 | - * @param lpArray 路牌数组 | ||
| 13 | - * @constructor | ||
| 14 | - */ | ||
| 15 | - BXPplaceClassesTime03 : function(paramObj, lpArray) { | ||
| 16 | - // 参数对象 | ||
| 17 | - _paramObj = paramObj; | ||
| 18 | - | ||
| 19 | - // // 测试行驶时间 | ||
| 20 | - // var _fcsj = paramObj.toTimeObj("16:20"); | ||
| 21 | - // var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, _fcsj, paramObj); // 使用策略计算班次行驶时间 | ||
| 22 | - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",行驶时间=" + _bcsj); | ||
| 23 | - // | ||
| 24 | - | ||
| 25 | - // // 测试停站时间 | ||
| 26 | - // var _fcsj = paramObj.toTimeObj("05:30"); | ||
| 27 | - // var _layovertime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")( | ||
| 28 | - // _fcsj, false, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), paramObj); | ||
| 29 | - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",停站layover时间=" + _layovertime); | ||
| 30 | - // | ||
| 31 | - // var schedule = {}; | ||
| 32 | - | ||
| 33 | - // // 测试间隔时间 | ||
| 34 | - // var _fcsj = paramObj.toTimeObj("07:30"); | ||
| 35 | - // var _headway = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(true, _fcsj, _paramObj); | ||
| 36 | - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",发车间隔=" + _headway); | ||
| 37 | - | ||
| 38 | - // 1、初始化行车计划 | ||
| 39 | - var schedule = new InternalScheduleObj_v2_2(paramObj, lpArray); | ||
| 40 | - // 2、生成班次(从第2圈开始) | ||
| 41 | - schedule.fnCreateBclistWithMasterBc(2, 20); | ||
| 42 | - // 3、调整发车间隔 | ||
| 43 | - schedule.fnAdjustHeadway(); | ||
| 44 | - // 4、计算吃饭班次 | ||
| 45 | - schedule.fnCalcuEatBc(); | ||
| 46 | - // // 6、计算末班车 | ||
| 47 | - // schedule.fnCalcuLastBc(); | ||
| 48 | - // 7、重新设置停站时间 | ||
| 49 | - schedule.fnReSetLayoverTime(); | ||
| 50 | - // 8、补进出场例保班次 | ||
| 51 | - schedule.fnCalcuOtherBc(); | ||
| 52 | - | ||
| 53 | - //-------------------- 输出ganut图上的班次,班型描述 ----------------------// | ||
| 54 | - // TODO:班型再议 | ||
| 55 | - return { | ||
| 56 | - 'json':schedule.fnToGanttBcArray(),'bxrcgs':null, | ||
| 57 | - 'aInternalLpObj': schedule.fnGetLpArray() | ||
| 58 | - }; | ||
| 59 | - }, | ||
| 60 | - | ||
| 61 | - //----------------------------------- 导入导出配置 -----------------------------------// | ||
| 62 | - | ||
| 63 | - /** | ||
| 64 | - * 导出时刻表配置。 | ||
| 65 | - * @param fnGetGanttBc 获取gantt班次方法 | ||
| 66 | - */ | ||
| 67 | - exportExcelConfig: function(fnGetGanttBc) { | ||
| 68 | - var oExcel = new Main_v2_2_ExcelObj(_paramObj, fnGetGanttBc); | ||
| 69 | - | ||
| 70 | - $('.exportAddXls').off('click'); | ||
| 71 | - $('.exportAddXlsx').off('click'); | ||
| 72 | - | ||
| 73 | - $('.exportAddXls').on('click', function() { | ||
| 74 | - | ||
| 75 | - var aInfos = { | ||
| 76 | - "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表 | ||
| 77 | - "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表 | ||
| 78 | - "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象 | ||
| 79 | - }; | ||
| 80 | - | ||
| 81 | - console.log(aInfos); | ||
| 82 | - | ||
| 83 | - $(".exportAdd").addClass("disabled"); | ||
| 84 | - $(".exportAddSpan").html("正在导出..."); | ||
| 85 | - | ||
| 86 | - // 提交 | ||
| 87 | - $.ajax({ | ||
| 88 | - type: 'POST', | ||
| 89 | - url: "/tidc/exportDTDFile/xls", | ||
| 90 | - dataType: 'binary', | ||
| 91 | - contentType: "application/json", | ||
| 92 | - data: JSON.stringify(aInfos), | ||
| 93 | - success: function(data){ | ||
| 94 | - oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xls"); | ||
| 95 | - | ||
| 96 | - $(".exportAdd").removeClass("disabled"); | ||
| 97 | - $(".exportAddSpan").html(" 导出数据"); | ||
| 98 | - }, | ||
| 99 | - error: function(xhr, type){ | ||
| 100 | - alert('错误:TODO'); | ||
| 101 | - | ||
| 102 | - $(".exportAdd").removeClass("disabled"); | ||
| 103 | - $(".exportAddSpan").html(" 导出数据"); | ||
| 104 | - } | ||
| 105 | - }); | ||
| 106 | - }); | ||
| 107 | - | ||
| 108 | - $('.exportAddXlsx').on('click', function() { | ||
| 109 | - var aInfos = { | ||
| 110 | - "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表 | ||
| 111 | - "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表 | ||
| 112 | - "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象 | ||
| 113 | - }; | ||
| 114 | - | ||
| 115 | - console.log(aInfos); | ||
| 116 | - | ||
| 117 | - $(".exportAdd").addClass("disabled"); | ||
| 118 | - $(".exportAddSpan").html("正在导出..."); | ||
| 119 | - | ||
| 120 | - // 提交 | ||
| 121 | - $.ajax({ | ||
| 122 | - type: 'POST', | ||
| 123 | - url: "/tidc/exportDTDFile/xlsx", | ||
| 124 | - dataType: 'binary', | ||
| 125 | - contentType: "application/json", | ||
| 126 | - data: JSON.stringify(aInfos), | ||
| 127 | - success: function(data){ | ||
| 128 | - oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx"); | ||
| 129 | - | ||
| 130 | - $(".exportAdd").removeClass("disabled"); | ||
| 131 | - $(".exportAddSpan").html(" 导出数据"); | ||
| 132 | - }, | ||
| 133 | - error: function(xhr, type){ | ||
| 134 | - alert('错误:TODO'); | ||
| 135 | - | ||
| 136 | - $(".exportAdd").removeClass("disabled"); | ||
| 137 | - $(".exportAddSpan").html(" 导出数据"); | ||
| 138 | - } | ||
| 139 | - }); | ||
| 140 | - }); | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - | ||
| 144 | - } | 1 | +/** |
| 2 | + * 主类(v2_2版本)。 | ||
| 3 | + */ | ||
| 4 | +var Main_v2_2 = function() { | ||
| 5 | + | ||
| 6 | + var _paramObj; // 参数对象 | ||
| 7 | + | ||
| 8 | + return { | ||
| 9 | + /** | ||
| 10 | + * 使用发车间隔策略生成时刻表。 | ||
| 11 | + * @param paramObj 参数对象 | ||
| 12 | + * @param lpArray 路牌数组 | ||
| 13 | + * @constructor | ||
| 14 | + */ | ||
| 15 | + BXPplaceClassesTime03 : function(paramObj, lpArray) { | ||
| 16 | + // 参数对象 | ||
| 17 | + _paramObj = paramObj; | ||
| 18 | + | ||
| 19 | + // // 测试行驶时间 | ||
| 20 | + // var _fcsj = paramObj.toTimeObj("16:20"); | ||
| 21 | + // var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, _fcsj, paramObj); // 使用策略计算班次行驶时间 | ||
| 22 | + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",行驶时间=" + _bcsj); | ||
| 23 | + // | ||
| 24 | + | ||
| 25 | + // // 测试停站时间 | ||
| 26 | + // var _fcsj = paramObj.toTimeObj("05:30"); | ||
| 27 | + // var _layovertime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")( | ||
| 28 | + // _fcsj, false, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), paramObj); | ||
| 29 | + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",停站layover时间=" + _layovertime); | ||
| 30 | + // | ||
| 31 | + // var schedule = {}; | ||
| 32 | + | ||
| 33 | + // // 测试间隔时间 | ||
| 34 | + // var _fcsj = paramObj.toTimeObj("07:30"); | ||
| 35 | + // var _headway = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(true, _fcsj, _paramObj); | ||
| 36 | + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",发车间隔=" + _headway); | ||
| 37 | + | ||
| 38 | + // 1、初始化行车计划 | ||
| 39 | + var schedule = new InternalScheduleObj_v2_2(paramObj, lpArray); | ||
| 40 | + // 2、生成班次(从第2圈开始) | ||
| 41 | + schedule.fnCreateBclistWithMasterBc(2, 20); | ||
| 42 | + // 3、调整发车间隔 | ||
| 43 | + schedule.fnAdjustHeadway(); | ||
| 44 | + // 4、计算吃饭班次 | ||
| 45 | + schedule.fnCalcuEatBc(); | ||
| 46 | + // // 6、计算末班车 | ||
| 47 | + // schedule.fnCalcuLastBc(); | ||
| 48 | + // 7、重新设置停站时间 | ||
| 49 | + schedule.fnReSetLayoverTime(); | ||
| 50 | + // 8、补进出场例保班次 | ||
| 51 | + schedule.fnCalcuOtherBc(); | ||
| 52 | + | ||
| 53 | + //-------------------- 输出ganut图上的班次,班型描述 ----------------------// | ||
| 54 | + // TODO:班型再议 | ||
| 55 | + return { | ||
| 56 | + 'json':schedule.fnToGanttBcArray(),'bxrcgs':null, | ||
| 57 | + 'aInternalLpObj': schedule.fnGetLpArray() | ||
| 58 | + }; | ||
| 59 | + }, | ||
| 60 | + | ||
| 61 | + //----------------------------------- 导入导出配置 -----------------------------------// | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 导出时刻表配置。 | ||
| 65 | + * @param fnGetGanttBc 获取gantt班次方法 | ||
| 66 | + */ | ||
| 67 | + exportExcelConfig: function(fnGetGanttBc) { | ||
| 68 | + var oExcel = new Main_v2_2_ExcelObj(_paramObj, fnGetGanttBc); | ||
| 69 | + | ||
| 70 | + $('.exportAddXls').off('click'); | ||
| 71 | + $('.exportAddXlsx').off('click'); | ||
| 72 | + | ||
| 73 | + $('.exportAddXls').on('click', function() { | ||
| 74 | + | ||
| 75 | + var aInfos = { | ||
| 76 | + "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表 | ||
| 77 | + "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表 | ||
| 78 | + "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象 | ||
| 79 | + }; | ||
| 80 | + | ||
| 81 | + console.log(aInfos); | ||
| 82 | + | ||
| 83 | + $(".exportAdd").addClass("disabled"); | ||
| 84 | + $(".exportAddSpan").html("正在导出..."); | ||
| 85 | + | ||
| 86 | + // 提交 | ||
| 87 | + $.ajax({ | ||
| 88 | + type: 'POST', | ||
| 89 | + url: "/tidc/exportDTDFile/xls", | ||
| 90 | + dataType: 'binary', | ||
| 91 | + contentType: "application/json", | ||
| 92 | + data: JSON.stringify(aInfos), | ||
| 93 | + success: function(data){ | ||
| 94 | + oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xls"); | ||
| 95 | + | ||
| 96 | + $(".exportAdd").removeClass("disabled"); | ||
| 97 | + $(".exportAddSpan").html(" 导出数据"); | ||
| 98 | + }, | ||
| 99 | + error: function(xhr, type){ | ||
| 100 | + alert('错误:TODO'); | ||
| 101 | + | ||
| 102 | + $(".exportAdd").removeClass("disabled"); | ||
| 103 | + $(".exportAddSpan").html(" 导出数据"); | ||
| 104 | + } | ||
| 105 | + }); | ||
| 106 | + }); | ||
| 107 | + | ||
| 108 | + $('.exportAddXlsx').on('click', function() { | ||
| 109 | + var aInfos = { | ||
| 110 | + "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表 | ||
| 111 | + "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表 | ||
| 112 | + "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象 | ||
| 113 | + }; | ||
| 114 | + | ||
| 115 | + console.log(aInfos); | ||
| 116 | + | ||
| 117 | + $(".exportAdd").addClass("disabled"); | ||
| 118 | + $(".exportAddSpan").html("正在导出..."); | ||
| 119 | + | ||
| 120 | + // 提交 | ||
| 121 | + $.ajax({ | ||
| 122 | + type: 'POST', | ||
| 123 | + url: "/tidc/exportDTDFile/xlsx", | ||
| 124 | + dataType: 'binary', | ||
| 125 | + contentType: "application/json", | ||
| 126 | + data: JSON.stringify(aInfos), | ||
| 127 | + success: function(data){ | ||
| 128 | + oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx"); | ||
| 129 | + | ||
| 130 | + $(".exportAdd").removeClass("disabled"); | ||
| 131 | + $(".exportAddSpan").html(" 导出数据"); | ||
| 132 | + }, | ||
| 133 | + error: function(xhr, type){ | ||
| 134 | + alert('错误:TODO'); | ||
| 135 | + | ||
| 136 | + $(".exportAdd").removeClass("disabled"); | ||
| 137 | + $(".exportAddSpan").html(" 导出数据"); | ||
| 138 | + } | ||
| 139 | + }); | ||
| 140 | + }); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + | ||
| 144 | + } | ||
| 145 | }(); | 145 | }(); |
| 146 | \ No newline at end of file | 146 | \ No newline at end of file |
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 | \ No newline at end of file | 478 | \ No newline at end of file |
src/main/resources/static/pages/forms/mould/calcLbStatuAnaly.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/oil/list_ph.html
| @@ -149,6 +149,7 @@ | @@ -149,6 +149,7 @@ | ||
| 149 | <option value="2">一车多单</option> | 149 | <option value="2">一车多单</option> |
| 150 | <option value="3">有加油没里程</option> | 150 | <option value="3">有加油没里程</option> |
| 151 | <option value="4">有里程没加油</option> | 151 | <option value="4">有里程没加油</option> |
| 152 | + <option value="5">跨分工用车</option> | ||
| 152 | </select> | 153 | </select> |
| 153 | </div> | 154 | </div> |
| 154 | 155 | ||
| @@ -547,6 +548,8 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | @@ -547,6 +548,8 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | ||
| 547 | }else{ | 548 | }else{ |
| 548 | var params2 = {}; | 549 | var params2 = {}; |
| 549 | params2['ylbList']=JSON.stringify(ylArray2); | 550 | params2['ylbList']=JSON.stringify(ylArray2); |
| 551 | + params2['fgsbm']=$("#ylbListFgsdmId").val(); | ||
| 552 | + | ||
| 550 | var i = layer.load(2); | 553 | var i = layer.load(2); |
| 551 | //保存操作 | 554 | //保存操作 |
| 552 | $post('/ylb/saveYlbList', params, function () { | 555 | $post('/ylb/saveYlbList', params, function () { |
| @@ -659,11 +662,17 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | @@ -659,11 +662,17 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | ||
| 659 | $('tr.filter .filter-submit').on('click', function () { | 662 | $('tr.filter .filter-submit').on('click', function () { |
| 660 | var ylbGsdm=$("#ylbListGsdmId").val(); | 663 | var ylbGsdm=$("#ylbListGsdmId").val(); |
| 661 | var ylbFgsdm=$("#ylbListFgsdmId").val(); | 664 | var ylbFgsdm=$("#ylbListFgsdmId").val(); |
| 665 | + var nbbm=$("#nbbm").val(); | ||
| 662 | if ($("#rq").val() == "" || $("#rq").val() ==null){ | 666 | if ($("#rq").val() == "" || $("#rq").val() ==null){ |
| 663 | layer.msg('请选择日期.'); | 667 | layer.msg('请选择日期.'); |
| 664 | - }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){ | ||
| 665 | - layer.msg('请选择公司和分公司.'); | ||
| 666 | - }else { | 668 | + }else if(ylbGsdm=="" || ylbGsdm==null){ |
| 669 | +// || ylbFgsdm=="" | ||
| 670 | + layer.msg('请选择公司'); | ||
| 671 | + } | ||
| 672 | + /* else if( (ylbFgsdm==""||ylbFgsdm==null) && (nbbm=="" || nbbm==null) ){ | ||
| 673 | + layer.msg('不选择分公司处理输入车辆自编号'); | ||
| 674 | + } */ | ||
| 675 | + else { | ||
| 667 | var params = getParamsList(); | 676 | var params = getParamsList(); |
| 668 | page = 0; | 677 | page = 0; |
| 669 | jsDoQuery(params, true); | 678 | jsDoQuery(params, true); |
| @@ -697,6 +706,7 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | @@ -697,6 +706,7 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | ||
| 697 | } | 706 | } |
| 698 | } | 707 | } |
| 699 | } | 708 | } |
| 709 | + options += '<option value="">全部分公司</option>'; | ||
| 700 | $('#ylbListFgsdmId').html(options); | 710 | $('#ylbListFgsdmId').html(options); |
| 701 | initXl(); | 711 | initXl(); |
| 702 | initCl(); | 712 | initCl(); |
src/main/resources/static/pages/permission/user/authorize.html
| 1 | -<!DOCTYPE html> | ||
| 2 | -<html lang="zh-cn"> | ||
| 3 | - | ||
| 4 | -<head> | ||
| 5 | - <meta charset="UTF-8"> | ||
| 6 | - <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/> | ||
| 7 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" /> | ||
| 8 | - <link rel="stylesheet" href="/assets/plugins/ztree_v3/css/zTreeStyle/zTreeStyle.css" /> | ||
| 9 | - <style> | ||
| 10 | - html,body{ | ||
| 11 | - height: 100%; | ||
| 12 | - } | ||
| 13 | - .ct_page{ | ||
| 14 | - padding: 25px 15px; | ||
| 15 | - height: 100%; | ||
| 16 | - height: calc(100% - 50px); | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - .ct_cont{ | ||
| 20 | - height: calc(100% - 41px); | ||
| 21 | - } | ||
| 22 | - | ||
| 23 | - .ct_cont>div>div.uk-card{ | ||
| 24 | - height: 99%; | ||
| 25 | - } | ||
| 26 | - | ||
| 27 | - form .uk-inline{ | ||
| 28 | - width: calc(100% - 4px); | ||
| 29 | - margin-left: 2px; | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - .ct-card-body{ | ||
| 33 | - overflow: auto; | ||
| 34 | - padding: 1px 1px 0 2px; | ||
| 35 | - height: calc(100% - 54px); | ||
| 36 | - position: relative; | ||
| 37 | - margin-top: -12px; | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - .ct_li_desc{ | ||
| 41 | - color: #a8a8a8; | ||
| 42 | - font-size: 13px; | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - .ct-card-body .uk-list-large{ | ||
| 46 | - font-size: 14px; | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - .ct-card-body .uk-list-large>li{ | ||
| 50 | - cursor: default; | ||
| 51 | - padding-left: 20px; | ||
| 52 | - margin-top: 2px !important; | ||
| 53 | - padding-top: 17px !important; | ||
| 54 | - position: relative; | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - .ct-card-body .uk-list-large>li:hover{ | ||
| 58 | - background: #edecec; | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - .ct-card-body .uk-list-large>li.active{ | ||
| 62 | - background: #1e87f0 !important; | ||
| 63 | - color: white; | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - .ct-card-body .uk-list-large>li.active>span.role-code{ | ||
| 67 | - color: #ffffff; | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - .ct-card-body .uk-list-large.role-list>li:hover{ | ||
| 71 | - background: #fff494; | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - .ct-card-body .uk-list-large>li.active .ct_li_desc{ | ||
| 75 | - color: #e6e6e6; | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - .ct-card-body .uk-list-large>li>span.uk-badge{ | ||
| 79 | - position: absolute; | ||
| 80 | - top: 17px; | ||
| 81 | - right: 25px; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - .ct-card-body .uk-list-large>li>span.role-code{ | ||
| 85 | - padding: 4px 6px; | ||
| 86 | - color: #a8a8a8; | ||
| 87 | - margin-left: 5px; | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - .top_title{ | ||
| 91 | - padding: 9px 0 5px 15px; | ||
| 92 | - border-bottom: 1px solid #ededed; | ||
| 93 | - border-left: 5px solid #FFC107; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - .top_title>.desc{ | ||
| 97 | - font-size: 13px; | ||
| 98 | - color: grey; | ||
| 99 | - margin-top: 3px; | ||
| 100 | - } | ||
| 101 | - | ||
| 102 | - .left_menu_list{ | ||
| 103 | - overflow: auto; | ||
| 104 | - position: relative; | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | - .left_menu_list .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{ | ||
| 108 | - opacity: 0.6 !important; | ||
| 109 | - padding: 0 !important; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - ._company{ | ||
| 113 | - margin: 15px 0px; | ||
| 114 | - } | ||
| 115 | - ._company>h5{ | ||
| 116 | - margin-bottom: 10px; | ||
| 117 | - font-size: 15px; | ||
| 118 | - color: #6b6b6b; | ||
| 119 | - text-indent: 12px; | ||
| 120 | - } | ||
| 121 | - ._company>._fgs>label{ | ||
| 122 | - padding: 3px 12px 3px 10px; | ||
| 123 | - display: inline-block; | ||
| 124 | - border: 1px solid gainsboro; | ||
| 125 | - border-radius: 2px; | ||
| 126 | - margin: 5px; | ||
| 127 | - font-size: 14px; | ||
| 128 | - } | ||
| 129 | - ._company>._fgs>label.active{ | ||
| 130 | - background: #1e87f0; | ||
| 131 | - color: #fff; | ||
| 132 | - } | ||
| 133 | - ._company .uk-checkbox:checked:focus, | ||
| 134 | - .line_checkbox_list .uk-checkbox:checked:focus{ | ||
| 135 | - background-color: #1e87f0 !important; | ||
| 136 | - } | ||
| 137 | - .save_icon{ | ||
| 138 | - position: absolute; | ||
| 139 | - right: 2px; | ||
| 140 | - background: #bec4c9; | ||
| 141 | - font-size: 12px; | ||
| 142 | - padding: 2px 15px; | ||
| 143 | - color: #fff; | ||
| 144 | - box-shadow: 0 5px 15px rgba(0,0,0,0.08); | ||
| 145 | - cursor: pointer; | ||
| 146 | - } | ||
| 147 | - .save_icon:hover{ | ||
| 148 | - background: #FFC107; | ||
| 149 | - } | ||
| 150 | - .data_auth_list{ | ||
| 151 | - position: relative; | ||
| 152 | - } | ||
| 153 | - #user_authorize_wrap .top_title{ | ||
| 154 | - border-left: 5px solid #cacac8; | ||
| 155 | - } | ||
| 156 | - .xd_line_list{ | ||
| 157 | - height: 37%; | ||
| 158 | - padding: 7px; | ||
| 159 | - border-bottom: 1px solid #f2f2f2; | ||
| 160 | - overflow: auto; | ||
| 161 | - position: relative; | ||
| 162 | - } | ||
| 163 | - .xd_line_list>h5{ | ||
| 164 | - color: #858585; | ||
| 165 | - margin: 5px 5px 5px 0; | ||
| 166 | - font-size: 14px; | ||
| 167 | - } | ||
| 168 | - .sub_lines{ | ||
| 169 | - padding-left: 15px; | ||
| 170 | - } | ||
| 171 | - .sub_lines>span.line_btn { | ||
| 172 | - background: #00BCD4; | ||
| 173 | - color: #fff; | ||
| 174 | - padding: 4px 9px; | ||
| 175 | - display: inline-block; | ||
| 176 | - min-width: 68px; | ||
| 177 | - text-align: center; | ||
| 178 | - margin: 5px 2px; | ||
| 179 | - box-shadow: 0 5px 9px rgba(0,0,0,0.08); | ||
| 180 | - cursor: pointer; | ||
| 181 | - font-size: 14px; | ||
| 182 | - font-family: 微软雅黑; | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | - .sub_lines>span.line_btn.destroy{ | ||
| 186 | - background: #ff5c5c; | ||
| 187 | - } | ||
| 188 | - | ||
| 189 | - .sub_lines>span.line_btn.destroy:hover{ | ||
| 190 | - background: #ff7373; | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - .sub_lines>span.line_btn:hover{ | ||
| 194 | - background: #2dd7ed; | ||
| 195 | - } | ||
| 196 | - .add_line_icon{ | ||
| 197 | - cursor: pointer; | ||
| 198 | - padding: 2px 5px; | ||
| 199 | - border-radius: 5px; | ||
| 200 | - display: inline-block; | ||
| 201 | - } | ||
| 202 | - .add_line_icon>i{ | ||
| 203 | - vertical-align: top; | ||
| 204 | - margin-top: 3px; | ||
| 205 | - } | ||
| 206 | - .add_line_icon:hover{ | ||
| 207 | - background: #ededed; | ||
| 208 | - } | ||
| 209 | - .ct_pattern_form{ | ||
| 210 | - display: inline-block; | ||
| 211 | - } | ||
| 212 | - .xd_menu_grid{ | ||
| 213 | - padding: 25px 25px 0 25px; | ||
| 214 | - height: calc(63% - 91px); | ||
| 215 | - } | ||
| 216 | - .xd_menu_grid .uk-list{ | ||
| 217 | - border: 1px solid #ededed; | ||
| 218 | - height: calc(100% - 70px); | ||
| 219 | - overflow: auto; | ||
| 220 | - position: relative; | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - .xd_menu_grid .uk-list>li{ | ||
| 224 | - margin: 5px 0 !important; | ||
| 225 | - padding: 10px 0 0 10px !important; | ||
| 226 | - font-size: 14px; | ||
| 227 | - } | ||
| 228 | - .top_tools{ | ||
| 229 | - position: absolute; | ||
| 230 | - top: 15px; | ||
| 231 | - right: 25px; | ||
| 232 | - } | ||
| 233 | - .ct_field { | ||
| 234 | - display: inline-block; | ||
| 235 | - width: 240px; | ||
| 236 | - } | ||
| 237 | - .ct_field>select,.ct_field>input{ | ||
| 238 | - width: calc(100% - 60px); | ||
| 239 | - } | ||
| 240 | - .line_checkbox_list{ | ||
| 241 | - margin-top: 15px; | ||
| 242 | - } | ||
| 243 | - .line_checkbox_list>.btn{ | ||
| 244 | - padding: 5px 7px; | ||
| 245 | - border-radius: 2px; | ||
| 246 | - display: inline-block; | ||
| 247 | - margin: 4px 9px; | ||
| 248 | - font-size: 14px; | ||
| 249 | - font-family: 微软雅黑; | ||
| 250 | - border: 1px solid #d9d9d9; | ||
| 251 | - width: 100px; | ||
| 252 | - overflow: hidden; | ||
| 253 | - text-overflow: ellipsis; | ||
| 254 | - white-space: nowrap; | ||
| 255 | - } | ||
| 256 | - .line_checkbox_list>.btn>input{ | ||
| 257 | - margin-right: 5px; | ||
| 258 | - } | ||
| 259 | - .line_checkbox_list>.btn.active{ | ||
| 260 | - background: #1e87f0; | ||
| 261 | - color: #fff; | ||
| 262 | - } | ||
| 263 | - | ||
| 264 | - .line_checkbox_list>.btn.destroy, | ||
| 265 | - .line_checkbox_list>.btn.destroy>input{ | ||
| 266 | - border-color: #ff9595; | ||
| 267 | - color: #ff5c5c; | ||
| 268 | - } | ||
| 269 | - | ||
| 270 | - .line_checkbox_list>.btn.destroy.active{ | ||
| 271 | - background: #ff5c5c; | ||
| 272 | - color: #fff; | ||
| 273 | - } | ||
| 274 | - | ||
| 275 | - .line_checkbox_list>.btn.destroy.active>input{ | ||
| 276 | - background-color: #ff5c5c !important; | ||
| 277 | - border-color: #ff5c5c !important; | ||
| 278 | - } | ||
| 279 | - | ||
| 280 | - #role_authorize_wrap .ztree *{ | ||
| 281 | - font-size: 14px; | ||
| 282 | - } | ||
| 283 | - #role_authorize_wrap .ztree li{ | ||
| 284 | - line-height: 21px; | ||
| 285 | - } | ||
| 286 | - .loading{ | ||
| 287 | - height: 100%; | ||
| 288 | - text-align: center; | ||
| 289 | - } | ||
| 290 | - .loading .uk-spinner{ | ||
| 291 | - margin-top: 200px; | ||
| 292 | - } | ||
| 293 | - .loading circle{ | ||
| 294 | - stroke: red; | ||
| 295 | - } | ||
| 296 | - | ||
| 297 | - #select_line_modal .uk-checkbox:checked { | ||
| 298 | - background-color: #1e87f0; | ||
| 299 | - } | ||
| 300 | - </style> | ||
| 301 | -</head> | ||
| 302 | - | ||
| 303 | -<body> | ||
| 304 | -<div class="loading"> | ||
| 305 | - <div uk-spinner></div> | ||
| 306 | -</div> | ||
| 307 | -<div class="ct_page" style="display: none;"> | ||
| 308 | - <h2 class="uk-heading-line uk-heading-bullet"><span>用户授权管理</span></h2> | ||
| 309 | - <div class="ct_cont uk-grid-small uk-child-width-expand" uk-grid> | ||
| 310 | - <div class="role_list uk-width-1-4 "> | ||
| 311 | - <div class="uk-card uk-card-default"> | ||
| 312 | - <form> | ||
| 313 | - <div class="uk-margin"> | ||
| 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 | - </div> | ||
| 318 | - </div> | ||
| 319 | - </form> | ||
| 320 | - | ||
| 321 | - <div class="ct-card-body" > | ||
| 322 | - <ul class="uk-list uk-list-large uk-list-divider role-list"> | ||
| 323 | - </ul> | ||
| 324 | - </div> | ||
| 325 | - </div> | ||
| 326 | - </div> | ||
| 327 | - <div class="user_list uk-width-1-5 "> | ||
| 328 | - <div class="uk-card uk-card-default"> | ||
| 329 | - <form> | ||
| 330 | - <div class="uk-margin"> | ||
| 331 | - <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 | - </div> | ||
| 335 | - </div> | ||
| 336 | - </form> | ||
| 337 | - | ||
| 338 | - <div class="ct-card-body"> | ||
| 339 | - <ul class="uk-list uk-list-large user-list"> | ||
| 340 | - </ul> | ||
| 341 | - </div> | ||
| 342 | - </div> | ||
| 343 | - </div> | ||
| 344 | - <div class="auth_cont "> | ||
| 345 | - <div class="uk-card uk-card-default authorize_right_cont"> | ||
| 346 | - | ||
| 347 | - </div> | ||
| 348 | - </div> | ||
| 349 | - </div> | ||
| 350 | -</div> | ||
| 351 | - | ||
| 352 | -<script id="authorize-role-list-temp" type="text/html"> | ||
| 353 | - {{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> | ||
| 359 | - {{/each}} | ||
| 360 | -</script> | ||
| 361 | -<script id="authorize-user-list-temp" type="text/html"> | ||
| 362 | - {{each list as u i}} | ||
| 363 | - <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 | - {{/each}} | ||
| 365 | -</script> | ||
| 366 | -<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script> | ||
| 367 | -<script src="/assets/js/common.js"></script> | ||
| 368 | -<script src="/assets/plugins/uk3.0/uikit.min.js"></script> | ||
| 369 | -<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script> | ||
| 370 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script> | ||
| 371 | -<!-- EventProxy --> | ||
| 372 | -<script src="/assets/js/eventproxy.js"></script> | ||
| 373 | -<!-- art-template 模版引擎 --> | ||
| 374 | -<script src="/assets/plugins/template.js"></script> | ||
| 375 | -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | ||
| 376 | -<script src="/assets/plugins/ztree_v3/js/jquery.ztree.core.min.js"></script> | ||
| 377 | -<script src="/assets/plugins/ztree_v3/js/jquery.ztree.excheck.min.js"></script> | ||
| 378 | -<script> | ||
| 379 | - var storage = window.localStorage; | ||
| 380 | - | ||
| 381 | - if (typeof String.prototype.startsWith != 'function') { | ||
| 382 | - String.prototype.startsWith = function (prefix){ | ||
| 383 | - return this.slice(0, prefix.length) === prefix; | ||
| 384 | - }; | ||
| 385 | - } | ||
| 386 | - var roles,users,role_users,modules,companyData,lineArray; | ||
| 387 | - | ||
| 388 | - var ep = EventProxy.create('query_roles', 'query_users', 'query_modules', 'query_company', 'query_line', function (rs, us, ms, cs, lines) { | ||
| 389 | - roles = rs; | ||
| 390 | - users = us; | ||
| 391 | - modules = ms; | ||
| 392 | - companyData = cs; | ||
| 393 | - lineArray=lines; | ||
| 394 | - role_users = {}; | ||
| 395 | - debugger | ||
| 396 | - for(var i=0,r;r=roles[i++];){ | ||
| 397 | - r.count=0; | ||
| 398 | - role_users[r.id]=[]; | ||
| 399 | - r.createDateStr=moment(r.createDate).format('YYYY-MM-DD HH:ss'); | ||
| 400 | - r.codeUp=r.codeName.toUpperCase(); | ||
| 401 | - for(var j=0,u;u=users[j++];){ | ||
| 402 | - if(u.roles.indexOf(r.id)!=-1){ | ||
| 403 | - r.count++; | ||
| 404 | - role_users[r.id].push(u); | ||
| 405 | - } | ||
| 406 | - } | ||
| 407 | - } | ||
| 408 | - //渲染角色list | ||
| 409 | - render_role_list(roles); | ||
| 410 | - //渲染用户list | ||
| 411 | - render_user_list(users); | ||
| 412 | - | ||
| 413 | - $('.loading').remove(); | ||
| 414 | - $('.ct_page').show(); | ||
| 415 | - }); | ||
| 416 | - | ||
| 417 | - //角色点击 | ||
| 418 | - $('ul.role-list').on('click', 'li', roleClickHanlder); | ||
| 419 | - //用户点击 | ||
| 420 | - $('ul.user-list').on('click', 'li', userClickHanlder); | ||
| 421 | - | ||
| 422 | - | ||
| 423 | - function roleClickHanlder() { | ||
| 424 | - if($(this).hasClass('active') && $('ul.user-list>li.active').length==0) | ||
| 425 | - return; | ||
| 426 | - | ||
| 427 | - reset_dom(); | ||
| 428 | - $('ul.role-list>li.active').removeClass('active'); | ||
| 429 | - $(this).addClass('active'); | ||
| 430 | - //重新渲染用户list | ||
| 431 | - var id = $(this).data('id'); | ||
| 432 | - render_user_list(role_users[id]); | ||
| 433 | - //加载角色授权页面 | ||
| 434 | - $('.authorize_right_cont').load('/pages/permission/authorize_all/role_auth.html', function () { | ||
| 435 | - $('#role_authorize_wrap', this).trigger('init', {role: get_role(id), modules: modules, companyData: companyData}); | ||
| 436 | - }); | ||
| 437 | - } | ||
| 438 | - | ||
| 439 | - function userClickHanlder() { | ||
| 440 | - if($(this).hasClass('active')) | ||
| 441 | - return; | ||
| 442 | - | ||
| 443 | - reset_dom(); | ||
| 444 | - $('ul.user-list>li.active').removeClass('active'); | ||
| 445 | - $(this).addClass('active'); | ||
| 446 | - | ||
| 447 | - //加载用户授权页面 | ||
| 448 | - var id = $(this).data('id'); | ||
| 449 | - $('.authorize_right_cont').load('/pages/permission/authorize_all/user_auth.html', function () { | ||
| 450 | - $('#user_authorize_wrap', this).trigger('init', {user: get_user(id),lineArray:lineArray, companyData:companyData}); | ||
| 451 | - }); | ||
| 452 | - } | ||
| 453 | - | ||
| 454 | - //refresh-user | ||
| 455 | - $('.authorize_right_cont').on('refresh-user', function () { | ||
| 456 | - $('ul.user-list>li.active').removeClass('active').trigger('click'); | ||
| 457 | - }); | ||
| 458 | - | ||
| 459 | - function reset_dom() { | ||
| 460 | - $('#select_line_modal').remove(); | ||
| 461 | - } | ||
| 462 | - | ||
| 463 | - //滚动条 | ||
| 464 | - $('.ct_page .uk-card .ct-card-body').perfectScrollbar({suppressScrollX: true}); | ||
| 465 | - | ||
| 466 | - //query all role | ||
| 467 | - var paramsRole = {}; | ||
| 468 | - paramsRole['codeName'] = 'ROLE_ADMIN'; | ||
| 469 | - var userId=storage.getItem("editUser"); | ||
| 470 | - $get('/user',{id_eq:userId}, function (rs) { | ||
| 471 | - debugger | ||
| 472 | - //if (rs) | ||
| 473 | - ep.emit('query_roles', rs.content[0].roles); | ||
| 474 | - }); | ||
| 475 | - | ||
| 476 | - | ||
| 477 | - //query all user | ||
| 478 | - var paramsUser = {}; | ||
| 479 | - paramsRole['name'] = 'name'; | ||
| 480 | - $.get('/user/all_distinct',paramsUser, function (rs) { | ||
| 481 | - var userA={}; | ||
| 482 | - for(var i=0,u;u=rs[i++];){ | ||
| 483 | - 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'); | ||
| 487 | - userA[0]=u; | ||
| 488 | - } | ||
| 489 | - } | ||
| 490 | - ep.emit('query_users', userA); | ||
| 491 | - }); | ||
| 492 | - | ||
| 493 | - //query all modules | ||
| 494 | - $.get('/module/all_distinct', function (rs) { | ||
| 495 | - ep.emit('query_modules', rs); | ||
| 496 | - }); | ||
| 497 | - | ||
| 498 | - //query all company data | ||
| 499 | - $.get('/business/all', function (rs) { | ||
| 500 | - ep.emit('query_company', rs); | ||
| 501 | - }); | ||
| 502 | - | ||
| 503 | - //query all line | ||
| 504 | - $.get('/line/all', {'remove_ne': 1}, function (rs) { | ||
| 505 | - ep.emit('query_line', rs); | ||
| 506 | - }); | ||
| 507 | - | ||
| 508 | - function discard_field(u) { | ||
| 509 | - var array = []; | ||
| 510 | - $.each(u.roles, function () { | ||
| 511 | - array.push(this.id); | ||
| 512 | - }); | ||
| 513 | - u.roles = array; | ||
| 514 | - } | ||
| 515 | - | ||
| 516 | - function render_role_list(list) { | ||
| 517 | - var htmlStr = template('authorize-role-list-temp', {list: list}); | ||
| 518 | - $('ul.role-list').html(htmlStr); | ||
| 519 | - up_scroll(); | ||
| 520 | - } | ||
| 521 | - | ||
| 522 | - | ||
| 523 | - function render_user_list(list) { | ||
| 524 | - var htmlStr = template('authorize-user-list-temp', {list: list}); | ||
| 525 | - $('ul.user-list').html(htmlStr); | ||
| 526 | - up_scroll(); | ||
| 527 | - } | ||
| 528 | - | ||
| 529 | - function reset_role_list(){ | ||
| 530 | - var actives = $('ul.role-list>li.active'); | ||
| 531 | - if(actives.length > 0){ | ||
| 532 | - $('ul.role-list>li.active').removeClass('active'); | ||
| 533 | - render_user_list(users); | ||
| 534 | - $('.authorize_right_cont').empty(); | ||
| 535 | - } | ||
| 536 | - } | ||
| 537 | - | ||
| 538 | - function up_scroll() { | ||
| 539 | - $('.ct_page .uk-card .ct-card-body').perfectScrollbar('update'); | ||
| 540 | - } | ||
| 541 | - | ||
| 542 | - | ||
| 543 | - | ||
| 544 | - function get_role(id) { | ||
| 545 | - for(var i=0,r;r=roles[i++];){ | ||
| 546 | - if(r.id==id) | ||
| 547 | - return r; | ||
| 548 | - } | ||
| 549 | - return null; | ||
| 550 | - } | ||
| 551 | - | ||
| 552 | - function get_user(id) { | ||
| 553 | - for(var i=0,u;u=users[i++];){ | ||
| 554 | - if(u.id==id) | ||
| 555 | - return u; | ||
| 556 | - } | ||
| 557 | - return null; | ||
| 558 | - } | ||
| 559 | - | ||
| 560 | - $(document).on('submit', 'form', function () { | ||
| 561 | - return false; | ||
| 562 | - }); | ||
| 563 | - | ||
| 564 | - function convert_buss_data(rs) { | ||
| 565 | - var baseCode; | ||
| 566 | - //找到跟节点 | ||
| 567 | - $.each(rs, function () { | ||
| 568 | - if(this.upCode == 0){ | ||
| 569 | - baseCode=this.businessCode; | ||
| 570 | - return false; | ||
| 571 | - } | ||
| 572 | - }); | ||
| 573 | - if(!baseCode){ | ||
| 574 | - alert('大爷找不到根节点,数据有问题吧!!!'); | ||
| 575 | - return; | ||
| 576 | - } | ||
| 577 | - //提取二级节点 | ||
| 578 | - var secondMap={}; | ||
| 579 | - $.each(rs, function () { | ||
| 580 | - if(this.upCode==baseCode){ | ||
| 581 | - secondMap[this.businessCode] = { | ||
| 582 | - name: this.businessName, | ||
| 583 | - childs: [] | ||
| 584 | - }; | ||
| 585 | - } | ||
| 586 | - }); | ||
| 587 | - //分公司节点 | ||
| 588 | - $.each(rs, function () { | ||
| 589 | - if(secondMap[this.upCode]) | ||
| 590 | - secondMap[this.upCode].childs.push(this); | ||
| 591 | - }); | ||
| 592 | - | ||
| 593 | - //排序 | ||
| 594 | - for(var sid in secondMap){ | ||
| 595 | - secondMap[sid].childs.sort(naturalSort); | ||
| 596 | - } | ||
| 597 | - | ||
| 598 | - return secondMap; | ||
| 599 | - } | ||
| 600 | - | ||
| 601 | - var naturalSort=function (a, b) { | ||
| 602 | - return a.businessName.localeCompare(b.businessName); | ||
| 603 | - }; | ||
| 604 | - | ||
| 605 | - var groupBy = function (list, field) { | ||
| 606 | - var rs = {}, | ||
| 607 | - key; | ||
| 608 | - $.each(list, function () { | ||
| 609 | - key = this[field]; | ||
| 610 | - if (!rs[key]) | ||
| 611 | - rs[key] = []; | ||
| 612 | - | ||
| 613 | - rs[key].push(this); | ||
| 614 | - }); | ||
| 615 | - | ||
| 616 | - return rs; | ||
| 617 | - }; | ||
| 618 | -</script> | ||
| 619 | -</body> | 1 | +<!--<!DOCTYPE html>--> |
| 2 | +<html lang="zh-cn"> | ||
| 3 | + | ||
| 4 | +<head> | ||
| 5 | + <meta charset="UTF-8"> | ||
| 6 | + <script src="/metronic_v4.5.4/plugins/jquery.min.js"></script> | ||
| 7 | + <script src="/assets/js/common.js"></script> | ||
| 8 | + <script src="/assets/plugins/uk3.0/uikit.min.js"></script> | ||
| 9 | + <script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script> | ||
| 10 | + <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js"></script> | ||
| 11 | + <!-- EventProxy --> | ||
| 12 | + <script src="/assets/js/eventproxy.js"></script> | ||
| 13 | + <!-- art-template 模版引擎 --> | ||
| 14 | + <script src="/assets/plugins/template.js"></script> | ||
| 15 | + <script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | ||
| 16 | + <script src="/assets/plugins/ztree_v3/js/jquery.ztree.core.min.js"></script> | ||
| 17 | + <script src="/assets/plugins/ztree_v3/js/jquery.ztree.excheck.min.js"></script> | ||
| 18 | + <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/> | ||
| 19 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" /> | ||
| 20 | + <link rel="stylesheet" href="/assets/plugins/ztree_v3/css/zTreeStyle/zTreeStyle.css" /> | ||
| 21 | + <style> | ||
| 22 | + html,body{ | ||
| 23 | + height: 100%; | ||
| 24 | + } | ||
| 25 | + .ct_page{ | ||
| 26 | + padding: 25px 15px; | ||
| 27 | + height: 100%; | ||
| 28 | + height: calc(100% - 50px); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + .ct_cont{ | ||
| 32 | + height: calc(100% - 41px); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + .ct_cont>div>div.uk-card{ | ||
| 36 | + height: 99%; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + form .uk-inline{ | ||
| 40 | + width: calc(100% - 4px); | ||
| 41 | + margin-left: 2px; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + .ct-card-body{ | ||
| 45 | + overflow: auto; | ||
| 46 | + padding: 1px 1px 0 2px; | ||
| 47 | + height: calc(100% - 54px); | ||
| 48 | + position: relative; | ||
| 49 | + margin-top: -12px; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + .ct_li_desc{ | ||
| 53 | + color: #a8a8a8; | ||
| 54 | + font-size: 13px; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + .ct-card-body .uk-list-large{ | ||
| 58 | + font-size: 14px; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + .ct-card-body .uk-list-large>li{ | ||
| 62 | + cursor: default; | ||
| 63 | + padding-left: 20px; | ||
| 64 | + margin-top: 2px !important; | ||
| 65 | + padding-top: 17px !important; | ||
| 66 | + position: relative; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + .ct-card-body .uk-list-large>li:hover{ | ||
| 70 | + background: #edecec; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + .ct-card-body .uk-list-large>li.active{ | ||
| 74 | + background: #1e87f0 !important; | ||
| 75 | + color: white; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + .ct-card-body .uk-list-large>li.active>span.role-code{ | ||
| 79 | + color: #ffffff; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + .ct-card-body .uk-list-large.role-list>li:hover{ | ||
| 83 | + background: #fff494; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + .ct-card-body .uk-list-large>li.active .ct_li_desc{ | ||
| 87 | + color: #e6e6e6; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + .ct-card-body .uk-list-large>li>span.uk-badge{ | ||
| 91 | + position: absolute; | ||
| 92 | + top: 17px; | ||
| 93 | + right: 25px; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + .ct-card-body .uk-list-large>li>span.role-code{ | ||
| 97 | + padding: 4px 6px; | ||
| 98 | + color: #a8a8a8; | ||
| 99 | + margin-left: 5px; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + .top_title{ | ||
| 103 | + padding: 9px 0 5px 15px; | ||
| 104 | + border-bottom: 1px solid #ededed; | ||
| 105 | + border-left: 5px solid #FFC107; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + .top_title>.desc{ | ||
| 109 | + font-size: 13px; | ||
| 110 | + color: grey; | ||
| 111 | + margin-top: 3px; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + .left_menu_list{ | ||
| 115 | + overflow: auto; | ||
| 116 | + position: relative; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + .left_menu_list .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{ | ||
| 120 | + opacity: 0.6 !important; | ||
| 121 | + padding: 0 !important; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + ._company{ | ||
| 125 | + margin: 15px 0px; | ||
| 126 | + } | ||
| 127 | + ._company>h5{ | ||
| 128 | + margin-bottom: 10px; | ||
| 129 | + font-size: 15px; | ||
| 130 | + color: #6b6b6b; | ||
| 131 | + text-indent: 12px; | ||
| 132 | + } | ||
| 133 | + ._company>._fgs>label{ | ||
| 134 | + padding: 3px 12px 3px 10px; | ||
| 135 | + display: inline-block; | ||
| 136 | + border: 1px solid gainsboro; | ||
| 137 | + border-radius: 2px; | ||
| 138 | + margin: 5px; | ||
| 139 | + font-size: 14px; | ||
| 140 | + } | ||
| 141 | + ._company>._fgs>label.active{ | ||
| 142 | + background: #1e87f0; | ||
| 143 | + color: #fff; | ||
| 144 | + } | ||
| 145 | + ._company .uk-checkbox:checked:focus, | ||
| 146 | + .line_checkbox_list .uk-checkbox:checked:focus{ | ||
| 147 | + background-color: #1e87f0 !important; | ||
| 148 | + } | ||
| 149 | + .save_icon{ | ||
| 150 | + position: absolute; | ||
| 151 | + right: 2px; | ||
| 152 | + background: #bec4c9; | ||
| 153 | + font-size: 12px; | ||
| 154 | + padding: 2px 15px; | ||
| 155 | + color: #fff; | ||
| 156 | + box-shadow: 0 5px 15px rgba(0,0,0,0.08); | ||
| 157 | + cursor: pointer; | ||
| 158 | + } | ||
| 159 | + .save_icon:hover{ | ||
| 160 | + background: #FFC107; | ||
| 161 | + } | ||
| 162 | + .data_auth_list{ | ||
| 163 | + position: relative; | ||
| 164 | + } | ||
| 165 | + #user_authorize_wrap .top_title{ | ||
| 166 | + border-left: 5px solid #cacac8; | ||
| 167 | + } | ||
| 168 | + .xd_line_list{ | ||
| 169 | + height: 37%; | ||
| 170 | + padding: 7px; | ||
| 171 | + border-bottom: 1px solid #f2f2f2; | ||
| 172 | + overflow: auto; | ||
| 173 | + position: relative; | ||
| 174 | + } | ||
| 175 | + .xd_line_list>h5{ | ||
| 176 | + color: #858585; | ||
| 177 | + margin: 5px 5px 5px 0; | ||
| 178 | + font-size: 14px; | ||
| 179 | + } | ||
| 180 | + .sub_lines{ | ||
| 181 | + padding-left: 15px; | ||
| 182 | + } | ||
| 183 | + .sub_lines>span.line_btn { | ||
| 184 | + background: #00BCD4; | ||
| 185 | + color: #fff; | ||
| 186 | + padding: 4px 9px; | ||
| 187 | + display: inline-block; | ||
| 188 | + min-width: 68px; | ||
| 189 | + text-align: center; | ||
| 190 | + margin: 5px 2px; | ||
| 191 | + box-shadow: 0 5px 9px rgba(0,0,0,0.08); | ||
| 192 | + cursor: pointer; | ||
| 193 | + font-size: 14px; | ||
| 194 | + font-family: 微软雅黑; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + .sub_lines>span.line_btn.destroy{ | ||
| 198 | + background: #ff5c5c; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + .sub_lines>span.line_btn.destroy:hover{ | ||
| 202 | + background: #ff7373; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + .sub_lines>span.line_btn:hover{ | ||
| 206 | + background: #2dd7ed; | ||
| 207 | + } | ||
| 208 | + .add_line_icon{ | ||
| 209 | + cursor: pointer; | ||
| 210 | + padding: 2px 5px; | ||
| 211 | + border-radius: 5px; | ||
| 212 | + display: inline-block; | ||
| 213 | + } | ||
| 214 | + .add_line_icon>i{ | ||
| 215 | + vertical-align: top; | ||
| 216 | + margin-top: 3px; | ||
| 217 | + } | ||
| 218 | + .add_line_icon:hover{ | ||
| 219 | + background: #ededed; | ||
| 220 | + } | ||
| 221 | + .ct_pattern_form{ | ||
| 222 | + display: inline-block; | ||
| 223 | + } | ||
| 224 | + .xd_menu_grid{ | ||
| 225 | + padding: 25px 25px 0 25px; | ||
| 226 | + height: calc(63% - 91px); | ||
| 227 | + } | ||
| 228 | + .xd_menu_grid .uk-list{ | ||
| 229 | + border: 1px solid #ededed; | ||
| 230 | + height: calc(100% - 70px); | ||
| 231 | + overflow: auto; | ||
| 232 | + position: relative; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + .xd_menu_grid .uk-list>li{ | ||
| 236 | + margin: 5px 0 !important; | ||
| 237 | + padding: 10px 0 0 10px !important; | ||
| 238 | + font-size: 14px; | ||
| 239 | + } | ||
| 240 | + .top_tools{ | ||
| 241 | + position: absolute; | ||
| 242 | + top: 15px; | ||
| 243 | + right: 25px; | ||
| 244 | + } | ||
| 245 | + .ct_field { | ||
| 246 | + display: inline-block; | ||
| 247 | + width: 240px; | ||
| 248 | + } | ||
| 249 | + .ct_field>select,.ct_field>input{ | ||
| 250 | + width: calc(100% - 60px); | ||
| 251 | + } | ||
| 252 | + .line_checkbox_list{ | ||
| 253 | + margin-top: 15px; | ||
| 254 | + } | ||
| 255 | + .line_checkbox_list>.btn{ | ||
| 256 | + padding: 5px 7px; | ||
| 257 | + border-radius: 2px; | ||
| 258 | + display: inline-block; | ||
| 259 | + margin: 4px 9px; | ||
| 260 | + font-size: 14px; | ||
| 261 | + font-family: 微软雅黑; | ||
| 262 | + border: 1px solid #d9d9d9; | ||
| 263 | + width: 100px; | ||
| 264 | + overflow: hidden; | ||
| 265 | + text-overflow: ellipsis; | ||
| 266 | + white-space: nowrap; | ||
| 267 | + } | ||
| 268 | + .line_checkbox_list>.btn>input{ | ||
| 269 | + margin-right: 5px; | ||
| 270 | + } | ||
| 271 | + .line_checkbox_list>.btn.active{ | ||
| 272 | + background: #1e87f0; | ||
| 273 | + color: #fff; | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + .line_checkbox_list>.btn.destroy, | ||
| 277 | + .line_checkbox_list>.btn.destroy>input{ | ||
| 278 | + border-color: #ff9595; | ||
| 279 | + color: #ff5c5c; | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + .line_checkbox_list>.btn.destroy.active{ | ||
| 283 | + background: #ff5c5c; | ||
| 284 | + color: #fff; | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + .line_checkbox_list>.btn.destroy.active>input{ | ||
| 288 | + background-color: #ff5c5c !important; | ||
| 289 | + border-color: #ff5c5c !important; | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + #role_authorize_wrap .ztree *{ | ||
| 293 | + font-size: 14px; | ||
| 294 | + } | ||
| 295 | + #role_authorize_wrap .ztree li{ | ||
| 296 | + line-height: 21px; | ||
| 297 | + } | ||
| 298 | + .loading{ | ||
| 299 | + height: 100%; | ||
| 300 | + text-align: center; | ||
| 301 | + } | ||
| 302 | + .loading .uk-spinner{ | ||
| 303 | + margin-top: 200px; | ||
| 304 | + } | ||
| 305 | + .loading circle{ | ||
| 306 | + stroke: red; | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + #select_line_modal .uk-checkbox:checked { | ||
| 310 | + background-color: #1e87f0; | ||
| 311 | + } | ||
| 312 | + </style> | ||
| 313 | + | ||
| 314 | +</head> | ||
| 315 | + | ||
| 316 | +<body> | ||
| 317 | +<div class="loading"> | ||
| 318 | + <div uk-spinner></div> | ||
| 319 | +</div> | ||
| 320 | +<div class="ct_page" style="display: none;"> | ||
| 321 | + <h2 class="uk-heading-line uk-heading-bullet"><span>用户授权管理</span></h2> | ||
| 322 | + <div class="ct_cont uk-grid-small uk-child-width-expand" uk-grid> | ||
| 323 | + <div class="role_list uk-width-1-4 "> | ||
| 324 | + <div class="uk-card uk-card-default"> | ||
| 325 | + <form> | ||
| 326 | + <div class="uk-margin"> | ||
| 327 | + <div class="uk-inline" > | ||
| 328 | + </div> | ||
| 329 | + </div> | ||
| 330 | + </form> | ||
| 331 | + | ||
| 332 | + <div class="ct-card-body" > | ||
| 333 | + <ul class="uk-list uk-list-large uk-list-divider role-list"> | ||
| 334 | + </ul> | ||
| 335 | + </div> | ||
| 336 | + </div> | ||
| 337 | + </div> | ||
| 338 | + <div class="user_list uk-width-1-5 "> | ||
| 339 | + <div class="uk-card uk-card-default"> | ||
| 340 | + <form> | ||
| 341 | + <div class="uk-margin"> | ||
| 342 | + <div class="uk-inline" > | ||
| 343 | + </div> | ||
| 344 | + </div> | ||
| 345 | + </form> | ||
| 346 | + | ||
| 347 | + <div class="ct-card-body"> | ||
| 348 | + <ul class="uk-list uk-list-large user-list"> | ||
| 349 | + </ul> | ||
| 350 | + </div> | ||
| 351 | + </div> | ||
| 352 | + </div> | ||
| 353 | + <div class="auth_cont "> | ||
| 354 | + <div class="uk-card uk-card-default authorize_right_cont"> | ||
| 355 | + | ||
| 356 | + </div> | ||
| 357 | + </div> | ||
| 358 | + | ||
| 359 | + </div> | ||
| 360 | +</div> | ||
| 361 | + | ||
| 362 | +<script id="authorize-role-list-temp1" type="text/html"> | ||
| 363 | + {{each list as r i}} | ||
| 364 | + <li data-id="{{r.id}}" data-name="{{r.roleName}}" data-code="{{r.codeUp}}">{{r.roleName}} | ||
| 365 | + <span class="role-code">{{r.codeName}}</span> | ||
| 366 | + <div class="ct_li_desc">{{r.createDateStr}}</div> | ||
| 367 | + <span class="uk-badge">{{r.count}}</span> | ||
| 368 | + </li> | ||
| 369 | + {{/each}} | ||
| 370 | +</script> | ||
| 371 | +<script id="authorize-user-list-temp1" type="text/html"> | ||
| 372 | + {{each list as u i}} | ||
| 373 | + <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> | ||
| 374 | + {{/each}} | ||
| 375 | +</script> | ||
| 376 | +<script> | ||
| 377 | + var storage = window.localStorage; | ||
| 378 | + | ||
| 379 | + if (typeof String.prototype.startsWith != 'function') { | ||
| 380 | + String.prototype.startsWith = function (prefix){ | ||
| 381 | + return this.slice(0, prefix.length) === prefix; | ||
| 382 | + }; | ||
| 383 | + } | ||
| 384 | + var roles,users,role_users,modules,companyData,lineArray; | ||
| 385 | + | ||
| 386 | + var ep = EventProxy.create('query_roles', 'query_users', 'query_modules', 'query_company', 'query_line', function (rs, us, ms, cs, lines) { | ||
| 387 | + roles = rs; | ||
| 388 | + users = us; | ||
| 389 | + modules = ms; | ||
| 390 | + companyData = cs; | ||
| 391 | + lineArray=lines; | ||
| 392 | + role_users = {}; | ||
| 393 | + debugger | ||
| 394 | + for(var i=0,r;r=roles[i++];){ | ||
| 395 | + r.count=0; | ||
| 396 | + role_users[r.id]=[]; | ||
| 397 | + r.createDateStr=moment(r.createDate).format('YYYY-MM-DD HH:ss'); | ||
| 398 | + r.codeUp=r.codeName.toUpperCase(); | ||
| 399 | + for(var j=0,u;u=users[j++];){ | ||
| 400 | + if(u.roles.indexOf(r.id)!=-1){ | ||
| 401 | + r.count++; | ||
| 402 | + role_users[r.id].push(u); | ||
| 403 | + } | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + //渲染角色list | ||
| 407 | + render_role_list(roles); | ||
| 408 | + //渲染用户list | ||
| 409 | + render_user_list(users); | ||
| 410 | + | ||
| 411 | + $('.loading').remove(); | ||
| 412 | + $('.ct_page').show(); | ||
| 413 | + }); | ||
| 414 | + | ||
| 415 | + //角色点击 | ||
| 416 | + $('ul.role-list').on('click', 'li', roleClickHanlder); | ||
| 417 | + //用户点击 | ||
| 418 | + $('ul.user-list').on('click', 'li', userClickHanlder); | ||
| 419 | + | ||
| 420 | + | ||
| 421 | + function roleClickHanlder() { | ||
| 422 | + if($(this).hasClass('active') && $('ul.user-list>li.active').length==0) | ||
| 423 | + return; | ||
| 424 | + | ||
| 425 | + reset_dom(); | ||
| 426 | + $('ul.role-list>li.active').removeClass('active'); | ||
| 427 | + $(this).addClass('active'); | ||
| 428 | + //重新渲染用户list | ||
| 429 | + var id = $(this).data('id'); | ||
| 430 | + render_user_list(role_users[id]); | ||
| 431 | + //加载角色授权页面 | ||
| 432 | + $('.authorize_right_cont').load('/pages/permission/authorize_all/role_auth.html', function () { | ||
| 433 | + $('#role_authorize_wrap', this).trigger('init', {role: get_role(id), modules: modules, companyData: companyData}); | ||
| 434 | + }); | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + function userClickHanlder() { | ||
| 438 | + if($(this).hasClass('active')) | ||
| 439 | + return; | ||
| 440 | + | ||
| 441 | + reset_dom(); | ||
| 442 | + $('ul.user-list>li.active').removeClass('active'); | ||
| 443 | + $(this).addClass('active'); | ||
| 444 | + | ||
| 445 | + //加载用户授权页面 | ||
| 446 | + var id = $(this).data('id'); | ||
| 447 | + $('.authorize_right_cont').load('/pages/permission/authorize_all/user_auth.html', function () { | ||
| 448 | + $('#user_authorize_wrap', this).trigger('init', {user: get_user(id),lineArray:lineArray, companyData:companyData}); | ||
| 449 | + }); | ||
| 450 | + } | ||
| 451 | + | ||
| 452 | + //refresh-user | ||
| 453 | + $('.authorize_right_cont').on('refresh-user', function () { | ||
| 454 | + $('ul.user-list>li.active').removeClass('active').trigger('click'); | ||
| 455 | + }); | ||
| 456 | + | ||
| 457 | + function reset_dom() { | ||
| 458 | + $('#select_line_modal').remove(); | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | + //滚动条 | ||
| 462 | + $('.ct_page .uk-card .ct-card-body').perfectScrollbar({suppressScrollX: true}); | ||
| 463 | + | ||
| 464 | + //query all role | ||
| 465 | + var paramsRole = {}; | ||
| 466 | + paramsRole['codeName'] = 'ROLE_ADMIN'; | ||
| 467 | + var userId=storage.getItem("editUser"); | ||
| 468 | + $get('/user',{id_eq:userId}, function (rs) { | ||
| 469 | + ep.emit('query_roles', rs.content[0].roles); | ||
| 470 | + }); | ||
| 471 | + | ||
| 472 | + | ||
| 473 | + //query all user | ||
| 474 | + var paramsUser = {}; | ||
| 475 | + paramsRole['name'] = 'name'; | ||
| 476 | + $.get('/user/all_distinct',paramsUser, function (rs) { | ||
| 477 | + var userA={}; | ||
| 478 | + for(var i=0,u;u=rs[i++];){ | ||
| 479 | + if (u.id==userId){ | ||
| 480 | + discard_field(u); | ||
| 481 | + u.userNameUp=u.userName.toUpperCase(); | ||
| 482 | + u.lastLoginDateStr=moment(u.lastLoginDate).format('YYYY-MM-DD HH:ss'); | ||
| 483 | + userA[0]=u; | ||
| 484 | + } | ||
| 485 | + } | ||
| 486 | + ep.emit('query_users', userA); | ||
| 487 | + }); | ||
| 488 | + | ||
| 489 | + //query all modules | ||
| 490 | + $.get('/module/all_distinct', function (rs) { | ||
| 491 | + ep.emit('query_modules', rs); | ||
| 492 | + }); | ||
| 493 | + | ||
| 494 | + //query all company data | ||
| 495 | + $.get('/business/all', function (rs) { | ||
| 496 | + ep.emit('query_company', rs); | ||
| 497 | + }); | ||
| 498 | + | ||
| 499 | + //query all line | ||
| 500 | + $.get('/line/all', {'remove_ne': 1}, function (rs) { | ||
| 501 | + ep.emit('query_line', rs); | ||
| 502 | + }); | ||
| 503 | + | ||
| 504 | + function discard_field(u) { | ||
| 505 | + var array = []; | ||
| 506 | + $.each(u.roles, function () { | ||
| 507 | + array.push(this.id); | ||
| 508 | + }); | ||
| 509 | + u.roles = array; | ||
| 510 | + } | ||
| 511 | + | ||
| 512 | + function render_role_list(list) { | ||
| 513 | + var htmlStr = template('authorize-role-list-temp1', {list: list}); | ||
| 514 | + $('ul.role-list').html(htmlStr); | ||
| 515 | + up_scroll(); | ||
| 516 | + } | ||
| 517 | + | ||
| 518 | + | ||
| 519 | + function render_user_list(list) { | ||
| 520 | + var htmlStr = template('authorize-user-list-temp1', {list: list}); | ||
| 521 | + $('ul.user-list').html(htmlStr); | ||
| 522 | + up_scroll(); | ||
| 523 | + } | ||
| 524 | + | ||
| 525 | + function reset_role_list(){ | ||
| 526 | + var actives = $('ul.role-list>li.active'); | ||
| 527 | + if(actives.length > 0){ | ||
| 528 | + $('ul.role-list>li.active').removeClass('active'); | ||
| 529 | + render_user_list(users); | ||
| 530 | + $('.authorize_right_cont').empty(); | ||
| 531 | + } | ||
| 532 | + } | ||
| 533 | + | ||
| 534 | + function up_scroll() { | ||
| 535 | + $('.ct_page .uk-card .ct-card-body').perfectScrollbar('update'); | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + | ||
| 539 | + | ||
| 540 | + function get_role(id) { | ||
| 541 | + for(var i=0,r;r=roles[i++];){ | ||
| 542 | + if(r.id==id) | ||
| 543 | + return r; | ||
| 544 | + } | ||
| 545 | + return null; | ||
| 546 | + } | ||
| 547 | + | ||
| 548 | + function get_user(id) { | ||
| 549 | + for(var i=0,u;u=users[i++];){ | ||
| 550 | + if(u.id==id) | ||
| 551 | + return u; | ||
| 552 | + } | ||
| 553 | + return null; | ||
| 554 | + } | ||
| 555 | + | ||
| 556 | + $(document).on('submit', 'form', function () { | ||
| 557 | + return false; | ||
| 558 | + }); | ||
| 559 | + | ||
| 560 | + function convert_buss_data(rs) { | ||
| 561 | + var baseCode; | ||
| 562 | + //找到跟节点 | ||
| 563 | + $.each(rs, function () { | ||
| 564 | + if(this.upCode == 0){ | ||
| 565 | + baseCode=this.businessCode; | ||
| 566 | + return false; | ||
| 567 | + } | ||
| 568 | + }); | ||
| 569 | + if(!baseCode){ | ||
| 570 | + alert('大爷找不到根节点,数据有问题吧!!!'); | ||
| 571 | + return; | ||
| 572 | + } | ||
| 573 | + //提取二级节点 | ||
| 574 | + var secondMap={}; | ||
| 575 | + $.each(rs, function () { | ||
| 576 | + if(this.upCode==baseCode){ | ||
| 577 | + secondMap[this.businessCode] = { | ||
| 578 | + name: this.businessName, | ||
| 579 | + childs: [] | ||
| 580 | + }; | ||
| 581 | + } | ||
| 582 | + }); | ||
| 583 | + //分公司节点 | ||
| 584 | + $.each(rs, function () { | ||
| 585 | + if(secondMap[this.upCode]) | ||
| 586 | + secondMap[this.upCode].childs.push(this); | ||
| 587 | + }); | ||
| 588 | + | ||
| 589 | + //排序 | ||
| 590 | + for(var sid in secondMap){ | ||
| 591 | + secondMap[sid].childs.sort(naturalSort); | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + return secondMap; | ||
| 595 | + } | ||
| 596 | + | ||
| 597 | + var naturalSort=function (a, b) { | ||
| 598 | + return a.businessName.localeCompare(b.businessName); | ||
| 599 | + }; | ||
| 600 | + | ||
| 601 | + var groupBy = function (list, field) { | ||
| 602 | + var rs = {}, | ||
| 603 | + key; | ||
| 604 | + $.each(list, function () { | ||
| 605 | + key = this[field]; | ||
| 606 | + if (!rs[key]) | ||
| 607 | + rs[key] = []; | ||
| 608 | + | ||
| 609 | + rs[key].push(this); | ||
| 610 | + }); | ||
| 611 | + | ||
| 612 | + return rs; | ||
| 613 | + }; | ||
| 614 | +</script> | ||
| 615 | +</body> | ||
| 620 | </html> | 616 | </html> |
| 621 | \ No newline at end of file | 617 | \ No newline at end of file |
src/main/resources/static/pages/permission/user/main.html
| 1 | -<iframe src="authorize.html?origin=real_control_iframe" frameborder="0" style="height: 90%;width: 100%;"></iframe> | 1 | +<iframe src="/pages/permission/user/authorize.html?origin=real_control_iframe" frameborder="0" style="height: 90%;width: 100%;"></iframe> |
| 2 | <div class="form-actions"> | 2 | <div class="form-actions"> |
| 3 | <div class="row"> | 3 | <div class="row"> |
| 4 | <div class="col-md-offset-3 col-md-4"> | 4 | <div class="col-md-offset-3 col-md-4"> |
| 5 | - <!--<a href="main.html" class="btn green" ><i class="fa fa-check"></i> 上一步</a>--> | ||
| 6 | - <!--<button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>--> | ||
| 7 | - <!--<a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>--> | ||
| 8 | </div> | 5 | </div> |
| 9 | </div> | 6 | </div> |
| 10 | </div> | 7 | </div> |
| 11 | \ No newline at end of file | 8 | \ No newline at end of file |
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 | })(window); | 170 | })(window); |
| 171 | \ No newline at end of file | 171 | \ No newline at end of file |