Commit 49e7d85feb90b62a35a4f19f79ebf5b654604158

Authored by 潘钊
2 parents 0be39be5 c45e7392

Merge branch 'minhang' into qingpu

Showing 48 changed files with 6513 additions and 5609 deletions
src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -2,7 +2,9 @@ package com.bsth.controller.oil;
2 2  
3 3 import java.text.ParseException;
4 4 import java.text.SimpleDateFormat;
  5 +import java.util.ArrayList;
5 6 import java.util.Date;
  7 +import java.util.Iterator;
6 8 import java.util.List;
7 9 import java.util.Map;
8 10  
... ... @@ -44,14 +46,47 @@ public class YlbController extends BaseController<Ylb, Integer>{
44 46 * @return
45 47 */
46 48 @RequestMapping(value = "/obtain",method = RequestMethod.GET)
47   - public List<Map<String, Object>> obtain(@RequestParam Map<String, Object> map){
  49 + public Map<String, Object> obtain(@RequestParam Map<String, Object> map){
48 50 String rq=map.get("rq").toString();
49   - List<Map<String, Object>> list=yblService.obtain(rq);
  51 + Map<String, Object> list=yblService.obtain(rq);
50 52 System.out.println();
51 53 return list;
52 54 }
53 55  
54 56 /**
  57 + * 拆分油量
  58 + * @param map
  59 + * @return
  60 + */
  61 + @RequestMapping(value = "/sort",method = RequestMethod.GET)
  62 + public Map<String, Object> sort(@RequestParam Map<String, Object> map){
  63 + Map<String, Object> list=yblService.sort(map);
  64 + return list;
  65 + }
  66 +
  67 + /**
  68 + * 进场油量等于出场油量
  69 + * @param map
  70 + * @return
  71 + */
  72 + @RequestMapping(value = "/outAndIn",method = RequestMethod.GET)
  73 + public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map){
  74 + Map<String, Object> list=yblService.outAndIn(map);
  75 + return list;
  76 + }
  77 +
  78 + /**
  79 + * 核对油量(有加油没里程)
  80 + * @param map
  81 + * @return
  82 + */
  83 + @RequestMapping(value = "/checkYl",method = RequestMethod.GET)
  84 + public Map<String, Object> checkYl(@RequestParam Map<String, Object> map){
  85 + Map<String, Object> list=yblService.checkYl(map);
  86 + return list;
  87 + }
  88 +
  89 + /**
55 90 *
56 91 * @Title: list
57 92 * @Description: TODO(多条件分页查询)
... ...
src/main/java/com/bsth/controller/oil/YlxxbController.java
1 1 package com.bsth.controller.oil;
2 2  
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
3 6 import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
4 9 import org.springframework.web.bind.annotation.RestController;
5 10  
6 11 import com.bsth.controller.BaseController;
7 12 import com.bsth.entity.oil.Ylxxb;
  13 +import com.bsth.service.oil.YlxxbService;
  14 +import com.bsth.util.PageObject;
8 15  
9 16 @RestController
10 17 @RequestMapping("ylxxb")
11 18 public class YlxxbController extends BaseController<Ylxxb, Integer>{
12   -
  19 + @Autowired
  20 + private YlxxbService service;
  21 + @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
  22 + public PageObject<Ylxxb> pagequery(@RequestParam Map<String, Object> map){
  23 + PageObject<Ylxxb> pagequery=null;
  24 + map.put("curPage", map.get("page").toString());
  25 + map.put("pageData","10");
  26 + pagequery=service.Pagequery(map);
  27 + return pagequery;
  28 + }
  29 +
  30 +
  31 + /**
  32 + * 核对油量(有加油没里程)
  33 + * @param map
  34 + * @return
  35 + */
  36 + @RequestMapping(value = "/check",method = RequestMethod.GET)
  37 + public Map<String, Object> check(@RequestParam Map<String, Object> map){
  38 + Map<String, Object> list=service.checkJsy(map);
  39 + return list;
  40 + }
13 41 }
... ...
src/main/java/com/bsth/data/arrival/AnalyseData.java
... ... @@ -78,6 +78,9 @@ public class AnalyseData {
78 78 && curr.getTs() - prve.getTs() < SHIFT_TIME){
79 79 prve.setEnable(false);
80 80 }
  81 +// else if(curr.getInOut()){
  82 +// //curr.getTs() - prve.getTs() < 30000
  83 +// }
81 84 }
82 85 else{
83 86 //上下行的同名站,新走向的第一个出站信号开始有效
... ...
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
... ... @@ -51,7 +51,7 @@ public class ArrivalData_GPS implements CommandLineRunner{
51 51 @Override
52 52 public void run(String... arg0) throws Exception {
53 53 logger.info("ArrivalData_GPS,30,10");
54   - Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 10, TimeUnit.SECONDS);
  54 + //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 20, TimeUnit.SECONDS);
55 55 }
56 56  
57 57 @Component
... ...
src/main/java/com/bsth/data/arrival/DataLoader.java
... ... @@ -58,7 +58,7 @@ public class DataLoader {
58 58 PreparedStatement ps = null;
59 59 ResultSet rs = null;
60 60  
61   - String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts";
  61 + String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by create_date";
62 62 try{
63 63 long t = System.currentTimeMillis();
64 64  
... ...
src/main/java/com/bsth/data/directive/FirstScheduleCheckThread.java
... ... @@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Component;
10 10  
  11 +import com.bsth.data.match.Arrival2Schedule;
  12 +import com.bsth.data.match.ExpectArrivalEnd;
11 13 import com.bsth.data.schedule.DayOfSchedule;
12 14 import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 15 import com.bsth.service.directive.DirectiveService;
... ... @@ -63,6 +65,26 @@ public class FirstScheduleCheckThread extends Thread{
63 65 && Math.abs(first.getDfsjT() - t) < THREE_MINUTES){
64 66  
65 67 directiveService.send60Dispatch(first, dayOfSchedule.doneSum(first.getClZbh()), "定补@系统");
  68 + //期望完成出场班次时间
  69 + long endTime;
  70 +
  71 + if(first.getZdsj() != null)
  72 + endTime=first.getZdsjT() - 60000;
  73 + else
  74 + endTime=schList.get(1).getDfsjT() - 60000;
  75 +
  76 + ExpectArrivalEnd ead = new ExpectArrivalEnd()
  77 + ,ead2 = new ExpectArrivalEnd();
  78 + ead.setNbbm(car);
  79 + ead.setEndStation(first.getQdzCode());
  80 + ead.setEndTime(endTime);
  81 +
  82 + ead2.setNbbm(car);
  83 + ead2.setEndStation(first.getZdzCode());
  84 + ead2.setEndTime(endTime);
  85 +
  86 + Arrival2Schedule.addExpect(car, ead);
  87 + Arrival2Schedule.addExpect(car, ead2);
66 88 }
67 89 }
68 90 }
... ...
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
... ... @@ -51,13 +51,13 @@ public class GatewayHttpUtils {
51 51  
52 52 post.setEntity(new StringEntity(jsonStr, "utf-8"));
53 53  
54   - CloseableHttpResponse response = httpClient.execute(post);
55   -
56   - JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
57   - if(null != json && json.getInteger("errCode") == 0)
58   - code = 0;
59   - else
60   - logger.error("和网关http通讯失败,rs: " + json);
  54 +// CloseableHttpResponse response = httpClient.execute(post);
  55 +//
  56 +// JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
  57 +// if(null != json && json.getInteger("errCode") == 0)
  58 +// code = 0;
  59 +// else
  60 +// logger.error("和网关http通讯失败,rs: " + json);
61 61 }catch(Exception e){
62 62 logger.error("", e);
63 63 }finally {
... ...
src/main/java/com/bsth/data/match/Arrival2Schedule.java
... ... @@ -3,9 +3,7 @@ package com.bsth.data.match;
3 3 import java.text.SimpleDateFormat;
4 4 import java.util.ArrayList;
5 5 import java.util.Collections;
6   -import java.util.HashMap;
7 6 import java.util.List;
8   -import java.util.Map;
9 7 import java.util.Set;
10 8  
11 9 import org.slf4j.Logger;
... ... @@ -15,14 +13,18 @@ import org.springframework.context.ApplicationContext;
15 13 import org.springframework.context.ApplicationContextAware;
16 14 import org.springframework.stereotype.Component;
17 15  
  16 +import com.bsth.data.LineConfigData;
18 17 import com.bsth.data.arrival.ArrivalComparator;
19 18 import com.bsth.data.arrival.ArrivalData_GPS;
20 19 import com.bsth.data.arrival.ArrivalEntity;
21 20 import com.bsth.data.schedule.DayOfSchedule;
22 21 import com.bsth.data.schedule.ScheduleComparator;
  22 +import com.bsth.entity.realcontrol.LineConfig;
23 23 import com.bsth.entity.realcontrol.ScheduleRealInfo;
24 24 import com.bsth.service.directive.DirectiveService;
25 25 import com.bsth.websocket.handler.SendUtils;
  26 +import com.google.common.collect.ArrayListMultimap;
  27 +import com.google.common.collect.ListMultimap;
26 28  
27 29 /**
28 30 *
... ... @@ -38,13 +40,14 @@ public class Arrival2Schedule implements ApplicationContextAware {
38 40 private static DayOfSchedule dayOfSchedule;
39 41 private static SendUtils sendUtils;
40 42 private static DirectiveService directiveService;
  43 + private static LineConfigData lineConfigData;
41 44 private final static int ONE_MINUTE = 1000 * 60;
42 45 //定一个4小时的范围,基本能对正常班次进行容错。主要防止早上停车场GPS飘导致完成晚上的进场班次
43 46 private final static int FOUR_HOURS = 1000 * 60 * 60 * 4;
44 47  
45 48 private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class);
46 49  
47   - private static Map<String, ExpectArrivalEnd> expectMap = new HashMap<>();
  50 + private static ArrayListMultimap<String, ExpectArrivalEnd> expectMap = ArrayListMultimap.create();
48 51  
49 52 /**
50 53 *
... ... @@ -61,6 +64,8 @@ public class Arrival2Schedule implements ApplicationContextAware {
61 64  
62 65 public static class SchMatchThread extends Thread{
63 66 String nbbm;
  67 + LineConfig conf;
  68 +
64 69 public SchMatchThread(String nbbm){
65 70 this.nbbm = nbbm;
66 71 }
... ... @@ -73,7 +78,6 @@ public class Arrival2Schedule implements ApplicationContextAware {
73 78  
74 79 @Override
75 80 public void run() {
76   -
77 81 //班次列表
78 82 List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm);
79 83 //进出起终点数据
... ... @@ -82,6 +86,7 @@ public class Arrival2Schedule implements ApplicationContextAware {
82 86 if(schList.size() == 0 || arrList.size() == 0)
83 87 return;
84 88  
  89 + conf = lineConfigData.get(schList.get(0).getXlBm());
85 90 //排序
86 91 Collections.sort(schList, schComparator);
87 92 Collections.sort(arrList, arrComparator);
... ... @@ -113,8 +118,8 @@ public class Arrival2Schedule implements ApplicationContextAware {
113 118 if(sch.isDestroy())
114 119 continue;
115 120  
116   - //没有里程的不匹配
117   - if(sch.getBcsj() == null && sch.getJhlc() == null)
  121 + //线路配置出站既出场,并且没有里程的不匹配
  122 + if(conf.getOutConfig()==2 && sch.getBcsj() == null && sch.getJhlc() == null)
118 123 continue;
119 124  
120 125 list.add(sch);
... ... @@ -194,7 +199,15 @@ public class Arrival2Schedule implements ApplicationContextAware {
194 199 mr = new MatchResult();
195 200 mr.sch = sch;
196 201 mr.ts = inArr.getTs();
197   - mr.diff = inArr.getTs() - sch.getZdsjT();
  202 + //班次没有里程和运送时间的
  203 + if(sch.getZdsj() == null){
  204 + if(i < schList.size()-1)
  205 + mr.diff = inArr.getTs() - schList.get(i + 1).getDfsjT();
  206 + else
  207 + mr.diff = inArr.getTs() - sch.getDfsjT();
  208 + }
  209 + else
  210 + mr.diff = inArr.getTs() - sch.getZdsjT();
198 211 mr.success = dayOfSchedule.validEndTime(sch, inArr.getTs());
199 212 if(Math.abs(mr.diff) < FOUR_HOURS && mr.success)
200 213 mrs.add(mr);
... ... @@ -216,13 +229,8 @@ public class Arrival2Schedule implements ApplicationContextAware {
216 229 public void carOut(MatchResult mr){
217 230 ScheduleRealInfo sch = mr.sch;
218 231  
219   - if(expectMap.containsKey(nbbm)){
220   - ExpectArrivalEnd ead = expectMap.get(nbbm);
221   - if(mr.ts < ead.getEndTime())
222   - return;
223   - else
224   - expectMap.remove(nbbm);
225   - }
  232 + if(!isExpectOut(mr))
  233 + return;
226 234 //设置发车时间
227 235 sch.setFcsjActualAll(mr.ts);
228 236 //通知客户端
... ... @@ -231,8 +239,32 @@ public class Arrival2Schedule implements ApplicationContextAware {
231 239 dayOfSchedule.save(sch);
232 240 //车辆当前执行班次
233 241 dayOfSchedule.addExecPlan(sch);
  242 +
234 243 //期望车辆到达的终点
235   - expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts));
  244 + if(sch.getZdsj() != null)
  245 + expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts));
  246 + }
  247 +
  248 + /**
  249 + *
  250 + * @Title: isExpectOut
  251 + * @Description: TODO(是否是一个期望的出站匹配结果)
  252 + */
  253 + private boolean isExpectOut(MatchResult mr){
  254 + ScheduleRealInfo sch = mr.sch;
  255 + String nbbm = sch.getClZbh();
  256 + if(expectMap.containsKey(nbbm)){
  257 + List<ExpectArrivalEnd> eads = expectMap.get(nbbm);
  258 + for(ExpectArrivalEnd ead : eads){
  259 + if(sch.getQdzCode().equals(ead.getEndStation())
  260 + || mr.ts > ead.getEndTime()){
  261 + expectMap.removeAll(nbbm);
  262 + return true;
  263 + }
  264 + }
  265 + return false;
  266 + }
  267 + return true;
236 268 }
237 269  
238 270 /**
... ... @@ -243,15 +275,8 @@ public class Arrival2Schedule implements ApplicationContextAware {
243 275 public void carInStop(MatchResult mr){
244 276 ScheduleRealInfo sch = mr.sch;
245 277 String nbbm=sch.getClZbh();
246   - if(expectMap.containsKey(nbbm)){
247   - ExpectArrivalEnd ead = expectMap.get(nbbm);
248   - if(mr.ts < ead.getEndTime()
249   - && !mr.sch.getZdzCode().equals(ead.getEndStation())){
250   - return;
251   - }
252   - else
253   - expectMap.remove(nbbm);
254   - }
  278 + if(!isExpectIn(mr))
  279 + return;
255 280  
256 281 //如果是进停车场,并且实达时间差值大于 30 分钟,并且之前还有未完成班次。
257 282 if(sch.getBcType().equals("in") && Math.abs(mr.diff) > (1000 * 60 * 30)){
... ... @@ -289,6 +314,28 @@ public class Arrival2Schedule implements ApplicationContextAware {
289 314  
290 315 /**
291 316 *
  317 + * @Title: isExpectOut
  318 + * @Description: TODO(是否是一个期望的进站匹配结果)
  319 + */
  320 + private boolean isExpectIn(MatchResult mr){
  321 + ScheduleRealInfo sch = mr.sch;
  322 + String nbbm = sch.getClZbh();
  323 + if(expectMap.containsKey(nbbm)){
  324 + List<ExpectArrivalEnd> eads = expectMap.get(nbbm);
  325 + for(ExpectArrivalEnd ead : eads){
  326 + if(sch.getZdzCode().equals(ead.getEndStation())
  327 + || mr.ts > ead.getEndTime()){
  328 + expectMap.removeAll(nbbm);
  329 + return true;
  330 + }
  331 + }
  332 + return false;
  333 + }
  334 + return true;
  335 + }
  336 +
  337 + /**
  338 + *
292 339 * @Title: correctFirstSignal
293 340 * @Description: TODO(检查并纠正首班出场到离站)
294 341 */
... ... @@ -367,6 +414,7 @@ public class Arrival2Schedule implements ApplicationContextAware {
367 414 sendUtils = arg0.getBean(SendUtils.class);
368 415 dayOfSchedule = arg0.getBean(DayOfSchedule.class);
369 416 directiveService = arg0.getBean(DirectiveService.class);
  417 + lineConfigData = arg0.getBean(LineConfigData.class);
370 418 }
371 419  
372 420 /**
... ... @@ -376,6 +424,10 @@ public class Arrival2Schedule implements ApplicationContextAware {
376 424 * @param @param nbbm
377 425 */
378 426 public void removeExpect(String nbbm){
379   - expectMap.remove(nbbm);
  427 + expectMap.removeAll(nbbm);
  428 + }
  429 +
  430 + public static void addExpect(String nbbm, ExpectArrivalEnd eae){
  431 + expectMap.put(nbbm, eae);
380 432 }
381 433 }
... ...
src/main/java/com/bsth/data/match/ExpectArrivalEnd.java
... ... @@ -5,7 +5,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
5 5 /**
6 6 *
7 7 * @ClassName: ExpectArrivalEnd
8   - * @Description: TODO(期望车辆在某个时间段到达某个终点........)
  8 + * @Description: TODO(期望车辆在某个时间段到达某个终点或 发出某个起点........)
9 9 * @author PanZhao
10 10 * @date 2016年11月2日 下午8:04:43
11 11 *
... ... @@ -29,6 +29,7 @@ public class ExpectArrivalEnd {
29 29 }
30 30 return ead;
31 31 }
  32 +
32 33  
33 34 public String getNbbm() {
34 35 return nbbm;
... ...
src/main/java/com/bsth/entity/oil/Ylb.java
1 1 package com.bsth.entity.oil;
2 2  
  3 +import java.text.DecimalFormat;
3 4 import java.util.Date;
4 5  
5 6 import javax.persistence.Entity;
6 7 import javax.persistence.GeneratedValue;
7 8 import javax.persistence.Id;
8 9 import javax.persistence.Table;
  10 +import javax.persistence.Transient;
9 11  
10 12 import org.springframework.format.annotation.DateTimeFormat;
11 13  
  14 +import com.bsth.data.BasicData;
  15 +
12 16 @Entity
13 17 @Table(name = "bsth_c_ylb")
14 18 public class Ylb {
... ... @@ -22,23 +26,23 @@ public class Ylb {
22 26 private String fgsdm;
23 27 private String nbbm;
24 28 private String jsy;
25   - private Double czlc;
26   - private Double jzlc;
27   - private Double czyl;
28   - private Double jzyl;
  29 + private Double czlc=0.0;
  30 + private Double jzlc=0.0;
  31 + private Double czyl=0.0;
  32 + private Double jzyl=0.0;
29 33 private Double jzl;
30 34 private int sfkt;
31 35 private String jhsj;
32   - private Double yh;
33   - private Double sh;
  36 + private Double yh=0.0;
  37 + private Double sh=0.0;
34 38 private String shyy;
35   - private Double zlc;
  39 + private Double zlc=0.0;
36 40 private int yhlx;
37 41 private String rylx;
38   - private Double ns;
39   - private Double fyylc;
40   - private Double jhzlc;
41   - private Double jhfyylc;
  42 + private Double ns=0.0;
  43 + private Double fyylc=0.0;
  44 + private Double jhzlc=0.0;
  45 + private Double jhfyylc=0.0;
42 46 private int jhzbc;
43 47 private int jhbc;
44 48 private int sjzbc;
... ... @@ -49,6 +53,16 @@ public class Ylb {
49 53 private int nylx;
50 54 //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
51 55 private int jcsx;
  56 +
  57 + @Transient
  58 + private String bglyh;
  59 +
  60 + @Transient
  61 + private String xlname;
  62 +
  63 + @Transient
  64 + private String gsname;
  65 +
52 66  
53 67 public Integer getId() {
54 68 return id;
... ... @@ -254,5 +268,38 @@ public class Ylb {
254 268 public void setJcsx(int jcsx){
255 269 this.jcsx=jcsx;
256 270 }
  271 +
  272 + public String getBglyh() {
  273 + if(this.getZlc()==0){
  274 + return "0.00";
  275 + }else{
  276 + DecimalFormat df = new DecimalFormat("0.00");
  277 + return df.format(this.getYh()/this.getZlc()*100);
  278 + }
  279 + }
  280 +
  281 + public void setBglyh(String bglyh) {
  282 + this.bglyh = bglyh;
  283 + }
  284 +
  285 + public String getXlname() {
  286 + return BasicData.lineCode2NameMap.get(this.xlbm);
  287 + }
  288 +
  289 + public void setXlname(String xlname) {
  290 + this.xlname = xlname;
  291 + }
  292 +
  293 + public String getGsname() {
  294 + return BasicData.nbbm2CompanyCodeMap.get(this.nbbm);
  295 + }
  296 +
  297 + public void setGsname(String gsname) {
  298 + this.gsname = gsname;
  299 + }
  300 +
  301 +
  302 +
  303 +
257 304  
258 305 }
... ...
src/main/java/com/bsth/entity/oil/Ylxxb.java
... ... @@ -6,6 +6,9 @@ import javax.persistence.Entity;
6 6 import javax.persistence.GeneratedValue;
7 7 import javax.persistence.Id;
8 8 import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +
  11 +import org.springframework.format.annotation.DateTimeFormat;
9 12  
10 13 @Entity
11 14 @Table(name = "bsth_c_ylxxb")
... ... @@ -13,6 +16,7 @@ public class Ylxxb {
13 16 @Id
14 17 @GeneratedValue
15 18 private Integer id;
  19 + @DateTimeFormat(pattern="yyyy-MM-dd")
16 20 private Date yyrq;
17 21 private Date jlrq;
18 22 private String nbbm;
... ... @@ -29,6 +33,12 @@ public class Ylxxb {
29 33 private String xgr;
30 34 private String fromgsdm;
31 35 private int nylx;
  36 + @Transient
  37 + private String ldgh;
  38 + //0为接口数据,1为手工输入
  39 + private int jylx=0;
  40 +
  41 +
32 42 public Integer getId() {
33 43 return id;
34 44 }
... ... @@ -131,6 +141,18 @@ public class Ylxxb {
131 141 public void setNylx(int nylx) {
132 142 this.nylx = nylx;
133 143 }
  144 + public String getLdgh() {
  145 + return ldgh;
  146 + }
  147 + public void setLdgh(String ldgh) {
  148 + this.ldgh = ldgh;
  149 + }
  150 + public int getJylx() {
  151 + return jylx;
  152 + }
  153 + public void setJylx(int jylx) {
  154 + this.jylx = jylx;
  155 + }
134 156  
135 157  
136 158  
... ...
src/main/java/com/bsth/filter/ResourceFilter.java
1   -package com.bsth.filter;
2   -
3   -import java.io.File;
4   -import java.io.IOException;
5   -
6   -import javax.servlet.FilterChain;
7   -import javax.servlet.ServletException;
8   -import javax.servlet.http.HttpServletRequest;
9   -import javax.servlet.http.HttpServletResponse;
10   -
11   -import org.apache.commons.lang3.StringUtils;
12   -
13   -import com.bsth.util.RequestUtils;
14   -
15   -/**
16   - *
17   - * @ClassName: ResourceFilter
18   - * @Description: TODO(HTML片段过滤器)
19   - * @author PanZhao
20   - * @date 2016年3月19日 下午10:10:11
21   - *
22   - */
23   -public class ResourceFilter extends BaseFilter {
24   -
25   - String[] params = new String[]{"no"};
26   -
27   - @Override
28   - public void doFilter(HttpServletRequest request,
29   - HttpServletResponse response, FilterChain chain)
30   - throws IOException, ServletException {
31   -
32   - String uri = request.getRequestURI();
33   - int len = uri.length();
34   - if (RequestUtils.isAjaxRequest(request) ||
35   - !uri.substring(len - 5, len).equals(".html")) {
36   - super.doFilter(request, response, chain);
37   - } else {
38   -
39   - String fPath = this.getClass().getResource("/").getPath()
40   - + "static/" + uri;
41   -
42   - File f = new File(fPath);
43   -
44   -
45   - if (f.exists() && f.isFile() ){
46   - request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response);;
47   - }else
48   - response.sendRedirect("/");
49   - }
50   - }
51   -
52   - /**
53   - * 拼接参数
54   - * @param request
55   - * @return
56   - */
57   - public String joinParam(HttpServletRequest request){
58   -
59   - StringBuilder sb = new StringBuilder();
60   -
61   - String v
62   - ,url = request.getRequestURI();
63   - for(String p : params){
64   - v = request.getParameter(p);
65   - if(!StringUtils.isEmpty(v))
66   - sb.append("&" + p + "=" + v);
67   - }
68   -
69   - if(sb.length() > 0)
70   - url += "?" + sb.substring(1, sb.length());
71   - return url;
72   - }
73   -}
  1 +package com.bsth.filter;
  2 +
  3 +import java.io.File;
  4 +import java.io.IOException;
  5 +
  6 +import javax.servlet.FilterChain;
  7 +import javax.servlet.ServletException;
  8 +import javax.servlet.http.HttpServletRequest;
  9 +import javax.servlet.http.HttpServletResponse;
  10 +
  11 +import org.apache.commons.lang3.StringUtils;
  12 +
  13 +import com.bsth.util.RequestUtils;
  14 +
  15 +/**
  16 + *
  17 + * @ClassName: ResourceFilter
  18 + * @Description: TODO(HTML片段过滤器)
  19 + * @author PanZhao
  20 + * @date 2016年3月19日 下午10:10:11
  21 + *
  22 + */
  23 +public class ResourceFilter extends BaseFilter {
  24 +
  25 + String[] params = new String[]{"no"};
  26 +
  27 + @Override
  28 + public void doFilter(HttpServletRequest request,
  29 + HttpServletResponse response, FilterChain chain)
  30 + throws IOException, ServletException {
  31 +
  32 + String uri = request.getRequestURI();
  33 + int len = uri.length();
  34 + if (RequestUtils.isAjaxRequest(request) ||
  35 + !uri.substring(len - 5, len).equals(".html")) {
  36 + super.doFilter(request, response, chain);
  37 + } else {
  38 +
  39 + String fPath = this.getClass().getResource("/").getPath()
  40 + + "static/" + uri;
  41 +
  42 + File f = new File(fPath);
  43 +
  44 +
  45 + if (f.exists() && f.isFile() ){
  46 + request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response);;
  47 + }else
  48 + response.sendRedirect("/");
  49 + }
  50 + }
  51 +
  52 + /**
  53 + * 拼接参数
  54 + * @param request
  55 + * @return
  56 + */
  57 + public String joinParam(HttpServletRequest request){
  58 +
  59 + StringBuilder sb = new StringBuilder();
  60 +
  61 + String v
  62 + ,url = request.getRequestURI();
  63 + for(String p : params){
  64 + v = request.getParameter(p);
  65 + if(!StringUtils.isEmpty(v))
  66 + sb.append("&" + p + "=" + v);
  67 + }
  68 +
  69 + if(sb.length() > 0)
  70 + url += "?" + sb.substring(1, sb.length());
  71 + return url;
  72 + }
  73 +}
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
1 1 package com.bsth.repository.oil;
2 2  
  3 +import java.util.Date;
3 4 import java.util.List;
  5 +import java.util.Map;
4 6  
5 7 import org.springframework.data.jpa.repository.Modifying;
6 8 import org.springframework.data.jpa.repository.Query;
... ... @@ -19,7 +21,9 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
19 21 */
20 22 @Transactional
21 23 @Modifying
22   - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)-to_days(rq)=1",nativeQuery=true)
  24 + @Query(value="SELECT a.* FROM bsth_c_ylb a where to_days(?1)-to_days(a.rq)=1"
  25 + + " and jcsx=(select max(b.jcsx) from bsth_c_ylb b where a.nbbm=b.nbbm and "
  26 + + " to_days(?1)-to_days(b.rq)=1 ) group by nbbm",nativeQuery=true)
23 27 List<Ylb> obtainYlbefore(String rq);
24 28  
25 29 /**
... ... @@ -31,4 +35,15 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
31 35 @Modifying
32 36 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true)
33 37 List<Ylb> obtainYl(String rq);
  38 +
  39 +
  40 + /**
  41 + * 查询当天总的加注量和总里程
  42 + * @param rq
  43 + * @return
  44 + */
  45 + @Transactional
  46 + @Modifying
  47 + @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc from bsth_c_ylb where nbbm=?1 and rq=?2",nativeQuery=true)
  48 + List<Object[]> sumLcYl(String nbbm,Date rq);
34 49 }
... ...
src/main/java/com/bsth/repository/oil/YlxxbRepository.java
... ... @@ -21,4 +21,10 @@ public interface YlxxbRepository extends BaseRepository&lt;Ylxxb, Integer&gt;{
21 21 @Modifying
22 22 @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?)=to_days(yyrq)",nativeQuery=true)
23 23 List<Ylxxb> obtainYlxx(String rq);
  24 +
  25 + @Transactional
  26 + @Modifying
  27 + @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nbbm =?2 and jylx=1",nativeQuery=true)
  28 + List<Ylxxb> obtainYlxx2(String rq,String nbbm);
  29 +
24 30 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -23,6 +23,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
23 23 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)")
24 24 List<ScheduleRealInfo> queryUserInfo(String line,String date);
25 25  
  26 + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)")
  27 + List<ScheduleRealInfo> queryUserInfo2(String line,String date);
  28 +
26 29 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")
27 30 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);
28 31  
... ... @@ -57,6 +60,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
57 60 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') order by bcs")
58 61 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date);
59 62  
  63 + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and bcType='normal' order by bcs")
  64 + List<ScheduleRealInfo> queryListWaybill2(String jName,String clZbh,String lpName,String date);
  65 +
60 66 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
61 67 List<ScheduleRealInfo> scheduleDaily(String line,String date);
62 68  
... ... @@ -72,7 +78,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
72 78 @Query(value = "delete ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
73 79 void deleteByLineCodeAndDate(String xlBm, String schDate);
74 80  
75   - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
  81 + @Query(value="select s from ScheduleRealInfo s where (s.xlBm = ?1 or s.xlBm is not null) and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
76 82 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
77 83  
78 84 @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where (s.xlBm = ?1 or s.xlBm is not null) and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh ORDER BY xlBm,clZbh,realExecDate,fcsjActual")
... ...
src/main/java/com/bsth/service/oil/YlbService.java
1 1 package com.bsth.service.oil;
2 2  
3   -import java.util.List;
4 3 import java.util.Map;
5 4  
6 5 import com.bsth.entity.oil.Ylb;
7 6 import com.bsth.service.BaseService;
8 7  
9 8 public interface YlbService extends BaseService<Ylb, Integer>{
10   - List<Map<String, Object>> obtain(String rq);
  9 + Map<String, Object> obtain(String rq);
  10 +
  11 + Map<String, Object> sort(Map<String, Object> map);
  12 +
  13 + Map<String, Object> outAndIn(Map<String, Object> map);
  14 +
  15 + Map<String, Object> checkYl(Map<String, Object> map);
11 16 }
... ...
src/main/java/com/bsth/service/oil/YlxxbService.java
1 1 package com.bsth.service.oil;
2 2  
  3 +import java.util.Map;
  4 +
3 5 import com.bsth.entity.oil.Ylxxb;
4 6 import com.bsth.service.BaseService;
  7 +import com.bsth.util.PageObject;
5 8  
6 9 public interface YlxxbService extends BaseService<Ylxxb, Integer>{
  10 + PageObject<Ylxxb> Pagequery(Map<String, Object> map) ;
  11 +
  12 + Map<String, Object> checkJsy(Map<String, Object> map);
7 13  
8 14 }
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
1 1 package com.bsth.service.oil.impl;
2 2  
  3 +import java.text.DecimalFormat;
  4 +import java.text.ParseException;
  5 +import java.text.SimpleDateFormat;
3 6 import java.util.ArrayList;
  7 +import java.util.Date;
4 8 import java.util.HashMap;
  9 +import java.util.Iterator;
5 10 import java.util.List;
6 11 import java.util.Map;
7 12  
  13 +import javax.transaction.Transactional;
  14 +
8 15 import org.slf4j.Logger;
9 16 import org.slf4j.LoggerFactory;
10 17 import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.data.domain.Sort;
  19 +import org.springframework.data.domain.Sort.Direction;
11 20 import org.springframework.stereotype.Service;
12 21  
13 22 import com.bsth.common.ResponseCode;
  23 +import com.bsth.entity.oil.Cyl;
14 24 import com.bsth.entity.oil.Ylb;
15 25 import com.bsth.entity.oil.Ylxxb;
  26 +import com.bsth.entity.search.CustomerSpecs;
  27 +import com.bsth.repository.oil.CylRepository;
16 28 import com.bsth.repository.oil.YlbRepository;
17 29 import com.bsth.repository.oil.YlxxbRepository;
18 30 import com.bsth.service.impl.BaseServiceImpl;
19 31 import com.bsth.service.oil.YlbService;
  32 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
20 33 import com.github.abel533.echarts.code.Y;
21 34  
22 35 @Service
... ... @@ -27,43 +40,356 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
27 40 @Autowired
28 41 YlxxbRepository ylxxbRepository;
29 42  
  43 + @Autowired
  44 + CylRepository cylRepository;
  45 +
  46 + @Autowired
  47 + ScheduleRealInfoService scheduleRealInfoService;
  48 +
30 49 Logger logger = LoggerFactory.getLogger(this.getClass());
  50 +
  51 +
  52 + /**
  53 + * 获取进存油信息
  54 + * @Transactional 回滚事物
  55 + */
  56 + @Transactional
31 57 @Override
32   - public List<Map<String, Object>> obtain(String rq) {
  58 + public Map<String, Object> obtain(String rq) {
  59 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  60 + //保留两位小数
  61 + DecimalFormat df = new DecimalFormat("#.00");
33 62 // TODO Auto-generated method stub
34   - List<Map<String, Object>> list=new ArrayList<Map<String, Object>>();
  63 + Map<String, Object> newMap=new HashMap<String,Object>();
35 64 //当天YLB信息
36 65 List<Ylb> ylList=repository.obtainYl(rq);
37 66 //当天YLXXB信息
38 67 List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);
39   -
40   - //前一天YLB信息
  68 + //前一天所有车辆最后进场班次信息
41 69 List<Ylb> ylListBe=repository.obtainYlbefore(rq);
  70 + //从排班表中计算出行驶的总里程
  71 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("1024",rq);
  72 +
  73 + for(int x=0;x<listpb.size();x++){
  74 +
  75 + Map<String, Object> map=listpb.get(x);
42 76  
43   - for(int i=0;i<ylList.size();i++){
44   - Map<String, Object> map = new HashMap<String, Object>();
45   - Ylb t=ylList.get(i);
46   - Double jzl=0.0;
47   - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
48   - for(int j=0;j<ylxxList.size();j++){
49   - Ylxxb ylxxb= ylxxList.get(j);
50   - if(t.getNbbm().equals(ylxxb.getNbbm()) && t.getJsy().equals(ylxxb.getJsy())){
51   - jzl+=ylxxb.getJzl();
  77 + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  78 + Ylb t=new Ylb();
  79 + for(int k=0;k<ylList.size();k++){
  80 + Ylb t1=ylList.get(k);
  81 + if(t1.getNbbm().equals(map.get("clZbh").toString())
  82 + &&t1.getJsy().equals(map.get("jGh").toString())
  83 + &&t1.getXlbm().equals(map.get("xlBm").toString()))
  84 + {
  85 + t=t1;
52 86 }
53 87 }
54   - t.setJzl(jzl);
  88 + try {
  89 + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  90 + if(map.get("seqNumber").toString().equals("1")){
  91 + for (int y = 0; y < ylListBe.size(); y++) {
  92 + Ylb ylb=ylListBe.get(y);
  93 + if(map.get("clZbh").toString().equals(ylb.getNbbm())){
  94 + t.setCzyl(ylb.getJzyl());
  95 + break;
  96 + }else{
  97 + t.setCzyl(0.0);
  98 + }
  99 + }
  100 + }
  101 +
  102 + Double jzl=0.0;
  103 + //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
  104 + for(int j=0;j<ylxxList.size();j++){
  105 + Ylxxb ylxxb= ylxxList.get(j);
  106 + if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){
  107 + jzl+=ylxxb.getJzl();
  108 + }
  109 + }
  110 + t.setJzl(jzl);
  111 + t.setNbbm(map.get("clZbh").toString());
  112 + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
  113 + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
  114 + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
  115 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  116 + t.setSsgsdm(map.get("company").toString());
  117 + t.setRq(sdf.parse(rq));
  118 + repository.save(t);
  119 + newMap.put("status", ResponseCode.SUCCESS);
  120 + } catch (ParseException e) {
  121 + // TODO Auto-generated catch block
  122 + newMap.put("status", ResponseCode.ERROR);
  123 + e.printStackTrace();
  124 + }
  125 + }
  126 +
  127 + return newMap;
  128 + }
  129 +
  130 +
  131 + /**
  132 + * 进场等于出场
  133 + */
  134 + @Transactional
  135 + @Override
  136 + public Map<String, Object> outAndIn(Map<String, Object> map){
  137 + // TODO Auto-generated method stub
  138 + Map<String, Object> newMap=new HashMap<String,Object>();
  139 + Map<String, Object> map2=new HashMap<String,Object>();
  140 + String rq=map.get("rq").toString();
  141 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  142 +
  143 + try {
  144 + map.put("rq_eq", sdf.parse(rq));
  145 + } catch (ParseException e1) {
  146 + // TODO Auto-generated catch block
  147 + e1.printStackTrace();
  148 + }
  149 + //获取车辆存油信息
  150 + List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
  151 + //指定日期YLB信息
  152 + Iterator<Ylb> iterator= repository.findAll(new CustomerSpecs<Ylb>(map)).iterator();
  153 + while(iterator.hasNext()){
  154 + Ylb ylb=iterator.next();
  155 + //判断是否已经计算过
  156 + if(newMap.get("nbbm"+ylb.getNbbm())==null){
  157 + String nbbm_eq=ylb.getNbbm();
  158 + Date rq_eq=ylb.getRq();
  159 + //得到一天总的加油和里程(根据车,时间)
  160 + List<Object[]> sumList=repository.sumLcYl(nbbm_eq, rq_eq);
  161 + //保存总的加油量
  162 + Double jzl=Double.valueOf(sumList.get(0)[0].toString());
  163 + //保存总的里程
  164 + Double zlc=Double.valueOf(sumList.get(0)[1].toString());
  165 + //保留两位小数
  166 + DecimalFormat df = new DecimalFormat("#.00");
  167 + Double zyl=0.0;
  168 + Double nextJzyl=0.0;
  169 +
  170 + //保存已经计算过的车辆,相同车辆编号的车不在计算
  171 + newMap.put("nbbm"+ylb.getNbbm(), ylb.getNbbm());
  172 +
  173 + //查询指定车辆,设置进、存、耗油量
  174 + map.remove("nbbm_eq");
  175 + map.put("nbbm_eq", ylb.getNbbm());
  176 + Iterator<Ylb> iterator2= repository.findAll(new CustomerSpecs<Ylb>(map),new Sort(Direction.ASC, "jcsx")).iterator();
  177 + while(iterator2.hasNext()){
  178 + try{
  179 + Ylb t = iterator2.next();
  180 + if(t.getJcsx()==1){
  181 + //进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量
  182 + Double yl=t.getCzyl();
  183 + Double jcyl=t.getCzyl();
  184 + zyl=jcyl+jzl-yl;
  185 + Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc)));
  186 + t.setYh(yh);
  187 + nextJzyl=t.getJzl()+t.getCzyl()-yh;
  188 + t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  189 + }else{
  190 + t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
  191 + Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc)));
  192 + t.setYh(yh);
  193 + nextJzyl=t.getJzl()+nextJzyl-yh;
  194 + t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  195 + }
  196 +
  197 + repository.save(t);
  198 + //设置存油量
  199 + Cyl cyl=null;
  200 + boolean fage=false;
  201 + for(int z=0;z<cylList.size();z++){
  202 + cyl=cylList.get(z);
  203 + if(t.getNbbm().equals(cyl.getNbbm())){
  204 + cyl.setCyl(t.getJzyl());
  205 + cyl.setUpdatetime(t.getRq());
  206 + fage=true;
  207 + break;
  208 + }
  209 + }
  210 +
  211 + if(fage){
  212 + cylRepository.save(cyl);
  213 + }else{
  214 + cyl=new Cyl();
  215 + cyl.setNbbm(t.getNbbm());
  216 + cyl.setCyl(t.getJzyl());
  217 + cyl.setGsdm(t.getSsgsdm());
  218 + cyl.setUpdatetime(t.getRq());
  219 + cylRepository.save(cyl);
  220 + }
  221 +
  222 +
  223 + map2.put("status", ResponseCode.SUCCESS);
  224 + }catch(Exception e){
  225 + map2.put("status", ResponseCode.ERROR);
  226 + logger.error("save erro.", e);
  227 + }
  228 + }
  229 +
  230 +
  231 + }
  232 + }
  233 +
  234 + return map2;
  235 + }
  236 +
  237 + /**
  238 + * 拆分
  239 + */
  240 + @Transactional
  241 + @Override
  242 + public Map<String, Object> sort(Map<String, Object> map) {
  243 + // TODO Auto-generated method stub
  244 + Map<String, Object> newMap = new HashMap<String, Object>();
  245 + //获取车辆存油信息
  246 + List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
  247 + int id=Integer.parseInt(map.get("id").toString());
  248 + //最后存油量
  249 + Double yl=Double.parseDouble(map.get("jzyl").toString());
  250 + Ylb ylb=repository.findOne(id);
  251 + String nbbm_eq=ylb.getNbbm();
  252 + Date rq_eq=ylb.getRq();
  253 + //得到一天总的加油和里程(根据车,时间)
  254 + List<Object[]> sumList=repository.sumLcYl(nbbm_eq, rq_eq);
  255 + //保存总的加油量
  256 + Double jzl=Double.valueOf(sumList.get(0)[0].toString());
  257 + //保存总的里程
  258 + Double zlc=Double.valueOf(sumList.get(0)[1].toString());
  259 + map.put("nbbm_eq", nbbm_eq);
  260 + map.put("rq_eq",rq_eq);
  261 + Iterator<Ylb> iterator= repository.findAll(new CustomerSpecs<Ylb>(map),new Sort(Direction.ASC, "jcsx")).iterator();
  262 + //根据jcyl排序1为该车当日第一个出场,出场油量为前一天的存油
  263 + //保留两位小数
  264 + DecimalFormat df = new DecimalFormat("#.00");
  265 + Double zyl=0.0;
  266 + Double nextJzyl=0.0;
  267 + //车的,进,出油量及耗油
  268 + while(iterator.hasNext()){
55 269 try{
  270 + Ylb t = iterator.next();
  271 + if(t.getJcsx()==1){
  272 + Double jcyl=t.getCzyl();
  273 + zyl=jcyl+jzl-yl;
  274 + Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc)));
  275 + t.setYh(yh);
  276 + nextJzyl=t.getJzl()+t.getCzyl()-yh;
  277 + t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  278 + }else{
  279 + if(t.getZlc()!=0){
  280 + t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
  281 + Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc)));
  282 + t.setYh(yh);
  283 + nextJzyl=t.getJzl()+nextJzyl-yh;
  284 + t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  285 + }
  286 +
  287 + }
56 288 repository.save(t);
57   - map.put("status", ResponseCode.SUCCESS);
58   - map.put("t", t);
59   - list.add(map);
  289 +
  290 + //设置存油量
  291 + Cyl cyl=null;
  292 + boolean fage=false;
  293 + for(int z=0;z<cylList.size();z++){
  294 + cyl=cylList.get(z);
  295 + if(t.getNbbm().equals(cyl.getNbbm())){
  296 + cyl.setCyl(t.getJzyl());
  297 + cyl.setUpdatetime(t.getRq());
  298 + fage=true;
  299 + break;
  300 + }
  301 + }
  302 + if(fage){
  303 + cylRepository.save(cyl);
  304 + }else{
  305 + cyl=new Cyl();
  306 + cyl.setNbbm(t.getNbbm());
  307 + cyl.setCyl(t.getJzyl());
  308 + cyl.setGsdm(t.getSsgsdm());
  309 + cyl.setUpdatetime(t.getRq());
  310 + cylRepository.save(cyl);
  311 + }
  312 +
  313 + newMap.put("status", ResponseCode.SUCCESS);
60 314 }catch(Exception e){
61   - map.put("status", ResponseCode.ERROR);
  315 + newMap.put("status", ResponseCode.ERROR);
62 316 logger.error("save erro.", e);
63   - list.add(map);
64 317 }
65 318 }
66   - return list;
  319 + return newMap;
67 320 }
68 321  
  322 + /**
  323 + * 核对,有加注没里程
  324 + * @param map
  325 + * @return
  326 + */
  327 + @Transactional
  328 + @Override
  329 + public Map<String, Object> checkYl(Map<String, Object> map) {
  330 + Map<String, Object> newMap=new HashMap<String,Object>();
  331 + // TODO Auto-generated method stub
  332 + try{
  333 + //获取车辆存油信息
  334 + List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
  335 + String rq=map.get("rq").toString();
  336 + List<Ylb> ylbList=repository.obtainYl(rq);
  337 + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq);
  338 + for (int i = 0; i < ylxxbList.size(); i++) {
  339 + Boolean fage=true;
  340 + Ylxxb y1=ylxxbList.get(i);
  341 + for(int y=0;y<ylbList.size();y++){
  342 + Ylb y2=ylbList.get(y);
  343 + if(y1.getNbbm().equals(y2.getNbbm())){
  344 + fage=false;
  345 + break;
  346 + }
  347 + }
  348 +
  349 + if(fage){
  350 + Ylb t=new Ylb();
  351 + t.setNbbm(y1.getNbbm());
  352 + t.setRq(y1.getYyrq());
  353 + t.setJsy(y1.getJsy());
  354 + t.setJzl(y1.getJzl());
  355 + t.setSsgsdm(y1.getGsdm());
  356 + t.setXlbm("1024");
  357 + repository.save(t);
  358 +
  359 + //设置存油量
  360 + Cyl cyl=null;
  361 + boolean status=false;
  362 + for(int z=0;z<cylList.size();z++){
  363 + cyl=cylList.get(z);
  364 + if(t.getNbbm().equals(cyl.getNbbm())){
  365 + cyl.setCyl(cyl.getCyl()+t.getJzl());
  366 + cyl.setUpdatetime(t.getRq());
  367 + status=true;
  368 + break;
  369 + }
  370 + }
  371 + if(status){
  372 + cylRepository.save(cyl);
  373 + }else{
  374 + cyl=new Cyl();
  375 + cyl.setNbbm(t.getNbbm());
  376 + cyl.setCyl(t.getJzl());
  377 + cyl.setGsdm(t.getSsgsdm());
  378 + cyl.setUpdatetime(t.getRq());
  379 + cylRepository.save(cyl);
  380 + }
  381 +
  382 +
  383 + }
  384 + }
  385 + newMap.put("status", ResponseCode.SUCCESS);
  386 + }catch(Exception e){
  387 + newMap.put("status", ResponseCode.ERROR);
  388 + logger.error("save erro.", e);
  389 + }
  390 +
  391 + return newMap;
  392 + }
  393 +
  394 +
69 395 }
... ...
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
1 1 package com.bsth.service.oil.impl;
2 2  
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.ArrayList;
  6 +import java.util.HashMap;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
3 13 import org.springframework.stereotype.Service;
4 14  
  15 +import com.bsth.common.ResponseCode;
  16 +import com.bsth.entity.oil.Ylb;
5 17 import com.bsth.entity.oil.Ylxxb;
  18 +import com.bsth.entity.search.CustomerSpecs;
  19 +import com.bsth.repository.oil.YlbRepository;
  20 +import com.bsth.repository.oil.YlxxbRepository;
6 21 import com.bsth.service.impl.BaseServiceImpl;
7 22 import com.bsth.service.oil.YlxxbService;
  23 +import com.bsth.util.PageHelper;
  24 +import com.bsth.util.PageObject;
8 25  
9 26 @Service
10 27 public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements YlxxbService
11 28 {
  29 + Logger logger = LoggerFactory.getLogger(this.getClass());
  30 + @Autowired
  31 + YlxxbRepository repository;
  32 + @Autowired
  33 + YlbRepository ylbRepository;
  34 +
  35 + @Override
  36 + public PageObject<Ylxxb> Pagequery(Map<String, Object> map) {
  37 + String rq=map.get("yyrq").toString();
  38 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  39 + try {
  40 + map.put("yyrq_eq", sdf.parseObject(rq));
  41 + } catch (ParseException e) {
  42 + // TODO Auto-generated catch block
  43 + e.printStackTrace();
  44 + }
  45 + //根具条件查询指定日期Ylxxb的数据
  46 + List<Ylxxb> iterator=repository.findAll(new CustomerSpecs<Ylxxb>(map));
  47 + map.remove("yyrq_eq");
  48 + try {
  49 + map.put("rq_eq", sdf.parse(rq));
  50 + } catch (ParseException e) {
  51 + // TODO Auto-generated catch block
  52 + e.printStackTrace();
  53 + }
  54 + //根具条件查询指定日期Ylb的数据
  55 + List<Ylb> ylbIterator=(List<Ylb>) ylbRepository.findAll(new CustomerSpecs<Ylb>(map));
  56 + List<Ylxxb> list=new ArrayList<Ylxxb>();
  57 + for (int i = 0; i < iterator.size(); i++) {
  58 + Ylxxb y1=iterator.get(i);
  59 + boolean fage=true;
  60 + String ldgh="";
  61 + for (int j = 0; j < ylbIterator.size(); j++) {
  62 + Ylb y2 = ylbIterator.get(j);
  63 + if(y1.getNbbm().equals(y2.getNbbm())){
  64 + if(y1.getJsy().equals(y2.getJsy())){
  65 + fage=false;
  66 + }
  67 + ldgh +=y2.getJsy()+"/";
  68 + }
  69 + }
  70 + if(fage){
  71 + y1.setLdgh(ldgh);
  72 + list.add(y1);
  73 + }
  74 + }
  75 +
  76 + PageHelper pageHelper = new PageHelper(list.size(), map);
  77 + pageHelper.getMap();
  78 + PageObject<Ylxxb> pageObject=pageHelper.getPageObject();
  79 + pageObject.setDataList(list);
  80 + return pageObject;
  81 + }
  82 +
  83 + @Override
  84 + public Map<String, Object> checkJsy(Map<String, Object> map) {
  85 + Map<String, Object> newMap=new HashMap<String,Object>();
  86 + // TODO Auto-generated method stub
  87 + try {
  88 + int id=Integer.parseInt(map.get("id").toString());
  89 + String jsy=map.get("jsy").toString();
  90 + Ylxxb ylxxb=repository.findOne(id);
  91 + ylxxb.setJsy(jsy);
  92 + repository.save(ylxxb);
  93 + newMap.put("status", ResponseCode.SUCCESS);
  94 + }catch(Exception e){
  95 + newMap.put("status", ResponseCode.ERROR);
  96 + logger.error("save erro.", e);
  97 + }
  98 + return newMap;
  99 + }
12 100  
13 101 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -113,6 +113,9 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
113 113  
114 114 List<ScheduleRealInfo> realScheduleList(String line,String date);
115 115  
  116 +
  117 + List<Map<String,Object>> yesterdayDataList(String line,String date);
  118 +
116 119 List<Map<String,Object>> yesterdayDataList(String line);
117 120  
118 121 Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs);
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -509,7 +509,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
509 509  
510 510 @Override
511 511 public List<ScheduleRealInfo> queryUserInfo(String line, String date) {
512   - return scheduleRealInfoRepository.queryUserInfo(line, date);
  512 + return scheduleRealInfoRepository.queryUserInfo2(line, date);
513 513 }
514 514 /**
515 515 *
... ... @@ -1165,7 +1165,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1165 1165 @Override
1166 1166 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1167 1167 String lpName,String date) {
1168   - return scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date);
  1168 + return scheduleRealInfoRepository.queryListWaybill2(jName,clZbh,lpName,date);
1169 1169 }
1170 1170  
1171 1171 @Override
... ... @@ -1467,9 +1467,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1467 1467 }
1468 1468  
1469 1469  
1470   - public List<Map<String,Object>> yesterdayDataList(String line) {
  1470 + public List<Map<String,Object>> yesterdayDataList(String line,String date) {
1471 1471 //前一天日期
1472   - String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
  1472 +// String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
  1473 +// String date = "2016-09-20";
1473 1474 List<Map<String,Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
1474 1475 List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1475 1476 for(ScheduleRealInfo scheduleRealInfo:list){
... ... @@ -1609,4 +1610,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1609 1610 rs.put("ts", list);
1610 1611 return rs;
1611 1612 }
  1613 +
  1614 + @Override
  1615 + public List<Map<String, Object>> yesterdayDataList(String line) {
  1616 + // TODO Auto-generated method stub
  1617 + return null;
  1618 + }
  1619 +
1612 1620 }
... ...
src/main/java/com/bsth/service/schedule/rules/strategy/IStrategy.java
1   -package com.bsth.service.schedule.rules.strategy;
2   -
3   -import com.bsth.entity.Line;
4   -import com.bsth.entity.schedule.CarConfigInfo;
5   -import com.bsth.entity.schedule.EmployeeConfigInfo;
6   -import com.bsth.entity.schedule.TTInfo;
7   -import com.bsth.entity.schedule.TTInfoDetail;
8   -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
9   -import com.google.common.collect.Multimap;
10   -
11   -import java.util.Date;
12   -import java.util.List;
13   -import java.util.Map;
14   -
15   -/**
16   - * 获取数据的策略。
17   - */
18   -public interface IStrategy {
19   -
20   - /**
21   - * 获取线路信息。
22   - * @param xlId 线路id
23   - * @return
24   - */
25   - Line getLine(Integer xlId);
26   -
27   - /**
28   - * 获取指定线路下,可用的时刻表。
29   - * @param xlId 线路id
30   - * @return 时刻表
31   - */
32   - List<TTInfo> getTTInfo(Integer xlId);
33   -
34   - /**
35   - * 获取指定线路的时刻表的明细。
36   - * @param xlId 线路id
37   - * @return
38   - */
39   - List<TTInfoDetail> getTTInfoDetail(Integer xlId);
40   -
41   - /**
42   - * 获取指定线路下,可用的排班规则。
43   - * @param xlId
44   - * @return
45   - */
46   - Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId);
47   -
48   - /**
49   - * 获取指定线路下,日期与路牌与时刻明细对应的Map。
50   - * @param xlId 线路id
51   - * @param fromDate 开始日期
52   - * @param toDate 结束日期
53   - * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value
54   - */
55   - Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(Integer xlId, Date fromDate, Date toDate);
56   -
57   - /**
58   - * 获取指定线路下,车辆配置与车辆信息对应的Map。
59   - * @param xlId 线路id
60   - * @return 车辆配置id为key,具体车辆配置信息为value。
61   - */
62   - Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId);
63   -
64   - /**
65   - * 获取指定线路下,人员配置与人员对应的Map。
66   - * @param xlId 线路id
67   - * @return 人员配置id为key,具体人员配置信息为value。
68   - */
69   - Map<Long, EmployeeConfigInfo> getEmployeeConfigMaps(Integer xlId);
70   -}
  1 +package com.bsth.service.schedule.rules.strategy;
  2 +
  3 +import com.bsth.entity.Line;
  4 +import com.bsth.entity.schedule.CarConfigInfo;
  5 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  6 +import com.bsth.entity.schedule.TTInfo;
  7 +import com.bsth.entity.schedule.TTInfoDetail;
  8 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  9 +import com.google.common.collect.Multimap;
  10 +
  11 +import java.util.Date;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * 获取数据的策略。
  17 + */
  18 +public interface IStrategy {
  19 +
  20 + /**
  21 + * 获取线路信息。
  22 + * @param xlId 线路id
  23 + * @return
  24 + */
  25 + Line getLine(Integer xlId);
  26 +
  27 + /**
  28 + * 获取指定线路下,可用的时刻表。
  29 + * @param xlId 线路id
  30 + * @return 时刻表
  31 + */
  32 + List<TTInfo> getTTInfo(Integer xlId);
  33 +
  34 + /**
  35 + * 获取指定线路的时刻表的明细。
  36 + * @param xlId 线路id
  37 + * @return
  38 + */
  39 + List<TTInfoDetail> getTTInfoDetail(Integer xlId);
  40 +
  41 + /**
  42 + * 获取指定线路下,可用的排班规则。
  43 + * @param xlId
  44 + * @return
  45 + */
  46 + Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId);
  47 +
  48 + /**
  49 + * 获取指定线路下,日期与路牌与时刻明细对应的Map。
  50 + * @param xlId 线路id
  51 + * @param fromDate 开始日期
  52 + * @param toDate 结束日期
  53 + * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value
  54 + */
  55 + Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(Integer xlId, Date fromDate, Date toDate);
  56 +
  57 + /**
  58 + * 获取指定线路下,车辆配置与车辆信息对应的Map。
  59 + * @param xlId 线路id
  60 + * @return 车辆配置id为key,具体车辆配置信息为value。
  61 + */
  62 + Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId);
  63 +
  64 + /**
  65 + * 获取指定线路下,人员配置与人员对应的Map。
  66 + * @param xlId 线路id
  67 + * @return 人员配置id为key,具体人员配置信息为value。
  68 + */
  69 + Map<Long, EmployeeConfigInfo> getEmployeeConfigMaps(Integer xlId);
  70 +}
... ...
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
... ... @@ -3,6 +3,7 @@ package com.bsth.websocket.handler;
3 3 import java.io.IOException;
4 4 import java.util.ArrayList;
5 5 import java.util.HashMap;
  6 +import java.util.Iterator;
6 7 import java.util.List;
7 8 import java.util.Map;
8 9 import java.util.Set;
... ... @@ -83,7 +84,7 @@ public class RealControlSocketHandler implements WebSocketHandler {
83 84 default:
84 85 break;
85 86 }
86   - System.out.println(msg);
  87 + logger.info(msg.getPayload().toString());
87 88 }
88 89  
89 90 @Override
... ... @@ -145,22 +146,23 @@ public class RealControlSocketHandler implements WebSocketHandler {
145 146 * @param message
146 147 */
147 148 public synchronized void sendMessageToLine(String lineCode, String msg) {
148   - //Set<String> uids = BasicData.lineCode2SocketUserMap.get(lineCode);
149   - //if(null == uids || uids.size() == 0)
150   - // return;
151 149  
152 150 TextMessage message = new TextMessage(msg.getBytes());
153 151  
154   - List<WebSocketSession> sessList = listenMap.get(lineCode);
  152 + Iterator<WebSocketSession> iterator = listenMap.get(lineCode).iterator();
155 153  
156   - for (WebSocketSession user : sessList) {
  154 + WebSocketSession user;
  155 + while(iterator.hasNext()){
  156 + user = iterator.next();
157 157 try {
158 158 if (user.isOpen()) {
159 159 user.sendMessage(message);
160 160 }
161   - } catch (IOException e) {
  161 + } catch (Exception e) {
  162 + logger.error("sendMessageToLine error ...."+msg);
162 163 logger.error("sendMessageToLine error ....", e);
163 164 }
  165 +
164 166 }
165 167 }
166 168 }
... ...
src/main/resources/application-dev.properties
... ... @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
8 8 spring.jpa.database= MYSQL
9 9 spring.jpa.show-sql= true
10 10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11   -spring.datasource.url= jdbc:mysql://127.0.0.1:3306/qp_control
  11 +spring.datasource.url= jdbc:mysql://192.168.168.201:3306/mh_control
12 12 spring.datasource.username= root
13   -spring.datasource.password= panzhao
  13 +spring.datasource.password= 123456
14 14 #DATASOURCE
15 15 spring.datasource.max-active=100
16 16 spring.datasource.max-idle=8
... ...
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   - "colors": "^1.1.2",
14   - "eventproxy": "^0.3.4",
15   - "uglify-js": "^2.6.2"
16   - }
17   -}
  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 + "colors": "^1.1.2",
  14 + "eventproxy": "^0.3.4",
  15 + "uglify-js": "^2.6.2"
  16 + }
  17 +}
... ...
src/main/resources/ms-jdbc.properties
... ... @@ -4,6 +4,6 @@
4 4 #ms.mysql.password= 123456
5 5  
6 6 ms.mysql.driver= com.mysql.jdbc.Driver
7   -ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8
  7 +ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8
8 8 ms.mysql.username= root
9   -ms.mysql.password= panzhao
  9 +ms.mysql.password= 123456
... ...
src/main/resources/static/assets/js/eventproxy.js
1   -/*global define*/
2   -!(function (name, definition) {
3   - // Check define
4   - var hasDefine = typeof define === 'function',
5   - // Check exports
6   - hasExports = typeof module !== 'undefined' && module.exports;
7   -
8   - if (hasDefine) {
9   - // AMD Module or CMD Module
10   - define('eventproxy_debug', function () {return function () {};});
11   - define(['eventproxy_debug'], definition);
12   - } else if (hasExports) {
13   - // Node.js Module
14   - module.exports = definition(require('debug')('eventproxy'));
15   - } else {
16   - // Assign to common namespaces or simply the global object (window)
17   - this[name] = definition();
18   - }
19   -})('EventProxy', function (debug) {
20   - debug = debug || function () {};
21   -
22   - /*!
23   - * refs
24   - */
25   - var SLICE = Array.prototype.slice;
26   - var CONCAT = Array.prototype.concat;
27   - var ALL_EVENT = '__all__';
28   -
29   - /**
30   - * EventProxy. An implementation of task/event based asynchronous pattern.
31   - * A module that can be mixed in to *any object* in order to provide it with custom events.
32   - * You may `bind` or `unbind` a callback function to an event;
33   - * `trigger`-ing an event fires all callbacks in succession.
34   - * Examples:
35   - * ```js
36   - * var render = function (template, resources) {};
37   - * var proxy = new EventProxy();
38   - * proxy.assign("template", "l10n", render);
39   - * proxy.trigger("template", template);
40   - * proxy.trigger("l10n", resources);
41   - * ```
42   - */
43   - var EventProxy = function () {
44   - if (!(this instanceof EventProxy)) {
45   - return new EventProxy();
46   - }
47   - this._callbacks = {};
48   - this._fired = {};
49   - };
50   -
51   - /**
52   - * Bind an event, specified by a string name, `ev`, to a `callback` function.
53   - * Passing __ALL_EVENT__ will bind the callback to all events fired.
54   - * Examples:
55   - * ```js
56   - * var proxy = new EventProxy();
57   - * proxy.addListener("template", function (event) {
58   - * // TODO
59   - * });
60   - * ```
61   - * @param {String} eventname Event name.
62   - * @param {Function} callback Callback.
63   - */
64   - EventProxy.prototype.addListener = function (ev, callback) {
65   - debug('Add listener for %s', ev);
66   - this._callbacks[ev] = this._callbacks[ev] || [];
67   - this._callbacks[ev].push(callback);
68   - return this;
69   - };
70   - /**
71   - * `addListener` alias, `bind`
72   - */
73   - EventProxy.prototype.bind = EventProxy.prototype.addListener;
74   - /**
75   - * `addListener` alias, `on`
76   - */
77   - EventProxy.prototype.on = EventProxy.prototype.addListener;
78   - /**
79   - * `addListener` alias, `subscribe`
80   - */
81   - EventProxy.prototype.subscribe = EventProxy.prototype.addListener;
82   -
83   - /**
84   - * Bind an event, but put the callback into head of all callbacks.
85   - * @param {String} eventname Event name.
86   - * @param {Function} callback Callback.
87   - */
88   - EventProxy.prototype.headbind = function (ev, callback) {
89   - debug('Add listener for %s', ev);
90   - this._callbacks[ev] = this._callbacks[ev] || [];
91   - this._callbacks[ev].unshift(callback);
92   - return this;
93   - };
94   -
95   - /**
96   - * Remove one or many callbacks.
97   - *
98   - * - If `callback` is null, removes all callbacks for the event.
99   - * - If `eventname` is null, removes all bound callbacks for all events.
100   - * @param {String} eventname Event name.
101   - * @param {Function} callback Callback.
102   - */
103   - EventProxy.prototype.removeListener = function (eventname, callback) {
104   - var calls = this._callbacks;
105   - if (!eventname) {
106   - debug('Remove all listeners');
107   - this._callbacks = {};
108   - } else {
109   - if (!callback) {
110   - debug('Remove all listeners of %s', eventname);
111   - calls[eventname] = [];
112   - } else {
113   - var list = calls[eventname];
114   - if (list) {
115   - var l = list.length;
116   - for (var i = 0; i < l; i++) {
117   - if (callback === list[i]) {
118   - debug('Remove a listener of %s', eventname);
119   - list[i] = null;
120   - }
121   - }
122   - }
123   - }
124   - }
125   - return this;
126   - };
127   - /**
128   - * `removeListener` alias, unbind
129   - */
130   - EventProxy.prototype.unbind = EventProxy.prototype.removeListener;
131   -
132   - /**
133   - * Remove all listeners. It equals unbind()
134   - * Just add this API for as same as Event.Emitter.
135   - * @param {String} event Event name.
136   - */
137   - EventProxy.prototype.removeAllListeners = function (event) {
138   - return this.unbind(event);
139   - };
140   -
141   - /**
142   - * Bind the ALL_EVENT event
143   - */
144   - EventProxy.prototype.bindForAll = function (callback) {
145   - this.bind(ALL_EVENT, callback);
146   - };
147   -
148   - /**
149   - * Unbind the ALL_EVENT event
150   - */
151   - EventProxy.prototype.unbindForAll = function (callback) {
152   - this.unbind(ALL_EVENT, callback);
153   - };
154   -
155   - /**
156   - * Trigger an event, firing all bound callbacks. Callbacks are passed the
157   - * same arguments as `trigger` is, apart from the event name.
158   - * Listening for `"all"` passes the true event name as the first argument.
159   - * @param {String} eventname Event name
160   - * @param {Mix} data Pass in data
161   - */
162   - EventProxy.prototype.trigger = function (eventname, data) {
163   - var list, ev, callback, i, l;
164   - var both = 2;
165   - var calls = this._callbacks;
166   - debug('Emit event %s with data %j', eventname, data);
167   - while (both--) {
168   - ev = both ? eventname : ALL_EVENT;
169   - list = calls[ev];
170   - if (list) {
171   - for (i = 0, l = list.length; i < l; i++) {
172   - if (!(callback = list[i])) {
173   - list.splice(i, 1);
174   - i--;
175   - l--;
176   - } else {
177   - var args = [];
178   - var start = both ? 1 : 0;
179   - for (var j = start; j < arguments.length; j++) {
180   - args.push(arguments[j]);
181   - }
182   - callback.apply(this, args);
183   - }
184   - }
185   - }
186   - }
187   - return this;
188   - };
189   -
190   - /**
191   - * `trigger` alias
192   - */
193   - EventProxy.prototype.emit = EventProxy.prototype.trigger;
194   - /**
195   - * `trigger` alias
196   - */
197   - EventProxy.prototype.fire = EventProxy.prototype.trigger;
198   -
199   - /**
200   - * Bind an event like the bind method, but will remove the listener after it was fired.
201   - * @param {String} ev Event name
202   - * @param {Function} callback Callback
203   - */
204   - EventProxy.prototype.once = function (ev, callback) {
205   - var self = this;
206   - var wrapper = function () {
207   - callback.apply(self, arguments);
208   - self.unbind(ev, wrapper);
209   - };
210   - this.bind(ev, wrapper);
211   - return this;
212   - };
213   -
214   - var later = (typeof setImmediate !== 'undefined' && setImmediate) ||
215   - (typeof process !== 'undefined' && process.nextTick) || function (fn) {
216   - setTimeout(fn, 0);
217   - };
218   -
219   - /**
220   - * emitLater
221   - * make emit async
222   - */
223   - EventProxy.prototype.emitLater = function () {
224   - var self = this;
225   - var args = arguments;
226   - later(function () {
227   - self.trigger.apply(self, args);
228   - });
229   - };
230   -
231   - /**
232   - * Bind an event, and trigger it immediately.
233   - * @param {String} ev Event name.
234   - * @param {Function} callback Callback.
235   - * @param {Mix} data The data that will be passed to calback as arguments.
236   - */
237   - EventProxy.prototype.immediate = function (ev, callback, data) {
238   - this.bind(ev, callback);
239   - this.trigger(ev, data);
240   - return this;
241   - };
242   - /**
243   - * `immediate` alias
244   - */
245   - EventProxy.prototype.asap = EventProxy.prototype.immediate;
246   -
247   - var _assign = function (eventname1, eventname2, cb, once) {
248   - var proxy = this;
249   - var argsLength = arguments.length;
250   - var times = 0;
251   - var flag = {};
252   -
253   - // Check the arguments length.
254   - if (argsLength < 3) {
255   - return this;
256   - }
257   -
258   - var events = SLICE.call(arguments, 0, -2);
259   - var callback = arguments[argsLength - 2];
260   - var isOnce = arguments[argsLength - 1];
261   -
262   - // Check the callback type.
263   - if (typeof callback !== "function") {
264   - return this;
265   - }
266   - debug('Assign listener for events %j, once is %s', events, !!isOnce);
267   - var bind = function (key) {
268   - var method = isOnce ? "once" : "bind";
269   - proxy[method](key, function (data) {
270   - proxy._fired[key] = proxy._fired[key] || {};
271   - proxy._fired[key].data = data;
272   - if (!flag[key]) {
273   - flag[key] = true;
274   - times++;
275   - }
276   - });
277   - };
278   -
279   - var length = events.length;
280   - for (var index = 0; index < length; index++) {
281   - bind(events[index]);
282   - }
283   -
284   - var _all = function (event) {
285   - if (times < length) {
286   - return;
287   - }
288   - if (!flag[event]) {
289   - return;
290   - }
291   - var data = [];
292   - for (var index = 0; index < length; index++) {
293   - data.push(proxy._fired[events[index]].data);
294   - }
295   - if (isOnce) {
296   - proxy.unbindForAll(_all);
297   - }
298   - debug('Events %j all emited with data %j', events, data);
299   - callback.apply(null, data);
300   - };
301   - proxy.bindForAll(_all);
302   - };
303   -
304   - /**
305   - * Assign some events, after all events were fired, the callback will be executed once.
306   - *
307   - * Examples:
308   - * ```js
309   - * proxy.all(ev1, ev2, callback);
310   - * proxy.all([ev1, ev2], callback);
311   - * proxy.all(ev1, [ev2, ev3], callback);
312   - * ```
313   - * @param {String} eventname1 First event name.
314   - * @param {String} eventname2 Second event name.
315   - * @param {Function} callback Callback, that will be called after predefined events were fired.
316   - */
317   - EventProxy.prototype.all = function (eventname1, eventname2, callback) {
318   - var args = CONCAT.apply([], arguments);
319   - args.push(true);
320   - _assign.apply(this, args);
321   - return this;
322   - };
323   - /**
324   - * `all` alias
325   - */
326   - EventProxy.prototype.assign = EventProxy.prototype.all;
327   -
328   - /**
329   - * Assign the only one 'error' event handler.
330   - * @param {Function(err)} callback
331   - */
332   - EventProxy.prototype.fail = function (callback) {
333   - var that = this;
334   -
335   - that.once('error', function () {
336   - that.unbind();
337   - // put all arguments to the error handler
338   - // fail(function(err, args1, args2, ...){})
339   - callback.apply(null, arguments);
340   - });
341   - return this;
342   - };
343   -
344   - /**
345   - * A shortcut of ep#emit('error', err)
346   - */
347   - EventProxy.prototype.throw = function () {
348   - var that = this;
349   - that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
350   - };
351   -
352   - /**
353   - * Assign some events, after all events were fired, the callback will be executed first time.
354   - * Then any event that predefined be fired again, the callback will executed with the newest data.
355   - * Examples:
356   - * ```js
357   - * proxy.tail(ev1, ev2, callback);
358   - * proxy.tail([ev1, ev2], callback);
359   - * proxy.tail(ev1, [ev2, ev3], callback);
360   - * ```
361   - * @param {String} eventname1 First event name.
362   - * @param {String} eventname2 Second event name.
363   - * @param {Function} callback Callback, that will be called after predefined events were fired.
364   - */
365   - EventProxy.prototype.tail = function () {
366   - var args = CONCAT.apply([], arguments);
367   - args.push(false);
368   - _assign.apply(this, args);
369   - return this;
370   - };
371   - /**
372   - * `tail` alias, assignAll
373   - */
374   - EventProxy.prototype.assignAll = EventProxy.prototype.tail;
375   - /**
376   - * `tail` alias, assignAlways
377   - */
378   - EventProxy.prototype.assignAlways = EventProxy.prototype.tail;
379   -
380   - /**
381   - * The callback will be executed after the event be fired N times.
382   - * @param {String} eventname Event name.
383   - * @param {Number} times N times.
384   - * @param {Function} callback Callback, that will be called after event was fired N times.
385   - */
386   - EventProxy.prototype.after = function (eventname, times, callback) {
387   - if (times === 0) {
388   - callback.call(null, []);
389   - return this;
390   - }
391   - var proxy = this,
392   - firedData = [];
393   - this._after = this._after || {};
394   - var group = eventname + '_group';
395   - this._after[group] = {
396   - index: 0,
397   - results: []
398   - };
399   - debug('After emit %s times, event %s\'s listenner will execute', times, eventname);
400   - var all = function (name, data) {
401   - if (name === eventname) {
402   - times--;
403   - firedData.push(data);
404   - if (times < 1) {
405   - debug('Event %s was emit %s, and execute the listenner', eventname, times);
406   - proxy.unbindForAll(all);
407   - callback.apply(null, [firedData]);
408   - }
409   - }
410   - if (name === group) {
411   - times--;
412   - proxy._after[group].results[data.index] = data.result;
413   - if (times < 1) {
414   - debug('Event %s was emit %s, and execute the listenner', eventname, times);
415   - proxy.unbindForAll(all);
416   - callback.call(null, proxy._after[group].results);
417   - }
418   - }
419   - };
420   - proxy.bindForAll(all);
421   - return this;
422   - };
423   -
424   - /**
425   - * The `after` method's helper. Use it will return ordered results.
426   - * If you need manipulate result, you need callback
427   - * Examples:
428   - * ```js
429   - * var ep = new EventProxy();
430   - * ep.after('file', files.length, function (list) {
431   - * // Ordered results
432   - * });
433   - * for (var i = 0; i < files.length; i++) {
434   - * fs.readFile(files[i], 'utf-8', ep.group('file'));
435   - * }
436   - * ```
437   - * @param {String} eventname Event name, shoule keep consistent with `after`.
438   - * @param {Function} callback Callback function, should return the final result.
439   - */
440   - EventProxy.prototype.group = function (eventname, callback) {
441   - var that = this;
442   - var group = eventname + '_group';
443   - var index = that._after[group].index;
444   - that._after[group].index++;
445   - return function (err, data) {
446   - if (err) {
447   - // put all arguments to the error handler
448   - return that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
449   - }
450   - that.emit(group, {
451   - index: index,
452   - // callback(err, args1, args2, ...)
453   - result: callback ? callback.apply(null, SLICE.call(arguments, 1)) : data
454   - });
455   - };
456   - };
457   -
458   - /**
459   - * The callback will be executed after any registered event was fired. It only executed once.
460   - * @param {String} eventname1 Event name.
461   - * @param {String} eventname2 Event name.
462   - * @param {Function} callback The callback will get a map that has data and eventname attributes.
463   - */
464   - EventProxy.prototype.any = function () {
465   - var proxy = this,
466   - callback = arguments[arguments.length - 1],
467   - events = SLICE.call(arguments, 0, -1),
468   - _eventname = events.join("_");
469   -
470   - debug('Add listenner for Any of events %j emit', events);
471   - proxy.once(_eventname, callback);
472   -
473   - var _bind = function (key) {
474   - proxy.bind(key, function (data) {
475   - debug('One of events %j emited, execute the listenner');
476   - proxy.trigger(_eventname, {"data": data, eventName: key});
477   - });
478   - };
479   -
480   - for (var index = 0; index < events.length; index++) {
481   - _bind(events[index]);
482   - }
483   - };
484   -
485   - /**
486   - * The callback will be executed when the event name not equals with assigned event.
487   - * @param {String} eventname Event name.
488   - * @param {Function} callback Callback.
489   - */
490   - EventProxy.prototype.not = function (eventname, callback) {
491   - var proxy = this;
492   - debug('Add listenner for not event %s', eventname);
493   - proxy.bindForAll(function (name, data) {
494   - if (name !== eventname) {
495   - debug('listenner execute of event %s emit, but not event %s.', name, eventname);
496   - callback(data);
497   - }
498   - });
499   - };
500   -
501   - /**
502   - * Success callback wrapper, will handler err for you.
503   - *
504   - * ```js
505   - * fs.readFile('foo.txt', ep.done('content'));
506   - *
507   - * // equal to =>
508   - *
509   - * fs.readFile('foo.txt', function (err, content) {
510   - * if (err) {
511   - * return ep.emit('error', err);
512   - * }
513   - * ep.emit('content', content);
514   - * });
515   - * ```
516   - *
517   - * ```js
518   - * fs.readFile('foo.txt', ep.done('content', function (content) {
519   - * return content.trim();
520   - * }));
521   - *
522   - * // equal to =>
523   - *
524   - * fs.readFile('foo.txt', function (err, content) {
525   - * if (err) {
526   - * return ep.emit('error', err);
527   - * }
528   - * ep.emit('content', content.trim());
529   - * });
530   - * ```
531   - * @param {Function|String} handler, success callback or event name will be emit after callback.
532   - * @return {Function}
533   - */
534   - EventProxy.prototype.done = function (handler, callback) {
535   - var that = this;
536   - return function (err, data) {
537   - if (err) {
538   - // put all arguments to the error handler
539   - return that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
540   - }
541   -
542   - // callback(err, args1, args2, ...)
543   - var args = SLICE.call(arguments, 1);
544   -
545   - if (typeof handler === 'string') {
546   - // getAsync(query, ep.done('query'));
547   - // or
548   - // getAsync(query, ep.done('query', function (data) {
549   - // return data.trim();
550   - // }));
551   - if (callback) {
552   - // only replace the args when it really return a result
553   - return that.emit(handler, callback.apply(null, args));
554   - } else {
555   - // put all arguments to the done handler
556   - //ep.done('some');
557   - //ep.on('some', function(args1, args2, ...){});
558   - return that.emit.apply(that, [handler].concat(args));
559   - }
560   - }
561   -
562   - // speed improve for mostly case: `callback(err, data)`
563   - if (arguments.length <= 2) {
564   - return handler(data);
565   - }
566   -
567   - // callback(err, args1, args2, ...)
568   - handler.apply(null, args);
569   - };
570   - };
571   -
572   - /**
573   - * make done async
574   - * @return {Function} delay done
575   - */
576   - EventProxy.prototype.doneLater = function (handler, callback) {
577   - var _doneHandler = this.done(handler, callback);
578   - return function (err, data) {
579   - var args = arguments;
580   - later(function () {
581   - _doneHandler.apply(null, args);
582   - });
583   - };
584   - };
585   -
586   - /**
587   - * Create a new EventProxy
588   - * Examples:
589   - * ```js
590   - * var ep = EventProxy.create();
591   - * ep.assign('user', 'articles', function(user, articles) {
592   - * // do something...
593   - * });
594   - * // or one line ways: Create EventProxy and Assign
595   - * var ep = EventProxy.create('user', 'articles', function(user, articles) {
596   - * // do something...
597   - * });
598   - * ```
599   - * @return {EventProxy} EventProxy instance
600   - */
601   - EventProxy.create = function () {
602   - var ep = new EventProxy();
603   - var args = CONCAT.apply([], arguments);
604   - if (args.length) {
605   - var errorHandler = args[args.length - 1];
606   - var callback = args[args.length - 2];
607   - if (typeof errorHandler === 'function' && typeof callback === 'function') {
608   - args.pop();
609   - ep.fail(errorHandler);
610   - }
611   - ep.assign.apply(ep, args);
612   - }
613   - return ep;
614   - };
615   -
616   - // Backwards compatibility
617   - EventProxy.EventProxy = EventProxy;
618   -
619   - return EventProxy;
620   -});
  1 +/*global define*/
  2 +!(function (name, definition) {
  3 + // Check define
  4 + var hasDefine = typeof define === 'function',
  5 + // Check exports
  6 + hasExports = typeof module !== 'undefined' && module.exports;
  7 +
  8 + if (hasDefine) {
  9 + // AMD Module or CMD Module
  10 + define('eventproxy_debug', function () {return function () {};});
  11 + define(['eventproxy_debug'], definition);
  12 + } else if (hasExports) {
  13 + // Node.js Module
  14 + module.exports = definition(require('debug')('eventproxy'));
  15 + } else {
  16 + // Assign to common namespaces or simply the global object (window)
  17 + this[name] = definition();
  18 + }
  19 +})('EventProxy', function (debug) {
  20 + debug = debug || function () {};
  21 +
  22 + /*!
  23 + * refs
  24 + */
  25 + var SLICE = Array.prototype.slice;
  26 + var CONCAT = Array.prototype.concat;
  27 + var ALL_EVENT = '__all__';
  28 +
  29 + /**
  30 + * EventProxy. An implementation of task/event based asynchronous pattern.
  31 + * A module that can be mixed in to *any object* in order to provide it with custom events.
  32 + * You may `bind` or `unbind` a callback function to an event;
  33 + * `trigger`-ing an event fires all callbacks in succession.
  34 + * Examples:
  35 + * ```js
  36 + * var render = function (template, resources) {};
  37 + * var proxy = new EventProxy();
  38 + * proxy.assign("template", "l10n", render);
  39 + * proxy.trigger("template", template);
  40 + * proxy.trigger("l10n", resources);
  41 + * ```
  42 + */
  43 + var EventProxy = function () {
  44 + if (!(this instanceof EventProxy)) {
  45 + return new EventProxy();
  46 + }
  47 + this._callbacks = {};
  48 + this._fired = {};
  49 + };
  50 +
  51 + /**
  52 + * Bind an event, specified by a string name, `ev`, to a `callback` function.
  53 + * Passing __ALL_EVENT__ will bind the callback to all events fired.
  54 + * Examples:
  55 + * ```js
  56 + * var proxy = new EventProxy();
  57 + * proxy.addListener("template", function (event) {
  58 + * // TODO
  59 + * });
  60 + * ```
  61 + * @param {String} eventname Event name.
  62 + * @param {Function} callback Callback.
  63 + */
  64 + EventProxy.prototype.addListener = function (ev, callback) {
  65 + debug('Add listener for %s', ev);
  66 + this._callbacks[ev] = this._callbacks[ev] || [];
  67 + this._callbacks[ev].push(callback);
  68 + return this;
  69 + };
  70 + /**
  71 + * `addListener` alias, `bind`
  72 + */
  73 + EventProxy.prototype.bind = EventProxy.prototype.addListener;
  74 + /**
  75 + * `addListener` alias, `on`
  76 + */
  77 + EventProxy.prototype.on = EventProxy.prototype.addListener;
  78 + /**
  79 + * `addListener` alias, `subscribe`
  80 + */
  81 + EventProxy.prototype.subscribe = EventProxy.prototype.addListener;
  82 +
  83 + /**
  84 + * Bind an event, but put the callback into head of all callbacks.
  85 + * @param {String} eventname Event name.
  86 + * @param {Function} callback Callback.
  87 + */
  88 + EventProxy.prototype.headbind = function (ev, callback) {
  89 + debug('Add listener for %s', ev);
  90 + this._callbacks[ev] = this._callbacks[ev] || [];
  91 + this._callbacks[ev].unshift(callback);
  92 + return this;
  93 + };
  94 +
  95 + /**
  96 + * Remove one or many callbacks.
  97 + *
  98 + * - If `callback` is null, removes all callbacks for the event.
  99 + * - If `eventname` is null, removes all bound callbacks for all events.
  100 + * @param {String} eventname Event name.
  101 + * @param {Function} callback Callback.
  102 + */
  103 + EventProxy.prototype.removeListener = function (eventname, callback) {
  104 + var calls = this._callbacks;
  105 + if (!eventname) {
  106 + debug('Remove all listeners');
  107 + this._callbacks = {};
  108 + } else {
  109 + if (!callback) {
  110 + debug('Remove all listeners of %s', eventname);
  111 + calls[eventname] = [];
  112 + } else {
  113 + var list = calls[eventname];
  114 + if (list) {
  115 + var l = list.length;
  116 + for (var i = 0; i < l; i++) {
  117 + if (callback === list[i]) {
  118 + debug('Remove a listener of %s', eventname);
  119 + list[i] = null;
  120 + }
  121 + }
  122 + }
  123 + }
  124 + }
  125 + return this;
  126 + };
  127 + /**
  128 + * `removeListener` alias, unbind
  129 + */
  130 + EventProxy.prototype.unbind = EventProxy.prototype.removeListener;
  131 +
  132 + /**
  133 + * Remove all listeners. It equals unbind()
  134 + * Just add this API for as same as Event.Emitter.
  135 + * @param {String} event Event name.
  136 + */
  137 + EventProxy.prototype.removeAllListeners = function (event) {
  138 + return this.unbind(event);
  139 + };
  140 +
  141 + /**
  142 + * Bind the ALL_EVENT event
  143 + */
  144 + EventProxy.prototype.bindForAll = function (callback) {
  145 + this.bind(ALL_EVENT, callback);
  146 + };
  147 +
  148 + /**
  149 + * Unbind the ALL_EVENT event
  150 + */
  151 + EventProxy.prototype.unbindForAll = function (callback) {
  152 + this.unbind(ALL_EVENT, callback);
  153 + };
  154 +
  155 + /**
  156 + * Trigger an event, firing all bound callbacks. Callbacks are passed the
  157 + * same arguments as `trigger` is, apart from the event name.
  158 + * Listening for `"all"` passes the true event name as the first argument.
  159 + * @param {String} eventname Event name
  160 + * @param {Mix} data Pass in data
  161 + */
  162 + EventProxy.prototype.trigger = function (eventname, data) {
  163 + var list, ev, callback, i, l;
  164 + var both = 2;
  165 + var calls = this._callbacks;
  166 + debug('Emit event %s with data %j', eventname, data);
  167 + while (both--) {
  168 + ev = both ? eventname : ALL_EVENT;
  169 + list = calls[ev];
  170 + if (list) {
  171 + for (i = 0, l = list.length; i < l; i++) {
  172 + if (!(callback = list[i])) {
  173 + list.splice(i, 1);
  174 + i--;
  175 + l--;
  176 + } else {
  177 + var args = [];
  178 + var start = both ? 1 : 0;
  179 + for (var j = start; j < arguments.length; j++) {
  180 + args.push(arguments[j]);
  181 + }
  182 + callback.apply(this, args);
  183 + }
  184 + }
  185 + }
  186 + }
  187 + return this;
  188 + };
  189 +
  190 + /**
  191 + * `trigger` alias
  192 + */
  193 + EventProxy.prototype.emit = EventProxy.prototype.trigger;
  194 + /**
  195 + * `trigger` alias
  196 + */
  197 + EventProxy.prototype.fire = EventProxy.prototype.trigger;
  198 +
  199 + /**
  200 + * Bind an event like the bind method, but will remove the listener after it was fired.
  201 + * @param {String} ev Event name
  202 + * @param {Function} callback Callback
  203 + */
  204 + EventProxy.prototype.once = function (ev, callback) {
  205 + var self = this;
  206 + var wrapper = function () {
  207 + callback.apply(self, arguments);
  208 + self.unbind(ev, wrapper);
  209 + };
  210 + this.bind(ev, wrapper);
  211 + return this;
  212 + };
  213 +
  214 + var later = (typeof setImmediate !== 'undefined' && setImmediate) ||
  215 + (typeof process !== 'undefined' && process.nextTick) || function (fn) {
  216 + setTimeout(fn, 0);
  217 + };
  218 +
  219 + /**
  220 + * emitLater
  221 + * make emit async
  222 + */
  223 + EventProxy.prototype.emitLater = function () {
  224 + var self = this;
  225 + var args = arguments;
  226 + later(function () {
  227 + self.trigger.apply(self, args);
  228 + });
  229 + };
  230 +
  231 + /**
  232 + * Bind an event, and trigger it immediately.
  233 + * @param {String} ev Event name.
  234 + * @param {Function} callback Callback.
  235 + * @param {Mix} data The data that will be passed to calback as arguments.
  236 + */
  237 + EventProxy.prototype.immediate = function (ev, callback, data) {
  238 + this.bind(ev, callback);
  239 + this.trigger(ev, data);
  240 + return this;
  241 + };
  242 + /**
  243 + * `immediate` alias
  244 + */
  245 + EventProxy.prototype.asap = EventProxy.prototype.immediate;
  246 +
  247 + var _assign = function (eventname1, eventname2, cb, once) {
  248 + var proxy = this;
  249 + var argsLength = arguments.length;
  250 + var times = 0;
  251 + var flag = {};
  252 +
  253 + // Check the arguments length.
  254 + if (argsLength < 3) {
  255 + return this;
  256 + }
  257 +
  258 + var events = SLICE.call(arguments, 0, -2);
  259 + var callback = arguments[argsLength - 2];
  260 + var isOnce = arguments[argsLength - 1];
  261 +
  262 + // Check the callback type.
  263 + if (typeof callback !== "function") {
  264 + return this;
  265 + }
  266 + debug('Assign listener for events %j, once is %s', events, !!isOnce);
  267 + var bind = function (key) {
  268 + var method = isOnce ? "once" : "bind";
  269 + proxy[method](key, function (data) {
  270 + proxy._fired[key] = proxy._fired[key] || {};
  271 + proxy._fired[key].data = data;
  272 + if (!flag[key]) {
  273 + flag[key] = true;
  274 + times++;
  275 + }
  276 + });
  277 + };
  278 +
  279 + var length = events.length;
  280 + for (var index = 0; index < length; index++) {
  281 + bind(events[index]);
  282 + }
  283 +
  284 + var _all = function (event) {
  285 + if (times < length) {
  286 + return;
  287 + }
  288 + if (!flag[event]) {
  289 + return;
  290 + }
  291 + var data = [];
  292 + for (var index = 0; index < length; index++) {
  293 + data.push(proxy._fired[events[index]].data);
  294 + }
  295 + if (isOnce) {
  296 + proxy.unbindForAll(_all);
  297 + }
  298 + debug('Events %j all emited with data %j', events, data);
  299 + callback.apply(null, data);
  300 + };
  301 + proxy.bindForAll(_all);
  302 + };
  303 +
  304 + /**
  305 + * Assign some events, after all events were fired, the callback will be executed once.
  306 + *
  307 + * Examples:
  308 + * ```js
  309 + * proxy.all(ev1, ev2, callback);
  310 + * proxy.all([ev1, ev2], callback);
  311 + * proxy.all(ev1, [ev2, ev3], callback);
  312 + * ```
  313 + * @param {String} eventname1 First event name.
  314 + * @param {String} eventname2 Second event name.
  315 + * @param {Function} callback Callback, that will be called after predefined events were fired.
  316 + */
  317 + EventProxy.prototype.all = function (eventname1, eventname2, callback) {
  318 + var args = CONCAT.apply([], arguments);
  319 + args.push(true);
  320 + _assign.apply(this, args);
  321 + return this;
  322 + };
  323 + /**
  324 + * `all` alias
  325 + */
  326 + EventProxy.prototype.assign = EventProxy.prototype.all;
  327 +
  328 + /**
  329 + * Assign the only one 'error' event handler.
  330 + * @param {Function(err)} callback
  331 + */
  332 + EventProxy.prototype.fail = function (callback) {
  333 + var that = this;
  334 +
  335 + that.once('error', function () {
  336 + that.unbind();
  337 + // put all arguments to the error handler
  338 + // fail(function(err, args1, args2, ...){})
  339 + callback.apply(null, arguments);
  340 + });
  341 + return this;
  342 + };
  343 +
  344 + /**
  345 + * A shortcut of ep#emit('error', err)
  346 + */
  347 + EventProxy.prototype.throw = function () {
  348 + var that = this;
  349 + that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
  350 + };
  351 +
  352 + /**
  353 + * Assign some events, after all events were fired, the callback will be executed first time.
  354 + * Then any event that predefined be fired again, the callback will executed with the newest data.
  355 + * Examples:
  356 + * ```js
  357 + * proxy.tail(ev1, ev2, callback);
  358 + * proxy.tail([ev1, ev2], callback);
  359 + * proxy.tail(ev1, [ev2, ev3], callback);
  360 + * ```
  361 + * @param {String} eventname1 First event name.
  362 + * @param {String} eventname2 Second event name.
  363 + * @param {Function} callback Callback, that will be called after predefined events were fired.
  364 + */
  365 + EventProxy.prototype.tail = function () {
  366 + var args = CONCAT.apply([], arguments);
  367 + args.push(false);
  368 + _assign.apply(this, args);
  369 + return this;
  370 + };
  371 + /**
  372 + * `tail` alias, assignAll
  373 + */
  374 + EventProxy.prototype.assignAll = EventProxy.prototype.tail;
  375 + /**
  376 + * `tail` alias, assignAlways
  377 + */
  378 + EventProxy.prototype.assignAlways = EventProxy.prototype.tail;
  379 +
  380 + /**
  381 + * The callback will be executed after the event be fired N times.
  382 + * @param {String} eventname Event name.
  383 + * @param {Number} times N times.
  384 + * @param {Function} callback Callback, that will be called after event was fired N times.
  385 + */
  386 + EventProxy.prototype.after = function (eventname, times, callback) {
  387 + if (times === 0) {
  388 + callback.call(null, []);
  389 + return this;
  390 + }
  391 + var proxy = this,
  392 + firedData = [];
  393 + this._after = this._after || {};
  394 + var group = eventname + '_group';
  395 + this._after[group] = {
  396 + index: 0,
  397 + results: []
  398 + };
  399 + debug('After emit %s times, event %s\'s listenner will execute', times, eventname);
  400 + var all = function (name, data) {
  401 + if (name === eventname) {
  402 + times--;
  403 + firedData.push(data);
  404 + if (times < 1) {
  405 + debug('Event %s was emit %s, and execute the listenner', eventname, times);
  406 + proxy.unbindForAll(all);
  407 + callback.apply(null, [firedData]);
  408 + }
  409 + }
  410 + if (name === group) {
  411 + times--;
  412 + proxy._after[group].results[data.index] = data.result;
  413 + if (times < 1) {
  414 + debug('Event %s was emit %s, and execute the listenner', eventname, times);
  415 + proxy.unbindForAll(all);
  416 + callback.call(null, proxy._after[group].results);
  417 + }
  418 + }
  419 + };
  420 + proxy.bindForAll(all);
  421 + return this;
  422 + };
  423 +
  424 + /**
  425 + * The `after` method's helper. Use it will return ordered results.
  426 + * If you need manipulate result, you need callback
  427 + * Examples:
  428 + * ```js
  429 + * var ep = new EventProxy();
  430 + * ep.after('file', files.length, function (list) {
  431 + * // Ordered results
  432 + * });
  433 + * for (var i = 0; i < files.length; i++) {
  434 + * fs.readFile(files[i], 'utf-8', ep.group('file'));
  435 + * }
  436 + * ```
  437 + * @param {String} eventname Event name, shoule keep consistent with `after`.
  438 + * @param {Function} callback Callback function, should return the final result.
  439 + */
  440 + EventProxy.prototype.group = function (eventname, callback) {
  441 + var that = this;
  442 + var group = eventname + '_group';
  443 + var index = that._after[group].index;
  444 + that._after[group].index++;
  445 + return function (err, data) {
  446 + if (err) {
  447 + // put all arguments to the error handler
  448 + return that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
  449 + }
  450 + that.emit(group, {
  451 + index: index,
  452 + // callback(err, args1, args2, ...)
  453 + result: callback ? callback.apply(null, SLICE.call(arguments, 1)) : data
  454 + });
  455 + };
  456 + };
  457 +
  458 + /**
  459 + * The callback will be executed after any registered event was fired. It only executed once.
  460 + * @param {String} eventname1 Event name.
  461 + * @param {String} eventname2 Event name.
  462 + * @param {Function} callback The callback will get a map that has data and eventname attributes.
  463 + */
  464 + EventProxy.prototype.any = function () {
  465 + var proxy = this,
  466 + callback = arguments[arguments.length - 1],
  467 + events = SLICE.call(arguments, 0, -1),
  468 + _eventname = events.join("_");
  469 +
  470 + debug('Add listenner for Any of events %j emit', events);
  471 + proxy.once(_eventname, callback);
  472 +
  473 + var _bind = function (key) {
  474 + proxy.bind(key, function (data) {
  475 + debug('One of events %j emited, execute the listenner');
  476 + proxy.trigger(_eventname, {"data": data, eventName: key});
  477 + });
  478 + };
  479 +
  480 + for (var index = 0; index < events.length; index++) {
  481 + _bind(events[index]);
  482 + }
  483 + };
  484 +
  485 + /**
  486 + * The callback will be executed when the event name not equals with assigned event.
  487 + * @param {String} eventname Event name.
  488 + * @param {Function} callback Callback.
  489 + */
  490 + EventProxy.prototype.not = function (eventname, callback) {
  491 + var proxy = this;
  492 + debug('Add listenner for not event %s', eventname);
  493 + proxy.bindForAll(function (name, data) {
  494 + if (name !== eventname) {
  495 + debug('listenner execute of event %s emit, but not event %s.', name, eventname);
  496 + callback(data);
  497 + }
  498 + });
  499 + };
  500 +
  501 + /**
  502 + * Success callback wrapper, will handler err for you.
  503 + *
  504 + * ```js
  505 + * fs.readFile('foo.txt', ep.done('content'));
  506 + *
  507 + * // equal to =>
  508 + *
  509 + * fs.readFile('foo.txt', function (err, content) {
  510 + * if (err) {
  511 + * return ep.emit('error', err);
  512 + * }
  513 + * ep.emit('content', content);
  514 + * });
  515 + * ```
  516 + *
  517 + * ```js
  518 + * fs.readFile('foo.txt', ep.done('content', function (content) {
  519 + * return content.trim();
  520 + * }));
  521 + *
  522 + * // equal to =>
  523 + *
  524 + * fs.readFile('foo.txt', function (err, content) {
  525 + * if (err) {
  526 + * return ep.emit('error', err);
  527 + * }
  528 + * ep.emit('content', content.trim());
  529 + * });
  530 + * ```
  531 + * @param {Function|String} handler, success callback or event name will be emit after callback.
  532 + * @return {Function}
  533 + */
  534 + EventProxy.prototype.done = function (handler, callback) {
  535 + var that = this;
  536 + return function (err, data) {
  537 + if (err) {
  538 + // put all arguments to the error handler
  539 + return that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
  540 + }
  541 +
  542 + // callback(err, args1, args2, ...)
  543 + var args = SLICE.call(arguments, 1);
  544 +
  545 + if (typeof handler === 'string') {
  546 + // getAsync(query, ep.done('query'));
  547 + // or
  548 + // getAsync(query, ep.done('query', function (data) {
  549 + // return data.trim();
  550 + // }));
  551 + if (callback) {
  552 + // only replace the args when it really return a result
  553 + return that.emit(handler, callback.apply(null, args));
  554 + } else {
  555 + // put all arguments to the done handler
  556 + //ep.done('some');
  557 + //ep.on('some', function(args1, args2, ...){});
  558 + return that.emit.apply(that, [handler].concat(args));
  559 + }
  560 + }
  561 +
  562 + // speed improve for mostly case: `callback(err, data)`
  563 + if (arguments.length <= 2) {
  564 + return handler(data);
  565 + }
  566 +
  567 + // callback(err, args1, args2, ...)
  568 + handler.apply(null, args);
  569 + };
  570 + };
  571 +
  572 + /**
  573 + * make done async
  574 + * @return {Function} delay done
  575 + */
  576 + EventProxy.prototype.doneLater = function (handler, callback) {
  577 + var _doneHandler = this.done(handler, callback);
  578 + return function (err, data) {
  579 + var args = arguments;
  580 + later(function () {
  581 + _doneHandler.apply(null, args);
  582 + });
  583 + };
  584 + };
  585 +
  586 + /**
  587 + * Create a new EventProxy
  588 + * Examples:
  589 + * ```js
  590 + * var ep = EventProxy.create();
  591 + * ep.assign('user', 'articles', function(user, articles) {
  592 + * // do something...
  593 + * });
  594 + * // or one line ways: Create EventProxy and Assign
  595 + * var ep = EventProxy.create('user', 'articles', function(user, articles) {
  596 + * // do something...
  597 + * });
  598 + * ```
  599 + * @return {EventProxy} EventProxy instance
  600 + */
  601 + EventProxy.create = function () {
  602 + var ep = new EventProxy();
  603 + var args = CONCAT.apply([], arguments);
  604 + if (args.length) {
  605 + var errorHandler = args[args.length - 1];
  606 + var callback = args[args.length - 2];
  607 + if (typeof errorHandler === 'function' && typeof callback === 'function') {
  608 + args.pop();
  609 + ep.fail(errorHandler);
  610 + }
  611 + ep.assign.apply(ep, args);
  612 + }
  613 + return ep;
  614 + };
  615 +
  616 + // Backwards compatibility
  617 + EventProxy.EventProxy = EventProxy;
  618 +
  619 + return EventProxy;
  620 +});
... ...
src/main/resources/static/assets/js/sockjs.min.js
1   -/* sockjs-client v1.1.1 | http://sockjs.org | MIT license */
2   -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e){(function(n){"use strict";var r=t("./transport-list");e.exports=t("./main")(r),"_sockjs_onload"in n&&setTimeout(n._sockjs_onload,1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./main":14,"./transport-list":16}],2:[function(t,e){"use strict";function n(){i.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],3:[function(t,e){"use strict";function n(){i.call(this)}var r=t("inherits"),i=t("./eventtarget");r(n,i),n.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},n.prototype.once=function(t,e){function n(){r.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}var r=this,i=!1;this.on(t,n)},n.prototype.emit=function(){var t=arguments[0],e=this._listeners[t];if(e){for(var n=arguments.length,r=new Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var o=0;o<e.length;o++)e[o].apply(this,r)}},n.prototype.on=n.prototype.addListener=i.prototype.addEventListener,n.prototype.removeListener=i.prototype.removeEventListener,e.exports.EventEmitter=n},{"./eventtarget":5,inherits:54}],4:[function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,e.exports=n},{}],5:[function(t,e){"use strict";function n(){this._listeners={}}n.prototype.addEventListener=function(t,e){t in this._listeners||(this._listeners[t]=[]);var n=this._listeners[t];-1===n.indexOf(e)&&(n=n.concat([e])),this._listeners[t]=n},n.prototype.removeEventListener=function(t,e){var n=this._listeners[t];if(n){var r=n.indexOf(e);return-1!==r?void(n.length>1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(){var t=arguments[0],e=t.type,n=1===arguments.length?[t]:Array.apply(null,arguments);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i<r.length;i++)r[i].apply(this,n)},e.exports=n},{}],6:[function(t,e){"use strict";function n(t){i.call(this),this.initEvent("message",!1,!1),this.data=t}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],7:[function(t,e){"use strict";function n(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var r=t("json3"),i=t("./utils/iframe");n.prototype._transportClose=function(t,e){i.postMessage("c",r.stringify([t,e]))},n.prototype._transportMessage=function(t){i.postMessage("t",t)},n.prototype._send=function(t){this._transport.send(t)},n.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},e.exports=n},{"./utils/iframe":47,json3:55}],8:[function(t,e){"use strict";var n=t("./utils/url"),r=t("./utils/event"),i=t("json3"),o=t("./facade"),s=t("./info-iframe-receiver"),a=t("./utils/iframe"),u=t("./location");e.exports=function(t,e){var l={};e.forEach(function(t){t.facadeTransport&&(l[t.facadeTransport.transportName]=t.facadeTransport)}),l[s.transportName]=s;var c;t.bootstrap_iframe=function(){var e;a.currentWindowId=u.hash.slice(1);var s=function(r){if(r.source===parent&&("undefined"==typeof c&&(c=r.origin),r.origin===c)){var s;try{s=i.parse(r.data)}catch(f){return}if(s.windowId===a.currentWindowId)switch(s.type){case"s":var h;try{h=i.parse(s.data)}catch(f){break}var d=h[0],p=h[1],v=h[2],m=h[3];if(d!==t.version)throw new Error('Incompatible SockJS! Main site uses: "'+d+'", the iframe: "'+t.version+'".');if(!n.isOriginEqual(v,u.href)||!n.isOriginEqual(m,u.href))throw new Error("Can't connect to different domain from within an iframe. ("+u.href+", "+v+", "+m+")");e=new o(new l[p](v,m));break;case"m":e._send(s.data);break;case"c":e&&e._close(),e=null}}};r.attachEvent("message",s),a.postMessage("s")}}},{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,debug:void 0,json3:55}],9:[function(t,e){"use strict";function n(t,e){r.call(this);var n=this,i=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var r,a;if(200===t){if(a=+new Date-i,e)try{r=o.parse(e)}catch(u){}s.isObject(r)||(r={})}n.emit("finish",r,a),n.removeAllListeners()})}var r=t("events").EventEmitter,i=t("inherits"),o=t("json3"),s=t("./utils/object");i(n,r),n.prototype.close=function(){this.removeAllListeners(),this.xo.close()},e.exports=n},{"./utils/object":49,debug:void 0,events:3,inherits:54,json3:55}],10:[function(t,e){"use strict";function n(t){var e=this;i.call(this),this.ir=new a(t,s),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",o.stringify([t,n]))})}var r=t("inherits"),i=t("events").EventEmitter,o=t("json3"),s=t("./transport/sender/xhr-local"),a=t("./info-ajax");r(n,i),n.transportName="iframe-info-receiver",n.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},e.exports=n},{"./info-ajax":9,"./transport/sender/xhr-local":37,events:3,inherits:54,json3:55}],11:[function(t,e){(function(n){"use strict";function r(t,e){var r=this;i.call(this);var o=function(){var n=r.ifr=new u(l.transportName,e,t);n.once("message",function(t){if(t){var e;try{e=s.parse(t)}catch(n){return r.emit("finish"),void r.close()}var i=e[0],o=e[1];r.emit("finish",i,o)}r.close()}),n.once("close",function(){r.emit("finish"),r.close()})};n.document.body?o():a.attachEvent("load",o)}var i=t("events").EventEmitter,o=t("inherits"),s=t("json3"),a=t("./utils/event"),u=t("./transport/iframe"),l=t("./info-iframe-receiver");o(r,i),r.enabled=function(){return u.enabled()},r.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,debug:void 0,events:3,inherits:54,json3:55}],12:[function(t,e){"use strict";function n(t,e){var n=this;r.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var r=t("events").EventEmitter,i=t("inherits"),o=t("./utils/url"),s=t("./transport/sender/xdr"),a=t("./transport/sender/xhr-cors"),u=t("./transport/sender/xhr-local"),l=t("./transport/sender/xhr-fake"),c=t("./info-iframe"),f=t("./info-ajax");i(n,r),n._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,u):a.enabled?new f(e,a):s.enabled&&n.sameScheme?new f(e,s):c.enabled()?new c(t,e):new f(e,l)},n.prototype.doXhr=function(t,e){var r=this,i=o.addPath(t,"/info");this.xo=n._getReceiver(t,i,e),this.timeoutRef=setTimeout(function(){r._cleanup(!1),r.emit("finish")},n.timeout),this.xo.once("finish",function(t,e){r._cleanup(!0),r.emit("finish",t,e)})},n.prototype._cleanup=function(t){clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},n.prototype.close=function(){this.removeAllListeners(),this._cleanup(!1)},n.timeout=8e3,e.exports=n},{"./info-ajax":9,"./info-iframe":11,"./transport/sender/xdr":34,"./transport/sender/xhr-cors":35,"./transport/sender/xhr-fake":36,"./transport/sender/xhr-local":37,"./utils/url":52,debug:void 0,events:3,inherits:54}],13:[function(t,e){(function(t){"use strict";e.exports=t.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e){(function(n){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");b.call(this),this.readyState=r.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&m.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports,this._transportOptions=n.transportOptions||{};var i=n.sessionId||8;if("function"==typeof i)this._generateSessionId=i;else{if("number"!=typeof i)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return l.string(i)}}this._server=n.server||l.numberString(1e3);var o=new s(t);if(!o.host||!o.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(o.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==o.protocol&&"https:"!==o.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+o.protocol+"' is not allowed.");var a="https:"===o.protocol;if("https"===g.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var u=e.sort();u.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e<u.length-1&&t===u[e+1])throw new SyntaxError("The protocols entry '"+t+"' is duplicated.")});var c=f.getOrigin(g.href);this._origin=c?c.toLowerCase():null,o.set("pathname",o.pathname.replace(/\/+$/,"")),this.url=o.href,this._urlInfo={nullOrigin:!v.hasDomain(),sameOrigin:f.isOriginEqual(this.url,g.href),sameScheme:f.isSchemeEqual(this.url,g.href)},this._ir=new _(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function i(t){return 1e3===t||t>=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=this._transportOptions[t.transportName],o=new t(r,this._transUrl,i);return o.on("message",this._transportMessage.bind(this)),o.once("close",this._transportClose.bind(this)),o.transportName=t.transportName,void(this._transport=o)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,debug:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i<o;)i in n&&t.call(r,n[i],i,e)}},!b(i.forEach));var g=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);p(i,{indexOf:function(e){var n=y&&h(this)?this.split(""):v(this),r=n.length>>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(a[t]=void 0)}),a.length>1&&a.index<o.length&&i.push.apply(f,a.slice(1)),c=a[0].length,d=u,f.length>=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x=" \n \f\r   ᠎              \u2028\u2029",_="​",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){"use strict";var n=t.WebSocket||t.MozWebSocket;n&&(e.exports=function(t){return new n(t)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)"))
  1 +/* sockjs-client v1.1.1 | http://sockjs.org | MIT license */
  2 +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e){(function(n){"use strict";var r=t("./transport-list");e.exports=t("./main")(r),"_sockjs_onload"in n&&setTimeout(n._sockjs_onload,1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./main":14,"./transport-list":16}],2:[function(t,e){"use strict";function n(){i.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],3:[function(t,e){"use strict";function n(){i.call(this)}var r=t("inherits"),i=t("./eventtarget");r(n,i),n.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},n.prototype.once=function(t,e){function n(){r.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}var r=this,i=!1;this.on(t,n)},n.prototype.emit=function(){var t=arguments[0],e=this._listeners[t];if(e){for(var n=arguments.length,r=new Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var o=0;o<e.length;o++)e[o].apply(this,r)}},n.prototype.on=n.prototype.addListener=i.prototype.addEventListener,n.prototype.removeListener=i.prototype.removeEventListener,e.exports.EventEmitter=n},{"./eventtarget":5,inherits:54}],4:[function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,e.exports=n},{}],5:[function(t,e){"use strict";function n(){this._listeners={}}n.prototype.addEventListener=function(t,e){t in this._listeners||(this._listeners[t]=[]);var n=this._listeners[t];-1===n.indexOf(e)&&(n=n.concat([e])),this._listeners[t]=n},n.prototype.removeEventListener=function(t,e){var n=this._listeners[t];if(n){var r=n.indexOf(e);return-1!==r?void(n.length>1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(){var t=arguments[0],e=t.type,n=1===arguments.length?[t]:Array.apply(null,arguments);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i<r.length;i++)r[i].apply(this,n)},e.exports=n},{}],6:[function(t,e){"use strict";function n(t){i.call(this),this.initEvent("message",!1,!1),this.data=t}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],7:[function(t,e){"use strict";function n(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var r=t("json3"),i=t("./utils/iframe");n.prototype._transportClose=function(t,e){i.postMessage("c",r.stringify([t,e]))},n.prototype._transportMessage=function(t){i.postMessage("t",t)},n.prototype._send=function(t){this._transport.send(t)},n.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},e.exports=n},{"./utils/iframe":47,json3:55}],8:[function(t,e){"use strict";var n=t("./utils/url"),r=t("./utils/event"),i=t("json3"),o=t("./facade"),s=t("./info-iframe-receiver"),a=t("./utils/iframe"),u=t("./location");e.exports=function(t,e){var l={};e.forEach(function(t){t.facadeTransport&&(l[t.facadeTransport.transportName]=t.facadeTransport)}),l[s.transportName]=s;var c;t.bootstrap_iframe=function(){var e;a.currentWindowId=u.hash.slice(1);var s=function(r){if(r.source===parent&&("undefined"==typeof c&&(c=r.origin),r.origin===c)){var s;try{s=i.parse(r.data)}catch(f){return}if(s.windowId===a.currentWindowId)switch(s.type){case"s":var h;try{h=i.parse(s.data)}catch(f){break}var d=h[0],p=h[1],v=h[2],m=h[3];if(d!==t.version)throw new Error('Incompatible SockJS! Main site uses: "'+d+'", the iframe: "'+t.version+'".');if(!n.isOriginEqual(v,u.href)||!n.isOriginEqual(m,u.href))throw new Error("Can't connect to different domain from within an iframe. ("+u.href+", "+v+", "+m+")");e=new o(new l[p](v,m));break;case"m":e._send(s.data);break;case"c":e&&e._close(),e=null}}};r.attachEvent("message",s),a.postMessage("s")}}},{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,debug:void 0,json3:55}],9:[function(t,e){"use strict";function n(t,e){r.call(this);var n=this,i=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var r,a;if(200===t){if(a=+new Date-i,e)try{r=o.parse(e)}catch(u){}s.isObject(r)||(r={})}n.emit("finish",r,a),n.removeAllListeners()})}var r=t("events").EventEmitter,i=t("inherits"),o=t("json3"),s=t("./utils/object");i(n,r),n.prototype.close=function(){this.removeAllListeners(),this.xo.close()},e.exports=n},{"./utils/object":49,debug:void 0,events:3,inherits:54,json3:55}],10:[function(t,e){"use strict";function n(t){var e=this;i.call(this),this.ir=new a(t,s),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",o.stringify([t,n]))})}var r=t("inherits"),i=t("events").EventEmitter,o=t("json3"),s=t("./transport/sender/xhr-local"),a=t("./info-ajax");r(n,i),n.transportName="iframe-info-receiver",n.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},e.exports=n},{"./info-ajax":9,"./transport/sender/xhr-local":37,events:3,inherits:54,json3:55}],11:[function(t,e){(function(n){"use strict";function r(t,e){var r=this;i.call(this);var o=function(){var n=r.ifr=new u(l.transportName,e,t);n.once("message",function(t){if(t){var e;try{e=s.parse(t)}catch(n){return r.emit("finish"),void r.close()}var i=e[0],o=e[1];r.emit("finish",i,o)}r.close()}),n.once("close",function(){r.emit("finish"),r.close()})};n.document.body?o():a.attachEvent("load",o)}var i=t("events").EventEmitter,o=t("inherits"),s=t("json3"),a=t("./utils/event"),u=t("./transport/iframe"),l=t("./info-iframe-receiver");o(r,i),r.enabled=function(){return u.enabled()},r.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,debug:void 0,events:3,inherits:54,json3:55}],12:[function(t,e){"use strict";function n(t,e){var n=this;r.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var r=t("events").EventEmitter,i=t("inherits"),o=t("./utils/url"),s=t("./transport/sender/xdr"),a=t("./transport/sender/xhr-cors"),u=t("./transport/sender/xhr-local"),l=t("./transport/sender/xhr-fake"),c=t("./info-iframe"),f=t("./info-ajax");i(n,r),n._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,u):a.enabled?new f(e,a):s.enabled&&n.sameScheme?new f(e,s):c.enabled()?new c(t,e):new f(e,l)},n.prototype.doXhr=function(t,e){var r=this,i=o.addPath(t,"/info");this.xo=n._getReceiver(t,i,e),this.timeoutRef=setTimeout(function(){r._cleanup(!1),r.emit("finish")},n.timeout),this.xo.once("finish",function(t,e){r._cleanup(!0),r.emit("finish",t,e)})},n.prototype._cleanup=function(t){clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},n.prototype.close=function(){this.removeAllListeners(),this._cleanup(!1)},n.timeout=8e3,e.exports=n},{"./info-ajax":9,"./info-iframe":11,"./transport/sender/xdr":34,"./transport/sender/xhr-cors":35,"./transport/sender/xhr-fake":36,"./transport/sender/xhr-local":37,"./utils/url":52,debug:void 0,events:3,inherits:54}],13:[function(t,e){(function(t){"use strict";e.exports=t.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e){(function(n){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");b.call(this),this.readyState=r.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&m.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports,this._transportOptions=n.transportOptions||{};var i=n.sessionId||8;if("function"==typeof i)this._generateSessionId=i;else{if("number"!=typeof i)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return l.string(i)}}this._server=n.server||l.numberString(1e3);var o=new s(t);if(!o.host||!o.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(o.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==o.protocol&&"https:"!==o.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+o.protocol+"' is not allowed.");var a="https:"===o.protocol;if("https"===g.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var u=e.sort();u.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e<u.length-1&&t===u[e+1])throw new SyntaxError("The protocols entry '"+t+"' is duplicated.")});var c=f.getOrigin(g.href);this._origin=c?c.toLowerCase():null,o.set("pathname",o.pathname.replace(/\/+$/,"")),this.url=o.href,this._urlInfo={nullOrigin:!v.hasDomain(),sameOrigin:f.isOriginEqual(this.url,g.href),sameScheme:f.isSchemeEqual(this.url,g.href)},this._ir=new _(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function i(t){return 1e3===t||t>=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=this._transportOptions[t.transportName],o=new t(r,this._transUrl,i);return o.on("message",this._transportMessage.bind(this)),o.once("close",this._transportClose.bind(this)),o.transportName=t.transportName,void(this._transport=o)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,debug:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i<o;)i in n&&t.call(r,n[i],i,e)}},!b(i.forEach));var g=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);p(i,{indexOf:function(e){var n=y&&h(this)?this.split(""):v(this),r=n.length>>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(a[t]=void 0)}),a.length>1&&a.index<o.length&&i.push.apply(f,a.slice(1)),c=a[0].length,d=u,f.length>=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x=" \n \f\r   ᠎              \u2028\u2029",_="​",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){"use strict";var n=t.WebSocket||t.MozWebSocket;n&&(e.exports=function(t){return new n(t)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)"))
3 3 }},"undefined"==typeof i.async&&n.document.attachEvent)if(s.isOpera())e=this.script2=n.document.createElement("script"),e.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=e.async=!1;else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";n.emit("close",null,r),n._cleanup()})}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._chunkHandler=function(t,e){if(200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),-1===n)break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},e.exports=n},{debug:void 0,events:3,inherits:54}],33:[function(t,e){(function(n){"use strict";function r(t){try{return n.document.createElement('<iframe name="'+t+'">')}catch(e){var r=n.document.createElement("iframe");return r.name=t,r}}function i(){o=n.document.createElement("form"),o.style.display="none",o.style.position="absolute",o.method="POST",o.enctype="application/x-www-form-urlencoded",o.acceptCharset="UTF-8",s=n.document.createElement("textarea"),s.name="d",o.appendChild(s),n.document.body.appendChild(o)}var o,s,a=t("../../utils/random"),u=t("../../utils/url");e.exports=function(t,e,n){o||i();var l="a"+a.string(8);o.target=l,o.action=u.addQuery(u.addPath(t,"/jsonp_send"),"i="+l);var c=r(l);c.id=l,c.style.display="none",o.appendChild(c);try{s.value=e}catch(f){}o.submit();var h=function(t){c.onerror&&(c.onreadystatechange=c.onerror=c.onload=null,setTimeout(function(){c.parentNode.removeChild(c),c=null},500),s.value="",n(t))};return c.onerror=function(){h()},c.onload=function(){h()},c.onreadystatechange=function(t){"complete"===c.readyState&&h()},function(){h(new Error("Aborted"))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/random":50,"../../utils/url":52,debug:void 0}],34:[function(t,e){(function(n){"use strict";function r(t,e,n){var r=this;i.call(this),setTimeout(function(){r._start(t,e,n)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/browser"),u=t("../../utils/url");o(r,i),r.prototype._start=function(t,e,r){var i=this,o=new n.XDomainRequest;e=u.addQuery(e,"t="+ +new Date),o.onerror=function(){i._error()},o.ontimeout=function(){i._error()},o.onprogress=function(){i.emit("chunk",200,o.responseText)},o.onload=function(){i.emit("finish",200,o.responseText),i._cleanup(!1)},this.xdr=o,this.unloadRef=s.unloadAdd(function(){i._cleanup(!0)});try{this.xdr.open(t,e),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(r)}catch(a){this._error()}},r.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},r.prototype._cleanup=function(t){if(this.xdr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,t)try{this.xdr.abort()}catch(e){}this.unloadRef=this.xdr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!(!n.XDomainRequest||!a.hasDomain()),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],35:[function(t,e){"use strict";function n(t,e,n,r){i.call(this,t,e,n,r)}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled&&i.supportsCORS,e.exports=n},{"../driver/xhr":17,inherits:54}],36:[function(t,e){"use strict";function n(){var t=this;r.call(this),this.to=setTimeout(function(){t.emit("finish",200,"{}")},n.timeout)}var r=t("events").EventEmitter,i=t("inherits");i(n,r),n.prototype.close=function(){clearTimeout(this.to)},n.timeout=2e3,e.exports=n},{events:3,inherits:54}],37:[function(t,e){"use strict";function n(t,e,n){i.call(this,t,e,n,{noCredentials:!0})}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled,e.exports=n},{"../driver/xhr":17,inherits:54}],38:[function(t,e){"use strict";function n(t,e,o){if(!n.enabled())throw new Error("Transport created when disabled");s.call(this);var u=this,l=i.addPath(t,"/websocket");l="https"===l.slice(0,5)?"wss"+l.slice(5):"ws"+l.slice(4),this.url=l,this.ws=new a(this.url,[],o),this.ws.onmessage=function(t){u.emit("message",t.data)},this.unloadRef=r.unloadAdd(function(){u.ws.close()}),this.ws.onclose=function(t){u.emit("close",t.code,t.reason),u._cleanup()},this.ws.onerror=function(t){u.emit("close",1006,"WebSocket connection broken"),u._cleanup()}}var r=t("../utils/event"),i=t("../utils/url"),o=t("inherits"),s=t("events").EventEmitter,a=t("./driver/websocket");o(n,s),n.prototype.send=function(t){var e="["+t+"]";this.ws.send(e)},n.prototype.close=function(){this.ws&&this.ws.close(),this._cleanup()},n.prototype._cleanup=function(){var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),r.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},n.enabled=function(){return!!a},n.transportName="websocket",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/url":52,"./driver/websocket":19,debug:void 0,events:3,inherits:54}],39:[function(t,e){"use strict";function n(t){if(!a.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",s,a)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./xdr-streaming"),s=t("./receiver/xhr"),a=t("./sender/xdr");r(n,i),n.enabled=o.enabled,n.transportName="xdr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,"./xdr-streaming":40,inherits:54}],40:[function(t,e){"use strict";function n(t){if(!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr_streaming",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xdr");r(n,i),n.enabled=function(t){return t.cookie_needed||t.nullOrigin?!1:s.enabled&&t.sameScheme},n.transportName="xdr-streaming",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,inherits:54}],41:[function(t,e){"use strict";function n(t){if(!a.enabled&&!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xhr-cors"),a=t("./sender/xhr-local");r(n,i),n.enabled=function(t){return t.nullOrigin?!1:a.enabled&&t.sameOrigin?!0:s.enabled},n.transportName="xhr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],42:[function(t,e){(function(n){"use strict";function r(t){if(!u.enabled&&!a.enabled)throw new Error("Transport created when disabled");o.call(this,t,"/xhr_streaming",s,a)}var i=t("inherits"),o=t("./lib/ajax-based"),s=t("./receiver/xhr"),a=t("./sender/xhr-cors"),u=t("./sender/xhr-local"),l=t("../utils/browser");i(r,o),r.enabled=function(t){return t.nullOrigin?!1:l.isOpera()?!1:a.enabled},r.transportName="xhr-streaming",r.roundTrips=2,r.needBody=!!n.document,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/browser":44,"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],43:[function(t,e){(function(t){"use strict";e.exports.randomBytes=t.crypto&&t.crypto.getRandomValues?function(e){var n=new Uint8Array(e);return t.crypto.getRandomValues(n),n}:function(t){for(var e=new Array(t),n=0;t>n;n++)e[n]=Math.floor(256*Math.random());return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],44:[function(t,e){(function(t){"use strict";e.exports={isOpera:function(){return t.navigator&&/opera/i.test(t.navigator.userAgent)},isKonqueror:function(){return t.navigator&&/konqueror/i.test(t.navigator.userAgent)},hasDomain:function(){if(!t.document)return!0;try{return!!t.document.domain}catch(e){return!1}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(t,e){"use strict";var n,r=t("json3"),i=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,o=function(t){var e,n={},r=[];for(e=0;65536>e;e++)r.push(String.fromCharCode(e));return t.lastIndex=0,r.join("").replace(t,function(t){return n[t]="\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4),""}),t.lastIndex=0,n};e.exports={quote:function(t){var e=r.stringify(t);return i.lastIndex=0,i.test(e)?(n||(n=o(i)),e.replace(i,function(t){return n[t]})):e}}},{json3:55}],46:[function(t,e){(function(n){"use strict";var r=t("./random"),i={},o=!1,s=n.chrome&&n.chrome.app&&n.chrome.app.runtime;e.exports={attachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.addEventListener(t,e,!1):n.document&&n.attachEvent&&(n.document.attachEvent("on"+t,e),n.attachEvent("on"+t,e))},detachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.removeEventListener(t,e,!1):n.document&&n.detachEvent&&(n.document.detachEvent("on"+t,e),n.detachEvent("on"+t,e))},unloadAdd:function(t){if(s)return null;var e=r.string(8);return i[e]=t,o&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in i&&delete i[t]},triggerUnloadCallbacks:function(){for(var t in i)i[t](),delete i[t]}};var a=function(){o||(o=!0,e.exports.triggerUnloadCallbacks())};s||e.exports.attachEvent("unload",a)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./random":50}],47:[function(t,e){(function(n){"use strict";var r=t("./event"),i=t("json3"),o=t("./browser");e.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){e.exports.WPrefix in n||(n[e.exports.WPrefix]={})},postMessage:function(t,r){n.parent!==n&&n.parent.postMessage(i.stringify({windowId:e.exports.currentWindowId,type:t,data:r||""}),"*")},createIframe:function(t,e){var i,o,s=n.document.createElement("iframe"),a=function(){clearTimeout(i);try{s.onload=null}catch(t){}s.onerror=null},u=function(){s&&(a(),setTimeout(function(){s&&s.parentNode.removeChild(s),s=null},0),r.unloadDel(o))},l=function(t){s&&(u(),e(t))},c=function(t,e){try{setTimeout(function(){s&&s.contentWindow&&s.contentWindow.postMessage(t,e)},0)}catch(n){}};return s.src=t,s.style.display="none",s.style.position="absolute",s.onerror=function(){l("onerror")},s.onload=function(){clearTimeout(i),i=setTimeout(function(){l("onload timeout")},2e3)},n.document.body.appendChild(s),i=setTimeout(function(){l("timeout")},15e3),o=r.unloadAdd(u),{post:c,cleanup:u,loaded:a}},createHtmlfile:function(t,i){var o,s,a,u=["Active"].concat("Object").join("X"),l=new n[u]("htmlfile"),c=function(){clearTimeout(o),a.onerror=null},f=function(){l&&(c(),r.unloadDel(s),a.parentNode.removeChild(a),a=l=null,CollectGarbage())},h=function(t){l&&(f(),i(t))},d=function(t,e){try{setTimeout(function(){a&&a.contentWindow&&a.contentWindow.postMessage(t,e)},0)}catch(n){}};l.open(),l.write('<html><script>document.domain="'+n.document.domain+'";</script></html>'),l.close(),l.parentWindow[e.exports.WPrefix]=n[e.exports.WPrefix];var p=l.createElement("div");return l.body.appendChild(p),a=l.createElement("iframe"),p.appendChild(a),a.src=t,a.onerror=function(){h("onerror")},o=setTimeout(function(){h("timeout")},15e3),s=r.unloadAdd(f),{post:d,cleanup:f,loaded:c}}},e.exports.iframeEnabled=!1,n.document&&(e.exports.iframeEnabled=("function"==typeof n.postMessage||"object"==typeof n.postMessage)&&!o.isKonqueror())}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./browser":44,"./event":46,debug:void 0,json3:55}],48:[function(t,e){(function(t){"use strict";var n={};["log","debug","warn"].forEach(function(e){var r;try{r=t.console&&t.console[e]&&t.console[e].apply}catch(i){}n[e]=r?function(){return t.console[e].apply(t.console,arguments)}:"log"===e?function(){}:n.log}),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(t,e){"use strict";e.exports={isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},extend:function(t){if(!this.isObject(t))return t;for(var e,n,r=1,i=arguments.length;i>r;r++){e=arguments[r];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}}},{}],50:[function(t,e){"use strict";var n=t("crypto"),r="abcdefghijklmnopqrstuvwxyz012345";e.exports={string:function(t){for(var e=r.length,i=n.randomBytes(t),o=[],s=0;t>s;s++)o.push(r.substr(i[s]%e,1));return o.join("")},number:function(t){return Math.floor(Math.random()*t)},numberString:function(t){var e=(""+(t-1)).length,n=new Array(e+1).join("0");return(n+this.number(t)).slice(-e)}}},{crypto:43}],51:[function(t,e){"use strict";e.exports=function(t){return{filterToEnabled:function(e,n){var r={main:[],facade:[]};return e?"string"==typeof e&&(e=[e]):e=[],t.forEach(function(t){t&&("websocket"!==t.transportName||n.websocket!==!1)&&(e.length&&-1===e.indexOf(t.transportName)||t.enabled(n)&&(r.main.push(t),t.facadeTransport&&r.facade.push(t.facadeTransport)))}),r}}}},{debug:void 0}],52:[function(t,e){"use strict";var n=t("url-parse");e.exports={getOrigin:function(t){if(!t)return null;var e=new n(t);if("file:"===e.protocol)return null;var r=e.port;return r||(r="https:"===e.protocol?"443":"80"),e.protocol+"//"+e.hostname+":"+r},isOriginEqual:function(t,e){var n=this.getOrigin(t)===this.getOrigin(e);return n},isSchemeEqual:function(t,e){return t.split(":")[0]===e.split(":")[0]},addPath:function(t,e){var n=t.split("?");return n[0]+e+(n[1]?"?"+n[1]:"")},addQuery:function(t,e){return t+(-1===t.indexOf("?")?"?"+e:"&"+e)}}},{debug:void 0,"url-parse":56}],53:[function(t,e){e.exports="1.1.1"},{}],54:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],55:[function(e,n,r){(function(e){(function(){function i(t,e){function n(t){if(n[t]!==m)return n[t];var i;if("bug-string-char-index"==t)i="a"!="a"[0];else if("json"==t)i=n("json-stringify")&&n("json-parse");else{var s,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var u=e.stringify,c="function"==typeof u&&g;if(c){(s=function(){return 1}).toJSON=s;try{c="0"===u(0)&&"0"===u(new r)&&'""'==u(new o)&&u(b)===m&&u(m)===m&&u()===m&&"1"===u(s)&&"[1]"==u([s])&&"[null]"==u([m])&&"null"==u(null)&&"[null,null,null]"==u([m,b,null])&&u({a:[s,!0,!1,null,"\x00\b\n\f\r "]})==a&&"1"===u(null,s)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new l(-1))}catch(f){c=!1}}i=c}if("json-parse"==t){var h=e.parse;if("function"==typeof h)try{if(0===h("0")&&!h(!1)){s=h(a);var d=5==s.a.length&&1===s.a[0];if(d){try{d=!h('" "')}catch(f){}if(d)try{d=1!==h("01")}catch(f){}if(d)try{d=1!==h("1.")}catch(f){}}}}catch(f){d=!1}i=d}}return n[t]=!!i}t||(t=u.Object()),e||(e=u.Object());var r=t.Number||u.Number,o=t.String||u.String,a=t.Object||u.Object,l=t.Date||u.Date,c=t.SyntaxError||u.SyntaxError,f=t.TypeError||u.TypeError,h=t.Math||u.Math,d=t.JSON||u.JSON;"object"==typeof d&&d&&(e.stringify=d.stringify,e.parse=d.parse);var p,v,m,y=a.prototype,b=y.toString,g=new l(-0xc782b5b800cec);try{g=-109252==g.getUTCFullYear()&&0===g.getUTCMonth()&&1===g.getUTCDate()&&10==g.getUTCHours()&&37==g.getUTCMinutes()&&6==g.getUTCSeconds()&&708==g.getUTCMilliseconds()}catch(w){}if(!n("json")){var x="[object Function]",_="[object Date]",E="[object Number]",j="[object String]",T="[object Array]",S="[object Boolean]",O=n("bug-string-char-index");if(!g)var C=h.floor,A=[0,31,59,90,120,151,181,212,243,273,304,334],N=function(t,e){return A[e]+365*(t-1970)+C((t-1969+(e=+(e>1)))/4)-C((t-1901+e)/100)+C((t-1601+e)/400)};if((p=y.hasOwnProperty)||(p=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=b?p=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,p=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,p.call(this,t)}),v=function(t,e){var n,r,i,o=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(i in r)p.call(r,i)&&o++;return n=r=null,o?v=2==o?function(t,e){var n,r={},i=b.call(t)==x;for(n in t)i&&"prototype"==n||p.call(r,n)||!(r[n]=1)||!p.call(t,n)||e(n)}:function(t,e){var n,r,i=b.call(t)==x;for(n in t)i&&"prototype"==n||!p.call(t,n)||(r="constructor"===n)||e(n);(r||p.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],v=function(t,e){var n,i,o=b.call(t)==x,a=!o&&"function"!=typeof t.constructor&&s[typeof t.hasOwnProperty]&&t.hasOwnProperty||p;for(n in t)o&&"prototype"==n||!a.call(t,n)||e(n);for(i=r.length;n=r[--i];a.call(t,n)&&e(n));}),v(t,e)},!n("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},I="000000",P=function(t,e){return(I+(e||0)).slice(-t)},L="\\u00",R=function(t){for(var e='"',n=0,r=t.length,i=!O||r>10,o=i&&(O?t.split(""):t);r>n;n++){var s=t.charCodeAt(n);switch(s){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=k[s];break;default:if(32>s){e+=L+P(2,s.toString(16));break}e+=i?o[n]:t.charAt(n)}}return e+'"'},U=function(t,e,n,r,i,o,s){var a,u,l,c,h,d,y,g,w,x,O,A,k,I,L,M;try{a=e[t]}catch(q){}if("object"==typeof a&&a)if(u=b.call(a),u!=_||p.call(a,"toJSON"))"function"==typeof a.toJSON&&(u!=E&&u!=j&&u!=T||p.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-1/0&&1/0>a){if(N){for(h=C(a/864e5),l=C(h/365.2425)+1970-1;N(l+1,0)<=h;l++);for(c=C((h-N(l,0))/30.42);N(l,c+1)<=h;c++);h=1+h-N(l,c),d=(a%864e5+864e5)%864e5,y=C(d/36e5)%24,g=C(d/6e4)%60,w=C(d/1e3)%60,x=d%1e3}else l=a.getUTCFullYear(),c=a.getUTCMonth(),h=a.getUTCDate(),y=a.getUTCHours(),g=a.getUTCMinutes(),w=a.getUTCSeconds(),x=a.getUTCMilliseconds();a=(0>=l||l>=1e4?(0>l?"-":"+")+P(6,0>l?-l:l):P(4,l))+"-"+P(2,c+1)+"-"+P(2,h)+"T"+P(2,y)+":"+P(2,g)+":"+P(2,w)+"."+P(3,x)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if(u=b.call(a),u==S)return""+a;if(u==E)return a>-1/0&&1/0>a?""+a:"null";if(u==j)return R(""+a);if("object"==typeof a){for(I=s.length;I--;)if(s[I]===a)throw f();if(s.push(a),O=[],L=o,o+=i,u==T){for(k=0,I=a.length;I>k;k++)A=U(k,a,n,r,i,o,s),O.push(A===m?"null":A);M=O.length?i?"[\n"+o+O.join(",\n"+o)+"\n"+L+"]":"["+O.join(",")+"]":"[]"}else v(r||a,function(t){var e=U(t,a,n,r,i,o,s);e!==m&&O.push(R(t)+":"+(i?" ":"")+e)}),M=O.length?i?"{\n"+o+O.join(",\n"+o)+"\n"+L+"}":"{"+O.join(",")+"}":"{}";return s.pop(),M}};e.stringify=function(t,e,n){var r,i,o,a;if(s[typeof e]&&e)if((a=b.call(e))==x)i=e;else if(a==T){o={};for(var u,l=0,c=e.length;c>l;u=e[l++],a=b.call(u),(a==j||a==E)&&(o[u]=1));}if(n)if((a=b.call(n))==E){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.length<n;r+=" ");}else a==j&&(r=n.length<=10?n:n.slice(0,10));return U("",(u={},u[""]=t,u),i,o,r,"",[])}}if(!n("json-parse")){var M,q,D=o.fromCharCode,W={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:"\n",102:"\f",114:"\r"},J=function(){throw M=q=null,c()},B=function(){for(var t,e,n,r,i,o=q,s=o.length;s>M;)switch(i=o.charCodeAt(M)){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=O?o.charAt(M):o[M],M++,t;case 34:for(t="@",M++;s>M;)if(i=o.charCodeAt(M),32>i)J();else if(92==i)switch(i=o.charCodeAt(++M)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=W[i],M++;break;case 117:for(e=++M,n=M+4;n>M;M++)i=o.charCodeAt(M),i>=48&&57>=i||i>=97&&102>=i||i>=65&&70>=i||J();t+=D("0x"+o.slice(e,M));break;default:J()}else{if(34==i)break;for(i=o.charCodeAt(M),e=M;i>=32&&92!=i&&34!=i;)i=o.charCodeAt(++M);t+=o.slice(e,M)}if(34==o.charCodeAt(M))return M++,t;J();default:if(e=M,45==i&&(r=!0,i=o.charCodeAt(++M)),i>=48&&57>=i){for(48==i&&(i=o.charCodeAt(M+1),i>=48&&57>=i)&&J(),r=!1;s>M&&(i=o.charCodeAt(M),i>=48&&57>=i);M++);if(46==o.charCodeAt(M)){for(n=++M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}if(i=o.charCodeAt(M),101==i||69==i){for(i=o.charCodeAt(++M),(43==i||45==i)&&M++,n=M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}return+o.slice(e,M)}if(r&&J(),"true"==o.slice(M,M+4))return M+=4,!0;if("false"==o.slice(M,M+5))return M+=5,!1;if("null"==o.slice(M,M+4))return M+=4,null;J()}return"$"},G=function(t){var e,n;if("$"==t&&J(),"string"==typeof t){if("@"==(O?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];t=B(),"]"!=t;n||(n=!0))n&&(","==t?(t=B(),"]"==t&&J()):J()),","==t&&J(),e.push(G(t));return e}if("{"==t){for(e={};t=B(),"}"!=t;n||(n=!0))n&&(","==t?(t=B(),"}"==t&&J()):J()),(","==t||"string"!=typeof t||"@"!=(O?t.charAt(0):t[0])||":"!=B())&&J(),e[t.slice(1)]=G(B());return e}J()}return t},F=function(t,e,n){var r=H(t,e,n);r===m?delete t[e]:t[e]=r},H=function(t,e,n){var r,i=t[e];if("object"==typeof i&&i)if(b.call(i)==T)for(r=i.length;r--;)F(i,r,n);else v(i,function(t){F(i,t,n)});return n.call(t,e,i)};e.parse=function(t,e){var n,r;return M=0,q=""+t,n=G(B()),"$"!=B()&&J(),M=q=null,e&&b.call(e)==x?H((r={},r[""]=n,r),"",e):n}}}return e.runInContext=i,e}var o="function"==typeof t&&t.amd,s={"function":!0,object:!0},a=s[typeof r]&&r&&!r.nodeType&&r,u=s[typeof window]&&window||this,l=a&&s[typeof n]&&n&&!n.nodeType&&"object"==typeof e&&e;if(!l||l.global!==l&&l.window!==l&&l.self!==l||(u=l),a&&!o)i(u,a);else{var c=u.JSON,f=u.JSON3,h=!1,d=i(u,u.JSON3={noConflict:function(){return h||(h=!0,u.JSON=c,u.JSON3=f,c=f=null),d}});u.JSON={parse:d.parse,stringify:d.stringify}}o&&t(function(){return d})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],56:[function(t,e){"use strict";function n(t){var e=u.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]?e[3]:""}}function r(t,e,u){if(!(this instanceof r))return new r(t,e,u);var c,f,h,d,p=a.test(t),v=typeof e,m=this,y=0;"object"!==v&&"string"!==v&&(u=e,e=null),u&&"function"!=typeof u&&(u=s.parse),e=o(e);var b=n(t);for(m.protocol=b.protocol||e.protocol||"",m.slashes=b.slashes||e.slashes,t=b.rest;y<l.length;y++)f=l[y],c=f[0],d=f[1],c!==c?m[d]=t:"string"==typeof c?~(h=t.indexOf(c))&&("number"==typeof f[2]?(m[d]=t.slice(0,h),t=t.slice(h+f[2])):(m[d]=t.slice(h),t=t.slice(0,h))):(h=c.exec(t))&&(m[d]=h[1],t=t.slice(0,t.length-h[0].length)),m[d]=m[d]||(f[3]||"port"===d&&p?e[d]||"":""),f[4]&&(m[d]=m[d].toLowerCase());u&&(m.query=u(m.query)),i(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(f=m.auth.split(":"),m.username=f[0]||"",m.password=f[1]||""),m.href=m.toString()}var i=t("requires-port"),o=t("./lolcation"),s=t("querystringify"),a=/^\/(?!\/)/,u=/^([a-z0-9.+-]+:)?(\/\/)?(.*)$/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[0/0,"host",void 0,1,1],[/\:(\d+)$/,"port"],[0/0,"hostname",void 0,1,1]];r.prototype.set=function(t,e,n){var r=this;return"query"===t?("string"==typeof e&&e.length&&(e=(n||s.parse)(e)),r[t]=e):"port"===t?(r[t]=e,i(e,r.protocol)?e&&(r.host=r.hostname+":"+e):(r.host=r.hostname,r[t]="")):"hostname"===t?(r[t]=e,r.port&&(e+=":"+r.port),r.host=e):"host"===t?(r[t]=e,/\:\d+/.test(e)&&(e=e.split(":"),r.hostname=e[0],r.port=e[1])):"protocol"===t?(r.protocol=e,r.slashes=!n):r[t]=e,r.href=r.toString(),r},r.prototype.toString=function(t){t&&"function"==typeof t||(t=s.stringify);var e,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var i=r+(n.slashes?"//":"");return n.username&&(i+=n.username,n.password&&(i+=":"+n.password),i+="@"),i+=n.hostname,n.port&&(i+=":"+n.port),i+=n.pathname,e="object"==typeof n.query?t(n.query):n.query,e&&(i+="?"!==e.charAt(0)?"?"+e:e),n.hash&&(i+=n.hash),i},r.qs=s,r.location=o,e.exports=r},{"./lolcation":57,querystringify:58,"requires-port":59}],57:[function(t,e){(function(n){"use strict";var r,i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,o={hash:1,query:1};e.exports=function(e){e=e||n.location||{},r=r||t("./");var s,a={},u=typeof e;if("blob:"===e.protocol)a=new r(unescape(e.pathname),{});else if("string"===u){a=new r(e,{});for(s in o)delete a[s]}else if("object"===u){for(s in e)s in o||(a[s]=e[s]);void 0===a.slashes&&(a.slashes=i.test(e.href))}return a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":56}],58:[function(t,e,n){"use strict";function r(t){for(var e,n=/([^=?&]+)=([^&]*)/g,r={};e=n.exec(t);r[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return r}function i(t,e){e=e||"";var n=[];"string"!=typeof e&&(e="?");for(var r in t)o.call(t,r)&&n.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return n.length?e+n.join("&"):""}var o=Object.prototype.hasOwnProperty;n.stringify=i,n.parse=r},{}],59:[function(t,e){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}]},{},[1])(1)});
4 4 \ No newline at end of file
... ...
src/main/resources/static/assets/plugins/layer-v2.4/demo.html
1   -<!doctype html>
2   -<html>
3   -<head>
4   -<meta charset="utf-8">
5   -<title>layer-更懂你的web弹窗解决方案</title>
6   -<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
7   -<script src="layer/layer.js"></script>
8   -
9   -<style>
10   -html{background-color:#E3E3E3; font-size:14px; color:#000; font-family:'微软雅黑'}
11   -a,a:hover{ text-decoration:none;}
12   -pre{font-family:'微软雅黑'}
13   -.box{padding:20px; background-color:#fff; margin:50px 100px; border-radius:5px;}
14   -.box a{padding-right:15px;}
15   -#about_hide{display:none}
16   -.layer_text{background-color:#fff; padding:20px;}
17   -.layer_text p{margin-bottom: 10px; text-indent: 2em; line-height: 23px;}
18   -.button{display:inline-block; *display:inline; *zoom:1; line-height:30px; padding:0 20px; background-color:#56B4DC; color:#fff; font-size:14px; border-radius:3px; cursor:pointer; font-weight:normal;}
19   -.photos-demo img{width:200px;}
20   -</style>
21   -</head>
22   -<body>
23   -<div class="box">
24   -<pre>
25   - @Name:layer-v<script>document.write(layer.v)</script> 弹层组件说明
26   - @Author:贤心
27   - @Site:<a href="http://layer.layui.com/?form=local" target="_blank">http://layer.layui.com</a>
28   - @Github:<a href="https://github.com/sentsin/layer" target="_blank">https://github.com/sentsin/layer</a>
29   -
30   -
31   -<strong>【注意事项】</strong>
32   -一、使用时,请把文件夹layer整个放置在您站点的任何一个目录,只需引入layer.js即可,除jQuery外,其它文件无需再引入。
33   -二、如果您的js引入是通过合并处理或者您不想采用layer自动获取的绝对路径,您可以通过layer.config()来配置(详见官网API页)
34   -三、jQuery最低要求1.8
35   -四、更多使用说明与演示,请参见layer官网。
36   -五、请勿用于虚假诈骗、及违反我国法律的Web平台。这一点非常重要非常的重要!
37   -六、layer遵循LGPL协议,将永久性提供无偿服务。版权最终解释权:贤心。
38   -</pre>
39   -</div>
40   -
41   -<div class="box">
42   - <h2 style="padding-bottom:20px;">扩展模块:图片查看器(相册层)</h2>
43   - <div id="photosDemo" class="photos-demo">
44   - <!-- layer-src表示大图 layer-pid表示图片id src表示缩略图-->
45   -
46   - <img layer-src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" layer-pid="" src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" alt="layer宣传图">
47   - <img layer-src="http://sentsin.qiniudn.com/sentsinmy5.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinmy5.jpg" alt="我入互联网这五年">
48   - <img layer-src="" layer-pid="" src="http://sentsin.qiniudn.com/sentsin_39101a660cf4671b7ec297a74cc652c74152104f.jpg" alt="微摄影">
49   - <img layer-src="http://sentsin.qiniudn.com/sentsinsan01.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinsan01.jpg" alt="三清山">
50   - <img layer-src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" layer-pid="" src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" alt="国足">
51   - </div>
52   -
53   -</div>
54   -
55   -
56   -<div class="box" style="text-align:center">
57   - <a href="http://layer.layui.com/?form=local" target="_blank">更多示例</a>
58   - <a href="http://layer.layui.com/api.html" target="_blank">使用文档</a>
59   - <a href="http://fly.layui.com" target="_blank" title="Fly">交流反馈</a>
60   - <a href="javascript:;" id="about">关于</a>
61   -</div>
62   -
63   -<script>
64   -;!function(){
65   -
66   -//页面一打开就执行,放入ready是为了layer所需配件(css、扩展模块)加载完毕
67   -layer.ready(function(){
68   - //官网欢迎页
69   - layer.open({
70   - type: 2,
71   - //skin: 'layui-layer-lan',
72   - title: 'layer弹层组件',
73   - fix: false,
74   - shadeClose: true,
75   - maxmin: true,
76   - area: ['1000px', '500px'],
77   - content: 'http://layer.layui.com/?form=local',
78   - end: function(){
79   - layer.tips('试试相册模块?', '#photosDemo', {tips: 1})
80   - }
81   - });
82   -
83   - //layer.msg('欢迎使用layer');
84   -
85   - //使用相册
86   - layer.photos({
87   - photos: '#photosDemo'
88   - });
89   -});
90   -
91   -//关于
92   -$('#about').on('click', function(){
93   - layer.alert(layer.v + ' - 贤心出品');
94   -});
95   -
96   -}();
97   -</script>
98   -</body>
  1 +<!doctype html>
  2 +<html>
  3 +<head>
  4 +<meta charset="utf-8">
  5 +<title>layer-更懂你的web弹窗解决方案</title>
  6 +<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
  7 +<script src="layer/layer.js"></script>
  8 +
  9 +<style>
  10 +html{background-color:#E3E3E3; font-size:14px; color:#000; font-family:'微软雅黑'}
  11 +a,a:hover{ text-decoration:none;}
  12 +pre{font-family:'微软雅黑'}
  13 +.box{padding:20px; background-color:#fff; margin:50px 100px; border-radius:5px;}
  14 +.box a{padding-right:15px;}
  15 +#about_hide{display:none}
  16 +.layer_text{background-color:#fff; padding:20px;}
  17 +.layer_text p{margin-bottom: 10px; text-indent: 2em; line-height: 23px;}
  18 +.button{display:inline-block; *display:inline; *zoom:1; line-height:30px; padding:0 20px; background-color:#56B4DC; color:#fff; font-size:14px; border-radius:3px; cursor:pointer; font-weight:normal;}
  19 +.photos-demo img{width:200px;}
  20 +</style>
  21 +</head>
  22 +<body>
  23 +<div class="box">
  24 +<pre>
  25 + @Name:layer-v<script>document.write(layer.v)</script> 弹层组件说明
  26 + @Author:贤心
  27 + @Site:<a href="http://layer.layui.com/?form=local" target="_blank">http://layer.layui.com</a>
  28 + @Github:<a href="https://github.com/sentsin/layer" target="_blank">https://github.com/sentsin/layer</a>
  29 +
  30 +
  31 +<strong>【注意事项】</strong>
  32 +一、使用时,请把文件夹layer整个放置在您站点的任何一个目录,只需引入layer.js即可,除jQuery外,其它文件无需再引入。
  33 +二、如果您的js引入是通过合并处理或者您不想采用layer自动获取的绝对路径,您可以通过layer.config()来配置(详见官网API页)
  34 +三、jQuery最低要求1.8
  35 +四、更多使用说明与演示,请参见layer官网。
  36 +五、请勿用于虚假诈骗、及违反我国法律的Web平台。这一点非常重要非常的重要!
  37 +六、layer遵循LGPL协议,将永久性提供无偿服务。版权最终解释权:贤心。
  38 +</pre>
  39 +</div>
  40 +
  41 +<div class="box">
  42 + <h2 style="padding-bottom:20px;">扩展模块:图片查看器(相册层)</h2>
  43 + <div id="photosDemo" class="photos-demo">
  44 + <!-- layer-src表示大图 layer-pid表示图片id src表示缩略图-->
  45 +
  46 + <img layer-src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" layer-pid="" src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" alt="layer宣传图">
  47 + <img layer-src="http://sentsin.qiniudn.com/sentsinmy5.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinmy5.jpg" alt="我入互联网这五年">
  48 + <img layer-src="" layer-pid="" src="http://sentsin.qiniudn.com/sentsin_39101a660cf4671b7ec297a74cc652c74152104f.jpg" alt="微摄影">
  49 + <img layer-src="http://sentsin.qiniudn.com/sentsinsan01.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinsan01.jpg" alt="三清山">
  50 + <img layer-src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" layer-pid="" src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" alt="国足">
  51 + </div>
  52 +
  53 +</div>
  54 +
  55 +
  56 +<div class="box" style="text-align:center">
  57 + <a href="http://layer.layui.com/?form=local" target="_blank">更多示例</a>
  58 + <a href="http://layer.layui.com/api.html" target="_blank">使用文档</a>
  59 + <a href="http://fly.layui.com" target="_blank" title="Fly">交流反馈</a>
  60 + <a href="javascript:;" id="about">关于</a>
  61 +</div>
  62 +
  63 +<script>
  64 +;!function(){
  65 +
  66 +//页面一打开就执行,放入ready是为了layer所需配件(css、扩展模块)加载完毕
  67 +layer.ready(function(){
  68 + //官网欢迎页
  69 + layer.open({
  70 + type: 2,
  71 + //skin: 'layui-layer-lan',
  72 + title: 'layer弹层组件',
  73 + fix: false,
  74 + shadeClose: true,
  75 + maxmin: true,
  76 + area: ['1000px', '500px'],
  77 + content: 'http://layer.layui.com/?form=local',
  78 + end: function(){
  79 + layer.tips('试试相册模块?', '#photosDemo', {tips: 1})
  80 + }
  81 + });
  82 +
  83 + //layer.msg('欢迎使用layer');
  84 +
  85 + //使用相册
  86 + layer.photos({
  87 + photos: '#photosDemo'
  88 + });
  89 +});
  90 +
  91 +//关于
  92 +$('#about').on('click', function(){
  93 + layer.alert(layer.v + ' - 贤心出品');
  94 +});
  95 +
  96 +}();
  97 +</script>
  98 +</body>
99 99 </html>
100 100 \ No newline at end of file
... ...
src/main/resources/static/assets/plugins/layer-v2.4/layer/layer.js
1   -/*! layer-v2.4 弹层组件 License LGPL http://layer.layui.com/ By 贤心 */
  1 +/*! layer-v2.4 弹层组件 License LGPL http://layer.layui.com/ By 贤心 */
2 2 ;!function(a,b){"use strict";var c,d,e={getPath:function(){var a=document.scripts,b=a[a.length-1],c=b.src;if(!b.getAttribute("merge"))return c.substring(0,c.lastIndexOf("/")+1)}(),enter:function(a){13===a.keyCode&&a.preventDefault()},config:{},end:{},btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],type:["dialog","page","iframe","loading","tips"]},f={v:"2.4",ie6:!!a.ActiveXObject&&!a.XMLHttpRequest,index:0,path:e.getPath,config:function(a,b){var d=0;return a=a||{},f.cache=e.config=c.extend(e.config,a),f.path=e.config.path||f.path,"string"==typeof a.extend&&(a.extend=[a.extend]),f.use("skin/layer.css",a.extend&&a.extend.length>0?function g(){var c=a.extend;f.use(c[c[d]?d:d-1],d<c.length?function(){return++d,g}():b)}():b),this},use:function(a,b,d){var e=c("head")[0],a=a.replace(/\s/g,""),g=/\.css$/.test(a),h=document.createElement(g?"link":"script"),i="layui_layer_"+a.replace(/\.|\//g,"");return f.path?(g&&(h.rel="stylesheet"),h[g?"href":"src"]=/^http:\/\//.test(a)?a:f.path+a,h.id=i,c("#"+i)[0]||e.appendChild(h),function j(){(g?1989===parseInt(c("#"+i).css("width")):f[d||i])?function(){b&&b();try{g||e.removeChild(h)}catch(a){}}():setTimeout(j,100)}(),this):void 0},ready:function(a,b){var d="function"==typeof a;return d&&(b=a),f.config(c.extend(e.config,function(){return d?{}:{path:a}}()),b),this},alert:function(a,b,d){var e="function"==typeof b;return e&&(d=b),f.open(c.extend({content:a,yes:d},e?{}:b))},confirm:function(a,b,d,g){var h="function"==typeof b;return h&&(g=d,d=b),f.open(c.extend({content:a,btn:e.btn,yes:d,btn2:g},h?{}:b))},msg:function(a,d,g){var i="function"==typeof d,j=e.config.skin,k=(j?j+" "+j+"-msg":"")||"layui-layer-msg",l=h.anim.length-1;return i&&(g=d),f.open(c.extend({content:a,time:3e3,shade:!1,skin:k,title:!1,closeBtn:!1,btn:!1,end:g},i&&!e.config.skin?{skin:k+" layui-layer-hui",shift:l}:function(){return d=d||{},(-1===d.icon||d.icon===b&&!e.config.skin)&&(d.skin=k+" "+(d.skin||"layui-layer-hui")),d}()))},load:function(a,b){return f.open(c.extend({type:3,icon:a||0,shade:.01},b))},tips:function(a,b,d){return f.open(c.extend({type:4,content:[a,b],closeBtn:!1,time:3e3,shade:!1,fix:!1,maxWidth:210},d))}},g=function(a){var b=this;b.index=++f.index,b.config=c.extend({},b.config,e.config,a),b.creat()};g.pt=g.prototype;var h=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];h.anim=["layer-anim","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],g.pt.config={type:0,shade:.3,fix:!0,move:h[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,shift:0,icon:-1,scrollbar:!0,tips:2},g.pt.vessel=function(a,b){var c=this,d=c.index,f=c.config,g=f.zIndex+d,i="object"==typeof f.title,j=f.maxmin&&(1===f.type||2===f.type),k=f.title?'<div class="layui-layer-title" style="'+(i?f.title[1]:"")+'">'+(i?f.title[0]:f.title)+"</div>":"";return f.zIndex=g,b([f.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+d+'" times="'+d+'" style="'+("z-index:"+(g-1)+"; background-color:"+(f.shade[1]||"#000")+"; opacity:"+(f.shade[0]||f.shade)+"; filter:alpha(opacity="+(100*f.shade[0]||100*f.shade)+");")+'"></div>':"",'<div class="'+h[0]+(" layui-layer-"+e.type[f.type])+(0!=f.type&&2!=f.type||f.shade?"":" layui-layer-border")+" "+(f.skin||"")+'" id="'+h[0]+d+'" type="'+e.type[f.type]+'" times="'+d+'" showtime="'+f.time+'" conType="'+(a?"object":"string")+'" style="z-index: '+g+"; width:"+f.area[0]+";height:"+f.area[1]+(f.fix?"":";position:absolute;")+'">'+(a&&2!=f.type?"":k)+'<div id="'+(f.id||"")+'" class="layui-layer-content'+(0==f.type&&-1!==f.icon?" layui-layer-padding":"")+(3==f.type?" layui-layer-loading"+f.icon:"")+'">'+(0==f.type&&-1!==f.icon?'<i class="layui-layer-ico layui-layer-ico'+f.icon+'"></i>':"")+(1==f.type&&a?"":f.content||"")+'</div><span class="layui-layer-setwin">'+function(){var a=j?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return f.closeBtn&&(a+='<a class="layui-layer-ico '+h[7]+" "+h[7]+(f.title?f.closeBtn:4==f.type?"1":"2")+'" href="javascript:;"></a>'),a}()+"</span>"+(f.btn?function(){var a="";"string"==typeof f.btn&&(f.btn=[f.btn]);for(var b=0,c=f.btn.length;c>b;b++)a+='<a class="'+h[6]+b+'">'+f.btn[b]+"</a>";return'<div class="'+h[6]+'">'+a+"</div>"}():"")+"</div>"],k),c},g.pt.creat=function(){var a=this,b=a.config,g=a.index,i=b.content,j="object"==typeof i;if(!c("#"+b.id)[0]){switch("string"==typeof b.area&&(b.area="auto"===b.area?["",""]:[b.area,""]),b.type){case 0:b.btn="btn"in b?b.btn:e.btn[0],f.closeAll("dialog");break;case 2:var i=b.content=j?b.content:[b.content||"http://layer.layui.com","auto"];b.content='<iframe scrolling="'+(b.content[1]||"auto")+'" allowtransparency="true" id="'+h[4]+g+'" name="'+h[4]+g+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+b.content[0]+'"></iframe>';break;case 3:b.title=!1,b.closeBtn=!1,-1===b.icon&&0===b.icon,f.closeAll("loading");break;case 4:j||(b.content=[b.content,"body"]),b.follow=b.content[1],b.content=b.content[0]+'<i class="layui-layer-TipsG"></i>',b.title=!1,b.tips="object"==typeof b.tips?b.tips:[b.tips,!0],b.tipsMore||f.closeAll("tips")}a.vessel(j,function(d,e){c("body").append(d[0]),j?function(){2==b.type||4==b.type?function(){c("body").append(d[1])}():function(){i.parents("."+h[0])[0]||(i.show().addClass("layui-layer-wrap").wrap(d[1]),c("#"+h[0]+g).find("."+h[5]).before(e))}()}():c("body").append(d[1]),a.layero=c("#"+h[0]+g),b.scrollbar||h.html.css("overflow","hidden").attr("layer-full",g)}).auto(g),2==b.type&&f.ie6&&a.layero.find("iframe").attr("src",i[0]),c(document).off("keydown",e.enter).on("keydown",e.enter),a.layero.on("keydown",function(a){c(document).off("keydown",e.enter)}),4==b.type?a.tips():a.offset(),b.fix&&d.on("resize",function(){a.offset(),(/^\d+%$/.test(b.area[0])||/^\d+%$/.test(b.area[1]))&&a.auto(g),4==b.type&&a.tips()}),b.time<=0||setTimeout(function(){f.close(a.index)},b.time),a.move().callback(),h.anim[b.shift]&&a.layero.addClass(h.anim[b.shift])}},g.pt.auto=function(a){function b(a){a=g.find(a),a.height(i[1]-j-k-2*(0|parseFloat(a.css("padding"))))}var e=this,f=e.config,g=c("#"+h[0]+a);""===f.area[0]&&f.maxWidth>0&&(/MSIE 7/.test(navigator.userAgent)&&f.btn&&g.width(g.innerWidth()),g.outerWidth()>f.maxWidth&&g.width(f.maxWidth));var i=[g.innerWidth(),g.innerHeight()],j=g.find(h[1]).outerHeight()||0,k=g.find("."+h[6]).outerHeight()||0;switch(f.type){case 2:b("iframe");break;default:""===f.area[1]?f.fix&&i[1]>=d.height()&&(i[1]=d.height(),b("."+h[5])):b("."+h[5])}return e},g.pt.offset=function(){var a=this,b=a.config,c=a.layero,e=[c.outerWidth(),c.outerHeight()],f="object"==typeof b.offset;a.offsetTop=(d.height()-e[1])/2,a.offsetLeft=(d.width()-e[0])/2,f?(a.offsetTop=b.offset[0],a.offsetLeft=b.offset[1]||a.offsetLeft):"auto"!==b.offset&&(a.offsetTop=b.offset,"rb"===b.offset&&(a.offsetTop=d.height()-e[1],a.offsetLeft=d.width()-e[0])),b.fix||(a.offsetTop=/%$/.test(a.offsetTop)?d.height()*parseFloat(a.offsetTop)/100:parseFloat(a.offsetTop),a.offsetLeft=/%$/.test(a.offsetLeft)?d.width()*parseFloat(a.offsetLeft)/100:parseFloat(a.offsetLeft),a.offsetTop+=d.scrollTop(),a.offsetLeft+=d.scrollLeft()),c.css({top:a.offsetTop,left:a.offsetLeft})},g.pt.tips=function(){var a=this,b=a.config,e=a.layero,f=[e.outerWidth(),e.outerHeight()],g=c(b.follow);g[0]||(g=c("body"));var i={width:g.outerWidth(),height:g.outerHeight(),top:g.offset().top,left:g.offset().left},j=e.find(".layui-layer-TipsG"),k=b.tips[0];b.tips[1]||j.remove(),i.autoLeft=function(){i.left+f[0]-d.width()>0?(i.tipLeft=i.left+i.width-f[0],j.css({right:12,left:"auto"})):i.tipLeft=i.left},i.where=[function(){i.autoLeft(),i.tipTop=i.top-f[1]-10,j.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left+i.width+10,i.tipTop=i.top,j.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",b.tips[1])},function(){i.autoLeft(),i.tipTop=i.top+i.height+10,j.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left-f[0]-10,i.tipTop=i.top,j.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",b.tips[1])}],i.where[k-1](),1===k?i.top-(d.scrollTop()+f[1]+16)<0&&i.where[2]():2===k?d.width()-(i.left+i.width+f[0]+16)>0||i.where[3]():3===k?i.top-d.scrollTop()+i.height+f[1]+16-d.height()>0&&i.where[0]():4===k&&f[0]+16-i.left>0&&i.where[1](),e.find("."+h[5]).css({"background-color":b.tips[1],"padding-right":b.closeBtn?"30px":""}),e.css({left:i.tipLeft-(b.fix?d.scrollLeft():0),top:i.tipTop-(b.fix?d.scrollTop():0)})},g.pt.move=function(){var a=this,b=a.config,e={setY:0,moveLayer:function(){var a=e.layero,b=parseInt(a.css("margin-left")),c=parseInt(e.move.css("left"));0===b||(c-=b),"fixed"!==a.css("position")&&(c-=a.parent().offset().left,e.setY=0),a.css({left:c,top:parseInt(e.move.css("top"))-e.setY})}},f=a.layero.find(b.move);return b.move&&f.attr("move","ok"),f.css({cursor:b.move?"move":"auto"}),c(b.move).on("mousedown",function(a){if(a.preventDefault(),"ok"===c(this).attr("move")){e.ismove=!0,e.layero=c(this).parents("."+h[0]);var f=e.layero.offset().left,g=e.layero.offset().top,i=e.layero.outerWidth()-6,j=e.layero.outerHeight()-6;c("#layui-layer-moves")[0]||c("body").append('<div id="layui-layer-moves" class="layui-layer-moves" style="left:'+f+"px; top:"+g+"px; width:"+i+"px; height:"+j+'px; z-index:2147483584"></div>'),e.move=c("#layui-layer-moves"),b.moveType&&e.move.css({visibility:"hidden"}),e.moveX=a.pageX-e.move.position().left,e.moveY=a.pageY-e.move.position().top,"fixed"!==e.layero.css("position")||(e.setY=d.scrollTop())}}),c(document).mousemove(function(a){if(e.ismove){var c=a.pageX-e.moveX,f=a.pageY-e.moveY;if(a.preventDefault(),!b.moveOut){e.setY=d.scrollTop();var g=d.width()-e.move.outerWidth(),h=e.setY;0>c&&(c=0),c>g&&(c=g),h>f&&(f=h),f>d.height()-e.move.outerHeight()+e.setY&&(f=d.height()-e.move.outerHeight()+e.setY)}e.move.css({left:c,top:f}),b.moveType&&e.moveLayer(),c=f=g=h=null}}).mouseup(function(){try{e.ismove&&(e.moveLayer(),e.move.remove(),b.moveEnd&&b.moveEnd()),e.ismove=!1}catch(a){e.ismove=!1}}),a},g.pt.callback=function(){function a(){var a=g.cancel&&g.cancel(b.index,d);a===!1||f.close(b.index)}var b=this,d=b.layero,g=b.config;b.openLayer(),g.success&&(2==g.type?d.find("iframe").on("load",function(){g.success(d,b.index)}):g.success(d,b.index)),f.ie6&&b.IE6(d),d.find("."+h[6]).children("a").on("click",function(){var a=c(this).index();if(0===a)g.yes?g.yes(b.index,d):g.btn1?g.btn1(b.index,d):f.close(b.index);else{var e=g["btn"+(a+1)]&&g["btn"+(a+1)](b.index,d);e===!1||f.close(b.index)}}),d.find("."+h[7]).on("click",a),g.shadeClose&&c("#layui-layer-shade"+b.index).on("click",function(){f.close(b.index)}),d.find(".layui-layer-min").on("click",function(){var a=g.min&&g.min(d);a===!1||f.min(b.index,g)}),d.find(".layui-layer-max").on("click",function(){c(this).hasClass("layui-layer-maxmin")?(f.restore(b.index),g.restore&&g.restore(d)):(f.full(b.index,g),setTimeout(function(){g.full&&g.full(d)},100))}),g.end&&(e.end[b.index]=g.end)},e.reselect=function(){c.each(c("select"),function(a,b){var d=c(this);d.parents("."+h[0])[0]||1==d.attr("layer")&&c("."+h[0]).length<1&&d.removeAttr("layer").show(),d=null})},g.pt.IE6=function(a){function b(){a.css({top:f+(e.config.fix?d.scrollTop():0)})}var e=this,f=a.offset().top;b(),d.scroll(b),c("select").each(function(a,b){var d=c(this);d.parents("."+h[0])[0]||"none"===d.css("display")||d.attr({layer:"1"}).hide(),d=null})},g.pt.openLayer=function(){var a=this;f.zIndex=a.config.zIndex,f.setTop=function(a){var b=function(){f.zIndex++,a.css("z-index",f.zIndex+1)};return f.zIndex=parseInt(a[0].style.zIndex),a.on("mousedown",b),f.zIndex}},e.record=function(a){var b=[a.width(),a.height(),a.position().top,a.position().left+parseFloat(a.css("margin-left"))];a.find(".layui-layer-max").addClass("layui-layer-maxmin"),a.attr({area:b})},e.rescollbar=function(a){h.html.attr("layer-full")==a&&(h.html[0].style.removeProperty?h.html[0].style.removeProperty("overflow"):h.html[0].style.removeAttribute("overflow"),h.html.removeAttr("layer-full"))},a.layer=f,f.getChildFrame=function(a,b){return b=b||c("."+h[4]).attr("times"),c("#"+h[0]+b).find("iframe").contents().find(a)},f.getFrameIndex=function(a){return c("#"+a).parents("."+h[4]).attr("times")},f.iframeAuto=function(a){if(a){var b=f.getChildFrame("html",a).outerHeight(),d=c("#"+h[0]+a),e=d.find(h[1]).outerHeight()||0,g=d.find("."+h[6]).outerHeight()||0;d.css({height:b+e+g}),d.find("iframe").css({height:b})}},f.iframeSrc=function(a,b){c("#"+h[0]+a).find("iframe").attr("src",b)},f.style=function(a,b){var d=c("#"+h[0]+a),f=d.attr("type"),g=d.find(h[1]).outerHeight()||0,i=d.find("."+h[6]).outerHeight()||0;(f===e.type[1]||f===e.type[2])&&(d.css(b),f===e.type[2]&&d.find("iframe").css({height:parseFloat(b.height)-g-i}))},f.min=function(a,b){var d=c("#"+h[0]+a),g=d.find(h[1]).outerHeight()||0;e.record(d),f.style(a,{width:180,height:g,overflow:"hidden"}),d.find(".layui-layer-min").hide(),"page"===d.attr("type")&&d.find(h[4]).hide(),e.rescollbar(a)},f.restore=function(a){var b=c("#"+h[0]+a),d=b.attr("area").split(",");b.attr("type");f.style(a,{width:parseFloat(d[0]),height:parseFloat(d[1]),top:parseFloat(d[2]),left:parseFloat(d[3]),overflow:"visible"}),b.find(".layui-layer-max").removeClass("layui-layer-maxmin"),b.find(".layui-layer-min").show(),"page"===b.attr("type")&&b.find(h[4]).show(),e.rescollbar(a)},f.full=function(a){var b,g=c("#"+h[0]+a);e.record(g),h.html.attr("layer-full")||h.html.css("overflow","hidden").attr("layer-full",a),clearTimeout(b),b=setTimeout(function(){var b="fixed"===g.css("position");f.style(a,{top:b?0:d.scrollTop(),left:b?0:d.scrollLeft(),width:d.width(),height:d.height()}),g.find(".layui-layer-min").hide()},100)},f.title=function(a,b){var d=c("#"+h[0]+(b||f.index)).find(h[1]);d.html(a)},f.close=function(a){var b=c("#"+h[0]+a),d=b.attr("type");if(b[0]){if(d===e.type[1]&&"object"===b.attr("conType")){b.children(":not(."+h[5]+")").remove();for(var g=0;2>g;g++)b.find(".layui-layer-wrap").unwrap().hide()}else{if(d===e.type[2])try{var i=c("#"+h[4]+a)[0];i.contentWindow.document.write(""),i.contentWindow.close(),b.find("."+h[5])[0].removeChild(i)}catch(j){}b[0].innerHTML="",b.remove()}c("#layui-layer-moves, #layui-layer-shade"+a).remove(),f.ie6&&e.reselect(),e.rescollbar(a),c(document).off("keydown",e.enter),"function"==typeof e.end[a]&&e.end[a](),delete e.end[a]}},f.closeAll=function(a){c.each(c("."+h[0]),function(){var b=c(this),d=a?b.attr("type")===a:1;d&&f.close(b.attr("times")),d=null})};var i=f.cache||{},j=function(a){return i.skin?" "+i.skin+" "+i.skin+"-"+a:""};f.prompt=function(a,b){a=a||{},"function"==typeof a&&(b=a);var d,e=2==a.formType?'<textarea class="layui-layer-input">'+(a.value||"")+"</textarea>":function(){return'<input type="'+(1==a.formType?"password":"text")+'" class="layui-layer-input" value="'+(a.value||"")+'">'}();return f.open(c.extend({btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:e,skin:"layui-layer-prompt"+j("prompt"),success:function(a){d=a.find(".layui-layer-input"),d.focus()},yes:function(c){var e=d.val();""===e?d.focus():e.length>(a.maxlength||500)?f.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(a.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",d,{tips:1}):b&&b(e,c,d)}},a))},f.tab=function(a){a=a||{};var b=a.tab||{};return f.open(c.extend({type:1,skin:"layui-layer-tab"+j("tab"),title:function(){var a=b.length,c=1,d="";if(a>0)for(d='<span class="layui-layer-tabnow">'+b[0].title+"</span>";a>c;c++)d+="<span>"+b[c].title+"</span>";return d}(),content:'<ul class="layui-layer-tabmain">'+function(){var a=b.length,c=1,d="";if(a>0)for(d='<li class="layui-layer-tabli xubox_tab_layer">'+(b[0].content||"no content")+"</li>";a>c;c++)d+='<li class="layui-layer-tabli">'+(b[c].content||"no content")+"</li>";return d}()+"</ul>",success:function(b){var d=b.find(".layui-layer-title").children(),e=b.find(".layui-layer-tabmain").children();d.on("mousedown",function(b){b.stopPropagation?b.stopPropagation():b.cancelBubble=!0;var d=c(this),f=d.index();d.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),e.eq(f).show().siblings().hide(),"function"==typeof a.change&&a.change(f)})}},a))},f.photos=function(b,d,e){function g(a,b,c){var d=new Image;return d.src=a,d.complete?b(d):(d.onload=function(){d.onload=null,b(d)},void(d.onerror=function(a){d.onerror=null,c(a)}))}var h={};if(b=b||{},b.photos){var i=b.photos.constructor===Object,k=i?b.photos:{},l=k.data||[],m=k.start||0;if(h.imgIndex=(0|m)+1,b.img=b.img||"img",i){if(0===l.length)return f.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var n=c(b.photos),o=function(){l=[],n.find(b.img).each(function(a){var b=c(this);b.attr("layer-index",a),l.push({alt:b.attr("alt"),pid:b.attr("layer-pid"),src:b.attr("layer-src")||b.attr("src"),thumb:b.attr("src")})})};if(o(),0===l.length)return;if(d||n.on("click",b.img,function(){var a=c(this),d=a.attr("layer-index");f.photos(c.extend(b,{photos:{start:d,data:l,tab:b.tab},full:b.full}),!0),o()}),!d)return}h.imgprev=function(a){h.imgIndex--,h.imgIndex<1&&(h.imgIndex=l.length),h.tabimg(a)},h.imgnext=function(a,b){h.imgIndex++,h.imgIndex>l.length&&(h.imgIndex=1,b)||h.tabimg(a)},h.keyup=function(a){if(!h.end){var b=a.keyCode;a.preventDefault(),37===b?h.imgprev(!0):39===b?h.imgnext(!0):27===b&&f.close(h.index)}},h.tabimg=function(a){l.length<=1||(k.start=h.imgIndex-1,f.close(h.index),f.photos(b,!0,a))},h.event=function(){h.bigimg.hover(function(){h.imgsee.show()},function(){h.imgsee.hide()}),h.bigimg.find(".layui-layer-imgprev").on("click",function(a){a.preventDefault(),h.imgprev()}),h.bigimg.find(".layui-layer-imgnext").on("click",function(a){a.preventDefault(),h.imgnext()}),c(document).on("keyup",h.keyup)},h.loadi=f.load(1,{shade:"shade"in b?!1:.9,scrollbar:!1}),g(l[m].src,function(d){f.close(h.loadi),h.index=f.open(c.extend({type:1,area:function(){var e=[d.width,d.height],f=[c(a).width()-50,c(a).height()-50];return!b.full&&e[0]>f[0]&&(e[0]=f[0],e[1]=e[0]*d.height/d.width),[e[0]+"px",e[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,shift:5*Math.random()|0,skin:"layui-layer-photos"+j("photos"),content:'<div class="layui-layer-phimg"><img src="'+l[m].src+'" alt="'+(l[m].alt||"")+'" layer-pid="'+l[m].pid+'"><div class="layui-layer-imgsee">'+(l.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(e?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(l[m].alt||"")+"</a><em>"+h.imgIndex+"/"+l.length+"</em></span></div></div></div>",success:function(a,c){h.bigimg=a.find(".layui-layer-phimg"),h.imgsee=a.find(".layui-layer-imguide,.layui-layer-imgbar"),h.event(a),b.tab&&b.tab(l[m],a)},end:function(){h.end=!0,c(document).off("keyup",h.keyup)}},b))},function(){f.close(h.loadi),f.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["&#x4E0B;&#x4E00;&#x5F20;","&#x4E0D;&#x770B;&#x4E86;"],yes:function(){l.length>1&&h.imgnext(!0,!0)}})})}},e.run=function(){c=jQuery,d=c(a),h.html=c("html"),f.open=function(a){var b=new g(a);return b.index}},"function"==typeof define?define(function(){return e.run(),f}):function(){e.run(),f.use("skin/layer.css")}()}(window);
3 3 \ No newline at end of file
... ...
src/main/resources/static/metronic_v4.5.4/plugins/select2/css/select2.min.css
1   -.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px;}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap;}.select2-container .select2-search--inline{float:left;}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051;}.select2-results{display:block;}.select2-results__options{list-style:none;margin:0;padding:0;}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none;}.select2-results__option[aria-selected]{cursor:pointer;}.select2-container--open .select2-dropdown{left:0;}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-search--dropdown{display:block;padding:4px;}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box;}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-search--dropdown.select2-search--hide{display:none;}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0);}.select2-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px;}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px;}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto;}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none;}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%;}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left;}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder{float:right;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0;}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none;}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0;}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa;}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--default .select2-results__option[role=group]{padding:0;}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999;}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd;}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em;}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white;}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic .select2-selection--single{background-color:#f6f6f6;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:-o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px;}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto;}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:-o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none;}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0;}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;}.select2-container--classic .select2-dropdown{background-color:white;border:1px solid transparent;}.select2-container--classic .select2-dropdown--above{border-bottom:none;}.select2-container--classic .select2-dropdown--below{border-top:none;}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--classic .select2-results__option[role=group]{padding:0;}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey;}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:white;}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb;}
2 1 \ No newline at end of file
  2 +.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px;}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap;}.select2-container .select2-search--inline{float:left;}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:10510;}.select2-results{display:block;}.select2-results__options{list-style:none;margin:0;padding:0;}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none;}.select2-results__option[aria-selected]{cursor:pointer;}.select2-container--open .select2-dropdown{left:0;}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-search--dropdown{display:block;padding:4px;}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box;}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-search--dropdown.select2-search--hide{display:none;}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0);}.select2-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px;}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px;}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto;}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none;}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%;}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left;}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder{float:right;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0;}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none;}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0;}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa;}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--default .select2-results__option[role=group]{padding:0;}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999;}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd;}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em;}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white;}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic .select2-selection--single{background-color:#f6f6f6;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:-o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px;}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto;}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:-o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none;}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0;}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;}.select2-container--classic .select2-dropdown{background-color:white;border:1px solid transparent;}.select2-container--classic .select2-dropdown--above{border-bottom:none;}.select2-container--classic .select2-dropdown--below{border-top:none;}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--classic .select2-results__option[role=group]{padding:0;}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey;}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:white;}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb;}
3 3 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -158,9 +158,11 @@
158 158 $(this).children().each(function(index){
159 159 params[index] = $(this).text();
160 160 });
  161 + console.log(params);
161 162 jName = params[0].split("\\")[0];
162 163 var id = $("#"+params[1]).val();
163 164 $get('/realSchedule/'+id,null,function(result){
  165 + console.log(result);
164 166 result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");
165 167 var ludan_1 = template('ludan_1',result);
166 168 //var ludan_4 = template('ludan_4',result);
... ... @@ -220,9 +222,9 @@
220 222 <script type="text/html" id="list_info">
221 223 {{each list as obj i}}
222 224 <tr>
223   - <td width="45%">{{obj.jName}}\{{obj.jGh}}</td>
224   - <td width="32%">{{obj.clZbh}}</td>
225   - <td width="23%">{{obj.lpName}}<input type="hidden" id="{{obj.clZbh}}" value="{{obj.id}}"></td>
  225 + <td width="45%">{{obj[4]}}\{{obj[1]}}</td>
  226 + <td width="32%">{{obj[2]}}</td>
  227 + <td width="23%">{{obj[3]}}<input type="hidden" id="{{obj[2]}}" value="{{obj[0]}}"></td>
226 228 </tr>
227 229 {{/each}}
228 230 {{if list.length == 0}}
... ...
src/main/resources/static/pages/oil/cylList.html
... ... @@ -56,8 +56,8 @@
56 56 <th width="3%">#</th>
57 57 <th width="15%">公司</th>
58 58 <th width="15%">车辆编码</th>
59   - <th width="15%">油箱容量</th>
60   - <th width="15%">车辆存油</th>
  59 + <th width="15%">油箱存油</th>
  60 + <th width="15%">车辆容量</th>
61 61 <th width="18%">最后更新时间</th>
62 62 <th width="19%">操作</th>
63 63 </tr>
... ...
src/main/resources/static/pages/oil/list.html
... ... @@ -21,8 +21,8 @@
21 21 </div>
22 22 <div class="actions">
23 23 <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
24   - <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button>
25   - <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i> 拆分</button>
  24 +<!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> -->
  25 + <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i> 拆分/保存</button>
26 26 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
27 27 <div class="btn-group">
28 28 <a class="btn red btn-outline btn-circle" href="javascript:;"
... ... @@ -34,9 +34,9 @@
34 34 class="tool-action" id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息
35 35 </a></li>
36 36 <li><a href="javascript:;" data-action="1"
37   - class="tool-action"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场)
  37 + class="tool-action" id="outAndIn"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场)
38 38 </a></li>
39   - <li><a href="javascript:;" data-action="3"
  39 + <li><a href="javascript:;" id="checkYl" data-action="3"
40 40 class="tool-action"> <i class="fa fa-gg-circle"></i>
41 41 核对加注量(有加油无里程)
42 42 </a></li>
... ... @@ -86,7 +86,7 @@
86 86 内部编码:
87 87 </td>
88 88 <td colspan="3">
89   - <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;" ></select>
  89 + <select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;" ></select>
90 90 </td>
91 91 <td colspan="4">
92 92 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
... ... @@ -101,14 +101,14 @@
101 101 <th width="2%">#</th>
102 102 <th width="8%">日期</th>
103 103 <th width="5%">公司</th>
104   - <th width="5%">分公司</th>
  104 + <th width="8%">线路</th>
105 105 <th width="5%">自编号</th>
106 106 <th width="6%">驾驶员</th>
107   - <th width="5%">加油量</th>
  107 + <th width="4%">加油量</th>
108 108 <th width="5%">出场公里</th>
109   - <th width="5%">进场公里</th>
110   - <th width="5%">出场存油</th>
111   - <th width="5%">进场存油</th>
  109 + <th width="4%">进场公里</th>
  110 + <th width="4%">出场存油</th>
  111 + <th width="4%">进场存油</th>
112 112 <th width="5%">油耗</th>
113 113 <th width="5%">燃油类型</th>
114 114 <th width="4%">尿素</th>
... ... @@ -135,17 +135,17 @@
135 135 {{each list as obj i}}
136 136 <tr>
137 137 <td style="vertical-align: middle;">
138   - <input type="radio" class="group-checkable icheck" data-id="{{obj.id}}">
  138 + <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}">
139 139 </td>
  140 +
140 141 <td>
141   -
142 142 {{obj.rq}}
143 143 </td>
144 144 <td>
145   - {{obj.ssgsdm}}
  145 + {{obj.gsname}}
146 146 </td>
147 147 <td>
148   - {{obj.fgsdm}}
  148 + {{obj.xlname}}
149 149 </td>
150 150 <td>
151 151 {{obj.nbbm}}
... ... @@ -192,7 +192,7 @@
192 192 {{obj.yhlx}}
193 193 </td>
194 194 <td>
195   - {{(obj.yh/obj.zlc)}}
  195 + {{obj.bglyh}}
196 196 </td>
197 197 <td>
198 198 <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>
... ... @@ -208,11 +208,70 @@
208 208  
209 209 <script>
210 210 $(function(){
  211 + $("#checkYl").on('click',function(){
  212 + console.log("核对加注量");
  213 + if($("#rq").val()!=""){
  214 + var cells = $('tr.filter')[0].cells
  215 + ,params = {}
  216 + ,name;
  217 + $.each(cells, function(i, cell){
  218 + var items = $('input,select', cell);
  219 + for(var j = 0, item; item = items[j++];){
  220 + name = $(item).attr('name');
  221 + if(name){
  222 + params[name] = $(item).val();
  223 + }
  224 + }
  225 + });
  226 + $get('/ylb/checkYl', params, function(){
  227 + jsDoQuery(null,true);
  228 + });
  229 + }else{
  230 + layer.msg('请选择日期.');
  231 + }
  232 + })
  233 +
  234 + //进场等于出场
  235 + $("#outAndIn").on('click',function(){
  236 + console.log("进场油量等于出场油量");
  237 + if($("#rq").val()!=""){
  238 + var cells = $('tr.filter')[0].cells
  239 + ,params = {}
  240 + ,name;
  241 + $.each(cells, function(i, cell){
  242 + var items = $('input,select', cell);
  243 + for(var j = 0, item; item = items[j++];){
  244 + name = $(item).attr('name');
  245 + if(name){
  246 + params[name] = $(item).val();
  247 + }
  248 + }
  249 + });
  250 + $get('/ylb/outAndIn', params, function(){
  251 + jsDoQuery(null,true);
  252 + });
  253 + }else{
  254 + layer.msg('请选择日期.');
  255 + }
  256 + })
211 257 //拆分
212 258 $("#sortButton").on('click',function(){
213 259 console.log("拆分油量");
214 260 if($("#rq").val()!=""){
215   -
  261 + var id = $('input.icheck:checked').data('id');
  262 + if(typeof(id)=='undefined'){
  263 + layer.msg("请选择一行进行拆分");
  264 + }else{
  265 + //获取输入的进场存油
  266 + var jzyl=$("#jzyl"+id).html();
  267 + var params = {};
  268 + params['jzyl']=jzyl;
  269 + params['id']=id;
  270 + $get('/ylb/sort', params, function(){
  271 + jsDoQuery(null,true);
  272 + });
  273 +
  274 + }
216 275 }else{
217 276 layer.msg('请选择日期.');
218 277 }
... ... @@ -234,6 +293,7 @@ $(function(){
234 293 }
235 294 });
236 295 $get('/ylb/obtain', params, function(){
  296 + console.log("----------------------");
237 297 jsDoQuery(null,true);
238 298 });
239 299 }else{
... ... @@ -251,7 +311,7 @@ $(function(){
251 311 }
252 312 var page = 0, initPagination;
253 313 var icheckOptions = {
254   - checkboxClass: 'icheckbox_flat-blue',
  314 + radioClass: 'iradio_square-blue icheck',
255 315 increaseArea: '20%'
256 316 }
257 317  
... ... @@ -315,16 +375,16 @@ $(function(){
315 375 }
316 376  
317 377 function iCheckChange(){
318   - var tr = $(this).parents('tr');
  378 + var tr = $(this).parents('tr');
319 379 if(this.checked)
320 380 tr.addClass('row-active');
321 381 else
322   - tr.removeClass('row-active');
323   -
324   - if($('#datatable_resource input.icheck:checked').length == 1)
  382 + tr.removeClass('row-active');
  383 +
  384 + /* if($('#datatable_resource input.icheck:checked').length == 1)
325 385 $('#removeButton').removeAttr('disabled');
326 386 else
327   - $('#removeButton').attr('disabled', 'disabled');
  387 + $('#removeButton').attr('disabled', 'disabled'); */
328 388 }
329 389  
330 390 function showPagination(data){
... ... @@ -357,8 +417,7 @@ $(function(){
357 417 if($(this).attr('disabled'))
358 418 return;
359 419  
360   - var id = $('#datatable_resource input.icheck:checked').data('id');
361   -
  420 + var id = $('input.icheck:checked').data('id');
362 421 removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){
363 422 $('tr.filter .filter-submit').click();
364 423 });
... ...
src/main/resources/static/pages/permission/resource/edit.html
1   -<div class="page-head">
2   - <div class="page-title">
3   - <h1>编辑资源</h1>
4   - </div>
5   -</div>
6   -
7   -<ul class="page-breadcrumb breadcrumb">
8   - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9   - <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li>
10   - <li><a href="javascript:;" class="back" data-pjax>资源管理</a> <i class="fa fa-circle"></i></li>
11   - <li><span class="active">编辑资源</span></li>
12   -</ul>
13   -
14   -<div class="portlet light bordered">
15   - <div class="portlet-title">
16   - <div class="caption">
17   - <i class="icon-equalizer font-red-sunglo"></i> <span
18   - class="caption-subject font-red-sunglo bold uppercase">表单</span>
19   - </div>
20   - </div>
21   - <div class="portlet-body form">
22   - <form action="/resource" class="form-horizontal" id="resource_edit_form" >
23   - <div class="alert alert-danger display-hide">
24   - <button class="close" data-close="alert"></button>
25   - 您的输入有误,请检查下面的输入项
26   - </div>
27   - <div class="form-body">
28   - <input type="hidden" name="id">
29   - <div class="form-group">
30   - <label class="col-md-3 control-label">所属模块</label>
31   - <div class="col-md-4">
32   - <div class="input-group">
33   - <select class="form-control" name="module.id" id="moduleSelect">
34   - </select>
35   - </div>
36   - </div>
37   - </div>
38   - <div class="form-group">
39   - <label class="col-md-3 control-label">资源名称</label>
40   - <div class="col-md-4">
41   - <input type="text" class="form-control" name="name">
42   - </div>
43   - </div>
44   - <div class="form-group">
45   - <label class="col-md-3 control-label">映射地址</label>
46   - <div class="col-md-4">
47   - <input type="text" class="form-control" name="url">
48   - <span class="help-block"> 例(新增资源):/resource/add</span>
49   - </div>
50   - </div>
51   - <div class="form-group">
52   - <label class="col-md-3 control-label">请求方式</label>
53   - <div class="col-md-4">
54   - <div class="input-group">
55   - <select class="form-control" name="method" style="width: 160px;">
56   - <option value="get">get</option>
57   - <option value="post">post</option>
58   - <option value="delete">delete</option>
59   - </select>
60   - </div>
61   - </div>
62   - </div>
63   - <div class="form-group">
64   - <label class="col-md-3 control-label">是否启用</label>
65   - <div class="col-md-4">
66   - <div class="input-group">
67   - <select class="form-control" name="enable" style="width: 160px;">
68   - <option value="1">可用</option>
69   - <option value="0">禁用</option>
70   - </select>
71   - </div>
72   - </div>
73   - </div>
74   - <div class="form-group">
75   - <label class="col-md-3 control-label">备注/描述</label>
76   - <div class="col-md-4">
77   - <textarea class="form-control" rows="3" name="descriptions"></textarea>
78   - </div>
79   - </div>
80   - </div>
81   - <div class="form-actions">
82   - <div class="row">
83   - <div class="col-md-offset-3 col-md-4">
84   - <button type="submit" class="btn green" ><i class="fa fa-check"></i> 保存</button>
85   - <a type="button" class="btn default back" href="javascript:;" ><i class="fa fa-times"></i> 取消</a>
86   - </div>
87   - </div>
88   - </div>
89   - </form>
90   - <!-- END FORM-->
91   - </div>
92   -</div>
93   -
94   -<script>
95   -$(function(){
96   - $('a.back').on('click', function(){
97   - history.back();
98   - });
99   -
100   - var id = $.url().param('no');
101   -
102   - if(!id){
103   - alert('缺少主键');
104   - }
105   - else{
106   - renderModuleSelect(function(){
107   - $get('/resource/' + id ,null, function(obj){
108   - putFormData(obj, '#resource_edit_form');
109   - $('#moduleSelect').val(obj.module.id).change();
110   - });
111   - });
112   - }
113   -
114   - var form = $('#resource_edit_form');
115   - var error = $('.alert-danger', form);
116   -
117   - //form validate
118   - form.validate({
119   - errorElement : 'span',
120   - errorClass : 'help-block help-block-error',
121   - focusInvalid : false,
122   - rules : {
123   - 'name' : {
124   - required : true
125   - },
126   - 'url' : {
127   - required : true
128   - },
129   - 'module.id': {
130   - required : true
131   - }
132   - },
133   - invalidHandler : function(event, validator) {
134   - error.show();
135   - App.scrollTo(error, -200);
136   - },
137   -
138   - highlight : function(element) {
139   - $(element).closest('.form-group').addClass('has-error');
140   - },
141   -
142   - unhighlight : function(element) {
143   - $(element).closest('.form-group').removeClass('has-error');
144   - },
145   -
146   - success : function(label) {
147   - label.closest('.form-group').removeClass('has-error');
148   - },
149   -
150   - submitHandler : function(f) {
151   - var params = form.serializeJSON();
152   - error.hide();
153   -
154   - $post('/resource', params, function(res){
155   - layer.msg('修改资源成功.');
156   - });
157   - }
158   - });
159   -
160   - //模块下拉框
161   - function renderModuleSelect(callback){
162   - getModuleTreeData(function(treeData){
163   - var options = '<option value="">请选择...</option>';
164   - $.each(treeData, function(i, g){
165   - var dArray = g.children;
166   -
167   - for(var i = 0,d; d = dArray[i++];){
168   - options += '<optgroup label="'+d.name+'">';
169   - if(!d.children)
170   - continue;
171   -
172   - $.each(d.children, function(i, m){
173   - options += '<option value="'+m.id+'">'+m.name+'</option>'
174   - });
175   - options += '</optgroup>';
176   - }
177   - });
178   - $('#moduleSelect').html(options).select2();
179   - callback && callback();
180   - });
181   - }
182   -
183   - function getModuleTreeData(cb){
184   - var treeData = [];
185   - $get('/module/all',null, function(arr){
186   - treeData = createTreeData(arr);
187   - cb && cb(treeData)
188   - });
189   - }
190   -});
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>编辑资源</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><a href="javascript:;" class="back" data-pjax>资源管理</a> <i class="fa fa-circle"></i></li>
  11 + <li><span class="active">编辑资源</span></li>
  12 +</ul>
  13 +
  14 +<div class="portlet light bordered">
  15 + <div class="portlet-title">
  16 + <div class="caption">
  17 + <i class="icon-equalizer font-red-sunglo"></i> <span
  18 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  19 + </div>
  20 + </div>
  21 + <div class="portlet-body form">
  22 + <form action="/resource" class="form-horizontal" id="resource_edit_form" >
  23 + <div class="alert alert-danger display-hide">
  24 + <button class="close" data-close="alert"></button>
  25 + 您的输入有误,请检查下面的输入项
  26 + </div>
  27 + <div class="form-body">
  28 + <input type="hidden" name="id">
  29 + <div class="form-group">
  30 + <label class="col-md-3 control-label">所属模块</label>
  31 + <div class="col-md-4">
  32 + <div class="input-group">
  33 + <select class="form-control" name="module.id" id="moduleSelect">
  34 + </select>
  35 + </div>
  36 + </div>
  37 + </div>
  38 + <div class="form-group">
  39 + <label class="col-md-3 control-label">资源名称</label>
  40 + <div class="col-md-4">
  41 + <input type="text" class="form-control" name="name">
  42 + </div>
  43 + </div>
  44 + <div class="form-group">
  45 + <label class="col-md-3 control-label">映射地址</label>
  46 + <div class="col-md-4">
  47 + <input type="text" class="form-control" name="url">
  48 + <span class="help-block"> 例(新增资源):/resource/add</span>
  49 + </div>
  50 + </div>
  51 + <div class="form-group">
  52 + <label class="col-md-3 control-label">请求方式</label>
  53 + <div class="col-md-4">
  54 + <div class="input-group">
  55 + <select class="form-control" name="method" style="width: 160px;">
  56 + <option value="get">get</option>
  57 + <option value="post">post</option>
  58 + <option value="delete">delete</option>
  59 + </select>
  60 + </div>
  61 + </div>
  62 + </div>
  63 + <div class="form-group">
  64 + <label class="col-md-3 control-label">是否启用</label>
  65 + <div class="col-md-4">
  66 + <div class="input-group">
  67 + <select class="form-control" name="enable" style="width: 160px;">
  68 + <option value="1">可用</option>
  69 + <option value="0">禁用</option>
  70 + </select>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + <div class="form-group">
  75 + <label class="col-md-3 control-label">备注/描述</label>
  76 + <div class="col-md-4">
  77 + <textarea class="form-control" rows="3" name="descriptions"></textarea>
  78 + </div>
  79 + </div>
  80 + </div>
  81 + <div class="form-actions">
  82 + <div class="row">
  83 + <div class="col-md-offset-3 col-md-4">
  84 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 保存</button>
  85 + <a type="button" class="btn default back" href="javascript:;" ><i class="fa fa-times"></i> 取消</a>
  86 + </div>
  87 + </div>
  88 + </div>
  89 + </form>
  90 + <!-- END FORM-->
  91 + </div>
  92 +</div>
  93 +
  94 +<script>
  95 +$(function(){
  96 + $('a.back').on('click', function(){
  97 + history.back();
  98 + });
  99 +
  100 + var id = $.url().param('no');
  101 +
  102 + if(!id){
  103 + alert('缺少主键');
  104 + }
  105 + else{
  106 + renderModuleSelect(function(){
  107 + $get('/resource/' + id ,null, function(obj){
  108 + putFormData(obj, '#resource_edit_form');
  109 + $('#moduleSelect').val(obj.module.id).change();
  110 + });
  111 + });
  112 + }
  113 +
  114 + var form = $('#resource_edit_form');
  115 + var error = $('.alert-danger', form);
  116 +
  117 + //form validate
  118 + form.validate({
  119 + errorElement : 'span',
  120 + errorClass : 'help-block help-block-error',
  121 + focusInvalid : false,
  122 + rules : {
  123 + 'name' : {
  124 + required : true
  125 + },
  126 + 'url' : {
  127 + required : true
  128 + },
  129 + 'module.id': {
  130 + required : true
  131 + }
  132 + },
  133 + invalidHandler : function(event, validator) {
  134 + error.show();
  135 + App.scrollTo(error, -200);
  136 + },
  137 +
  138 + highlight : function(element) {
  139 + $(element).closest('.form-group').addClass('has-error');
  140 + },
  141 +
  142 + unhighlight : function(element) {
  143 + $(element).closest('.form-group').removeClass('has-error');
  144 + },
  145 +
  146 + success : function(label) {
  147 + label.closest('.form-group').removeClass('has-error');
  148 + },
  149 +
  150 + submitHandler : function(f) {
  151 + var params = form.serializeJSON();
  152 + error.hide();
  153 +
  154 + $post('/resource', params, function(res){
  155 + layer.msg('修改资源成功.');
  156 + });
  157 + }
  158 + });
  159 +
  160 + //模块下拉框
  161 + function renderModuleSelect(callback){
  162 + getModuleTreeData(function(treeData){
  163 + var options = '<option value="">请选择...</option>';
  164 + $.each(treeData, function(i, g){
  165 + var dArray = g.children;
  166 +
  167 + for(var i = 0,d; d = dArray[i++];){
  168 + options += '<optgroup label="'+d.name+'">';
  169 + if(!d.children)
  170 + continue;
  171 +
  172 + $.each(d.children, function(i, m){
  173 + options += '<option value="'+m.id+'">'+m.name+'</option>'
  174 + });
  175 + options += '</optgroup>';
  176 + }
  177 + });
  178 + $('#moduleSelect').html(options).select2();
  179 + callback && callback();
  180 + });
  181 + }
  182 +
  183 + function getModuleTreeData(cb){
  184 + var treeData = [];
  185 + $get('/module/all',null, function(arr){
  186 + treeData = createTreeData(arr);
  187 + cb && cb(treeData)
  188 + });
  189 + }
  190 +});
191 191 </script>
192 192 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/resource/list.html
1   -<div class="page-head">
2   - <div class="page-title">
3   - <h1>资源管理</h1>
4   - </div>
5   -</div>
6   -
7   -<ul class="page-breadcrumb breadcrumb">
8   - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9   - <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li>
10   - <li><span class="active">资源管理</span></li>
11   -</ul>
12   -
13   -<div class="row">
14   - <div class="col-md-12">
15   - <!-- Begin: life time stats -->
16   - <div class="portlet light portlet-fit portlet-datatable bordered">
17   - <div class="portlet-title">
18   - <div class="caption">
19   - <i class="fa fa-database font-dark"></i> <span
20   - class="caption-subject font-dark sbold uppercase">资源数据表</span>
21   - </div>
22   - <div class="actions">
23   - <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加资源</a>
24   - <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除资源</button>
25   - <div class="btn-group">
26   - <a class="btn red btn-outline btn-circle" href="javascript:;"
27   - data-toggle="dropdown"> <i class="fa fa-share"></i> <span
28   - class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i>
29   - </a>
30   - <ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
31   - <li><a href="javascript:;" data-action="0"
32   - class="tool-action"> <i class="fa fa-print"></i> 打印
33   - </a></li>
34   - <li><a href="javascript:;" data-action="1"
35   - class="tool-action"> <i class="fa fa-copy"></i> 复制
36   - </a></li>
37   - <li><a href="javascript:;" data-action="3"
38   - class="tool-action"> <i class="fa fa-file-excel-o"></i>
39   - 导出Excel
40   - </a></li>
41   - <li class="divider"></li>
42   - <li><a href="javascript:;" data-action="5"
43   - class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据
44   - </a></li>
45   - </ul>
46   - </div>
47   - </div>
48   - </div>
49   - <div class="portlet-body">
50   - <div class="table-container" style="margin-top: 10px">
51   - <table
52   - class="table table-striped table-bordered table-hover table-checkable"
53   - id="datatable_resource">
54   - <thead>
55   - <tr role="row" class="heading">
56   - <th width="3%">#</th>
57   - <th width="15%">所属模块</th>
58   - <th width="13%">资源名</th>
59   - <th width="100">链接</th>
60   - <th width="11%">请求方式</th>
61   - <th width="18%">描述</th>
62   - <th width="10%">状态</th>
63   - <th width="18%">操作</th>
64   - </tr>
65   - <tr role="row" class="filter">
66   - <td></td>
67   - <td>
68   - <select name="module.id_eq" class="form-control form-filter input-sm" id="moduleSelect"></select>
69   - </td>
70   - <td>
71   - <input type="text" class="form-control form-filter input-sm" name="name_like">
72   - </td>
73   - <td>
74   - <input type="text" class="form-control form-filter input-sm" name="url_like">
75   - </td>
76   - <td>
77   - <select class="form-control form-filter " name="method_eq">
78   - <option value="">请选择...</option>
79   - <option value="get">get</option>
80   - <option value="post">post</option>
81   - <option value="delete">delete</option>
82   - </select>
83   - </td>
84   - <td>
85   - <input type="text" class="form-control form-filter input-sm" disabled="disabled">
86   - </td>
87   - <td>
88   - <select class="form-control form-filter " name="enable_eq">
89   - <option value="">请选择...</option>
90   - <option value="1">可用</option>
91   - <option value="0">禁用</option>
92   - </select>
93   - </td>
94   - <td>
95   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
96   - <i class="fa fa-search"></i> 搜索</button>
97   -
98   - <button class="btn btn-sm red btn-outline filter-cancel">
99   - <i class="fa fa-times"></i> 重置</button>
100   - </td>
101   - </tr>
102   - </thead>
103   - <tbody></tbody>
104   - </table>
105   - <div style="text-align: right;">
106   - <ul id="pagination" class="pagination"></ul>
107   - </div>
108   - </div>
109   - </div>
110   - </div>
111   - </div>
112   -</div>
113   -
114   -<script id="resource_list_temp" type="text/html">
115   -{{each list as obj i}}
116   -<tr>
117   - <td style="vertical-align: middle;">
118   - <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}">
119   - </td>
120   - <td>
121   - {{obj.module.name}}
122   - </td>
123   - <td>
124   - {{obj.name}}
125   - </td>
126   - <td>
127   - {{obj.url}}
128   - </td>
129   - <td>
130   - {{obj.method}}
131   - </td>
132   - <td>
133   - {{obj.descriptions}}
134   - </td>
135   - <td>
136   - {{if obj.enable}}
137   - 可用
138   - {{else}}
139   - 禁用
140   - {{/if}}
141   - </td>
142   - <td><a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a></td>
143   -</tr>
144   -{{/each}}
145   -{{if list.length == 0}}
146   -<tr>
147   - <td colspan=8><h6 class="muted">没有找到相关数据</h6></td>
148   -</tr>
149   -{{/if}}
150   -</script>
151   -
152   -<script type="text/javascript">
153   -$(function(){
154   - var page = 0, initPagination;
155   - var icheckOptions = {
156   - checkboxClass: 'icheckbox_flat-blue',
157   - increaseArea: '20%'
158   - }
159   -
160   - var init = function(){
161   - jsDoQuery(null,true);
162   -
163   - //模块下拉框
164   - getModuleTreeData(function(treeData){
165   - var options = '<option value="">请选择...</option>';
166   - $.each(treeData, function(i, g){
167   - var dArray = g.children;
168   -
169   - for(var i = 0,d; d = dArray[i++];){
170   - options += '<optgroup label="'+d.name+'">';
171   - if(!d.children)
172   - continue;
173   -
174   - $.each(d.children, function(i, m){
175   - options += '<option value="'+m.id+'">'+m.name+'</option>'
176   - });
177   - options += '</optgroup>';
178   - }
179   - });
180   - $('#moduleSelect').html(options)/* .select2() */;
181   - });
182   - }
183   -
184   - //if($('#historyCache').length == 0){
185   - init();
186   - //}
187   -
188   -
189   - //重置
190   - $('tr.filter .filter-cancel').on('click', function(){
191   - $('tr.filter input, select').val('').change();
192   - jsDoQuery(null, true);
193   - });
194   -
195   - //提交
196   - $('tr.filter .filter-submit').on('click', function(){
197   - var cells = $('tr.filter')[0].cells
198   - ,params = {}
199   - ,name;
200   - $.each(cells, function(i, cell){
201   - var items = $('input,select', cell);
202   - for(var j = 0, item; item = items[j++];){
203   - name = $(item).attr('name');
204   - if(name){
205   - params[name] = $(item).val();
206   - }
207   - }
208   - });
209   - page = 0;
210   - jsDoQuery(params, true);
211   - });
212   -
213   - /*
214   - * 获取数据 p: 要提交的参数, pagination: 是否重新分页
215   - */
216   - function jsDoQuery(p, pagination){
217   - var params = {};
218   - if(p)
219   - params = p;
220   - //更新时间排序
221   - params['order'] = 'updateDate';
222   - params['page'] = page;
223   - var i = layer.load(2);
224   - $get('/resource' ,params, function(data){
225   - var bodyHtm = template('resource_list_temp', {list: data.content});
226   -
227   - $('#datatable_resource tbody').html(bodyHtm)
228   - .find('.icheck').iCheck(icheckOptions)
229   - .on('ifChanged', iCheckChange);
230   - if(pagination && data.content.length > 0){
231   - //重新分页
232   - initPagination = true;
233   - showPagination(data);
234   - }
235   - layer.close(i);
236   - });
237   - }
238   -
239   - function iCheckChange(){
240   - var tr = $(this).parents('tr');
241   - if(this.checked)
242   - tr.addClass('row-active');
243   - else
244   - tr.removeClass('row-active');
245   -
246   - if($('#datatable_resource input.icheck:checked').length == 1)
247   - $('#removeButton').removeAttr('disabled');
248   - else
249   - $('#removeButton').attr('disabled', 'disabled');
250   - }
251   -
252   - function showPagination(data){
253   - //分页
254   - $('#pagination').jqPaginator({
255   - totalPages: data.totalPages,
256   - visiblePages: 6,
257   - currentPage: page + 1,
258   - first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
259   - prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
260   - next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
261   - last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
262   - page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
263   - onPageChange: function (num, type) {
264   - if(initPagination){
265   - initPagination = false;
266   - return;
267   - }
268   -
269   -
270   - page = num - 1;
271   - jsDoQuery(null, false);
272   - }
273   - });
274   - }
275   -
276   - function getModuleTreeData(cb){
277   - var treeData = [];
278   - $get('/module/all',null, function(arr){
279   - treeData = createTreeData(arr);
280   - cb && cb(treeData)
281   - });
282   - }
283   -
284   - //删除
285   - $('#removeButton').on('click', function(){
286   - if($(this).attr('disabled'))
287   - return;
288   -
289   - var id = $('#datatable_resource input.icheck:checked').data('id');
290   -
291   - removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){
292   - $('tr.filter .filter-submit').click();
293   - });
294   - });
295   -});
296   -</script>
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>资源管理</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><span class="active">资源管理</span></li>
  11 +</ul>
  12 +
  13 +<div class="row">
  14 + <div class="col-md-12">
  15 + <!-- Begin: life time stats -->
  16 + <div class="portlet light portlet-fit portlet-datatable bordered">
  17 + <div class="portlet-title">
  18 + <div class="caption">
  19 + <i class="fa fa-database font-dark"></i> <span
  20 + class="caption-subject font-dark sbold uppercase">资源数据表</span>
  21 + </div>
  22 + <div class="actions">
  23 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加资源</a>
  24 + <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除资源</button>
  25 + <div class="btn-group">
  26 + <a class="btn red btn-outline btn-circle" href="javascript:;"
  27 + data-toggle="dropdown"> <i class="fa fa-share"></i> <span
  28 + class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i>
  29 + </a>
  30 + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
  31 + <li><a href="javascript:;" data-action="0"
  32 + class="tool-action"> <i class="fa fa-print"></i> 打印
  33 + </a></li>
  34 + <li><a href="javascript:;" data-action="1"
  35 + class="tool-action"> <i class="fa fa-copy"></i> 复制
  36 + </a></li>
  37 + <li><a href="javascript:;" data-action="3"
  38 + class="tool-action"> <i class="fa fa-file-excel-o"></i>
  39 + 导出Excel
  40 + </a></li>
  41 + <li class="divider"></li>
  42 + <li><a href="javascript:;" data-action="5"
  43 + class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据
  44 + </a></li>
  45 + </ul>
  46 + </div>
  47 + </div>
  48 + </div>
  49 + <div class="portlet-body">
  50 + <div class="table-container" style="margin-top: 10px">
  51 + <table
  52 + class="table table-striped table-bordered table-hover table-checkable"
  53 + id="datatable_resource">
  54 + <thead>
  55 + <tr role="row" class="heading">
  56 + <th width="3%">#</th>
  57 + <th width="15%">所属模块</th>
  58 + <th width="13%">资源名</th>
  59 + <th width="100">链接</th>
  60 + <th width="11%">请求方式</th>
  61 + <th width="18%">描述</th>
  62 + <th width="10%">状态</th>
  63 + <th width="18%">操作</th>
  64 + </tr>
  65 + <tr role="row" class="filter">
  66 + <td></td>
  67 + <td>
  68 + <select name="module.id_eq" class="form-control form-filter input-sm" id="moduleSelect"></select>
  69 + </td>
  70 + <td>
  71 + <input type="text" class="form-control form-filter input-sm" name="name_like">
  72 + </td>
  73 + <td>
  74 + <input type="text" class="form-control form-filter input-sm" name="url_like">
  75 + </td>
  76 + <td>
  77 + <select class="form-control form-filter " name="method_eq">
  78 + <option value="">请选择...</option>
  79 + <option value="get">get</option>
  80 + <option value="post">post</option>
  81 + <option value="delete">delete</option>
  82 + </select>
  83 + </td>
  84 + <td>
  85 + <input type="text" class="form-control form-filter input-sm" disabled="disabled">
  86 + </td>
  87 + <td>
  88 + <select class="form-control form-filter " name="enable_eq">
  89 + <option value="">请选择...</option>
  90 + <option value="1">可用</option>
  91 + <option value="0">禁用</option>
  92 + </select>
  93 + </td>
  94 + <td>
  95 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
  96 + <i class="fa fa-search"></i> 搜索</button>
  97 +
  98 + <button class="btn btn-sm red btn-outline filter-cancel">
  99 + <i class="fa fa-times"></i> 重置</button>
  100 + </td>
  101 + </tr>
  102 + </thead>
  103 + <tbody></tbody>
  104 + </table>
  105 + <div style="text-align: right;">
  106 + <ul id="pagination" class="pagination"></ul>
  107 + </div>
  108 + </div>
  109 + </div>
  110 + </div>
  111 + </div>
  112 +</div>
  113 +
  114 +<script id="resource_list_temp" type="text/html">
  115 +{{each list as obj i}}
  116 +<tr>
  117 + <td style="vertical-align: middle;">
  118 + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}">
  119 + </td>
  120 + <td>
  121 + {{obj.module.name}}
  122 + </td>
  123 + <td>
  124 + {{obj.name}}
  125 + </td>
  126 + <td>
  127 + {{obj.url}}
  128 + </td>
  129 + <td>
  130 + {{obj.method}}
  131 + </td>
  132 + <td>
  133 + {{obj.descriptions}}
  134 + </td>
  135 + <td>
  136 + {{if obj.enable}}
  137 + 可用
  138 + {{else}}
  139 + 禁用
  140 + {{/if}}
  141 + </td>
  142 + <td><a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a></td>
  143 +</tr>
  144 +{{/each}}
  145 +{{if list.length == 0}}
  146 +<tr>
  147 + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td>
  148 +</tr>
  149 +{{/if}}
  150 +</script>
  151 +
  152 +<script type="text/javascript">
  153 +$(function(){
  154 + var page = 0, initPagination;
  155 + var icheckOptions = {
  156 + checkboxClass: 'icheckbox_flat-blue',
  157 + increaseArea: '20%'
  158 + }
  159 +
  160 + var init = function(){
  161 + jsDoQuery(null,true);
  162 +
  163 + //模块下拉框
  164 + getModuleTreeData(function(treeData){
  165 + var options = '<option value="">请选择...</option>';
  166 + $.each(treeData, function(i, g){
  167 + var dArray = g.children;
  168 +
  169 + for(var i = 0,d; d = dArray[i++];){
  170 + options += '<optgroup label="'+d.name+'">';
  171 + if(!d.children)
  172 + continue;
  173 +
  174 + $.each(d.children, function(i, m){
  175 + options += '<option value="'+m.id+'">'+m.name+'</option>'
  176 + });
  177 + options += '</optgroup>';
  178 + }
  179 + });
  180 + $('#moduleSelect').html(options)/* .select2() */;
  181 + });
  182 + }
  183 +
  184 + //if($('#historyCache').length == 0){
  185 + init();
  186 + //}
  187 +
  188 +
  189 + //重置
  190 + $('tr.filter .filter-cancel').on('click', function(){
  191 + $('tr.filter input, select').val('').change();
  192 + jsDoQuery(null, true);
  193 + });
  194 +
  195 + //提交
  196 + $('tr.filter .filter-submit').on('click', function(){
  197 + var cells = $('tr.filter')[0].cells
  198 + ,params = {}
  199 + ,name;
  200 + $.each(cells, function(i, cell){
  201 + var items = $('input,select', cell);
  202 + for(var j = 0, item; item = items[j++];){
  203 + name = $(item).attr('name');
  204 + if(name){
  205 + params[name] = $(item).val();
  206 + }
  207 + }
  208 + });
  209 + page = 0;
  210 + jsDoQuery(params, true);
  211 + });
  212 +
  213 + /*
  214 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  215 + */
  216 + function jsDoQuery(p, pagination){
  217 + var params = {};
  218 + if(p)
  219 + params = p;
  220 + //更新时间排序
  221 + params['order'] = 'updateDate';
  222 + params['page'] = page;
  223 + var i = layer.load(2);
  224 + $get('/resource' ,params, function(data){
  225 + var bodyHtm = template('resource_list_temp', {list: data.content});
  226 +
  227 + $('#datatable_resource tbody').html(bodyHtm)
  228 + .find('.icheck').iCheck(icheckOptions)
  229 + .on('ifChanged', iCheckChange);
  230 + if(pagination && data.content.length > 0){
  231 + //重新分页
  232 + initPagination = true;
  233 + showPagination(data);
  234 + }
  235 + layer.close(i);
  236 + });
  237 + }
  238 +
  239 + function iCheckChange(){
  240 + var tr = $(this).parents('tr');
  241 + if(this.checked)
  242 + tr.addClass('row-active');
  243 + else
  244 + tr.removeClass('row-active');
  245 +
  246 + if($('#datatable_resource input.icheck:checked').length == 1)
  247 + $('#removeButton').removeAttr('disabled');
  248 + else
  249 + $('#removeButton').attr('disabled', 'disabled');
  250 + }
  251 +
  252 + function showPagination(data){
  253 + //分页
  254 + $('#pagination').jqPaginator({
  255 + totalPages: data.totalPages,
  256 + visiblePages: 6,
  257 + currentPage: page + 1,
  258 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  259 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  260 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  261 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  262 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  263 + onPageChange: function (num, type) {
  264 + if(initPagination){
  265 + initPagination = false;
  266 + return;
  267 + }
  268 +
  269 +
  270 + page = num - 1;
  271 + jsDoQuery(null, false);
  272 + }
  273 + });
  274 + }
  275 +
  276 + function getModuleTreeData(cb){
  277 + var treeData = [];
  278 + $get('/module/all',null, function(arr){
  279 + treeData = createTreeData(arr);
  280 + cb && cb(treeData)
  281 + });
  282 + }
  283 +
  284 + //删除
  285 + $('#removeButton').on('click', function(){
  286 + if($(this).attr('disabled'))
  287 + return;
  288 +
  289 + var id = $('#datatable_resource input.icheck:checked').data('id');
  290 +
  291 + removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){
  292 + $('tr.filter .filter-submit').click();
  293 + });
  294 + });
  295 +});
  296 +</script>
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/temp.txt
1   -busInfoManage
2   -
3   -employeeInfoManage
4   -
  1 +busInfoManage
  2 +
  3 +employeeInfoManage
  4 +
5 5 timeTableManage
6 6 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
1   -//自定义指令
2   -/**
3   - * loading载入中指令。
4   - */
5   -angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) {
6   - return {
7   - restrict: 'A',
8   - link: function(scope, element) {
9   - // 初始隐藏loading界面
10   - element.hide();
11   -
12   - // 开始请求通知处理
13   - requestNotificationChannel.onRequestStarted(scope, function() {
14   - element.show();
15   - });
16   - // 请求结束通知处理
17   - requestNotificationChannel.onRequestEnded(scope, function() {
18   - element.hide();
19   - });
20   - }
21   - };
22   -}]);
23   -/**
24   - * remoteValidatio指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel。
25   - * 属性如下:
26   - * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
27   - * remotevparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }}
28   - *
29   - */
30   -angular.module('ScheduleApp').directive('remoteValidation', [
31   - '$$SearchInfoService_g',
32   - function($$SearchInfoService_g) {
33   - return {
34   - restrict: "A", // 属性
35   - require: "^ngModel", // 依赖所属指令的ngModel
36   - compile: function(tElem, tAttrs) {
37   - // 验证属性
38   - if (!tAttrs["remotevtype"]) { // 验证类型
39   - throw new Error("remotevtype属性必须填写");
40   - } else if (!$$SearchInfoService_g.validate[tAttrs["remotevtype"]]) {
41   - throw new Error(!tAttrs["remotevtype"] + "验证类型不存在");
42   - }
43   - if (!tAttrs["remotevparam"]) { // 查询参数
44   - throw new Error("remotevparam属性必须填写");
45   - }
46   -
47   - // 监听获取的数据
48   - var $watch_rvtype = undefined;
49   - var $watch_rvparam_obj = undefined;
50   -
51   - // 验证数据
52   - var $$internal_validate = function(ngModelCtrl) {
53   - if ($watch_rvtype && $watch_rvparam_obj) {
54   - // 获取查询参数模版
55   - var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
56   - if (!paramTemplate) {
57   - throw new Error($watch_rvtype + "查询模版不存在");
58   - }
59   - // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证
60   - var isParamAll = true;
61   - for (var key in paramTemplate) {
62   - if (!$watch_rvparam_obj[key]) {
63   - isParamAll = false;
64   - break;
65   - }
66   - }
67   - if (!isParamAll) {
68   - ngModelCtrl.$setValidity('remote', true);
69   - } else { // 开始验证
70   - $$SearchInfoService_g.validate[$watch_rvtype].remote.do(
71   - $watch_rvparam_obj,
72   - function(result) {
73   - if (result.status == "SUCCESS") {
74   - ngModelCtrl.$setValidity('remote', true);
75   - } else {
76   - ngModelCtrl.$setValidity('remote', false);
77   - }
78   - },
79   - function(result) {
80   - ngModelCtrl.$setValidity('remote', true);
81   - }
82   - );
83   - }
84   - }
85   - };
86   -
87   - return {
88   - pre: function(scope, element, attr) {
89   -
90   - },
91   -
92   - post: function(scope, element, attr, ngModelCtrl) {
93   - /**
94   - * 监控验证类型属性变化。
95   - */
96   - attr.$observe("remotevtype", function(value) {
97   - if (value && value != "") {
98   - $watch_rvtype = value;
99   - $$internal_validate(ngModelCtrl);
100   - }
101   - });
102   - /**
103   - * 监控查询结果属性变化。
104   - */
105   - attr.$observe("remotevparam", function(value) {
106   - if (value && value != "") {
107   - if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证
108   - return;
109   - }
110   - $watch_rvparam_obj = JSON.parse(value);
111   - $$internal_validate(ngModelCtrl);
112   - }
113   - });
114   - }
115   - };
116   - }
117   - }
118   - }
119   -]);
120   -
121   -
122   -angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
123   - return {
124   - restrict: 'E',
125   - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelectTemplate.html',
126   - scope: {
127   - model: "="
128   - },
129   - controllerAs: "$saSelectCtrl",
130   - bindToController: true,
131   - controller: function() {
132   - var self = this;
133   - self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}
134   - },
135   - /**
136   - * 此阶段可以改dom结构,此时angular还没扫描指令,
137   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
138   - * @param tElem
139   - * @param tAttrs
140   - * @returns {{pre: Function, post: Function}}
141   - */
142   - compile: function(tElem, tAttrs) {
143   - // 确定是否使用angularjs required验证
144   - // 属性 required
145   - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
146   - var required_attr = tAttrs["required"];
147   - if (required_attr) {
148   - if (required_attr == "true") {
149   - // 添加required属性指令
150   - tElem.find("ui-select").attr("required", "");
151   - } else {
152   - // 不等于true,不添加required属性指令
153   - }
154   - } else {
155   - // 不添加required属性指令
156   - }
157   -
158   - //console.log("saSelect" + ":compile = >" + tElem.html());
159   -
160   - return {
161   - pre: function(scope, element, attr) {
162   - // TODO:
163   - },
164   - /**
165   - * 相当于link函数。
166   - *
167   - * 重要属性如下:
168   - * model 是绑定外部值。
169   - * dicgroup 字典组的类型
170   - * name input name属性值
171   - */
172   - post: function(scope, element, attr) {
173   - // 1、获取属性
174   - var dicgroup_attr = attr['dicgroup']; // 字典组的类型
175   - var name_attr = attr['name']; // input name属性值
176   - var dicname_attr = attr['dicname']; // model关联的字典名字段
177   - var codename_attr = attr['codename']; // model关联的字典值字段
178   - var placeholder_attr = attr['placeholder']; // select placeholder提示
179   -
180   - // 系统的字典对象,使用dictionaryUtils类获取
181   - var origin_dicgroup;
182   - var dic_key; // 字典key
183   -
184   - if (dicgroup_attr) { // 赋值指定的字典数据
185   - origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);
186   - for (dic_key in origin_dicgroup) {
187   - var data = {}; // 重新组合的字典元素对象
188   - if (dic_key == "true")
189   - data.code = true;
190   - else
191   - data.code = dic_key;
192   - data.name = origin_dicgroup[dic_key];
193   - scope["$saSelectCtrl"].datas.push(data);
194   - }
195   - }
196   -
197   - if (name_attr) {
198   - scope["$saSelectCtrl"].nv = name_attr;
199   - }
200   - if (placeholder_attr) {
201   - scope["$saSelectCtrl"].ph = placeholder_attr;
202   - }
203   -
204   - scope["$saSelectCtrl"].select = function($item) {
205   - if (codename_attr) {
206   - scope["$saSelectCtrl"].model[codename_attr] = $item.code;
207   - }
208   - if (dicname_attr) {
209   - scope["$saSelectCtrl"].model[dicname_attr] = $item.name;
210   - }
211   - };
212   -
213   - scope["$saSelectCtrl"].remove = function() {
214   - if (codename_attr) {
215   - scope["$saSelectCtrl"].model[codename_attr] = null;
216   - }
217   - if (dicname_attr) {
218   - scope["$saSelectCtrl"].model[dicname_attr] = null;
219   - }
220   - scope["$saSelectCtrl"].cmodel = null;
221   - };
222   -
223   - $timeout(function() {
224   - // 创建内部使用的绑定对象
225   - var model_code = scope["$saSelectCtrl"].model[codename_attr];
226   - scope["$saSelectCtrl"].cmodel = model_code;
227   - }, 0);
228   - }
229   - }
230   - }
231   - };
232   -}]);
233   -
234   -
235   -
236   -angular.module('ScheduleApp').directive("saSelect2", [
237   - '$timeout', '$$SearchInfoService_g',
238   - function($timeout, $$searchInfoService_g) {
239   - return {
240   - restrict: 'E',
241   - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect2Template.html',
242   - scope: {
243   - model: "=" // 独立作用域,关联外部的模型对象
244   - },
245   - controllerAs: "$saSelectCtrl",
246   - bindToController: true,
247   - controller: function($scope) {
248   - var self = this;
249   - self.$$data = []; // 内部关联的数据
250   - },
251   - /**
252   - * 此阶段可以改dom结构,此时angular还没扫描指令,
253   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
254   - * @param tElem
255   - * @param tAttrs
256   - * @returns {{pre: Function, post: Function}}
257   - */
258   - compile: function(tElem, tAttrs) {
259   - // 1、获取此阶段使用的属性
260   - var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。
261   -
262   - // 2、处理属性
263   -
264   - // 确定是否使用angularjs required验证
265   - // 属性 required
266   - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
267   - if ($required_attr) {
268   - if ($required_attr == "true") {
269   - // 添加required属性指令
270   - tElem.find("ui-select").attr("required", "");
271   - } else {
272   - // 不等于true,不添加required属性指令
273   - }
274   - } else {
275   - // 不添加required属性指令
276   - }
277   -
278   - //console.log("saSelect" + ":compile = >" + tElem.html());
279   -
280   - return {
281   - pre: function(scope, element, attr) {
282   - // TODO:
283   - },
284   - /**
285   - * 相当于link函数。
286   - *
287   - * 重要属性如下:
288   - * model 是绑定外部值。
289   - * dicgroup 字典组的类型
290   - * name input name属性值
291   - */
292   - post: function(scope, element, attr) {
293   - // 1、获取此阶段使用的属性
294   - var $name_attr = attr["name"]; // 表单验证时需要的名字
295   - var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
296   - var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)
297   - var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)
298   - var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)
299   - var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)
300   - var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名
301   - var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述
302   -
303   - // 2、处理属性、转换成$saSelectCtrl内部使用的属性
304   - if ($name_attr) {
305   - scope["$saSelectCtrl"].$name_attr = $name_attr;
306   - }
307   - if ($placeholder_attr) {
308   - scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;
309   - }
310   - if ($showcolname_attr) {
311   - scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;
312   - }
313   -
314   - // 2-1、添加内部方法,根据type值,改变$$data的值
315   - scope["$saSelectCtrl"].$$internal_data_change_fn = function() {
316   - // 根据type属性动态载入数据
317   - if ($type_attr) {
318   - $$searchInfoService_g[$type_attr].list(
319   - {type: "all"},
320   - function(result) {
321   - scope["$saSelectCtrl"].$$data = [];
322   - for (var i = 0; i < result.length; i ++) {
323   - var data = {}; // data是result的一部分属性集合,根据配置来确定
324   - if ($datacolname1_attr) {
325   - data[$datacolname1_attr] = result[i][$datacolname1_attr];
326   - }
327   - if ($datacolname2_attr) {
328   - data[$datacolname2_attr] = result[i][$datacolname2_attr];
329   - }
330   - if ($showcolname_attr) {
331   - // 动态添加基于名字的拼音
332   - data[$showcolname_attr] = result[i][$showcolname_attr];
333   - if (data[$showcolname_attr]) {
334   - data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼
335   - data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼
336   - }
337   - }
338   - if (data["fullChars"])
339   - scope["$saSelectCtrl"].$$data.push(data);
340   - }
341   - },
342   - function(result) {
343   -
344   - }
345   - );
346   - }
347   - };
348   -
349   - // 3、选择、删除事件映射模型和内部数据对应的字段
350   - scope["$saSelectCtrl"].$select_fn_attr = function($item) {
351   - if ($modelcolname1_attr && $datacolname1_attr) {
352   - scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];
353   - }
354   - if ($modelcolname2_attr && $datacolname2_attr) {
355   - scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];
356   - }
357   - };
358   - scope["$saSelectCtrl"].$remove_fn_attr = function() {
359   - if ($modelcolname1_attr) {
360   - scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;
361   - }
362   - if ($modelcolname2_attr) {
363   - scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;
364   - }
365   - scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空
366   -
367   - scope["$saSelectCtrl"].$$internal_data_change_fn();
368   - };
369   -
370   - // 4、搜索事件
371   - scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {
372   - //var fullChars = pinyin.getFullChars($search).toUpperCase();
373   - //var camelChars = pinyin.getCamelChars($search);
374   - //
375   - //console.log(fullChars + " " + camelChars);
376   - // TODO:事件暂时没用,放着以后再说
377   - };
378   -
379   - // 5、全部载入后,输入的
380   - $timeout(function() {
381   - // 创建内部使用的绑定对象,用于确认选中那个值
382   - scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];
383   -
384   - scope["$saSelectCtrl"].$$internal_data_change_fn();
385   - }, 0);
386   - }
387   - }
388   - }
389   - };
390   - }
391   -]);
392   -
393   -
394   -
395   -
396   -
397   -/**
398   - * saSelect3指令
399   - * 属性如下:
400   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
401   - * name(必须):控件的名字
402   - * placeholder(可选):占位符字符串
403   - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
404   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
405   - * icname(必须):内部与之对应的字段名,如:icname=code
406   - * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
407   - * icname2(可选):内部与之对应的字段名2,如:icname2=name
408   - * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
409   - * icname3(可选):内部与之对应的字段名3,如:icname2=name
410   - * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
411   - * required(可选):是否要用required验证
412   - * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
413   - * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)
414   - *
415   - * 高级属性:
416   - * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)
417   - * dataparam(可选):数据源关联的外部参数对象
418   - *
419   - */
420   -angular.module('ScheduleApp').directive("saSelect3", [
421   - '$timeout',
422   - '$$SearchInfoService_g',
423   - function($timeout, $$searchInfoService_g) {
424   - return {
425   - restrict: 'E',
426   - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect3Template.html',
427   - scope: {
428   - model: "=" // 独立作用域,关联外部的模型object
429   - },
430   - controllerAs: "$saSelectCtrl",
431   - bindToController: true,
432   - controller: function($scope) {
433   - var self = this;
434   - self.$$data = []; // ui-select显示用的数据源
435   - self.$$data_real= []; // 内部真实的数据源
436   - },
437   -
438   - /**
439   - * 此阶段可以改dom结构,此时angular还没扫描指令,
440   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
441   - * @param tElem
442   - * @param tAttrs
443   - * @returns {{pre: Function, post: Function}}
444   - */
445   - compile: function(tElem, tAttrs) {
446   - // 获取所有的属性
447   - var $name_attr = tAttrs["name"]; // 控件的名字
448   - var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
449   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
450   - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
451   - var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
452   - var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
453   - var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
454   - var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
455   -
456   - var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
457   - var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
458   - var $required_attr = tAttrs["required"]; // 是否需要required验证
459   - var $mlp_attr = tAttrs["mlp"]; // 是否多级属性
460   - var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性
461   -
462   - // controlAs名字
463   - var ctrlAs = "$saSelectCtrl";
464   -
465   - // 数据源初始化标志
466   - var $$data_init = false;
467   - // 如果有required属性,添加angularjs required验证
468   - if ($required_attr != undefined) {
469   - tElem.find("ui-select").attr("required", "");
470   - }
471   -
472   - // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义
473   - // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}
474   - tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");
475   - // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data
476   - tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
477   - // 原来的设置:item[$saSelectCtrl.$icname_s]
478   - tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);
479   - // 原来的设置:{{$saSelectCtrl.$name}}
480   - tElem.find("ui-select").attr("name", $name_attr);
481   - // 原来的设置:{{$saSelectCtrl.$placeholder}}
482   - tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
483   -
484   - return {
485   - pre: function(scope, element, attr) {
486   - // TODO:
487   - },
488   - /**
489   - * 相当于link函数。
490   - * @param scope
491   - * @param element
492   - * @param attr
493   - */
494   - post: function(scope, element, attr) {
495   - // 添加选中事件处理函数
496   - scope[ctrlAs].$$internal_select_fn = function($item) {
497   - if ($dcname_attr && $icname_attr) {
498   - if ($mlp_attr) {
499   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
500   - } else {
501   - scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
502   - }
503   - }
504   - if ($dcname2_attr && $icname2_attr) {
505   - if ($mlp_attr) {
506   - eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");
507   - } else {
508   - scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
509   - }
510   - }
511   - if ($dcname3_attr && $icname3_attr) {
512   - if ($mlp_attr) {
513   - eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
514   - } else {
515   - scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
516   - }
517   - }
518   - };
519   -
520   - // 删除选中事件处理函数
521   - scope[ctrlAs].$$internal_remove_fn = function() {
522   - scope[ctrlAs].$$internalmodel = undefined;
523   - if ($mlp_attr) {
524   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
525   - } else {
526   - scope[ctrlAs].model[$dcname_attr] = undefined;
527   - }
528   -
529   - if ($dcname2_attr) {
530   - if ($mlp_attr) {
531   - eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");
532   - } else {
533   - scope[ctrlAs].model[$dcname2_attr] = undefined;
534   - }
535   - }
536   - if ($dcname3_attr) {
537   - if ($mlp_attr) {
538   - eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
539   - } else {
540   - scope[ctrlAs].model[$dcname3_attr] = undefined;
541   - }
542   - }
543   - };
544   -
545   - /**
546   - * 内部方法,读取字典数据作为数据源。
547   - * @param dicgroup 字典类型,如:gsType
548   - * @param ccol 代码字段名
549   - * @param ncol 名字字段名
550   - */
551   - scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {
552   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
553   - var dic_key; // 字典key
554   - // 清空内部数据
555   - scope[ctrlAs].$$data_real = [];
556   - for (dic_key in origin_dicgroup) {
557   - var data = {}; // 重新组合的字典元素对象
558   - if (dic_key == "true")
559   - data[ccol] = true;
560   - else
561   - data[ccol] = dic_key;
562   - data[ncol] = origin_dicgroup[dic_key];
563   - scope[ctrlAs].$$data_real.push(data);
564   - }
565   - // 这里直接将$$data_real数据深拷贝到$$data
566   - angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
567   -
568   - console.log(scope[ctrlAs].$$data);
569   - };
570   -
571   - /**
572   - * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把
573   - * 内部方法,读取字典数据作为数据源。
574   - * @param result 原始数据
575   - * @param dcvalue 传入的关联数据
576   - */
577   - scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {
578   - console.log("start=" + dcvalue);
579   - // 清空内部数据
580   - scope[ctrlAs].$$data_real = [];
581   - scope[ctrlAs].$$data = [];
582   - for (var i = 0; i < result.length; i ++) {
583   - if ($icname_s_attr) {
584   - if ($mlp_attr) {
585   - if (eval("result[i]" + "." + $icname_s_attr)) {
586   - // 全拼
587   - result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();
588   - // 简拼
589   - result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));
590   - }
591   - } else {
592   - if (result[i][$icname_s_attr]) {
593   - // 全拼
594   - result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();
595   - // 简拼
596   - result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);
597   - }
598   - }
599   - }
600   -
601   - if (result[i]["fullChars"]) { // 有拼音的加入数据源
602   - scope[ctrlAs].$$data_real.push(result[i]);
603   - }
604   -
605   - }
606   - //console.log("start2");
607   -
608   - // 数量太大取前10条记录作为显示
609   - if (angular.isArray(scope[ctrlAs].$$data_real)) {
610   - // 先迭代循环查找已经传过来的值
611   - if (scope[ctrlAs].$$data_real.length > 0) {
612   - if (dcvalue) {
613   - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
614   - if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {
615   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));
616   - break;
617   - }
618   - }
619   - }
620   - }
621   - // 在插入剩余的数据
622   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
623   - if (scope[ctrlAs].$$data.length < 10) {
624   - if ($mlp_attr) {
625   - if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {
626   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
627   - }
628   - } else {
629   - if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {
630   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
631   - }
632   - }
633   - } else {
634   - break;
635   - }
636   - }
637   - }
638   -
639   - //console.log("end");
640   - };
641   -
642   - /**
643   - * 判定一个对象是否为空对象。
644   - * @param Obj
645   - */
646   - scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {
647   - console.log(typeof obj);
648   -
649   - if (typeof obj === "object" && !(obj instanceof Array)) {
650   - for (var prop in obj) {
651   - if (obj.hasOwnProperty(prop)) {
652   - return false;
653   - }
654   - }
655   - return true;
656   - } else {
657   - throw "必须是对象";
658   - }
659   - };
660   -
661   - // 刷新数据
662   - scope[ctrlAs].$$internal_refresh_fn = function(search) {
663   - // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取
664   - var $dcvalue_attr = attr["dcvalue"];
665   -
666   - console.log("刷新数据:" + $dcvalue_attr);
667   -
668   - if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化
669   - if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源
670   - scope[ctrlAs].$$internal_dic_data(
671   - $datatype_attr, $icname_attr, $icname_s_attr);
672   - if ($dcvalue_attr) {
673   - scope[ctrlAs].$$internalmodel = $dcvalue_attr;
674   - }
675   - } else { // 非字典类型数据源
676   - if (!$dataassociate_attr) {
677   - $$searchInfoService_g[$datatype_attr].list(
678   - {type: "all"},
679   - function(result) {
680   - //console.log("ok:" + $datatype_attr);
681   - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
682   - //console.log("ok2:" + $datatype_attr);
683   - if ($dcvalue_attr) {
684   - scope[ctrlAs].$$internalmodel = $dcvalue_attr;
685   - }
686   -
687   - $$data_init = true;
688   - },
689   - function(result) {
690   -
691   - }
692   - );
693   - }
694   - }
695   - }
696   -
697   - if ($$data_init) {
698   - if (search && search != "") { // 有search值
699   - if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源
700   - // 处理search
701   - console.log("search:" + search);
702   -
703   - scope[ctrlAs].$$data = [];
704   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
705   - var upTerm = search.toUpperCase();
706   - if (scope[ctrlAs].$$data.length < 10) {
707   - if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
708   - || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
709   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
710   - }
711   - } else {
712   - break;
713   - }
714   - }
715   - }
716   - }
717   -
718   - }
719   -
720   - };
721   -
722   -
723   -
724   -
725   -
726   -
727   -
728   -
729   -
730   -
731   - // TODO:
732   -
733   - // dom全部载入后调用
734   - $timeout(function() {
735   - console.log("dom全部载入后调用");
736   - }, 0);
737   - // 监控dcvalue model值变换
738   - attr.$observe("dcvalue", function(value) {
739   - console.log("监控dc1 model值变换:" + value);
740   - scope[ctrlAs].$$internalmodel = value;
741   - }
742   - );
743   - // 监控获取数据参数变换
744   - attr.$observe("dataparam", function(value) {
745   - // 判定是否空对象
746   - console.log(value);
747   - var obj = JSON.parse(value);
748   - var $dcvalue_attr = attr["dcvalue"];
749   - if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {
750   - console.log("dataparam:" + obj);
751   -
752   - //
753   -
754   - obj["type"] = "all";
755   -
756   - $$data_init = false;
757   - $$searchInfoService_g[$datatype_attr].list(
758   - obj,
759   - function(result) {
760   - //console.log("ok:" + $datatype_attr);
761   - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
762   - //console.log("ok2:" + $datatype_attr);
763   - if ($dcvalue_attr) {
764   - scope[ctrlAs].$$internalmodel = $dcvalue_attr;
765   - }
766   -
767   - $$data_init = true;
768   - },
769   - function(result) {
770   -
771   - }
772   - );
773   - }
774   - }
775   - );
776   - }
777   - };
778   - }
779   - };
780   -
781   - }
782   -]);
783   -
784   -
785   -/**
786   - * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
787   - * name(必须):控件的名字
788   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
789   - * placeholder(可选):输入框占位符字符串
790   - *
791   - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
792   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
793   - * icname(必须):内部与之对应的字段名,如:icname=code
794   - *
795   - * cmaps(可选):model其他字段和内部数据字段名映射,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}
796   - * dsparams(必须):内部数据源查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
797   - * dscol(必须):内部显示的信息(暂时用内部字段),如:dscol=name
798   - * required(可选):是否要用required验证
799   - */
800   -angular.module('ScheduleApp').directive('saSelect4', [
801   - '$timeout',
802   - '$$SearchInfoService_g',
803   - function($timeout, $$searchInfoService_g) {
804   - return {
805   - restrict: 'E',
806   - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect4Template.html',
807   - scope: {
808   - model: "=" // 独立作用域,关联外部的模型object
809   - },
810   - controllerAs: "$saSelectCtrl",
811   - bindToController: true,
812   - controller: function($scope) {
813   - var self = this;
814   - self.$$data = []; // ui-select显示用的数据
815   - self.$$data_real = []; // 内部真实的数据
816   -
817   - // saSelect4组件的ng-model,用于外部绑定验证等操作
818   - self.$$internalmodel = undefined;
819   -
820   - self.$$internal_select_value = undefined; // 选中的值
821   - },
822   -
823   - /**
824   - * 此阶段可以改dom结构,此时angular还没扫描指令,
825   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
826   - * @param tElem
827   - * @param tAttrs
828   - * @returns {{pre: Function, post: Function}}
829   - */
830   - compile: function(tElem, tAttrs) {
831   - // 获取属性
832   - var $name_attr = tAttrs["name"]; // 控件的名字
833   - var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
834   -
835   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
836   - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
837   -
838   - var $cmaps_attr = tAttrs["cmaps"]; // model其他字段和内部数据字段名映射
839   - var $dscol_attr = tAttrs["dscol"]; // 内部显示的信息
840   - var $required_attr = tAttrs["required"]; // 是否需要required验证
841   -
842   - // controlAs名字
843   - var ctrlAs = "$saSelectCtrl";
844   -
845   - // 验证属性
846   - if (!$name_attr) {
847   - throw new error("name属性必须填写");
848   - }
849   - if (!$dcname_attr) {
850   - throw new error("dcname属性必须填写");
851   - }
852   - if (!$icname_attr) {
853   - throw new error("icname属性必须填写");
854   - }
855   - if (!$dscol_attr) {
856   - throw new error("dscol属性必须填写");
857   - }
858   -
859   - // 动态设置dom
860   - // dom required 属性
861   - if ($required_attr != undefined) {
862   - tElem.find("div").attr("required", "");
863   - }
864   - // dom placeholder 属性
865   - tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
866   - // dom dscol 属性
867   - tElem.find("ui-select-match").html("{{$select.selected" + "." + $dscol_attr + "}}");
868   - tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $dscol_attr);
869   - // dom icname 属性
870   - tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
871   - // dom name 属性
872   - tElem.find("div").attr("name", $name_attr);
873   -
874   - return {
875   - pre: function(scope, element, attr) {
876   - // TODO:
877   - },
878   -
879   - /**
880   - * 相当于link函数。
881   - * @param scope
882   - * @param element
883   - * @param attr
884   - */
885   - post: function(scope, element, attr) {
886   -
887   - // 添加选中事件处理函数
888   - scope[ctrlAs].$$internal_select_fn = function($item) {
889   - if ($dcname_attr && $icname_attr) {
890   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
891   - }
892   -
893   - if ($cmaps_attr) {
894   - for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名
895   - var ic = $cmaps_attr[mc]; // 内部数据源对应字段
896   - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
897   - }
898   - }
899   - };
900   -
901   - // 删除选中事件处理函数
902   - scope[ctrlAs].$$internal_remove_fn = function() {
903   - scope[ctrlAs].$$internal_select_value = undefined;
904   - if ($dcname_attr) {
905   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
906   - }
907   -
908   - if ($cmaps_attr) {
909   - var mc; // model的字段名
910   - for (mc in $cmaps_attr) {
911   - eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
912   - }
913   - }
914   - scope[ctrlAs].$$internal_validate_model();
915   - };
916   -
917   - // 刷新数据
918   - scope[ctrlAs].$$internal_refresh_fn = function(search) {
919   - if (search && search != "") { // 有search值
920   - // 处理search
921   - console.log("search:" + search);
922   -
923   - scope[ctrlAs].$$data = [];
924   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
925   - var upTerm = search.toUpperCase();
926   - if (scope[ctrlAs].$$data.length < 10) {
927   - if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
928   - || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
929   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
930   - }
931   - } else {
932   - break;
933   - }
934   - }
935   - }
936   - };
937   -
938   - /**
939   - * 验证内部数据,更新外部model
940   - */
941   - scope[ctrlAs].$$internal_validate_model = function() {
942   - if (scope[ctrlAs].$$internal_select_value) {
943   - var select_value_temp = scope[ctrlAs].$$internal_select_value;
944   - if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
945   - var obj;
946   - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
947   - if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
948   - obj = angular.copy(scope[ctrlAs].$$data_real[j]);
949   - break;
950   - }
951   - }
952   - if (obj) { // 在data中判定有没有
953   - for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
954   - if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
955   - obj = undefined;
956   - break;
957   - }
958   - }
959   - if (obj) {
960   - scope[ctrlAs].$$data.push(obj);
961   - }
962   - // 更新内部model,用于外部验证
963   - // 内部model的值暂时随意,以后再改
964   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
965   - } else {
966   - scope[ctrlAs].$$internalmodel = undefined;
967   - }
968   -
969   - } else {
970   - scope[ctrlAs].$$internalmodel = undefined;
971   - }
972   -
973   - } else {
974   - scope[ctrlAs].$$internalmodel = undefined;
975   - }
976   - };
977   -
978   - /**
979   - * 内部方法,读取字典数据作为数据源。
980   - * @param atype ajax查询类型
981   - * @param ajaxparamobj 查询参数对象
982   - */
983   - scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
984   - ajaxparamobj.type = 'all';
985   - $$searchInfoService_g[atype].list(
986   - ajaxparamobj,
987   - function(result) {
988   - console.log("$$internal_ajax_data result");
989   -
990   - // 清空内部数据
991   - scope[ctrlAs].$$data_real = [];
992   - scope[ctrlAs].$$data = [];
993   -
994   - // result中添加拼音数据,注意:这里要求result返回对象数组
995   - for (var i = 0; i < result.length; i ++) {
996   - if ($dscol_attr) {
997   - if (eval("result[i]" + "." + $dscol_attr)) {
998   - // 全拼
999   - result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $dscol_attr)).toUpperCase();
1000   - // 简拼
1001   - result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $dscol_attr));
1002   - }
1003   - }
1004   -
1005   - if (result[i]["fullChars"]) { // 有拼音的加入数据源
1006   - scope[ctrlAs].$$data_real.push(result[i]);
1007   - }
1008   -
1009   - }
1010   -
1011   - // 数据量太大,取10条记录显示
1012   - if (angular.isArray(scope[ctrlAs].$$data_real)) {
1013   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
1014   - if (scope[ctrlAs].$$data.length < 10) {
1015   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
1016   - } else {
1017   - break;
1018   - }
1019   - }
1020   - }
1021   -
1022   - scope[ctrlAs].$$internal_validate_model();
1023   - },
1024   - function(result) {
1025   -
1026   - }
1027   - );
1028   - };
1029   -
1030   - /**
1031   - * 内部方法,读取字典数据作为数据源。
1032   - * @param dictype 字典类型,如:gsType
1033   - */
1034   - scope[ctrlAs].$$internal_dic_data = function(dictype) {
1035   - if (!dictionaryUtils.getByGroup(dictype)) {
1036   - throw new error("字典数据不窜在=" + dictype);
1037   - }
1038   -
1039   - // 清空内部数据
1040   - scope[ctrlAs].$$data_real = [];
1041   - scope[ctrlAs].$$data = [];
1042   -
1043   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
1044   - var dic_key; // 字典key
1045   -
1046   - for (dic_key in origin_dicgroup) {
1047   - var data = {}; // 重新组合的字典元素对象
1048   - if (dic_key == "true")
1049   - data[$icname_attr] = true;
1050   - else
1051   - data[$icname_attr] = dic_key;
1052   - data[$dscol_attr] = origin_dicgroup[dic_key];
1053   - scope[ctrlAs].$$data_real.push(data);
1054   - }
1055   - // 这里直接将$$data_real数据深拷贝到$$data
1056   - angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
1057   - scope[ctrlAs].$$internal_validate_model();
1058   - };
1059   -
1060   - attr.$observe("dsparams", function(value) {
1061   - if (value && value != "") {
1062   - var obj = JSON.parse(value);
1063   - console.log("observe 监控 dsparams=" + obj);
1064   -
1065   - // dsparams格式如下:
1066   - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
1067   -
1068   - if (obj.type == 'dic') {
1069   - scope[ctrlAs].$$internal_dic_data(obj.param);
1070   -
1071   - } else if (obj.type == 'ajax') {
1072   - scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
1073   - } else {
1074   - throw new Error("dsparams参数格式异常=" + obj);
1075   - }
1076   -
1077   - }
1078   -
1079   - });
1080   -
1081   - // 监控model绑定的dcvalue值变化
1082   - attr.$observe("dcvalue", function(value) {
1083   - if (value && value != "") {
1084   - console.log("observe 监控 dcvalue=" + value);
1085   - scope[ctrlAs].$$internal_select_value = value;
1086   - scope[ctrlAs].$$internal_validate_model();
1087   - }
1088   -
1089   - // 闭包测试
1090   - var obj = {'a':1,'b':2};
1091   - var tfx = scope[ctrlAs].$$test.bind(obj);
1092   - console.log("闭包测试=" + tfx());
1093   - });
1094   -
1095   - scope[ctrlAs].$$test = function() {
1096   - var exp = "this.a + '(' + this.b + ')'";
1097   - console.log("exp=" + exp);
1098   - return eval(exp);
1099   - };
1100   - }
1101   - };
1102   -
1103   - }
1104   -
1105   - };
1106   - }
1107   -]);
1108   -/**
1109   - * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
1110   - * name(必须):控件的名字
1111   - * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave
1112   - * cmaps(必须):外部对象与指令内部数据对象字段名映射对象字符串,如:{'xl.id' : 'id', 'xl.name' : 'name'}
1113   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
1114   - * icname(必须):内部与之对应的字段名,如:icname=id
1115   - *
1116   - * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
1117   - * dsparamsextra(可选):内部数据源查询附加参数对象字符串,如:{'type':'all'}
1118   - * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item
1119   - * iterobjexp(必须):内部显示用的表达式
1120   - * searchph(必须):查询输入占位符字符串,如:searchph=请输入...
1121   - * searchexp(必须):查询基于的内部数据源的表达式,如:searchexp=this.name+'('+this.code+')'
1122   - *
1123   - * required(可选):是否需要form的required验证
1124   - *
1125   - */
1126   -angular.module('ScheduleApp').directive('saSelect5', [
1127   - '$timeout',
1128   - '$$SearchInfoService_g',
1129   - function($timeout, $$searchInfoService_g) {
1130   - return {
1131   - restrict: 'E',
1132   - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',
1133   - scope: { // 独立作用域
1134   - model: "=" // 绑定外部对象
1135   - },
1136   - controllerAs: "$saSelectCtrl",
1137   - bindToController: true,
1138   - controller: function($scope) {
1139   - var self = this;
1140   - self.$$data = []; // 内部ui-select显示用数据
1141   - self.$$data_real = []; // 内部保存的实际数据
1142   -
1143   - // myselect组件的ng-model,用于外部绑定验证等操作
1144   - self.$$internalmodel = undefined;
1145   -
1146   - self.$$internal_select_value = undefined; // 选中的值
1147   -
1148   - },
1149   -
1150   - /**
1151   - * 此阶段可以改dom结构,此时angular还没扫描指令,
1152   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
1153   - * @param tElem
1154   - * @param tAttrs
1155   - * @returns {{pre: Function, post: Function}}
1156   - */
1157   - compile: function(tElem, tAttrs) {
1158   - // 获取属性,并验证必须按属性
1159   - var $name_attr = tAttrs["name"]; // 控件的名字
1160   - var $cmaps_attr = tAttrs["cmaps"]; // 外部对象与指令内部数据对象字段名映射对象
1161   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
1162   - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
1163   -
1164   - var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象
1165   - var $dsparamsextra_attr = tAttrs["dsparamsextra"]; // 内部数据源查询附加参数对象字符串
1166   - var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名
1167   - var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式
1168   - var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串
1169   - var $searchexp_attr = tAttrs["searchexp"]; // 查询基于的内部数据源的表达式
1170   -
1171   - var $required_attr = tAttrs["required"]; // 是否需要required验证
1172   -
1173   - if (!$name_attr) {
1174   - throw new Error("name属性必须填写");
1175   - }
1176   - if (!$cmaps_attr) {
1177   - throw new Error("cmaps属性必须填写")
1178   - }
1179   - if (!$dcname_attr || !$icname_attr) {
1180   - throw new Error("dcname、icname属性必须填写");
1181   - }
1182   - if (!$dsparams_attr) {
1183   - throw new Error("dsparams属性必须填写");
1184   - }
1185   - if (!$iterobjname_attr) {
1186   - throw new Error("iterobjname属性必须填写");
1187   - }
1188   - if (!$iterobjexp_attr) {
1189   - throw new Error("iterobjexp属性必须填写");
1190   - }
1191   - if (!$searchph_attr) {
1192   - throw new Error("searchph属性必须填写");
1193   - }
1194   - if (!$searchexp_attr) {
1195   - throw new Error("searchexp属性必须填写");
1196   - }
1197   -
1198   - // 内部controlAs名字
1199   - var ctrlAs = "$saSelectCtrl";
1200   -
1201   - // 动态设置dom
1202   - // dom,最外层name属性设置
1203   - tElem.find("div:first").attr("name", $name_attr);
1204   - // dom,最外层divrequired属性设置
1205   - if ($required_attr != undefined) {
1206   - tElem.find("div[name=\'" + $name_attr + "\']").attr("required", "");
1207   - }
1208   - // dom,ui-select-match的placeholder属性设定
1209   - tElem.find("ui-select-match").attr("placeholder", $searchph_attr);
1210   - // dom,ui-select-match的内容设定
1211   - var uiSelectMatchHtml = "{{" + ctrlAs + ".$$internal_match_str($select.selected)}}";
1212   - tElem.find("ui-select-match").html(uiSelectMatchHtml);
1213   - // dom,ui-select-choices的repeat属性设定
1214   - var uiSelectChoices_repeatAttr = $iterobjname_attr + "." + $icname_attr + " as " + $iterobjname_attr + " in " + ctrlAs + ".$$data";
1215   - tElem.find("ui-select-choices").attr("repeat", uiSelectChoices_repeatAttr);
1216   - // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
1217   - tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
1218   -
1219   - return {
1220   - pre: function (scope, element, attr) {
1221   - // TODO:
1222   - },
1223   -
1224   - /**
1225   - * 相当于link函数。
1226   - * @param scope
1227   - * @param element
1228   - * @param attr
1229   - */
1230   - post: function (scope, element, attr) {
1231   -
1232   - // 添加选中事件处理函数
1233   - scope[ctrlAs].$$internal_select_fn = function($item) {
1234   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
1235   -
1236   - eval("var obj=" + $cmaps_attr);
1237   - for (var mc in obj) { // model的字段名:内部数据源对应字段名
1238   - var ic = obj[mc]; // 内部数据源对应字段
1239   - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
1240   - }
1241   - };
1242   -
1243   - // 删除选中事件处理函数
1244   - scope[ctrlAs].$$internal_remove_fn = function() {
1245   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
1246   -
1247   - eval("var obj=" + $cmaps_attr);
1248   - var mc; // model的字段名
1249   - for (mc in obj) {
1250   - eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
1251   - }
1252   - };
1253   -
1254   - // 刷新数据
1255   - scope[ctrlAs].$$internal_refresh_fn = function(search) {
1256   - if (search && search != "") { // 有search值
1257   - // 处理search
1258   - console.log("search:" + search);
1259   -
1260   - scope[ctrlAs].$$data = [];
1261   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
1262   - var upTerm = search.toUpperCase();
1263   - if (scope[ctrlAs].$$data.length < 10) {
1264   - if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
1265   - || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
1266   - || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
1267   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
1268   - }
1269   - } else {
1270   - break;
1271   - }
1272   - }
1273   - }
1274   - };
1275   -
1276   - /**
1277   - * 验证内部数据,更新外部model
1278   - */
1279   - scope[ctrlAs].$$internal_validate_model = function() {
1280   - if (scope[ctrlAs].$$internal_select_value) {
1281   - var select_value_temp = scope[ctrlAs].$$internal_select_value;
1282   - if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
1283   - var obj;
1284   - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
1285   - if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
1286   - obj = angular.copy(scope[ctrlAs].$$data_real[j]);
1287   - break;
1288   - }
1289   - }
1290   - if (obj) { // 在data中判定有没有
1291   - for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
1292   - if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
1293   - obj = undefined;
1294   - break;
1295   - }
1296   - }
1297   - if (obj) {
1298   - scope[ctrlAs].$$data.push(obj);
1299   - }
1300   - // 更新内部model,用于外部验证
1301   - // 内部model的值暂时随意,以后再改
1302   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
1303   - } else {
1304   - scope[ctrlAs].$$internalmodel = undefined;
1305   - }
1306   -
1307   - } else {
1308   - scope[ctrlAs].$$internalmodel = undefined;
1309   - }
1310   -
1311   - } else {
1312   - scope[ctrlAs].$$internalmodel = undefined;
1313   - }
1314   - };
1315   -
1316   - /**
1317   - * 内部match表达式转换函数,需要外部绑定此函数的上下文。
1318   - * @param context function上下文
1319   - */
1320   - scope[ctrlAs].$$internal_match_str = function (context) {
1321   - var fx = function() {
1322   - try {
1323   - return eval($searchexp_attr);
1324   - } catch (err) {
1325   - //console.log(err);
1326   - return undefined;
1327   - }
1328   -
1329   - };
1330   -
1331   - var str = fx.bind(context)();
1332   - if (str && str != "")
1333   - return str;
1334   - else
1335   - return undefined;
1336   - };
1337   -
1338   - /**
1339   - * 内部方法,读取字典数据作为数据源。
1340   - * @param atype ajax查询类型
1341   - * @param ajaxparamobj 查询参数对象
1342   - */
1343   - scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
1344   - // 如果ajaxparamobj为空对象,则表示清空内部选项
1345   - var isEmptyObj = true;
1346   - for (var name in ajaxparamobj) {
1347   - isEmptyObj = false;
1348   - }
1349   - if (isEmptyObj) {
1350   - // 重新创建内部保存的数据
1351   - scope[ctrlAs].$$data_real = [];
1352   - // 重新创建内部ui-select显示用数据,默认取10条记录显示
1353   - scope[ctrlAs].$$data = [];
1354   -
1355   - scope[ctrlAs].$$internal_remove_fn();
1356   - scope[ctrlAs].$$internal_validate_model();
1357   -
1358   - return;
1359   - }
1360   -
1361   - if ($dsparamsextra_attr) { // 合并附加参数
1362   - eval("var extra = " + $dsparamsextra_attr);
1363   - for (var extrakey in extra) {
1364   - ajaxparamobj[extrakey] = extra[extrakey];
1365   - }
1366   - }
1367   -
1368   - $$searchInfoService_g[atype].list(
1369   - ajaxparamobj,
1370   - function(result) {
1371   - console.log("$$internal_ajax_data result");
1372   -
1373   - // 重新创建内部保存的数据
1374   - scope[ctrlAs].$$data_real = [];
1375   - // result中添加拼音数据,注意:这里要求result返回对象数组
1376   - for (var i = 0; i < result.length; i++) {
1377   - // 闭包绑定返回最终查询的值
1378   - var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
1379   - if (calcu_str) {
1380   - // 全拼
1381   - result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
1382   - // 简拼
1383   - result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
1384   - // 原值
1385   - result[i]["$calcu_str"] = calcu_str;
1386   -
1387   - scope[ctrlAs].$$data_real.push(result[i]);
1388   - }
1389   - }
1390   -
1391   - // 重新创建内部ui-select显示用数据,默认取10条记录显示
1392   - scope[ctrlAs].$$data = [];
1393   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
1394   - if (scope[ctrlAs].$$data.length < 10) {
1395   - scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
1396   - } else {
1397   - break;
1398   - }
1399   - }
1400   -
1401   - scope[ctrlAs].$$internal_validate_model();
1402   - },
1403   - function(result) {
1404   - throw new Error("ajax查询出错");
1405   - }
1406   - );
1407   - };
1408   -
1409   - /**
1410   - * 内部方法,读取字典数据作为数据源。
1411   - * @param dictype 字典类型,如:gsType
1412   - */
1413   - scope[ctrlAs].$$internal_dic_data = function(dictype) {
1414   - if (!dictionaryUtils.getByGroup(dictype)) {
1415   - throw new error("字典数据不窜在=" + dictype);
1416   - }
1417   -
1418   - // 重新创建内部保存的数据
1419   - scope[ctrlAs].$$data_real = [];
1420   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
1421   - var dic_key; // 字典key
1422   -
1423   - for (dic_key in origin_dicgroup) {
1424   - var data = {}; // 重新组合的字典元素对象
1425   - if (dic_key == "true")
1426   - data[$icname_attr] = true;
1427   - else
1428   - data[$icname_attr] = dic_key;
1429   - data[$dscol_attr] = origin_dicgroup[dic_key];
1430   - scope[ctrlAs].$$data_real.push(data);
1431   - }
1432   -
1433   - // 重新创建内部ui-select显示用数据,直接复制所有的字典数据
1434   - scope[ctrlAs].$$data = [];
1435   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
1436   - scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
1437   - }
1438   -
1439   - scope[ctrlAs].$$internal_validate_model();
1440   - };
1441   -
1442   - /**
1443   - * 监控dsparams属性变化
1444   - */
1445   - attr.$observe("dsparams", function(value) {
1446   - if (value && value != "") {
1447   - var obj = JSON.parse(value);
1448   - console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);
1449   -
1450   - // dsparams格式如下:
1451   - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
1452   -
1453   - if (obj.type == 'dic') {
1454   - scope[ctrlAs].$$internal_dic_data(obj.param);
1455   -
1456   - } else if (obj.type == 'ajax') {
1457   - scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
1458   - } else {
1459   - throw new Error("dsparams参数格式异常=" + obj);
1460   - }
1461   -
1462   - }
1463   - });
1464   -
1465   - /**
1466   - * 监控外部模型dcname的值的变化。
1467   - */
1468   - scope.$watch(
1469   - function() {
1470   - return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);
1471   - },
1472   - function(newValue, oldValue) {
1473   - if (newValue === undefined && oldValue === undefined) {
1474   - // 两侧都是undefined,不处理
1475   -
1476   - } else {
1477   - console.log("saSelect5 监控到外部模型" + $dcname_attr + "属性值变化,old=" + oldValue + ",new=" + newValue);
1478   - scope[ctrlAs].$$internal_select_value = newValue;
1479   - scope[ctrlAs].$$internal_validate_model();
1480   - }
1481   - },
1482   - true
1483   - );
1484   - }
1485   - };
1486   - }
1487   - };
1488   - }
1489   -]);
1490   -
1491   -/**
1492   - * saRadiogroup指令
1493   - * 属性如下:
1494   - * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate
1495   - * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)
1496   - * name(必须):控件的名字
1497   - * required(可选):是否要用required验证
1498   - * disabled(可选):标示单选框是否可选
1499   - *
1500   - */
1501   -angular.module('ScheduleApp').directive("saRadiogroup", [function() {
1502   - /**
1503   - * 使用字典数据的单选按钮组的指令。
1504   - * 指令名称:truefalse-Dic
1505   - */
1506   - return {
1507   - restrict: 'E',
1508   - templateUrl: '/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroupTemplate.html',
1509   - scope: {
1510   - model: "="
1511   - },
1512   - controllerAs: "$saRadiogroupCtrl",
1513   - bindToController: true,
1514   - controller: function($scope) {
1515   - //$scope["model"] = {selectedOption: null};
1516   - //console.log("controller");
1517   - //console.log("controller:" + $scope["model"]);
1518   -
1519   - var self = this;
1520   - self.$$data = null; // 内部数据
1521   - },
1522   -
1523   - /**
1524   - * 此阶段可以改dom结构,此时angular还没扫描指令,
1525   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
1526   - * @param tElem
1527   - * @param tAttrs
1528   - * @returns {{pre: Function, post: Function}}
1529   - */
1530   - compile: function(tElem, tAttrs) {
1531   - // 获取属性
1532   - var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type
1533   - var $name_attr = tAttrs["name"]; // 控件的名字
1534   - var $required_attr = tAttrs["required"]; // 是否要用required验证
1535   - var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选
1536   -
1537   - // controlAs名字
1538   - var ctrlAs = "$saRadiogroupCtrl";
1539   -
1540   - // 如果有required属性,添加angularjs required验证
1541   - if ($required_attr != undefined) {
1542   - tElem.find("input").attr("required", "");
1543   - }
1544   -
1545   - return {
1546   - pre: function(scope, element, attr) {
1547   -
1548   - },
1549   -
1550   - /**
1551   - * 相当于link函数。
1552   - * @param scope
1553   - * @param element
1554   - * @param attr
1555   - */
1556   - post: function(scope, element, attr) {
1557   - //console.log("link");
1558   - //console.log("link:" + scope.model);
1559   - //scope["model"] = {selectedOption: null};
1560   -
1561   - if ($name_attr) {
1562   - scope[ctrlAs].nv = $name_attr;
1563   - }
1564   -
1565   - if ($disabled_attr) {
1566   - scope[ctrlAs].disabled = true;
1567   - }
1568   - if ($dicgroup_attr) {
1569   - var obj = dictionaryUtils.getByGroup($dicgroup_attr);
1570   - scope[ctrlAs].$$data = obj;
1571   - // 处理 scope["dic"] key值
1572   - scope[ctrlAs].dicvalueCalcu = function(value) {
1573   - if (value == "true") {
1574   - //console.log(value);
1575   - return true;
1576   - } else if (value == "false") {
1577   - //console.log(value);
1578   - return false;
1579   - } else {
1580   - return value;
1581   - }
1582   - };
1583   - }
1584   - }
1585   - };
1586   - }
1587   - };
1588   -}]);
1589   -
1590   -
1591   -
1592   -/**
1593   - * saCheckboxgroup指令
1594   - * 属性如下:
1595   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
1596   - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
1597   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
1598   - * name(必须):控件的名字
1599   - * required(可选):是否要用required验证
1600   - * disabled(可选):标示框是否可选
1601   - *
1602   - */
1603   -angular.module('ScheduleApp').directive('saCheckboxgroup', [
1604   - function() {
1605   - return {
1606   - restrict: 'E',
1607   - templateUrl: '/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroupTemplate.html',
1608   - scope: {
1609   - model: "=" // 独立作用域,关联外部的模型object
1610   - },
1611   - controllerAs: "$saCheckboxgroupCtrl",
1612   - bindToController: true,
1613   - controller: function($scope) {
1614   - var self = this;
1615   - self.$$data = []; // 内部的数据
1616   -
1617   - // TODO:数据写死,周一至周日选择数据,以后有别的数据再议
1618   - self.$$data = [
1619   - {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1620   - {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1621   - {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1622   - {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1623   - {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1624   - {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1625   - {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}
1626   - ];
1627   - },
1628   -
1629   - /**
1630   - * 此阶段可以改dom结构,此时angular还没扫描指令,
1631   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
1632   - * @param tElem
1633   - * @param tAttrs
1634   - * @returns {{pre: Function, post: Function}}
1635   - */
1636   - compile: function(tElem, tAttrs) {
1637   - // 获取所有的属性
1638   - var $name_attr = tAttrs["name"]; // 控件的名字
1639   - var $required_attr = tAttrs["required"]; // 是否需要required验证
1640   - var $disabled_attr = tAttrs["disabled"]; // 是否禁用
1641   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
1642   -
1643   - // controlAs名字
1644   - var ctrlAs = '$saCheckboxgroupCtrl';
1645   -
1646   - // 如果有required属性,添加angularjs required验证
1647   - if ($required_attr != undefined) {
1648   - //console.log(tElem.html());
1649   - tElem.find("div").attr("required", "");
1650   - }
1651   - // 如果有disabled属性,添加禁用标志
1652   - if ($disabled_attr != undefined) {
1653   - tElem.find("input").attr("ng-disabled", "true");
1654   - }
1655   -
1656   - return {
1657   - pre: function(scope, element, attr) {
1658   - // TODO:
1659   - },
1660   - /**
1661   - * 相当于link函数。
1662   - * @param scope
1663   - * @param element
1664   - * @param attr
1665   - */
1666   - post: function(scope, element, attr) {
1667   - // name属性
1668   - if ($name_attr) {
1669   - scope[ctrlAs]["$name_attr"] = $name_attr;
1670   - }
1671   -
1672   - /**
1673   - * checkbox选择事件处理函数。
1674   - * @param $d 数据对象,$$data中的元素对象
1675   - */
1676   - scope[ctrlAs].$$internal_updateCheck_fn = function($d) {
1677   - $d.ischecked = !$d.ischecked;
1678   - console.log($d);
1679   - };
1680   -
1681   - // 测试使用watch监控$$data的变化
1682   - scope.$watch(
1683   - function() {
1684   - return scope[ctrlAs]["$$data"];
1685   - },
1686   - function(newValue, oldValue) {
1687   - // 根据$$data生成对应的数据
1688   - var rule_days_arr = [];
1689   - var i;
1690   - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
1691   - if (scope[ctrlAs]["$$data"][i].ischecked)
1692   - rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);
1693   - else
1694   - rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);
1695   - }
1696   - scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");
1697   - //scope[ctrlAs].$$internalmodel = undefined;
1698   - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
1699   -
1700   - // 更新model
1701   - if ($dcname_attr) {
1702   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");
1703   - }
1704   -
1705   -
1706   - },
1707   - true
1708   - );
1709   -
1710   - // TODO:
1711   -
1712   - // 监控dcvalue model值变换
1713   - attr.$observe("dcvalue", function(value) {
1714   - console.log("saCheckboxgroup 监控dc1 model值变换:" + value);
1715   - if (value) {
1716   - // 根据value值,修改$$data里的值
1717   - var data_array = value.split(",");
1718   - var i;
1719   - if (data_array.length > scope[ctrlAs]["$$data"].length) {
1720   - for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {
1721   - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
1722   - scope[ctrlAs]["$$data"][i].ischecked = true;
1723   - } else {
1724   - scope[ctrlAs]["$$data"][i].ischecked = false;
1725   - }
1726   - }
1727   - } else {
1728   - for (i = 0; i < data_array.length; i ++) {
1729   - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
1730   - scope[ctrlAs]["$$data"][i].ischecked = true;
1731   - } else {
1732   - scope[ctrlAs]["$$data"][i].ischecked = false;
1733   - }
1734   - }
1735   - }
1736   -
1737   - }
1738   - });
1739   - }
1740   -
1741   - };
1742   -
1743   -
1744   - }
1745   -
1746   - };
1747   - }
1748   -]);
1749   -
1750   -
1751   -
1752   -
1753   -/**
1754   - * saDategroup指令
1755   - * 属性如下:
1756   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
1757   - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
1758   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
1759   - * name(必须):控件的名字
1760   - * required(可选):是否要用required验证
1761   - * disabled(可选):标示框是否可选
1762   - *
1763   - */
1764   -angular.module('ScheduleApp').directive('saDategroup', [
1765   - '$filter',
1766   - function($filter) {
1767   - return {
1768   - restrict: 'E',
1769   - templateUrl: '/pages/scheduleApp/module/common/dts2/dateGroup/saDategroupTemplate.html',
1770   - scope: {
1771   - model: "=" // 独立作用域,关联外部的模型object
1772   - },
1773   - controllerAs: "$saDategroupCtrl",
1774   - bindToController: true,
1775   - controller: function($scope) {
1776   - var self = this;
1777   - self.$$data = []; // 内部的数据
1778   - self.$$date_select; // 内部选中的日期
1779   -
1780   - //// 测试数据
1781   - //self.$$data = [
1782   - // {datestr: '2011-01-01', ischecked: true},
1783   - // {datestr: '2011-01-01', ischecked: true},
1784   - // {datestr: '2011-01-01', ischecked: true}
1785   - //];
1786   - },
1787   -
1788   - /**
1789   - * 此阶段可以改dom结构,此时angular还没扫描指令,
1790   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
1791   - * @param tElem
1792   - * @param tAttrs
1793   - * @returns {{pre: Function, post: Function}}
1794   - */
1795   - compile: function(tElem, tAttrs) {
1796   - // 获取所有的属性
1797   - var $name_attr = tAttrs["name"]; // 控件的名字
1798   - var $required_attr = tAttrs["required"]; // 是否需要required验证
1799   - var $disabled_attr = tAttrs["disabled"]; // 是否禁用
1800   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
1801   -
1802   - // controlAs名字
1803   - var ctrlAs = '$saDategroupCtrl';
1804   -
1805   - // 如果有required属性,添加angularjs required验证
1806   - if ($required_attr != undefined) {
1807   - //console.log(tElem.html());
1808   - tElem.find("div").attr("required", "");
1809   - }
1810   - // 如果有disabled属性,添加禁用标志
1811   - if ($disabled_attr != undefined) {
1812   - tElem.find("input").attr("ng-disabled", "true");
1813   - tElem.find("div").attr("ng-disabled", "true");
1814   - }
1815   -
1816   - return {
1817   - pre: function (scope, element, attr) {
1818   - // TODO:
1819   - },
1820   - /**
1821   - * 相当于link函数。
1822   - * @param scope
1823   - * @param element
1824   - * @param attr
1825   - */
1826   - post: function (scope, element, attr) {
1827   - // name属性
1828   - if ($name_attr) {
1829   - scope[ctrlAs]["$name_attr"] = $name_attr;
1830   - }
1831   -
1832   -
1833   - // 日期open属性,及方法
1834   - scope[ctrlAs].$$specialDateOpen = false;
1835   - scope[ctrlAs].$$specialDate_open = function() {
1836   - scope[ctrlAs].$$specialDateOpen = true;
1837   - };
1838   -
1839   - // 监控选择的日期
1840   - scope.$watch(
1841   - function() {
1842   - return scope[ctrlAs]['$$date_select'];
1843   - },
1844   - function(newValue, oldValue) {
1845   - if (newValue) {
1846   - //console.log("saDategroup--->selectdate:" + newValue);
1847   - // 调用内置filter,转换日期到yyyy-MM-dd格式
1848   - var text = $filter('date')(newValue, 'yyyy-MM-dd');
1849   - var i;
1850   - var isexist = false; // 日期是否已经选择标识
1851   - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
1852   - if (scope[ctrlAs]["$$data"][i].datestr == text) {
1853   - isexist = true;
1854   - break;
1855   - }
1856   - }
1857   - if (!isexist) {
1858   - scope[ctrlAs]["$$data"].push(
1859   - {
1860   - datestr: text,
1861   - ischecked: true
1862   - }
1863   - );
1864   - }
1865   -
1866   - }
1867   -
1868   - }
1869   - );
1870   -
1871   - /**
1872   - * 日期点击事件处理函数。
1873   - * @param $index 索引
1874   - */
1875   - scope[ctrlAs].$$internal_datestr_click = function($index) {
1876   - scope[ctrlAs].$$data.splice($index, 1);
1877   - };
1878   -
1879   - // 测试使用watch监控$$data的变化
1880   - scope.$watch(
1881   - function() {
1882   - return scope[ctrlAs]['$$data'];
1883   - },
1884   - function(newValue, oldValue) {
1885   - // 根据$$data生成对应的数据
1886   - var special_days_arr = [];
1887   - var i;
1888   - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
1889   - special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);
1890   - }
1891   -
1892   - scope[ctrlAs].$$internalmodel = special_days_arr.join(",");
1893   - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
1894   -
1895   - // 更新model
1896   - if ($dcname_attr) {
1897   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");
1898   - }
1899   - },
1900   - true
1901   - );
1902   -
1903   - // 监控dcvalue model值变换
1904   - attr.$observe("dcvalue", function(value) {
1905   - console.log("saDategroup 监控dc1 model值变换:" + value);
1906   - if (value) {
1907   - // 根据value值,修改$$data里的值
1908   - var date_array = value.split(",");
1909   - var i;
1910   - scope[ctrlAs]["$$data"] = [];
1911   - for (i = 0; i < date_array.length; i++) {
1912   - scope[ctrlAs]["$$data"].push(
1913   - {
1914   - datestr: date_array[i],
1915   - ischecked: true
1916   - }
1917   - );
1918   - }
1919   -
1920   -
1921   -
1922   -
1923   -
1924   -
1925   -
1926   -
1927   -
1928   - }
1929   - });
1930   -
1931   - }
1932   -
1933   - };
1934   - }
1935   - }
1936   - }
1937   -]);
1938   -
1939   -
1940   -
1941   -
1942   -/**
1943   - * saGuideboardgroup指令
1944   - * 属性如下:
1945   - * name(必须):控件的名字
1946   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
1947   - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
1948   - * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
1949   - * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange
1950   - * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
1951   - * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange
1952   - * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
1953   - * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart
1954   - *
1955   - * required(可选):是否要用required验证
1956   - *
1957   - */
1958   -angular.module('ScheduleApp').directive('saGuideboardgroup', [
1959   - 'GuideboardManageService_g',
1960   - function(guideboardManageService_g) {
1961   - return {
1962   - restrict: 'E',
1963   - templateUrl: '/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroupTemplate.html',
1964   - scope: {
1965   - model: "=" // 独立作用域,关联外部的模型object
1966   - },
1967   - controllerAs: '$saGuideboardgroupCtrl',
1968   - bindToController: true,
1969   - controller: function($scope) {
1970   - var self = this;
1971   - self.$$data = []; // 选择线路后,该线路的路牌数据
1972   -
1973   - // 测试数据
1974   - //self.$$data = [
1975   - // {lpid: 1, lpname: '路1', isstart: false},
1976   - // {lpid: 2, lpname: '路2', isstart: true},
1977   - // {lpid: 3, lpname: '路3', isstart: false}
1978   - //];
1979   -
1980   -
1981   - self.$$dataSelected = []; // 选中的路牌列表
1982   - self.$$dataSelectedStart = undefined; // 起始路牌
1983   -
1984   - //self.$$dataSelected = [
1985   - // {lpid: 11, lpname: '路11', isstart: false},
1986   - // {lpid: 12, lpname: '路12', isstart: true},
1987   - // {lpid: 13, lpname: '路13', isstart: false}
1988   - //];
1989   -
1990   - // saGuideboardgroup组件的ng-model,用于外部绑定等操作
1991   - self.$$internalmodel = undefined;
1992   -
1993   - self.$$data_init = false; // *数据源初始化标志
1994   - self.$$data_xl_first_init = false; // 线路是否初始化
1995   - self.$$data_lp_first_init = false; // 路牌名字是否初始化
1996   - self.$$data_lpid_first_init = false; // 路牌id是否初始化
1997   - self.$$data_lpstart_first_init = false; // 起始路牌是否初始化
1998   -
1999   - },
2000   -
2001   - /**
2002   - * 此阶段可以改dom结构,此时angular还没扫描指令,
2003   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
2004   - * @param tElem
2005   - * @param tAttrs
2006   - * @returns {{pre: Function, post: Function}}
2007   - */
2008   - compile: function(tElem, tAttrs) {
2009   - // TODO:获取所有的属性
2010   - var $name_attr = tAttrs["name"]; // 控件的名字
2011   - var $required_attr = tAttrs["required"]; // 是否需要required验证
2012   - var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名
2013   - var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名
2014   - var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名
2015   -
2016   - // controlAs名字
2017   - var ctrlAs = '$saGuideboardgroupCtrl';
2018   -
2019   - // 如果有required属性,添加angularjs required验证
2020   - if ($required_attr != undefined) {
2021   - //console.log(tElem.html());
2022   - tElem.find("div").attr("required", "");
2023   - }
2024   -
2025   - return {
2026   - pre: function(scope, element, attr) {
2027   - // TODO:
2028   - },
2029   -
2030   - /**
2031   - * 相当于link函数。
2032   - * @param scope
2033   - * @param element
2034   - * @param attr
2035   - */
2036   - post: function(scope, element, attr) {
2037   - // name属性
2038   - if ($name_attr) {
2039   - scope[ctrlAs]["$name_attr"] = $name_attr;
2040   - }
2041   -
2042   - // TODO:
2043   -
2044   -
2045   - /**
2046   - * 路牌列表点击(路牌列表中选中路牌)
2047   - * @param $index
2048   - */
2049   - scope[ctrlAs].$$internal_lplist_click = function($index) {
2050   - var data_temp = scope[ctrlAs].$$data;
2051   - if (data_temp && data_temp.length > $index) {
2052   - scope[ctrlAs].$$dataSelected.push({
2053   - lpid: data_temp[$index].lpid,
2054   - lpname: data_temp[$index].lpname,
2055   - isstart: data_temp[$index].isstart
2056   - });
2057   -
2058   - // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌
2059   - if (scope[ctrlAs].$$dataSelectedStart == undefined) {
2060   - scope[ctrlAs].$$internal_sellplist_click(
2061   - scope[ctrlAs].$$dataSelected.length - 1);
2062   - }
2063   - }
2064   - };
2065   - /**
2066   - * 选中的路牌单击(初始路牌选择)
2067   - * @param $index
2068   - */
2069   - scope[ctrlAs].$$internal_sellplist_click = function($index) {
2070   - var data_temp = scope[ctrlAs].$$dataSelected;
2071   - if (data_temp && data_temp.length > $index) {
2072   - for (var i = 0; i < data_temp.length; i++) {
2073   - data_temp[i].isstart = false;
2074   - }
2075   - data_temp[$index].isstart = true;
2076   - scope[ctrlAs].$$dataSelectedStart = $index;
2077   - }
2078   - };
2079   - /**
2080   - * 选中的路牌双击(删除选中的路牌)
2081   - * @param $index
2082   - */
2083   - scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {
2084   - var data_temp = scope[ctrlAs].$$dataSelected;
2085   - if (data_temp && data_temp.length > $index) {
2086   - if (scope[ctrlAs].$$dataSelectedStart == $index) {
2087   - scope[ctrlAs].$$dataSelectedStart = undefined;
2088   - }
2089   - data_temp.splice($index, 1);
2090   - }
2091   - };
2092   -
2093   -
2094   - /**
2095   - * 验证内部数据,更新外部model
2096   - */
2097   - scope[ctrlAs].$$internal_validate_model = function() {
2098   - var data_temp = scope[ctrlAs].$$dataSelected;
2099   - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
2100   - var lpNames = [];
2101   - var lpIds = [];
2102   - var lpStart = 0;
2103   - var i = 0;
2104   -
2105   - if (data_temp &&
2106   - data_temp.length > 0 &&
2107   - data_temp2 != undefined) {
2108   -
2109   - for (i = 0; i < data_temp.length; i++) {
2110   - lpNames.push(data_temp[i].lpname);
2111   - lpIds.push(data_temp[i].lpid)
2112   - }
2113   - data_temp[data_temp2].isstart = true;
2114   - lpStart = data_temp2 + 1;
2115   -
2116   - // 更新内部model,用于外部验证
2117   - // 内部model的值暂时随意,以后再改
2118   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
2119   -
2120   - // 更新外部model字段
2121   - if ($lprangename_attr) {
2122   - console.log("lprangename=" + lpNames.join(','));
2123   - eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");
2124   - }
2125   - if ($lpidrangename_attr) {
2126   - console.log("lpidrangename=" + lpIds.join(','));
2127   - eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");
2128   - }
2129   - if ($lpstartname_attr) {
2130   - console.log("lpstartname=" + lpStart);
2131   - eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");
2132   - }
2133   -
2134   - } else {
2135   - scope[ctrlAs].$$internalmodel = undefined;
2136   - }
2137   -
2138   -
2139   - };
2140   -
2141   - // 监控内部数据,$$data_selected 变化
2142   - scope.$watch(
2143   - function() {
2144   - return scope[ctrlAs].$$dataSelected;
2145   - },
2146   - function(newValue, oldValue) {
2147   - scope[ctrlAs].$$internal_validate_model();
2148   - },
2149   - true
2150   - );
2151   -
2152   - // 监控内部数据,$$data_selected_start 变化
2153   - scope.$watch(
2154   - function() {
2155   - return scope[ctrlAs].$$dataSelectedStart;
2156   - },
2157   - function(newValue, oldValue) {
2158   - scope[ctrlAs].$$internal_validate_model();
2159   - },
2160   - true
2161   - );
2162   -
2163   - /**
2164   - * 验证数据是否初始化完成,
2165   - * 所谓的初始化就是内部所有的数据被有效设定过一次。
2166   - */
2167   - scope[ctrlAs].$$internal_validate_init = function() {
2168   - var self = scope[ctrlAs];
2169   -
2170   - if (self.$$data_xl_first_init &&
2171   - self.$$data_lp_first_init &&
2172   - self.$$data_lpid_first_init &&
2173   - self.$$data_lpstart_first_init) {
2174   - console.log("数据初始化完毕!");
2175   - self.$$data_init = true;
2176   - }
2177   -
2178   - };
2179   -
2180   - // 监控初始化标志,线路,路牌,路牌id,起始路牌
2181   - scope.$watch(
2182   - function() {
2183   - return scope[ctrlAs].$$data_xl_first_init;
2184   - },
2185   - function(newValue, oldValue) {
2186   - scope[ctrlAs].$$internal_validate_init();
2187   - }
2188   - );
2189   - scope.$watch(
2190   - function() {
2191   - return scope[ctrlAs].$$data_lp_first_init;
2192   - },
2193   - function(newValue, oldValue) {
2194   - scope[ctrlAs].$$internal_validate_init();
2195   - }
2196   - );
2197   - scope.$watch(
2198   - function() {
2199   - return scope[ctrlAs].$$data_lpid_first_init;
2200   - },
2201   - function(newValue, oldValue) {
2202   - scope[ctrlAs].$$internal_validate_init();
2203   - }
2204   - );
2205   - scope.$watch(
2206   - function() {
2207   - return scope[ctrlAs].$$data_lpstart_first_init;
2208   - },
2209   - function(newValue, oldValue) {
2210   - scope[ctrlAs].$$internal_validate_init();
2211   - }
2212   - );
2213   -
2214   -
2215   - // 监控线路id的变化
2216   - attr.$observe("xlidvalue", function(value) {
2217   - if (value && value != "") {
2218   - console.log("xlidvalue=" + value);
2219   -
2220   - guideboardManageService_g.rest.list(
2221   - {"xl.id_eq": value, size: 100},
2222   - function(result) {
2223   - // 获取值了
2224   - console.log("路牌获取了");
2225   -
2226   - scope[ctrlAs].$$data = [];
2227   - for (var i = 0; i < result.content.length; i++) {
2228   - scope[ctrlAs].$$data.push({
2229   - lpid: result.content[i].id,
2230   - lpname: result.content[i].lpName,
2231   - isstart: false
2232   - });
2233   - }
2234   - if (scope[ctrlAs].$$data_init) {
2235   - scope[ctrlAs].$$dataSelected = [];
2236   - scope[ctrlAs].$$dataSelectedStart = undefined;
2237   - scope[ctrlAs].$$internalmodel = undefined;
2238   - }
2239   - scope[ctrlAs].$$data_xl_first_init = true;
2240   - },
2241   - function(result) {
2242   -
2243   - }
2244   - );
2245   -
2246   - }
2247   - });
2248   -
2249   - // 监控路牌名称范围值的变化
2250   - attr.$observe("lprangevalue", function(value) {
2251   - if (value && value != "") {
2252   - var data_temp = scope[ctrlAs].$$dataSelected;
2253   - var lpnames = value.split(",");
2254   - var i = 0;
2255   - if (data_temp && data_temp.length == 0) { // 初始创建
2256   - console.log("lprangevalue变换了");
2257   - for (i = 0; i < lpnames.length; i++) {
2258   - scope[ctrlAs].$$dataSelected.push({
2259   - lpname: lpnames[i],
2260   - isstart: false
2261   - });
2262   - }
2263   - } else {
2264   - for (i = 0; i < lpnames.length; i++) {
2265   - data_temp[i].lpname = lpnames[i];
2266   - }
2267   - }
2268   - scope[ctrlAs].$$data_lp_first_init = true;
2269   - }
2270   - });
2271   -
2272   - // 监控路牌id范围值的变化
2273   - attr.$observe("lpidrangevalue", function(value) {
2274   - if (value && value != "") {
2275   - console.log("lpidrangevalue=" + value);
2276   - var data_temp = scope[ctrlAs].$$dataSelected;
2277   - var lpids = value.split(",");
2278   - var i = 0;
2279   - if (data_temp && data_temp.length == 0) { // 初始创建
2280   - console.log("lpidrangevalue");
2281   - for (i = 0; i < lpids.length; i++) {
2282   - scope[ctrlAs].$$dataSelected.push({
2283   - lpid: lpids[i],
2284   - isstart: false
2285   - });
2286   - }
2287   - } else {
2288   - for (i = 0; i < lpids.length; i++) {
2289   - data_temp[i].lpid = lpids[i];
2290   - }
2291   - }
2292   - scope[ctrlAs].$$data_lpid_first_init = true;
2293   - }
2294   - });
2295   -
2296   - // 监控起始路牌的变化
2297   - attr.$observe("lpstartvalue", function(value) {
2298   - if (value && value != "") {
2299   - scope[ctrlAs].$$dataSelectedStart = value - 1;
2300   - scope[ctrlAs].$$data_lpstart_first_init = true;
2301   - }
2302   - });
2303   -
2304   -
2305   -
2306   - }
2307   - }
2308   -
2309   - }
2310   - }
2311   - }
2312   -]);
2313   -
2314   -
2315   -
2316   -
2317   -/**
2318   - * saEmployeegroup指令
2319   - * 属性如下:
2320   - * name(必须):控件的名字
2321   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
2322   - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
2323   - * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
2324   - * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange
2325   - * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
2326   - * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange
2327   - * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
2328   - * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart
2329   - *
2330   - * required(可选):是否要用required验证
2331   - *
2332   - */
2333   -angular.module('ScheduleApp').directive('saEmployeegroup', [
2334   - 'EmployeeConfigService_g',
2335   - function(employeeConfigService_g) {
2336   - return {
2337   - restrict: 'E',
2338   - templateUrl: '/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroupTemplate.html',
2339   - scope: {
2340   - model: "=" // 独立作用域,关联外部的模型object
2341   - },
2342   - controllerAs: '$saEmployeegroupCtrl',
2343   - bindToController: true,
2344   - controller: function($scope) {
2345   - var self = this;
2346   - self.$$data = []; // 选择线路后,该线路的人员配置数据
2347   -
2348   - // 测试数据
2349   - //self.$$data = [
2350   - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},
2351   - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},
2352   - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}
2353   - //];
2354   -
2355   - self.$$dataSelected = []; // 选中的人员配置列表
2356   - self.$$dataSelectedStart = undefined; // 起始人员配置
2357   -
2358   - //self.$$dataSelected = [
2359   - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},
2360   - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},
2361   - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}
2362   - //];
2363   -
2364   - self.$$isFB = false; // 是否分班
2365   - self.$$dataFBSelected = []; // 选中的分班人员组配置列表
2366   - self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识
2367   - self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合
2368   -
2369   - //self.$$dataFBSelected = [
2370   - // {isstart: true, group: [
2371   - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
2372   - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
2373   - // ]},
2374   - // {isstart: false, group: [
2375   - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
2376   - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
2377   - // ]}
2378   - //];
2379   -
2380   - // saGuideboardgroup组件的ng-model,用于外部绑定等操作
2381   - self.$$internalmodel = undefined;
2382   -
2383   - self.$$data_init = false; // *数据源初始化标志
2384   - self.$$data_xl_first_init = false; // 线路是否初始化
2385   - self.$$data_ry_first_init = false; // 人员配置是否初始化
2386   - self.$$data_ry_first_data = undefined; // 人员配置初始化数据
2387   - self.$$data_rycid_first_init = false; // 人员配置id是否初始化
2388   - self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据
2389   - self.$$data_rystart_first_init = false; // 起始人员是否初始化
2390   - self.$$data_rystart_first_data = undefined; // 起始人员初始化数据
2391   -
2392   - },
2393   -
2394   - /**
2395   - * 此阶段可以改dom结构,此时angular还没扫描指令,
2396   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
2397   - * @param tElem
2398   - * @param tAttrs
2399   - * @returns {{pre: Function, post: Function}}
2400   - */
2401   - compile: function(tElem, tAttrs) {
2402   - // TODO:获取所有的属性
2403   - var $name_attr = tAttrs["name"]; // 控件的名字
2404   - var $required_attr = tAttrs["required"]; // 是否需要required验证
2405   - var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名
2406   - var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名
2407   - var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名
2408   -
2409   - // controlAs名字
2410   - var ctrlAs = '$saEmployeegroupCtrl';
2411   -
2412   - // 如果有required属性,添加angularjs required验证
2413   - if ($required_attr != undefined) {
2414   - //console.log(tElem.html());
2415   - tElem.find("div").attr("required", "");
2416   - }
2417   -
2418   - return {
2419   - pre: function(scope, element, attr) {
2420   - // TODO:
2421   - },
2422   -
2423   - /**
2424   - * 相当于link函数。
2425   - * @param scope
2426   - * @param element
2427   - * @param attr
2428   - */
2429   - post: function(scope, element, attr) {
2430   - // name属性
2431   - if ($name_attr) {
2432   - scope[ctrlAs]["$name_attr"] = $name_attr;
2433   - }
2434   -
2435   - /**
2436   - * 人员配置列表点击(人员配置列表中选中路牌)
2437   - * @param $index
2438   - */
2439   - scope[ctrlAs].$$internal_rylist_click = function($index) {
2440   - var data_temp = scope[ctrlAs].$$data;
2441   - if (data_temp && data_temp.length > $index) {
2442   - if (!scope[ctrlAs].$$isFB) { // 不分班
2443   - scope[ctrlAs].$$dataSelected.push({
2444   - id : data_temp[$index].id,
2445   - dbbm: data_temp[$index].dbbm,
2446   - jsy: data_temp[$index].jsy,
2447   - spy: data_temp[$index].spy,
2448   - isstart: false
2449   - });
2450   -
2451   - // 如果没有指定过初始人员,默认选择此人员作为起始人员
2452   - if (scope[ctrlAs].$$dataSelectedStart == undefined) {
2453   - scope[ctrlAs].$$internal_selrylist_click(
2454   - scope[ctrlAs].$$dataSelected.length - 1);
2455   - }
2456   - } else { // 分班
2457   - if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员
2458   - scope[ctrlAs].$$dataFBSelected
2459   - [scope[ctrlAs].$$dataFBInternalSelected.gindex].group
2460   - [scope[ctrlAs].$$dataFBInternalSelected.index] = {
2461   - id : data_temp[$index].id,
2462   - dbbm: data_temp[$index].dbbm,
2463   - jsy: data_temp[$index].jsy,
2464   - spy: data_temp[$index].spy,
2465   - isselected: true
2466   - };
2467   -
2468   - } else {
2469   - scope[ctrlAs].$$dataFBSelected.push({
2470   - isstart: false,
2471   - group: [].concat(
2472   - {
2473   - id : data_temp[$index].id,
2474   - dbbm: data_temp[$index].dbbm,
2475   - jsy: data_temp[$index].jsy,
2476   - spy: data_temp[$index].spy,
2477   - isselected: false
2478   - }, {
2479   - id : data_temp[$index].id,
2480   - dbbm: data_temp[$index].dbbm,
2481   - jsy: data_temp[$index].jsy,
2482   - spy: data_temp[$index].spy,
2483   - isselected: false
2484   - }
2485   - )
2486   - });
2487   - if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {
2488   - scope[ctrlAs].$$internal_selrygrouplist_click(
2489   - scope[ctrlAs].$$dataFBSelected.length - 1);
2490   - }
2491   - }
2492   - }
2493   -
2494   - }
2495   - };
2496   -
2497   - /**
2498   - * 选中的人员单击(初始人员选择)
2499   - * @param $index
2500   - */
2501   - scope[ctrlAs].$$internal_selrylist_click = function($index) {
2502   - var data_temp = scope[ctrlAs].$$dataSelected;
2503   - if (data_temp && data_temp.length > $index) {
2504   - for (var i = 0; i < data_temp.length; i++) {
2505   - data_temp[i].isstart = false;
2506   - }
2507   - data_temp[$index].isstart = true;
2508   - scope[ctrlAs].$$dataSelectedStart = $index;
2509   - }
2510   - };
2511   - /**
2512   - * 选中的人员双击(删除选中的人员)
2513   - * @param $index
2514   - */
2515   - scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {
2516   - var data_temp = scope[ctrlAs].$$dataSelected;
2517   - if (data_temp && data_temp.length > $index) {
2518   - if (scope[ctrlAs].$$dataSelectedStart == $index) {
2519   - scope[ctrlAs].$$dataSelectedStart = undefined;
2520   - }
2521   - data_temp.splice($index, 1);
2522   - }
2523   - };
2524   -
2525   - /**
2526   - * 选中的分班组人员单击(初始人员选择)
2527   - * @param $index
2528   - */
2529   - scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {
2530   - var data_temp = scope[ctrlAs].$$dataFBSelected;
2531   - if (data_temp && data_temp.length > $index) {
2532   - for (var i = 0; i < data_temp.length; i++) {
2533   - data_temp[i].isstart = false;
2534   - for (var j = 0; j < data_temp[i].group.length; j++) {
2535   - data_temp[i].group[j].isselected = false;
2536   - }
2537   - }
2538   - data_temp[$index].isstart = true;
2539   - scope[ctrlAs].$$dataFBSelectedStart = $index;
2540   - scope[ctrlAs].$$dataFBInternalSelected = undefined;
2541   - }
2542   - };
2543   - /**
2544   - * 分组内部单击(选中分班中的某组人员)
2545   - * @param $groupindex 组index
2546   - * @param $index 组内部某个index
2547   - * @param $event 事件防止冒泡
2548   - */
2549   - scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {
2550   - var data_temp = scope[ctrlAs].$$dataFBSelected;
2551   - if (data_temp && data_temp.length > $groupindex) {
2552   - if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {
2553   - // $$dataFBInternalSelected的格式如下:
2554   - //{gindex: 1, index: 0}
2555   - for (var i = 0; i < data_temp.length; i++) {
2556   - data_temp[i].isstart = false;
2557   - for (var j = 0; j < data_temp[i].group.length; j++) {
2558   - data_temp[i].group[j].isselected = false;
2559   - }
2560   - }
2561   - data_temp[$groupindex].group[$index].isselected = true;
2562   - scope[ctrlAs].$$dataFBInternalSelected = {
2563   - gindex: $groupindex, index: $index
2564   - };
2565   - scope[ctrlAs].$$dataFBSelectedStart = undefined;
2566   - $event.stopPropagation();
2567   - }
2568   - }
2569   -
2570   - };
2571   - /**
2572   - * 选中的分班人员双击(删除选中的人员)
2573   - * @param $index
2574   - */
2575   - scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {
2576   - var data_temp = scope[ctrlAs].$$dataFBSelected;
2577   - if (data_temp && data_temp.length > $index) {
2578   - if (scope[ctrlAs].$$dataFBSelectedStart == $index) {
2579   - scope[ctrlAs].$$dataFBSelectedStart = undefined;
2580   - }
2581   - if (scope[ctrlAs].$$dataFBInternalSelected &&
2582   - scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {
2583   - scope[ctrlAs].$$dataFBInternalSelected = undefined;
2584   - }
2585   - data_temp.splice($index, 1);
2586   - }
2587   - };
2588   -
2589   - /**
2590   - * 验证内部数据,更新外部model
2591   - */
2592   - scope[ctrlAs].$$internal_validate_model = function() {
2593   - var data_temp = scope[ctrlAs].$$dataSelected;
2594   - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
2595   - var data_temp3 = scope[ctrlAs].$$dataFBSelected;
2596   - var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;
2597   - var ryDbbms = [];
2598   - var ryDbbm_group = [];
2599   - var ryCids = [];
2600   - var ryCid_group = [];
2601   - var ryStart = 0;
2602   - var i = 0;
2603   - var j = 0;
2604   -
2605   - var isFB = scope[ctrlAs].$$isFB;
2606   -
2607   - if (isFB) {
2608   - if (data_temp3 &&
2609   - data_temp3.length > 0 &&
2610   - data_temp4 != undefined) {
2611   -
2612   - for (i = 0; i < data_temp3.length; i++) {
2613   - for (j = 0; j < data_temp3[i].group.length; j++) {
2614   - ryDbbm_group.push(data_temp3[i].group[j].dbbm);
2615   - ryCid_group.push(data_temp3[i].group[j].id);
2616   - }
2617   - ryDbbms.push(ryDbbm_group.join("-"));
2618   - ryCids.push(ryCid_group.join("-"));
2619   - ryDbbm_group = [];
2620   - ryCid_group = [];
2621   - }
2622   -
2623   - data_temp3[data_temp4].isstart = true;
2624   - ryStart = data_temp4 + 1;
2625   -
2626   - // 更新内部model,用于外部验证
2627   - // 内部model的值暂时随意,以后再改
2628   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
2629   -
2630   - // 更新外部model字段
2631   - if ($dbbmrangename_attr) {
2632   - console.log("dbbmrangename=" + ryDbbms.join(','));
2633   - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
2634   - }
2635   - if (rycidrangename_attr) {
2636   - console.log("rycidrangename=" + ryCids.join(','));
2637   - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
2638   - }
2639   - if ($rystartname_attr) {
2640   - console.log("rystartname=" + ryStart);
2641   - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
2642   - }
2643   -
2644   - } else {
2645   - scope[ctrlAs].$$internalmodel = undefined;
2646   - }
2647   -
2648   - } else {
2649   - if (data_temp &&
2650   - data_temp.length > 0 &&
2651   - data_temp2 != undefined) {
2652   -
2653   - for (i = 0; i < data_temp.length; i++) {
2654   - ryDbbms.push(data_temp[i].dbbm);
2655   - ryCids.push(data_temp[i].id);
2656   - }
2657   - data_temp[data_temp2].isstart = true;
2658   - ryStart = data_temp2 + 1;
2659   -
2660   - // 更新内部model,用于外部验证
2661   - // 内部model的值暂时随意,以后再改
2662   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
2663   -
2664   - // 更新外部model字段
2665   - if ($dbbmrangename_attr) {
2666   - console.log("dbbmrangename=" + ryDbbms.join(','));
2667   - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
2668   - }
2669   - if (rycidrangename_attr) {
2670   - console.log("rycidrangename=" + ryCids.join(','));
2671   - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
2672   - }
2673   - if ($rystartname_attr) {
2674   - console.log("rystartname=" + ryStart);
2675   - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
2676   - }
2677   -
2678   - } else {
2679   - scope[ctrlAs].$$internalmodel = undefined;
2680   - }
2681   - }
2682   -
2683   - };
2684   -
2685   - // 监控内部数据,$$dataSelected 变化
2686   - scope.$watch(
2687   - function() {
2688   - return scope[ctrlAs].$$dataSelected;
2689   - },
2690   - function(newValue, oldValue) {
2691   - scope[ctrlAs].$$internal_validate_model();
2692   - },
2693   - true
2694   - );
2695   -
2696   - // 监控内部数据,$$dataSelectedStart 变化
2697   - scope.$watch(
2698   - function() {
2699   - return scope[ctrlAs].$$dataSelectedStart;
2700   - },
2701   - function(newValue, oldValue) {
2702   - scope[ctrlAs].$$internal_validate_model();
2703   - },
2704   - true
2705   - );
2706   -
2707   -
2708   - // 监控内部数据,$$dataFBSelected 变化
2709   - scope.$watch(
2710   - function() {
2711   - return scope[ctrlAs].$$dataFBSelected;
2712   - },
2713   - function(newValue, oldValue) {
2714   - scope[ctrlAs].$$internal_validate_model();
2715   - },
2716   - true
2717   - );
2718   -
2719   - // 监控内部数据,$$dataFBSelectedStart 变化
2720   - scope.$watch(
2721   - function() {
2722   - return scope[ctrlAs].$$dataFBSelectedStart;
2723   - },
2724   - function(newValue, oldValue) {
2725   - scope[ctrlAs].$$internal_validate_model();
2726   - },
2727   - true
2728   - );
2729   -
2730   - // 监控内部数据,$$dataFBInternalSelected 变化
2731   - scope.$watch(
2732   - function() {
2733   - return scope[ctrlAs].$$dataFBInternalSelected;
2734   - },
2735   - function(newValue, oldValue) {
2736   - scope[ctrlAs].$$internal_validate_model();
2737   - },
2738   - true
2739   - );
2740   -
2741   - // 监控内部数据,$$isFB 变化
2742   - scope.$watch(
2743   - function() {
2744   - return scope[ctrlAs].$$isFB;
2745   - },
2746   - function(newValue, oldValue) {
2747   - scope[ctrlAs].$$internal_validate_model();
2748   - },
2749   - true
2750   - );
2751   -
2752   - /**
2753   - * 验证数据是否初始化完成,
2754   - * 所谓的初始化就是内部所有的数据被有效设定过一次。
2755   - */
2756   - scope[ctrlAs].$$internal_validate_init = function() {
2757   - var self = scope[ctrlAs];
2758   - var data_temp = self.$$data;
2759   - var dataSelect_temp = self.$$dataSelected;
2760   - var dataFBSelect_temp = self.$$dataFBSelected;
2761   - var dbbmnames = null;
2762   - var dbbmnamegroup = null;
2763   - var rycids = null;
2764   - var rycidgroup = null;
2765   -
2766   - var i = 0;
2767   - var j = 0;
2768   - var k = 0;
2769   -
2770   - if (self.$$data_xl_first_init &&
2771   - self.$$data_ry_first_init &&
2772   - self.$$data_rycid_first_init &&
2773   - self.$$data_rystart_first_init && !self.$$data_init) {
2774   - console.log("开始初始化数据");
2775   -
2776   - // 判定是否分班,字符串中包含-就是了
2777   - if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班
2778   - self.$$isFB = true;
2779   -
2780   - // 搭班编码、人员配置id
2781   - dbbmnames = self.$$data_ry_first_data.split(",");
2782   - rycids = self.$$data_rycid_first_data.split(",");
2783   - for (i = 0; i < dbbmnames.length; i++) {
2784   - dataFBSelect_temp.push({
2785   - group: [],
2786   - isstart: false
2787   - });
2788   - dbbmnamegroup = dbbmnames[i].split("-");
2789   - rycidgroup = rycids[i].split("-");
2790   -
2791   - for (k = 0; k < dbbmnamegroup.length; k++) {
2792   - dataFBSelect_temp[i].group.push({
2793   - id: rycidgroup[k],
2794   - dbbm: dbbmnamegroup[k],
2795   - isselected: false
2796   - });
2797   -
2798   - for (j = 0; j < data_temp.length; j++) {
2799   - if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {
2800   - dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;
2801   - dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;
2802   - break;
2803   - }
2804   - }
2805   - }
2806   -
2807   - }
2808   -
2809   - // 初始人员
2810   - scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;
2811   -
2812   -
2813   - } else if (dataSelect_temp.length == 0) {
2814   - self.$$isFB = false;
2815   -
2816   - // 搭班编码、人员配置id
2817   - dbbmnames = self.$$data_ry_first_data.split(",");
2818   - rycids = self.$$data_rycid_first_data.split(",");
2819   - for (i = 0; i < dbbmnames.length; i++) {
2820   - dataSelect_temp.push({
2821   - id: rycids[i],
2822   - dbbm: dbbmnames[i],
2823   - isstart: false
2824   - });
2825   - for (j = 0; j < data_temp.length; j++) {
2826   - if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {
2827   - dataSelect_temp[i].jsy = data_temp[j].jsy;
2828   - dataSelect_temp[i].spy = data_temp[j].spy;
2829   - break;
2830   - }
2831   - }
2832   - }
2833   - // 初始人员
2834   - scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1;
2835   -
2836   - }
2837   -
2838   - console.log("数据初始化完毕!");
2839   - self.$$data_init = true;
2840   - }
2841   -
2842   - };
2843   -
2844   - // 监控初始化标志,线路,人员,起始人员
2845   - scope.$watch(
2846   - function() {
2847   - return scope[ctrlAs].$$data_xl_first_init;
2848   - },
2849   - function(newValue, oldValue) {
2850   - scope[ctrlAs].$$internal_validate_init();
2851   - }
2852   - );
2853   - scope.$watch(
2854   - function() {
2855   - return scope[ctrlAs].$$data_ry_first_init;
2856   - },
2857   - function(newValue, oldValue) {
2858   - scope[ctrlAs].$$internal_validate_init();
2859   - }
2860   - );
2861   - scope.$watch(
2862   - function() {
2863   - return scope[ctrlAs].$$data_rycid_first_init;
2864   - },
2865   - function(newValue, oldValue) {
2866   - scope[ctrlAs].$$internal_validate_init();
2867   - }
2868   - );
2869   - scope.$watch(
2870   - function() {
2871   - return scope[ctrlAs].$$data_rystart_first_init;
2872   - },
2873   - function(newValue, oldValue) {
2874   - scope[ctrlAs].$$internal_validate_init();
2875   - }
2876   - );
2877   -
2878   -
2879   - // 监控线路id的变化
2880   - attr.$observe("xlidvalue", function(value) {
2881   - if (value && value != "") {
2882   - console.log("xlidvalue=" + value);
2883   -
2884   - employeeConfigService_g.rest.list(
2885   - {"xl.id_eq": value, "isCancel_eq" : false, size: 100},
2886   - function(result) {
2887   - // 获取值了
2888   - console.log("人员配置获取了");
2889   -
2890   - scope[ctrlAs].$$data = [];
2891   - for (var i = 0; i < result.content.length; i++) {
2892   - scope[ctrlAs].$$data.push({
2893   - id: result.content[i].id,
2894   - dbbm: result.content[i].dbbm,
2895   - jsy: result.content[i].jsy.personnelName,
2896   - spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName
2897   - });
2898   - }
2899   - if (scope[ctrlAs].$$data_init) {
2900   - scope[ctrlAs].$$dataSelected = [];
2901   - scope[ctrlAs].$$dataSelectedStart = undefined;
2902   -
2903   - scope[ctrlAs].$$dataFBSelected = [];
2904   - scope[ctrlAs].$$dataFBInternalSelected = undefined;
2905   - scope[ctrlAs].$$dataFBSelectedStart = undefined;
2906   -
2907   - scope[ctrlAs].$$internalmodel = undefined;
2908   - }
2909   - scope[ctrlAs].$$data_xl_first_init = true;
2910   - },
2911   - function(result) {
2912   -
2913   - }
2914   - );
2915   -
2916   - }
2917   - });
2918   -
2919   - // 监控搭班编码范围值的变化
2920   - attr.$observe("dbbmrangevalue", function(value) {
2921   - if (value && value != "") {
2922   - console.log("dbbmrangevalue变换了");
2923   - scope[ctrlAs].$$data_ry_first_init = true;
2924   - scope[ctrlAs].$$data_ry_first_data = value;
2925   - }
2926   - });
2927   -
2928   - // 监控人员配置id范围值的变化
2929   - attr.$observe("rycidrangevalue", function(value) {
2930   - if (value && value != "") {
2931   - console.log("rycidrangevalue变换了");
2932   - scope[ctrlAs].$$data_rycid_first_init = true;
2933   - scope[ctrlAs].$$data_rycid_first_data = value;
2934   - }
2935   - });
2936   -
2937   - // 监控起始人员的变化
2938   - attr.$observe("rystartvalue", function(value) {
2939   - if (value && value != "") {
2940   - console.log("rystartvalue变换了");
2941   - scope[ctrlAs].$$data_rystart_first_init = true;
2942   - scope[ctrlAs].$$data_rystart_first_data = value;
2943   - }
2944   - });
2945   -
2946   - }
2947   - }
2948   -
2949   - }
2950   - }
2951   - }
2952   -]);
2953   -
2954   -
2955   -/**
2956   - * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
2957   - * 属性如下:
2958   - * name(必须):控件的名字
2959   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
2960   - * bcttinfoidsvalue(必须):绑定的model班次ids字段值,如:bcttinfoidsvalue={{ctrl.employeeInfoForSave.lprange}}
2961   - * bcttinfoidsname(必须):bind的model班次ids字段名,如:bcttinfoidsname=lprange
2962   - * dataparams (必须):内部数据关联的查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
2963   - * required(可选):是否要用required验证
2964   - *
2965   - */
2966   -angular.module('ScheduleApp').directive('saBcgroup', [
2967   - 'TimeTableDetailManageService_g',
2968   - function(timeTableDetailManageService_g) {
2969   - return {
2970   - restrict: 'E',
2971   - templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroupTemplate.html',
2972   - scope: {
2973   - model: "=" // 独立作用域,关联外部的模型object
2974   - },
2975   - controllerAs: '$saBcgroupCtrl',
2976   - bindToController: true,
2977   - controller: function($scope) {
2978   - var self = this;
2979   - self.$$data = []; // 选择线路,时刻表,路牌后的班次列表
2980   -
2981   - // 测试数据
2982   - //self.$$data = [
2983   - // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
2984   - // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
2985   - // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
2986   - //];
2987   -
2988   -
2989   - self.$$dataSelected = []; // 套跑选中的班次列表
2990   -
2991   - //self.$$dataSelected = [
2992   - // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
2993   - // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
2994   - // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
2995   - //];
2996   -
2997   - // saBcgroup组件的ng-model,用于外部绑定等操作
2998   - self.$$internalmodel = undefined;
2999   -
3000   - self.$$data_bcdata_first_init = false; // 班次数据首次初始化标志
3001   - self.$$data_bcttinfoids_first_init = false; // 班次ids数据首次初始化标志
3002   - self.$$data_bcttinfoids_first_data = undefined; // 班次ids数据首次初始化数据
3003   -
3004   - },
3005   -
3006   - /**
3007   - * 此阶段可以改dom结构,此时angular还没扫描指令,
3008   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
3009   - * @param tElem
3010   - * @param tAttrs
3011   - * @returns {{pre: Function, post: Function}}
3012   - */
3013   - compile: function(tElem, tAttrs) {
3014   - // TODO:获取所有的属性
3015   - var $name_attr = tAttrs["name"]; // 控件的名字
3016   - var $required_attr = tAttrs["required"]; // 是否需要required验证
3017   - var $bcttinfoidsname_attr = tAttrs["bcttinfoidsname"]; // bind的model班次ids字段名
3018   -
3019   - // controlAs名字
3020   - var ctrlAs = '$saBcgroupCtrl';
3021   -
3022   - // 如果有required属性,添加angularjs required验证
3023   - if ($required_attr != undefined) {
3024   - //console.log(tElem.html());
3025   - tElem.find("div").attr("required", "");
3026   - }
3027   -
3028   - return {
3029   - pre: function(scope, element, attr) {
3030   - // TODO:
3031   - },
3032   -
3033   - /**
3034   - * 相当于link函数。
3035   - * @param scope
3036   - * @param element
3037   - * @param attr
3038   - */
3039   - post: function(scope, element, attr) {
3040   - // name属性
3041   - if ($name_attr) {
3042   - scope[ctrlAs]["$name_attr"] = $name_attr;
3043   - }
3044   -
3045   - // TODO:
3046   -
3047   -
3048   - /**
3049   - * 班次列表点击(班次列表中选中班次)
3050   - * @param $index
3051   - */
3052   - scope[ctrlAs].$$internal_bclist_click = function($index) {
3053   - var data_temp = scope[ctrlAs].$$data;
3054   - var data_temp2 = scope[ctrlAs].$$dataSelected;
3055   - var i = 0;
3056   - var isunique = true; // 是否已经选择过
3057   - if (data_temp && data_temp.length > $index) {
3058   - for (i = 0; i < data_temp2.length; i++) {
3059   - if (data_temp2[i].bcttinfoid == data_temp[$index].bcttinfoid) {
3060   - isunique = false;
3061   - break;
3062   - }
3063   - }
3064   - if (isunique) {
3065   - data_temp2.push({
3066   - bcttinfoid: data_temp[$index].bcttinfoid,
3067   - bcfcsj: data_temp[$index].bcfcsj,
3068   - bctype: data_temp[$index].bctype
3069   - });
3070   - }
3071   -
3072   - }
3073   - };
3074   - /**
3075   - * 选中的班次双击(删除选中的班次)
3076   - * @param $index
3077   - */
3078   - scope[ctrlAs].$$internal_selbclist_dbclick = function($index) {
3079   - var data_temp = scope[ctrlAs].$$dataSelected;
3080   - if (data_temp && data_temp.length > $index) {
3081   - data_temp.splice($index, 1);
3082   - }
3083   - };
3084   -
3085   -
3086   - /**
3087   - * 验证内部数据,更新外部model
3088   - */
3089   - scope[ctrlAs].$$internal_validate_model = function() {
3090   - var data_temp = scope[ctrlAs].$$dataSelected;
3091   - var bcttinfoIds = [];
3092   - var i = 0;
3093   -
3094   - if (data_temp &&
3095   - data_temp.length > 0) {
3096   -
3097   - for (i = 0; i < data_temp.length; i++) {
3098   - bcttinfoIds.push(data_temp[i].bcttinfoid);
3099   - }
3100   -
3101   - // 更新外部model字段
3102   - if ($bcttinfoidsname_attr) {
3103   - console.log("bcttinfoidsname=" + bcttinfoIds.join(','));
3104   - eval("scope[ctrlAs].model" + "." + $bcttinfoidsname_attr + " = bcttinfoIds.join(',');");
3105   - }
3106   -
3107   - // 更新内部model,用于外部验证
3108   - // 内部model的值暂时随意,以后再改
3109   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
3110   -
3111   - scope[ctrlAs].$$data_bcdata_first_init = true;
3112   - scope[ctrlAs].$$data_bcttinfoids_first_init = true;
3113   -
3114   - } else {
3115   - scope[ctrlAs].$$internalmodel = undefined;
3116   - }
3117   -
3118   - };
3119   -
3120   - // 监控内部数据,$$data_selected 变化
3121   - scope.$watch(
3122   - function() {
3123   - console.log("长度:" + scope[ctrlAs].$$dataSelected.length);
3124   - return scope[ctrlAs].$$dataSelected;
3125   - },
3126   - function(newValue, oldValue) {
3127   - scope[ctrlAs].$$internal_validate_model();
3128   - },
3129   - true
3130   - );
3131   -
3132   - /**
3133   - * 验证数据是否初始化完成,
3134   - * 所谓的初始化就是内部所有的数据被有效设定过一次。
3135   - */
3136   - scope[ctrlAs].$$internal_validate_init = function() {
3137   - var self = scope[ctrlAs];
3138   -
3139   - var data_temp = self.$$data;
3140   - var dataSelect_temp = self.$$dataSelected;
3141   - var bcttinfoids = null;
3142   -
3143   - var i = 0;
3144   - var j = 0;
3145   -
3146   - if (self.$$data_bcdata_first_init &&
3147   - self.$$data_bcttinfoids_first_init) {
3148   - console.log("开始初始化数据");
3149   -
3150   - bcttinfoids = self.$$data_bcttinfoids_first_data ? self.$$data_bcttinfoids_first_data.split(",") : [];
3151   -
3152   - for (i = 0; i < bcttinfoids.length; i++) {
3153   - dataSelect_temp.push({
3154   - bcttinfoid: bcttinfoids[i]
3155   - });
3156   - for (j = 0; j < data_temp.length; j++) {
3157   - if (dataSelect_temp[i].bcttinfoid == data_temp[j].bcttinfoid) {
3158   - dataSelect_temp[i].bcfcsj = data_temp[j].bcfcsj;
3159   - dataSelect_temp[i].bctype = data_temp[j].bctype;
3160   - break;
3161   - }
3162   - }
3163   - }
3164   -
3165   - console.log("数据初始化完毕!");
3166   - }
3167   -
3168   - };
3169   -
3170   - // 监控初始化标志
3171   - scope.$watch(
3172   - function() {
3173   - return scope[ctrlAs].$$data_bcdata_first_init;
3174   - },
3175   - function(newValue, oldValue) {
3176   - scope[ctrlAs].$$internal_validate_init();
3177   - }
3178   - );
3179   - scope.$watch(
3180   - function() {
3181   - return scope[ctrlAs].$$data_bcttinfoids_first_init;
3182   - },
3183   - function(newValue, oldValue) {
3184   - scope[ctrlAs].$$internal_validate_init();
3185   - }
3186   - );
3187   -
3188   - // 监控内部数据的变化
3189   - attr.$observe("dataparams", function(value) {
3190   - if (value && value != "") {
3191   - if (value == '{}') {
3192   - return;
3193   - }
3194   -
3195   - console.log("bcgroup observe 监控 dataparams=" + value);
3196   -
3197   - timeTableDetailManageService_g.bcdetails.list(
3198   - JSON.parse(value),
3199   - function(result) {
3200   - // 获取值了
3201   - console.log("内部班次数据获取了");
3202   -
3203   - scope[ctrlAs].$$data = [];
3204   - for (var i = 0; i < result.length; i++) {
3205   - scope[ctrlAs].$$data.push({
3206   - bcttinfoid: result[i].id,
3207   - bcfcsj: result[i].fcsj,
3208   - bctype: result[i].bcType
3209   - });
3210   - }
3211   - if (scope[ctrlAs].$$data_bcdata_first_init &&
3212   - scope[ctrlAs].$$data_bcttinfoids_first_init) {
3213   -
3214   - scope[ctrlAs].$$dataSelected = [];
3215   - scope[ctrlAs].$$internalmodel = undefined;
3216   - }
3217   - scope[ctrlAs].$$data_bcdata_first_init = true;
3218   - },
3219   - function(result) {
3220   -
3221   - }
3222   - );
3223   - }
3224   - });
3225   - // 监控班次ids数据的变化
3226   - attr.$observe("bcttinfoidsvalue", function(value) {
3227   - if (value && value != "") {
3228   - console.log("observe 监控 bcttinfoidsvalue=" + value);
3229   - scope[ctrlAs].$$data_bcttinfoids_first_init = true;
3230   - scope[ctrlAs].$$data_bcttinfoids_first_data = value;
3231   - }
3232   - });
3233   -
3234   - }
3235   - }
3236   -
3237   - }
3238   - }
3239   - }
  1 +//自定义指令
  2 +/**
  3 + * loading载入中指令。
  4 + */
  5 +angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) {
  6 + return {
  7 + restrict: 'A',
  8 + link: function(scope, element) {
  9 + // 初始隐藏loading界面
  10 + element.hide();
  11 +
  12 + // 开始请求通知处理
  13 + requestNotificationChannel.onRequestStarted(scope, function() {
  14 + element.show();
  15 + });
  16 + // 请求结束通知处理
  17 + requestNotificationChannel.onRequestEnded(scope, function() {
  18 + element.hide();
  19 + });
  20 + }
  21 + };
  22 +}]);
  23 +/**
  24 + * remoteValidatio指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel。
  25 + * 属性如下:
  26 + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
  27 + * remotevparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }}
  28 + *
  29 + */
  30 +angular.module('ScheduleApp').directive('remoteValidation', [
  31 + '$$SearchInfoService_g',
  32 + function($$SearchInfoService_g) {
  33 + return {
  34 + restrict: "A", // 属性
  35 + require: "^ngModel", // 依赖所属指令的ngModel
  36 + compile: function(tElem, tAttrs) {
  37 + // 验证属性
  38 + if (!tAttrs["remotevtype"]) { // 验证类型
  39 + throw new Error("remotevtype属性必须填写");
  40 + } else if (!$$SearchInfoService_g.validate[tAttrs["remotevtype"]]) {
  41 + throw new Error(!tAttrs["remotevtype"] + "验证类型不存在");
  42 + }
  43 + if (!tAttrs["remotevparam"]) { // 查询参数
  44 + throw new Error("remotevparam属性必须填写");
  45 + }
  46 +
  47 + // 监听获取的数据
  48 + var $watch_rvtype = undefined;
  49 + var $watch_rvparam_obj = undefined;
  50 +
  51 + // 验证数据
  52 + var $$internal_validate = function(ngModelCtrl) {
  53 + if ($watch_rvtype && $watch_rvparam_obj) {
  54 + // 获取查询参数模版
  55 + var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
  56 + if (!paramTemplate) {
  57 + throw new Error($watch_rvtype + "查询模版不存在");
  58 + }
  59 + // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证
  60 + var isParamAll = true;
  61 + for (var key in paramTemplate) {
  62 + if (!$watch_rvparam_obj[key]) {
  63 + isParamAll = false;
  64 + break;
  65 + }
  66 + }
  67 + if (!isParamAll) {
  68 + ngModelCtrl.$setValidity('remote', true);
  69 + } else { // 开始验证
  70 + $$SearchInfoService_g.validate[$watch_rvtype].remote.do(
  71 + $watch_rvparam_obj,
  72 + function(result) {
  73 + if (result.status == "SUCCESS") {
  74 + ngModelCtrl.$setValidity('remote', true);
  75 + } else {
  76 + ngModelCtrl.$setValidity('remote', false);
  77 + }
  78 + },
  79 + function(result) {
  80 + ngModelCtrl.$setValidity('remote', true);
  81 + }
  82 + );
  83 + }
  84 + }
  85 + };
  86 +
  87 + return {
  88 + pre: function(scope, element, attr) {
  89 +
  90 + },
  91 +
  92 + post: function(scope, element, attr, ngModelCtrl) {
  93 + /**
  94 + * 监控验证类型属性变化。
  95 + */
  96 + attr.$observe("remotevtype", function(value) {
  97 + if (value && value != "") {
  98 + $watch_rvtype = value;
  99 + $$internal_validate(ngModelCtrl);
  100 + }
  101 + });
  102 + /**
  103 + * 监控查询结果属性变化。
  104 + */
  105 + attr.$observe("remotevparam", function(value) {
  106 + if (value && value != "") {
  107 + if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证
  108 + return;
  109 + }
  110 + $watch_rvparam_obj = JSON.parse(value);
  111 + $$internal_validate(ngModelCtrl);
  112 + }
  113 + });
  114 + }
  115 + };
  116 + }
  117 + }
  118 + }
  119 +]);
  120 +
  121 +
  122 +angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
  123 + return {
  124 + restrict: 'E',
  125 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelectTemplate.html',
  126 + scope: {
  127 + model: "="
  128 + },
  129 + controllerAs: "$saSelectCtrl",
  130 + bindToController: true,
  131 + controller: function() {
  132 + var self = this;
  133 + self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}
  134 + },
  135 + /**
  136 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  137 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  138 + * @param tElem
  139 + * @param tAttrs
  140 + * @returns {{pre: Function, post: Function}}
  141 + */
  142 + compile: function(tElem, tAttrs) {
  143 + // 确定是否使用angularjs required验证
  144 + // 属性 required
  145 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  146 + var required_attr = tAttrs["required"];
  147 + if (required_attr) {
  148 + if (required_attr == "true") {
  149 + // 添加required属性指令
  150 + tElem.find("ui-select").attr("required", "");
  151 + } else {
  152 + // 不等于true,不添加required属性指令
  153 + }
  154 + } else {
  155 + // 不添加required属性指令
  156 + }
  157 +
  158 + //console.log("saSelect" + ":compile = >" + tElem.html());
  159 +
  160 + return {
  161 + pre: function(scope, element, attr) {
  162 + // TODO:
  163 + },
  164 + /**
  165 + * 相当于link函数。
  166 + *
  167 + * 重要属性如下:
  168 + * model 是绑定外部值。
  169 + * dicgroup 字典组的类型
  170 + * name input name属性值
  171 + */
  172 + post: function(scope, element, attr) {
  173 + // 1、获取属性
  174 + var dicgroup_attr = attr['dicgroup']; // 字典组的类型
  175 + var name_attr = attr['name']; // input name属性值
  176 + var dicname_attr = attr['dicname']; // model关联的字典名字段
  177 + var codename_attr = attr['codename']; // model关联的字典值字段
  178 + var placeholder_attr = attr['placeholder']; // select placeholder提示
  179 +
  180 + // 系统的字典对象,使用dictionaryUtils类获取
  181 + var origin_dicgroup;
  182 + var dic_key; // 字典key
  183 +
  184 + if (dicgroup_attr) { // 赋值指定的字典数据
  185 + origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);
  186 + for (dic_key in origin_dicgroup) {
  187 + var data = {}; // 重新组合的字典元素对象
  188 + if (dic_key == "true")
  189 + data.code = true;
  190 + else
  191 + data.code = dic_key;
  192 + data.name = origin_dicgroup[dic_key];
  193 + scope["$saSelectCtrl"].datas.push(data);
  194 + }
  195 + }
  196 +
  197 + if (name_attr) {
  198 + scope["$saSelectCtrl"].nv = name_attr;
  199 + }
  200 + if (placeholder_attr) {
  201 + scope["$saSelectCtrl"].ph = placeholder_attr;
  202 + }
  203 +
  204 + scope["$saSelectCtrl"].select = function($item) {
  205 + if (codename_attr) {
  206 + scope["$saSelectCtrl"].model[codename_attr] = $item.code;
  207 + }
  208 + if (dicname_attr) {
  209 + scope["$saSelectCtrl"].model[dicname_attr] = $item.name;
  210 + }
  211 + };
  212 +
  213 + scope["$saSelectCtrl"].remove = function() {
  214 + if (codename_attr) {
  215 + scope["$saSelectCtrl"].model[codename_attr] = null;
  216 + }
  217 + if (dicname_attr) {
  218 + scope["$saSelectCtrl"].model[dicname_attr] = null;
  219 + }
  220 + scope["$saSelectCtrl"].cmodel = null;
  221 + };
  222 +
  223 + $timeout(function() {
  224 + // 创建内部使用的绑定对象
  225 + var model_code = scope["$saSelectCtrl"].model[codename_attr];
  226 + scope["$saSelectCtrl"].cmodel = model_code;
  227 + }, 0);
  228 + }
  229 + }
  230 + }
  231 + };
  232 +}]);
  233 +
  234 +
  235 +
  236 +angular.module('ScheduleApp').directive("saSelect2", [
  237 + '$timeout', '$$SearchInfoService_g',
  238 + function($timeout, $$searchInfoService_g) {
  239 + return {
  240 + restrict: 'E',
  241 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect2Template.html',
  242 + scope: {
  243 + model: "=" // 独立作用域,关联外部的模型对象
  244 + },
  245 + controllerAs: "$saSelectCtrl",
  246 + bindToController: true,
  247 + controller: function($scope) {
  248 + var self = this;
  249 + self.$$data = []; // 内部关联的数据
  250 + },
  251 + /**
  252 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  253 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  254 + * @param tElem
  255 + * @param tAttrs
  256 + * @returns {{pre: Function, post: Function}}
  257 + */
  258 + compile: function(tElem, tAttrs) {
  259 + // 1、获取此阶段使用的属性
  260 + var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。
  261 +
  262 + // 2、处理属性
  263 +
  264 + // 确定是否使用angularjs required验证
  265 + // 属性 required
  266 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  267 + if ($required_attr) {
  268 + if ($required_attr == "true") {
  269 + // 添加required属性指令
  270 + tElem.find("ui-select").attr("required", "");
  271 + } else {
  272 + // 不等于true,不添加required属性指令
  273 + }
  274 + } else {
  275 + // 不添加required属性指令
  276 + }
  277 +
  278 + //console.log("saSelect" + ":compile = >" + tElem.html());
  279 +
  280 + return {
  281 + pre: function(scope, element, attr) {
  282 + // TODO:
  283 + },
  284 + /**
  285 + * 相当于link函数。
  286 + *
  287 + * 重要属性如下:
  288 + * model 是绑定外部值。
  289 + * dicgroup 字典组的类型
  290 + * name input name属性值
  291 + */
  292 + post: function(scope, element, attr) {
  293 + // 1、获取此阶段使用的属性
  294 + var $name_attr = attr["name"]; // 表单验证时需要的名字
  295 + var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  296 + var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)
  297 + var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)
  298 + var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)
  299 + var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)
  300 + var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名
  301 + var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述
  302 +
  303 + // 2、处理属性、转换成$saSelectCtrl内部使用的属性
  304 + if ($name_attr) {
  305 + scope["$saSelectCtrl"].$name_attr = $name_attr;
  306 + }
  307 + if ($placeholder_attr) {
  308 + scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;
  309 + }
  310 + if ($showcolname_attr) {
  311 + scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;
  312 + }
  313 +
  314 + // 2-1、添加内部方法,根据type值,改变$$data的值
  315 + scope["$saSelectCtrl"].$$internal_data_change_fn = function() {
  316 + // 根据type属性动态载入数据
  317 + if ($type_attr) {
  318 + $$searchInfoService_g[$type_attr].list(
  319 + {type: "all"},
  320 + function(result) {
  321 + scope["$saSelectCtrl"].$$data = [];
  322 + for (var i = 0; i < result.length; i ++) {
  323 + var data = {}; // data是result的一部分属性集合,根据配置来确定
  324 + if ($datacolname1_attr) {
  325 + data[$datacolname1_attr] = result[i][$datacolname1_attr];
  326 + }
  327 + if ($datacolname2_attr) {
  328 + data[$datacolname2_attr] = result[i][$datacolname2_attr];
  329 + }
  330 + if ($showcolname_attr) {
  331 + // 动态添加基于名字的拼音
  332 + data[$showcolname_attr] = result[i][$showcolname_attr];
  333 + if (data[$showcolname_attr]) {
  334 + data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼
  335 + data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼
  336 + }
  337 + }
  338 + if (data["fullChars"])
  339 + scope["$saSelectCtrl"].$$data.push(data);
  340 + }
  341 + },
  342 + function(result) {
  343 +
  344 + }
  345 + );
  346 + }
  347 + };
  348 +
  349 + // 3、选择、删除事件映射模型和内部数据对应的字段
  350 + scope["$saSelectCtrl"].$select_fn_attr = function($item) {
  351 + if ($modelcolname1_attr && $datacolname1_attr) {
  352 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];
  353 + }
  354 + if ($modelcolname2_attr && $datacolname2_attr) {
  355 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];
  356 + }
  357 + };
  358 + scope["$saSelectCtrl"].$remove_fn_attr = function() {
  359 + if ($modelcolname1_attr) {
  360 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;
  361 + }
  362 + if ($modelcolname2_attr) {
  363 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;
  364 + }
  365 + scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空
  366 +
  367 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  368 + };
  369 +
  370 + // 4、搜索事件
  371 + scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {
  372 + //var fullChars = pinyin.getFullChars($search).toUpperCase();
  373 + //var camelChars = pinyin.getCamelChars($search);
  374 + //
  375 + //console.log(fullChars + " " + camelChars);
  376 + // TODO:事件暂时没用,放着以后再说
  377 + };
  378 +
  379 + // 5、全部载入后,输入的
  380 + $timeout(function() {
  381 + // 创建内部使用的绑定对象,用于确认选中那个值
  382 + scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];
  383 +
  384 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  385 + }, 0);
  386 + }
  387 + }
  388 + }
  389 + };
  390 + }
  391 +]);
  392 +
  393 +
  394 +
  395 +
  396 +
  397 +/**
  398 + * saSelect3指令
  399 + * 属性如下:
  400 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  401 + * name(必须):控件的名字
  402 + * placeholder(可选):占位符字符串
  403 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  404 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  405 + * icname(必须):内部与之对应的字段名,如:icname=code
  406 + * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
  407 + * icname2(可选):内部与之对应的字段名2,如:icname2=name
  408 + * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
  409 + * icname3(可选):内部与之对应的字段名3,如:icname2=name
  410 + * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
  411 + * required(可选):是否要用required验证
  412 + * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
  413 + * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)
  414 + *
  415 + * 高级属性:
  416 + * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)
  417 + * dataparam(可选):数据源关联的外部参数对象
  418 + *
  419 + */
  420 +angular.module('ScheduleApp').directive("saSelect3", [
  421 + '$timeout',
  422 + '$$SearchInfoService_g',
  423 + function($timeout, $$searchInfoService_g) {
  424 + return {
  425 + restrict: 'E',
  426 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect3Template.html',
  427 + scope: {
  428 + model: "=" // 独立作用域,关联外部的模型object
  429 + },
  430 + controllerAs: "$saSelectCtrl",
  431 + bindToController: true,
  432 + controller: function($scope) {
  433 + var self = this;
  434 + self.$$data = []; // ui-select显示用的数据源
  435 + self.$$data_real= []; // 内部真实的数据源
  436 + },
  437 +
  438 + /**
  439 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  440 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  441 + * @param tElem
  442 + * @param tAttrs
  443 + * @returns {{pre: Function, post: Function}}
  444 + */
  445 + compile: function(tElem, tAttrs) {
  446 + // 获取所有的属性
  447 + var $name_attr = tAttrs["name"]; // 控件的名字
  448 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  449 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  450 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  451 + var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
  452 + var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
  453 + var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
  454 + var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
  455 +
  456 + var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
  457 + var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
  458 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  459 + var $mlp_attr = tAttrs["mlp"]; // 是否多级属性
  460 + var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性
  461 +
  462 + // controlAs名字
  463 + var ctrlAs = "$saSelectCtrl";
  464 +
  465 + // 数据源初始化标志
  466 + var $$data_init = false;
  467 + // 如果有required属性,添加angularjs required验证
  468 + if ($required_attr != undefined) {
  469 + tElem.find("ui-select").attr("required", "");
  470 + }
  471 +
  472 + // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义
  473 + // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}
  474 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");
  475 + // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data
  476 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  477 + // 原来的设置:item[$saSelectCtrl.$icname_s]
  478 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);
  479 + // 原来的设置:{{$saSelectCtrl.$name}}
  480 + tElem.find("ui-select").attr("name", $name_attr);
  481 + // 原来的设置:{{$saSelectCtrl.$placeholder}}
  482 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  483 +
  484 + return {
  485 + pre: function(scope, element, attr) {
  486 + // TODO:
  487 + },
  488 + /**
  489 + * 相当于link函数。
  490 + * @param scope
  491 + * @param element
  492 + * @param attr
  493 + */
  494 + post: function(scope, element, attr) {
  495 + // 添加选中事件处理函数
  496 + scope[ctrlAs].$$internal_select_fn = function($item) {
  497 + if ($dcname_attr && $icname_attr) {
  498 + if ($mlp_attr) {
  499 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  500 + } else {
  501 + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
  502 + }
  503 + }
  504 + if ($dcname2_attr && $icname2_attr) {
  505 + if ($mlp_attr) {
  506 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");
  507 + } else {
  508 + scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
  509 + }
  510 + }
  511 + if ($dcname3_attr && $icname3_attr) {
  512 + if ($mlp_attr) {
  513 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
  514 + } else {
  515 + scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
  516 + }
  517 + }
  518 + };
  519 +
  520 + // 删除选中事件处理函数
  521 + scope[ctrlAs].$$internal_remove_fn = function() {
  522 + scope[ctrlAs].$$internalmodel = undefined;
  523 + if ($mlp_attr) {
  524 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  525 + } else {
  526 + scope[ctrlAs].model[$dcname_attr] = undefined;
  527 + }
  528 +
  529 + if ($dcname2_attr) {
  530 + if ($mlp_attr) {
  531 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");
  532 + } else {
  533 + scope[ctrlAs].model[$dcname2_attr] = undefined;
  534 + }
  535 + }
  536 + if ($dcname3_attr) {
  537 + if ($mlp_attr) {
  538 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
  539 + } else {
  540 + scope[ctrlAs].model[$dcname3_attr] = undefined;
  541 + }
  542 + }
  543 + };
  544 +
  545 + /**
  546 + * 内部方法,读取字典数据作为数据源。
  547 + * @param dicgroup 字典类型,如:gsType
  548 + * @param ccol 代码字段名
  549 + * @param ncol 名字字段名
  550 + */
  551 + scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {
  552 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  553 + var dic_key; // 字典key
  554 + // 清空内部数据
  555 + scope[ctrlAs].$$data_real = [];
  556 + for (dic_key in origin_dicgroup) {
  557 + var data = {}; // 重新组合的字典元素对象
  558 + if (dic_key == "true")
  559 + data[ccol] = true;
  560 + else
  561 + data[ccol] = dic_key;
  562 + data[ncol] = origin_dicgroup[dic_key];
  563 + scope[ctrlAs].$$data_real.push(data);
  564 + }
  565 + // 这里直接将$$data_real数据深拷贝到$$data
  566 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  567 +
  568 + console.log(scope[ctrlAs].$$data);
  569 + };
  570 +
  571 + /**
  572 + * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把
  573 + * 内部方法,读取字典数据作为数据源。
  574 + * @param result 原始数据
  575 + * @param dcvalue 传入的关联数据
  576 + */
  577 + scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {
  578 + console.log("start=" + dcvalue);
  579 + // 清空内部数据
  580 + scope[ctrlAs].$$data_real = [];
  581 + scope[ctrlAs].$$data = [];
  582 + for (var i = 0; i < result.length; i ++) {
  583 + if ($icname_s_attr) {
  584 + if ($mlp_attr) {
  585 + if (eval("result[i]" + "." + $icname_s_attr)) {
  586 + // 全拼
  587 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();
  588 + // 简拼
  589 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));
  590 + }
  591 + } else {
  592 + if (result[i][$icname_s_attr]) {
  593 + // 全拼
  594 + result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();
  595 + // 简拼
  596 + result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);
  597 + }
  598 + }
  599 + }
  600 +
  601 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  602 + scope[ctrlAs].$$data_real.push(result[i]);
  603 + }
  604 +
  605 + }
  606 + //console.log("start2");
  607 +
  608 + // 数量太大取前10条记录作为显示
  609 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  610 + // 先迭代循环查找已经传过来的值
  611 + if (scope[ctrlAs].$$data_real.length > 0) {
  612 + if (dcvalue) {
  613 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  614 + if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {
  615 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));
  616 + break;
  617 + }
  618 + }
  619 + }
  620 + }
  621 + // 在插入剩余的数据
  622 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  623 + if (scope[ctrlAs].$$data.length < 10) {
  624 + if ($mlp_attr) {
  625 + if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {
  626 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  627 + }
  628 + } else {
  629 + if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {
  630 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  631 + }
  632 + }
  633 + } else {
  634 + break;
  635 + }
  636 + }
  637 + }
  638 +
  639 + //console.log("end");
  640 + };
  641 +
  642 + /**
  643 + * 判定一个对象是否为空对象。
  644 + * @param Obj
  645 + */
  646 + scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {
  647 + console.log(typeof obj);
  648 +
  649 + if (typeof obj === "object" && !(obj instanceof Array)) {
  650 + for (var prop in obj) {
  651 + if (obj.hasOwnProperty(prop)) {
  652 + return false;
  653 + }
  654 + }
  655 + return true;
  656 + } else {
  657 + throw "必须是对象";
  658 + }
  659 + };
  660 +
  661 + // 刷新数据
  662 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  663 + // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取
  664 + var $dcvalue_attr = attr["dcvalue"];
  665 +
  666 + console.log("刷新数据:" + $dcvalue_attr);
  667 +
  668 + if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化
  669 + if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源
  670 + scope[ctrlAs].$$internal_dic_data(
  671 + $datatype_attr, $icname_attr, $icname_s_attr);
  672 + if ($dcvalue_attr) {
  673 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  674 + }
  675 + } else { // 非字典类型数据源
  676 + if (!$dataassociate_attr) {
  677 + $$searchInfoService_g[$datatype_attr].list(
  678 + {type: "all"},
  679 + function(result) {
  680 + //console.log("ok:" + $datatype_attr);
  681 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  682 + //console.log("ok2:" + $datatype_attr);
  683 + if ($dcvalue_attr) {
  684 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  685 + }
  686 +
  687 + $$data_init = true;
  688 + },
  689 + function(result) {
  690 +
  691 + }
  692 + );
  693 + }
  694 + }
  695 + }
  696 +
  697 + if ($$data_init) {
  698 + if (search && search != "") { // 有search值
  699 + if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源
  700 + // 处理search
  701 + console.log("search:" + search);
  702 +
  703 + scope[ctrlAs].$$data = [];
  704 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  705 + var upTerm = search.toUpperCase();
  706 + if (scope[ctrlAs].$$data.length < 10) {
  707 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  708 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  709 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  710 + }
  711 + } else {
  712 + break;
  713 + }
  714 + }
  715 + }
  716 + }
  717 +
  718 + }
  719 +
  720 + };
  721 +
  722 +
  723 +
  724 +
  725 +
  726 +
  727 +
  728 +
  729 +
  730 +
  731 + // TODO:
  732 +
  733 + // dom全部载入后调用
  734 + $timeout(function() {
  735 + console.log("dom全部载入后调用");
  736 + }, 0);
  737 + // 监控dcvalue model值变换
  738 + attr.$observe("dcvalue", function(value) {
  739 + console.log("监控dc1 model值变换:" + value);
  740 + scope[ctrlAs].$$internalmodel = value;
  741 + }
  742 + );
  743 + // 监控获取数据参数变换
  744 + attr.$observe("dataparam", function(value) {
  745 + // 判定是否空对象
  746 + console.log(value);
  747 + var obj = JSON.parse(value);
  748 + var $dcvalue_attr = attr["dcvalue"];
  749 + if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {
  750 + console.log("dataparam:" + obj);
  751 +
  752 + //
  753 +
  754 + obj["type"] = "all";
  755 +
  756 + $$data_init = false;
  757 + $$searchInfoService_g[$datatype_attr].list(
  758 + obj,
  759 + function(result) {
  760 + //console.log("ok:" + $datatype_attr);
  761 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  762 + //console.log("ok2:" + $datatype_attr);
  763 + if ($dcvalue_attr) {
  764 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  765 + }
  766 +
  767 + $$data_init = true;
  768 + },
  769 + function(result) {
  770 +
  771 + }
  772 + );
  773 + }
  774 + }
  775 + );
  776 + }
  777 + };
  778 + }
  779 + };
  780 +
  781 + }
  782 +]);
  783 +
  784 +
  785 +/**
  786 + * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
  787 + * name(必须):控件的名字
  788 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  789 + * placeholder(可选):输入框占位符字符串
  790 + *
  791 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  792 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  793 + * icname(必须):内部与之对应的字段名,如:icname=code
  794 + *
  795 + * cmaps(可选):model其他字段和内部数据字段名映射,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}
  796 + * dsparams(必须):内部数据源查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  797 + * dscol(必须):内部显示的信息(暂时用内部字段),如:dscol=name
  798 + * required(可选):是否要用required验证
  799 + */
  800 +angular.module('ScheduleApp').directive('saSelect4', [
  801 + '$timeout',
  802 + '$$SearchInfoService_g',
  803 + function($timeout, $$searchInfoService_g) {
  804 + return {
  805 + restrict: 'E',
  806 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect4Template.html',
  807 + scope: {
  808 + model: "=" // 独立作用域,关联外部的模型object
  809 + },
  810 + controllerAs: "$saSelectCtrl",
  811 + bindToController: true,
  812 + controller: function($scope) {
  813 + var self = this;
  814 + self.$$data = []; // ui-select显示用的数据
  815 + self.$$data_real = []; // 内部真实的数据
  816 +
  817 + // saSelect4组件的ng-model,用于外部绑定验证等操作
  818 + self.$$internalmodel = undefined;
  819 +
  820 + self.$$internal_select_value = undefined; // 选中的值
  821 + },
  822 +
  823 + /**
  824 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  825 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  826 + * @param tElem
  827 + * @param tAttrs
  828 + * @returns {{pre: Function, post: Function}}
  829 + */
  830 + compile: function(tElem, tAttrs) {
  831 + // 获取属性
  832 + var $name_attr = tAttrs["name"]; // 控件的名字
  833 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  834 +
  835 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  836 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  837 +
  838 + var $cmaps_attr = tAttrs["cmaps"]; // model其他字段和内部数据字段名映射
  839 + var $dscol_attr = tAttrs["dscol"]; // 内部显示的信息
  840 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  841 +
  842 + // controlAs名字
  843 + var ctrlAs = "$saSelectCtrl";
  844 +
  845 + // 验证属性
  846 + if (!$name_attr) {
  847 + throw new error("name属性必须填写");
  848 + }
  849 + if (!$dcname_attr) {
  850 + throw new error("dcname属性必须填写");
  851 + }
  852 + if (!$icname_attr) {
  853 + throw new error("icname属性必须填写");
  854 + }
  855 + if (!$dscol_attr) {
  856 + throw new error("dscol属性必须填写");
  857 + }
  858 +
  859 + // 动态设置dom
  860 + // dom required 属性
  861 + if ($required_attr != undefined) {
  862 + tElem.find("div").attr("required", "");
  863 + }
  864 + // dom placeholder 属性
  865 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  866 + // dom dscol 属性
  867 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $dscol_attr + "}}");
  868 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $dscol_attr);
  869 + // dom icname 属性
  870 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  871 + // dom name 属性
  872 + tElem.find("div").attr("name", $name_attr);
  873 +
  874 + return {
  875 + pre: function(scope, element, attr) {
  876 + // TODO:
  877 + },
  878 +
  879 + /**
  880 + * 相当于link函数。
  881 + * @param scope
  882 + * @param element
  883 + * @param attr
  884 + */
  885 + post: function(scope, element, attr) {
  886 +
  887 + // 添加选中事件处理函数
  888 + scope[ctrlAs].$$internal_select_fn = function($item) {
  889 + if ($dcname_attr && $icname_attr) {
  890 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  891 + }
  892 +
  893 + if ($cmaps_attr) {
  894 + for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名
  895 + var ic = $cmaps_attr[mc]; // 内部数据源对应字段
  896 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
  897 + }
  898 + }
  899 + };
  900 +
  901 + // 删除选中事件处理函数
  902 + scope[ctrlAs].$$internal_remove_fn = function() {
  903 + scope[ctrlAs].$$internal_select_value = undefined;
  904 + if ($dcname_attr) {
  905 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  906 + }
  907 +
  908 + if ($cmaps_attr) {
  909 + var mc; // model的字段名
  910 + for (mc in $cmaps_attr) {
  911 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  912 + }
  913 + }
  914 + scope[ctrlAs].$$internal_validate_model();
  915 + };
  916 +
  917 + // 刷新数据
  918 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  919 + if (search && search != "") { // 有search值
  920 + // 处理search
  921 + console.log("search:" + search);
  922 +
  923 + scope[ctrlAs].$$data = [];
  924 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  925 + var upTerm = search.toUpperCase();
  926 + if (scope[ctrlAs].$$data.length < 10) {
  927 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  928 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  929 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  930 + }
  931 + } else {
  932 + break;
  933 + }
  934 + }
  935 + }
  936 + };
  937 +
  938 + /**
  939 + * 验证内部数据,更新外部model
  940 + */
  941 + scope[ctrlAs].$$internal_validate_model = function() {
  942 + if (scope[ctrlAs].$$internal_select_value) {
  943 + var select_value_temp = scope[ctrlAs].$$internal_select_value;
  944 + if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
  945 + var obj;
  946 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  947 + if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
  948 + obj = angular.copy(scope[ctrlAs].$$data_real[j]);
  949 + break;
  950 + }
  951 + }
  952 + if (obj) { // 在data中判定有没有
  953 + for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
  954 + if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
  955 + obj = undefined;
  956 + break;
  957 + }
  958 + }
  959 + if (obj) {
  960 + scope[ctrlAs].$$data.push(obj);
  961 + }
  962 + // 更新内部model,用于外部验证
  963 + // 内部model的值暂时随意,以后再改
  964 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  965 + } else {
  966 + scope[ctrlAs].$$internalmodel = undefined;
  967 + }
  968 +
  969 + } else {
  970 + scope[ctrlAs].$$internalmodel = undefined;
  971 + }
  972 +
  973 + } else {
  974 + scope[ctrlAs].$$internalmodel = undefined;
  975 + }
  976 + };
  977 +
  978 + /**
  979 + * 内部方法,读取字典数据作为数据源。
  980 + * @param atype ajax查询类型
  981 + * @param ajaxparamobj 查询参数对象
  982 + */
  983 + scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
  984 + ajaxparamobj.type = 'all';
  985 + $$searchInfoService_g[atype].list(
  986 + ajaxparamobj,
  987 + function(result) {
  988 + console.log("$$internal_ajax_data result");
  989 +
  990 + // 清空内部数据
  991 + scope[ctrlAs].$$data_real = [];
  992 + scope[ctrlAs].$$data = [];
  993 +
  994 + // result中添加拼音数据,注意:这里要求result返回对象数组
  995 + for (var i = 0; i < result.length; i ++) {
  996 + if ($dscol_attr) {
  997 + if (eval("result[i]" + "." + $dscol_attr)) {
  998 + // 全拼
  999 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $dscol_attr)).toUpperCase();
  1000 + // 简拼
  1001 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $dscol_attr));
  1002 + }
  1003 + }
  1004 +
  1005 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  1006 + scope[ctrlAs].$$data_real.push(result[i]);
  1007 + }
  1008 +
  1009 + }
  1010 +
  1011 + // 数据量太大,取10条记录显示
  1012 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  1013 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1014 + if (scope[ctrlAs].$$data.length < 10) {
  1015 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1016 + } else {
  1017 + break;
  1018 + }
  1019 + }
  1020 + }
  1021 +
  1022 + scope[ctrlAs].$$internal_validate_model();
  1023 + },
  1024 + function(result) {
  1025 +
  1026 + }
  1027 + );
  1028 + };
  1029 +
  1030 + /**
  1031 + * 内部方法,读取字典数据作为数据源。
  1032 + * @param dictype 字典类型,如:gsType
  1033 + */
  1034 + scope[ctrlAs].$$internal_dic_data = function(dictype) {
  1035 + if (!dictionaryUtils.getByGroup(dictype)) {
  1036 + throw new error("字典数据不窜在=" + dictype);
  1037 + }
  1038 +
  1039 + // 清空内部数据
  1040 + scope[ctrlAs].$$data_real = [];
  1041 + scope[ctrlAs].$$data = [];
  1042 +
  1043 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  1044 + var dic_key; // 字典key
  1045 +
  1046 + for (dic_key in origin_dicgroup) {
  1047 + var data = {}; // 重新组合的字典元素对象
  1048 + if (dic_key == "true")
  1049 + data[$icname_attr] = true;
  1050 + else
  1051 + data[$icname_attr] = dic_key;
  1052 + data[$dscol_attr] = origin_dicgroup[dic_key];
  1053 + scope[ctrlAs].$$data_real.push(data);
  1054 + }
  1055 + // 这里直接将$$data_real数据深拷贝到$$data
  1056 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  1057 + scope[ctrlAs].$$internal_validate_model();
  1058 + };
  1059 +
  1060 + attr.$observe("dsparams", function(value) {
  1061 + if (value && value != "") {
  1062 + var obj = JSON.parse(value);
  1063 + console.log("observe 监控 dsparams=" + obj);
  1064 +
  1065 + // dsparams格式如下:
  1066 + // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
  1067 +
  1068 + if (obj.type == 'dic') {
  1069 + scope[ctrlAs].$$internal_dic_data(obj.param);
  1070 +
  1071 + } else if (obj.type == 'ajax') {
  1072 + scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  1073 + } else {
  1074 + throw new Error("dsparams参数格式异常=" + obj);
  1075 + }
  1076 +
  1077 + }
  1078 +
  1079 + });
  1080 +
  1081 + // 监控model绑定的dcvalue值变化
  1082 + attr.$observe("dcvalue", function(value) {
  1083 + if (value && value != "") {
  1084 + console.log("observe 监控 dcvalue=" + value);
  1085 + scope[ctrlAs].$$internal_select_value = value;
  1086 + scope[ctrlAs].$$internal_validate_model();
  1087 + }
  1088 +
  1089 + // 闭包测试
  1090 + var obj = {'a':1,'b':2};
  1091 + var tfx = scope[ctrlAs].$$test.bind(obj);
  1092 + console.log("闭包测试=" + tfx());
  1093 + });
  1094 +
  1095 + scope[ctrlAs].$$test = function() {
  1096 + var exp = "this.a + '(' + this.b + ')'";
  1097 + console.log("exp=" + exp);
  1098 + return eval(exp);
  1099 + };
  1100 + }
  1101 + };
  1102 +
  1103 + }
  1104 +
  1105 + };
  1106 + }
  1107 +]);
  1108 +/**
  1109 + * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
  1110 + * name(必须):控件的名字
  1111 + * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave
  1112 + * cmaps(必须):外部对象与指令内部数据对象字段名映射对象字符串,如:{'xl.id' : 'id', 'xl.name' : 'name'}
  1113 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1114 + * icname(必须):内部与之对应的字段名,如:icname=id
  1115 + *
  1116 + * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  1117 + * dsparamsextra(可选):内部数据源查询附加参数对象字符串,如:{'type':'all'}
  1118 + * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item
  1119 + * iterobjexp(必须):内部显示用的表达式
  1120 + * searchph(必须):查询输入占位符字符串,如:searchph=请输入...
  1121 + * searchexp(必须):查询基于的内部数据源的表达式,如:searchexp=this.name+'('+this.code+')'
  1122 + *
  1123 + * required(可选):是否需要form的required验证
  1124 + *
  1125 + */
  1126 +angular.module('ScheduleApp').directive('saSelect5', [
  1127 + '$timeout',
  1128 + '$$SearchInfoService_g',
  1129 + function($timeout, $$searchInfoService_g) {
  1130 + return {
  1131 + restrict: 'E',
  1132 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',
  1133 + scope: { // 独立作用域
  1134 + model: "=" // 绑定外部对象
  1135 + },
  1136 + controllerAs: "$saSelectCtrl",
  1137 + bindToController: true,
  1138 + controller: function($scope) {
  1139 + var self = this;
  1140 + self.$$data = []; // 内部ui-select显示用数据
  1141 + self.$$data_real = []; // 内部保存的实际数据
  1142 +
  1143 + // myselect组件的ng-model,用于外部绑定验证等操作
  1144 + self.$$internalmodel = undefined;
  1145 +
  1146 + self.$$internal_select_value = undefined; // 选中的值
  1147 +
  1148 + },
  1149 +
  1150 + /**
  1151 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1152 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1153 + * @param tElem
  1154 + * @param tAttrs
  1155 + * @returns {{pre: Function, post: Function}}
  1156 + */
  1157 + compile: function(tElem, tAttrs) {
  1158 + // 获取属性,并验证必须按属性
  1159 + var $name_attr = tAttrs["name"]; // 控件的名字
  1160 + var $cmaps_attr = tAttrs["cmaps"]; // 外部对象与指令内部数据对象字段名映射对象
  1161 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  1162 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  1163 +
  1164 + var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象
  1165 + var $dsparamsextra_attr = tAttrs["dsparamsextra"]; // 内部数据源查询附加参数对象字符串
  1166 + var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名
  1167 + var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式
  1168 + var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串
  1169 + var $searchexp_attr = tAttrs["searchexp"]; // 查询基于的内部数据源的表达式
  1170 +
  1171 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1172 +
  1173 + if (!$name_attr) {
  1174 + throw new Error("name属性必须填写");
  1175 + }
  1176 + if (!$cmaps_attr) {
  1177 + throw new Error("cmaps属性必须填写")
  1178 + }
  1179 + if (!$dcname_attr || !$icname_attr) {
  1180 + throw new Error("dcname、icname属性必须填写");
  1181 + }
  1182 + if (!$dsparams_attr) {
  1183 + throw new Error("dsparams属性必须填写");
  1184 + }
  1185 + if (!$iterobjname_attr) {
  1186 + throw new Error("iterobjname属性必须填写");
  1187 + }
  1188 + if (!$iterobjexp_attr) {
  1189 + throw new Error("iterobjexp属性必须填写");
  1190 + }
  1191 + if (!$searchph_attr) {
  1192 + throw new Error("searchph属性必须填写");
  1193 + }
  1194 + if (!$searchexp_attr) {
  1195 + throw new Error("searchexp属性必须填写");
  1196 + }
  1197 +
  1198 + // 内部controlAs名字
  1199 + var ctrlAs = "$saSelectCtrl";
  1200 +
  1201 + // 动态设置dom
  1202 + // dom,最外层name属性设置
  1203 + tElem.find("div:first").attr("name", $name_attr);
  1204 + // dom,最外层divrequired属性设置
  1205 + if ($required_attr != undefined) {
  1206 + tElem.find("div[name=\'" + $name_attr + "\']").attr("required", "");
  1207 + }
  1208 + // dom,ui-select-match的placeholder属性设定
  1209 + tElem.find("ui-select-match").attr("placeholder", $searchph_attr);
  1210 + // dom,ui-select-match的内容设定
  1211 + var uiSelectMatchHtml = "{{" + ctrlAs + ".$$internal_match_str($select.selected)}}";
  1212 + tElem.find("ui-select-match").html(uiSelectMatchHtml);
  1213 + // dom,ui-select-choices的repeat属性设定
  1214 + var uiSelectChoices_repeatAttr = $iterobjname_attr + "." + $icname_attr + " as " + $iterobjname_attr + " in " + ctrlAs + ".$$data";
  1215 + tElem.find("ui-select-choices").attr("repeat", uiSelectChoices_repeatAttr);
  1216 + // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
  1217 + tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
  1218 +
  1219 + return {
  1220 + pre: function (scope, element, attr) {
  1221 + // TODO:
  1222 + },
  1223 +
  1224 + /**
  1225 + * 相当于link函数。
  1226 + * @param scope
  1227 + * @param element
  1228 + * @param attr
  1229 + */
  1230 + post: function (scope, element, attr) {
  1231 +
  1232 + // 添加选中事件处理函数
  1233 + scope[ctrlAs].$$internal_select_fn = function($item) {
  1234 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  1235 +
  1236 + eval("var obj=" + $cmaps_attr);
  1237 + for (var mc in obj) { // model的字段名:内部数据源对应字段名
  1238 + var ic = obj[mc]; // 内部数据源对应字段
  1239 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
  1240 + }
  1241 + };
  1242 +
  1243 + // 删除选中事件处理函数
  1244 + scope[ctrlAs].$$internal_remove_fn = function() {
  1245 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  1246 +
  1247 + eval("var obj=" + $cmaps_attr);
  1248 + var mc; // model的字段名
  1249 + for (mc in obj) {
  1250 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  1251 + }
  1252 + };
  1253 +
  1254 + // 刷新数据
  1255 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  1256 + if (search && search != "") { // 有search值
  1257 + // 处理search
  1258 + console.log("search:" + search);
  1259 +
  1260 + scope[ctrlAs].$$data = [];
  1261 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1262 + var upTerm = search.toUpperCase();
  1263 + if (scope[ctrlAs].$$data.length < 10) {
  1264 + if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
  1265 + || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
  1266 + || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
  1267 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1268 + }
  1269 + } else {
  1270 + break;
  1271 + }
  1272 + }
  1273 + }
  1274 + };
  1275 +
  1276 + /**
  1277 + * 验证内部数据,更新外部model
  1278 + */
  1279 + scope[ctrlAs].$$internal_validate_model = function() {
  1280 + if (scope[ctrlAs].$$internal_select_value) {
  1281 + var select_value_temp = scope[ctrlAs].$$internal_select_value;
  1282 + if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
  1283 + var obj;
  1284 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  1285 + if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
  1286 + obj = angular.copy(scope[ctrlAs].$$data_real[j]);
  1287 + break;
  1288 + }
  1289 + }
  1290 + if (obj) { // 在data中判定有没有
  1291 + for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
  1292 + if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
  1293 + obj = undefined;
  1294 + break;
  1295 + }
  1296 + }
  1297 + if (obj) {
  1298 + scope[ctrlAs].$$data.push(obj);
  1299 + }
  1300 + // 更新内部model,用于外部验证
  1301 + // 内部model的值暂时随意,以后再改
  1302 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  1303 + } else {
  1304 + scope[ctrlAs].$$internalmodel = undefined;
  1305 + }
  1306 +
  1307 + } else {
  1308 + scope[ctrlAs].$$internalmodel = undefined;
  1309 + }
  1310 +
  1311 + } else {
  1312 + scope[ctrlAs].$$internalmodel = undefined;
  1313 + }
  1314 + };
  1315 +
  1316 + /**
  1317 + * 内部match表达式转换函数,需要外部绑定此函数的上下文。
  1318 + * @param context function上下文
  1319 + */
  1320 + scope[ctrlAs].$$internal_match_str = function (context) {
  1321 + var fx = function() {
  1322 + try {
  1323 + return eval($searchexp_attr);
  1324 + } catch (err) {
  1325 + //console.log(err);
  1326 + return undefined;
  1327 + }
  1328 +
  1329 + };
  1330 +
  1331 + var str = fx.bind(context)();
  1332 + if (str && str != "")
  1333 + return str;
  1334 + else
  1335 + return undefined;
  1336 + };
  1337 +
  1338 + /**
  1339 + * 内部方法,读取字典数据作为数据源。
  1340 + * @param atype ajax查询类型
  1341 + * @param ajaxparamobj 查询参数对象
  1342 + */
  1343 + scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
  1344 + // 如果ajaxparamobj为空对象,则表示清空内部选项
  1345 + var isEmptyObj = true;
  1346 + for (var name in ajaxparamobj) {
  1347 + isEmptyObj = false;
  1348 + }
  1349 + if (isEmptyObj) {
  1350 + // 重新创建内部保存的数据
  1351 + scope[ctrlAs].$$data_real = [];
  1352 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  1353 + scope[ctrlAs].$$data = [];
  1354 +
  1355 + scope[ctrlAs].$$internal_remove_fn();
  1356 + scope[ctrlAs].$$internal_validate_model();
  1357 +
  1358 + return;
  1359 + }
  1360 +
  1361 + if ($dsparamsextra_attr) { // 合并附加参数
  1362 + eval("var extra = " + $dsparamsextra_attr);
  1363 + for (var extrakey in extra) {
  1364 + ajaxparamobj[extrakey] = extra[extrakey];
  1365 + }
  1366 + }
  1367 +
  1368 + $$searchInfoService_g[atype].list(
  1369 + ajaxparamobj,
  1370 + function(result) {
  1371 + console.log("$$internal_ajax_data result");
  1372 +
  1373 + // 重新创建内部保存的数据
  1374 + scope[ctrlAs].$$data_real = [];
  1375 + // result中添加拼音数据,注意:这里要求result返回对象数组
  1376 + for (var i = 0; i < result.length; i++) {
  1377 + // 闭包绑定返回最终查询的值
  1378 + var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
  1379 + if (calcu_str) {
  1380 + // 全拼
  1381 + result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
  1382 + // 简拼
  1383 + result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
  1384 + // 原值
  1385 + result[i]["$calcu_str"] = calcu_str;
  1386 +
  1387 + scope[ctrlAs].$$data_real.push(result[i]);
  1388 + }
  1389 + }
  1390 +
  1391 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  1392 + scope[ctrlAs].$$data = [];
  1393 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1394 + if (scope[ctrlAs].$$data.length < 10) {
  1395 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  1396 + } else {
  1397 + break;
  1398 + }
  1399 + }
  1400 +
  1401 + scope[ctrlAs].$$internal_validate_model();
  1402 + },
  1403 + function(result) {
  1404 + throw new Error("ajax查询出错");
  1405 + }
  1406 + );
  1407 + };
  1408 +
  1409 + /**
  1410 + * 内部方法,读取字典数据作为数据源。
  1411 + * @param dictype 字典类型,如:gsType
  1412 + */
  1413 + scope[ctrlAs].$$internal_dic_data = function(dictype) {
  1414 + if (!dictionaryUtils.getByGroup(dictype)) {
  1415 + throw new error("字典数据不窜在=" + dictype);
  1416 + }
  1417 +
  1418 + // 重新创建内部保存的数据
  1419 + scope[ctrlAs].$$data_real = [];
  1420 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  1421 + var dic_key; // 字典key
  1422 +
  1423 + for (dic_key in origin_dicgroup) {
  1424 + var data = {}; // 重新组合的字典元素对象
  1425 + if (dic_key == "true")
  1426 + data[$icname_attr] = true;
  1427 + else
  1428 + data[$icname_attr] = dic_key;
  1429 + data[$dscol_attr] = origin_dicgroup[dic_key];
  1430 + scope[ctrlAs].$$data_real.push(data);
  1431 + }
  1432 +
  1433 + // 重新创建内部ui-select显示用数据,直接复制所有的字典数据
  1434 + scope[ctrlAs].$$data = [];
  1435 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1436 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  1437 + }
  1438 +
  1439 + scope[ctrlAs].$$internal_validate_model();
  1440 + };
  1441 +
  1442 + /**
  1443 + * 监控dsparams属性变化
  1444 + */
  1445 + attr.$observe("dsparams", function(value) {
  1446 + if (value && value != "") {
  1447 + var obj = JSON.parse(value);
  1448 + console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);
  1449 +
  1450 + // dsparams格式如下:
  1451 + // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
  1452 +
  1453 + if (obj.type == 'dic') {
  1454 + scope[ctrlAs].$$internal_dic_data(obj.param);
  1455 +
  1456 + } else if (obj.type == 'ajax') {
  1457 + scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  1458 + } else {
  1459 + throw new Error("dsparams参数格式异常=" + obj);
  1460 + }
  1461 +
  1462 + }
  1463 + });
  1464 +
  1465 + /**
  1466 + * 监控外部模型dcname的值的变化。
  1467 + */
  1468 + scope.$watch(
  1469 + function() {
  1470 + return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);
  1471 + },
  1472 + function(newValue, oldValue) {
  1473 + if (newValue === undefined && oldValue === undefined) {
  1474 + // 两侧都是undefined,不处理
  1475 +
  1476 + } else {
  1477 + console.log("saSelect5 监控到外部模型" + $dcname_attr + "属性值变化,old=" + oldValue + ",new=" + newValue);
  1478 + scope[ctrlAs].$$internal_select_value = newValue;
  1479 + scope[ctrlAs].$$internal_validate_model();
  1480 + }
  1481 + },
  1482 + true
  1483 + );
  1484 + }
  1485 + };
  1486 + }
  1487 + };
  1488 + }
  1489 +]);
  1490 +
  1491 +/**
  1492 + * saRadiogroup指令
  1493 + * 属性如下:
  1494 + * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate
  1495 + * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)
  1496 + * name(必须):控件的名字
  1497 + * required(可选):是否要用required验证
  1498 + * disabled(可选):标示单选框是否可选
  1499 + *
  1500 + */
  1501 +angular.module('ScheduleApp').directive("saRadiogroup", [function() {
  1502 + /**
  1503 + * 使用字典数据的单选按钮组的指令。
  1504 + * 指令名称:truefalse-Dic
  1505 + */
  1506 + return {
  1507 + restrict: 'E',
  1508 + templateUrl: '/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroupTemplate.html',
  1509 + scope: {
  1510 + model: "="
  1511 + },
  1512 + controllerAs: "$saRadiogroupCtrl",
  1513 + bindToController: true,
  1514 + controller: function($scope) {
  1515 + //$scope["model"] = {selectedOption: null};
  1516 + //console.log("controller");
  1517 + //console.log("controller:" + $scope["model"]);
  1518 +
  1519 + var self = this;
  1520 + self.$$data = null; // 内部数据
  1521 + },
  1522 +
  1523 + /**
  1524 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1525 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1526 + * @param tElem
  1527 + * @param tAttrs
  1528 + * @returns {{pre: Function, post: Function}}
  1529 + */
  1530 + compile: function(tElem, tAttrs) {
  1531 + // 获取属性
  1532 + var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type
  1533 + var $name_attr = tAttrs["name"]; // 控件的名字
  1534 + var $required_attr = tAttrs["required"]; // 是否要用required验证
  1535 + var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选
  1536 +
  1537 + // controlAs名字
  1538 + var ctrlAs = "$saRadiogroupCtrl";
  1539 +
  1540 + // 如果有required属性,添加angularjs required验证
  1541 + if ($required_attr != undefined) {
  1542 + tElem.find("input").attr("required", "");
  1543 + }
  1544 +
  1545 + return {
  1546 + pre: function(scope, element, attr) {
  1547 +
  1548 + },
  1549 +
  1550 + /**
  1551 + * 相当于link函数。
  1552 + * @param scope
  1553 + * @param element
  1554 + * @param attr
  1555 + */
  1556 + post: function(scope, element, attr) {
  1557 + //console.log("link");
  1558 + //console.log("link:" + scope.model);
  1559 + //scope["model"] = {selectedOption: null};
  1560 +
  1561 + if ($name_attr) {
  1562 + scope[ctrlAs].nv = $name_attr;
  1563 + }
  1564 +
  1565 + if ($disabled_attr) {
  1566 + scope[ctrlAs].disabled = true;
  1567 + }
  1568 + if ($dicgroup_attr) {
  1569 + var obj = dictionaryUtils.getByGroup($dicgroup_attr);
  1570 + scope[ctrlAs].$$data = obj;
  1571 + // 处理 scope["dic"] key值
  1572 + scope[ctrlAs].dicvalueCalcu = function(value) {
  1573 + if (value == "true") {
  1574 + //console.log(value);
  1575 + return true;
  1576 + } else if (value == "false") {
  1577 + //console.log(value);
  1578 + return false;
  1579 + } else {
  1580 + return value;
  1581 + }
  1582 + };
  1583 + }
  1584 + }
  1585 + };
  1586 + }
  1587 + };
  1588 +}]);
  1589 +
  1590 +
  1591 +
  1592 +/**
  1593 + * saCheckboxgroup指令
  1594 + * 属性如下:
  1595 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1596 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  1597 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1598 + * name(必须):控件的名字
  1599 + * required(可选):是否要用required验证
  1600 + * disabled(可选):标示框是否可选
  1601 + *
  1602 + */
  1603 +angular.module('ScheduleApp').directive('saCheckboxgroup', [
  1604 + function() {
  1605 + return {
  1606 + restrict: 'E',
  1607 + templateUrl: '/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroupTemplate.html',
  1608 + scope: {
  1609 + model: "=" // 独立作用域,关联外部的模型object
  1610 + },
  1611 + controllerAs: "$saCheckboxgroupCtrl",
  1612 + bindToController: true,
  1613 + controller: function($scope) {
  1614 + var self = this;
  1615 + self.$$data = []; // 内部的数据
  1616 +
  1617 + // TODO:数据写死,周一至周日选择数据,以后有别的数据再议
  1618 + self.$$data = [
  1619 + {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1620 + {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1621 + {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1622 + {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1623 + {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1624 + {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1625 + {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}
  1626 + ];
  1627 + },
  1628 +
  1629 + /**
  1630 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1631 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1632 + * @param tElem
  1633 + * @param tAttrs
  1634 + * @returns {{pre: Function, post: Function}}
  1635 + */
  1636 + compile: function(tElem, tAttrs) {
  1637 + // 获取所有的属性
  1638 + var $name_attr = tAttrs["name"]; // 控件的名字
  1639 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1640 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  1641 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  1642 +
  1643 + // controlAs名字
  1644 + var ctrlAs = '$saCheckboxgroupCtrl';
  1645 +
  1646 + // 如果有required属性,添加angularjs required验证
  1647 + if ($required_attr != undefined) {
  1648 + //console.log(tElem.html());
  1649 + tElem.find("div").attr("required", "");
  1650 + }
  1651 + // 如果有disabled属性,添加禁用标志
  1652 + if ($disabled_attr != undefined) {
  1653 + tElem.find("input").attr("ng-disabled", "true");
  1654 + }
  1655 +
  1656 + return {
  1657 + pre: function(scope, element, attr) {
  1658 + // TODO:
  1659 + },
  1660 + /**
  1661 + * 相当于link函数。
  1662 + * @param scope
  1663 + * @param element
  1664 + * @param attr
  1665 + */
  1666 + post: function(scope, element, attr) {
  1667 + // name属性
  1668 + if ($name_attr) {
  1669 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1670 + }
  1671 +
  1672 + /**
  1673 + * checkbox选择事件处理函数。
  1674 + * @param $d 数据对象,$$data中的元素对象
  1675 + */
  1676 + scope[ctrlAs].$$internal_updateCheck_fn = function($d) {
  1677 + $d.ischecked = !$d.ischecked;
  1678 + console.log($d);
  1679 + };
  1680 +
  1681 + // 测试使用watch监控$$data的变化
  1682 + scope.$watch(
  1683 + function() {
  1684 + return scope[ctrlAs]["$$data"];
  1685 + },
  1686 + function(newValue, oldValue) {
  1687 + // 根据$$data生成对应的数据
  1688 + var rule_days_arr = [];
  1689 + var i;
  1690 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1691 + if (scope[ctrlAs]["$$data"][i].ischecked)
  1692 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);
  1693 + else
  1694 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);
  1695 + }
  1696 + scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");
  1697 + //scope[ctrlAs].$$internalmodel = undefined;
  1698 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  1699 +
  1700 + // 更新model
  1701 + if ($dcname_attr) {
  1702 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");
  1703 + }
  1704 +
  1705 +
  1706 + },
  1707 + true
  1708 + );
  1709 +
  1710 + // TODO:
  1711 +
  1712 + // 监控dcvalue model值变换
  1713 + attr.$observe("dcvalue", function(value) {
  1714 + console.log("saCheckboxgroup 监控dc1 model值变换:" + value);
  1715 + if (value) {
  1716 + // 根据value值,修改$$data里的值
  1717 + var data_array = value.split(",");
  1718 + var i;
  1719 + if (data_array.length > scope[ctrlAs]["$$data"].length) {
  1720 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {
  1721 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  1722 + scope[ctrlAs]["$$data"][i].ischecked = true;
  1723 + } else {
  1724 + scope[ctrlAs]["$$data"][i].ischecked = false;
  1725 + }
  1726 + }
  1727 + } else {
  1728 + for (i = 0; i < data_array.length; i ++) {
  1729 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  1730 + scope[ctrlAs]["$$data"][i].ischecked = true;
  1731 + } else {
  1732 + scope[ctrlAs]["$$data"][i].ischecked = false;
  1733 + }
  1734 + }
  1735 + }
  1736 +
  1737 + }
  1738 + });
  1739 + }
  1740 +
  1741 + };
  1742 +
  1743 +
  1744 + }
  1745 +
  1746 + };
  1747 + }
  1748 +]);
  1749 +
  1750 +
  1751 +
  1752 +
  1753 +/**
  1754 + * saDategroup指令
  1755 + * 属性如下:
  1756 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1757 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  1758 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1759 + * name(必须):控件的名字
  1760 + * required(可选):是否要用required验证
  1761 + * disabled(可选):标示框是否可选
  1762 + *
  1763 + */
  1764 +angular.module('ScheduleApp').directive('saDategroup', [
  1765 + '$filter',
  1766 + function($filter) {
  1767 + return {
  1768 + restrict: 'E',
  1769 + templateUrl: '/pages/scheduleApp/module/common/dts2/dateGroup/saDategroupTemplate.html',
  1770 + scope: {
  1771 + model: "=" // 独立作用域,关联外部的模型object
  1772 + },
  1773 + controllerAs: "$saDategroupCtrl",
  1774 + bindToController: true,
  1775 + controller: function($scope) {
  1776 + var self = this;
  1777 + self.$$data = []; // 内部的数据
  1778 + self.$$date_select; // 内部选中的日期
  1779 +
  1780 + //// 测试数据
  1781 + //self.$$data = [
  1782 + // {datestr: '2011-01-01', ischecked: true},
  1783 + // {datestr: '2011-01-01', ischecked: true},
  1784 + // {datestr: '2011-01-01', ischecked: true}
  1785 + //];
  1786 + },
  1787 +
  1788 + /**
  1789 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1790 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1791 + * @param tElem
  1792 + * @param tAttrs
  1793 + * @returns {{pre: Function, post: Function}}
  1794 + */
  1795 + compile: function(tElem, tAttrs) {
  1796 + // 获取所有的属性
  1797 + var $name_attr = tAttrs["name"]; // 控件的名字
  1798 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1799 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  1800 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  1801 +
  1802 + // controlAs名字
  1803 + var ctrlAs = '$saDategroupCtrl';
  1804 +
  1805 + // 如果有required属性,添加angularjs required验证
  1806 + if ($required_attr != undefined) {
  1807 + //console.log(tElem.html());
  1808 + tElem.find("div").attr("required", "");
  1809 + }
  1810 + // 如果有disabled属性,添加禁用标志
  1811 + if ($disabled_attr != undefined) {
  1812 + tElem.find("input").attr("ng-disabled", "true");
  1813 + tElem.find("div").attr("ng-disabled", "true");
  1814 + }
  1815 +
  1816 + return {
  1817 + pre: function (scope, element, attr) {
  1818 + // TODO:
  1819 + },
  1820 + /**
  1821 + * 相当于link函数。
  1822 + * @param scope
  1823 + * @param element
  1824 + * @param attr
  1825 + */
  1826 + post: function (scope, element, attr) {
  1827 + // name属性
  1828 + if ($name_attr) {
  1829 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1830 + }
  1831 +
  1832 +
  1833 + // 日期open属性,及方法
  1834 + scope[ctrlAs].$$specialDateOpen = false;
  1835 + scope[ctrlAs].$$specialDate_open = function() {
  1836 + scope[ctrlAs].$$specialDateOpen = true;
  1837 + };
  1838 +
  1839 + // 监控选择的日期
  1840 + scope.$watch(
  1841 + function() {
  1842 + return scope[ctrlAs]['$$date_select'];
  1843 + },
  1844 + function(newValue, oldValue) {
  1845 + if (newValue) {
  1846 + //console.log("saDategroup--->selectdate:" + newValue);
  1847 + // 调用内置filter,转换日期到yyyy-MM-dd格式
  1848 + var text = $filter('date')(newValue, 'yyyy-MM-dd');
  1849 + var i;
  1850 + var isexist = false; // 日期是否已经选择标识
  1851 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1852 + if (scope[ctrlAs]["$$data"][i].datestr == text) {
  1853 + isexist = true;
  1854 + break;
  1855 + }
  1856 + }
  1857 + if (!isexist) {
  1858 + scope[ctrlAs]["$$data"].push(
  1859 + {
  1860 + datestr: text,
  1861 + ischecked: true
  1862 + }
  1863 + );
  1864 + }
  1865 +
  1866 + }
  1867 +
  1868 + }
  1869 + );
  1870 +
  1871 + /**
  1872 + * 日期点击事件处理函数。
  1873 + * @param $index 索引
  1874 + */
  1875 + scope[ctrlAs].$$internal_datestr_click = function($index) {
  1876 + scope[ctrlAs].$$data.splice($index, 1);
  1877 + };
  1878 +
  1879 + // 测试使用watch监控$$data的变化
  1880 + scope.$watch(
  1881 + function() {
  1882 + return scope[ctrlAs]['$$data'];
  1883 + },
  1884 + function(newValue, oldValue) {
  1885 + // 根据$$data生成对应的数据
  1886 + var special_days_arr = [];
  1887 + var i;
  1888 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1889 + special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);
  1890 + }
  1891 +
  1892 + scope[ctrlAs].$$internalmodel = special_days_arr.join(",");
  1893 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  1894 +
  1895 + // 更新model
  1896 + if ($dcname_attr) {
  1897 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");
  1898 + }
  1899 + },
  1900 + true
  1901 + );
  1902 +
  1903 + // 监控dcvalue model值变换
  1904 + attr.$observe("dcvalue", function(value) {
  1905 + console.log("saDategroup 监控dc1 model值变换:" + value);
  1906 + if (value) {
  1907 + // 根据value值,修改$$data里的值
  1908 + var date_array = value.split(",");
  1909 + var i;
  1910 + scope[ctrlAs]["$$data"] = [];
  1911 + for (i = 0; i < date_array.length; i++) {
  1912 + scope[ctrlAs]["$$data"].push(
  1913 + {
  1914 + datestr: date_array[i],
  1915 + ischecked: true
  1916 + }
  1917 + );
  1918 + }
  1919 +
  1920 +
  1921 +
  1922 +
  1923 +
  1924 +
  1925 +
  1926 +
  1927 +
  1928 + }
  1929 + });
  1930 +
  1931 + }
  1932 +
  1933 + };
  1934 + }
  1935 + }
  1936 + }
  1937 +]);
  1938 +
  1939 +
  1940 +
  1941 +
  1942 +/**
  1943 + * saGuideboardgroup指令
  1944 + * 属性如下:
  1945 + * name(必须):控件的名字
  1946 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1947 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  1948 + * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1949 + * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange
  1950 + * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1951 + * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange
  1952 + * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  1953 + * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart
  1954 + *
  1955 + * required(可选):是否要用required验证
  1956 + *
  1957 + */
  1958 +angular.module('ScheduleApp').directive('saGuideboardgroup', [
  1959 + 'GuideboardManageService_g',
  1960 + function(guideboardManageService_g) {
  1961 + return {
  1962 + restrict: 'E',
  1963 + templateUrl: '/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroupTemplate.html',
  1964 + scope: {
  1965 + model: "=" // 独立作用域,关联外部的模型object
  1966 + },
  1967 + controllerAs: '$saGuideboardgroupCtrl',
  1968 + bindToController: true,
  1969 + controller: function($scope) {
  1970 + var self = this;
  1971 + self.$$data = []; // 选择线路后,该线路的路牌数据
  1972 +
  1973 + // 测试数据
  1974 + //self.$$data = [
  1975 + // {lpid: 1, lpname: '路1', isstart: false},
  1976 + // {lpid: 2, lpname: '路2', isstart: true},
  1977 + // {lpid: 3, lpname: '路3', isstart: false}
  1978 + //];
  1979 +
  1980 +
  1981 + self.$$dataSelected = []; // 选中的路牌列表
  1982 + self.$$dataSelectedStart = undefined; // 起始路牌
  1983 +
  1984 + //self.$$dataSelected = [
  1985 + // {lpid: 11, lpname: '路11', isstart: false},
  1986 + // {lpid: 12, lpname: '路12', isstart: true},
  1987 + // {lpid: 13, lpname: '路13', isstart: false}
  1988 + //];
  1989 +
  1990 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  1991 + self.$$internalmodel = undefined;
  1992 +
  1993 + self.$$data_init = false; // *数据源初始化标志
  1994 + self.$$data_xl_first_init = false; // 线路是否初始化
  1995 + self.$$data_lp_first_init = false; // 路牌名字是否初始化
  1996 + self.$$data_lpid_first_init = false; // 路牌id是否初始化
  1997 + self.$$data_lpstart_first_init = false; // 起始路牌是否初始化
  1998 +
  1999 + },
  2000 +
  2001 + /**
  2002 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  2003 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  2004 + * @param tElem
  2005 + * @param tAttrs
  2006 + * @returns {{pre: Function, post: Function}}
  2007 + */
  2008 + compile: function(tElem, tAttrs) {
  2009 + // TODO:获取所有的属性
  2010 + var $name_attr = tAttrs["name"]; // 控件的名字
  2011 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  2012 + var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名
  2013 + var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名
  2014 + var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名
  2015 +
  2016 + // controlAs名字
  2017 + var ctrlAs = '$saGuideboardgroupCtrl';
  2018 +
  2019 + // 如果有required属性,添加angularjs required验证
  2020 + if ($required_attr != undefined) {
  2021 + //console.log(tElem.html());
  2022 + tElem.find("div").attr("required", "");
  2023 + }
  2024 +
  2025 + return {
  2026 + pre: function(scope, element, attr) {
  2027 + // TODO:
  2028 + },
  2029 +
  2030 + /**
  2031 + * 相当于link函数。
  2032 + * @param scope
  2033 + * @param element
  2034 + * @param attr
  2035 + */
  2036 + post: function(scope, element, attr) {
  2037 + // name属性
  2038 + if ($name_attr) {
  2039 + scope[ctrlAs]["$name_attr"] = $name_attr;
  2040 + }
  2041 +
  2042 + // TODO:
  2043 +
  2044 +
  2045 + /**
  2046 + * 路牌列表点击(路牌列表中选中路牌)
  2047 + * @param $index
  2048 + */
  2049 + scope[ctrlAs].$$internal_lplist_click = function($index) {
  2050 + var data_temp = scope[ctrlAs].$$data;
  2051 + if (data_temp && data_temp.length > $index) {
  2052 + scope[ctrlAs].$$dataSelected.push({
  2053 + lpid: data_temp[$index].lpid,
  2054 + lpname: data_temp[$index].lpname,
  2055 + isstart: data_temp[$index].isstart
  2056 + });
  2057 +
  2058 + // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌
  2059 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  2060 + scope[ctrlAs].$$internal_sellplist_click(
  2061 + scope[ctrlAs].$$dataSelected.length - 1);
  2062 + }
  2063 + }
  2064 + };
  2065 + /**
  2066 + * 选中的路牌单击(初始路牌选择)
  2067 + * @param $index
  2068 + */
  2069 + scope[ctrlAs].$$internal_sellplist_click = function($index) {
  2070 + var data_temp = scope[ctrlAs].$$dataSelected;
  2071 + if (data_temp && data_temp.length > $index) {
  2072 + for (var i = 0; i < data_temp.length; i++) {
  2073 + data_temp[i].isstart = false;
  2074 + }
  2075 + data_temp[$index].isstart = true;
  2076 + scope[ctrlAs].$$dataSelectedStart = $index;
  2077 + }
  2078 + };
  2079 + /**
  2080 + * 选中的路牌双击(删除选中的路牌)
  2081 + * @param $index
  2082 + */
  2083 + scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {
  2084 + var data_temp = scope[ctrlAs].$$dataSelected;
  2085 + if (data_temp && data_temp.length > $index) {
  2086 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  2087 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2088 + }
  2089 + data_temp.splice($index, 1);
  2090 + }
  2091 + };
  2092 +
  2093 +
  2094 + /**
  2095 + * 验证内部数据,更新外部model
  2096 + */
  2097 + scope[ctrlAs].$$internal_validate_model = function() {
  2098 + var data_temp = scope[ctrlAs].$$dataSelected;
  2099 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  2100 + var lpNames = [];
  2101 + var lpIds = [];
  2102 + var lpStart = 0;
  2103 + var i = 0;
  2104 +
  2105 + if (data_temp &&
  2106 + data_temp.length > 0 &&
  2107 + data_temp2 != undefined) {
  2108 +
  2109 + for (i = 0; i < data_temp.length; i++) {
  2110 + lpNames.push(data_temp[i].lpname);
  2111 + lpIds.push(data_temp[i].lpid)
  2112 + }
  2113 + data_temp[data_temp2].isstart = true;
  2114 + lpStart = data_temp2 + 1;
  2115 +
  2116 + // 更新内部model,用于外部验证
  2117 + // 内部model的值暂时随意,以后再改
  2118 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  2119 +
  2120 + // 更新外部model字段
  2121 + if ($lprangename_attr) {
  2122 + console.log("lprangename=" + lpNames.join(','));
  2123 + eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");
  2124 + }
  2125 + if ($lpidrangename_attr) {
  2126 + console.log("lpidrangename=" + lpIds.join(','));
  2127 + eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");
  2128 + }
  2129 + if ($lpstartname_attr) {
  2130 + console.log("lpstartname=" + lpStart);
  2131 + eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");
  2132 + }
  2133 +
  2134 + } else {
  2135 + scope[ctrlAs].$$internalmodel = undefined;
  2136 + }
  2137 +
  2138 +
  2139 + };
  2140 +
  2141 + // 监控内部数据,$$data_selected 变化
  2142 + scope.$watch(
  2143 + function() {
  2144 + return scope[ctrlAs].$$dataSelected;
  2145 + },
  2146 + function(newValue, oldValue) {
  2147 + scope[ctrlAs].$$internal_validate_model();
  2148 + },
  2149 + true
  2150 + );
  2151 +
  2152 + // 监控内部数据,$$data_selected_start 变化
  2153 + scope.$watch(
  2154 + function() {
  2155 + return scope[ctrlAs].$$dataSelectedStart;
  2156 + },
  2157 + function(newValue, oldValue) {
  2158 + scope[ctrlAs].$$internal_validate_model();
  2159 + },
  2160 + true
  2161 + );
  2162 +
  2163 + /**
  2164 + * 验证数据是否初始化完成,
  2165 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  2166 + */
  2167 + scope[ctrlAs].$$internal_validate_init = function() {
  2168 + var self = scope[ctrlAs];
  2169 +
  2170 + if (self.$$data_xl_first_init &&
  2171 + self.$$data_lp_first_init &&
  2172 + self.$$data_lpid_first_init &&
  2173 + self.$$data_lpstart_first_init) {
  2174 + console.log("数据初始化完毕!");
  2175 + self.$$data_init = true;
  2176 + }
  2177 +
  2178 + };
  2179 +
  2180 + // 监控初始化标志,线路,路牌,路牌id,起始路牌
  2181 + scope.$watch(
  2182 + function() {
  2183 + return scope[ctrlAs].$$data_xl_first_init;
  2184 + },
  2185 + function(newValue, oldValue) {
  2186 + scope[ctrlAs].$$internal_validate_init();
  2187 + }
  2188 + );
  2189 + scope.$watch(
  2190 + function() {
  2191 + return scope[ctrlAs].$$data_lp_first_init;
  2192 + },
  2193 + function(newValue, oldValue) {
  2194 + scope[ctrlAs].$$internal_validate_init();
  2195 + }
  2196 + );
  2197 + scope.$watch(
  2198 + function() {
  2199 + return scope[ctrlAs].$$data_lpid_first_init;
  2200 + },
  2201 + function(newValue, oldValue) {
  2202 + scope[ctrlAs].$$internal_validate_init();
  2203 + }
  2204 + );
  2205 + scope.$watch(
  2206 + function() {
  2207 + return scope[ctrlAs].$$data_lpstart_first_init;
  2208 + },
  2209 + function(newValue, oldValue) {
  2210 + scope[ctrlAs].$$internal_validate_init();
  2211 + }
  2212 + );
  2213 +
  2214 +
  2215 + // 监控线路id的变化
  2216 + attr.$observe("xlidvalue", function(value) {
  2217 + if (value && value != "") {
  2218 + console.log("xlidvalue=" + value);
  2219 +
  2220 + guideboardManageService_g.rest.list(
  2221 + {"xl.id_eq": value, size: 100},
  2222 + function(result) {
  2223 + // 获取值了
  2224 + console.log("路牌获取了");
  2225 +
  2226 + scope[ctrlAs].$$data = [];
  2227 + for (var i = 0; i < result.content.length; i++) {
  2228 + scope[ctrlAs].$$data.push({
  2229 + lpid: result.content[i].id,
  2230 + lpname: result.content[i].lpName,
  2231 + isstart: false
  2232 + });
  2233 + }
  2234 + if (scope[ctrlAs].$$data_init) {
  2235 + scope[ctrlAs].$$dataSelected = [];
  2236 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2237 + scope[ctrlAs].$$internalmodel = undefined;
  2238 + }
  2239 + scope[ctrlAs].$$data_xl_first_init = true;
  2240 + },
  2241 + function(result) {
  2242 +
  2243 + }
  2244 + );
  2245 +
  2246 + }
  2247 + });
  2248 +
  2249 + // 监控路牌名称范围值的变化
  2250 + attr.$observe("lprangevalue", function(value) {
  2251 + if (value && value != "") {
  2252 + var data_temp = scope[ctrlAs].$$dataSelected;
  2253 + var lpnames = value.split(",");
  2254 + var i = 0;
  2255 + if (data_temp && data_temp.length == 0) { // 初始创建
  2256 + console.log("lprangevalue变换了");
  2257 + for (i = 0; i < lpnames.length; i++) {
  2258 + scope[ctrlAs].$$dataSelected.push({
  2259 + lpname: lpnames[i],
  2260 + isstart: false
  2261 + });
  2262 + }
  2263 + } else {
  2264 + for (i = 0; i < lpnames.length; i++) {
  2265 + data_temp[i].lpname = lpnames[i];
  2266 + }
  2267 + }
  2268 + scope[ctrlAs].$$data_lp_first_init = true;
  2269 + }
  2270 + });
  2271 +
  2272 + // 监控路牌id范围值的变化
  2273 + attr.$observe("lpidrangevalue", function(value) {
  2274 + if (value && value != "") {
  2275 + console.log("lpidrangevalue=" + value);
  2276 + var data_temp = scope[ctrlAs].$$dataSelected;
  2277 + var lpids = value.split(",");
  2278 + var i = 0;
  2279 + if (data_temp && data_temp.length == 0) { // 初始创建
  2280 + console.log("lpidrangevalue");
  2281 + for (i = 0; i < lpids.length; i++) {
  2282 + scope[ctrlAs].$$dataSelected.push({
  2283 + lpid: lpids[i],
  2284 + isstart: false
  2285 + });
  2286 + }
  2287 + } else {
  2288 + for (i = 0; i < lpids.length; i++) {
  2289 + data_temp[i].lpid = lpids[i];
  2290 + }
  2291 + }
  2292 + scope[ctrlAs].$$data_lpid_first_init = true;
  2293 + }
  2294 + });
  2295 +
  2296 + // 监控起始路牌的变化
  2297 + attr.$observe("lpstartvalue", function(value) {
  2298 + if (value && value != "") {
  2299 + scope[ctrlAs].$$dataSelectedStart = value - 1;
  2300 + scope[ctrlAs].$$data_lpstart_first_init = true;
  2301 + }
  2302 + });
  2303 +
  2304 +
  2305 +
  2306 + }
  2307 + }
  2308 +
  2309 + }
  2310 + }
  2311 + }
  2312 +]);
  2313 +
  2314 +
  2315 +
  2316 +
  2317 +/**
  2318 + * saEmployeegroup指令
  2319 + * 属性如下:
  2320 + * name(必须):控件的名字
  2321 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  2322 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  2323 + * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  2324 + * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange
  2325 + * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  2326 + * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange
  2327 + * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  2328 + * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart
  2329 + *
  2330 + * required(可选):是否要用required验证
  2331 + *
  2332 + */
  2333 +angular.module('ScheduleApp').directive('saEmployeegroup', [
  2334 + 'EmployeeConfigService_g',
  2335 + function(employeeConfigService_g) {
  2336 + return {
  2337 + restrict: 'E',
  2338 + templateUrl: '/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroupTemplate.html',
  2339 + scope: {
  2340 + model: "=" // 独立作用域,关联外部的模型object
  2341 + },
  2342 + controllerAs: '$saEmployeegroupCtrl',
  2343 + bindToController: true,
  2344 + controller: function($scope) {
  2345 + var self = this;
  2346 + self.$$data = []; // 选择线路后,该线路的人员配置数据
  2347 +
  2348 + // 测试数据
  2349 + //self.$$data = [
  2350 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},
  2351 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},
  2352 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}
  2353 + //];
  2354 +
  2355 + self.$$dataSelected = []; // 选中的人员配置列表
  2356 + self.$$dataSelectedStart = undefined; // 起始人员配置
  2357 +
  2358 + //self.$$dataSelected = [
  2359 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},
  2360 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},
  2361 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}
  2362 + //];
  2363 +
  2364 + self.$$isFB = false; // 是否分班
  2365 + self.$$dataFBSelected = []; // 选中的分班人员组配置列表
  2366 + self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识
  2367 + self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合
  2368 +
  2369 + //self.$$dataFBSelected = [
  2370 + // {isstart: true, group: [
  2371 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  2372 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  2373 + // ]},
  2374 + // {isstart: false, group: [
  2375 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  2376 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  2377 + // ]}
  2378 + //];
  2379 +
  2380 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  2381 + self.$$internalmodel = undefined;
  2382 +
  2383 + self.$$data_init = false; // *数据源初始化标志
  2384 + self.$$data_xl_first_init = false; // 线路是否初始化
  2385 + self.$$data_ry_first_init = false; // 人员配置是否初始化
  2386 + self.$$data_ry_first_data = undefined; // 人员配置初始化数据
  2387 + self.$$data_rycid_first_init = false; // 人员配置id是否初始化
  2388 + self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据
  2389 + self.$$data_rystart_first_init = false; // 起始人员是否初始化
  2390 + self.$$data_rystart_first_data = undefined; // 起始人员初始化数据
  2391 +
  2392 + },
  2393 +
  2394 + /**
  2395 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  2396 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  2397 + * @param tElem
  2398 + * @param tAttrs
  2399 + * @returns {{pre: Function, post: Function}}
  2400 + */
  2401 + compile: function(tElem, tAttrs) {
  2402 + // TODO:获取所有的属性
  2403 + var $name_attr = tAttrs["name"]; // 控件的名字
  2404 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  2405 + var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名
  2406 + var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名
  2407 + var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名
  2408 +
  2409 + // controlAs名字
  2410 + var ctrlAs = '$saEmployeegroupCtrl';
  2411 +
  2412 + // 如果有required属性,添加angularjs required验证
  2413 + if ($required_attr != undefined) {
  2414 + //console.log(tElem.html());
  2415 + tElem.find("div").attr("required", "");
  2416 + }
  2417 +
  2418 + return {
  2419 + pre: function(scope, element, attr) {
  2420 + // TODO:
  2421 + },
  2422 +
  2423 + /**
  2424 + * 相当于link函数。
  2425 + * @param scope
  2426 + * @param element
  2427 + * @param attr
  2428 + */
  2429 + post: function(scope, element, attr) {
  2430 + // name属性
  2431 + if ($name_attr) {
  2432 + scope[ctrlAs]["$name_attr"] = $name_attr;
  2433 + }
  2434 +
  2435 + /**
  2436 + * 人员配置列表点击(人员配置列表中选中路牌)
  2437 + * @param $index
  2438 + */
  2439 + scope[ctrlAs].$$internal_rylist_click = function($index) {
  2440 + var data_temp = scope[ctrlAs].$$data;
  2441 + if (data_temp && data_temp.length > $index) {
  2442 + if (!scope[ctrlAs].$$isFB) { // 不分班
  2443 + scope[ctrlAs].$$dataSelected.push({
  2444 + id : data_temp[$index].id,
  2445 + dbbm: data_temp[$index].dbbm,
  2446 + jsy: data_temp[$index].jsy,
  2447 + spy: data_temp[$index].spy,
  2448 + isstart: false
  2449 + });
  2450 +
  2451 + // 如果没有指定过初始人员,默认选择此人员作为起始人员
  2452 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  2453 + scope[ctrlAs].$$internal_selrylist_click(
  2454 + scope[ctrlAs].$$dataSelected.length - 1);
  2455 + }
  2456 + } else { // 分班
  2457 + if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员
  2458 + scope[ctrlAs].$$dataFBSelected
  2459 + [scope[ctrlAs].$$dataFBInternalSelected.gindex].group
  2460 + [scope[ctrlAs].$$dataFBInternalSelected.index] = {
  2461 + id : data_temp[$index].id,
  2462 + dbbm: data_temp[$index].dbbm,
  2463 + jsy: data_temp[$index].jsy,
  2464 + spy: data_temp[$index].spy,
  2465 + isselected: true
  2466 + };
  2467 +
  2468 + } else {
  2469 + scope[ctrlAs].$$dataFBSelected.push({
  2470 + isstart: false,
  2471 + group: [].concat(
  2472 + {
  2473 + id : data_temp[$index].id,
  2474 + dbbm: data_temp[$index].dbbm,
  2475 + jsy: data_temp[$index].jsy,
  2476 + spy: data_temp[$index].spy,
  2477 + isselected: false
  2478 + }, {
  2479 + id : data_temp[$index].id,
  2480 + dbbm: data_temp[$index].dbbm,
  2481 + jsy: data_temp[$index].jsy,
  2482 + spy: data_temp[$index].spy,
  2483 + isselected: false
  2484 + }
  2485 + )
  2486 + });
  2487 + if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {
  2488 + scope[ctrlAs].$$internal_selrygrouplist_click(
  2489 + scope[ctrlAs].$$dataFBSelected.length - 1);
  2490 + }
  2491 + }
  2492 + }
  2493 +
  2494 + }
  2495 + };
  2496 +
  2497 + /**
  2498 + * 选中的人员单击(初始人员选择)
  2499 + * @param $index
  2500 + */
  2501 + scope[ctrlAs].$$internal_selrylist_click = function($index) {
  2502 + var data_temp = scope[ctrlAs].$$dataSelected;
  2503 + if (data_temp && data_temp.length > $index) {
  2504 + for (var i = 0; i < data_temp.length; i++) {
  2505 + data_temp[i].isstart = false;
  2506 + }
  2507 + data_temp[$index].isstart = true;
  2508 + scope[ctrlAs].$$dataSelectedStart = $index;
  2509 + }
  2510 + };
  2511 + /**
  2512 + * 选中的人员双击(删除选中的人员)
  2513 + * @param $index
  2514 + */
  2515 + scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {
  2516 + var data_temp = scope[ctrlAs].$$dataSelected;
  2517 + if (data_temp && data_temp.length > $index) {
  2518 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  2519 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2520 + }
  2521 + data_temp.splice($index, 1);
  2522 + }
  2523 + };
  2524 +
  2525 + /**
  2526 + * 选中的分班组人员单击(初始人员选择)
  2527 + * @param $index
  2528 + */
  2529 + scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {
  2530 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2531 + if (data_temp && data_temp.length > $index) {
  2532 + for (var i = 0; i < data_temp.length; i++) {
  2533 + data_temp[i].isstart = false;
  2534 + for (var j = 0; j < data_temp[i].group.length; j++) {
  2535 + data_temp[i].group[j].isselected = false;
  2536 + }
  2537 + }
  2538 + data_temp[$index].isstart = true;
  2539 + scope[ctrlAs].$$dataFBSelectedStart = $index;
  2540 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  2541 + }
  2542 + };
  2543 + /**
  2544 + * 分组内部单击(选中分班中的某组人员)
  2545 + * @param $groupindex 组index
  2546 + * @param $index 组内部某个index
  2547 + * @param $event 事件防止冒泡
  2548 + */
  2549 + scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {
  2550 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2551 + if (data_temp && data_temp.length > $groupindex) {
  2552 + if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {
  2553 + // $$dataFBInternalSelected的格式如下:
  2554 + //{gindex: 1, index: 0}
  2555 + for (var i = 0; i < data_temp.length; i++) {
  2556 + data_temp[i].isstart = false;
  2557 + for (var j = 0; j < data_temp[i].group.length; j++) {
  2558 + data_temp[i].group[j].isselected = false;
  2559 + }
  2560 + }
  2561 + data_temp[$groupindex].group[$index].isselected = true;
  2562 + scope[ctrlAs].$$dataFBInternalSelected = {
  2563 + gindex: $groupindex, index: $index
  2564 + };
  2565 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2566 + $event.stopPropagation();
  2567 + }
  2568 + }
  2569 +
  2570 + };
  2571 + /**
  2572 + * 选中的分班人员双击(删除选中的人员)
  2573 + * @param $index
  2574 + */
  2575 + scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {
  2576 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2577 + if (data_temp && data_temp.length > $index) {
  2578 + if (scope[ctrlAs].$$dataFBSelectedStart == $index) {
  2579 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2580 + }
  2581 + if (scope[ctrlAs].$$dataFBInternalSelected &&
  2582 + scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {
  2583 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  2584 + }
  2585 + data_temp.splice($index, 1);
  2586 + }
  2587 + };
  2588 +
  2589 + /**
  2590 + * 验证内部数据,更新外部model
  2591 + */
  2592 + scope[ctrlAs].$$internal_validate_model = function() {
  2593 + var data_temp = scope[ctrlAs].$$dataSelected;
  2594 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  2595 + var data_temp3 = scope[ctrlAs].$$dataFBSelected;
  2596 + var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;
  2597 + var ryDbbms = [];
  2598 + var ryDbbm_group = [];
  2599 + var ryCids = [];
  2600 + var ryCid_group = [];
  2601 + var ryStart = 0;
  2602 + var i = 0;
  2603 + var j = 0;
  2604 +
  2605 + var isFB = scope[ctrlAs].$$isFB;
  2606 +
  2607 + if (isFB) {
  2608 + if (data_temp3 &&
  2609 + data_temp3.length > 0 &&
  2610 + data_temp4 != undefined) {
  2611 +
  2612 + for (i = 0; i < data_temp3.length; i++) {
  2613 + for (j = 0; j < data_temp3[i].group.length; j++) {
  2614 + ryDbbm_group.push(data_temp3[i].group[j].dbbm);
  2615 + ryCid_group.push(data_temp3[i].group[j].id);
  2616 + }
  2617 + ryDbbms.push(ryDbbm_group.join("-"));
  2618 + ryCids.push(ryCid_group.join("-"));
  2619 + ryDbbm_group = [];
  2620 + ryCid_group = [];
  2621 + }
  2622 +
  2623 + data_temp3[data_temp4].isstart = true;
  2624 + ryStart = data_temp4 + 1;
  2625 +
  2626 + // 更新内部model,用于外部验证
  2627 + // 内部model的值暂时随意,以后再改
  2628 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  2629 +
  2630 + // 更新外部model字段
  2631 + if ($dbbmrangename_attr) {
  2632 + console.log("dbbmrangename=" + ryDbbms.join(','));
  2633 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  2634 + }
  2635 + if (rycidrangename_attr) {
  2636 + console.log("rycidrangename=" + ryCids.join(','));
  2637 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  2638 + }
  2639 + if ($rystartname_attr) {
  2640 + console.log("rystartname=" + ryStart);
  2641 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  2642 + }
  2643 +
  2644 + } else {
  2645 + scope[ctrlAs].$$internalmodel = undefined;
  2646 + }
  2647 +
  2648 + } else {
  2649 + if (data_temp &&
  2650 + data_temp.length > 0 &&
  2651 + data_temp2 != undefined) {
  2652 +
  2653 + for (i = 0; i < data_temp.length; i++) {
  2654 + ryDbbms.push(data_temp[i].dbbm);
  2655 + ryCids.push(data_temp[i].id);
  2656 + }
  2657 + data_temp[data_temp2].isstart = true;
  2658 + ryStart = data_temp2 + 1;
  2659 +
  2660 + // 更新内部model,用于外部验证
  2661 + // 内部model的值暂时随意,以后再改
  2662 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  2663 +
  2664 + // 更新外部model字段
  2665 + if ($dbbmrangename_attr) {
  2666 + console.log("dbbmrangename=" + ryDbbms.join(','));
  2667 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  2668 + }
  2669 + if (rycidrangename_attr) {
  2670 + console.log("rycidrangename=" + ryCids.join(','));
  2671 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  2672 + }
  2673 + if ($rystartname_attr) {
  2674 + console.log("rystartname=" + ryStart);
  2675 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  2676 + }
  2677 +
  2678 + } else {
  2679 + scope[ctrlAs].$$internalmodel = undefined;
  2680 + }
  2681 + }
  2682 +
  2683 + };
  2684 +
  2685 + // 监控内部数据,$$dataSelected 变化
  2686 + scope.$watch(
  2687 + function() {
  2688 + return scope[ctrlAs].$$dataSelected;
  2689 + },
  2690 + function(newValue, oldValue) {
  2691 + scope[ctrlAs].$$internal_validate_model();
  2692 + },
  2693 + true
  2694 + );
  2695 +
  2696 + // 监控内部数据,$$dataSelectedStart 变化
  2697 + scope.$watch(
  2698 + function() {
  2699 + return scope[ctrlAs].$$dataSelectedStart;
  2700 + },
  2701 + function(newValue, oldValue) {
  2702 + scope[ctrlAs].$$internal_validate_model();
  2703 + },
  2704 + true
  2705 + );
  2706 +
  2707 +
  2708 + // 监控内部数据,$$dataFBSelected 变化
  2709 + scope.$watch(
  2710 + function() {
  2711 + return scope[ctrlAs].$$dataFBSelected;
  2712 + },
  2713 + function(newValue, oldValue) {
  2714 + scope[ctrlAs].$$internal_validate_model();
  2715 + },
  2716 + true
  2717 + );
  2718 +
  2719 + // 监控内部数据,$$dataFBSelectedStart 变化
  2720 + scope.$watch(
  2721 + function() {
  2722 + return scope[ctrlAs].$$dataFBSelectedStart;
  2723 + },
  2724 + function(newValue, oldValue) {
  2725 + scope[ctrlAs].$$internal_validate_model();
  2726 + },
  2727 + true
  2728 + );
  2729 +
  2730 + // 监控内部数据,$$dataFBInternalSelected 变化
  2731 + scope.$watch(
  2732 + function() {
  2733 + return scope[ctrlAs].$$dataFBInternalSelected;
  2734 + },
  2735 + function(newValue, oldValue) {
  2736 + scope[ctrlAs].$$internal_validate_model();
  2737 + },
  2738 + true
  2739 + );
  2740 +
  2741 + // 监控内部数据,$$isFB 变化
  2742 + scope.$watch(
  2743 + function() {
  2744 + return scope[ctrlAs].$$isFB;
  2745 + },
  2746 + function(newValue, oldValue) {
  2747 + scope[ctrlAs].$$internal_validate_model();
  2748 + },
  2749 + true
  2750 + );
  2751 +
  2752 + /**
  2753 + * 验证数据是否初始化完成,
  2754 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  2755 + */
  2756 + scope[ctrlAs].$$internal_validate_init = function() {
  2757 + var self = scope[ctrlAs];
  2758 + var data_temp = self.$$data;
  2759 + var dataSelect_temp = self.$$dataSelected;
  2760 + var dataFBSelect_temp = self.$$dataFBSelected;
  2761 + var dbbmnames = null;
  2762 + var dbbmnamegroup = null;
  2763 + var rycids = null;
  2764 + var rycidgroup = null;
  2765 +
  2766 + var i = 0;
  2767 + var j = 0;
  2768 + var k = 0;
  2769 +
  2770 + if (self.$$data_xl_first_init &&
  2771 + self.$$data_ry_first_init &&
  2772 + self.$$data_rycid_first_init &&
  2773 + self.$$data_rystart_first_init && !self.$$data_init) {
  2774 + console.log("开始初始化数据");
  2775 +
  2776 + // 判定是否分班,字符串中包含-就是了
  2777 + if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班
  2778 + self.$$isFB = true;
  2779 +
  2780 + // 搭班编码、人员配置id
  2781 + dbbmnames = self.$$data_ry_first_data.split(",");
  2782 + rycids = self.$$data_rycid_first_data.split(",");
  2783 + for (i = 0; i < dbbmnames.length; i++) {
  2784 + dataFBSelect_temp.push({
  2785 + group: [],
  2786 + isstart: false
  2787 + });
  2788 + dbbmnamegroup = dbbmnames[i].split("-");
  2789 + rycidgroup = rycids[i].split("-");
  2790 +
  2791 + for (k = 0; k < dbbmnamegroup.length; k++) {
  2792 + dataFBSelect_temp[i].group.push({
  2793 + id: rycidgroup[k],
  2794 + dbbm: dbbmnamegroup[k],
  2795 + isselected: false
  2796 + });
  2797 +
  2798 + for (j = 0; j < data_temp.length; j++) {
  2799 + if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {
  2800 + dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;
  2801 + dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;
  2802 + break;
  2803 + }
  2804 + }
  2805 + }
  2806 +
  2807 + }
  2808 +
  2809 + // 初始人员
  2810 + scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;
  2811 +
  2812 +
  2813 + } else if (dataSelect_temp.length == 0) {
  2814 + self.$$isFB = false;
  2815 +
  2816 + // 搭班编码、人员配置id
  2817 + dbbmnames = self.$$data_ry_first_data.split(",");
  2818 + rycids = self.$$data_rycid_first_data.split(",");
  2819 + for (i = 0; i < dbbmnames.length; i++) {
  2820 + dataSelect_temp.push({
  2821 + id: rycids[i],
  2822 + dbbm: dbbmnames[i],
  2823 + isstart: false
  2824 + });
  2825 + for (j = 0; j < data_temp.length; j++) {
  2826 + if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {
  2827 + dataSelect_temp[i].jsy = data_temp[j].jsy;
  2828 + dataSelect_temp[i].spy = data_temp[j].spy;
  2829 + break;
  2830 + }
  2831 + }
  2832 + }
  2833 + // 初始人员
  2834 + scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1;
  2835 +
  2836 + }
  2837 +
  2838 + console.log("数据初始化完毕!");
  2839 + self.$$data_init = true;
  2840 + }
  2841 +
  2842 + };
  2843 +
  2844 + // 监控初始化标志,线路,人员,起始人员
  2845 + scope.$watch(
  2846 + function() {
  2847 + return scope[ctrlAs].$$data_xl_first_init;
  2848 + },
  2849 + function(newValue, oldValue) {
  2850 + scope[ctrlAs].$$internal_validate_init();
  2851 + }
  2852 + );
  2853 + scope.$watch(
  2854 + function() {
  2855 + return scope[ctrlAs].$$data_ry_first_init;
  2856 + },
  2857 + function(newValue, oldValue) {
  2858 + scope[ctrlAs].$$internal_validate_init();
  2859 + }
  2860 + );
  2861 + scope.$watch(
  2862 + function() {
  2863 + return scope[ctrlAs].$$data_rycid_first_init;
  2864 + },
  2865 + function(newValue, oldValue) {
  2866 + scope[ctrlAs].$$internal_validate_init();
  2867 + }
  2868 + );
  2869 + scope.$watch(
  2870 + function() {
  2871 + return scope[ctrlAs].$$data_rystart_first_init;
  2872 + },
  2873 + function(newValue, oldValue) {
  2874 + scope[ctrlAs].$$internal_validate_init();
  2875 + }
  2876 + );
  2877 +
  2878 +
  2879 + // 监控线路id的变化
  2880 + attr.$observe("xlidvalue", function(value) {
  2881 + if (value && value != "") {
  2882 + console.log("xlidvalue=" + value);
  2883 +
  2884 + employeeConfigService_g.rest.list(
  2885 + {"xl.id_eq": value, "isCancel_eq" : false, size: 100},
  2886 + function(result) {
  2887 + // 获取值了
  2888 + console.log("人员配置获取了");
  2889 +
  2890 + scope[ctrlAs].$$data = [];
  2891 + for (var i = 0; i < result.content.length; i++) {
  2892 + scope[ctrlAs].$$data.push({
  2893 + id: result.content[i].id,
  2894 + dbbm: result.content[i].dbbm,
  2895 + jsy: result.content[i].jsy.personnelName,
  2896 + spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName
  2897 + });
  2898 + }
  2899 + if (scope[ctrlAs].$$data_init) {
  2900 + scope[ctrlAs].$$dataSelected = [];
  2901 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2902 +
  2903 + scope[ctrlAs].$$dataFBSelected = [];
  2904 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  2905 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2906 +
  2907 + scope[ctrlAs].$$internalmodel = undefined;
  2908 + }
  2909 + scope[ctrlAs].$$data_xl_first_init = true;
  2910 + },
  2911 + function(result) {
  2912 +
  2913 + }
  2914 + );
  2915 +
  2916 + }
  2917 + });
  2918 +
  2919 + // 监控搭班编码范围值的变化
  2920 + attr.$observe("dbbmrangevalue", function(value) {
  2921 + if (value && value != "") {
  2922 + console.log("dbbmrangevalue变换了");
  2923 + scope[ctrlAs].$$data_ry_first_init = true;
  2924 + scope[ctrlAs].$$data_ry_first_data = value;
  2925 + }
  2926 + });
  2927 +
  2928 + // 监控人员配置id范围值的变化
  2929 + attr.$observe("rycidrangevalue", function(value) {
  2930 + if (value && value != "") {
  2931 + console.log("rycidrangevalue变换了");
  2932 + scope[ctrlAs].$$data_rycid_first_init = true;
  2933 + scope[ctrlAs].$$data_rycid_first_data = value;
  2934 + }
  2935 + });
  2936 +
  2937 + // 监控起始人员的变化
  2938 + attr.$observe("rystartvalue", function(value) {
  2939 + if (value && value != "") {
  2940 + console.log("rystartvalue变换了");
  2941 + scope[ctrlAs].$$data_rystart_first_init = true;
  2942 + scope[ctrlAs].$$data_rystart_first_data = value;
  2943 + }
  2944 + });
  2945 +
  2946 + }
  2947 + }
  2948 +
  2949 + }
  2950 + }
  2951 + }
  2952 +]);
  2953 +
  2954 +
  2955 +/**
  2956 + * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
  2957 + * 属性如下:
  2958 + * name(必须):控件的名字
  2959 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  2960 + * bcttinfoidsvalue(必须):绑定的model班次ids字段值,如:bcttinfoidsvalue={{ctrl.employeeInfoForSave.lprange}}
  2961 + * bcttinfoidsname(必须):bind的model班次ids字段名,如:bcttinfoidsname=lprange
  2962 + * dataparams (必须):内部数据关联的查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  2963 + * required(可选):是否要用required验证
  2964 + *
  2965 + */
  2966 +angular.module('ScheduleApp').directive('saBcgroup', [
  2967 + 'TimeTableDetailManageService_g',
  2968 + function(timeTableDetailManageService_g) {
  2969 + return {
  2970 + restrict: 'E',
  2971 + templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroupTemplate.html',
  2972 + scope: {
  2973 + model: "=" // 独立作用域,关联外部的模型object
  2974 + },
  2975 + controllerAs: '$saBcgroupCtrl',
  2976 + bindToController: true,
  2977 + controller: function($scope) {
  2978 + var self = this;
  2979 + self.$$data = []; // 选择线路,时刻表,路牌后的班次列表
  2980 +
  2981 + // 测试数据
  2982 + //self.$$data = [
  2983 + // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
  2984 + // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
  2985 + // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
  2986 + //];
  2987 +
  2988 +
  2989 + self.$$dataSelected = []; // 套跑选中的班次列表
  2990 +
  2991 + //self.$$dataSelected = [
  2992 + // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
  2993 + // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
  2994 + // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
  2995 + //];
  2996 +
  2997 + // saBcgroup组件的ng-model,用于外部绑定等操作
  2998 + self.$$internalmodel = undefined;
  2999 +
  3000 + self.$$data_bcdata_first_init = false; // 班次数据首次初始化标志
  3001 + self.$$data_bcttinfoids_first_init = false; // 班次ids数据首次初始化标志
  3002 + self.$$data_bcttinfoids_first_data = undefined; // 班次ids数据首次初始化数据
  3003 +
  3004 + },
  3005 +
  3006 + /**
  3007 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  3008 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  3009 + * @param tElem
  3010 + * @param tAttrs
  3011 + * @returns {{pre: Function, post: Function}}
  3012 + */
  3013 + compile: function(tElem, tAttrs) {
  3014 + // TODO:获取所有的属性
  3015 + var $name_attr = tAttrs["name"]; // 控件的名字
  3016 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  3017 + var $bcttinfoidsname_attr = tAttrs["bcttinfoidsname"]; // bind的model班次ids字段名
  3018 +
  3019 + // controlAs名字
  3020 + var ctrlAs = '$saBcgroupCtrl';
  3021 +
  3022 + // 如果有required属性,添加angularjs required验证
  3023 + if ($required_attr != undefined) {
  3024 + //console.log(tElem.html());
  3025 + tElem.find("div").attr("required", "");
  3026 + }
  3027 +
  3028 + return {
  3029 + pre: function(scope, element, attr) {
  3030 + // TODO:
  3031 + },
  3032 +
  3033 + /**
  3034 + * 相当于link函数。
  3035 + * @param scope
  3036 + * @param element
  3037 + * @param attr
  3038 + */
  3039 + post: function(scope, element, attr) {
  3040 + // name属性
  3041 + if ($name_attr) {
  3042 + scope[ctrlAs]["$name_attr"] = $name_attr;
  3043 + }
  3044 +
  3045 + // TODO:
  3046 +
  3047 +
  3048 + /**
  3049 + * 班次列表点击(班次列表中选中班次)
  3050 + * @param $index
  3051 + */
  3052 + scope[ctrlAs].$$internal_bclist_click = function($index) {
  3053 + var data_temp = scope[ctrlAs].$$data;
  3054 + var data_temp2 = scope[ctrlAs].$$dataSelected;
  3055 + var i = 0;
  3056 + var isunique = true; // 是否已经选择过
  3057 + if (data_temp && data_temp.length > $index) {
  3058 + for (i = 0; i < data_temp2.length; i++) {
  3059 + if (data_temp2[i].bcttinfoid == data_temp[$index].bcttinfoid) {
  3060 + isunique = false;
  3061 + break;
  3062 + }
  3063 + }
  3064 + if (isunique) {
  3065 + data_temp2.push({
  3066 + bcttinfoid: data_temp[$index].bcttinfoid,
  3067 + bcfcsj: data_temp[$index].bcfcsj,
  3068 + bctype: data_temp[$index].bctype
  3069 + });
  3070 + }
  3071 +
  3072 + }
  3073 + };
  3074 + /**
  3075 + * 选中的班次双击(删除选中的班次)
  3076 + * @param $index
  3077 + */
  3078 + scope[ctrlAs].$$internal_selbclist_dbclick = function($index) {
  3079 + var data_temp = scope[ctrlAs].$$dataSelected;
  3080 + if (data_temp && data_temp.length > $index) {
  3081 + data_temp.splice($index, 1);
  3082 + }
  3083 + };
  3084 +
  3085 +
  3086 + /**
  3087 + * 验证内部数据,更新外部model
  3088 + */
  3089 + scope[ctrlAs].$$internal_validate_model = function() {
  3090 + var data_temp = scope[ctrlAs].$$dataSelected;
  3091 + var bcttinfoIds = [];
  3092 + var i = 0;
  3093 +
  3094 + if (data_temp &&
  3095 + data_temp.length > 0) {
  3096 +
  3097 + for (i = 0; i < data_temp.length; i++) {
  3098 + bcttinfoIds.push(data_temp[i].bcttinfoid);
  3099 + }
  3100 +
  3101 + // 更新外部model字段
  3102 + if ($bcttinfoidsname_attr) {
  3103 + console.log("bcttinfoidsname=" + bcttinfoIds.join(','));
  3104 + eval("scope[ctrlAs].model" + "." + $bcttinfoidsname_attr + " = bcttinfoIds.join(',');");
  3105 + }
  3106 +
  3107 + // 更新内部model,用于外部验证
  3108 + // 内部model的值暂时随意,以后再改
  3109 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  3110 +
  3111 + scope[ctrlAs].$$data_bcdata_first_init = true;
  3112 + scope[ctrlAs].$$data_bcttinfoids_first_init = true;
  3113 +
  3114 + } else {
  3115 + scope[ctrlAs].$$internalmodel = undefined;
  3116 + }
  3117 +
  3118 + };
  3119 +
  3120 + // 监控内部数据,$$data_selected 变化
  3121 + scope.$watch(
  3122 + function() {
  3123 + console.log("长度:" + scope[ctrlAs].$$dataSelected.length);
  3124 + return scope[ctrlAs].$$dataSelected;
  3125 + },
  3126 + function(newValue, oldValue) {
  3127 + scope[ctrlAs].$$internal_validate_model();
  3128 + },
  3129 + true
  3130 + );
  3131 +
  3132 + /**
  3133 + * 验证数据是否初始化完成,
  3134 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  3135 + */
  3136 + scope[ctrlAs].$$internal_validate_init = function() {
  3137 + var self = scope[ctrlAs];
  3138 +
  3139 + var data_temp = self.$$data;
  3140 + var dataSelect_temp = self.$$dataSelected;
  3141 + var bcttinfoids = null;
  3142 +
  3143 + var i = 0;
  3144 + var j = 0;
  3145 +
  3146 + if (self.$$data_bcdata_first_init &&
  3147 + self.$$data_bcttinfoids_first_init) {
  3148 + console.log("开始初始化数据");
  3149 +
  3150 + bcttinfoids = self.$$data_bcttinfoids_first_data ? self.$$data_bcttinfoids_first_data.split(",") : [];
  3151 +
  3152 + for (i = 0; i < bcttinfoids.length; i++) {
  3153 + dataSelect_temp.push({
  3154 + bcttinfoid: bcttinfoids[i]
  3155 + });
  3156 + for (j = 0; j < data_temp.length; j++) {
  3157 + if (dataSelect_temp[i].bcttinfoid == data_temp[j].bcttinfoid) {
  3158 + dataSelect_temp[i].bcfcsj = data_temp[j].bcfcsj;
  3159 + dataSelect_temp[i].bctype = data_temp[j].bctype;
  3160 + break;
  3161 + }
  3162 + }
  3163 + }
  3164 +
  3165 + console.log("数据初始化完毕!");
  3166 + }
  3167 +
  3168 + };
  3169 +
  3170 + // 监控初始化标志
  3171 + scope.$watch(
  3172 + function() {
  3173 + return scope[ctrlAs].$$data_bcdata_first_init;
  3174 + },
  3175 + function(newValue, oldValue) {
  3176 + scope[ctrlAs].$$internal_validate_init();
  3177 + }
  3178 + );
  3179 + scope.$watch(
  3180 + function() {
  3181 + return scope[ctrlAs].$$data_bcttinfoids_first_init;
  3182 + },
  3183 + function(newValue, oldValue) {
  3184 + scope[ctrlAs].$$internal_validate_init();
  3185 + }
  3186 + );
  3187 +
  3188 + // 监控内部数据的变化
  3189 + attr.$observe("dataparams", function(value) {
  3190 + if (value && value != "") {
  3191 + if (value == '{}') {
  3192 + return;
  3193 + }
  3194 +
  3195 + console.log("bcgroup observe 监控 dataparams=" + value);
  3196 +
  3197 + timeTableDetailManageService_g.bcdetails.list(
  3198 + JSON.parse(value),
  3199 + function(result) {
  3200 + // 获取值了
  3201 + console.log("内部班次数据获取了");
  3202 +
  3203 + scope[ctrlAs].$$data = [];
  3204 + for (var i = 0; i < result.length; i++) {
  3205 + scope[ctrlAs].$$data.push({
  3206 + bcttinfoid: result[i].id,
  3207 + bcfcsj: result[i].fcsj,
  3208 + bctype: result[i].bcType
  3209 + });
  3210 + }
  3211 + if (scope[ctrlAs].$$data_bcdata_first_init &&
  3212 + scope[ctrlAs].$$data_bcttinfoids_first_init) {
  3213 +
  3214 + scope[ctrlAs].$$dataSelected = [];
  3215 + scope[ctrlAs].$$internalmodel = undefined;
  3216 + }
  3217 + scope[ctrlAs].$$data_bcdata_first_init = true;
  3218 + },
  3219 + function(result) {
  3220 +
  3221 + }
  3222 + );
  3223 + }
  3224 + });
  3225 + // 监控班次ids数据的变化
  3226 + attr.$observe("bcttinfoidsvalue", function(value) {
  3227 + if (value && value != "") {
  3228 + console.log("observe 监控 bcttinfoidsvalue=" + value);
  3229 + scope[ctrlAs].$$data_bcttinfoids_first_init = true;
  3230 + scope[ctrlAs].$$data_bcttinfoids_first_data = value;
  3231 + }
  3232 + });
  3233 +
  3234 + }
  3235 + }
  3236 +
  3237 + }
  3238 + }
  3239 + }
3240 3240 ]);
3241 3241 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
1   -// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
2   -
3   -// 文件下载服务
4   -angular.module('ScheduleApp').factory('FileDownload_g', function() {
5   - return {
6   - downloadFile: function (data, mimeType, fileName) {
7   - var success = false;
8   - var blob = new Blob([data], { type: mimeType });
9   - try {
10   - if (navigator.msSaveBlob)
11   - navigator.msSaveBlob(blob, fileName);
12   - else {
13   - // Try using other saveBlob implementations, if available
14   - var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
15   - if (saveBlob === undefined) throw "Not supported";
16   - saveBlob(blob, fileName);
17   - }
18   - success = true;
19   - } catch (ex) {
20   - console.log("saveBlob method failed with the following exception:");
21   - console.log(ex);
22   - }
23   -
24   - if (!success) {
25   - // Get the blob url creator
26   - var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
27   - if (urlCreator) {
28   - // Try to use a download link
29   - var link = document.createElement('a');
30   - if ('download' in link) {
31   - // Try to simulate a click
32   - try {
33   - // Prepare a blob URL
34   - var url = urlCreator.createObjectURL(blob);
35   - link.setAttribute('href', url);
36   -
37   - // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
38   - link.setAttribute("download", fileName);
39   -
40   - // Simulate clicking the download link
41   - var event = document.createEvent('MouseEvents');
42   - event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
43   - link.dispatchEvent(event);
44   - success = true;
45   -
46   - } catch (ex) {
47   - console.log("Download link method with simulated click failed with the following exception:");
48   - console.log(ex);
49   - }
50   - }
51   -
52   - if (!success) {
53   - // Fallback to window.location method
54   - try {
55   - // Prepare a blob URL
56   - // Use application/octet-stream when using window.location to force download
57   - var url = urlCreator.createObjectURL(blob);
58   - window.location = url;
59   - console.log("Download link method with window.location succeeded");
60   - success = true;
61   - } catch (ex) {
62   - console.log("Download link method with window.location failed with the following exception:");
63   - console.log(ex);
64   - }
65   - }
66   - }
67   - }
68   -
69   - if (!success) {
70   - // Fallback to window.open method
71   - console.log("No methods worked for saving the arraybuffer, using last resort window.open");
72   - window.open("", '_blank', '');
73   - }
74   - }
75   - };
76   -});
77   -
78   -// 车辆信息service
79   -angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
80   - return {
81   - rest: $resource(
82   - '/cars/:id',
83   - {order: 'carCode', direction: 'ASC', id: '@id_route'},
84   - {
85   - list: {
86   - method: 'GET',
87   - params: {
88   - page: 0
89   - }
90   - },
91   - get: {
92   - method: 'GET'
93   - },
94   - save: {
95   - method: 'POST'
96   - }
97   - }
98   - ),
99   - validate: $resource(
100   - '/cars/validate/:type',
101   - {},
102   - {
103   - insideCode: {
104   - method: 'GET'
105   - }
106   - }
107   - ),
108   - dataTools: $resource(
109   - '/cars/:type',
110   - {},
111   - {
112   - dataExport: {
113   - method: 'GET',
114   - responseType: "arraybuffer",
115   - params: {
116   - type: "dataExport"
117   - },
118   - transformResponse: function(data, headers){
119   - return {data : data};
120   - }
121   - }
122   - }
123   - )
124   - };
125   -}]);
126   -// 人员信息service
127   -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
128   - return {
129   - rest : $resource(
130   - '/personnel/:id',
131   - {order: 'jobCode', direction: 'ASC', id: '@id_route'},
132   - {
133   - list: {
134   - method: 'GET',
135   - params: {
136   - page: 0
137   - }
138   - },
139   - get: {
140   - method: 'GET'
141   - },
142   - save: {
143   - method: 'POST'
144   - }
145   - }
146   - ),
147   - validate: $resource(
148   - '/personnel/validate/:type',
149   - {},
150   - {
151   - jobCode: {
152   - method: 'GET'
153   - }
154   - }
155   - ),
156   - dataTools: $resource(
157   - '/personnel/:type',
158   - {},
159   - {
160   - dataExport: {
161   - method: 'GET',
162   - responseType: "arraybuffer",
163   - params: {
164   - type: "dataExport"
165   - },
166   - transformResponse: function(data, headers){
167   - return {data : data};
168   - }
169   - }
170   - }
171   - )
172   - };
173   -}]);
174   -// 车辆设备信息service
175   -angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
176   - return $resource(
177   - '/cde/:id',
178   - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
179   - {
180   - list: {
181   - method: 'GET',
182   - params: {
183   - page: 0
184   - }
185   - },
186   - get: {
187   - method: 'GET'
188   - },
189   - save: {
190   - method: 'POST'
191   - },
192   - delete: {
193   - method: 'DELETE'
194   - }
195   - }
196   - );
197   -}]);
198   -
199   -// 车辆配置service
200   -angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
201   - return {
202   - rest : $resource(
203   - '/cci/:id',
204   - {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
205   - {
206   - list: {
207   - method: 'GET',
208   - params: {
209   - page: 0
210   - }
211   - },
212   - get: {
213   - method: 'GET'
214   - },
215   - save: {
216   - method: 'POST'
217   - }
218   - }
219   - )
220   - };
221   -}]);
222   -
223   -// 人员配置service
224   -angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
225   - return {
226   - rest : $resource(
227   - '/eci/:id',
228   - {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
229   - {
230   - list: {
231   - method: 'GET',
232   - params: {
233   - page: 0
234   - }
235   - },
236   - get: {
237   - method: 'GET'
238   - },
239   - save: {
240   - method: 'POST'
241   - },
242   - delete: {
243   - method: 'DELETE'
244   - }
245   - }
246   - ),
247   - validate: $resource( // TODO:
248   - '/personnel/validate/:type',
249   - {},
250   - {
251   - jobCode: {
252   - method: 'GET'
253   - }
254   - }
255   - )
256   - };
257   -}]);
258   -
259   -// 路牌管理service
260   -angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
261   - return {
262   - rest: $resource(
263   - '/gic/:id',
264   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
265   - {
266   - list: {
267   - method: 'GET',
268   - params: {
269   - page: 0
270   - }
271   - },
272   - get: {
273   - method: 'GET'
274   - },
275   - save: {
276   - method: 'POST'
277   - }
278   - }
279   - )
280   - };
281   -}]);
282   -
283   -// 排班管理service
284   -angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
285   - return {
286   - rest: $resource(
287   - '/sr1fc/:id',
288   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
289   - {
290   - list: {
291   - method: 'GET',
292   - params: {
293   - page: 0
294   - }
295   - },
296   - get: {
297   - method: 'GET'
298   - },
299   - save: {
300   - method: 'POST'
301   - },
302   - delete: {
303   - method: 'DELETE'
304   - }
305   - }
306   - )
307   - };
308   -}]);
309   -
310   -// 套跑管理service
311   -angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {
312   - return {
313   - rest: $resource(
314   - 'rms/:id',
315   - {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},
316   - {
317   - list: {
318   - method: 'GET',
319   - params: {
320   - page: 0
321   - }
322   - },
323   - get: {
324   - method: 'GET'
325   - },
326   - save: {
327   - method: 'POST'
328   - },
329   - delete: {
330   - method: 'DELETE'
331   - }
332   - }
333   - )
334   - };
335   -}]);
336   -
337   -// 时刻表管理service
338   -angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
339   - return {
340   - rest: $resource(
341   - '/tic/:id',
342   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
343   - {
344   - list: {
345   - method: 'GET',
346   - params: {
347   - page: 0,
348   - isCancel_eq: 'false'
349   - }
350   - },
351   - get: {
352   - method: 'GET'
353   - },
354   - save: {
355   - method: 'POST'
356   - },
357   - delete: {
358   - method: 'DELETE'
359   - }
360   - }
361   - ),
362   - validate: $resource(
363   - '/tic/validate/:type',
364   - {},
365   - {
366   - ttinfoname: {
367   - method: 'GET'
368   - }
369   - }
370   - )
371   - };
372   -}]);
373   -// 时刻表明细管理service
374   -angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
375   - return {
376   - rest: $resource(
377   - '/tidc/:id',
378   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
379   - {
380   - get: {
381   - method: 'GET'
382   - },
383   - save: {
384   - method: 'POST'
385   - }
386   - }
387   - ),
388   - edit: $resource(
389   - '/tidc/edit/:xlid/:ttid',
390   - {},
391   - {
392   - list: {
393   - method: 'GET'
394   - }
395   - }
396   - ),
397   - bcdetails: $resource(
398   - '/tidc/bcdetail',
399   - {},
400   - {
401   - list: {
402   - method: 'GET',
403   - isArray: true
404   - }
405   - }
406   - )
407   - };
408   -}]);
409   -
410   -
411   -
412   -// 排班计划管理service
413   -angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {
414   - return {
415   - rest : $resource(
416   - '/spc/:id',
417   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
418   - {
419   - list: {
420   - method: 'GET',
421   - params: {
422   - page: 0
423   - }
424   - },
425   - get: {
426   - method: 'GET'
427   - },
428   - save: {
429   - method: 'POST'
430   - },
431   - delete: {
432   - method: 'DELETE'
433   - }
434   - }
435   - ),
436   - tommorw: $resource(
437   - '/spc/tommorw',
438   - {},
439   - {
440   - list: {
441   - method: 'GET'
442   - }
443   - }
444   - )
445   - };
446   -}]);
447   -
448   -// 排班计划明细管理service
449   -angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {
450   - return {
451   - rest : $resource(
452   - '/spic/:id',
453   - {order: 'scheduleDate,lp,fcno', direction: 'ASC', id: '@id_route'},
454   - {
455   - list: {
456   - method: 'GET',
457   - params: {
458   - page: 0
459   - }
460   - },
461   - get: {
462   - method: 'GET'
463   - },
464   - save: {
465   - method: 'POST'
466   - }
467   - }
468   - ),
469   - groupinfo : $resource(
470   - '/spic/groupinfos/:xlid/:sdate',
471   - {},
472   - {
473   - list: {
474   - method: 'GET',
475   - isArray: true
476   - }
477   - }
478   - ),
479   - updateGroupInfo : $resource(
480   - '/spic/groupinfos/update',
481   - {},
482   - {
483   - update: {
484   - method: 'POST'
485   - }
486   - }
487   - )
488   - };
489   -}]);
490   -
491   -// 线路运营统计service
492   -angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
493   - return $resource(
494   - '/bic/:id',
495   - {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
496   - {
497   - list: {
498   - method: 'GET',
499   - params: {
500   - page: 0
501   - }
502   - }
503   - }
504   - );
505   -}]);
506   -
507   -
508   -
509   -
510   -/**
511   - * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
512   - * 1、compile阶段使用的属性如下:
513   - * required:用于和表单验证连接,指定成required="true"才有效。
514   - * 2、link阶段使用的属性如下
515   - * model:关联的模型对象
516   - * name:表单验证时需要的名字
517   - * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
518   - * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
519   - * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
520   - * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
521   - * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
522   - * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
523   - * placeholder:select placeholder字符串描述
524   - *
525   - * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
526   - * $$SearchInfoService_g,内部使用的数据服务
527   - */
528   -// saSelect2指令使用的内部信service
529   -angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
530   - return {
531   - xl: $resource(
532   - '/line/:type',
533   - {order: 'name', direction: 'ASC'},
534   - {
535   - list: {
536   - method: 'GET',
537   - isArray: true
538   - }
539   - }
540   - ),
541   - zd: $resource(
542   - '/stationroute/stations',
543   - {order: 'stationCode', direction: 'ASC'},
544   - {
545   - list: {
546   - method: 'GET',
547   - isArray: true
548   - }
549   - }
550   - ),
551   - tcc: $resource(
552   - '/carpark/:type',
553   - {order: 'parkCode', direction: 'ASC'},
554   - {
555   - list: {
556   - method: 'GET',
557   - isArray: true
558   - }
559   - }
560   - ),
561   - ry: $resource(
562   - '/personnel/:type',
563   - {order: 'personnelName', direction: 'ASC'},
564   - {
565   - list: {
566   - method: 'GET',
567   - isArray: true
568   - }
569   - }
570   - ),
571   - cl: $resource(
572   - '/cars/:type',
573   - {order: "insideCode", direction: 'ASC'},
574   - {
575   - list: {
576   - method: 'GET',
577   - isArray: true
578   - }
579   - }
580   - ),
581   - ttInfo: $resource(
582   - '/tic/:type',
583   - {order: "name", direction: 'ASC'},
584   - {
585   - list: {
586   - method: 'GET',
587   - isArray: true
588   - }
589   - }
590   - ),
591   - lpInfo: $resource(
592   - '/gic/ttlpnames',
593   - {order: "lpName", direction: 'ASC'},
594   - {
595   - list: {
596   - method: 'GET',
597   - isArray: true
598   - }
599   - }
600   - ),
601   - lpInfo2: $resource(
602   - '/gic/:type',
603   - {order: "lpName", direction: 'ASC'},
604   - {
605   - list: {
606   - method: 'GET',
607   - isArray: true
608   - }
609   - }
610   - ),
611   - cci: $resource(
612   - '/cci/cars',
613   - {},
614   - {
615   - list: {
616   - method: 'GET',
617   - isArray: true
618   - }
619   - }
620   -
621   - ),
622   - cci2: $resource(
623   - '/cci/:type',
624   - {},
625   - {
626   - list: {
627   - method: 'GET',
628   - isArray: true
629   - }
630   - }
631   - ),
632   - cci3: $resource(
633   - '/cci/cars2',
634   - {},
635   - {
636   - list: {
637   - method: 'GET',
638   - isArray: true
639   - }
640   - }
641   -
642   - ),
643   - eci: $resource(
644   - '/eci/jsy',
645   - {},
646   - {
647   - list: {
648   - method: 'GET',
649   - isArray: true
650   - }
651   - }
652   - ),
653   - eci2: $resource(
654   - '/eci/spy',
655   - {},
656   - {
657   - list: {
658   - method: 'GET',
659   - isArray: true
660   - }
661   - }
662   - ),
663   - eci3: $resource(
664   - '/eci/:type',
665   - {},
666   - {
667   - list: {
668   - method: 'GET',
669   - isArray: true
670   - }
671   - }
672   - ),
673   -
674   -
675   - validate: { // remoteValidation指令用到的resource
676   - cl1: { // 车辆自编号不能重复验证
677   - template: {'insideCode_eq': '-1'}, // 查询参数模版
678   - remote: $resource( // $resource封装对象
679   - '/cars/validate/equale',
680   - {},
681   - {
682   - do: {
683   - method: 'GET'
684   - }
685   - }
686   - )
687   - },
688   - cde1: { // 车辆设备启用日期验证
689   - template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
690   - remote: $resource( // $resource封装对象
691   - '/cde//validate/qyrq',
692   - {},
693   - {
694   - do: {
695   - method: 'GET'
696   - }
697   - }
698   - )
699   - }
700   - }
701   -
702   - //validate: $resource(
703   - // '/cars/validate/:type',
704   - // {},
705   - // {
706   - // insideCode: {
707   - // method: 'GET'
708   - // }
709   - // }
710   - //)
711   -
712   -
713   -
714   - }
715   -}]);
716   -
717   -
718   -
  1 +// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
  2 +
  3 +// 文件下载服务
  4 +angular.module('ScheduleApp').factory('FileDownload_g', function() {
  5 + return {
  6 + downloadFile: function (data, mimeType, fileName) {
  7 + var success = false;
  8 + var blob = new Blob([data], { type: mimeType });
  9 + try {
  10 + if (navigator.msSaveBlob)
  11 + navigator.msSaveBlob(blob, fileName);
  12 + else {
  13 + // Try using other saveBlob implementations, if available
  14 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  15 + if (saveBlob === undefined) throw "Not supported";
  16 + saveBlob(blob, fileName);
  17 + }
  18 + success = true;
  19 + } catch (ex) {
  20 + console.log("saveBlob method failed with the following exception:");
  21 + console.log(ex);
  22 + }
  23 +
  24 + if (!success) {
  25 + // Get the blob url creator
  26 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  27 + if (urlCreator) {
  28 + // Try to use a download link
  29 + var link = document.createElement('a');
  30 + if ('download' in link) {
  31 + // Try to simulate a click
  32 + try {
  33 + // Prepare a blob URL
  34 + var url = urlCreator.createObjectURL(blob);
  35 + link.setAttribute('href', url);
  36 +
  37 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  38 + link.setAttribute("download", fileName);
  39 +
  40 + // Simulate clicking the download link
  41 + var event = document.createEvent('MouseEvents');
  42 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  43 + link.dispatchEvent(event);
  44 + success = true;
  45 +
  46 + } catch (ex) {
  47 + console.log("Download link method with simulated click failed with the following exception:");
  48 + console.log(ex);
  49 + }
  50 + }
  51 +
  52 + if (!success) {
  53 + // Fallback to window.location method
  54 + try {
  55 + // Prepare a blob URL
  56 + // Use application/octet-stream when using window.location to force download
  57 + var url = urlCreator.createObjectURL(blob);
  58 + window.location = url;
  59 + console.log("Download link method with window.location succeeded");
  60 + success = true;
  61 + } catch (ex) {
  62 + console.log("Download link method with window.location failed with the following exception:");
  63 + console.log(ex);
  64 + }
  65 + }
  66 + }
  67 + }
  68 +
  69 + if (!success) {
  70 + // Fallback to window.open method
  71 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  72 + window.open("", '_blank', '');
  73 + }
  74 + }
  75 + };
  76 +});
  77 +
  78 +// 车辆信息service
  79 +angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
  80 + return {
  81 + rest: $resource(
  82 + '/cars/:id',
  83 + {order: 'carCode', direction: 'ASC', id: '@id_route'},
  84 + {
  85 + list: {
  86 + method: 'GET',
  87 + params: {
  88 + page: 0
  89 + }
  90 + },
  91 + get: {
  92 + method: 'GET'
  93 + },
  94 + save: {
  95 + method: 'POST'
  96 + }
  97 + }
  98 + ),
  99 + validate: $resource(
  100 + '/cars/validate/:type',
  101 + {},
  102 + {
  103 + insideCode: {
  104 + method: 'GET'
  105 + }
  106 + }
  107 + ),
  108 + dataTools: $resource(
  109 + '/cars/:type',
  110 + {},
  111 + {
  112 + dataExport: {
  113 + method: 'GET',
  114 + responseType: "arraybuffer",
  115 + params: {
  116 + type: "dataExport"
  117 + },
  118 + transformResponse: function(data, headers){
  119 + return {data : data};
  120 + }
  121 + }
  122 + }
  123 + )
  124 + };
  125 +}]);
  126 +// 人员信息service
  127 +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
  128 + return {
  129 + rest : $resource(
  130 + '/personnel/:id',
  131 + {order: 'jobCode', direction: 'ASC', id: '@id_route'},
  132 + {
  133 + list: {
  134 + method: 'GET',
  135 + params: {
  136 + page: 0
  137 + }
  138 + },
  139 + get: {
  140 + method: 'GET'
  141 + },
  142 + save: {
  143 + method: 'POST'
  144 + }
  145 + }
  146 + ),
  147 + validate: $resource(
  148 + '/personnel/validate/:type',
  149 + {},
  150 + {
  151 + jobCode: {
  152 + method: 'GET'
  153 + }
  154 + }
  155 + ),
  156 + dataTools: $resource(
  157 + '/personnel/:type',
  158 + {},
  159 + {
  160 + dataExport: {
  161 + method: 'GET',
  162 + responseType: "arraybuffer",
  163 + params: {
  164 + type: "dataExport"
  165 + },
  166 + transformResponse: function(data, headers){
  167 + return {data : data};
  168 + }
  169 + }
  170 + }
  171 + )
  172 + };
  173 +}]);
  174 +// 车辆设备信息service
  175 +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
  176 + return $resource(
  177 + '/cde/:id',
  178 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  179 + {
  180 + list: {
  181 + method: 'GET',
  182 + params: {
  183 + page: 0
  184 + }
  185 + },
  186 + get: {
  187 + method: 'GET'
  188 + },
  189 + save: {
  190 + method: 'POST'
  191 + },
  192 + delete: {
  193 + method: 'DELETE'
  194 + }
  195 + }
  196 + );
  197 +}]);
  198 +
  199 +// 车辆配置service
  200 +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
  201 + return {
  202 + rest : $resource(
  203 + '/cci/:id',
  204 + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
  205 + {
  206 + list: {
  207 + method: 'GET',
  208 + params: {
  209 + page: 0
  210 + }
  211 + },
  212 + get: {
  213 + method: 'GET'
  214 + },
  215 + save: {
  216 + method: 'POST'
  217 + }
  218 + }
  219 + )
  220 + };
  221 +}]);
  222 +
  223 +// 人员配置service
  224 +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
  225 + return {
  226 + rest : $resource(
  227 + '/eci/:id',
  228 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
  229 + {
  230 + list: {
  231 + method: 'GET',
  232 + params: {
  233 + page: 0
  234 + }
  235 + },
  236 + get: {
  237 + method: 'GET'
  238 + },
  239 + save: {
  240 + method: 'POST'
  241 + },
  242 + delete: {
  243 + method: 'DELETE'
  244 + }
  245 + }
  246 + ),
  247 + validate: $resource( // TODO:
  248 + '/personnel/validate/:type',
  249 + {},
  250 + {
  251 + jobCode: {
  252 + method: 'GET'
  253 + }
  254 + }
  255 + )
  256 + };
  257 +}]);
  258 +
  259 +// 路牌管理service
  260 +angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
  261 + return {
  262 + rest: $resource(
  263 + '/gic/:id',
  264 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  265 + {
  266 + list: {
  267 + method: 'GET',
  268 + params: {
  269 + page: 0
  270 + }
  271 + },
  272 + get: {
  273 + method: 'GET'
  274 + },
  275 + save: {
  276 + method: 'POST'
  277 + }
  278 + }
  279 + )
  280 + };
  281 +}]);
  282 +
  283 +// 排班管理service
  284 +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
  285 + return {
  286 + rest: $resource(
  287 + '/sr1fc/:id',
  288 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  289 + {
  290 + list: {
  291 + method: 'GET',
  292 + params: {
  293 + page: 0
  294 + }
  295 + },
  296 + get: {
  297 + method: 'GET'
  298 + },
  299 + save: {
  300 + method: 'POST'
  301 + },
  302 + delete: {
  303 + method: 'DELETE'
  304 + }
  305 + }
  306 + )
  307 + };
  308 +}]);
  309 +
  310 +// 套跑管理service
  311 +angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {
  312 + return {
  313 + rest: $resource(
  314 + 'rms/:id',
  315 + {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},
  316 + {
  317 + list: {
  318 + method: 'GET',
  319 + params: {
  320 + page: 0
  321 + }
  322 + },
  323 + get: {
  324 + method: 'GET'
  325 + },
  326 + save: {
  327 + method: 'POST'
  328 + },
  329 + delete: {
  330 + method: 'DELETE'
  331 + }
  332 + }
  333 + )
  334 + };
  335 +}]);
  336 +
  337 +// 时刻表管理service
  338 +angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
  339 + return {
  340 + rest: $resource(
  341 + '/tic/:id',
  342 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  343 + {
  344 + list: {
  345 + method: 'GET',
  346 + params: {
  347 + page: 0,
  348 + isCancel_eq: 'false'
  349 + }
  350 + },
  351 + get: {
  352 + method: 'GET'
  353 + },
  354 + save: {
  355 + method: 'POST'
  356 + },
  357 + delete: {
  358 + method: 'DELETE'
  359 + }
  360 + }
  361 + ),
  362 + validate: $resource(
  363 + '/tic/validate/:type',
  364 + {},
  365 + {
  366 + ttinfoname: {
  367 + method: 'GET'
  368 + }
  369 + }
  370 + )
  371 + };
  372 +}]);
  373 +// 时刻表明细管理service
  374 +angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
  375 + return {
  376 + rest: $resource(
  377 + '/tidc/:id',
  378 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  379 + {
  380 + get: {
  381 + method: 'GET'
  382 + },
  383 + save: {
  384 + method: 'POST'
  385 + }
  386 + }
  387 + ),
  388 + edit: $resource(
  389 + '/tidc/edit/:xlid/:ttid',
  390 + {},
  391 + {
  392 + list: {
  393 + method: 'GET'
  394 + }
  395 + }
  396 + ),
  397 + bcdetails: $resource(
  398 + '/tidc/bcdetail',
  399 + {},
  400 + {
  401 + list: {
  402 + method: 'GET',
  403 + isArray: true
  404 + }
  405 + }
  406 + )
  407 + };
  408 +}]);
  409 +
  410 +
  411 +
  412 +// 排班计划管理service
  413 +angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {
  414 + return {
  415 + rest : $resource(
  416 + '/spc/:id',
  417 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  418 + {
  419 + list: {
  420 + method: 'GET',
  421 + params: {
  422 + page: 0
  423 + }
  424 + },
  425 + get: {
  426 + method: 'GET'
  427 + },
  428 + save: {
  429 + method: 'POST'
  430 + },
  431 + delete: {
  432 + method: 'DELETE'
  433 + }
  434 + }
  435 + ),
  436 + tommorw: $resource(
  437 + '/spc/tommorw',
  438 + {},
  439 + {
  440 + list: {
  441 + method: 'GET'
  442 + }
  443 + }
  444 + )
  445 + };
  446 +}]);
  447 +
  448 +// 排班计划明细管理service
  449 +angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {
  450 + return {
  451 + rest : $resource(
  452 + '/spic/:id',
  453 + {order: 'scheduleDate,lp,fcno', direction: 'ASC', id: '@id_route'},
  454 + {
  455 + list: {
  456 + method: 'GET',
  457 + params: {
  458 + page: 0
  459 + }
  460 + },
  461 + get: {
  462 + method: 'GET'
  463 + },
  464 + save: {
  465 + method: 'POST'
  466 + }
  467 + }
  468 + ),
  469 + groupinfo : $resource(
  470 + '/spic/groupinfos/:xlid/:sdate',
  471 + {},
  472 + {
  473 + list: {
  474 + method: 'GET',
  475 + isArray: true
  476 + }
  477 + }
  478 + ),
  479 + updateGroupInfo : $resource(
  480 + '/spic/groupinfos/update',
  481 + {},
  482 + {
  483 + update: {
  484 + method: 'POST'
  485 + }
  486 + }
  487 + )
  488 + };
  489 +}]);
  490 +
  491 +// 线路运营统计service
  492 +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
  493 + return $resource(
  494 + '/bic/:id',
  495 + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
  496 + {
  497 + list: {
  498 + method: 'GET',
  499 + params: {
  500 + page: 0
  501 + }
  502 + }
  503 + }
  504 + );
  505 +}]);
  506 +
  507 +
  508 +
  509 +
  510 +/**
  511 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  512 + * 1、compile阶段使用的属性如下:
  513 + * required:用于和表单验证连接,指定成required="true"才有效。
  514 + * 2、link阶段使用的属性如下
  515 + * model:关联的模型对象
  516 + * name:表单验证时需要的名字
  517 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  518 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  519 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  520 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  521 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  522 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  523 + * placeholder:select placeholder字符串描述
  524 + *
  525 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  526 + * $$SearchInfoService_g,内部使用的数据服务
  527 + */
  528 +// saSelect2指令使用的内部信service
  529 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  530 + return {
  531 + xl: $resource(
  532 + '/line/:type',
  533 + {order: 'name', direction: 'ASC'},
  534 + {
  535 + list: {
  536 + method: 'GET',
  537 + isArray: true
  538 + }
  539 + }
  540 + ),
  541 + zd: $resource(
  542 + '/stationroute/stations',
  543 + {order: 'stationCode', direction: 'ASC'},
  544 + {
  545 + list: {
  546 + method: 'GET',
  547 + isArray: true
  548 + }
  549 + }
  550 + ),
  551 + tcc: $resource(
  552 + '/carpark/:type',
  553 + {order: 'parkCode', direction: 'ASC'},
  554 + {
  555 + list: {
  556 + method: 'GET',
  557 + isArray: true
  558 + }
  559 + }
  560 + ),
  561 + ry: $resource(
  562 + '/personnel/:type',
  563 + {order: 'personnelName', direction: 'ASC'},
  564 + {
  565 + list: {
  566 + method: 'GET',
  567 + isArray: true
  568 + }
  569 + }
  570 + ),
  571 + cl: $resource(
  572 + '/cars/:type',
  573 + {order: "insideCode", direction: 'ASC'},
  574 + {
  575 + list: {
  576 + method: 'GET',
  577 + isArray: true
  578 + }
  579 + }
  580 + ),
  581 + ttInfo: $resource(
  582 + '/tic/:type',
  583 + {order: "name", direction: 'ASC'},
  584 + {
  585 + list: {
  586 + method: 'GET',
  587 + isArray: true
  588 + }
  589 + }
  590 + ),
  591 + lpInfo: $resource(
  592 + '/gic/ttlpnames',
  593 + {order: "lpName", direction: 'ASC'},
  594 + {
  595 + list: {
  596 + method: 'GET',
  597 + isArray: true
  598 + }
  599 + }
  600 + ),
  601 + lpInfo2: $resource(
  602 + '/gic/:type',
  603 + {order: "lpName", direction: 'ASC'},
  604 + {
  605 + list: {
  606 + method: 'GET',
  607 + isArray: true
  608 + }
  609 + }
  610 + ),
  611 + cci: $resource(
  612 + '/cci/cars',
  613 + {},
  614 + {
  615 + list: {
  616 + method: 'GET',
  617 + isArray: true
  618 + }
  619 + }
  620 +
  621 + ),
  622 + cci2: $resource(
  623 + '/cci/:type',
  624 + {},
  625 + {
  626 + list: {
  627 + method: 'GET',
  628 + isArray: true
  629 + }
  630 + }
  631 + ),
  632 + cci3: $resource(
  633 + '/cci/cars2',
  634 + {},
  635 + {
  636 + list: {
  637 + method: 'GET',
  638 + isArray: true
  639 + }
  640 + }
  641 +
  642 + ),
  643 + eci: $resource(
  644 + '/eci/jsy',
  645 + {},
  646 + {
  647 + list: {
  648 + method: 'GET',
  649 + isArray: true
  650 + }
  651 + }
  652 + ),
  653 + eci2: $resource(
  654 + '/eci/spy',
  655 + {},
  656 + {
  657 + list: {
  658 + method: 'GET',
  659 + isArray: true
  660 + }
  661 + }
  662 + ),
  663 + eci3: $resource(
  664 + '/eci/:type',
  665 + {},
  666 + {
  667 + list: {
  668 + method: 'GET',
  669 + isArray: true
  670 + }
  671 + }
  672 + ),
  673 +
  674 +
  675 + validate: { // remoteValidation指令用到的resource
  676 + cl1: { // 车辆自编号不能重复验证
  677 + template: {'insideCode_eq': '-1'}, // 查询参数模版
  678 + remote: $resource( // $resource封装对象
  679 + '/cars/validate/equale',
  680 + {},
  681 + {
  682 + do: {
  683 + method: 'GET'
  684 + }
  685 + }
  686 + )
  687 + },
  688 + cde1: { // 车辆设备启用日期验证
  689 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  690 + remote: $resource( // $resource封装对象
  691 + '/cde//validate/qyrq',
  692 + {},
  693 + {
  694 + do: {
  695 + method: 'GET'
  696 + }
  697 + }
  698 + )
  699 + }
  700 + }
  701 +
  702 + //validate: $resource(
  703 + // '/cars/validate/:type',
  704 + // {},
  705 + // {
  706 + // insideCode: {
  707 + // method: 'GET'
  708 + // }
  709 + // }
  710 + //)
  711 +
  712 +
  713 +
  714 + }
  715 +}]);
  716 +
  717 +
  718 +
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list_report.html
1   -<!-- ui-route employeeInfoManage.list -->
2   -<div ng-controller="SchedulePlanReportManageListCtrl as ctrl">
3   - <div class="fixDiv">
4   - <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column" style="width: 2000px">
5   - <thead>
6   - <tr role="row" class="heading">
7   - <th style="width: 50px;">序号</th>
8   - <th style="width: 230px;">线路</th>
9   - <th style="width: 180px">日期</th>
10   - <th style="width: 60px">路牌</th>
11   - <th style="width: 100px;">车辆</th>
12   - <th style="width: 80px;">出场1</th>
13   - <th style="width: 100px;">驾工1</th>
14   - <th style="width: 100px;">驾1</th>
15   - <th style="width: 100px;">售工1</th>
16   - <th style="width: 100px;">售1</th>
17   - <th style="width: 80px;">出场2</th>
18   - <th style="width: 100px;">驾工2</th>
19   - <th style="width: 100px;">驾2</th>
20   - <th style="width: 100px;">售工2</th>
21   - <th style="width: 100px;">售2</th>
22   - <th style="width: 150px;">排班时间</th>
23   - <th>时刻表</th>
24   - </tr>
25   - <tr role="row" class="filter">
26   - <td></td>
27   - <td>
28   - <sa-Select3 model="ctrl.searchCondition()"
29   - name="xl"
30   - placeholder="请输拼音..."
31   - dcvalue="{{ctrl.searchCondition()['xlid']}}"
32   - dcname="xlid"
33   - icname="id"
34   - icnames="name"
35   - datatype="xl">
36   - </sa-Select3>
37   - </td>
38   - <td>
39   - <div class="input-group">
40   - <input type="text" class="form-control"
41   - name="scheduleDate" placeholder="选择日期..."
42   - uib-datepicker-popup="yyyy-MM-dd"
43   - is-open="ctrl.scheduleDateOpen"
44   - ng-model="ctrl.searchCondition().sdate" readonly/>
45   - <span class="input-group-btn">
46   - <button type="button" class="btn btn-default" ng-click="ctrl.scheduleDate_open()">
47   - <i class="glyphicon glyphicon-calendar"></i>
48   - </button>
49   - </span>
50   - </div>
51   - </td>
52   - <td></td>
53   - <td></td>
54   - <td></td>
55   - <td></td>
56   - <td></td>
57   - <td></td>
58   - <td></td>
59   - <td></td>
60   - <td></td>
61   - <td></td>
62   - <td></td>
63   - <td></td>
64   - <td></td>
65   - </tr>
66   - </thead>
67   - <tbody>
68   - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
69   - <td>
70   - <span ng-bind="$index + 1"></span>
71   - </td>
72   - <td>
73   - <span ng-bind="info.xlName"></span>
74   - </td>
75   - <td>
76   - <span ng-bind="info.scheduleDate | date: 'yyyy-MM-dd'"></span>
77   - </td>
78   - <td>
79   - <span ng-bind="info.lpName"></span>
80   - </td>
81   - <td>
82   - <a class="btn btn-primary" ng-click="ctrl.goEditForm(1, info)">
83   - <span ng-bind="info.clZbh"></span>
84   - </a>
85   - </td>
86   - <td>
87   - <a class="btn btn-info" ng-show="info.ccsj1" ng-click="ctrl.goEditForm(2, info)">
88   - <span ng-bind="info.ccsj1"></span>
89   - </a>
90   - </td>
91   - <td>
92   - <a class="btn btn-success" ng-show="info.jsy1Gh" ng-click="ctrl.goEditForm(3, info)">
93   - <span ng-bind="info.jsy1Gh"></span>
94   - </a>
95   - </td>
96   - <td>
97   - <a class="btn btn-success" ng-show="info.jsy1Name" ng-click="ctrl.goEditForm(3, info)">
98   - <span ng-bind="info.jsy1Name"></span>
99   - </a>
100   - </td>
101   - <td>
102   - <a class="btn btn-info" ng-show="info.spy1Gh" ng-click="ctrl.goEditForm(3, info)">
103   - <span ng-bind="info.spy1Gh"></span>
104   - </a>
105   - </td>
106   - <td>
107   - <a class="btn btn-info" ng-show="info.spy1Name" ng-click="ctrl.goEditForm(3, info)">
108   - <span ng-bind="info.spy1Name"></span>
109   - </a>
110   - </td>
111   - <td>
112   - <a class="btn btn-success" ng-show="info.ccsj2" ng-click="ctrl.goEditForm(4, info)">
113   - <span ng-bind="info.ccsj2"></span>
114   - </a>
115   - </td>
116   - <td>
117   - <a class="btn btn-info" ng-show="info.jsy2Gh" ng-click="ctrl.goEditForm(5, info)">
118   - <span ng-bind="info.jsy2Gh"></span>
119   - </a>
120   - </td>
121   - <td>
122   - <a class="btn btn-info" ng-show="info.jsy2Name" ng-click="ctrl.goEditForm(5, info)">
123   - <span ng-bind="info.jsy2Name"></span>
124   - </a>
125   - </td>
126   - <td>
127   - <a class="btn btn-info" ng-show="info.spy2Gh" ng-click="ctrl.goEditForm(5, info)">
128   - <span ng-bind="info.spy2Gh"></span>
129   - </a>
130   - </td>
131   - <td>
132   - <a class="btn btn-info" ng-show="info.spy2Name" ng-click="ctrl.goEditForm(5, info)">
133   - <span ng-bind="info.spy2Name"></span>
134   - </a>
135   - </td>
136   - <td>
137   - <span ng-bind="info.createDate | date: 'yyyy-MM-dd HH:mm:ss'"></span>
138   - </td>
139   - <td>
140   - <span ng-bind="info.ttinfoName"></span>
141   - </td>
142   - </tr>
143   - </tbody>
144   - </table>
145   - </div>
146   -
  1 +<!-- ui-route employeeInfoManage.list -->
  2 +<div ng-controller="SchedulePlanReportManageListCtrl as ctrl">
  3 + <div class="fixDiv">
  4 + <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column" style="width: 2000px">
  5 + <thead>
  6 + <tr role="row" class="heading">
  7 + <th style="width: 50px;">序号</th>
  8 + <th style="width: 230px;">线路</th>
  9 + <th style="width: 180px">日期</th>
  10 + <th style="width: 60px">路牌</th>
  11 + <th style="width: 100px;">车辆</th>
  12 + <th style="width: 80px;">出场1</th>
  13 + <th style="width: 100px;">驾工1</th>
  14 + <th style="width: 100px;">驾1</th>
  15 + <th style="width: 100px;">售工1</th>
  16 + <th style="width: 100px;">售1</th>
  17 + <th style="width: 80px;">出场2</th>
  18 + <th style="width: 100px;">驾工2</th>
  19 + <th style="width: 100px;">驾2</th>
  20 + <th style="width: 100px;">售工2</th>
  21 + <th style="width: 100px;">售2</th>
  22 + <th style="width: 150px;">排班时间</th>
  23 + <th>时刻表</th>
  24 + </tr>
  25 + <tr role="row" class="filter">
  26 + <td></td>
  27 + <td>
  28 + <sa-Select3 model="ctrl.searchCondition()"
  29 + name="xl"
  30 + placeholder="请输拼音..."
  31 + dcvalue="{{ctrl.searchCondition()['xlid']}}"
  32 + dcname="xlid"
  33 + icname="id"
  34 + icnames="name"
  35 + datatype="xl">
  36 + </sa-Select3>
  37 + </td>
  38 + <td>
  39 + <div class="input-group">
  40 + <input type="text" class="form-control"
  41 + name="scheduleDate" placeholder="选择日期..."
  42 + uib-datepicker-popup="yyyy-MM-dd"
  43 + is-open="ctrl.scheduleDateOpen"
  44 + ng-model="ctrl.searchCondition().sdate" readonly/>
  45 + <span class="input-group-btn">
  46 + <button type="button" class="btn btn-default" ng-click="ctrl.scheduleDate_open()">
  47 + <i class="glyphicon glyphicon-calendar"></i>
  48 + </button>
  49 + </span>
  50 + </div>
  51 + </td>
  52 + <td></td>
  53 + <td></td>
  54 + <td></td>
  55 + <td></td>
  56 + <td></td>
  57 + <td></td>
  58 + <td></td>
  59 + <td></td>
  60 + <td></td>
  61 + <td></td>
  62 + <td></td>
  63 + <td></td>
  64 + <td></td>
  65 + </tr>
  66 + </thead>
  67 + <tbody>
  68 + <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
  69 + <td>
  70 + <span ng-bind="$index + 1"></span>
  71 + </td>
  72 + <td>
  73 + <span ng-bind="info.xlName"></span>
  74 + </td>
  75 + <td>
  76 + <span ng-bind="info.scheduleDate | date: 'yyyy-MM-dd'"></span>
  77 + </td>
  78 + <td>
  79 + <span ng-bind="info.lpName"></span>
  80 + </td>
  81 + <td>
  82 + <a class="btn btn-primary" ng-click="ctrl.goEditForm(1, info)">
  83 + <span ng-bind="info.clZbh"></span>
  84 + </a>
  85 + </td>
  86 + <td>
  87 + <a class="btn btn-info" ng-show="info.ccsj1" ng-click="ctrl.goEditForm(2, info)">
  88 + <span ng-bind="info.ccsj1"></span>
  89 + </a>
  90 + </td>
  91 + <td>
  92 + <a class="btn btn-success" ng-show="info.jsy1Gh" ng-click="ctrl.goEditForm(3, info)">
  93 + <span ng-bind="info.jsy1Gh"></span>
  94 + </a>
  95 + </td>
  96 + <td>
  97 + <a class="btn btn-success" ng-show="info.jsy1Name" ng-click="ctrl.goEditForm(3, info)">
  98 + <span ng-bind="info.jsy1Name"></span>
  99 + </a>
  100 + </td>
  101 + <td>
  102 + <a class="btn btn-info" ng-show="info.spy1Gh" ng-click="ctrl.goEditForm(3, info)">
  103 + <span ng-bind="info.spy1Gh"></span>
  104 + </a>
  105 + </td>
  106 + <td>
  107 + <a class="btn btn-info" ng-show="info.spy1Name" ng-click="ctrl.goEditForm(3, info)">
  108 + <span ng-bind="info.spy1Name"></span>
  109 + </a>
  110 + </td>
  111 + <td>
  112 + <a class="btn btn-success" ng-show="info.ccsj2" ng-click="ctrl.goEditForm(4, info)">
  113 + <span ng-bind="info.ccsj2"></span>
  114 + </a>
  115 + </td>
  116 + <td>
  117 + <a class="btn btn-info" ng-show="info.jsy2Gh" ng-click="ctrl.goEditForm(5, info)">
  118 + <span ng-bind="info.jsy2Gh"></span>
  119 + </a>
  120 + </td>
  121 + <td>
  122 + <a class="btn btn-info" ng-show="info.jsy2Name" ng-click="ctrl.goEditForm(5, info)">
  123 + <span ng-bind="info.jsy2Name"></span>
  124 + </a>
  125 + </td>
  126 + <td>
  127 + <a class="btn btn-info" ng-show="info.spy2Gh" ng-click="ctrl.goEditForm(5, info)">
  128 + <span ng-bind="info.spy2Gh"></span>
  129 + </a>
  130 + </td>
  131 + <td>
  132 + <a class="btn btn-info" ng-show="info.spy2Name" ng-click="ctrl.goEditForm(5, info)">
  133 + <span ng-bind="info.spy2Name"></span>
  134 + </a>
  135 + </td>
  136 + <td>
  137 + <span ng-bind="info.createDate | date: 'yyyy-MM-dd HH:mm:ss'"></span>
  138 + </td>
  139 + <td>
  140 + <span ng-bind="info.ttinfoName"></span>
  141 + </td>
  142 + </tr>
  143 + </tbody>
  144 + </table>
  145 + </div>
  146 +
147 147 </div>
148 148 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/css/line_schedule.css
... ... @@ -706,3 +706,26 @@ input.i-cbox[type=checkbox]{
706 706 .sch-tzrc-table.ct_table>.ct_table_body dl.context-menu-active{
707 707 background: #e6e6e6;
708 708 }
  709 +
  710 +.search_sch_panel{
  711 + float: right;
  712 +}
  713 +
  714 +.search_sch_panel .uk-form input[type=text]{
  715 + width: 80px;
  716 + background: #fafafa;
  717 + border: 0;
  718 + border-bottom: 1px solid #ddd;
  719 + font-size: 14px;
  720 + height: 20px;
  721 + transition: all .3s ease;
  722 +}
  723 +
  724 +.search_sch_panel .uk-form input.active[type=text]{
  725 + width: 130px;
  726 +}
  727 +
  728 +.search_sch_panel .uk-form input[type=text]::-webkit-input-placeholder{
  729 + font-size: 12px;
  730 + color: #cecece;
  731 +}
... ...
src/main/resources/static/real_control_v2/css/sch_autocomp_result.css 0 → 100644
  1 +.uk-autocomplete.sch-search-autocom .uk-dropdown {
  2 + width: 260px;
  3 + max-height: 500px;
  4 + overflow: auto;
  5 +}
  6 +
  7 +.sch-search-results>li {
  8 + position: relative;
  9 + /*line-height: 18px;*/
  10 +}
  11 +
  12 +.sch-search-results>li.uk-active small {
  13 + color: #ebeaea;
  14 +}
  15 +
  16 +.sch-search-results small {
  17 + /*display: block;*/
  18 + color: #9b9797;
  19 + margin-left: 9px;
  20 +}
  21 +
  22 +.sch-search-results small.search-result-desc {
  23 + white-space: nowrap;
  24 + overflow: hidden;
  25 + display: block;
  26 + text-overflow: ellipsis;
  27 + margin-left: 0;
  28 +}
  29 +
  30 +
  31 +/*.sch-search-results div.exec_sch_badge {
  32 + position: absolute;
  33 + top: 8px;
  34 + right: 3px;
  35 + background: #96f396;
  36 + text-indent: 0;
  37 + padding: 0 3px;
  38 + border-radius: 5px;
  39 + color: #7b5d5d;
  40 +}*/
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
... ... @@ -7,6 +7,16 @@
7 7 {{else}}
8 8 下行/{{line.endStationName}}
9 9 {{/if}}
  10 + <!-- <div class="search_sch_panel">
  11 + <form class="uk-form">
  12 + <div class="uk-autocomplete sch-search-autocom">
  13 + <div class="uk-form-icon">
  14 + <i class="uk-icon-search"></i>
  15 + <input type="text" placeholder="search">
  16 + </div>
  17 + </div>
  18 + </form>
  19 + </div> -->
10 20 </h3>
11 21 <div class="schedule-body">
12 22 <div class="ct_table_wrap">
... ...
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
... ... @@ -10,7 +10,7 @@ var gb_schedule_table = (function() {
10 10 return s1.dfsjT - s2.dfsjT;
11 11 }
12 12  
13   - var show = function() {
  13 + var show = function(cb) {
14 14 //从服务器获取班次数据
15 15 $.get('/realSchedule/lines', {
16 16 lines: gb_data_basic.line_idx
... ... @@ -63,6 +63,8 @@ var gb_schedule_table = (function() {
63 63 gb_ct_table.enableSort($('.ct_table', content), reset_seq_no, gb_schedule_table_dbclick.init);
64 64 //dbclick event
65 65 gb_schedule_table_dbclick.init();
  66 +
  67 + cb&&cb();
66 68 });
67 69 }
68 70  
... ... @@ -189,15 +191,20 @@ var gb_schedule_table = (function() {
189 191 drag_strat = null;
190 192 }).on('mouseover', seq_nos, function() {
191 193 if (drag_strat) {
192   - var drag_end = parseInt($(this).text()),
  194 + var e = parseInt($(this).text()),
193 195 dls = $(this).parents('.ct_table_body').find('dl');
194 196  
195 197 reset_drag_active_all(this);
196   - if (drag_end - drag_strat <= 1)
197   - return;
198   -
199   - for (var i = drag_strat; i < drag_end; i++)
200   - $(dls[i]).addClass('drag-active');
  198 + //向上选中
  199 + if(e <= drag_strat){
  200 + for (var i = drag_strat; i > e-2; i--)
  201 + $(dls[i]).addClass('drag-active');
  202 + }
  203 + //向下选中
  204 + else{
  205 + for (var j = drag_strat; j < e; j++)
  206 + $(dls[j]).addClass('drag-active');
  207 + }
201 208 }
202 209 }).on('click', seq_nos, function() {
203 210 reset_relevance_active(this);
... ... @@ -278,7 +285,7 @@ var gb_schedule_table = (function() {
278 285 //计算应发未发数量
279 286 var calc_yfwf_num = function(lineCode){
280 287  
281   - var schArr=line2Schedule[lineCode]
  288 + var schArr=gb_common.get_vals(line2Schedule[lineCode]).sort(schedule_sort)
282 289 ,yfwf_num=0
283 290 ,t = new Date().valueOf();
284 291  
... ...
src/main/resources/static/real_control_v2/js/line_schedule/search.js 0 → 100644
  1 +/** 班次搜索 */
  2 +var gb_sch_search = (function() {
  3 +
  4 + //搜索结果模板,和art-template冲突。 用字符串渲染
  5 + var result_template = '<script type="text/autocomplete">' +
  6 + ' <ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results sch-search-results">' +
  7 + ' {{~items}}' +
  8 + ' <li data-value="{{ $item.value }}">' +
  9 + ' <a>' +
  10 + ' {{ $item.value }}' +
  11 + ' <small >执行班次 07:00</small>' +
  12 + ' <small class="search-result-desc">{{{ $item.desc }}}</small>' +
  13 + ' </a>' +
  14 + ' </li>' +
  15 + ' {{/items}}' +
  16 + ' </ul>' +
  17 + '</script>';
  18 +
  19 + var ips = '.search_sch_panel input',
  20 + _input, schArr, lineCode, group_cars;
  21 + $(document)
  22 + .on('focus', ips, function() {
  23 + $(this).addClass('active');
  24 + lineCode = $(this).parents('li.line_schedule').data('id');
  25 + schArr = gb_common.get_vals(gb_schedule_table.findScheduleByLine(lineCode));
  26 +
  27 + group_cars = gb_common.groupBy(schArr, 'clZbh');
  28 + _input = $(this);
  29 + })
  30 + .on('blur', ips, function() {
  31 + if ($(this).val() == '')
  32 + $(this).removeClass('active');
  33 + });
  34 +
  35 + var elements = '.search_sch_panel .sch-search-autocom';
  36 + var init = function() {
  37 + $(elements).each(function() {
  38 + $(this).append(result_template);
  39 + constructor(this);
  40 + });
  41 + };
  42 +
  43 + var constructor = function(e) {
  44 + UIkit.autocomplete(e, {
  45 + minLength: 1,
  46 + delay: 50,
  47 + source: autocomplete_source
  48 + }).on('selectitem.uk.autocomplete', selectitem);
  49 + }
  50 +
  51 + var autocomplete_source = function(release) {
  52 + var rs = [],
  53 + v = _input.val().toUpperCase();
  54 + for (var car in group_cars) {
  55 + if (car.indexOf(v) != -1)
  56 + rs.push({
  57 + value: car,
  58 + desc: '应发未发:0,已完成 8 个班次'
  59 + });
  60 + }
  61 +
  62 + console.log(rs);
  63 + release && release(rs);
  64 + }
  65 +
  66 + var selectitem = function(event, data, acobject){
  67 + var cont='li.line_schedule[data-id='+lineCode+']'
  68 + ,tbodys=$('.line-schedule-table .ct_table_body', cont);
  69 +
  70 + $('.sch-search-autocom input', cont).val(data.value).addClass('active');
  71 + console.log(tbodys);
  72 + }
  73 +
  74 + return {
  75 + init: init
  76 + };
  77 +})();
... ...
src/main/resources/static/real_control_v2/js/main.js
... ... @@ -35,7 +35,10 @@ var gb_main_ep = new EventProxy(),
35 35  
36 36 //render schedule table
37 37 eq.once('render-sch-table', function() {
38   - gb_schedule_table.show();
  38 + gb_schedule_table.show(function(){
  39 + //搜索框
  40 + //gb_sch_search.init();
  41 + });
39 42  
40 43 //嵌入地图页面
41 44 $('li.map-panel','#main-tab-content').load('/real_control_v2/mapmonitor/real_monitor/real.html');
... ...
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
... ... @@ -9,14 +9,7 @@ var gb_sch_websocket = (function() {
9 9  
10 10 schSock.onopen = function(e) {
11 11 console.log('webSocket[realcontrol] onopen');
12   - setTimeout(function() {
13   - //注册线路监听
14   - var data = {
15   - operCode: 'register_line',
16   - idx: gb_data_basic.line_idx
17   - }
18   - schSock.send(JSON.stringify(data));
19   - }, 500);
  12 + setTimeout(regListen, 500);
20 13 };
21 14 //接收消息
22 15 schSock.onmessage = function(e) {
... ... @@ -28,9 +21,22 @@ var gb_sch_websocket = (function() {
28 21 }
29 22 };
30 23  
  24 + function regListen (){
  25 + //注册线路监听
  26 + var data = {
  27 + operCode: 'register_line',
  28 + idx: gb_data_basic.line_idx
  29 + }
  30 + schSock.send(JSON.stringify(data));
  31 + console.log('regListen....', data);
  32 + }
  33 +
31 34 //断开
32 35 schSock.onclose = function(e) {
33 36 alert('和服务器连接断开....');
  37 + console.log('和服务器连接断开....');
  38 + regListen();
  39 +
34 40 };
35 41  
36 42 //80协议上报
... ...
src/main/resources/static/real_control_v2/main.html
... ... @@ -18,6 +18,7 @@
18 18 <link rel="stylesheet" href="/real_control_v2/css/home.css" />
19 19 <!-- line style -->
20 20 <link rel="stylesheet" href="/real_control_v2/css/line_schedule.css" />
  21 + <link rel="stylesheet" href="/real_control_v2/css/sch_autocomp_result.css" />
21 22 <!-- custom table -->
22 23 <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" />
23 24 <!-- jquery contextMenu style -->
... ... @@ -118,6 +119,7 @@
118 119 <script src="/real_control_v2/js/line_schedule/sch_table.js"></script>
119 120 <script src="/real_control_v2/js/line_schedule/context_menu.js"></script>
120 121 <script src="/real_control_v2/js/line_schedule/dbclick.js"></script>
  122 + <script src="/real_control_v2/js/line_schedule/search.js"></script>
121 123  
122 124 <!-- 字典相关 -->
123 125 <script src="/assets/js/dictionary.js"></script>
... ...