Commit c45e739287723fbdcefac3f0589feb06e6d01df8

Authored by 潘钊
2 parents 1a61f28c b27fab8e

Merge branch 'minhang' of

http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

# Conflicts:
#	src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
Showing 59 changed files with 6524 additions and 5832 deletions
src/main/java/com/bsth/controller/BaseController.java
@@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile; @@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
17 17
18 import javax.servlet.http.HttpServletResponse; 18 import javax.servlet.http.HttpServletResponse;
19 import java.io.*; 19 import java.io.*;
  20 +import java.util.ArrayList;
20 import java.util.HashMap; 21 import java.util.HashMap;
21 import java.util.List; 22 import java.util.List;
22 import java.util.Map; 23 import java.util.Map;
@@ -54,18 +55,31 @@ public class BaseController<T, ID extends Serializable> { @@ -54,18 +55,31 @@ public class BaseController<T, ID extends Serializable> {
54 @RequestParam(defaultValue = "id") String order, 55 @RequestParam(defaultValue = "id") String order,
55 @RequestParam(defaultValue = "DESC") String direction){ 56 @RequestParam(defaultValue = "DESC") String direction){
56 57
57 - Direction d;  
58 -  
59 - if(null != direction && direction.equals("ASC"))  
60 - d = Direction.ASC;  
61 - else  
62 - d = Direction.DESC;  
63 -  
64 // 允许多个字段排序,order可以写单个字段,也可以写多个字段 58 // 允许多个字段排序,order可以写单个字段,也可以写多个字段
65 // 多个字段格式:{col1},{col2},{col3},....,{coln} 59 // 多个字段格式:{col1},{col2},{col3},....,{coln}
66 - // 每个字段的排序方向都是一致,这个以后再看要不要改  
67 - List<String> list = Splitter.on(",").trimResults().splitToList(order);  
68 - return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); 60 + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order);
  61 + // 多字段排序:DESC,ASC...
  62 + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction);
  63 +
  64 + if (order_dirs.size() == 1) { // 所有字段采用一种排序
  65 + if (null != order_dirs.get(0) && order_dirs.get(0).equals("ASC")) {
  66 + return baseService.list(map, new PageRequest(page, size, new Sort(Direction.ASC, order_columns)));
  67 + } else {
  68 + return baseService.list(map, new PageRequest(page, size, new Sort(Direction.DESC, order_columns)));
  69 + }
  70 + } else if (order_columns.size() == order_dirs.size()) {
  71 + List<Sort.Order> orderList = new ArrayList<>();
  72 + for (int i = 0; i < order_columns.size(); i++) {
  73 + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) {
  74 + orderList.add(new Sort.Order(Direction.ASC, order_columns.get(i)));
  75 + } else {
  76 + orderList.add(new Sort.Order(Direction.DESC, order_columns.get(i)));
  77 + }
  78 + }
  79 + return baseService.list(map, new PageRequest(page, size, new Sort(orderList)));
  80 + } else {
  81 + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致");
  82 + }
69 } 83 }
70 84
71 /** 85 /**
src/main/java/com/bsth/controller/CarDeviceController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
  3 +import com.bsth.common.ResponseCode;
3 import com.bsth.entity.CarDevice; 4 import com.bsth.entity.CarDevice;
  5 +import com.bsth.service.CarDeviceService;
  6 +import org.joda.time.DateTime;
  7 +import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.web.bind.annotation.RequestBody; 8 import org.springframework.web.bind.annotation.RequestBody;
5 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.springframework.web.bind.annotation.RequestMethod; 10 import org.springframework.web.bind.annotation.RequestMethod;
7 import org.springframework.web.bind.annotation.RestController; 11 import org.springframework.web.bind.annotation.RestController;
8 12
  13 +import java.util.HashMap;
  14 +import java.util.Iterator;
9 import java.util.Map; 15 import java.util.Map;
10 16
11 /** 17 /**
@@ -14,7 +20,8 @@ import java.util.Map; @@ -14,7 +20,8 @@ import java.util.Map;
14 @RestController 20 @RestController
15 @RequestMapping("cde") 21 @RequestMapping("cde")
16 public class CarDeviceController extends BaseController<CarDevice, Long> { 22 public class CarDeviceController extends BaseController<CarDevice, Long> {
17 - 23 + @Autowired
  24 + private CarDeviceService carDeviceService;
18 /** 25 /**
19 * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody 26 * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
20 * @Title: save 27 * @Title: save
@@ -28,4 +35,22 @@ public class CarDeviceController extends BaseController&lt;CarDevice, Long&gt; { @@ -28,4 +35,22 @@ public class CarDeviceController extends BaseController&lt;CarDevice, Long&gt; {
28 public Map<String, Object> save(@RequestBody CarDevice t){ 35 public Map<String, Object> save(@RequestBody CarDevice t){
29 return baseService.save(t); 36 return baseService.save(t);
30 } 37 }
  38 +
  39 + @RequestMapping(value = "/validate/qyrq", method = RequestMethod.GET)
  40 + public Map<String, Object> validateQyrq(String qyrq, Integer xl, Integer cl) {
  41 + // 验证启用日期,必须是最大的日期,就是最晚的日期
  42 + Map<String, Object> obj = new HashMap<>();
  43 + obj.put("xl_eq", xl);
  44 + obj.put("cl_eq", cl);
  45 + obj.put("qyrq_ge", new DateTime(qyrq).toDate());
  46 + Iterator<CarDevice> iterator = carDeviceService.list(obj).iterator();
  47 + if (iterator.hasNext()) {
  48 + obj.clear();
  49 + obj.put("status", ResponseCode.ERROR);
  50 + } else {
  51 + obj.clear();
  52 + obj.put("status", ResponseCode.SUCCESS);
  53 + }
  54 + return obj;
  55 + }
31 } 56 }
src/main/java/com/bsth/controller/oil/YlbController.java
@@ -2,7 +2,9 @@ package com.bsth.controller.oil; @@ -2,7 +2,9 @@ package com.bsth.controller.oil;
2 2
3 import java.text.ParseException; 3 import java.text.ParseException;
4 import java.text.SimpleDateFormat; 4 import java.text.SimpleDateFormat;
  5 +import java.util.ArrayList;
5 import java.util.Date; 6 import java.util.Date;
  7 +import java.util.Iterator;
6 import java.util.List; 8 import java.util.List;
7 import java.util.Map; 9 import java.util.Map;
8 10
@@ -44,14 +46,47 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -44,14 +46,47 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
44 * @return 46 * @return
45 */ 47 */
46 @RequestMapping(value = "/obtain",method = RequestMethod.GET) 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 String rq=map.get("rq").toString(); 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 System.out.println(); 52 System.out.println();
51 return list; 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 * @Title: list 91 * @Title: list
57 * @Description: TODO(多条件分页查询) 92 * @Description: TODO(多条件分页查询)
src/main/java/com/bsth/controller/oil/YlxxbController.java
1 package com.bsth.controller.oil; 1 package com.bsth.controller.oil;
2 2
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
3 import org.springframework.web.bind.annotation.RequestMapping; 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 import org.springframework.web.bind.annotation.RestController; 9 import org.springframework.web.bind.annotation.RestController;
5 10
6 import com.bsth.controller.BaseController; 11 import com.bsth.controller.BaseController;
7 import com.bsth.entity.oil.Ylxxb; 12 import com.bsth.entity.oil.Ylxxb;
  13 +import com.bsth.service.oil.YlxxbService;
  14 +import com.bsth.util.PageObject;
8 15
9 @RestController 16 @RestController
10 @RequestMapping("ylxxb") 17 @RequestMapping("ylxxb")
11 public class YlxxbController extends BaseController<Ylxxb, Integer>{ 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/ArrivalData_GPS.java
@@ -51,7 +51,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ @@ -51,7 +51,7 @@ public class ArrivalData_GPS implements CommandLineRunner{
51 @Override 51 @Override
52 public void run(String... arg0) throws Exception { 52 public void run(String... arg0) throws Exception {
53 logger.info("ArrivalData_GPS,30,10"); 53 logger.info("ArrivalData_GPS,30,10");
54 - Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 20, TimeUnit.SECONDS); 54 + //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 20, TimeUnit.SECONDS);
55 } 55 }
56 56
57 @Component 57 @Component
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
@@ -73,7 +73,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -73,7 +73,7 @@ public class GpsRealData implements CommandLineRunner{
73 @Override 73 @Override
74 public void run(String... arg0) throws Exception { 74 public void run(String... arg0) throws Exception {
75 logger.info("gpsDataLoader,20,6"); 75 logger.info("gpsDataLoader,20,6");
76 - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 7, TimeUnit.SECONDS); 76 + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS);
77 } 77 }
78 78
79 public GpsEntity add(GpsEntity gps) { 79 public GpsEntity add(GpsEntity gps) {
src/main/java/com/bsth/entity/oil/Ylb.java
1 package com.bsth.entity.oil; 1 package com.bsth.entity.oil;
2 2
  3 +import java.text.DecimalFormat;
3 import java.util.Date; 4 import java.util.Date;
4 5
5 import javax.persistence.Entity; 6 import javax.persistence.Entity;
6 import javax.persistence.GeneratedValue; 7 import javax.persistence.GeneratedValue;
7 import javax.persistence.Id; 8 import javax.persistence.Id;
8 import javax.persistence.Table; 9 import javax.persistence.Table;
  10 +import javax.persistence.Transient;
9 11
10 import org.springframework.format.annotation.DateTimeFormat; 12 import org.springframework.format.annotation.DateTimeFormat;
11 13
  14 +import com.bsth.data.BasicData;
  15 +
12 @Entity 16 @Entity
13 @Table(name = "bsth_c_ylb") 17 @Table(name = "bsth_c_ylb")
14 public class Ylb { 18 public class Ylb {
@@ -22,23 +26,23 @@ public class Ylb { @@ -22,23 +26,23 @@ public class Ylb {
22 private String fgsdm; 26 private String fgsdm;
23 private String nbbm; 27 private String nbbm;
24 private String jsy; 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 private Double jzl; 33 private Double jzl;
30 private int sfkt; 34 private int sfkt;
31 private String jhsj; 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 private String shyy; 38 private String shyy;
35 - private Double zlc; 39 + private Double zlc=0.0;
36 private int yhlx; 40 private int yhlx;
37 private String rylx; 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 private int jhzbc; 46 private int jhzbc;
43 private int jhbc; 47 private int jhbc;
44 private int sjzbc; 48 private int sjzbc;
@@ -49,6 +53,16 @@ public class Ylb { @@ -49,6 +53,16 @@ public class Ylb {
49 private int nylx; 53 private int nylx;
50 //进场顺序(根据最先出场和最后进场来关联车辆的存油量) 54 //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
51 private int jcsx; 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 public Integer getId() { 67 public Integer getId() {
54 return id; 68 return id;
@@ -254,5 +268,38 @@ public class Ylb { @@ -254,5 +268,38 @@ public class Ylb {
254 public void setJcsx(int jcsx){ 268 public void setJcsx(int jcsx){
255 this.jcsx=jcsx; 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 +6,9 @@ import javax.persistence.Entity;
6 import javax.persistence.GeneratedValue; 6 import javax.persistence.GeneratedValue;
7 import javax.persistence.Id; 7 import javax.persistence.Id;
8 import javax.persistence.Table; 8 import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +
  11 +import org.springframework.format.annotation.DateTimeFormat;
9 12
10 @Entity 13 @Entity
11 @Table(name = "bsth_c_ylxxb") 14 @Table(name = "bsth_c_ylxxb")
@@ -13,6 +16,7 @@ public class Ylxxb { @@ -13,6 +16,7 @@ public class Ylxxb {
13 @Id 16 @Id
14 @GeneratedValue 17 @GeneratedValue
15 private Integer id; 18 private Integer id;
  19 + @DateTimeFormat(pattern="yyyy-MM-dd")
16 private Date yyrq; 20 private Date yyrq;
17 private Date jlrq; 21 private Date jlrq;
18 private String nbbm; 22 private String nbbm;
@@ -29,6 +33,12 @@ public class Ylxxb { @@ -29,6 +33,12 @@ public class Ylxxb {
29 private String xgr; 33 private String xgr;
30 private String fromgsdm; 34 private String fromgsdm;
31 private int nylx; 35 private int nylx;
  36 + @Transient
  37 + private String ldgh;
  38 + //0为接口数据,1为手工输入
  39 + private int jylx=0;
  40 +
  41 +
32 public Integer getId() { 42 public Integer getId() {
33 return id; 43 return id;
34 } 44 }
@@ -131,6 +141,18 @@ public class Ylxxb { @@ -131,6 +141,18 @@ public class Ylxxb {
131 public void setNylx(int nylx) { 141 public void setNylx(int nylx) {
132 this.nylx = nylx; 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/entity/search/PredicatesBuilder.java
1 package com.bsth.entity.search; 1 package com.bsth.entity.search;
2 2
  3 +import javax.persistence.criteria.CriteriaBuilder;
  4 +import javax.persistence.criteria.Path;
  5 +import javax.persistence.criteria.Predicate;
3 import java.text.NumberFormat; 6 import java.text.NumberFormat;
4 import java.text.ParseException; 7 import java.text.ParseException;
5 import java.text.SimpleDateFormat; 8 import java.text.SimpleDateFormat;
6 import java.util.Date; 9 import java.util.Date;
7 10
8 -import javax.persistence.criteria.CriteriaBuilder;  
9 -import javax.persistence.criteria.Path;  
10 -import javax.persistence.criteria.Predicate;  
11 -  
12 /** 11 /**
13 * 12 *
14 * @ClassName: PredicatesBuilder 13 * @ClassName: PredicatesBuilder
@@ -44,13 +43,22 @@ public class PredicatesBuilder { @@ -44,13 +43,22 @@ public class PredicatesBuilder {
44 } 43 }
45 } 44 }
46 45
47 - public static Predicate ge(CriteriaBuilder cb,Path<Number> expression, Object object){  
48 - try {  
49 - return cb.ge(expression, nf.parse(object.toString()));  
50 - } catch (ParseException e) {  
51 - e.printStackTrace();  
52 - return null;  
53 - } 46 + public static Predicate ge(CriteriaBuilder cb,Path<?> expression, Object object){
  47 + Class<?> leftType = expression.getJavaType();
  48 + Class<?> rightType = object.getClass();
  49 +
  50 + if (leftType.isAssignableFrom(Number.class) &&
  51 + rightType.isAssignableFrom(Number.class)) { // 判定是否是Number类型的子类
  52 + return cb.ge((Path<Number>) expression, (Number) object);
  53 + } else if (leftType.isAssignableFrom(String.class) &&
  54 + rightType.isAssignableFrom(String.class)) { // 判定是否是String类型的子类
  55 + return cb.greaterThanOrEqualTo((Path<String>) expression, (String) object);
  56 + } else if (leftType.isAssignableFrom(Date.class) &&
  57 + rightType.isAssignableFrom(Date.class)) { // 判定是否是Date类型的子类
  58 + return cb.greaterThanOrEqualTo((Path<Date>) expression, (Date) object);
  59 + } else {
  60 + throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass());
  61 + }
54 } 62 }
55 63
56 public static Predicate lt(CriteriaBuilder cb,Path<Number> expression, Object object){ 64 public static Predicate lt(CriteriaBuilder cb,Path<Number> expression, Object object){
@@ -62,13 +70,22 @@ public class PredicatesBuilder { @@ -62,13 +70,22 @@ public class PredicatesBuilder {
62 } 70 }
63 } 71 }
64 72
65 - public static Predicate le(CriteriaBuilder cb,Path<Number> expression, Object object){  
66 - try {  
67 - return cb.le(expression, nf.parse(object.toString()));  
68 - } catch (ParseException e) {  
69 - e.printStackTrace();  
70 - return null;  
71 - } 73 + public static Predicate le(CriteriaBuilder cb,Path<?> expression, Object object){
  74 + Class<?> leftType = expression.getJavaType();
  75 + Class<?> rightType = object.getClass();
  76 +
  77 + if (leftType.isAssignableFrom(Number.class) &&
  78 + rightType.isAssignableFrom(Number.class)) { // 判定是否是Number类型的子类
  79 + return cb.le((Path<Number>) expression, (Number) object);
  80 + } else if (leftType.isAssignableFrom(String.class) &&
  81 + rightType.isAssignableFrom(String.class)) { // 判定是否是String类型的子类
  82 + return cb.lessThanOrEqualTo((Path<String>) expression, (String) object);
  83 + } else if (leftType.isAssignableFrom(Date.class) &&
  84 + rightType.isAssignableFrom(Date.class)) { // 判定是否是Date类型的子类
  85 + return cb.lessThanOrEqualTo((Path<Date>) expression, (Date) object);
  86 + } else {
  87 + throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass());
  88 + }
72 } 89 }
73 90
74 public static Predicate prefixLike(CriteriaBuilder cb,Path<String> expression, Object object){ 91 public static Predicate prefixLike(CriteriaBuilder cb,Path<String> expression, Object object){
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 package com.bsth.repository.oil; 1 package com.bsth.repository.oil;
2 2
  3 +import java.util.Date;
3 import java.util.List; 4 import java.util.List;
  5 +import java.util.Map;
4 6
5 import org.springframework.data.jpa.repository.Modifying; 7 import org.springframework.data.jpa.repository.Modifying;
6 import org.springframework.data.jpa.repository.Query; 8 import org.springframework.data.jpa.repository.Query;
@@ -19,7 +21,9 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -19,7 +21,9 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
19 */ 21 */
20 @Transactional 22 @Transactional
21 @Modifying 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 List<Ylb> obtainYlbefore(String rq); 27 List<Ylb> obtainYlbefore(String rq);
24 28
25 /** 29 /**
@@ -31,4 +35,15 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -31,4 +35,15 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
31 @Modifying 35 @Modifying
32 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true) 36 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true)
33 List<Ylb> obtainYl(String rq); 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,4 +21,10 @@ public interface YlxxbRepository extends BaseRepository&lt;Ylxxb, Integer&gt;{
21 @Modifying 21 @Modifying
22 @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?)=to_days(yyrq)",nativeQuery=true) 22 @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?)=to_days(yyrq)",nativeQuery=true)
23 List<Ylxxb> obtainYlxx(String rq); 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,6 +23,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
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)") 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 List<ScheduleRealInfo> queryUserInfo(String line,String date); 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 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs") 29 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")
27 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); 30 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);
28 31
@@ -57,6 +60,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -57,6 +60,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
57 @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") 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 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date); 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 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") 66 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
61 List<ScheduleRealInfo> scheduleDaily(String line,String date); 67 List<ScheduleRealInfo> scheduleDaily(String line,String date);
62 68
@@ -72,7 +78,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -72,7 +78,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
72 @Query(value = "delete ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2") 78 @Query(value = "delete ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
73 void deleteByLineCodeAndDate(String xlBm, String schDate); 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 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); 82 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
77 83
78 @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") 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/impl/CarDeviceServiceImpl.java
@@ -2,8 +2,10 @@ package com.bsth.service.impl; @@ -2,8 +2,10 @@ package com.bsth.service.impl;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.entity.CarDevice; 4 import com.bsth.entity.CarDevice;
  5 +import com.bsth.entity.Cars;
5 import com.bsth.entity.schedule.rule.RerunRule; 6 import com.bsth.entity.schedule.rule.RerunRule;
6 import com.bsth.repository.CarDeviceRepository; 7 import com.bsth.repository.CarDeviceRepository;
  8 +import com.bsth.repository.CarsRepository;
7 import com.bsth.service.CarDeviceService; 9 import com.bsth.service.CarDeviceService;
8 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
@@ -17,9 +19,31 @@ import java.util.Map; @@ -17,9 +19,31 @@ import java.util.Map;
17 */ 19 */
18 @Service 20 @Service
19 public class CarDeviceServiceImpl extends BaseServiceImpl<CarDevice, Long> implements CarDeviceService { 21 public class CarDeviceServiceImpl extends BaseServiceImpl<CarDevice, Long> implements CarDeviceService {
20 -  
21 @Autowired 22 @Autowired
22 private CarDeviceRepository carDeviceRepository; 23 private CarDeviceRepository carDeviceRepository;
  24 + @Autowired
  25 + private CarsRepository carsRepository;
  26 +
  27 + @Transactional
  28 + @Override
  29 + public Map<String, Object> save(CarDevice carDevice) {
  30 + Map<String, Object> map = new HashMap<>();
  31 +
  32 + try {
  33 + // 查找对应的车辆基础信息,更新设备编号数据
  34 + Cars cars = carsRepository.findOne(carDevice.getCl());
  35 + cars.setEquipmentCode(carDevice.getNewDeviceNo());
  36 + // 保存车辆设备信息
  37 + carDeviceRepository.save(carDevice);
  38 + map.put("status", ResponseCode.SUCCESS);
  39 + map.put("t", carDevice);
  40 + } catch(Exception e) {
  41 + map.put("status", ResponseCode.ERROR);
  42 + logger.error("save erro.", e);
  43 + }
  44 +
  45 + return map;
  46 + }
23 47
24 @Transactional 48 @Transactional
25 @Override 49 @Override
src/main/java/com/bsth/service/oil/YlbService.java
1 package com.bsth.service.oil; 1 package com.bsth.service.oil;
2 2
3 -import java.util.List;  
4 import java.util.Map; 3 import java.util.Map;
5 4
6 import com.bsth.entity.oil.Ylb; 5 import com.bsth.entity.oil.Ylb;
7 import com.bsth.service.BaseService; 6 import com.bsth.service.BaseService;
8 7
9 public interface YlbService extends BaseService<Ylb, Integer>{ 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 package com.bsth.service.oil; 1 package com.bsth.service.oil;
2 2
  3 +import java.util.Map;
  4 +
3 import com.bsth.entity.oil.Ylxxb; 5 import com.bsth.entity.oil.Ylxxb;
4 import com.bsth.service.BaseService; 6 import com.bsth.service.BaseService;
  7 +import com.bsth.util.PageObject;
5 8
6 public interface YlxxbService extends BaseService<Ylxxb, Integer>{ 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 package com.bsth.service.oil.impl; 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 import java.util.ArrayList; 6 import java.util.ArrayList;
  7 +import java.util.Date;
4 import java.util.HashMap; 8 import java.util.HashMap;
  9 +import java.util.Iterator;
5 import java.util.List; 10 import java.util.List;
6 import java.util.Map; 11 import java.util.Map;
7 12
  13 +import javax.transaction.Transactional;
  14 +
8 import org.slf4j.Logger; 15 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 16 import org.slf4j.LoggerFactory;
10 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.data.domain.Sort;
  19 +import org.springframework.data.domain.Sort.Direction;
11 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
12 21
13 import com.bsth.common.ResponseCode; 22 import com.bsth.common.ResponseCode;
  23 +import com.bsth.entity.oil.Cyl;
14 import com.bsth.entity.oil.Ylb; 24 import com.bsth.entity.oil.Ylb;
15 import com.bsth.entity.oil.Ylxxb; 25 import com.bsth.entity.oil.Ylxxb;
  26 +import com.bsth.entity.search.CustomerSpecs;
  27 +import com.bsth.repository.oil.CylRepository;
16 import com.bsth.repository.oil.YlbRepository; 28 import com.bsth.repository.oil.YlbRepository;
17 import com.bsth.repository.oil.YlxxbRepository; 29 import com.bsth.repository.oil.YlxxbRepository;
18 import com.bsth.service.impl.BaseServiceImpl; 30 import com.bsth.service.impl.BaseServiceImpl;
19 import com.bsth.service.oil.YlbService; 31 import com.bsth.service.oil.YlbService;
  32 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
20 import com.github.abel533.echarts.code.Y; 33 import com.github.abel533.echarts.code.Y;
21 34
22 @Service 35 @Service
@@ -27,43 +40,356 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -27,43 +40,356 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
27 @Autowired 40 @Autowired
28 YlxxbRepository ylxxbRepository; 41 YlxxbRepository ylxxbRepository;
29 42
  43 + @Autowired
  44 + CylRepository cylRepository;
  45 +
  46 + @Autowired
  47 + ScheduleRealInfoService scheduleRealInfoService;
  48 +
30 Logger logger = LoggerFactory.getLogger(this.getClass()); 49 Logger logger = LoggerFactory.getLogger(this.getClass());
  50 +
  51 +
  52 + /**
  53 + * 获取进存油信息
  54 + * @Transactional 回滚事物
  55 + */
  56 + @Transactional
31 @Override 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 // TODO Auto-generated method stub 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 //当天YLB信息 64 //当天YLB信息
36 List<Ylb> ylList=repository.obtainYl(rq); 65 List<Ylb> ylList=repository.obtainYl(rq);
37 //当天YLXXB信息 66 //当天YLXXB信息
38 List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); 67 List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);
39 -  
40 - //前一天YLB信息 68 + //前一天所有车辆最后进场班次信息
41 List<Ylb> ylListBe=repository.obtainYlbefore(rq); 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 try{ 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 repository.save(t); 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 }catch(Exception e){ 314 }catch(Exception e){
61 - map.put("status", ResponseCode.ERROR); 315 + newMap.put("status", ResponseCode.ERROR);
62 logger.error("save erro.", e); 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 package com.bsth.service.oil.impl; 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 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
4 14
  15 +import com.bsth.common.ResponseCode;
  16 +import com.bsth.entity.oil.Ylb;
5 import com.bsth.entity.oil.Ylxxb; 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 import com.bsth.service.impl.BaseServiceImpl; 21 import com.bsth.service.impl.BaseServiceImpl;
7 import com.bsth.service.oil.YlxxbService; 22 import com.bsth.service.oil.YlxxbService;
  23 +import com.bsth.util.PageHelper;
  24 +import com.bsth.util.PageObject;
8 25
9 @Service 26 @Service
10 public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements YlxxbService 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,6 +113,9 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
113 113
114 List<ScheduleRealInfo> realScheduleList(String line,String date); 114 List<ScheduleRealInfo> realScheduleList(String line,String date);
115 115
  116 +
  117 + List<Map<String,Object>> yesterdayDataList(String line,String date);
  118 +
116 List<Map<String,Object>> yesterdayDataList(String line); 119 List<Map<String,Object>> yesterdayDataList(String line);
117 120
118 Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs); 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,7 +509,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
509 509
510 @Override 510 @Override
511 public List<ScheduleRealInfo> queryUserInfo(String line, String date) { 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,7 +1165,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1165 @Override 1165 @Override
1166 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh, 1166 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1167 String lpName,String date) { 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 @Override 1171 @Override
@@ -1467,9 +1467,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -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 List<Map<String,Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date); 1474 List<Map<String,Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
1474 List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); 1475 List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
1475 for(ScheduleRealInfo scheduleRealInfo:list){ 1476 for(ScheduleRealInfo scheduleRealInfo:list){
@@ -1609,4 +1610,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1609,4 +1610,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1609 rs.put("ts", list); 1610 rs.put("ts", list);
1610 return rs; 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/resources/application-dev.properties
@@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
8 spring.jpa.database= MYSQL 8 spring.jpa.database= MYSQL
9 spring.jpa.show-sql= true 9 spring.jpa.show-sql= true
10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver 10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11 -spring.datasource.url= jdbc:mysql://127.0.0.1:3306/qp_control 11 +spring.datasource.url= jdbc:mysql://192.168.168.201:3306/mh_control
12 spring.datasource.username= root 12 spring.datasource.username= root
13 -spring.datasource.password= panzhao 13 +spring.datasource.password= 123456
14 #DATASOURCE 14 #DATASOURCE
15 spring.datasource.max-active=100 15 spring.datasource.max-active=100
16 spring.datasource.max-idle=8 16 spring.datasource.max-idle=8
src/main/resources/datatools/config-prod.properties
@@ -4,11 +4,11 @@ @@ -4,11 +4,11 @@
4 datatools.kettle_properties=/datatools/kettle.properties 4 datatools.kettle_properties=/datatools/kettle.properties
5 # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正) 5 # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正)
6 #数据库ip地址 6 #数据库ip地址
7 -datatools.kvars_dbip=192.168.40.82 7 +datatools.kvars_dbip=192.168.40.100
8 #数据库用户名 8 #数据库用户名
9 datatools.kvars_dbuname=root 9 datatools.kvars_dbuname=root
10 #数据库密码 10 #数据库密码
11 -datatools.kvars_dbpwd=123456 11 +datatools.kvars_dbpwd=root@JSP2jsp
12 #数据库库名 12 #数据库库名
13 datatools.kvars_dbdname=qp_control 13 datatools.kvars_dbdname=qp_control
14 14
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,6 +4,6 @@
4 #ms.mysql.password= 123456 4 #ms.mysql.password= 123456
5 5
6 ms.mysql.driver= com.mysql.jdbc.Driver 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 ms.mysql.username= root 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 }},"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)}); 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 \ No newline at end of file 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 </html> 99 </html>
100 \ No newline at end of file 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 ;!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); 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 \ No newline at end of file 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 \ No newline at end of file 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 \ No newline at end of file 3 \ No newline at end of file
src/main/resources/static/pages/forms/statement/waybill.html
@@ -158,9 +158,11 @@ @@ -158,9 +158,11 @@
158 $(this).children().each(function(index){ 158 $(this).children().each(function(index){
159 params[index] = $(this).text(); 159 params[index] = $(this).text();
160 }); 160 });
  161 + console.log(params);
161 jName = params[0].split("\\")[0]; 162 jName = params[0].split("\\")[0];
162 var id = $("#"+params[1]).val(); 163 var id = $("#"+params[1]).val();
163 $get('/realSchedule/'+id,null,function(result){ 164 $get('/realSchedule/'+id,null,function(result){
  165 + console.log(result);
164 result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); 166 result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");
165 var ludan_1 = template('ludan_1',result); 167 var ludan_1 = template('ludan_1',result);
166 //var ludan_4 = template('ludan_4',result); 168 //var ludan_4 = template('ludan_4',result);
@@ -220,9 +222,9 @@ @@ -220,9 +222,9 @@
220 <script type="text/html" id="list_info"> 222 <script type="text/html" id="list_info">
221 {{each list as obj i}} 223 {{each list as obj i}}
222 <tr> 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 </tr> 228 </tr>
227 {{/each}} 229 {{/each}}
228 {{if list.length == 0}} 230 {{if list.length == 0}}
src/main/resources/static/pages/oil/cylList.html
@@ -56,8 +56,8 @@ @@ -56,8 +56,8 @@
56 <th width="3%">#</th> 56 <th width="3%">#</th>
57 <th width="15%">公司</th> 57 <th width="15%">公司</th>
58 <th width="15%">车辆编码</th> 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 <th width="18%">最后更新时间</th> 61 <th width="18%">最后更新时间</th>
62 <th width="19%">操作</th> 62 <th width="19%">操作</th>
63 </tr> 63 </tr>
src/main/resources/static/pages/oil/list.html
@@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
21 </div> 21 </div>
22 <div class="actions"> 22 <div class="actions">
23 <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a> 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 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> --> 26 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
27 <div class="btn-group"> 27 <div class="btn-group">
28 <a class="btn red btn-outline btn-circle" href="javascript:;" 28 <a class="btn red btn-outline btn-circle" href="javascript:;"
@@ -34,9 +34,9 @@ @@ -34,9 +34,9 @@
34 class="tool-action" id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息 34 class="tool-action" id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息
35 </a></li> 35 </a></li>
36 <li><a href="javascript:;" data-action="1" 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 </a></li> 38 </a></li>
39 - <li><a href="javascript:;" data-action="3" 39 + <li><a href="javascript:;" id="checkYl" data-action="3"
40 class="tool-action"> <i class="fa fa-gg-circle"></i> 40 class="tool-action"> <i class="fa fa-gg-circle"></i>
41 核对加注量(有加油无里程) 41 核对加注量(有加油无里程)
42 </a></li> 42 </a></li>
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
86 内部编码: 86 内部编码:
87 </td> 87 </td>
88 <td colspan="3"> 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 </td> 90 </td>
91 <td colspan="4"> 91 <td colspan="4">
92 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > 92 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
@@ -101,14 +101,14 @@ @@ -101,14 +101,14 @@
101 <th width="2%">#</th> 101 <th width="2%">#</th>
102 <th width="8%">日期</th> 102 <th width="8%">日期</th>
103 <th width="5%">公司</th> 103 <th width="5%">公司</th>
104 - <th width="5%">分公司</th> 104 + <th width="8%">线路</th>
105 <th width="5%">自编号</th> 105 <th width="5%">自编号</th>
106 <th width="6%">驾驶员</th> 106 <th width="6%">驾驶员</th>
107 - <th width="5%">加油量</th> 107 + <th width="4%">加油量</th>
108 <th width="5%">出场公里</th> 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 <th width="5%">油耗</th> 112 <th width="5%">油耗</th>
113 <th width="5%">燃油类型</th> 113 <th width="5%">燃油类型</th>
114 <th width="4%">尿素</th> 114 <th width="4%">尿素</th>
@@ -135,17 +135,17 @@ @@ -135,17 +135,17 @@
135 {{each list as obj i}} 135 {{each list as obj i}}
136 <tr> 136 <tr>
137 <td style="vertical-align: middle;"> 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 </td> 139 </td>
  140 +
140 <td> 141 <td>
141 -  
142 {{obj.rq}} 142 {{obj.rq}}
143 </td> 143 </td>
144 <td> 144 <td>
145 - {{obj.ssgsdm}} 145 + {{obj.gsname}}
146 </td> 146 </td>
147 <td> 147 <td>
148 - {{obj.fgsdm}} 148 + {{obj.xlname}}
149 </td> 149 </td>
150 <td> 150 <td>
151 {{obj.nbbm}} 151 {{obj.nbbm}}
@@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
192 {{obj.yhlx}} 192 {{obj.yhlx}}
193 </td> 193 </td>
194 <td> 194 <td>
195 - {{(obj.yh/obj.zlc)}} 195 + {{obj.bglyh}}
196 </td> 196 </td>
197 <td> 197 <td>
198 <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a> 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,11 +208,70 @@
208 208
209 <script> 209 <script>
210 $(function(){ 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 $("#sortButton").on('click',function(){ 258 $("#sortButton").on('click',function(){
213 console.log("拆分油量"); 259 console.log("拆分油量");
214 if($("#rq").val()!=""){ 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 }else{ 275 }else{
217 layer.msg('请选择日期.'); 276 layer.msg('请选择日期.');
218 } 277 }
@@ -234,6 +293,7 @@ $(function(){ @@ -234,6 +293,7 @@ $(function(){
234 } 293 }
235 }); 294 });
236 $get('/ylb/obtain', params, function(){ 295 $get('/ylb/obtain', params, function(){
  296 + console.log("----------------------");
237 jsDoQuery(null,true); 297 jsDoQuery(null,true);
238 }); 298 });
239 }else{ 299 }else{
@@ -251,7 +311,7 @@ $(function(){ @@ -251,7 +311,7 @@ $(function(){
251 } 311 }
252 var page = 0, initPagination; 312 var page = 0, initPagination;
253 var icheckOptions = { 313 var icheckOptions = {
254 - checkboxClass: 'icheckbox_flat-blue', 314 + radioClass: 'iradio_square-blue icheck',
255 increaseArea: '20%' 315 increaseArea: '20%'
256 } 316 }
257 317
@@ -315,16 +375,16 @@ $(function(){ @@ -315,16 +375,16 @@ $(function(){
315 } 375 }
316 376
317 function iCheckChange(){ 377 function iCheckChange(){
318 - var tr = $(this).parents('tr'); 378 + var tr = $(this).parents('tr');
319 if(this.checked) 379 if(this.checked)
320 tr.addClass('row-active'); 380 tr.addClass('row-active');
321 else 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 $('#removeButton').removeAttr('disabled'); 385 $('#removeButton').removeAttr('disabled');
326 else 386 else
327 - $('#removeButton').attr('disabled', 'disabled'); 387 + $('#removeButton').attr('disabled', 'disabled'); */
328 } 388 }
329 389
330 function showPagination(data){ 390 function showPagination(data){
@@ -357,8 +417,7 @@ $(function(){ @@ -357,8 +417,7 @@ $(function(){
357 if($(this).attr('disabled')) 417 if($(this).attr('disabled'))
358 return; 418 return;
359 419
360 - var id = $('#datatable_resource input.icheck:checked').data('id');  
361 - 420 + var id = $('input.icheck:checked').data('id');
362 removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ 421 removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){
363 $('tr.filter .filter-submit').click(); 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 </script> 191 </script>
192 \ No newline at end of file 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/basicInfo/busInfoManage/edit.html
@@ -45,7 +45,10 @@ @@ -45,7 +45,10 @@
45 <div class="col-md-3"> 45 <div class="col-md-3">
46 <input type="text" class="form-control" 46 <input type="text" class="form-control"
47 name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" 47 name="insideCode" ng-model="ctrl.busInfoForSave.insideCode"
48 - required ng-maxlength="8" remote-Validaton rvtype="insideCode" 48 + required ng-maxlength="8"
  49 + remote-Validation
  50 + remotevtype="cl1"
  51 + remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}"
49 placeholder="请输入车辆内部编码"/> 52 placeholder="请输入车辆内部编码"/>
50 </div> 53 </div>
51 <!-- 隐藏块,显示验证信息 --> 54 <!-- 隐藏块,显示验证信息 -->
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
@@ -45,7 +45,10 @@ @@ -45,7 +45,10 @@
45 <div class="col-md-3"> 45 <div class="col-md-3">
46 <input type="text" class="form-control" 46 <input type="text" class="form-control"
47 name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" 47 name="insideCode" ng-model="ctrl.busInfoForSave.insideCode"
48 - required ng-maxlength="8" remote-Validaton rvtype="insideCode" 48 + required ng-maxlength="8"
  49 + remote-Validation
  50 + remotevtype="cl1"
  51 + remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}"
49 placeholder="请输入车辆内部编码"/> 52 placeholder="请输入车辆内部编码"/>
50 </div> 53 </div>
51 <!-- 隐藏块,显示验证信息 --> 54 <!-- 隐藏块,显示验证信息 -->
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html
@@ -144,7 +144,10 @@ @@ -144,7 +144,10 @@
144 name="qyrq" placeholder="请选择启用日期..." 144 name="qyrq" placeholder="请选择启用日期..."
145 uib-datepicker-popup="yyyy年MM月dd日" 145 uib-datepicker-popup="yyyy年MM月dd日"
146 is-open="ctrl.qyrqOpen" required 146 is-open="ctrl.qyrqOpen" required
147 - ng-model="ctrl.deviceInfoForSave.qyrq" readonly/> 147 + ng-model="ctrl.deviceInfoForSave.qyrq" readonly
  148 + remote-Validation
  149 + remotevtype="cde1"
  150 + remotevparam="{{ {'qyrq': ctrl.deviceInfoForSave.qyrq} | json}}"/>
148 <span class="input-group-btn"> 151 <span class="input-group-btn">
149 <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()"> 152 <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
150 <i class="glyphicon glyphicon-calendar"></i> 153 <i class="glyphicon glyphicon-calendar"></i>
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html
@@ -144,7 +144,10 @@ @@ -144,7 +144,10 @@
144 name="qyrq" placeholder="请选择启用日期..." 144 name="qyrq" placeholder="请选择启用日期..."
145 uib-datepicker-popup="yyyy年MM月dd日" 145 uib-datepicker-popup="yyyy年MM月dd日"
146 is-open="ctrl.qyrqOpen" required 146 is-open="ctrl.qyrqOpen" required
147 - ng-model="ctrl.deviceInfoForSave.qyrq" readonly/> 147 + ng-model="ctrl.deviceInfoForSave.qyrq" readonly
  148 + remote-Validation
  149 + remotevtype="cde1"
  150 + remotevparam="{{ {'qyrq': ctrl.deviceInfoForSave.qyrq, 'xl': ctrl.deviceInfoForSave.xl, 'cl': ctrl.deviceInfoForSave.cl} | json}}"/>
148 <span class="input-group-btn"> 151 <span class="input-group-btn">
149 <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()"> 152 <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
150 <i class="glyphicon glyphicon-calendar"></i> 153 <i class="glyphicon glyphicon-calendar"></i>
@@ -156,6 +159,9 @@ @@ -156,6 +159,9 @@
156 <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required"> 159 <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required">
157 启用日期必须选择 160 启用日期必须选择
158 </div> 161 </div>
  162 + <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.remote">
  163 + 启用日期必须比历史的启用日期大
  164 + </div>
159 </div> 165 </div>
160 166
161 <!-- 其他form-group --> 167 <!-- 其他form-group -->
src/main/resources/static/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroup.js
1 -  
2 -  
3 -/**  
4 - * saCheckboxgroup指令  
5 - * 属性如下:  
6 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
7 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
8 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
9 - * name(必须):控件的名字  
10 - * required(可选):是否要用required验证  
11 - * disabled(可选):标示框是否可选  
12 - *  
13 - */  
14 -angular.module('ScheduleApp').directive('saCheckboxgroup', [  
15 - function() {  
16 - return {  
17 - restrict: 'E',  
18 - templateUrl: '/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroupTemplate.html',  
19 - scope: {  
20 - model: "=" // 独立作用域,关联外部的模型object  
21 - },  
22 - controllerAs: "$saCheckboxgroupCtrl",  
23 - bindToController: true,  
24 - controller: function($scope) {  
25 - var self = this;  
26 - self.$$data = []; // 内部的数据  
27 -  
28 - // TODO:数据写死,周一至周日选择数据,以后有别的数据再议  
29 - self.$$data = [  
30 - {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
31 - {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
32 - {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
33 - {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
34 - {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
35 - {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
36 - {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}  
37 - ];  
38 - },  
39 -  
40 - /**  
41 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
42 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
43 - * @param tElem  
44 - * @param tAttrs  
45 - * @returns {{pre: Function, post: Function}}  
46 - */  
47 - compile: function(tElem, tAttrs) {  
48 - // 获取所有的属性  
49 - var $name_attr = tAttrs["name"]; // 控件的名字  
50 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
51 - var $disabled_attr = tAttrs["disabled"]; // 是否禁用  
52 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
53 -  
54 - // controlAs名字  
55 - var ctrlAs = '$saCheckboxgroupCtrl';  
56 -  
57 - // 如果有required属性,添加angularjs required验证  
58 - if ($required_attr != undefined) {  
59 - //console.log(tElem.html());  
60 - tElem.find("div").attr("required", "");  
61 - }  
62 - // 如果有disabled属性,添加禁用标志  
63 - if ($disabled_attr != undefined) {  
64 - tElem.find("input").attr("ng-disabled", "true");  
65 - }  
66 -  
67 - return {  
68 - pre: function(scope, element, attr) {  
69 - // TODO:  
70 - },  
71 - /**  
72 - * 相当于link函数。  
73 - * @param scope  
74 - * @param element  
75 - * @param attr  
76 - */  
77 - post: function(scope, element, attr) {  
78 - // name属性  
79 - if ($name_attr) {  
80 - scope[ctrlAs]["$name_attr"] = $name_attr;  
81 - }  
82 -  
83 - /**  
84 - * checkbox选择事件处理函数。  
85 - * @param $d 数据对象,$$data中的元素对象  
86 - */  
87 - scope[ctrlAs].$$internal_updateCheck_fn = function($d) {  
88 - $d.ischecked = !$d.ischecked;  
89 - console.log($d);  
90 - };  
91 -  
92 - // 测试使用watch监控$$data的变化  
93 - scope.$watch(  
94 - function() {  
95 - return scope[ctrlAs]["$$data"];  
96 - },  
97 - function(newValue, oldValue) {  
98 - // 根据$$data生成对应的数据  
99 - var rule_days_arr = [];  
100 - var i;  
101 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
102 - if (scope[ctrlAs]["$$data"][i].ischecked)  
103 - rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);  
104 - else  
105 - rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);  
106 - }  
107 - scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");  
108 - //scope[ctrlAs].$$internalmodel = undefined;  
109 - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);  
110 -  
111 - // 更新model  
112 - if ($dcname_attr) {  
113 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");  
114 - }  
115 -  
116 -  
117 - },  
118 - true  
119 - );  
120 -  
121 - // TODO:  
122 -  
123 - // 监控dcvalue model值变换  
124 - attr.$observe("dcvalue", function(value) {  
125 - console.log("saCheckboxgroup 监控dc1 model值变换:" + value);  
126 - if (value) {  
127 - // 根据value值,修改$$data里的值  
128 - var data_array = value.split(",");  
129 - var i;  
130 - if (data_array.length > scope[ctrlAs]["$$data"].length) {  
131 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {  
132 - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {  
133 - scope[ctrlAs]["$$data"][i].ischecked = true;  
134 - } else {  
135 - scope[ctrlAs]["$$data"][i].ischecked = false;  
136 - }  
137 - }  
138 - } else {  
139 - for (i = 0; i < data_array.length; i ++) {  
140 - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {  
141 - scope[ctrlAs]["$$data"][i].ischecked = true;  
142 - } else {  
143 - scope[ctrlAs]["$$data"][i].ischecked = false;  
144 - }  
145 - }  
146 - }  
147 -  
148 - }  
149 - });  
150 - }  
151 -  
152 - };  
153 -  
154 -  
155 - }  
156 -  
157 - };  
158 - }  
159 -]);  
160 - 1 +
  2 +
  3 +/**
  4 + * saCheckboxgroup指令
  5 + * 属性如下:
  6 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  7 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  8 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  9 + * name(必须):控件的名字
  10 + * required(可选):是否要用required验证
  11 + * disabled(可选):标示框是否可选
  12 + *
  13 + */
  14 +angular.module('ScheduleApp').directive('saCheckboxgroup', [
  15 + function() {
  16 + return {
  17 + restrict: 'E',
  18 + templateUrl: '/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroupTemplate.html',
  19 + scope: {
  20 + model: "=" // 独立作用域,关联外部的模型object
  21 + },
  22 + controllerAs: "$saCheckboxgroupCtrl",
  23 + bindToController: true,
  24 + controller: function($scope) {
  25 + var self = this;
  26 + self.$$data = []; // 内部的数据
  27 +
  28 + // TODO:数据写死,周一至周日选择数据,以后有别的数据再议
  29 + self.$$data = [
  30 + {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  31 + {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  32 + {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  33 + {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  34 + {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  35 + {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  36 + {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}
  37 + ];
  38 + },
  39 +
  40 + /**
  41 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  42 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  43 + * @param tElem
  44 + * @param tAttrs
  45 + * @returns {{pre: Function, post: Function}}
  46 + */
  47 + compile: function(tElem, tAttrs) {
  48 + // 获取所有的属性
  49 + var $name_attr = tAttrs["name"]; // 控件的名字
  50 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  51 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  52 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  53 +
  54 + // controlAs名字
  55 + var ctrlAs = '$saCheckboxgroupCtrl';
  56 +
  57 + // 如果有required属性,添加angularjs required验证
  58 + if ($required_attr != undefined) {
  59 + //console.log(tElem.html());
  60 + tElem.find("div").attr("required", "");
  61 + }
  62 + // 如果有disabled属性,添加禁用标志
  63 + if ($disabled_attr != undefined) {
  64 + tElem.find("input").attr("ng-disabled", "true");
  65 + }
  66 +
  67 + return {
  68 + pre: function(scope, element, attr) {
  69 + // TODO:
  70 + },
  71 + /**
  72 + * 相当于link函数。
  73 + * @param scope
  74 + * @param element
  75 + * @param attr
  76 + */
  77 + post: function(scope, element, attr) {
  78 + // name属性
  79 + if ($name_attr) {
  80 + scope[ctrlAs]["$name_attr"] = $name_attr;
  81 + }
  82 +
  83 + /**
  84 + * checkbox选择事件处理函数。
  85 + * @param $d 数据对象,$$data中的元素对象
  86 + */
  87 + scope[ctrlAs].$$internal_updateCheck_fn = function($d) {
  88 + $d.ischecked = !$d.ischecked;
  89 + console.log($d);
  90 + };
  91 +
  92 + // 测试使用watch监控$$data的变化
  93 + scope.$watch(
  94 + function() {
  95 + return scope[ctrlAs]["$$data"];
  96 + },
  97 + function(newValue, oldValue) {
  98 + // 根据$$data生成对应的数据
  99 + var rule_days_arr = [];
  100 + var i;
  101 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  102 + if (scope[ctrlAs]["$$data"][i].ischecked)
  103 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);
  104 + else
  105 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);
  106 + }
  107 + scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");
  108 + //scope[ctrlAs].$$internalmodel = undefined;
  109 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  110 +
  111 + // 更新model
  112 + if ($dcname_attr) {
  113 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");
  114 + }
  115 +
  116 +
  117 + },
  118 + true
  119 + );
  120 +
  121 + // TODO:
  122 +
  123 + // 监控dcvalue model值变换
  124 + attr.$observe("dcvalue", function(value) {
  125 + console.log("saCheckboxgroup 监控dc1 model值变换:" + value);
  126 + if (value) {
  127 + // 根据value值,修改$$data里的值
  128 + var data_array = value.split(",");
  129 + var i;
  130 + if (data_array.length > scope[ctrlAs]["$$data"].length) {
  131 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {
  132 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  133 + scope[ctrlAs]["$$data"][i].ischecked = true;
  134 + } else {
  135 + scope[ctrlAs]["$$data"][i].ischecked = false;
  136 + }
  137 + }
  138 + } else {
  139 + for (i = 0; i < data_array.length; i ++) {
  140 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  141 + scope[ctrlAs]["$$data"][i].ischecked = true;
  142 + } else {
  143 + scope[ctrlAs]["$$data"][i].ischecked = false;
  144 + }
  145 + }
  146 + }
  147 +
  148 + }
  149 + });
  150 + }
  151 +
  152 + };
  153 +
  154 +
  155 + }
  156 +
  157 + };
  158 + }
  159 +]);
  160 +
src/main/resources/static/pages/scheduleApp/module/common/dts1/load/loadingWidget.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 - }; 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 }]); 22 }]);
23 \ No newline at end of file 23 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroup.js
1 -  
2 -/**  
3 - * saRadiogroup指令  
4 - * 属性如下:  
5 - * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate  
6 - * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)  
7 - * name(必须):控件的名字  
8 - * required(可选):是否要用required验证  
9 - * disabled(可选):标示单选框是否可选  
10 - *  
11 - */  
12 -angular.module('ScheduleApp').directive("saRadiogroup", [function() {  
13 - /**  
14 - * 使用字典数据的单选按钮组的指令。  
15 - * 指令名称:truefalse-Dic  
16 - */  
17 - return {  
18 - restrict: 'E',  
19 - templateUrl: '/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroupTemplate.html',  
20 - scope: {  
21 - model: "="  
22 - },  
23 - controllerAs: "$saRadiogroupCtrl",  
24 - bindToController: true,  
25 - controller: function($scope) {  
26 - //$scope["model"] = {selectedOption: null};  
27 - //console.log("controller");  
28 - //console.log("controller:" + $scope["model"]);  
29 -  
30 - var self = this;  
31 - self.$$data = null; // 内部数据  
32 - },  
33 -  
34 - /**  
35 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
36 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
37 - * @param tElem  
38 - * @param tAttrs  
39 - * @returns {{pre: Function, post: Function}}  
40 - */  
41 - compile: function(tElem, tAttrs) {  
42 - // 获取属性  
43 - var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type  
44 - var $name_attr = tAttrs["name"]; // 控件的名字  
45 - var $required_attr = tAttrs["required"]; // 是否要用required验证  
46 - var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选  
47 -  
48 - // controlAs名字  
49 - var ctrlAs = "$saRadiogroupCtrl";  
50 -  
51 - // 如果有required属性,添加angularjs required验证  
52 - if ($required_attr != undefined) {  
53 - tElem.find("input").attr("required", "");  
54 - }  
55 -  
56 - return {  
57 - pre: function(scope, element, attr) {  
58 -  
59 - },  
60 -  
61 - /**  
62 - * 相当于link函数。  
63 - * @param scope  
64 - * @param element  
65 - * @param attr  
66 - */  
67 - post: function(scope, element, attr) {  
68 - //console.log("link");  
69 - //console.log("link:" + scope.model);  
70 - //scope["model"] = {selectedOption: null};  
71 -  
72 - if ($name_attr) {  
73 - scope[ctrlAs].nv = $name_attr;  
74 - }  
75 -  
76 - if ($disabled_attr) {  
77 - scope[ctrlAs].disabled = true;  
78 - }  
79 - if ($dicgroup_attr) {  
80 - var obj = dictionaryUtils.getByGroup($dicgroup_attr);  
81 - scope[ctrlAs].$$data = obj;  
82 - // 处理 scope["dic"] key值  
83 - scope[ctrlAs].dicvalueCalcu = function(value) {  
84 - if (value == "true") {  
85 - //console.log(value);  
86 - return true;  
87 - } else if (value == "false") {  
88 - //console.log(value);  
89 - return false;  
90 - } else {  
91 - return value;  
92 - }  
93 - };  
94 - }  
95 - }  
96 - };  
97 - }  
98 - };  
99 -}]); 1 +
  2 +/**
  3 + * saRadiogroup指令
  4 + * 属性如下:
  5 + * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate
  6 + * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)
  7 + * name(必须):控件的名字
  8 + * required(可选):是否要用required验证
  9 + * disabled(可选):标示单选框是否可选
  10 + *
  11 + */
  12 +angular.module('ScheduleApp').directive("saRadiogroup", [function() {
  13 + /**
  14 + * 使用字典数据的单选按钮组的指令。
  15 + * 指令名称:truefalse-Dic
  16 + */
  17 + return {
  18 + restrict: 'E',
  19 + templateUrl: '/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroupTemplate.html',
  20 + scope: {
  21 + model: "="
  22 + },
  23 + controllerAs: "$saRadiogroupCtrl",
  24 + bindToController: true,
  25 + controller: function($scope) {
  26 + //$scope["model"] = {selectedOption: null};
  27 + //console.log("controller");
  28 + //console.log("controller:" + $scope["model"]);
  29 +
  30 + var self = this;
  31 + self.$$data = null; // 内部数据
  32 + },
  33 +
  34 + /**
  35 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  36 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  37 + * @param tElem
  38 + * @param tAttrs
  39 + * @returns {{pre: Function, post: Function}}
  40 + */
  41 + compile: function(tElem, tAttrs) {
  42 + // 获取属性
  43 + var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type
  44 + var $name_attr = tAttrs["name"]; // 控件的名字
  45 + var $required_attr = tAttrs["required"]; // 是否要用required验证
  46 + var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选
  47 +
  48 + // controlAs名字
  49 + var ctrlAs = "$saRadiogroupCtrl";
  50 +
  51 + // 如果有required属性,添加angularjs required验证
  52 + if ($required_attr != undefined) {
  53 + tElem.find("input").attr("required", "");
  54 + }
  55 +
  56 + return {
  57 + pre: function(scope, element, attr) {
  58 +
  59 + },
  60 +
  61 + /**
  62 + * 相当于link函数。
  63 + * @param scope
  64 + * @param element
  65 + * @param attr
  66 + */
  67 + post: function(scope, element, attr) {
  68 + //console.log("link");
  69 + //console.log("link:" + scope.model);
  70 + //scope["model"] = {selectedOption: null};
  71 +
  72 + if ($name_attr) {
  73 + scope[ctrlAs].nv = $name_attr;
  74 + }
  75 +
  76 + if ($disabled_attr) {
  77 + scope[ctrlAs].disabled = true;
  78 + }
  79 + if ($dicgroup_attr) {
  80 + var obj = dictionaryUtils.getByGroup($dicgroup_attr);
  81 + scope[ctrlAs].$$data = obj;
  82 + // 处理 scope["dic"] key值
  83 + scope[ctrlAs].dicvalueCalcu = function(value) {
  84 + if (value == "true") {
  85 + //console.log(value);
  86 + return true;
  87 + } else if (value == "false") {
  88 + //console.log(value);
  89 + return false;
  90 + } else {
  91 + return value;
  92 + }
  93 + };
  94 + }
  95 + }
  96 + };
  97 + }
  98 + };
  99 +}]);
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect.js
1 -  
2 -angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {  
3 - return {  
4 - restrict: 'E',  
5 - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelectTemplate.html',  
6 - scope: {  
7 - model: "="  
8 - },  
9 - controllerAs: "$saSelectCtrl",  
10 - bindToController: true,  
11 - controller: function() {  
12 - var self = this;  
13 - self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}  
14 - },  
15 - /**  
16 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
17 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
18 - * @param tElem  
19 - * @param tAttrs  
20 - * @returns {{pre: Function, post: Function}}  
21 - */  
22 - compile: function(tElem, tAttrs) {  
23 - // 确定是否使用angularjs required验证  
24 - // 属性 required  
25 - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加  
26 - var required_attr = tAttrs["required"];  
27 - if (required_attr) {  
28 - if (required_attr == "true") {  
29 - // 添加required属性指令  
30 - tElem.find("ui-select").attr("required", "");  
31 - } else {  
32 - // 不等于true,不添加required属性指令  
33 - }  
34 - } else {  
35 - // 不添加required属性指令  
36 - }  
37 -  
38 - //console.log("saSelect" + ":compile = >" + tElem.html());  
39 -  
40 - return {  
41 - pre: function(scope, element, attr) {  
42 - // TODO:  
43 - },  
44 - /**  
45 - * 相当于link函数。  
46 - *  
47 - * 重要属性如下:  
48 - * model 是绑定外部值。  
49 - * dicgroup 字典组的类型  
50 - * name input name属性值  
51 - */  
52 - post: function(scope, element, attr) {  
53 - // 1、获取属性  
54 - var dicgroup_attr = attr['dicgroup']; // 字典组的类型  
55 - var name_attr = attr['name']; // input name属性值  
56 - var dicname_attr = attr['dicname']; // model关联的字典名字段  
57 - var codename_attr = attr['codename']; // model关联的字典值字段  
58 - var placeholder_attr = attr['placeholder']; // select placeholder提示  
59 -  
60 - // 系统的字典对象,使用dictionaryUtils类获取  
61 - var origin_dicgroup;  
62 - var dic_key; // 字典key  
63 -  
64 - if (dicgroup_attr) { // 赋值指定的字典数据  
65 - origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);  
66 - for (dic_key in origin_dicgroup) {  
67 - var data = {}; // 重新组合的字典元素对象  
68 - if (dic_key == "true")  
69 - data.code = true;  
70 - else  
71 - data.code = dic_key;  
72 - data.name = origin_dicgroup[dic_key];  
73 - scope["$saSelectCtrl"].datas.push(data);  
74 - }  
75 - }  
76 -  
77 - if (name_attr) {  
78 - scope["$saSelectCtrl"].nv = name_attr;  
79 - }  
80 - if (placeholder_attr) {  
81 - scope["$saSelectCtrl"].ph = placeholder_attr;  
82 - }  
83 -  
84 - scope["$saSelectCtrl"].select = function($item) {  
85 - if (codename_attr) {  
86 - scope["$saSelectCtrl"].model[codename_attr] = $item.code;  
87 - }  
88 - if (dicname_attr) {  
89 - scope["$saSelectCtrl"].model[dicname_attr] = $item.name;  
90 - }  
91 - };  
92 -  
93 - scope["$saSelectCtrl"].remove = function() {  
94 - if (codename_attr) {  
95 - scope["$saSelectCtrl"].model[codename_attr] = null;  
96 - }  
97 - if (dicname_attr) {  
98 - scope["$saSelectCtrl"].model[dicname_attr] = null;  
99 - }  
100 - scope["$saSelectCtrl"].cmodel = null;  
101 - };  
102 -  
103 - $timeout(function() {  
104 - // 创建内部使用的绑定对象  
105 - var model_code = scope["$saSelectCtrl"].model[codename_attr];  
106 - scope["$saSelectCtrl"].cmodel = model_code;  
107 - }, 0);  
108 - }  
109 - }  
110 - }  
111 - };  
112 -}]); 1 +
  2 +angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
  3 + return {
  4 + restrict: 'E',
  5 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelectTemplate.html',
  6 + scope: {
  7 + model: "="
  8 + },
  9 + controllerAs: "$saSelectCtrl",
  10 + bindToController: true,
  11 + controller: function() {
  12 + var self = this;
  13 + self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}
  14 + },
  15 + /**
  16 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  17 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  18 + * @param tElem
  19 + * @param tAttrs
  20 + * @returns {{pre: Function, post: Function}}
  21 + */
  22 + compile: function(tElem, tAttrs) {
  23 + // 确定是否使用angularjs required验证
  24 + // 属性 required
  25 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  26 + var required_attr = tAttrs["required"];
  27 + if (required_attr) {
  28 + if (required_attr == "true") {
  29 + // 添加required属性指令
  30 + tElem.find("ui-select").attr("required", "");
  31 + } else {
  32 + // 不等于true,不添加required属性指令
  33 + }
  34 + } else {
  35 + // 不添加required属性指令
  36 + }
  37 +
  38 + //console.log("saSelect" + ":compile = >" + tElem.html());
  39 +
  40 + return {
  41 + pre: function(scope, element, attr) {
  42 + // TODO:
  43 + },
  44 + /**
  45 + * 相当于link函数。
  46 + *
  47 + * 重要属性如下:
  48 + * model 是绑定外部值。
  49 + * dicgroup 字典组的类型
  50 + * name input name属性值
  51 + */
  52 + post: function(scope, element, attr) {
  53 + // 1、获取属性
  54 + var dicgroup_attr = attr['dicgroup']; // 字典组的类型
  55 + var name_attr = attr['name']; // input name属性值
  56 + var dicname_attr = attr['dicname']; // model关联的字典名字段
  57 + var codename_attr = attr['codename']; // model关联的字典值字段
  58 + var placeholder_attr = attr['placeholder']; // select placeholder提示
  59 +
  60 + // 系统的字典对象,使用dictionaryUtils类获取
  61 + var origin_dicgroup;
  62 + var dic_key; // 字典key
  63 +
  64 + if (dicgroup_attr) { // 赋值指定的字典数据
  65 + origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);
  66 + for (dic_key in origin_dicgroup) {
  67 + var data = {}; // 重新组合的字典元素对象
  68 + if (dic_key == "true")
  69 + data.code = true;
  70 + else
  71 + data.code = dic_key;
  72 + data.name = origin_dicgroup[dic_key];
  73 + scope["$saSelectCtrl"].datas.push(data);
  74 + }
  75 + }
  76 +
  77 + if (name_attr) {
  78 + scope["$saSelectCtrl"].nv = name_attr;
  79 + }
  80 + if (placeholder_attr) {
  81 + scope["$saSelectCtrl"].ph = placeholder_attr;
  82 + }
  83 +
  84 + scope["$saSelectCtrl"].select = function($item) {
  85 + if (codename_attr) {
  86 + scope["$saSelectCtrl"].model[codename_attr] = $item.code;
  87 + }
  88 + if (dicname_attr) {
  89 + scope["$saSelectCtrl"].model[dicname_attr] = $item.name;
  90 + }
  91 + };
  92 +
  93 + scope["$saSelectCtrl"].remove = function() {
  94 + if (codename_attr) {
  95 + scope["$saSelectCtrl"].model[codename_attr] = null;
  96 + }
  97 + if (dicname_attr) {
  98 + scope["$saSelectCtrl"].model[dicname_attr] = null;
  99 + }
  100 + scope["$saSelectCtrl"].cmodel = null;
  101 + };
  102 +
  103 + $timeout(function() {
  104 + // 创建内部使用的绑定对象
  105 + var model_code = scope["$saSelectCtrl"].model[codename_attr];
  106 + scope["$saSelectCtrl"].cmodel = model_code;
  107 + }, 0);
  108 + }
  109 + }
  110 + }
  111 + };
  112 +}]);
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect2.js
1 -  
2 -  
3 -angular.module('ScheduleApp').directive("saSelect2", [  
4 - '$timeout', '$$SearchInfoService_g',  
5 - function($timeout, $$searchInfoService_g) {  
6 - return {  
7 - restrict: 'E',  
8 - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect2Template.html',  
9 - scope: {  
10 - model: "=" // 独立作用域,关联外部的模型对象  
11 - },  
12 - controllerAs: "$saSelectCtrl",  
13 - bindToController: true,  
14 - controller: function($scope) {  
15 - var self = this;  
16 - self.$$data = []; // 内部关联的数据  
17 - },  
18 - /**  
19 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
20 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
21 - * @param tElem  
22 - * @param tAttrs  
23 - * @returns {{pre: Function, post: Function}}  
24 - */  
25 - compile: function(tElem, tAttrs) {  
26 - // 1、获取此阶段使用的属性  
27 - var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。  
28 -  
29 - // 2、处理属性  
30 -  
31 - // 确定是否使用angularjs required验证  
32 - // 属性 required  
33 - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加  
34 - if ($required_attr) {  
35 - if ($required_attr == "true") {  
36 - // 添加required属性指令  
37 - tElem.find("ui-select").attr("required", "");  
38 - } else {  
39 - // 不等于true,不添加required属性指令  
40 - }  
41 - } else {  
42 - // 不添加required属性指令  
43 - }  
44 -  
45 - //console.log("saSelect" + ":compile = >" + tElem.html());  
46 -  
47 - return {  
48 - pre: function(scope, element, attr) {  
49 - // TODO:  
50 - },  
51 - /**  
52 - * 相当于link函数。  
53 - *  
54 - * 重要属性如下:  
55 - * model 是绑定外部值。  
56 - * dicgroup 字典组的类型  
57 - * name input name属性值  
58 - */  
59 - post: function(scope, element, attr) {  
60 - // 1、获取此阶段使用的属性  
61 - var $name_attr = attr["name"]; // 表单验证时需要的名字  
62 - var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加  
63 - var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)  
64 - var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)  
65 - var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)  
66 - var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)  
67 - var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名  
68 - var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述  
69 -  
70 - // 2、处理属性、转换成$saSelectCtrl内部使用的属性  
71 - if ($name_attr) {  
72 - scope["$saSelectCtrl"].$name_attr = $name_attr;  
73 - }  
74 - if ($placeholder_attr) {  
75 - scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;  
76 - }  
77 - if ($showcolname_attr) {  
78 - scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;  
79 - }  
80 -  
81 - // 2-1、添加内部方法,根据type值,改变$$data的值  
82 - scope["$saSelectCtrl"].$$internal_data_change_fn = function() {  
83 - // 根据type属性动态载入数据  
84 - if ($type_attr) {  
85 - $$searchInfoService_g[$type_attr].list(  
86 - {type: "all"},  
87 - function(result) {  
88 - scope["$saSelectCtrl"].$$data = [];  
89 - for (var i = 0; i < result.length; i ++) {  
90 - var data = {}; // data是result的一部分属性集合,根据配置来确定  
91 - if ($datacolname1_attr) {  
92 - data[$datacolname1_attr] = result[i][$datacolname1_attr];  
93 - }  
94 - if ($datacolname2_attr) {  
95 - data[$datacolname2_attr] = result[i][$datacolname2_attr];  
96 - }  
97 - if ($showcolname_attr) {  
98 - // 动态添加基于名字的拼音  
99 - data[$showcolname_attr] = result[i][$showcolname_attr];  
100 - if (data[$showcolname_attr]) {  
101 - data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼  
102 - data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼  
103 - }  
104 - }  
105 - if (data["fullChars"])  
106 - scope["$saSelectCtrl"].$$data.push(data);  
107 - }  
108 - },  
109 - function(result) {  
110 -  
111 - }  
112 - );  
113 - }  
114 - };  
115 -  
116 - // 3、选择、删除事件映射模型和内部数据对应的字段  
117 - scope["$saSelectCtrl"].$select_fn_attr = function($item) {  
118 - if ($modelcolname1_attr && $datacolname1_attr) {  
119 - scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];  
120 - }  
121 - if ($modelcolname2_attr && $datacolname2_attr) {  
122 - scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];  
123 - }  
124 - };  
125 - scope["$saSelectCtrl"].$remove_fn_attr = function() {  
126 - if ($modelcolname1_attr) {  
127 - scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;  
128 - }  
129 - if ($modelcolname2_attr) {  
130 - scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;  
131 - }  
132 - scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空  
133 -  
134 - scope["$saSelectCtrl"].$$internal_data_change_fn();  
135 - };  
136 -  
137 - // 4、搜索事件  
138 - scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {  
139 - //var fullChars = pinyin.getFullChars($search).toUpperCase();  
140 - //var camelChars = pinyin.getCamelChars($search);  
141 - //  
142 - //console.log(fullChars + " " + camelChars);  
143 - // TODO:事件暂时没用,放着以后再说  
144 - };  
145 -  
146 - // 5、全部载入后,输入的  
147 - $timeout(function() {  
148 - // 创建内部使用的绑定对象,用于确认选中那个值  
149 - scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];  
150 -  
151 - scope["$saSelectCtrl"].$$internal_data_change_fn();  
152 - }, 0);  
153 - }  
154 - }  
155 - }  
156 - };  
157 - }  
158 -]);  
159 - 1 +
  2 +
  3 +angular.module('ScheduleApp').directive("saSelect2", [
  4 + '$timeout', '$$SearchInfoService_g',
  5 + function($timeout, $$searchInfoService_g) {
  6 + return {
  7 + restrict: 'E',
  8 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect2Template.html',
  9 + scope: {
  10 + model: "=" // 独立作用域,关联外部的模型对象
  11 + },
  12 + controllerAs: "$saSelectCtrl",
  13 + bindToController: true,
  14 + controller: function($scope) {
  15 + var self = this;
  16 + self.$$data = []; // 内部关联的数据
  17 + },
  18 + /**
  19 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  20 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  21 + * @param tElem
  22 + * @param tAttrs
  23 + * @returns {{pre: Function, post: Function}}
  24 + */
  25 + compile: function(tElem, tAttrs) {
  26 + // 1、获取此阶段使用的属性
  27 + var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。
  28 +
  29 + // 2、处理属性
  30 +
  31 + // 确定是否使用angularjs required验证
  32 + // 属性 required
  33 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  34 + if ($required_attr) {
  35 + if ($required_attr == "true") {
  36 + // 添加required属性指令
  37 + tElem.find("ui-select").attr("required", "");
  38 + } else {
  39 + // 不等于true,不添加required属性指令
  40 + }
  41 + } else {
  42 + // 不添加required属性指令
  43 + }
  44 +
  45 + //console.log("saSelect" + ":compile = >" + tElem.html());
  46 +
  47 + return {
  48 + pre: function(scope, element, attr) {
  49 + // TODO:
  50 + },
  51 + /**
  52 + * 相当于link函数。
  53 + *
  54 + * 重要属性如下:
  55 + * model 是绑定外部值。
  56 + * dicgroup 字典组的类型
  57 + * name input name属性值
  58 + */
  59 + post: function(scope, element, attr) {
  60 + // 1、获取此阶段使用的属性
  61 + var $name_attr = attr["name"]; // 表单验证时需要的名字
  62 + var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  63 + var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)
  64 + var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)
  65 + var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)
  66 + var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)
  67 + var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名
  68 + var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述
  69 +
  70 + // 2、处理属性、转换成$saSelectCtrl内部使用的属性
  71 + if ($name_attr) {
  72 + scope["$saSelectCtrl"].$name_attr = $name_attr;
  73 + }
  74 + if ($placeholder_attr) {
  75 + scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;
  76 + }
  77 + if ($showcolname_attr) {
  78 + scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;
  79 + }
  80 +
  81 + // 2-1、添加内部方法,根据type值,改变$$data的值
  82 + scope["$saSelectCtrl"].$$internal_data_change_fn = function() {
  83 + // 根据type属性动态载入数据
  84 + if ($type_attr) {
  85 + $$searchInfoService_g[$type_attr].list(
  86 + {type: "all"},
  87 + function(result) {
  88 + scope["$saSelectCtrl"].$$data = [];
  89 + for (var i = 0; i < result.length; i ++) {
  90 + var data = {}; // data是result的一部分属性集合,根据配置来确定
  91 + if ($datacolname1_attr) {
  92 + data[$datacolname1_attr] = result[i][$datacolname1_attr];
  93 + }
  94 + if ($datacolname2_attr) {
  95 + data[$datacolname2_attr] = result[i][$datacolname2_attr];
  96 + }
  97 + if ($showcolname_attr) {
  98 + // 动态添加基于名字的拼音
  99 + data[$showcolname_attr] = result[i][$showcolname_attr];
  100 + if (data[$showcolname_attr]) {
  101 + data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼
  102 + data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼
  103 + }
  104 + }
  105 + if (data["fullChars"])
  106 + scope["$saSelectCtrl"].$$data.push(data);
  107 + }
  108 + },
  109 + function(result) {
  110 +
  111 + }
  112 + );
  113 + }
  114 + };
  115 +
  116 + // 3、选择、删除事件映射模型和内部数据对应的字段
  117 + scope["$saSelectCtrl"].$select_fn_attr = function($item) {
  118 + if ($modelcolname1_attr && $datacolname1_attr) {
  119 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];
  120 + }
  121 + if ($modelcolname2_attr && $datacolname2_attr) {
  122 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];
  123 + }
  124 + };
  125 + scope["$saSelectCtrl"].$remove_fn_attr = function() {
  126 + if ($modelcolname1_attr) {
  127 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;
  128 + }
  129 + if ($modelcolname2_attr) {
  130 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;
  131 + }
  132 + scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空
  133 +
  134 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  135 + };
  136 +
  137 + // 4、搜索事件
  138 + scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {
  139 + //var fullChars = pinyin.getFullChars($search).toUpperCase();
  140 + //var camelChars = pinyin.getCamelChars($search);
  141 + //
  142 + //console.log(fullChars + " " + camelChars);
  143 + // TODO:事件暂时没用,放着以后再说
  144 + };
  145 +
  146 + // 5、全部载入后,输入的
  147 + $timeout(function() {
  148 + // 创建内部使用的绑定对象,用于确认选中那个值
  149 + scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];
  150 +
  151 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  152 + }, 0);
  153 + }
  154 + }
  155 + }
  156 + };
  157 + }
  158 +]);
  159 +
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect3.js
1 -  
2 -  
3 -  
4 -/**  
5 - * saSelect3指令  
6 - * 属性如下:  
7 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
8 - * name(必须):控件的名字  
9 - * placeholder(可选):占位符字符串  
10 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
11 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
12 - * icname(必须):内部与之对应的字段名,如:icname=code  
13 - * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name  
14 - * icname2(可选):内部与之对应的字段名2,如:icname2=name  
15 - * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name  
16 - * icname3(可选):内部与之对应的字段名3,如:icname2=name  
17 - * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name  
18 - * required(可选):是否要用required验证  
19 - * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点  
20 - * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)  
21 - *  
22 - * 高级属性:  
23 - * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)  
24 - * dataparam(可选):数据源关联的外部参数对象  
25 - *  
26 - */  
27 -angular.module('ScheduleApp').directive("saSelect3", [  
28 - '$timeout',  
29 - '$$SearchInfoService_g',  
30 - function($timeout, $$searchInfoService_g) {  
31 - return {  
32 - restrict: 'E',  
33 - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect3Template.html',  
34 - scope: {  
35 - model: "=" // 独立作用域,关联外部的模型object  
36 - },  
37 - controllerAs: "$saSelectCtrl",  
38 - bindToController: true,  
39 - controller: function($scope) {  
40 - var self = this;  
41 - self.$$data = []; // ui-select显示用的数据源  
42 - self.$$data_real= []; // 内部真实的数据源  
43 - },  
44 -  
45 - /**  
46 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
47 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
48 - * @param tElem  
49 - * @param tAttrs  
50 - * @returns {{pre: Function, post: Function}}  
51 - */  
52 - compile: function(tElem, tAttrs) {  
53 - // 获取所有的属性  
54 - var $name_attr = tAttrs["name"]; // 控件的名字  
55 - var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字  
56 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
57 - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名  
58 - var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2  
59 - var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2  
60 - var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3  
61 - var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3  
62 -  
63 - var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段  
64 - var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型  
65 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
66 - var $mlp_attr = tAttrs["mlp"]; // 是否多级属性  
67 - var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性  
68 -  
69 - // controlAs名字  
70 - var ctrlAs = "$saSelectCtrl";  
71 -  
72 - // 数据源初始化标志  
73 - var $$data_init = false;  
74 - // 如果有required属性,添加angularjs required验证  
75 - if ($required_attr != undefined) {  
76 - tElem.find("ui-select").attr("required", "");  
77 - }  
78 -  
79 - // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义  
80 - // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}  
81 - tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");  
82 - // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data  
83 - tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");  
84 - // 原来的设置:item[$saSelectCtrl.$icname_s]  
85 - tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);  
86 - // 原来的设置:{{$saSelectCtrl.$name}}  
87 - tElem.find("ui-select").attr("name", $name_attr);  
88 - // 原来的设置:{{$saSelectCtrl.$placeholder}}  
89 - tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);  
90 -  
91 - return {  
92 - pre: function(scope, element, attr) {  
93 - // TODO:  
94 - },  
95 - /**  
96 - * 相当于link函数。  
97 - * @param scope  
98 - * @param element  
99 - * @param attr  
100 - */  
101 - post: function(scope, element, attr) {  
102 - // 添加选中事件处理函数  
103 - scope[ctrlAs].$$internal_select_fn = function($item) {  
104 - if ($dcname_attr && $icname_attr) {  
105 - if ($mlp_attr) {  
106 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");  
107 - } else {  
108 - scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];  
109 - }  
110 - }  
111 - if ($dcname2_attr && $icname2_attr) {  
112 - if ($mlp_attr) {  
113 - eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");  
114 - } else {  
115 - scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];  
116 - }  
117 - }  
118 - if ($dcname3_attr && $icname3_attr) {  
119 - if ($mlp_attr) {  
120 - eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");  
121 - } else {  
122 - scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];  
123 - }  
124 - }  
125 - };  
126 -  
127 - // 删除选中事件处理函数  
128 - scope[ctrlAs].$$internal_remove_fn = function() {  
129 - scope[ctrlAs].$$internalmodel = undefined;  
130 - if ($mlp_attr) {  
131 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");  
132 - } else {  
133 - scope[ctrlAs].model[$dcname_attr] = undefined;  
134 - }  
135 -  
136 - if ($dcname2_attr) {  
137 - if ($mlp_attr) {  
138 - eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");  
139 - } else {  
140 - scope[ctrlAs].model[$dcname2_attr] = undefined;  
141 - }  
142 - }  
143 - if ($dcname3_attr) {  
144 - if ($mlp_attr) {  
145 - eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");  
146 - } else {  
147 - scope[ctrlAs].model[$dcname3_attr] = undefined;  
148 - }  
149 - }  
150 - };  
151 -  
152 - /**  
153 - * 内部方法,读取字典数据作为数据源。  
154 - * @param dicgroup 字典类型,如:gsType  
155 - * @param ccol 代码字段名  
156 - * @param ncol 名字字段名  
157 - */  
158 - scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {  
159 - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);  
160 - var dic_key; // 字典key  
161 - // 清空内部数据  
162 - scope[ctrlAs].$$data_real = [];  
163 - for (dic_key in origin_dicgroup) {  
164 - var data = {}; // 重新组合的字典元素对象  
165 - if (dic_key == "true")  
166 - data[ccol] = true;  
167 - else  
168 - data[ccol] = dic_key;  
169 - data[ncol] = origin_dicgroup[dic_key];  
170 - scope[ctrlAs].$$data_real.push(data);  
171 - }  
172 - // 这里直接将$$data_real数据深拷贝到$$data  
173 - angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);  
174 -  
175 - console.log(scope[ctrlAs].$$data);  
176 - };  
177 -  
178 - /**  
179 - * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把  
180 - * 内部方法,读取字典数据作为数据源。  
181 - * @param result 原始数据  
182 - * @param dcvalue 传入的关联数据  
183 - */  
184 - scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {  
185 - console.log("start=" + dcvalue);  
186 - // 清空内部数据  
187 - scope[ctrlAs].$$data_real = [];  
188 - scope[ctrlAs].$$data = [];  
189 - for (var i = 0; i < result.length; i ++) {  
190 - if ($icname_s_attr) {  
191 - if ($mlp_attr) {  
192 - if (eval("result[i]" + "." + $icname_s_attr)) {  
193 - // 全拼  
194 - result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();  
195 - // 简拼  
196 - result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));  
197 - }  
198 - } else {  
199 - if (result[i][$icname_s_attr]) {  
200 - // 全拼  
201 - result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();  
202 - // 简拼  
203 - result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);  
204 - }  
205 - }  
206 - }  
207 -  
208 - if (result[i]["fullChars"]) { // 有拼音的加入数据源  
209 - scope[ctrlAs].$$data_real.push(result[i]);  
210 - }  
211 -  
212 - }  
213 - //console.log("start2");  
214 -  
215 - // 数量太大取前10条记录作为显示  
216 - if (angular.isArray(scope[ctrlAs].$$data_real)) {  
217 - // 先迭代循环查找已经传过来的值  
218 - if (scope[ctrlAs].$$data_real.length > 0) {  
219 - if (dcvalue) {  
220 - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {  
221 - if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {  
222 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));  
223 - break;  
224 - }  
225 - }  
226 - }  
227 - }  
228 - // 在插入剩余的数据  
229 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
230 - if (scope[ctrlAs].$$data.length < 10) {  
231 - if ($mlp_attr) {  
232 - if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {  
233 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
234 - }  
235 - } else {  
236 - if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {  
237 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
238 - }  
239 - }  
240 - } else {  
241 - break;  
242 - }  
243 - }  
244 - }  
245 -  
246 - //console.log("end");  
247 - };  
248 -  
249 - /**  
250 - * 判定一个对象是否为空对象。  
251 - * @param Obj  
252 - */  
253 - scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {  
254 - console.log(typeof obj);  
255 -  
256 - if (typeof obj === "object" && !(obj instanceof Array)) {  
257 - for (var prop in obj) {  
258 - if (obj.hasOwnProperty(prop)) {  
259 - return false;  
260 - }  
261 - }  
262 - return true;  
263 - } else {  
264 - throw "必须是对象";  
265 - }  
266 - };  
267 -  
268 - // 刷新数据  
269 - scope[ctrlAs].$$internal_refresh_fn = function(search) {  
270 - // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取  
271 - var $dcvalue_attr = attr["dcvalue"];  
272 -  
273 - console.log("刷新数据:" + $dcvalue_attr);  
274 -  
275 - if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化  
276 - if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源  
277 - scope[ctrlAs].$$internal_dic_data(  
278 - $datatype_attr, $icname_attr, $icname_s_attr);  
279 - if ($dcvalue_attr) {  
280 - scope[ctrlAs].$$internalmodel = $dcvalue_attr;  
281 - }  
282 - } else { // 非字典类型数据源  
283 - if (!$dataassociate_attr) {  
284 - $$searchInfoService_g[$datatype_attr].list(  
285 - {type: "all"},  
286 - function(result) {  
287 - //console.log("ok:" + $datatype_attr);  
288 - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);  
289 - //console.log("ok2:" + $datatype_attr);  
290 - if ($dcvalue_attr) {  
291 - scope[ctrlAs].$$internalmodel = $dcvalue_attr;  
292 - }  
293 -  
294 - $$data_init = true;  
295 - },  
296 - function(result) {  
297 -  
298 - }  
299 - );  
300 - }  
301 - }  
302 - }  
303 -  
304 - if ($$data_init) {  
305 - if (search && search != "") { // 有search值  
306 - if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源  
307 - // 处理search  
308 - console.log("search:" + search);  
309 -  
310 - scope[ctrlAs].$$data = [];  
311 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
312 - var upTerm = search.toUpperCase();  
313 - if (scope[ctrlAs].$$data.length < 10) {  
314 - if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1  
315 - || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {  
316 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
317 - }  
318 - } else {  
319 - break;  
320 - }  
321 - }  
322 - }  
323 - }  
324 -  
325 - }  
326 -  
327 - };  
328 -  
329 -  
330 -  
331 -  
332 -  
333 -  
334 -  
335 -  
336 -  
337 -  
338 - // TODO:  
339 -  
340 - // dom全部载入后调用  
341 - $timeout(function() {  
342 - console.log("dom全部载入后调用");  
343 - }, 0);  
344 - // 监控dcvalue model值变换  
345 - attr.$observe("dcvalue", function(value) {  
346 - console.log("监控dc1 model值变换:" + value);  
347 - scope[ctrlAs].$$internalmodel = value;  
348 - }  
349 - );  
350 - // 监控获取数据参数变换  
351 - attr.$observe("dataparam", function(value) {  
352 - // 判定是否空对象  
353 - console.log(value);  
354 - var obj = JSON.parse(value);  
355 - var $dcvalue_attr = attr["dcvalue"];  
356 - if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {  
357 - console.log("dataparam:" + obj);  
358 -  
359 - //  
360 -  
361 - obj["type"] = "all";  
362 -  
363 - $$data_init = false;  
364 - $$searchInfoService_g[$datatype_attr].list(  
365 - obj,  
366 - function(result) {  
367 - //console.log("ok:" + $datatype_attr);  
368 - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);  
369 - //console.log("ok2:" + $datatype_attr);  
370 - if ($dcvalue_attr) {  
371 - scope[ctrlAs].$$internalmodel = $dcvalue_attr;  
372 - }  
373 -  
374 - $$data_init = true;  
375 - },  
376 - function(result) {  
377 -  
378 - }  
379 - );  
380 - }  
381 - }  
382 - );  
383 - }  
384 - };  
385 - }  
386 - };  
387 -  
388 - }  
389 -]);  
390 - 1 +
  2 +
  3 +
  4 +/**
  5 + * saSelect3指令
  6 + * 属性如下:
  7 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  8 + * name(必须):控件的名字
  9 + * placeholder(可选):占位符字符串
  10 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  11 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  12 + * icname(必须):内部与之对应的字段名,如:icname=code
  13 + * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
  14 + * icname2(可选):内部与之对应的字段名2,如:icname2=name
  15 + * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
  16 + * icname3(可选):内部与之对应的字段名3,如:icname2=name
  17 + * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
  18 + * required(可选):是否要用required验证
  19 + * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
  20 + * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)
  21 + *
  22 + * 高级属性:
  23 + * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)
  24 + * dataparam(可选):数据源关联的外部参数对象
  25 + *
  26 + */
  27 +angular.module('ScheduleApp').directive("saSelect3", [
  28 + '$timeout',
  29 + '$$SearchInfoService_g',
  30 + function($timeout, $$searchInfoService_g) {
  31 + return {
  32 + restrict: 'E',
  33 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect3Template.html',
  34 + scope: {
  35 + model: "=" // 独立作用域,关联外部的模型object
  36 + },
  37 + controllerAs: "$saSelectCtrl",
  38 + bindToController: true,
  39 + controller: function($scope) {
  40 + var self = this;
  41 + self.$$data = []; // ui-select显示用的数据源
  42 + self.$$data_real= []; // 内部真实的数据源
  43 + },
  44 +
  45 + /**
  46 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  47 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  48 + * @param tElem
  49 + * @param tAttrs
  50 + * @returns {{pre: Function, post: Function}}
  51 + */
  52 + compile: function(tElem, tAttrs) {
  53 + // 获取所有的属性
  54 + var $name_attr = tAttrs["name"]; // 控件的名字
  55 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  56 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  57 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  58 + var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
  59 + var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
  60 + var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
  61 + var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
  62 +
  63 + var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
  64 + var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
  65 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  66 + var $mlp_attr = tAttrs["mlp"]; // 是否多级属性
  67 + var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性
  68 +
  69 + // controlAs名字
  70 + var ctrlAs = "$saSelectCtrl";
  71 +
  72 + // 数据源初始化标志
  73 + var $$data_init = false;
  74 + // 如果有required属性,添加angularjs required验证
  75 + if ($required_attr != undefined) {
  76 + tElem.find("ui-select").attr("required", "");
  77 + }
  78 +
  79 + // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义
  80 + // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}
  81 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");
  82 + // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data
  83 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  84 + // 原来的设置:item[$saSelectCtrl.$icname_s]
  85 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);
  86 + // 原来的设置:{{$saSelectCtrl.$name}}
  87 + tElem.find("ui-select").attr("name", $name_attr);
  88 + // 原来的设置:{{$saSelectCtrl.$placeholder}}
  89 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  90 +
  91 + return {
  92 + pre: function(scope, element, attr) {
  93 + // TODO:
  94 + },
  95 + /**
  96 + * 相当于link函数。
  97 + * @param scope
  98 + * @param element
  99 + * @param attr
  100 + */
  101 + post: function(scope, element, attr) {
  102 + // 添加选中事件处理函数
  103 + scope[ctrlAs].$$internal_select_fn = function($item) {
  104 + if ($dcname_attr && $icname_attr) {
  105 + if ($mlp_attr) {
  106 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  107 + } else {
  108 + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
  109 + }
  110 + }
  111 + if ($dcname2_attr && $icname2_attr) {
  112 + if ($mlp_attr) {
  113 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");
  114 + } else {
  115 + scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
  116 + }
  117 + }
  118 + if ($dcname3_attr && $icname3_attr) {
  119 + if ($mlp_attr) {
  120 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
  121 + } else {
  122 + scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
  123 + }
  124 + }
  125 + };
  126 +
  127 + // 删除选中事件处理函数
  128 + scope[ctrlAs].$$internal_remove_fn = function() {
  129 + scope[ctrlAs].$$internalmodel = undefined;
  130 + if ($mlp_attr) {
  131 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  132 + } else {
  133 + scope[ctrlAs].model[$dcname_attr] = undefined;
  134 + }
  135 +
  136 + if ($dcname2_attr) {
  137 + if ($mlp_attr) {
  138 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");
  139 + } else {
  140 + scope[ctrlAs].model[$dcname2_attr] = undefined;
  141 + }
  142 + }
  143 + if ($dcname3_attr) {
  144 + if ($mlp_attr) {
  145 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
  146 + } else {
  147 + scope[ctrlAs].model[$dcname3_attr] = undefined;
  148 + }
  149 + }
  150 + };
  151 +
  152 + /**
  153 + * 内部方法,读取字典数据作为数据源。
  154 + * @param dicgroup 字典类型,如:gsType
  155 + * @param ccol 代码字段名
  156 + * @param ncol 名字字段名
  157 + */
  158 + scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {
  159 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  160 + var dic_key; // 字典key
  161 + // 清空内部数据
  162 + scope[ctrlAs].$$data_real = [];
  163 + for (dic_key in origin_dicgroup) {
  164 + var data = {}; // 重新组合的字典元素对象
  165 + if (dic_key == "true")
  166 + data[ccol] = true;
  167 + else
  168 + data[ccol] = dic_key;
  169 + data[ncol] = origin_dicgroup[dic_key];
  170 + scope[ctrlAs].$$data_real.push(data);
  171 + }
  172 + // 这里直接将$$data_real数据深拷贝到$$data
  173 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  174 +
  175 + console.log(scope[ctrlAs].$$data);
  176 + };
  177 +
  178 + /**
  179 + * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把
  180 + * 内部方法,读取字典数据作为数据源。
  181 + * @param result 原始数据
  182 + * @param dcvalue 传入的关联数据
  183 + */
  184 + scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {
  185 + console.log("start=" + dcvalue);
  186 + // 清空内部数据
  187 + scope[ctrlAs].$$data_real = [];
  188 + scope[ctrlAs].$$data = [];
  189 + for (var i = 0; i < result.length; i ++) {
  190 + if ($icname_s_attr) {
  191 + if ($mlp_attr) {
  192 + if (eval("result[i]" + "." + $icname_s_attr)) {
  193 + // 全拼
  194 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();
  195 + // 简拼
  196 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));
  197 + }
  198 + } else {
  199 + if (result[i][$icname_s_attr]) {
  200 + // 全拼
  201 + result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();
  202 + // 简拼
  203 + result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);
  204 + }
  205 + }
  206 + }
  207 +
  208 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  209 + scope[ctrlAs].$$data_real.push(result[i]);
  210 + }
  211 +
  212 + }
  213 + //console.log("start2");
  214 +
  215 + // 数量太大取前10条记录作为显示
  216 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  217 + // 先迭代循环查找已经传过来的值
  218 + if (scope[ctrlAs].$$data_real.length > 0) {
  219 + if (dcvalue) {
  220 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  221 + if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {
  222 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));
  223 + break;
  224 + }
  225 + }
  226 + }
  227 + }
  228 + // 在插入剩余的数据
  229 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  230 + if (scope[ctrlAs].$$data.length < 10) {
  231 + if ($mlp_attr) {
  232 + if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {
  233 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  234 + }
  235 + } else {
  236 + if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {
  237 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  238 + }
  239 + }
  240 + } else {
  241 + break;
  242 + }
  243 + }
  244 + }
  245 +
  246 + //console.log("end");
  247 + };
  248 +
  249 + /**
  250 + * 判定一个对象是否为空对象。
  251 + * @param Obj
  252 + */
  253 + scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {
  254 + console.log(typeof obj);
  255 +
  256 + if (typeof obj === "object" && !(obj instanceof Array)) {
  257 + for (var prop in obj) {
  258 + if (obj.hasOwnProperty(prop)) {
  259 + return false;
  260 + }
  261 + }
  262 + return true;
  263 + } else {
  264 + throw "必须是对象";
  265 + }
  266 + };
  267 +
  268 + // 刷新数据
  269 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  270 + // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取
  271 + var $dcvalue_attr = attr["dcvalue"];
  272 +
  273 + console.log("刷新数据:" + $dcvalue_attr);
  274 +
  275 + if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化
  276 + if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源
  277 + scope[ctrlAs].$$internal_dic_data(
  278 + $datatype_attr, $icname_attr, $icname_s_attr);
  279 + if ($dcvalue_attr) {
  280 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  281 + }
  282 + } else { // 非字典类型数据源
  283 + if (!$dataassociate_attr) {
  284 + $$searchInfoService_g[$datatype_attr].list(
  285 + {type: "all"},
  286 + function(result) {
  287 + //console.log("ok:" + $datatype_attr);
  288 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  289 + //console.log("ok2:" + $datatype_attr);
  290 + if ($dcvalue_attr) {
  291 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  292 + }
  293 +
  294 + $$data_init = true;
  295 + },
  296 + function(result) {
  297 +
  298 + }
  299 + );
  300 + }
  301 + }
  302 + }
  303 +
  304 + if ($$data_init) {
  305 + if (search && search != "") { // 有search值
  306 + if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源
  307 + // 处理search
  308 + console.log("search:" + search);
  309 +
  310 + scope[ctrlAs].$$data = [];
  311 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  312 + var upTerm = search.toUpperCase();
  313 + if (scope[ctrlAs].$$data.length < 10) {
  314 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  315 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  316 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  317 + }
  318 + } else {
  319 + break;
  320 + }
  321 + }
  322 + }
  323 + }
  324 +
  325 + }
  326 +
  327 + };
  328 +
  329 +
  330 +
  331 +
  332 +
  333 +
  334 +
  335 +
  336 +
  337 +
  338 + // TODO:
  339 +
  340 + // dom全部载入后调用
  341 + $timeout(function() {
  342 + console.log("dom全部载入后调用");
  343 + }, 0);
  344 + // 监控dcvalue model值变换
  345 + attr.$observe("dcvalue", function(value) {
  346 + console.log("监控dc1 model值变换:" + value);
  347 + scope[ctrlAs].$$internalmodel = value;
  348 + }
  349 + );
  350 + // 监控获取数据参数变换
  351 + attr.$observe("dataparam", function(value) {
  352 + // 判定是否空对象
  353 + console.log(value);
  354 + var obj = JSON.parse(value);
  355 + var $dcvalue_attr = attr["dcvalue"];
  356 + if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {
  357 + console.log("dataparam:" + obj);
  358 +
  359 + //
  360 +
  361 + obj["type"] = "all";
  362 +
  363 + $$data_init = false;
  364 + $$searchInfoService_g[$datatype_attr].list(
  365 + obj,
  366 + function(result) {
  367 + //console.log("ok:" + $datatype_attr);
  368 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  369 + //console.log("ok2:" + $datatype_attr);
  370 + if ($dcvalue_attr) {
  371 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  372 + }
  373 +
  374 + $$data_init = true;
  375 + },
  376 + function(result) {
  377 +
  378 + }
  379 + );
  380 + }
  381 + }
  382 + );
  383 + }
  384 + };
  385 + }
  386 + };
  387 +
  388 + }
  389 +]);
  390 +
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect4.js
1 -/**  
2 - * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。  
3 - * name(必须):控件的名字  
4 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
5 - * placeholder(可选):输入框占位符字符串  
6 - *  
7 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
8 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
9 - * icname(必须):内部与之对应的字段名,如:icname=code  
10 - *  
11 - * cmaps(可选):model其他字段和内部数据字段名映射,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}  
12 - * dsparams(必须):内部数据源查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}  
13 - * dscol(必须):内部显示的信息(暂时用内部字段),如:dscol=name  
14 - * required(可选):是否要用required验证  
15 - */  
16 -angular.module('ScheduleApp').directive('saSelect4', [  
17 - '$timeout',  
18 - '$$SearchInfoService_g',  
19 - function($timeout, $$searchInfoService_g) {  
20 - return {  
21 - restrict: 'E',  
22 - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect4Template.html',  
23 - scope: {  
24 - model: "=" // 独立作用域,关联外部的模型object  
25 - },  
26 - controllerAs: "$saSelectCtrl",  
27 - bindToController: true,  
28 - controller: function($scope) {  
29 - var self = this;  
30 - self.$$data = []; // ui-select显示用的数据  
31 - self.$$data_real = []; // 内部真实的数据  
32 -  
33 - // saSelect4组件的ng-model,用于外部绑定验证等操作  
34 - self.$$internalmodel = undefined;  
35 -  
36 - self.$$internal_select_value = undefined; // 选中的值  
37 - },  
38 -  
39 - /**  
40 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
41 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
42 - * @param tElem  
43 - * @param tAttrs  
44 - * @returns {{pre: Function, post: Function}}  
45 - */  
46 - compile: function(tElem, tAttrs) {  
47 - // 获取属性  
48 - var $name_attr = tAttrs["name"]; // 控件的名字  
49 - var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字  
50 -  
51 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
52 - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名  
53 -  
54 - var $cmaps_attr = tAttrs["cmaps"]; // model其他字段和内部数据字段名映射  
55 - var $dscol_attr = tAttrs["dscol"]; // 内部显示的信息  
56 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
57 -  
58 - // controlAs名字  
59 - var ctrlAs = "$saSelectCtrl";  
60 -  
61 - // 验证属性  
62 - if (!$name_attr) {  
63 - throw new error("name属性必须填写");  
64 - }  
65 - if (!$dcname_attr) {  
66 - throw new error("dcname属性必须填写");  
67 - }  
68 - if (!$icname_attr) {  
69 - throw new error("icname属性必须填写");  
70 - }  
71 - if (!$dscol_attr) {  
72 - throw new error("dscol属性必须填写");  
73 - }  
74 -  
75 - // 动态设置dom  
76 - // dom required 属性  
77 - if ($required_attr != undefined) {  
78 - tElem.find("div").attr("required", "");  
79 - }  
80 - // dom placeholder 属性  
81 - tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);  
82 - // dom dscol 属性  
83 - tElem.find("ui-select-match").html("{{$select.selected" + "." + $dscol_attr + "}}");  
84 - tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $dscol_attr);  
85 - // dom icname 属性  
86 - tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");  
87 - // dom name 属性  
88 - tElem.find("div").attr("name", $name_attr);  
89 -  
90 - return {  
91 - pre: function(scope, element, attr) {  
92 - // TODO:  
93 - },  
94 -  
95 - /**  
96 - * 相当于link函数。  
97 - * @param scope  
98 - * @param element  
99 - * @param attr  
100 - */  
101 - post: function(scope, element, attr) {  
102 -  
103 - // 添加选中事件处理函数  
104 - scope[ctrlAs].$$internal_select_fn = function($item) {  
105 - if ($dcname_attr && $icname_attr) {  
106 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");  
107 - }  
108 -  
109 - if ($cmaps_attr) {  
110 - for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名  
111 - var ic = $cmaps_attr[mc]; // 内部数据源对应字段  
112 - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");  
113 - }  
114 - }  
115 - };  
116 -  
117 - // 删除选中事件处理函数  
118 - scope[ctrlAs].$$internal_remove_fn = function() {  
119 - scope[ctrlAs].$$internal_select_value = undefined;  
120 - if ($dcname_attr) {  
121 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");  
122 - }  
123 -  
124 - if ($cmaps_attr) {  
125 - var mc; // model的字段名  
126 - for (mc in $cmaps_attr) {  
127 - eval("scope[ctrlAs].model" + "." + mc + " = undefined;");  
128 - }  
129 - }  
130 - scope[ctrlAs].$$internal_validate_model();  
131 - };  
132 -  
133 - // 刷新数据  
134 - scope[ctrlAs].$$internal_refresh_fn = function(search) {  
135 - if (search && search != "") { // 有search值  
136 - // 处理search  
137 - console.log("search:" + search);  
138 -  
139 - scope[ctrlAs].$$data = [];  
140 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
141 - var upTerm = search.toUpperCase();  
142 - if (scope[ctrlAs].$$data.length < 10) {  
143 - if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1  
144 - || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {  
145 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
146 - }  
147 - } else {  
148 - break;  
149 - }  
150 - }  
151 - }  
152 - };  
153 -  
154 - /**  
155 - * 验证内部数据,更新外部model  
156 - */  
157 - scope[ctrlAs].$$internal_validate_model = function() {  
158 - if (scope[ctrlAs].$$internal_select_value) {  
159 - var select_value_temp = scope[ctrlAs].$$internal_select_value;  
160 - if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {  
161 - var obj;  
162 - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {  
163 - if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {  
164 - obj = angular.copy(scope[ctrlAs].$$data_real[j]);  
165 - break;  
166 - }  
167 - }  
168 - if (obj) { // 在data中判定有没有  
169 - for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {  
170 - if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {  
171 - obj = undefined;  
172 - break;  
173 - }  
174 - }  
175 - if (obj) {  
176 - scope[ctrlAs].$$data.push(obj);  
177 - }  
178 - // 更新内部model,用于外部验证  
179 - // 内部model的值暂时随意,以后再改  
180 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
181 - } else {  
182 - scope[ctrlAs].$$internalmodel = undefined;  
183 - }  
184 -  
185 - } else {  
186 - scope[ctrlAs].$$internalmodel = undefined;  
187 - }  
188 -  
189 - } else {  
190 - scope[ctrlAs].$$internalmodel = undefined;  
191 - }  
192 - };  
193 -  
194 - /**  
195 - * 内部方法,读取字典数据作为数据源。  
196 - * @param atype ajax查询类型  
197 - * @param ajaxparamobj 查询参数对象  
198 - */  
199 - scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {  
200 - ajaxparamobj.type = 'all';  
201 - $$searchInfoService_g[atype].list(  
202 - ajaxparamobj,  
203 - function(result) {  
204 - console.log("$$internal_ajax_data result");  
205 -  
206 - // 清空内部数据  
207 - scope[ctrlAs].$$data_real = [];  
208 - scope[ctrlAs].$$data = [];  
209 -  
210 - // result中添加拼音数据,注意:这里要求result返回对象数组  
211 - for (var i = 0; i < result.length; i ++) {  
212 - if ($dscol_attr) {  
213 - if (eval("result[i]" + "." + $dscol_attr)) {  
214 - // 全拼  
215 - result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $dscol_attr)).toUpperCase();  
216 - // 简拼  
217 - result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $dscol_attr));  
218 - }  
219 - }  
220 -  
221 - if (result[i]["fullChars"]) { // 有拼音的加入数据源  
222 - scope[ctrlAs].$$data_real.push(result[i]);  
223 - }  
224 -  
225 - }  
226 -  
227 - // 数据量太大,取10条记录显示  
228 - if (angular.isArray(scope[ctrlAs].$$data_real)) {  
229 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
230 - if (scope[ctrlAs].$$data.length < 10) {  
231 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
232 - } else {  
233 - break;  
234 - }  
235 - }  
236 - }  
237 -  
238 - scope[ctrlAs].$$internal_validate_model();  
239 - },  
240 - function(result) {  
241 -  
242 - }  
243 - );  
244 - };  
245 -  
246 - /**  
247 - * 内部方法,读取字典数据作为数据源。  
248 - * @param dictype 字典类型,如:gsType  
249 - */  
250 - scope[ctrlAs].$$internal_dic_data = function(dictype) {  
251 - if (!dictionaryUtils.getByGroup(dictype)) {  
252 - throw new error("字典数据不窜在=" + dictype);  
253 - }  
254 -  
255 - // 清空内部数据  
256 - scope[ctrlAs].$$data_real = [];  
257 - scope[ctrlAs].$$data = [];  
258 -  
259 - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);  
260 - var dic_key; // 字典key  
261 -  
262 - for (dic_key in origin_dicgroup) {  
263 - var data = {}; // 重新组合的字典元素对象  
264 - if (dic_key == "true")  
265 - data[$icname_attr] = true;  
266 - else  
267 - data[$icname_attr] = dic_key;  
268 - data[$dscol_attr] = origin_dicgroup[dic_key];  
269 - scope[ctrlAs].$$data_real.push(data);  
270 - }  
271 - // 这里直接将$$data_real数据深拷贝到$$data  
272 - angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);  
273 - scope[ctrlAs].$$internal_validate_model();  
274 - };  
275 -  
276 - attr.$observe("dsparams", function(value) {  
277 - if (value && value != "") {  
278 - var obj = JSON.parse(value);  
279 - console.log("observe 监控 dsparams=" + obj);  
280 -  
281 - // dsparams格式如下:  
282 - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}  
283 -  
284 - if (obj.type == 'dic') {  
285 - scope[ctrlAs].$$internal_dic_data(obj.param);  
286 -  
287 - } else if (obj.type == 'ajax') {  
288 - scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);  
289 - } else {  
290 - throw new Error("dsparams参数格式异常=" + obj);  
291 - }  
292 -  
293 - }  
294 -  
295 - });  
296 -  
297 - // 监控model绑定的dcvalue值变化  
298 - attr.$observe("dcvalue", function(value) {  
299 - if (value && value != "") {  
300 - console.log("observe 监控 dcvalue=" + value);  
301 - scope[ctrlAs].$$internal_select_value = value;  
302 - scope[ctrlAs].$$internal_validate_model();  
303 - }  
304 -  
305 - // 闭包测试  
306 - var obj = {'a':1,'b':2};  
307 - var tfx = scope[ctrlAs].$$test.bind(obj);  
308 - console.log("闭包测试=" + tfx());  
309 - });  
310 -  
311 - scope[ctrlAs].$$test = function() {  
312 - var exp = "this.a + '(' + this.b + ')'";  
313 - console.log("exp=" + exp);  
314 - return eval(exp);  
315 - };  
316 - }  
317 - };  
318 -  
319 - }  
320 -  
321 - };  
322 - } 1 +/**
  2 + * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
  3 + * name(必须):控件的名字
  4 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  5 + * placeholder(可选):输入框占位符字符串
  6 + *
  7 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  8 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  9 + * icname(必须):内部与之对应的字段名,如:icname=code
  10 + *
  11 + * cmaps(可选):model其他字段和内部数据字段名映射,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}
  12 + * dsparams(必须):内部数据源查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  13 + * dscol(必须):内部显示的信息(暂时用内部字段),如:dscol=name
  14 + * required(可选):是否要用required验证
  15 + */
  16 +angular.module('ScheduleApp').directive('saSelect4', [
  17 + '$timeout',
  18 + '$$SearchInfoService_g',
  19 + function($timeout, $$searchInfoService_g) {
  20 + return {
  21 + restrict: 'E',
  22 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect4Template.html',
  23 + scope: {
  24 + model: "=" // 独立作用域,关联外部的模型object
  25 + },
  26 + controllerAs: "$saSelectCtrl",
  27 + bindToController: true,
  28 + controller: function($scope) {
  29 + var self = this;
  30 + self.$$data = []; // ui-select显示用的数据
  31 + self.$$data_real = []; // 内部真实的数据
  32 +
  33 + // saSelect4组件的ng-model,用于外部绑定验证等操作
  34 + self.$$internalmodel = undefined;
  35 +
  36 + self.$$internal_select_value = undefined; // 选中的值
  37 + },
  38 +
  39 + /**
  40 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  41 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  42 + * @param tElem
  43 + * @param tAttrs
  44 + * @returns {{pre: Function, post: Function}}
  45 + */
  46 + compile: function(tElem, tAttrs) {
  47 + // 获取属性
  48 + var $name_attr = tAttrs["name"]; // 控件的名字
  49 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  50 +
  51 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  52 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  53 +
  54 + var $cmaps_attr = tAttrs["cmaps"]; // model其他字段和内部数据字段名映射
  55 + var $dscol_attr = tAttrs["dscol"]; // 内部显示的信息
  56 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  57 +
  58 + // controlAs名字
  59 + var ctrlAs = "$saSelectCtrl";
  60 +
  61 + // 验证属性
  62 + if (!$name_attr) {
  63 + throw new error("name属性必须填写");
  64 + }
  65 + if (!$dcname_attr) {
  66 + throw new error("dcname属性必须填写");
  67 + }
  68 + if (!$icname_attr) {
  69 + throw new error("icname属性必须填写");
  70 + }
  71 + if (!$dscol_attr) {
  72 + throw new error("dscol属性必须填写");
  73 + }
  74 +
  75 + // 动态设置dom
  76 + // dom required 属性
  77 + if ($required_attr != undefined) {
  78 + tElem.find("div").attr("required", "");
  79 + }
  80 + // dom placeholder 属性
  81 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  82 + // dom dscol 属性
  83 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $dscol_attr + "}}");
  84 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $dscol_attr);
  85 + // dom icname 属性
  86 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  87 + // dom name 属性
  88 + tElem.find("div").attr("name", $name_attr);
  89 +
  90 + return {
  91 + pre: function(scope, element, attr) {
  92 + // TODO:
  93 + },
  94 +
  95 + /**
  96 + * 相当于link函数。
  97 + * @param scope
  98 + * @param element
  99 + * @param attr
  100 + */
  101 + post: function(scope, element, attr) {
  102 +
  103 + // 添加选中事件处理函数
  104 + scope[ctrlAs].$$internal_select_fn = function($item) {
  105 + if ($dcname_attr && $icname_attr) {
  106 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  107 + }
  108 +
  109 + if ($cmaps_attr) {
  110 + for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名
  111 + var ic = $cmaps_attr[mc]; // 内部数据源对应字段
  112 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
  113 + }
  114 + }
  115 + };
  116 +
  117 + // 删除选中事件处理函数
  118 + scope[ctrlAs].$$internal_remove_fn = function() {
  119 + scope[ctrlAs].$$internal_select_value = undefined;
  120 + if ($dcname_attr) {
  121 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  122 + }
  123 +
  124 + if ($cmaps_attr) {
  125 + var mc; // model的字段名
  126 + for (mc in $cmaps_attr) {
  127 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  128 + }
  129 + }
  130 + scope[ctrlAs].$$internal_validate_model();
  131 + };
  132 +
  133 + // 刷新数据
  134 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  135 + if (search && search != "") { // 有search值
  136 + // 处理search
  137 + console.log("search:" + search);
  138 +
  139 + scope[ctrlAs].$$data = [];
  140 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  141 + var upTerm = search.toUpperCase();
  142 + if (scope[ctrlAs].$$data.length < 10) {
  143 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  144 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  145 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  146 + }
  147 + } else {
  148 + break;
  149 + }
  150 + }
  151 + }
  152 + };
  153 +
  154 + /**
  155 + * 验证内部数据,更新外部model
  156 + */
  157 + scope[ctrlAs].$$internal_validate_model = function() {
  158 + if (scope[ctrlAs].$$internal_select_value) {
  159 + var select_value_temp = scope[ctrlAs].$$internal_select_value;
  160 + if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
  161 + var obj;
  162 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  163 + if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
  164 + obj = angular.copy(scope[ctrlAs].$$data_real[j]);
  165 + break;
  166 + }
  167 + }
  168 + if (obj) { // 在data中判定有没有
  169 + for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
  170 + if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
  171 + obj = undefined;
  172 + break;
  173 + }
  174 + }
  175 + if (obj) {
  176 + scope[ctrlAs].$$data.push(obj);
  177 + }
  178 + // 更新内部model,用于外部验证
  179 + // 内部model的值暂时随意,以后再改
  180 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  181 + } else {
  182 + scope[ctrlAs].$$internalmodel = undefined;
  183 + }
  184 +
  185 + } else {
  186 + scope[ctrlAs].$$internalmodel = undefined;
  187 + }
  188 +
  189 + } else {
  190 + scope[ctrlAs].$$internalmodel = undefined;
  191 + }
  192 + };
  193 +
  194 + /**
  195 + * 内部方法,读取字典数据作为数据源。
  196 + * @param atype ajax查询类型
  197 + * @param ajaxparamobj 查询参数对象
  198 + */
  199 + scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
  200 + ajaxparamobj.type = 'all';
  201 + $$searchInfoService_g[atype].list(
  202 + ajaxparamobj,
  203 + function(result) {
  204 + console.log("$$internal_ajax_data result");
  205 +
  206 + // 清空内部数据
  207 + scope[ctrlAs].$$data_real = [];
  208 + scope[ctrlAs].$$data = [];
  209 +
  210 + // result中添加拼音数据,注意:这里要求result返回对象数组
  211 + for (var i = 0; i < result.length; i ++) {
  212 + if ($dscol_attr) {
  213 + if (eval("result[i]" + "." + $dscol_attr)) {
  214 + // 全拼
  215 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $dscol_attr)).toUpperCase();
  216 + // 简拼
  217 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $dscol_attr));
  218 + }
  219 + }
  220 +
  221 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  222 + scope[ctrlAs].$$data_real.push(result[i]);
  223 + }
  224 +
  225 + }
  226 +
  227 + // 数据量太大,取10条记录显示
  228 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  229 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  230 + if (scope[ctrlAs].$$data.length < 10) {
  231 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  232 + } else {
  233 + break;
  234 + }
  235 + }
  236 + }
  237 +
  238 + scope[ctrlAs].$$internal_validate_model();
  239 + },
  240 + function(result) {
  241 +
  242 + }
  243 + );
  244 + };
  245 +
  246 + /**
  247 + * 内部方法,读取字典数据作为数据源。
  248 + * @param dictype 字典类型,如:gsType
  249 + */
  250 + scope[ctrlAs].$$internal_dic_data = function(dictype) {
  251 + if (!dictionaryUtils.getByGroup(dictype)) {
  252 + throw new error("字典数据不窜在=" + dictype);
  253 + }
  254 +
  255 + // 清空内部数据
  256 + scope[ctrlAs].$$data_real = [];
  257 + scope[ctrlAs].$$data = [];
  258 +
  259 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  260 + var dic_key; // 字典key
  261 +
  262 + for (dic_key in origin_dicgroup) {
  263 + var data = {}; // 重新组合的字典元素对象
  264 + if (dic_key == "true")
  265 + data[$icname_attr] = true;
  266 + else
  267 + data[$icname_attr] = dic_key;
  268 + data[$dscol_attr] = origin_dicgroup[dic_key];
  269 + scope[ctrlAs].$$data_real.push(data);
  270 + }
  271 + // 这里直接将$$data_real数据深拷贝到$$data
  272 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  273 + scope[ctrlAs].$$internal_validate_model();
  274 + };
  275 +
  276 + attr.$observe("dsparams", function(value) {
  277 + if (value && value != "") {
  278 + var obj = JSON.parse(value);
  279 + console.log("observe 监控 dsparams=" + obj);
  280 +
  281 + // dsparams格式如下:
  282 + // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
  283 +
  284 + if (obj.type == 'dic') {
  285 + scope[ctrlAs].$$internal_dic_data(obj.param);
  286 +
  287 + } else if (obj.type == 'ajax') {
  288 + scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  289 + } else {
  290 + throw new Error("dsparams参数格式异常=" + obj);
  291 + }
  292 +
  293 + }
  294 +
  295 + });
  296 +
  297 + // 监控model绑定的dcvalue值变化
  298 + attr.$observe("dcvalue", function(value) {
  299 + if (value && value != "") {
  300 + console.log("observe 监控 dcvalue=" + value);
  301 + scope[ctrlAs].$$internal_select_value = value;
  302 + scope[ctrlAs].$$internal_validate_model();
  303 + }
  304 +
  305 + // 闭包测试
  306 + var obj = {'a':1,'b':2};
  307 + var tfx = scope[ctrlAs].$$test.bind(obj);
  308 + console.log("闭包测试=" + tfx());
  309 + });
  310 +
  311 + scope[ctrlAs].$$test = function() {
  312 + var exp = "this.a + '(' + this.b + ')'";
  313 + console.log("exp=" + exp);
  314 + return eval(exp);
  315 + };
  316 + }
  317 + };
  318 +
  319 + }
  320 +
  321 + };
  322 + }
323 ]); 323 ]);
324 \ No newline at end of file 324 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
1 -/**  
2 - * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。  
3 - * name(必须):控件的名字  
4 - * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave  
5 - * cmaps(必须):外部对象与指令内部数据对象字段名映射对象字符串,如:{'xl.id' : 'id', 'xl.name' : 'name'}  
6 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
7 - * icname(必须):内部与之对应的字段名,如:icname=id  
8 - *  
9 - * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}  
10 - * dsparamsextra(可选):内部数据源查询附加参数对象字符串,如:{'type':'all'}  
11 - * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item  
12 - * iterobjexp(必须):内部显示用的表达式  
13 - * searchph(必须):查询输入占位符字符串,如:searchph=请输入...  
14 - * searchexp(必须):查询基于的内部数据源的表达式,如:searchexp=this.name+'('+this.code+')'  
15 - *  
16 - * required(可选):是否需要form的required验证  
17 - *  
18 - */  
19 -angular.module('ScheduleApp').directive('saSelect5', [  
20 - '$timeout',  
21 - '$$SearchInfoService_g',  
22 - function($timeout, $$searchInfoService_g) {  
23 - return {  
24 - restrict: 'E',  
25 - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',  
26 - scope: { // 独立作用域  
27 - model: "=" // 绑定外部对象  
28 - },  
29 - controllerAs: "$saSelectCtrl",  
30 - bindToController: true,  
31 - controller: function($scope) {  
32 - var self = this;  
33 - self.$$data = []; // 内部ui-select显示用数据  
34 - self.$$data_real = []; // 内部保存的实际数据  
35 -  
36 - // myselect组件的ng-model,用于外部绑定验证等操作  
37 - self.$$internalmodel = undefined;  
38 -  
39 - self.$$internal_select_value = undefined; // 选中的值  
40 -  
41 - },  
42 -  
43 - /**  
44 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
45 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
46 - * @param tElem  
47 - * @param tAttrs  
48 - * @returns {{pre: Function, post: Function}}  
49 - */  
50 - compile: function(tElem, tAttrs) {  
51 - // 获取属性,并验证必须按属性  
52 - var $name_attr = tAttrs["name"]; // 控件的名字  
53 - var $cmaps_attr = tAttrs["cmaps"]; // 外部对象与指令内部数据对象字段名映射对象  
54 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
55 - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名  
56 -  
57 - var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象  
58 - var $dsparamsextra_attr = tAttrs["dsparamsextra"]; // 内部数据源查询附加参数对象字符串  
59 - var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名  
60 - var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式  
61 - var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串  
62 - var $searchexp_attr = tAttrs["searchexp"]; // 查询基于的内部数据源的表达式  
63 -  
64 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
65 -  
66 - if (!$name_attr) {  
67 - throw new Error("name属性必须填写");  
68 - }  
69 - if (!$cmaps_attr) {  
70 - throw new Error("cmaps属性必须填写")  
71 - }  
72 - if (!$dcname_attr || !$icname_attr) {  
73 - throw new Error("dcname、icname属性必须填写");  
74 - }  
75 - if (!$dsparams_attr) {  
76 - throw new Error("dsparams属性必须填写");  
77 - }  
78 - if (!$iterobjname_attr) {  
79 - throw new Error("iterobjname属性必须填写");  
80 - }  
81 - if (!$iterobjexp_attr) {  
82 - throw new Error("iterobjexp属性必须填写");  
83 - }  
84 - if (!$searchph_attr) {  
85 - throw new Error("searchph属性必须填写");  
86 - }  
87 - if (!$searchexp_attr) {  
88 - throw new Error("searchexp属性必须填写");  
89 - }  
90 -  
91 - // 内部controlAs名字  
92 - var ctrlAs = "$saSelectCtrl";  
93 -  
94 - // 动态设置dom  
95 - // dom,最外层name属性设置  
96 - tElem.find("div:first").attr("name", $name_attr);  
97 - // dom,最外层divrequired属性设置  
98 - if ($required_attr != undefined) {  
99 - tElem.find("div[name=\'" + $name_attr + "\']").attr("required", "");  
100 - }  
101 - // dom,ui-select-match的placeholder属性设定  
102 - tElem.find("ui-select-match").attr("placeholder", $searchph_attr);  
103 - // dom,ui-select-match的内容设定  
104 - var uiSelectMatchHtml = "{{" + ctrlAs + ".$$internal_match_str($select.selected)}}";  
105 - tElem.find("ui-select-match").html(uiSelectMatchHtml);  
106 - // dom,ui-select-choices的repeat属性设定  
107 - var uiSelectChoices_repeatAttr = $iterobjname_attr + "." + $icname_attr + " as " + $iterobjname_attr + " in " + ctrlAs + ".$$data";  
108 - tElem.find("ui-select-choices").attr("repeat", uiSelectChoices_repeatAttr);  
109 - // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置  
110 - tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");  
111 -  
112 - return {  
113 - pre: function (scope, element, attr) {  
114 - // TODO:  
115 - },  
116 -  
117 - /**  
118 - * 相当于link函数。  
119 - * @param scope  
120 - * @param element  
121 - * @param attr  
122 - */  
123 - post: function (scope, element, attr) {  
124 -  
125 - // 添加选中事件处理函数  
126 - scope[ctrlAs].$$internal_select_fn = function($item) {  
127 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");  
128 -  
129 - eval("var obj=" + $cmaps_attr);  
130 - for (var mc in obj) { // model的字段名:内部数据源对应字段名  
131 - var ic = obj[mc]; // 内部数据源对应字段  
132 - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");  
133 - }  
134 - };  
135 -  
136 - // 删除选中事件处理函数  
137 - scope[ctrlAs].$$internal_remove_fn = function() {  
138 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");  
139 -  
140 - eval("var obj=" + $cmaps_attr);  
141 - var mc; // model的字段名  
142 - for (mc in obj) {  
143 - eval("scope[ctrlAs].model" + "." + mc + " = undefined;");  
144 - }  
145 - };  
146 -  
147 - // 刷新数据  
148 - scope[ctrlAs].$$internal_refresh_fn = function(search) {  
149 - if (search && search != "") { // 有search值  
150 - // 处理search  
151 - console.log("search:" + search);  
152 -  
153 - scope[ctrlAs].$$data = [];  
154 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
155 - var upTerm = search.toUpperCase();  
156 - if (scope[ctrlAs].$$data.length < 10) {  
157 - if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1  
158 - || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1  
159 - || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {  
160 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
161 - }  
162 - } else {  
163 - break;  
164 - }  
165 - }  
166 - }  
167 - };  
168 -  
169 - /**  
170 - * 验证内部数据,更新外部model  
171 - */  
172 - scope[ctrlAs].$$internal_validate_model = function() {  
173 - if (scope[ctrlAs].$$internal_select_value) {  
174 - var select_value_temp = scope[ctrlAs].$$internal_select_value;  
175 - if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {  
176 - var obj;  
177 - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {  
178 - if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {  
179 - obj = angular.copy(scope[ctrlAs].$$data_real[j]);  
180 - break;  
181 - }  
182 - }  
183 - if (obj) { // 在data中判定有没有  
184 - for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {  
185 - if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {  
186 - obj = undefined;  
187 - break;  
188 - }  
189 - }  
190 - if (obj) {  
191 - scope[ctrlAs].$$data.push(obj);  
192 - }  
193 - // 更新内部model,用于外部验证  
194 - // 内部model的值暂时随意,以后再改  
195 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
196 - } else {  
197 - scope[ctrlAs].$$internalmodel = undefined;  
198 - }  
199 -  
200 - } else {  
201 - scope[ctrlAs].$$internalmodel = undefined;  
202 - }  
203 -  
204 - } else {  
205 - scope[ctrlAs].$$internalmodel = undefined;  
206 - }  
207 - };  
208 -  
209 - /**  
210 - * 内部match表达式转换函数,需要外部绑定此函数的上下文。  
211 - * @param context function上下文  
212 - */  
213 - scope[ctrlAs].$$internal_match_str = function (context) {  
214 - var fx = function() {  
215 - try {  
216 - return eval($searchexp_attr);  
217 - } catch (err) {  
218 - //console.log(err);  
219 - return undefined;  
220 - }  
221 -  
222 - };  
223 -  
224 - var str = fx.bind(context)();  
225 - if (str && str != "")  
226 - return str;  
227 - else  
228 - return undefined;  
229 - };  
230 -  
231 - /**  
232 - * 内部方法,读取字典数据作为数据源。  
233 - * @param atype ajax查询类型  
234 - * @param ajaxparamobj 查询参数对象  
235 - */  
236 - scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {  
237 - // 如果ajaxparamobj为空对象,则表示清空内部选项  
238 - var isEmptyObj = true;  
239 - for (var name in ajaxparamobj) {  
240 - isEmptyObj = false;  
241 - }  
242 - if (isEmptyObj) {  
243 - // 重新创建内部保存的数据  
244 - scope[ctrlAs].$$data_real = [];  
245 - // 重新创建内部ui-select显示用数据,默认取10条记录显示  
246 - scope[ctrlAs].$$data = [];  
247 -  
248 - scope[ctrlAs].$$internal_remove_fn();  
249 - scope[ctrlAs].$$internal_validate_model();  
250 -  
251 - return;  
252 - }  
253 -  
254 - if ($dsparamsextra_attr) { // 合并附加参数  
255 - eval("var extra = " + $dsparamsextra_attr);  
256 - for (var extrakey in extra) {  
257 - ajaxparamobj[extrakey] = extra[extrakey];  
258 - }  
259 - }  
260 -  
261 - $$searchInfoService_g[atype].list(  
262 - ajaxparamobj,  
263 - function(result) {  
264 - console.log("$$internal_ajax_data result");  
265 -  
266 - // 重新创建内部保存的数据  
267 - scope[ctrlAs].$$data_real = [];  
268 - // result中添加拼音数据,注意:这里要求result返回对象数组  
269 - for (var i = 0; i < result.length; i++) {  
270 - // 闭包绑定返回最终查询的值  
271 - var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);  
272 - if (calcu_str) {  
273 - // 全拼  
274 - result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);  
275 - // 简拼  
276 - result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);  
277 - // 原值  
278 - result[i]["$calcu_str"] = calcu_str;  
279 -  
280 - scope[ctrlAs].$$data_real.push(result[i]);  
281 - }  
282 - }  
283 -  
284 - // 重新创建内部ui-select显示用数据,默认取10条记录显示  
285 - scope[ctrlAs].$$data = [];  
286 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
287 - if (scope[ctrlAs].$$data.length < 10) {  
288 - scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);  
289 - } else {  
290 - break;  
291 - }  
292 - }  
293 -  
294 - scope[ctrlAs].$$internal_validate_model();  
295 - },  
296 - function(result) {  
297 - throw new Error("ajax查询出错");  
298 - }  
299 - );  
300 - };  
301 -  
302 - /**  
303 - * 内部方法,读取字典数据作为数据源。  
304 - * @param dictype 字典类型,如:gsType  
305 - */  
306 - scope[ctrlAs].$$internal_dic_data = function(dictype) {  
307 - if (!dictionaryUtils.getByGroup(dictype)) {  
308 - throw new error("字典数据不窜在=" + dictype);  
309 - }  
310 -  
311 - // 重新创建内部保存的数据  
312 - scope[ctrlAs].$$data_real = [];  
313 - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);  
314 - var dic_key; // 字典key  
315 -  
316 - for (dic_key in origin_dicgroup) {  
317 - var data = {}; // 重新组合的字典元素对象  
318 - if (dic_key == "true")  
319 - data[$icname_attr] = true;  
320 - else  
321 - data[$icname_attr] = dic_key;  
322 - data[$dscol_attr] = origin_dicgroup[dic_key];  
323 - scope[ctrlAs].$$data_real.push(data);  
324 - }  
325 -  
326 - // 重新创建内部ui-select显示用数据,直接复制所有的字典数据  
327 - scope[ctrlAs].$$data = [];  
328 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
329 - scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);  
330 - }  
331 -  
332 - scope[ctrlAs].$$internal_validate_model();  
333 - };  
334 -  
335 - /**  
336 - * 监控dsparams属性变化  
337 - */  
338 - attr.$observe("dsparams", function(value) {  
339 - if (value && value != "") {  
340 - var obj = JSON.parse(value);  
341 - console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);  
342 -  
343 - // dsparams格式如下:  
344 - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}  
345 -  
346 - if (obj.type == 'dic') {  
347 - scope[ctrlAs].$$internal_dic_data(obj.param);  
348 -  
349 - } else if (obj.type == 'ajax') {  
350 - scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);  
351 - } else {  
352 - throw new Error("dsparams参数格式异常=" + obj);  
353 - }  
354 -  
355 - }  
356 - });  
357 -  
358 - /**  
359 - * 监控外部模型dcname的值的变化。  
360 - */  
361 - scope.$watch(  
362 - function() {  
363 - return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);  
364 - },  
365 - function(newValue, oldValue) {  
366 - if (newValue === undefined && oldValue === undefined) {  
367 - // 两侧都是undefined,不处理  
368 -  
369 - } else {  
370 - console.log("saSelect5 监控到外部模型" + $dcname_attr + "属性值变化,old=" + oldValue + ",new=" + newValue);  
371 - scope[ctrlAs].$$internal_select_value = newValue;  
372 - scope[ctrlAs].$$internal_validate_model();  
373 - }  
374 - },  
375 - true  
376 - );  
377 - }  
378 - };  
379 - }  
380 - };  
381 - } 1 +/**
  2 + * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
  3 + * name(必须):控件的名字
  4 + * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave
  5 + * cmaps(必须):外部对象与指令内部数据对象字段名映射对象字符串,如:{'xl.id' : 'id', 'xl.name' : 'name'}
  6 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  7 + * icname(必须):内部与之对应的字段名,如:icname=id
  8 + *
  9 + * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  10 + * dsparamsextra(可选):内部数据源查询附加参数对象字符串,如:{'type':'all'}
  11 + * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item
  12 + * iterobjexp(必须):内部显示用的表达式
  13 + * searchph(必须):查询输入占位符字符串,如:searchph=请输入...
  14 + * searchexp(必须):查询基于的内部数据源的表达式,如:searchexp=this.name+'('+this.code+')'
  15 + *
  16 + * required(可选):是否需要form的required验证
  17 + *
  18 + */
  19 +angular.module('ScheduleApp').directive('saSelect5', [
  20 + '$timeout',
  21 + '$$SearchInfoService_g',
  22 + function($timeout, $$searchInfoService_g) {
  23 + return {
  24 + restrict: 'E',
  25 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',
  26 + scope: { // 独立作用域
  27 + model: "=" // 绑定外部对象
  28 + },
  29 + controllerAs: "$saSelectCtrl",
  30 + bindToController: true,
  31 + controller: function($scope) {
  32 + var self = this;
  33 + self.$$data = []; // 内部ui-select显示用数据
  34 + self.$$data_real = []; // 内部保存的实际数据
  35 +
  36 + // myselect组件的ng-model,用于外部绑定验证等操作
  37 + self.$$internalmodel = undefined;
  38 +
  39 + self.$$internal_select_value = undefined; // 选中的值
  40 +
  41 + },
  42 +
  43 + /**
  44 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  45 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  46 + * @param tElem
  47 + * @param tAttrs
  48 + * @returns {{pre: Function, post: Function}}
  49 + */
  50 + compile: function(tElem, tAttrs) {
  51 + // 获取属性,并验证必须按属性
  52 + var $name_attr = tAttrs["name"]; // 控件的名字
  53 + var $cmaps_attr = tAttrs["cmaps"]; // 外部对象与指令内部数据对象字段名映射对象
  54 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  55 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  56 +
  57 + var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象
  58 + var $dsparamsextra_attr = tAttrs["dsparamsextra"]; // 内部数据源查询附加参数对象字符串
  59 + var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名
  60 + var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式
  61 + var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串
  62 + var $searchexp_attr = tAttrs["searchexp"]; // 查询基于的内部数据源的表达式
  63 +
  64 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  65 +
  66 + if (!$name_attr) {
  67 + throw new Error("name属性必须填写");
  68 + }
  69 + if (!$cmaps_attr) {
  70 + throw new Error("cmaps属性必须填写")
  71 + }
  72 + if (!$dcname_attr || !$icname_attr) {
  73 + throw new Error("dcname、icname属性必须填写");
  74 + }
  75 + if (!$dsparams_attr) {
  76 + throw new Error("dsparams属性必须填写");
  77 + }
  78 + if (!$iterobjname_attr) {
  79 + throw new Error("iterobjname属性必须填写");
  80 + }
  81 + if (!$iterobjexp_attr) {
  82 + throw new Error("iterobjexp属性必须填写");
  83 + }
  84 + if (!$searchph_attr) {
  85 + throw new Error("searchph属性必须填写");
  86 + }
  87 + if (!$searchexp_attr) {
  88 + throw new Error("searchexp属性必须填写");
  89 + }
  90 +
  91 + // 内部controlAs名字
  92 + var ctrlAs = "$saSelectCtrl";
  93 +
  94 + // 动态设置dom
  95 + // dom,最外层name属性设置
  96 + tElem.find("div:first").attr("name", $name_attr);
  97 + // dom,最外层divrequired属性设置
  98 + if ($required_attr != undefined) {
  99 + tElem.find("div[name=\'" + $name_attr + "\']").attr("required", "");
  100 + }
  101 + // dom,ui-select-match的placeholder属性设定
  102 + tElem.find("ui-select-match").attr("placeholder", $searchph_attr);
  103 + // dom,ui-select-match的内容设定
  104 + var uiSelectMatchHtml = "{{" + ctrlAs + ".$$internal_match_str($select.selected)}}";
  105 + tElem.find("ui-select-match").html(uiSelectMatchHtml);
  106 + // dom,ui-select-choices的repeat属性设定
  107 + var uiSelectChoices_repeatAttr = $iterobjname_attr + "." + $icname_attr + " as " + $iterobjname_attr + " in " + ctrlAs + ".$$data";
  108 + tElem.find("ui-select-choices").attr("repeat", uiSelectChoices_repeatAttr);
  109 + // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
  110 + tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
  111 +
  112 + return {
  113 + pre: function (scope, element, attr) {
  114 + // TODO:
  115 + },
  116 +
  117 + /**
  118 + * 相当于link函数。
  119 + * @param scope
  120 + * @param element
  121 + * @param attr
  122 + */
  123 + post: function (scope, element, attr) {
  124 +
  125 + // 添加选中事件处理函数
  126 + scope[ctrlAs].$$internal_select_fn = function($item) {
  127 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  128 +
  129 + eval("var obj=" + $cmaps_attr);
  130 + for (var mc in obj) { // model的字段名:内部数据源对应字段名
  131 + var ic = obj[mc]; // 内部数据源对应字段
  132 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
  133 + }
  134 + };
  135 +
  136 + // 删除选中事件处理函数
  137 + scope[ctrlAs].$$internal_remove_fn = function() {
  138 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  139 +
  140 + eval("var obj=" + $cmaps_attr);
  141 + var mc; // model的字段名
  142 + for (mc in obj) {
  143 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  144 + }
  145 + };
  146 +
  147 + // 刷新数据
  148 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  149 + if (search && search != "") { // 有search值
  150 + // 处理search
  151 + console.log("search:" + search);
  152 +
  153 + scope[ctrlAs].$$data = [];
  154 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  155 + var upTerm = search.toUpperCase();
  156 + if (scope[ctrlAs].$$data.length < 10) {
  157 + if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
  158 + || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
  159 + || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
  160 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  161 + }
  162 + } else {
  163 + break;
  164 + }
  165 + }
  166 + }
  167 + };
  168 +
  169 + /**
  170 + * 验证内部数据,更新外部model
  171 + */
  172 + scope[ctrlAs].$$internal_validate_model = function() {
  173 + if (scope[ctrlAs].$$internal_select_value) {
  174 + var select_value_temp = scope[ctrlAs].$$internal_select_value;
  175 + if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
  176 + var obj;
  177 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  178 + if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
  179 + obj = angular.copy(scope[ctrlAs].$$data_real[j]);
  180 + break;
  181 + }
  182 + }
  183 + if (obj) { // 在data中判定有没有
  184 + for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
  185 + if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
  186 + obj = undefined;
  187 + break;
  188 + }
  189 + }
  190 + if (obj) {
  191 + scope[ctrlAs].$$data.push(obj);
  192 + }
  193 + // 更新内部model,用于外部验证
  194 + // 内部model的值暂时随意,以后再改
  195 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  196 + } else {
  197 + scope[ctrlAs].$$internalmodel = undefined;
  198 + }
  199 +
  200 + } else {
  201 + scope[ctrlAs].$$internalmodel = undefined;
  202 + }
  203 +
  204 + } else {
  205 + scope[ctrlAs].$$internalmodel = undefined;
  206 + }
  207 + };
  208 +
  209 + /**
  210 + * 内部match表达式转换函数,需要外部绑定此函数的上下文。
  211 + * @param context function上下文
  212 + */
  213 + scope[ctrlAs].$$internal_match_str = function (context) {
  214 + var fx = function() {
  215 + try {
  216 + return eval($searchexp_attr);
  217 + } catch (err) {
  218 + //console.log(err);
  219 + return undefined;
  220 + }
  221 +
  222 + };
  223 +
  224 + var str = fx.bind(context)();
  225 + if (str && str != "")
  226 + return str;
  227 + else
  228 + return undefined;
  229 + };
  230 +
  231 + /**
  232 + * 内部方法,读取字典数据作为数据源。
  233 + * @param atype ajax查询类型
  234 + * @param ajaxparamobj 查询参数对象
  235 + */
  236 + scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
  237 + // 如果ajaxparamobj为空对象,则表示清空内部选项
  238 + var isEmptyObj = true;
  239 + for (var name in ajaxparamobj) {
  240 + isEmptyObj = false;
  241 + }
  242 + if (isEmptyObj) {
  243 + // 重新创建内部保存的数据
  244 + scope[ctrlAs].$$data_real = [];
  245 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  246 + scope[ctrlAs].$$data = [];
  247 +
  248 + scope[ctrlAs].$$internal_remove_fn();
  249 + scope[ctrlAs].$$internal_validate_model();
  250 +
  251 + return;
  252 + }
  253 +
  254 + if ($dsparamsextra_attr) { // 合并附加参数
  255 + eval("var extra = " + $dsparamsextra_attr);
  256 + for (var extrakey in extra) {
  257 + ajaxparamobj[extrakey] = extra[extrakey];
  258 + }
  259 + }
  260 +
  261 + $$searchInfoService_g[atype].list(
  262 + ajaxparamobj,
  263 + function(result) {
  264 + console.log("$$internal_ajax_data result");
  265 +
  266 + // 重新创建内部保存的数据
  267 + scope[ctrlAs].$$data_real = [];
  268 + // result中添加拼音数据,注意:这里要求result返回对象数组
  269 + for (var i = 0; i < result.length; i++) {
  270 + // 闭包绑定返回最终查询的值
  271 + var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
  272 + if (calcu_str) {
  273 + // 全拼
  274 + result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
  275 + // 简拼
  276 + result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
  277 + // 原值
  278 + result[i]["$calcu_str"] = calcu_str;
  279 +
  280 + scope[ctrlAs].$$data_real.push(result[i]);
  281 + }
  282 + }
  283 +
  284 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  285 + scope[ctrlAs].$$data = [];
  286 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  287 + if (scope[ctrlAs].$$data.length < 10) {
  288 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  289 + } else {
  290 + break;
  291 + }
  292 + }
  293 +
  294 + scope[ctrlAs].$$internal_validate_model();
  295 + },
  296 + function(result) {
  297 + throw new Error("ajax查询出错");
  298 + }
  299 + );
  300 + };
  301 +
  302 + /**
  303 + * 内部方法,读取字典数据作为数据源。
  304 + * @param dictype 字典类型,如:gsType
  305 + */
  306 + scope[ctrlAs].$$internal_dic_data = function(dictype) {
  307 + if (!dictionaryUtils.getByGroup(dictype)) {
  308 + throw new error("字典数据不窜在=" + dictype);
  309 + }
  310 +
  311 + // 重新创建内部保存的数据
  312 + scope[ctrlAs].$$data_real = [];
  313 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  314 + var dic_key; // 字典key
  315 +
  316 + for (dic_key in origin_dicgroup) {
  317 + var data = {}; // 重新组合的字典元素对象
  318 + if (dic_key == "true")
  319 + data[$icname_attr] = true;
  320 + else
  321 + data[$icname_attr] = dic_key;
  322 + data[$dscol_attr] = origin_dicgroup[dic_key];
  323 + scope[ctrlAs].$$data_real.push(data);
  324 + }
  325 +
  326 + // 重新创建内部ui-select显示用数据,直接复制所有的字典数据
  327 + scope[ctrlAs].$$data = [];
  328 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  329 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  330 + }
  331 +
  332 + scope[ctrlAs].$$internal_validate_model();
  333 + };
  334 +
  335 + /**
  336 + * 监控dsparams属性变化
  337 + */
  338 + attr.$observe("dsparams", function(value) {
  339 + if (value && value != "") {
  340 + var obj = JSON.parse(value);
  341 + console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);
  342 +
  343 + // dsparams格式如下:
  344 + // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
  345 +
  346 + if (obj.type == 'dic') {
  347 + scope[ctrlAs].$$internal_dic_data(obj.param);
  348 +
  349 + } else if (obj.type == 'ajax') {
  350 + scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  351 + } else {
  352 + throw new Error("dsparams参数格式异常=" + obj);
  353 + }
  354 +
  355 + }
  356 + });
  357 +
  358 + /**
  359 + * 监控外部模型dcname的值的变化。
  360 + */
  361 + scope.$watch(
  362 + function() {
  363 + return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);
  364 + },
  365 + function(newValue, oldValue) {
  366 + if (newValue === undefined && oldValue === undefined) {
  367 + // 两侧都是undefined,不处理
  368 +
  369 + } else {
  370 + console.log("saSelect5 监控到外部模型" + $dcname_attr + "属性值变化,old=" + oldValue + ",new=" + newValue);
  371 + scope[ctrlAs].$$internal_select_value = newValue;
  372 + scope[ctrlAs].$$internal_validate_model();
  373 + }
  374 + },
  375 + true
  376 + );
  377 + }
  378 + };
  379 + }
  380 + };
  381 + }
382 ]); 382 ]);
383 \ No newline at end of file 383 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts1/ttt.txt deleted 100644 → 0
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidaton.js
1 -angular.module('ScheduleApp').directive("remoteValidaton", [  
2 - 'BusInfoManageService_g',  
3 - 'EmployeeInfoManageService_g',  
4 - 'TimeTableManageService_g',  
5 - function(  
6 - busInfoManageService_g,  
7 - employeeInfoManageService_g,  
8 - timeTableManageService_g  
9 - ) {  
10 - /**  
11 - * 远端验证指令,依赖于ngModel  
12 - * 指令名称 remote-Validation  
13 - * 需要属性 rvtype 表示验证类型  
14 - */  
15 - return {  
16 - restrict: "A",  
17 - require: "^ngModel",  
18 - link: function(scope, element, attr, ngModelCtrl) {  
19 - element.bind("keyup", function() {  
20 - var modelValue = ngModelCtrl.$modelValue;  
21 - var rv1_attr = attr["rv1"];  
22 - if (attr["rvtype"]) {  
23 -  
24 - // 根据rvtype的值,确定使用那个远端验证的url,  
25 - // rv1, rv2, rv3是关联比较值,暂时使用rv1  
26 - // 这个貌似没法通用,根据业务变换  
27 - // TODO:暂时有点乱以后改  
28 - if (attr["rvtype"] == "insideCode") {  
29 - busInfoManageService_g.validate.insideCode(  
30 - {"insideCode_eq": modelValue, type: "equale"},  
31 - function(result) {  
32 - //console.log(result);  
33 - if (result.status == "SUCCESS") {  
34 - ngModelCtrl.$setValidity('remote', true);  
35 - } else {  
36 - ngModelCtrl.$setValidity('remote', false);  
37 - }  
38 - },  
39 - function(result) {  
40 - //console.log(result);  
41 - ngModelCtrl.$setValidity('remote', true);  
42 - }  
43 - );  
44 - } else if (attr["rvtype"] == "jobCode") {  
45 - if (!rv1_attr) {  
46 - ngModelCtrl.$setValidity('remote', false);  
47 - return;  
48 - }  
49 -  
50 - employeeInfoManageService_g.validate.jobCode(  
51 - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},  
52 - function(result) {  
53 - //console.log(result);  
54 - if (result.status == "SUCCESS") {  
55 - ngModelCtrl.$setValidity('remote', true);  
56 - } else {  
57 - ngModelCtrl.$setValidity('remote', false);  
58 - }  
59 - },  
60 - function(result) {  
61 - //console.log(result);  
62 - ngModelCtrl.$setValidity('remote', true);  
63 - }  
64 - );  
65 - } else if (attr["rvtype"] == "ttinfoname") {  
66 - if (!rv1_attr) {  
67 - ngModelCtrl.$setValidity('remote', false);  
68 - return;  
69 - }  
70 -  
71 - timeTableManageService_g.validate.ttinfoname(  
72 - {"name_eq": modelValue, "xl.id_eq": rv1_attr, type: "equale"},  
73 - function(result) {  
74 - //console.log(result);  
75 - if (result.status == "SUCCESS") {  
76 - ngModelCtrl.$setValidity('remote', true);  
77 - } else {  
78 - ngModelCtrl.$setValidity('remote', false);  
79 - }  
80 - },  
81 - function(result) {  
82 - //console.log(result);  
83 - ngModelCtrl.$setValidity('remote', true);  
84 - }  
85 - );  
86 -  
87 - }  
88 - } else {  
89 - // 没有rvtype,就不用远端验证了  
90 - ngModelCtrl.$setValidity('remote', true);  
91 - }  
92 -  
93 - attr.$observe("rv1", function(value) {  
94 - if (attr["rvtype"] == "jobCode") {  
95 - if (!value) {  
96 - ngModelCtrl.$setValidity('remote', false);  
97 - return;  
98 - }  
99 -  
100 - employeeInfoManageService_g.validate.jobCode(  
101 - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},  
102 - function(result) {  
103 - //console.log(result);  
104 - if (result.status == "SUCCESS") {  
105 - ngModelCtrl.$setValidity('remote', true);  
106 - } else {  
107 - ngModelCtrl.$setValidity('remote', false);  
108 - }  
109 - },  
110 - function(result) {  
111 - //console.log(result);  
112 - ngModelCtrl.$setValidity('remote', true);  
113 - }  
114 - );  
115 - } else if (attr["rvtype"] == "ttinfoname") {  
116 - if (!value) {  
117 - ngModelCtrl.$setValidity('remote', false);  
118 - return;  
119 - }  
120 -  
121 - console.log("rv1:" + value);  
122 -  
123 - timeTableManageService_g.validate.ttinfoname(  
124 - {"name_eq": modelValue, "xl.id_eq": value, type: "equale"},  
125 - function(result) {  
126 - //console.log(result);  
127 - if (result.status == "SUCCESS") {  
128 - ngModelCtrl.$setValidity('remote', true);  
129 - } else {  
130 - ngModelCtrl.$setValidity('remote', false);  
131 - }  
132 - },  
133 - function(result) {  
134 - //console.log(result);  
135 - ngModelCtrl.$setValidity('remote', true);  
136 - }  
137 - );  
138 - }  
139 -  
140 - });  
141 - });  
142 - }  
143 - };  
144 - }  
145 - ]  
146 -);  
147 \ No newline at end of file 1 \ No newline at end of file
  2 +/**
  3 + * remoteValidatio指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel。
  4 + * 属性如下:
  5 + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
  6 + * remotevparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }}
  7 + *
  8 + */
  9 +angular.module('ScheduleApp').directive('remoteValidation', [
  10 + '$$SearchInfoService_g',
  11 + function($$SearchInfoService_g) {
  12 + return {
  13 + restrict: "A", // 属性
  14 + require: "^ngModel", // 依赖所属指令的ngModel
  15 + compile: function(tElem, tAttrs) {
  16 + // 验证属性
  17 + if (!tAttrs["remotevtype"]) { // 验证类型
  18 + throw new Error("remotevtype属性必须填写");
  19 + } else if (!$$SearchInfoService_g.validate[tAttrs["remotevtype"]]) {
  20 + throw new Error(!tAttrs["remotevtype"] + "验证类型不存在");
  21 + }
  22 + if (!tAttrs["remotevparam"]) { // 查询参数
  23 + throw new Error("remotevparam属性必须填写");
  24 + }
  25 +
  26 + // 监听获取的数据
  27 + var $watch_rvtype = undefined;
  28 + var $watch_rvparam_obj = undefined;
  29 +
  30 + // 验证数据
  31 + var $$internal_validate = function(ngModelCtrl) {
  32 + if ($watch_rvtype && $watch_rvparam_obj) {
  33 + // 获取查询参数模版
  34 + var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
  35 + if (!paramTemplate) {
  36 + throw new Error($watch_rvtype + "查询模版不存在");
  37 + }
  38 + // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证
  39 + var isParamAll = true;
  40 + for (var key in paramTemplate) {
  41 + if (!$watch_rvparam_obj[key]) {
  42 + isParamAll = false;
  43 + break;
  44 + }
  45 + }
  46 + if (!isParamAll) {
  47 + ngModelCtrl.$setValidity('remote', true);
  48 + } else { // 开始验证
  49 + $$SearchInfoService_g.validate[$watch_rvtype].remote.do(
  50 + $watch_rvparam_obj,
  51 + function(result) {
  52 + if (result.status == "SUCCESS") {
  53 + ngModelCtrl.$setValidity('remote', true);
  54 + } else {
  55 + ngModelCtrl.$setValidity('remote', false);
  56 + }
  57 + },
  58 + function(result) {
  59 + ngModelCtrl.$setValidity('remote', true);
  60 + }
  61 + );
  62 + }
  63 + }
  64 + };
  65 +
  66 + return {
  67 + pre: function(scope, element, attr) {
  68 +
  69 + },
  70 +
  71 + post: function(scope, element, attr, ngModelCtrl) {
  72 + /**
  73 + * 监控验证类型属性变化。
  74 + */
  75 + attr.$observe("remotevtype", function(value) {
  76 + if (value && value != "") {
  77 + $watch_rvtype = value;
  78 + $$internal_validate(ngModelCtrl);
  79 + }
  80 + });
  81 + /**
  82 + * 监控查询结果属性变化。
  83 + */
  84 + attr.$observe("remotevparam", function(value) {
  85 + if (value && value != "") {
  86 + if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证
  87 + return;
  88 + }
  89 + $watch_rvparam_obj = JSON.parse(value);
  90 + $$internal_validate(ngModelCtrl);
  91 + }
  92 + });
  93 + }
  94 + };
  95 + }
  96 + }
  97 + }
  98 +]);
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/temp.txt 0 → 100644
  1 +busInfoManage
  2 +
  3 +employeeInfoManage
  4 +
  5 +timeTableManage
0 \ No newline at end of file 6 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroup.js
1 -/**  
2 - * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。  
3 - * 属性如下:  
4 - * name(必须):控件的名字  
5 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
6 - * bcttinfoidsvalue(必须):绑定的model班次ids字段值,如:bcttinfoidsvalue={{ctrl.employeeInfoForSave.lprange}}  
7 - * bcttinfoidsname(必须):bind的model班次ids字段名,如:bcttinfoidsname=lprange  
8 - * dataparams (必须):内部数据关联的查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}  
9 - * required(可选):是否要用required验证  
10 - *  
11 - */  
12 -angular.module('ScheduleApp').directive('saBcgroup', [  
13 - 'TimeTableDetailManageService_g',  
14 - function(timeTableDetailManageService_g) {  
15 - return {  
16 - restrict: 'E',  
17 - templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroupTemplate.html',  
18 - scope: {  
19 - model: "=" // 独立作用域,关联外部的模型object  
20 - },  
21 - controllerAs: '$saBcgroupCtrl',  
22 - bindToController: true,  
23 - controller: function($scope) {  
24 - var self = this;  
25 - self.$$data = []; // 选择线路,时刻表,路牌后的班次列表  
26 -  
27 - // 测试数据  
28 - //self.$$data = [  
29 - // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},  
30 - // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},  
31 - // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}  
32 - //];  
33 -  
34 -  
35 - self.$$dataSelected = []; // 套跑选中的班次列表  
36 -  
37 - //self.$$dataSelected = [  
38 - // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},  
39 - // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},  
40 - // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}  
41 - //];  
42 -  
43 - // saBcgroup组件的ng-model,用于外部绑定等操作  
44 - self.$$internalmodel = undefined;  
45 -  
46 - self.$$data_bcdata_first_init = false; // 班次数据首次初始化标志  
47 - self.$$data_bcttinfoids_first_init = false; // 班次ids数据首次初始化标志  
48 - self.$$data_bcttinfoids_first_data = undefined; // 班次ids数据首次初始化数据  
49 -  
50 - },  
51 -  
52 - /**  
53 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
54 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
55 - * @param tElem  
56 - * @param tAttrs  
57 - * @returns {{pre: Function, post: Function}}  
58 - */  
59 - compile: function(tElem, tAttrs) {  
60 - // TODO:获取所有的属性  
61 - var $name_attr = tAttrs["name"]; // 控件的名字  
62 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
63 - var $bcttinfoidsname_attr = tAttrs["bcttinfoidsname"]; // bind的model班次ids字段名  
64 -  
65 - // controlAs名字  
66 - var ctrlAs = '$saBcgroupCtrl';  
67 -  
68 - // 如果有required属性,添加angularjs required验证  
69 - if ($required_attr != undefined) {  
70 - //console.log(tElem.html());  
71 - tElem.find("div").attr("required", "");  
72 - }  
73 -  
74 - return {  
75 - pre: function(scope, element, attr) {  
76 - // TODO:  
77 - },  
78 -  
79 - /**  
80 - * 相当于link函数。  
81 - * @param scope  
82 - * @param element  
83 - * @param attr  
84 - */  
85 - post: function(scope, element, attr) {  
86 - // name属性  
87 - if ($name_attr) {  
88 - scope[ctrlAs]["$name_attr"] = $name_attr;  
89 - }  
90 -  
91 - // TODO:  
92 -  
93 -  
94 - /**  
95 - * 班次列表点击(班次列表中选中班次)  
96 - * @param $index  
97 - */  
98 - scope[ctrlAs].$$internal_bclist_click = function($index) {  
99 - var data_temp = scope[ctrlAs].$$data;  
100 - var data_temp2 = scope[ctrlAs].$$dataSelected;  
101 - var i = 0;  
102 - var isunique = true; // 是否已经选择过  
103 - if (data_temp && data_temp.length > $index) {  
104 - for (i = 0; i < data_temp2.length; i++) {  
105 - if (data_temp2[i].bcttinfoid == data_temp[$index].bcttinfoid) {  
106 - isunique = false;  
107 - break;  
108 - }  
109 - }  
110 - if (isunique) {  
111 - data_temp2.push({  
112 - bcttinfoid: data_temp[$index].bcttinfoid,  
113 - bcfcsj: data_temp[$index].bcfcsj,  
114 - bctype: data_temp[$index].bctype  
115 - });  
116 - }  
117 -  
118 - }  
119 - };  
120 - /**  
121 - * 选中的班次双击(删除选中的班次)  
122 - * @param $index  
123 - */  
124 - scope[ctrlAs].$$internal_selbclist_dbclick = function($index) {  
125 - var data_temp = scope[ctrlAs].$$dataSelected;  
126 - if (data_temp && data_temp.length > $index) {  
127 - data_temp.splice($index, 1);  
128 - }  
129 - };  
130 -  
131 -  
132 - /**  
133 - * 验证内部数据,更新外部model  
134 - */  
135 - scope[ctrlAs].$$internal_validate_model = function() {  
136 - var data_temp = scope[ctrlAs].$$dataSelected;  
137 - var bcttinfoIds = [];  
138 - var i = 0;  
139 -  
140 - if (data_temp &&  
141 - data_temp.length > 0) {  
142 -  
143 - for (i = 0; i < data_temp.length; i++) {  
144 - bcttinfoIds.push(data_temp[i].bcttinfoid);  
145 - }  
146 -  
147 - // 更新外部model字段  
148 - if ($bcttinfoidsname_attr) {  
149 - console.log("bcttinfoidsname=" + bcttinfoIds.join(','));  
150 - eval("scope[ctrlAs].model" + "." + $bcttinfoidsname_attr + " = bcttinfoIds.join(',');");  
151 - }  
152 -  
153 - // 更新内部model,用于外部验证  
154 - // 内部model的值暂时随意,以后再改  
155 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
156 -  
157 - scope[ctrlAs].$$data_bcdata_first_init = true;  
158 - scope[ctrlAs].$$data_bcttinfoids_first_init = true;  
159 -  
160 - } else {  
161 - scope[ctrlAs].$$internalmodel = undefined;  
162 - }  
163 -  
164 - };  
165 -  
166 - // 监控内部数据,$$data_selected 变化  
167 - scope.$watch(  
168 - function() {  
169 - console.log("长度:" + scope[ctrlAs].$$dataSelected.length);  
170 - return scope[ctrlAs].$$dataSelected;  
171 - },  
172 - function(newValue, oldValue) {  
173 - scope[ctrlAs].$$internal_validate_model();  
174 - },  
175 - true  
176 - );  
177 -  
178 - /**  
179 - * 验证数据是否初始化完成,  
180 - * 所谓的初始化就是内部所有的数据被有效设定过一次。  
181 - */  
182 - scope[ctrlAs].$$internal_validate_init = function() {  
183 - var self = scope[ctrlAs];  
184 -  
185 - var data_temp = self.$$data;  
186 - var dataSelect_temp = self.$$dataSelected;  
187 - var bcttinfoids = null;  
188 -  
189 - var i = 0;  
190 - var j = 0;  
191 -  
192 - if (self.$$data_bcdata_first_init &&  
193 - self.$$data_bcttinfoids_first_init) {  
194 - console.log("开始初始化数据");  
195 -  
196 - bcttinfoids = self.$$data_bcttinfoids_first_data ? self.$$data_bcttinfoids_first_data.split(",") : [];  
197 -  
198 - for (i = 0; i < bcttinfoids.length; i++) {  
199 - dataSelect_temp.push({  
200 - bcttinfoid: bcttinfoids[i]  
201 - });  
202 - for (j = 0; j < data_temp.length; j++) {  
203 - if (dataSelect_temp[i].bcttinfoid == data_temp[j].bcttinfoid) {  
204 - dataSelect_temp[i].bcfcsj = data_temp[j].bcfcsj;  
205 - dataSelect_temp[i].bctype = data_temp[j].bctype;  
206 - break;  
207 - }  
208 - }  
209 - }  
210 -  
211 - console.log("数据初始化完毕!");  
212 - }  
213 -  
214 - };  
215 -  
216 - // 监控初始化标志  
217 - scope.$watch(  
218 - function() {  
219 - return scope[ctrlAs].$$data_bcdata_first_init;  
220 - },  
221 - function(newValue, oldValue) {  
222 - scope[ctrlAs].$$internal_validate_init();  
223 - }  
224 - );  
225 - scope.$watch(  
226 - function() {  
227 - return scope[ctrlAs].$$data_bcttinfoids_first_init;  
228 - },  
229 - function(newValue, oldValue) {  
230 - scope[ctrlAs].$$internal_validate_init();  
231 - }  
232 - );  
233 -  
234 - // 监控内部数据的变化  
235 - attr.$observe("dataparams", function(value) {  
236 - if (value && value != "") {  
237 - if (value == '{}') {  
238 - return;  
239 - }  
240 -  
241 - console.log("bcgroup observe 监控 dataparams=" + value);  
242 -  
243 - timeTableDetailManageService_g.bcdetails.list(  
244 - JSON.parse(value),  
245 - function(result) {  
246 - // 获取值了  
247 - console.log("内部班次数据获取了");  
248 -  
249 - scope[ctrlAs].$$data = [];  
250 - for (var i = 0; i < result.length; i++) {  
251 - scope[ctrlAs].$$data.push({  
252 - bcttinfoid: result[i].id,  
253 - bcfcsj: result[i].fcsj,  
254 - bctype: result[i].bcType  
255 - });  
256 - }  
257 - if (scope[ctrlAs].$$data_bcdata_first_init &&  
258 - scope[ctrlAs].$$data_bcttinfoids_first_init) {  
259 -  
260 - scope[ctrlAs].$$dataSelected = [];  
261 - scope[ctrlAs].$$internalmodel = undefined;  
262 - }  
263 - scope[ctrlAs].$$data_bcdata_first_init = true;  
264 - },  
265 - function(result) {  
266 -  
267 - }  
268 - );  
269 - }  
270 - });  
271 - // 监控班次ids数据的变化  
272 - attr.$observe("bcttinfoidsvalue", function(value) {  
273 - if (value && value != "") {  
274 - console.log("observe 监控 bcttinfoidsvalue=" + value);  
275 - scope[ctrlAs].$$data_bcttinfoids_first_init = true;  
276 - scope[ctrlAs].$$data_bcttinfoids_first_data = value;  
277 - }  
278 - });  
279 -  
280 - }  
281 - }  
282 -  
283 - }  
284 - }  
285 - } 1 +/**
  2 + * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
  3 + * 属性如下:
  4 + * name(必须):控件的名字
  5 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  6 + * bcttinfoidsvalue(必须):绑定的model班次ids字段值,如:bcttinfoidsvalue={{ctrl.employeeInfoForSave.lprange}}
  7 + * bcttinfoidsname(必须):bind的model班次ids字段名,如:bcttinfoidsname=lprange
  8 + * dataparams (必须):内部数据关联的查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  9 + * required(可选):是否要用required验证
  10 + *
  11 + */
  12 +angular.module('ScheduleApp').directive('saBcgroup', [
  13 + 'TimeTableDetailManageService_g',
  14 + function(timeTableDetailManageService_g) {
  15 + return {
  16 + restrict: 'E',
  17 + templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroupTemplate.html',
  18 + scope: {
  19 + model: "=" // 独立作用域,关联外部的模型object
  20 + },
  21 + controllerAs: '$saBcgroupCtrl',
  22 + bindToController: true,
  23 + controller: function($scope) {
  24 + var self = this;
  25 + self.$$data = []; // 选择线路,时刻表,路牌后的班次列表
  26 +
  27 + // 测试数据
  28 + //self.$$data = [
  29 + // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
  30 + // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
  31 + // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
  32 + //];
  33 +
  34 +
  35 + self.$$dataSelected = []; // 套跑选中的班次列表
  36 +
  37 + //self.$$dataSelected = [
  38 + // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
  39 + // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
  40 + // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
  41 + //];
  42 +
  43 + // saBcgroup组件的ng-model,用于外部绑定等操作
  44 + self.$$internalmodel = undefined;
  45 +
  46 + self.$$data_bcdata_first_init = false; // 班次数据首次初始化标志
  47 + self.$$data_bcttinfoids_first_init = false; // 班次ids数据首次初始化标志
  48 + self.$$data_bcttinfoids_first_data = undefined; // 班次ids数据首次初始化数据
  49 +
  50 + },
  51 +
  52 + /**
  53 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  54 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  55 + * @param tElem
  56 + * @param tAttrs
  57 + * @returns {{pre: Function, post: Function}}
  58 + */
  59 + compile: function(tElem, tAttrs) {
  60 + // TODO:获取所有的属性
  61 + var $name_attr = tAttrs["name"]; // 控件的名字
  62 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  63 + var $bcttinfoidsname_attr = tAttrs["bcttinfoidsname"]; // bind的model班次ids字段名
  64 +
  65 + // controlAs名字
  66 + var ctrlAs = '$saBcgroupCtrl';
  67 +
  68 + // 如果有required属性,添加angularjs required验证
  69 + if ($required_attr != undefined) {
  70 + //console.log(tElem.html());
  71 + tElem.find("div").attr("required", "");
  72 + }
  73 +
  74 + return {
  75 + pre: function(scope, element, attr) {
  76 + // TODO:
  77 + },
  78 +
  79 + /**
  80 + * 相当于link函数。
  81 + * @param scope
  82 + * @param element
  83 + * @param attr
  84 + */
  85 + post: function(scope, element, attr) {
  86 + // name属性
  87 + if ($name_attr) {
  88 + scope[ctrlAs]["$name_attr"] = $name_attr;
  89 + }
  90 +
  91 + // TODO:
  92 +
  93 +
  94 + /**
  95 + * 班次列表点击(班次列表中选中班次)
  96 + * @param $index
  97 + */
  98 + scope[ctrlAs].$$internal_bclist_click = function($index) {
  99 + var data_temp = scope[ctrlAs].$$data;
  100 + var data_temp2 = scope[ctrlAs].$$dataSelected;
  101 + var i = 0;
  102 + var isunique = true; // 是否已经选择过
  103 + if (data_temp && data_temp.length > $index) {
  104 + for (i = 0; i < data_temp2.length; i++) {
  105 + if (data_temp2[i].bcttinfoid == data_temp[$index].bcttinfoid) {
  106 + isunique = false;
  107 + break;
  108 + }
  109 + }
  110 + if (isunique) {
  111 + data_temp2.push({
  112 + bcttinfoid: data_temp[$index].bcttinfoid,
  113 + bcfcsj: data_temp[$index].bcfcsj,
  114 + bctype: data_temp[$index].bctype
  115 + });
  116 + }
  117 +
  118 + }
  119 + };
  120 + /**
  121 + * 选中的班次双击(删除选中的班次)
  122 + * @param $index
  123 + */
  124 + scope[ctrlAs].$$internal_selbclist_dbclick = function($index) {
  125 + var data_temp = scope[ctrlAs].$$dataSelected;
  126 + if (data_temp && data_temp.length > $index) {
  127 + data_temp.splice($index, 1);
  128 + }
  129 + };
  130 +
  131 +
  132 + /**
  133 + * 验证内部数据,更新外部model
  134 + */
  135 + scope[ctrlAs].$$internal_validate_model = function() {
  136 + var data_temp = scope[ctrlAs].$$dataSelected;
  137 + var bcttinfoIds = [];
  138 + var i = 0;
  139 +
  140 + if (data_temp &&
  141 + data_temp.length > 0) {
  142 +
  143 + for (i = 0; i < data_temp.length; i++) {
  144 + bcttinfoIds.push(data_temp[i].bcttinfoid);
  145 + }
  146 +
  147 + // 更新外部model字段
  148 + if ($bcttinfoidsname_attr) {
  149 + console.log("bcttinfoidsname=" + bcttinfoIds.join(','));
  150 + eval("scope[ctrlAs].model" + "." + $bcttinfoidsname_attr + " = bcttinfoIds.join(',');");
  151 + }
  152 +
  153 + // 更新内部model,用于外部验证
  154 + // 内部model的值暂时随意,以后再改
  155 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  156 +
  157 + scope[ctrlAs].$$data_bcdata_first_init = true;
  158 + scope[ctrlAs].$$data_bcttinfoids_first_init = true;
  159 +
  160 + } else {
  161 + scope[ctrlAs].$$internalmodel = undefined;
  162 + }
  163 +
  164 + };
  165 +
  166 + // 监控内部数据,$$data_selected 变化
  167 + scope.$watch(
  168 + function() {
  169 + console.log("长度:" + scope[ctrlAs].$$dataSelected.length);
  170 + return scope[ctrlAs].$$dataSelected;
  171 + },
  172 + function(newValue, oldValue) {
  173 + scope[ctrlAs].$$internal_validate_model();
  174 + },
  175 + true
  176 + );
  177 +
  178 + /**
  179 + * 验证数据是否初始化完成,
  180 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  181 + */
  182 + scope[ctrlAs].$$internal_validate_init = function() {
  183 + var self = scope[ctrlAs];
  184 +
  185 + var data_temp = self.$$data;
  186 + var dataSelect_temp = self.$$dataSelected;
  187 + var bcttinfoids = null;
  188 +
  189 + var i = 0;
  190 + var j = 0;
  191 +
  192 + if (self.$$data_bcdata_first_init &&
  193 + self.$$data_bcttinfoids_first_init) {
  194 + console.log("开始初始化数据");
  195 +
  196 + bcttinfoids = self.$$data_bcttinfoids_first_data ? self.$$data_bcttinfoids_first_data.split(",") : [];
  197 +
  198 + for (i = 0; i < bcttinfoids.length; i++) {
  199 + dataSelect_temp.push({
  200 + bcttinfoid: bcttinfoids[i]
  201 + });
  202 + for (j = 0; j < data_temp.length; j++) {
  203 + if (dataSelect_temp[i].bcttinfoid == data_temp[j].bcttinfoid) {
  204 + dataSelect_temp[i].bcfcsj = data_temp[j].bcfcsj;
  205 + dataSelect_temp[i].bctype = data_temp[j].bctype;
  206 + break;
  207 + }
  208 + }
  209 + }
  210 +
  211 + console.log("数据初始化完毕!");
  212 + }
  213 +
  214 + };
  215 +
  216 + // 监控初始化标志
  217 + scope.$watch(
  218 + function() {
  219 + return scope[ctrlAs].$$data_bcdata_first_init;
  220 + },
  221 + function(newValue, oldValue) {
  222 + scope[ctrlAs].$$internal_validate_init();
  223 + }
  224 + );
  225 + scope.$watch(
  226 + function() {
  227 + return scope[ctrlAs].$$data_bcttinfoids_first_init;
  228 + },
  229 + function(newValue, oldValue) {
  230 + scope[ctrlAs].$$internal_validate_init();
  231 + }
  232 + );
  233 +
  234 + // 监控内部数据的变化
  235 + attr.$observe("dataparams", function(value) {
  236 + if (value && value != "") {
  237 + if (value == '{}') {
  238 + return;
  239 + }
  240 +
  241 + console.log("bcgroup observe 监控 dataparams=" + value);
  242 +
  243 + timeTableDetailManageService_g.bcdetails.list(
  244 + JSON.parse(value),
  245 + function(result) {
  246 + // 获取值了
  247 + console.log("内部班次数据获取了");
  248 +
  249 + scope[ctrlAs].$$data = [];
  250 + for (var i = 0; i < result.length; i++) {
  251 + scope[ctrlAs].$$data.push({
  252 + bcttinfoid: result[i].id,
  253 + bcfcsj: result[i].fcsj,
  254 + bctype: result[i].bcType
  255 + });
  256 + }
  257 + if (scope[ctrlAs].$$data_bcdata_first_init &&
  258 + scope[ctrlAs].$$data_bcttinfoids_first_init) {
  259 +
  260 + scope[ctrlAs].$$dataSelected = [];
  261 + scope[ctrlAs].$$internalmodel = undefined;
  262 + }
  263 + scope[ctrlAs].$$data_bcdata_first_init = true;
  264 + },
  265 + function(result) {
  266 +
  267 + }
  268 + );
  269 + }
  270 + });
  271 + // 监控班次ids数据的变化
  272 + attr.$observe("bcttinfoidsvalue", function(value) {
  273 + if (value && value != "") {
  274 + console.log("observe 监控 bcttinfoidsvalue=" + value);
  275 + scope[ctrlAs].$$data_bcttinfoids_first_init = true;
  276 + scope[ctrlAs].$$data_bcttinfoids_first_data = value;
  277 + }
  278 + });
  279 +
  280 + }
  281 + }
  282 +
  283 + }
  284 + }
  285 + }
286 ]); 286 ]);
287 \ No newline at end of file 287 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts2/dateGroup/saDategroup.js
1 -  
2 -  
3 -/**  
4 - * saDategroup指令  
5 - * 属性如下:  
6 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
7 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
8 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
9 - * name(必须):控件的名字  
10 - * required(可选):是否要用required验证  
11 - * disabled(可选):标示框是否可选  
12 - *  
13 - */  
14 -angular.module('ScheduleApp').directive('saDategroup', [  
15 - '$filter',  
16 - function($filter) {  
17 - return {  
18 - restrict: 'E',  
19 - templateUrl: '/pages/scheduleApp/module/common/dts2/dateGroup/saDategroupTemplate.html',  
20 - scope: {  
21 - model: "=" // 独立作用域,关联外部的模型object  
22 - },  
23 - controllerAs: "$saDategroupCtrl",  
24 - bindToController: true,  
25 - controller: function($scope) {  
26 - var self = this;  
27 - self.$$data = []; // 内部的数据  
28 - self.$$date_select; // 内部选中的日期  
29 -  
30 - //// 测试数据  
31 - //self.$$data = [  
32 - // {datestr: '2011-01-01', ischecked: true},  
33 - // {datestr: '2011-01-01', ischecked: true},  
34 - // {datestr: '2011-01-01', ischecked: true}  
35 - //];  
36 - },  
37 -  
38 - /**  
39 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
40 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
41 - * @param tElem  
42 - * @param tAttrs  
43 - * @returns {{pre: Function, post: Function}}  
44 - */  
45 - compile: function(tElem, tAttrs) {  
46 - // 获取所有的属性  
47 - var $name_attr = tAttrs["name"]; // 控件的名字  
48 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
49 - var $disabled_attr = tAttrs["disabled"]; // 是否禁用  
50 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
51 -  
52 - // controlAs名字  
53 - var ctrlAs = '$saDategroupCtrl';  
54 -  
55 - // 如果有required属性,添加angularjs required验证  
56 - if ($required_attr != undefined) {  
57 - //console.log(tElem.html());  
58 - tElem.find("div").attr("required", "");  
59 - }  
60 - // 如果有disabled属性,添加禁用标志  
61 - if ($disabled_attr != undefined) {  
62 - tElem.find("input").attr("ng-disabled", "true");  
63 - tElem.find("div").attr("ng-disabled", "true");  
64 - }  
65 -  
66 - return {  
67 - pre: function (scope, element, attr) {  
68 - // TODO:  
69 - },  
70 - /**  
71 - * 相当于link函数。  
72 - * @param scope  
73 - * @param element  
74 - * @param attr  
75 - */  
76 - post: function (scope, element, attr) {  
77 - // name属性  
78 - if ($name_attr) {  
79 - scope[ctrlAs]["$name_attr"] = $name_attr;  
80 - }  
81 -  
82 -  
83 - // 日期open属性,及方法  
84 - scope[ctrlAs].$$specialDateOpen = false;  
85 - scope[ctrlAs].$$specialDate_open = function() {  
86 - scope[ctrlAs].$$specialDateOpen = true;  
87 - };  
88 -  
89 - // 监控选择的日期  
90 - scope.$watch(  
91 - function() {  
92 - return scope[ctrlAs]['$$date_select'];  
93 - },  
94 - function(newValue, oldValue) {  
95 - if (newValue) {  
96 - //console.log("saDategroup--->selectdate:" + newValue);  
97 - // 调用内置filter,转换日期到yyyy-MM-dd格式  
98 - var text = $filter('date')(newValue, 'yyyy-MM-dd');  
99 - var i;  
100 - var isexist = false; // 日期是否已经选择标识  
101 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
102 - if (scope[ctrlAs]["$$data"][i].datestr == text) {  
103 - isexist = true;  
104 - break;  
105 - }  
106 - }  
107 - if (!isexist) {  
108 - scope[ctrlAs]["$$data"].push(  
109 - {  
110 - datestr: text,  
111 - ischecked: true  
112 - }  
113 - );  
114 - }  
115 -  
116 - }  
117 -  
118 - }  
119 - );  
120 -  
121 - /**  
122 - * 日期点击事件处理函数。  
123 - * @param $index 索引  
124 - */  
125 - scope[ctrlAs].$$internal_datestr_click = function($index) {  
126 - scope[ctrlAs].$$data.splice($index, 1);  
127 - };  
128 -  
129 - // 测试使用watch监控$$data的变化  
130 - scope.$watch(  
131 - function() {  
132 - return scope[ctrlAs]['$$data'];  
133 - },  
134 - function(newValue, oldValue) {  
135 - // 根据$$data生成对应的数据  
136 - var special_days_arr = [];  
137 - var i;  
138 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
139 - special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);  
140 - }  
141 -  
142 - scope[ctrlAs].$$internalmodel = special_days_arr.join(",");  
143 - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);  
144 -  
145 - // 更新model  
146 - if ($dcname_attr) {  
147 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");  
148 - }  
149 - },  
150 - true  
151 - );  
152 -  
153 - // 监控dcvalue model值变换  
154 - attr.$observe("dcvalue", function(value) {  
155 - console.log("saDategroup 监控dc1 model值变换:" + value);  
156 - if (value) {  
157 - // 根据value值,修改$$data里的值  
158 - var date_array = value.split(",");  
159 - var i;  
160 - scope[ctrlAs]["$$data"] = [];  
161 - for (i = 0; i < date_array.length; i++) {  
162 - scope[ctrlAs]["$$data"].push(  
163 - {  
164 - datestr: date_array[i],  
165 - ischecked: true  
166 - }  
167 - );  
168 - }  
169 -  
170 -  
171 -  
172 -  
173 -  
174 -  
175 -  
176 -  
177 -  
178 - }  
179 - });  
180 -  
181 - }  
182 -  
183 - };  
184 - }  
185 - }  
186 - }  
187 -]);  
188 - 1 +
  2 +
  3 +/**
  4 + * saDategroup指令
  5 + * 属性如下:
  6 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  7 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  8 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  9 + * name(必须):控件的名字
  10 + * required(可选):是否要用required验证
  11 + * disabled(可选):标示框是否可选
  12 + *
  13 + */
  14 +angular.module('ScheduleApp').directive('saDategroup', [
  15 + '$filter',
  16 + function($filter) {
  17 + return {
  18 + restrict: 'E',
  19 + templateUrl: '/pages/scheduleApp/module/common/dts2/dateGroup/saDategroupTemplate.html',
  20 + scope: {
  21 + model: "=" // 独立作用域,关联外部的模型object
  22 + },
  23 + controllerAs: "$saDategroupCtrl",
  24 + bindToController: true,
  25 + controller: function($scope) {
  26 + var self = this;
  27 + self.$$data = []; // 内部的数据
  28 + self.$$date_select; // 内部选中的日期
  29 +
  30 + //// 测试数据
  31 + //self.$$data = [
  32 + // {datestr: '2011-01-01', ischecked: true},
  33 + // {datestr: '2011-01-01', ischecked: true},
  34 + // {datestr: '2011-01-01', ischecked: true}
  35 + //];
  36 + },
  37 +
  38 + /**
  39 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  40 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  41 + * @param tElem
  42 + * @param tAttrs
  43 + * @returns {{pre: Function, post: Function}}
  44 + */
  45 + compile: function(tElem, tAttrs) {
  46 + // 获取所有的属性
  47 + var $name_attr = tAttrs["name"]; // 控件的名字
  48 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  49 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  50 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  51 +
  52 + // controlAs名字
  53 + var ctrlAs = '$saDategroupCtrl';
  54 +
  55 + // 如果有required属性,添加angularjs required验证
  56 + if ($required_attr != undefined) {
  57 + //console.log(tElem.html());
  58 + tElem.find("div").attr("required", "");
  59 + }
  60 + // 如果有disabled属性,添加禁用标志
  61 + if ($disabled_attr != undefined) {
  62 + tElem.find("input").attr("ng-disabled", "true");
  63 + tElem.find("div").attr("ng-disabled", "true");
  64 + }
  65 +
  66 + return {
  67 + pre: function (scope, element, attr) {
  68 + // TODO:
  69 + },
  70 + /**
  71 + * 相当于link函数。
  72 + * @param scope
  73 + * @param element
  74 + * @param attr
  75 + */
  76 + post: function (scope, element, attr) {
  77 + // name属性
  78 + if ($name_attr) {
  79 + scope[ctrlAs]["$name_attr"] = $name_attr;
  80 + }
  81 +
  82 +
  83 + // 日期open属性,及方法
  84 + scope[ctrlAs].$$specialDateOpen = false;
  85 + scope[ctrlAs].$$specialDate_open = function() {
  86 + scope[ctrlAs].$$specialDateOpen = true;
  87 + };
  88 +
  89 + // 监控选择的日期
  90 + scope.$watch(
  91 + function() {
  92 + return scope[ctrlAs]['$$date_select'];
  93 + },
  94 + function(newValue, oldValue) {
  95 + if (newValue) {
  96 + //console.log("saDategroup--->selectdate:" + newValue);
  97 + // 调用内置filter,转换日期到yyyy-MM-dd格式
  98 + var text = $filter('date')(newValue, 'yyyy-MM-dd');
  99 + var i;
  100 + var isexist = false; // 日期是否已经选择标识
  101 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  102 + if (scope[ctrlAs]["$$data"][i].datestr == text) {
  103 + isexist = true;
  104 + break;
  105 + }
  106 + }
  107 + if (!isexist) {
  108 + scope[ctrlAs]["$$data"].push(
  109 + {
  110 + datestr: text,
  111 + ischecked: true
  112 + }
  113 + );
  114 + }
  115 +
  116 + }
  117 +
  118 + }
  119 + );
  120 +
  121 + /**
  122 + * 日期点击事件处理函数。
  123 + * @param $index 索引
  124 + */
  125 + scope[ctrlAs].$$internal_datestr_click = function($index) {
  126 + scope[ctrlAs].$$data.splice($index, 1);
  127 + };
  128 +
  129 + // 测试使用watch监控$$data的变化
  130 + scope.$watch(
  131 + function() {
  132 + return scope[ctrlAs]['$$data'];
  133 + },
  134 + function(newValue, oldValue) {
  135 + // 根据$$data生成对应的数据
  136 + var special_days_arr = [];
  137 + var i;
  138 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  139 + special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);
  140 + }
  141 +
  142 + scope[ctrlAs].$$internalmodel = special_days_arr.join(",");
  143 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  144 +
  145 + // 更新model
  146 + if ($dcname_attr) {
  147 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");
  148 + }
  149 + },
  150 + true
  151 + );
  152 +
  153 + // 监控dcvalue model值变换
  154 + attr.$observe("dcvalue", function(value) {
  155 + console.log("saDategroup 监控dc1 model值变换:" + value);
  156 + if (value) {
  157 + // 根据value值,修改$$data里的值
  158 + var date_array = value.split(",");
  159 + var i;
  160 + scope[ctrlAs]["$$data"] = [];
  161 + for (i = 0; i < date_array.length; i++) {
  162 + scope[ctrlAs]["$$data"].push(
  163 + {
  164 + datestr: date_array[i],
  165 + ischecked: true
  166 + }
  167 + );
  168 + }
  169 +
  170 +
  171 +
  172 +
  173 +
  174 +
  175 +
  176 +
  177 +
  178 + }
  179 + });
  180 +
  181 + }
  182 +
  183 + };
  184 + }
  185 + }
  186 + }
  187 +]);
  188 +
src/main/resources/static/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroup.js
1 -  
2 -  
3 -/**  
4 - * saEmployeegroup指令  
5 - * 属性如下:  
6 - * name(必须):控件的名字  
7 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
8 - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}  
9 - * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
10 - * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange  
11 - * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
12 - * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange  
13 - * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}  
14 - * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart  
15 - *  
16 - * required(可选):是否要用required验证  
17 - *  
18 - */  
19 -angular.module('ScheduleApp').directive('saEmployeegroup', [  
20 - 'EmployeeConfigService_g',  
21 - function(employeeConfigService_g) {  
22 - return {  
23 - restrict: 'E',  
24 - templateUrl: '/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroupTemplate.html',  
25 - scope: {  
26 - model: "=" // 独立作用域,关联外部的模型object  
27 - },  
28 - controllerAs: '$saEmployeegroupCtrl',  
29 - bindToController: true,  
30 - controller: function($scope) {  
31 - var self = this;  
32 - self.$$data = []; // 选择线路后,该线路的人员配置数据  
33 -  
34 - // 测试数据  
35 - //self.$$data = [  
36 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},  
37 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},  
38 - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}  
39 - //];  
40 -  
41 - self.$$dataSelected = []; // 选中的人员配置列表  
42 - self.$$dataSelectedStart = undefined; // 起始人员配置  
43 -  
44 - //self.$$dataSelected = [  
45 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},  
46 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},  
47 - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}  
48 - //];  
49 -  
50 - self.$$isFB = false; // 是否分班  
51 - self.$$dataFBSelected = []; // 选中的分班人员组配置列表  
52 - self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识  
53 - self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合  
54 -  
55 - //self.$$dataFBSelected = [  
56 - // {isstart: true, group: [  
57 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},  
58 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}  
59 - // ]},  
60 - // {isstart: false, group: [  
61 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},  
62 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}  
63 - // ]}  
64 - //];  
65 -  
66 - // saGuideboardgroup组件的ng-model,用于外部绑定等操作  
67 - self.$$internalmodel = undefined;  
68 -  
69 - self.$$data_init = false; // *数据源初始化标志  
70 - self.$$data_xl_first_init = false; // 线路是否初始化  
71 - self.$$data_ry_first_init = false; // 人员配置是否初始化  
72 - self.$$data_ry_first_data = undefined; // 人员配置初始化数据  
73 - self.$$data_rycid_first_init = false; // 人员配置id是否初始化  
74 - self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据  
75 - self.$$data_rystart_first_init = false; // 起始人员是否初始化  
76 - self.$$data_rystart_first_data = undefined; // 起始人员初始化数据  
77 -  
78 - },  
79 -  
80 - /**  
81 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
82 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
83 - * @param tElem  
84 - * @param tAttrs  
85 - * @returns {{pre: Function, post: Function}}  
86 - */  
87 - compile: function(tElem, tAttrs) {  
88 - // TODO:获取所有的属性  
89 - var $name_attr = tAttrs["name"]; // 控件的名字  
90 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
91 - var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名  
92 - var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名  
93 - var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名  
94 -  
95 - // controlAs名字  
96 - var ctrlAs = '$saEmployeegroupCtrl';  
97 -  
98 - // 如果有required属性,添加angularjs required验证  
99 - if ($required_attr != undefined) {  
100 - //console.log(tElem.html());  
101 - tElem.find("div").attr("required", "");  
102 - }  
103 -  
104 - return {  
105 - pre: function(scope, element, attr) {  
106 - // TODO:  
107 - },  
108 -  
109 - /**  
110 - * 相当于link函数。  
111 - * @param scope  
112 - * @param element  
113 - * @param attr  
114 - */  
115 - post: function(scope, element, attr) {  
116 - // name属性  
117 - if ($name_attr) {  
118 - scope[ctrlAs]["$name_attr"] = $name_attr;  
119 - }  
120 -  
121 - /**  
122 - * 人员配置列表点击(人员配置列表中选中路牌)  
123 - * @param $index  
124 - */  
125 - scope[ctrlAs].$$internal_rylist_click = function($index) {  
126 - var data_temp = scope[ctrlAs].$$data;  
127 - if (data_temp && data_temp.length > $index) {  
128 - if (!scope[ctrlAs].$$isFB) { // 不分班  
129 - scope[ctrlAs].$$dataSelected.push({  
130 - id : data_temp[$index].id,  
131 - dbbm: data_temp[$index].dbbm,  
132 - jsy: data_temp[$index].jsy,  
133 - spy: data_temp[$index].spy,  
134 - isstart: false  
135 - });  
136 -  
137 - // 如果没有指定过初始人员,默认选择此人员作为起始人员  
138 - if (scope[ctrlAs].$$dataSelectedStart == undefined) {  
139 - scope[ctrlAs].$$internal_selrylist_click(  
140 - scope[ctrlAs].$$dataSelected.length - 1);  
141 - }  
142 - } else { // 分班  
143 - if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员  
144 - scope[ctrlAs].$$dataFBSelected  
145 - [scope[ctrlAs].$$dataFBInternalSelected.gindex].group  
146 - [scope[ctrlAs].$$dataFBInternalSelected.index] = {  
147 - id : data_temp[$index].id,  
148 - dbbm: data_temp[$index].dbbm,  
149 - jsy: data_temp[$index].jsy,  
150 - spy: data_temp[$index].spy,  
151 - isselected: true  
152 - };  
153 -  
154 - } else {  
155 - scope[ctrlAs].$$dataFBSelected.push({  
156 - isstart: false,  
157 - group: [].concat(  
158 - {  
159 - id : data_temp[$index].id,  
160 - dbbm: data_temp[$index].dbbm,  
161 - jsy: data_temp[$index].jsy,  
162 - spy: data_temp[$index].spy,  
163 - isselected: false  
164 - }, {  
165 - id : data_temp[$index].id,  
166 - dbbm: data_temp[$index].dbbm,  
167 - jsy: data_temp[$index].jsy,  
168 - spy: data_temp[$index].spy,  
169 - isselected: false  
170 - }  
171 - )  
172 - });  
173 - if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {  
174 - scope[ctrlAs].$$internal_selrygrouplist_click(  
175 - scope[ctrlAs].$$dataFBSelected.length - 1);  
176 - }  
177 - }  
178 - }  
179 -  
180 - }  
181 - };  
182 -  
183 - /**  
184 - * 选中的人员单击(初始人员选择)  
185 - * @param $index  
186 - */  
187 - scope[ctrlAs].$$internal_selrylist_click = function($index) {  
188 - var data_temp = scope[ctrlAs].$$dataSelected;  
189 - if (data_temp && data_temp.length > $index) {  
190 - for (var i = 0; i < data_temp.length; i++) {  
191 - data_temp[i].isstart = false;  
192 - }  
193 - data_temp[$index].isstart = true;  
194 - scope[ctrlAs].$$dataSelectedStart = $index;  
195 - }  
196 - };  
197 - /**  
198 - * 选中的人员双击(删除选中的人员)  
199 - * @param $index  
200 - */  
201 - scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {  
202 - var data_temp = scope[ctrlAs].$$dataSelected;  
203 - if (data_temp && data_temp.length > $index) {  
204 - if (scope[ctrlAs].$$dataSelectedStart == $index) {  
205 - scope[ctrlAs].$$dataSelectedStart = undefined;  
206 - }  
207 - data_temp.splice($index, 1);  
208 - }  
209 - };  
210 -  
211 - /**  
212 - * 选中的分班组人员单击(初始人员选择)  
213 - * @param $index  
214 - */  
215 - scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {  
216 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
217 - if (data_temp && data_temp.length > $index) {  
218 - for (var i = 0; i < data_temp.length; i++) {  
219 - data_temp[i].isstart = false;  
220 - for (var j = 0; j < data_temp[i].group.length; j++) {  
221 - data_temp[i].group[j].isselected = false;  
222 - }  
223 - }  
224 - data_temp[$index].isstart = true;  
225 - scope[ctrlAs].$$dataFBSelectedStart = $index;  
226 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
227 - }  
228 - };  
229 - /**  
230 - * 分组内部单击(选中分班中的某组人员)  
231 - * @param $groupindex 组index  
232 - * @param $index 组内部某个index  
233 - * @param $event 事件防止冒泡  
234 - */  
235 - scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {  
236 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
237 - if (data_temp && data_temp.length > $groupindex) {  
238 - if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {  
239 - // $$dataFBInternalSelected的格式如下:  
240 - //{gindex: 1, index: 0}  
241 - for (var i = 0; i < data_temp.length; i++) {  
242 - data_temp[i].isstart = false;  
243 - for (var j = 0; j < data_temp[i].group.length; j++) {  
244 - data_temp[i].group[j].isselected = false;  
245 - }  
246 - }  
247 - data_temp[$groupindex].group[$index].isselected = true;  
248 - scope[ctrlAs].$$dataFBInternalSelected = {  
249 - gindex: $groupindex, index: $index  
250 - };  
251 - scope[ctrlAs].$$dataFBSelectedStart = undefined;  
252 - $event.stopPropagation();  
253 - }  
254 - }  
255 -  
256 - };  
257 - /**  
258 - * 选中的分班人员双击(删除选中的人员)  
259 - * @param $index  
260 - */  
261 - scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {  
262 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
263 - if (data_temp && data_temp.length > $index) {  
264 - if (scope[ctrlAs].$$dataFBSelectedStart == $index) {  
265 - scope[ctrlAs].$$dataFBSelectedStart = undefined;  
266 - }  
267 - if (scope[ctrlAs].$$dataFBInternalSelected &&  
268 - scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {  
269 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
270 - }  
271 - data_temp.splice($index, 1);  
272 - }  
273 - };  
274 -  
275 - /**  
276 - * 验证内部数据,更新外部model  
277 - */  
278 - scope[ctrlAs].$$internal_validate_model = function() {  
279 - var data_temp = scope[ctrlAs].$$dataSelected;  
280 - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;  
281 - var data_temp3 = scope[ctrlAs].$$dataFBSelected;  
282 - var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;  
283 - var ryDbbms = [];  
284 - var ryDbbm_group = [];  
285 - var ryCids = [];  
286 - var ryCid_group = [];  
287 - var ryStart = 0;  
288 - var i = 0;  
289 - var j = 0;  
290 -  
291 - var isFB = scope[ctrlAs].$$isFB;  
292 -  
293 - if (isFB) {  
294 - if (data_temp3 &&  
295 - data_temp3.length > 0 &&  
296 - data_temp4 != undefined) {  
297 -  
298 - for (i = 0; i < data_temp3.length; i++) {  
299 - for (j = 0; j < data_temp3[i].group.length; j++) {  
300 - ryDbbm_group.push(data_temp3[i].group[j].dbbm);  
301 - ryCid_group.push(data_temp3[i].group[j].id);  
302 - }  
303 - ryDbbms.push(ryDbbm_group.join("-"));  
304 - ryCids.push(ryCid_group.join("-"));  
305 - ryDbbm_group = [];  
306 - ryCid_group = [];  
307 - }  
308 -  
309 - data_temp3[data_temp4].isstart = true;  
310 - ryStart = data_temp4 + 1;  
311 -  
312 - // 更新内部model,用于外部验证  
313 - // 内部model的值暂时随意,以后再改  
314 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
315 -  
316 - // 更新外部model字段  
317 - if ($dbbmrangename_attr) {  
318 - console.log("dbbmrangename=" + ryDbbms.join(','));  
319 - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");  
320 - }  
321 - if (rycidrangename_attr) {  
322 - console.log("rycidrangename=" + ryCids.join(','));  
323 - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");  
324 - }  
325 - if ($rystartname_attr) {  
326 - console.log("rystartname=" + ryStart);  
327 - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");  
328 - }  
329 -  
330 - } else {  
331 - scope[ctrlAs].$$internalmodel = undefined;  
332 - }  
333 -  
334 - } else {  
335 - if (data_temp &&  
336 - data_temp.length > 0 &&  
337 - data_temp2 != undefined) {  
338 -  
339 - for (i = 0; i < data_temp.length; i++) {  
340 - ryDbbms.push(data_temp[i].dbbm);  
341 - ryCids.push(data_temp[i].id);  
342 - }  
343 - data_temp[data_temp2].isstart = true;  
344 - ryStart = data_temp2 + 1;  
345 -  
346 - // 更新内部model,用于外部验证  
347 - // 内部model的值暂时随意,以后再改  
348 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
349 -  
350 - // 更新外部model字段  
351 - if ($dbbmrangename_attr) {  
352 - console.log("dbbmrangename=" + ryDbbms.join(','));  
353 - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");  
354 - }  
355 - if (rycidrangename_attr) {  
356 - console.log("rycidrangename=" + ryCids.join(','));  
357 - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");  
358 - }  
359 - if ($rystartname_attr) {  
360 - console.log("rystartname=" + ryStart);  
361 - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");  
362 - }  
363 -  
364 - } else {  
365 - scope[ctrlAs].$$internalmodel = undefined;  
366 - }  
367 - }  
368 -  
369 - };  
370 -  
371 - // 监控内部数据,$$dataSelected 变化  
372 - scope.$watch(  
373 - function() {  
374 - return scope[ctrlAs].$$dataSelected;  
375 - },  
376 - function(newValue, oldValue) {  
377 - scope[ctrlAs].$$internal_validate_model();  
378 - },  
379 - true  
380 - );  
381 -  
382 - // 监控内部数据,$$dataSelectedStart 变化  
383 - scope.$watch(  
384 - function() {  
385 - return scope[ctrlAs].$$dataSelectedStart;  
386 - },  
387 - function(newValue, oldValue) {  
388 - scope[ctrlAs].$$internal_validate_model();  
389 - },  
390 - true  
391 - );  
392 -  
393 -  
394 - // 监控内部数据,$$dataFBSelected 变化  
395 - scope.$watch(  
396 - function() {  
397 - return scope[ctrlAs].$$dataFBSelected;  
398 - },  
399 - function(newValue, oldValue) {  
400 - scope[ctrlAs].$$internal_validate_model();  
401 - },  
402 - true  
403 - );  
404 -  
405 - // 监控内部数据,$$dataFBSelectedStart 变化  
406 - scope.$watch(  
407 - function() {  
408 - return scope[ctrlAs].$$dataFBSelectedStart;  
409 - },  
410 - function(newValue, oldValue) {  
411 - scope[ctrlAs].$$internal_validate_model();  
412 - },  
413 - true  
414 - );  
415 -  
416 - // 监控内部数据,$$dataFBInternalSelected 变化  
417 - scope.$watch(  
418 - function() {  
419 - return scope[ctrlAs].$$dataFBInternalSelected;  
420 - },  
421 - function(newValue, oldValue) {  
422 - scope[ctrlAs].$$internal_validate_model();  
423 - },  
424 - true  
425 - );  
426 -  
427 - // 监控内部数据,$$isFB 变化  
428 - scope.$watch(  
429 - function() {  
430 - return scope[ctrlAs].$$isFB;  
431 - },  
432 - function(newValue, oldValue) {  
433 - scope[ctrlAs].$$internal_validate_model();  
434 - },  
435 - true  
436 - );  
437 -  
438 - /**  
439 - * 验证数据是否初始化完成,  
440 - * 所谓的初始化就是内部所有的数据被有效设定过一次。  
441 - */  
442 - scope[ctrlAs].$$internal_validate_init = function() {  
443 - var self = scope[ctrlAs];  
444 - var data_temp = self.$$data;  
445 - var dataSelect_temp = self.$$dataSelected;  
446 - var dataFBSelect_temp = self.$$dataFBSelected;  
447 - var dbbmnames = null;  
448 - var dbbmnamegroup = null;  
449 - var rycids = null;  
450 - var rycidgroup = null;  
451 -  
452 - var i = 0;  
453 - var j = 0;  
454 - var k = 0;  
455 -  
456 - if (self.$$data_xl_first_init &&  
457 - self.$$data_ry_first_init &&  
458 - self.$$data_rycid_first_init &&  
459 - self.$$data_rystart_first_init && !self.$$data_init) {  
460 - console.log("开始初始化数据");  
461 -  
462 - // 判定是否分班,字符串中包含-就是了  
463 - if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班  
464 - self.$$isFB = true;  
465 -  
466 - // 搭班编码、人员配置id  
467 - dbbmnames = self.$$data_ry_first_data.split(",");  
468 - rycids = self.$$data_rycid_first_data.split(",");  
469 - for (i = 0; i < dbbmnames.length; i++) {  
470 - dataFBSelect_temp.push({  
471 - group: [],  
472 - isstart: false  
473 - });  
474 - dbbmnamegroup = dbbmnames[i].split("-");  
475 - rycidgroup = rycids[i].split("-");  
476 -  
477 - for (k = 0; k < dbbmnamegroup.length; k++) {  
478 - dataFBSelect_temp[i].group.push({  
479 - id: rycidgroup[k],  
480 - dbbm: dbbmnamegroup[k],  
481 - isselected: false  
482 - });  
483 -  
484 - for (j = 0; j < data_temp.length; j++) {  
485 - if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {  
486 - dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;  
487 - dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;  
488 - break;  
489 - }  
490 - }  
491 - }  
492 -  
493 - }  
494 -  
495 - // 初始人员  
496 - scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;  
497 -  
498 -  
499 - } else if (dataSelect_temp.length == 0) {  
500 - self.$$isFB = false;  
501 -  
502 - // 搭班编码、人员配置id  
503 - dbbmnames = self.$$data_ry_first_data.split(",");  
504 - rycids = self.$$data_rycid_first_data.split(",");  
505 - for (i = 0; i < dbbmnames.length; i++) {  
506 - dataSelect_temp.push({  
507 - id: rycids[i],  
508 - dbbm: dbbmnames[i],  
509 - isstart: false  
510 - });  
511 - for (j = 0; j < data_temp.length; j++) {  
512 - if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {  
513 - dataSelect_temp[i].jsy = data_temp[j].jsy;  
514 - dataSelect_temp[i].spy = data_temp[j].spy;  
515 - break;  
516 - }  
517 - }  
518 - }  
519 - // 初始人员  
520 - scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1;  
521 -  
522 - }  
523 -  
524 - console.log("数据初始化完毕!");  
525 - self.$$data_init = true;  
526 - }  
527 -  
528 - };  
529 -  
530 - // 监控初始化标志,线路,人员,起始人员  
531 - scope.$watch(  
532 - function() {  
533 - return scope[ctrlAs].$$data_xl_first_init;  
534 - },  
535 - function(newValue, oldValue) {  
536 - scope[ctrlAs].$$internal_validate_init();  
537 - }  
538 - );  
539 - scope.$watch(  
540 - function() {  
541 - return scope[ctrlAs].$$data_ry_first_init;  
542 - },  
543 - function(newValue, oldValue) {  
544 - scope[ctrlAs].$$internal_validate_init();  
545 - }  
546 - );  
547 - scope.$watch(  
548 - function() {  
549 - return scope[ctrlAs].$$data_rycid_first_init;  
550 - },  
551 - function(newValue, oldValue) {  
552 - scope[ctrlAs].$$internal_validate_init();  
553 - }  
554 - );  
555 - scope.$watch(  
556 - function() {  
557 - return scope[ctrlAs].$$data_rystart_first_init;  
558 - },  
559 - function(newValue, oldValue) {  
560 - scope[ctrlAs].$$internal_validate_init();  
561 - }  
562 - );  
563 -  
564 -  
565 - // 监控线路id的变化  
566 - attr.$observe("xlidvalue", function(value) {  
567 - if (value && value != "") {  
568 - console.log("xlidvalue=" + value);  
569 -  
570 - employeeConfigService_g.rest.list(  
571 - {"xl.id_eq": value, "isCancel_eq" : false, size: 100},  
572 - function(result) {  
573 - // 获取值了  
574 - console.log("人员配置获取了");  
575 -  
576 - scope[ctrlAs].$$data = [];  
577 - for (var i = 0; i < result.content.length; i++) {  
578 - scope[ctrlAs].$$data.push({  
579 - id: result.content[i].id,  
580 - dbbm: result.content[i].dbbm,  
581 - jsy: result.content[i].jsy.personnelName,  
582 - spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName  
583 - });  
584 - }  
585 - if (scope[ctrlAs].$$data_init) {  
586 - scope[ctrlAs].$$dataSelected = [];  
587 - scope[ctrlAs].$$dataSelectedStart = undefined;  
588 -  
589 - scope[ctrlAs].$$dataFBSelected = [];  
590 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
591 - scope[ctrlAs].$$dataFBSelectedStart = undefined;  
592 -  
593 - scope[ctrlAs].$$internalmodel = undefined;  
594 - }  
595 - scope[ctrlAs].$$data_xl_first_init = true;  
596 - },  
597 - function(result) {  
598 -  
599 - }  
600 - );  
601 -  
602 - }  
603 - });  
604 -  
605 - // 监控搭班编码范围值的变化  
606 - attr.$observe("dbbmrangevalue", function(value) {  
607 - if (value && value != "") {  
608 - console.log("dbbmrangevalue变换了");  
609 - scope[ctrlAs].$$data_ry_first_init = true;  
610 - scope[ctrlAs].$$data_ry_first_data = value;  
611 - }  
612 - });  
613 -  
614 - // 监控人员配置id范围值的变化  
615 - attr.$observe("rycidrangevalue", function(value) {  
616 - if (value && value != "") {  
617 - console.log("rycidrangevalue变换了");  
618 - scope[ctrlAs].$$data_rycid_first_init = true;  
619 - scope[ctrlAs].$$data_rycid_first_data = value;  
620 - }  
621 - });  
622 -  
623 - // 监控起始人员的变化  
624 - attr.$observe("rystartvalue", function(value) {  
625 - if (value && value != "") {  
626 - console.log("rystartvalue变换了");  
627 - scope[ctrlAs].$$data_rystart_first_init = true;  
628 - scope[ctrlAs].$$data_rystart_first_data = value;  
629 - }  
630 - });  
631 -  
632 - }  
633 - }  
634 -  
635 - }  
636 - }  
637 - }  
638 -]);  
639 - 1 +
  2 +
  3 +/**
  4 + * saEmployeegroup指令
  5 + * 属性如下:
  6 + * name(必须):控件的名字
  7 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  8 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  9 + * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  10 + * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange
  11 + * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  12 + * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange
  13 + * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  14 + * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart
  15 + *
  16 + * required(可选):是否要用required验证
  17 + *
  18 + */
  19 +angular.module('ScheduleApp').directive('saEmployeegroup', [
  20 + 'EmployeeConfigService_g',
  21 + function(employeeConfigService_g) {
  22 + return {
  23 + restrict: 'E',
  24 + templateUrl: '/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroupTemplate.html',
  25 + scope: {
  26 + model: "=" // 独立作用域,关联外部的模型object
  27 + },
  28 + controllerAs: '$saEmployeegroupCtrl',
  29 + bindToController: true,
  30 + controller: function($scope) {
  31 + var self = this;
  32 + self.$$data = []; // 选择线路后,该线路的人员配置数据
  33 +
  34 + // 测试数据
  35 + //self.$$data = [
  36 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},
  37 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},
  38 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}
  39 + //];
  40 +
  41 + self.$$dataSelected = []; // 选中的人员配置列表
  42 + self.$$dataSelectedStart = undefined; // 起始人员配置
  43 +
  44 + //self.$$dataSelected = [
  45 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},
  46 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},
  47 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}
  48 + //];
  49 +
  50 + self.$$isFB = false; // 是否分班
  51 + self.$$dataFBSelected = []; // 选中的分班人员组配置列表
  52 + self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识
  53 + self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合
  54 +
  55 + //self.$$dataFBSelected = [
  56 + // {isstart: true, group: [
  57 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  58 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  59 + // ]},
  60 + // {isstart: false, group: [
  61 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  62 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  63 + // ]}
  64 + //];
  65 +
  66 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  67 + self.$$internalmodel = undefined;
  68 +
  69 + self.$$data_init = false; // *数据源初始化标志
  70 + self.$$data_xl_first_init = false; // 线路是否初始化
  71 + self.$$data_ry_first_init = false; // 人员配置是否初始化
  72 + self.$$data_ry_first_data = undefined; // 人员配置初始化数据
  73 + self.$$data_rycid_first_init = false; // 人员配置id是否初始化
  74 + self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据
  75 + self.$$data_rystart_first_init = false; // 起始人员是否初始化
  76 + self.$$data_rystart_first_data = undefined; // 起始人员初始化数据
  77 +
  78 + },
  79 +
  80 + /**
  81 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  82 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  83 + * @param tElem
  84 + * @param tAttrs
  85 + * @returns {{pre: Function, post: Function}}
  86 + */
  87 + compile: function(tElem, tAttrs) {
  88 + // TODO:获取所有的属性
  89 + var $name_attr = tAttrs["name"]; // 控件的名字
  90 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  91 + var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名
  92 + var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名
  93 + var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名
  94 +
  95 + // controlAs名字
  96 + var ctrlAs = '$saEmployeegroupCtrl';
  97 +
  98 + // 如果有required属性,添加angularjs required验证
  99 + if ($required_attr != undefined) {
  100 + //console.log(tElem.html());
  101 + tElem.find("div").attr("required", "");
  102 + }
  103 +
  104 + return {
  105 + pre: function(scope, element, attr) {
  106 + // TODO:
  107 + },
  108 +
  109 + /**
  110 + * 相当于link函数。
  111 + * @param scope
  112 + * @param element
  113 + * @param attr
  114 + */
  115 + post: function(scope, element, attr) {
  116 + // name属性
  117 + if ($name_attr) {
  118 + scope[ctrlAs]["$name_attr"] = $name_attr;
  119 + }
  120 +
  121 + /**
  122 + * 人员配置列表点击(人员配置列表中选中路牌)
  123 + * @param $index
  124 + */
  125 + scope[ctrlAs].$$internal_rylist_click = function($index) {
  126 + var data_temp = scope[ctrlAs].$$data;
  127 + if (data_temp && data_temp.length > $index) {
  128 + if (!scope[ctrlAs].$$isFB) { // 不分班
  129 + scope[ctrlAs].$$dataSelected.push({
  130 + id : data_temp[$index].id,
  131 + dbbm: data_temp[$index].dbbm,
  132 + jsy: data_temp[$index].jsy,
  133 + spy: data_temp[$index].spy,
  134 + isstart: false
  135 + });
  136 +
  137 + // 如果没有指定过初始人员,默认选择此人员作为起始人员
  138 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  139 + scope[ctrlAs].$$internal_selrylist_click(
  140 + scope[ctrlAs].$$dataSelected.length - 1);
  141 + }
  142 + } else { // 分班
  143 + if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员
  144 + scope[ctrlAs].$$dataFBSelected
  145 + [scope[ctrlAs].$$dataFBInternalSelected.gindex].group
  146 + [scope[ctrlAs].$$dataFBInternalSelected.index] = {
  147 + id : data_temp[$index].id,
  148 + dbbm: data_temp[$index].dbbm,
  149 + jsy: data_temp[$index].jsy,
  150 + spy: data_temp[$index].spy,
  151 + isselected: true
  152 + };
  153 +
  154 + } else {
  155 + scope[ctrlAs].$$dataFBSelected.push({
  156 + isstart: false,
  157 + group: [].concat(
  158 + {
  159 + id : data_temp[$index].id,
  160 + dbbm: data_temp[$index].dbbm,
  161 + jsy: data_temp[$index].jsy,
  162 + spy: data_temp[$index].spy,
  163 + isselected: false
  164 + }, {
  165 + id : data_temp[$index].id,
  166 + dbbm: data_temp[$index].dbbm,
  167 + jsy: data_temp[$index].jsy,
  168 + spy: data_temp[$index].spy,
  169 + isselected: false
  170 + }
  171 + )
  172 + });
  173 + if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {
  174 + scope[ctrlAs].$$internal_selrygrouplist_click(
  175 + scope[ctrlAs].$$dataFBSelected.length - 1);
  176 + }
  177 + }
  178 + }
  179 +
  180 + }
  181 + };
  182 +
  183 + /**
  184 + * 选中的人员单击(初始人员选择)
  185 + * @param $index
  186 + */
  187 + scope[ctrlAs].$$internal_selrylist_click = function($index) {
  188 + var data_temp = scope[ctrlAs].$$dataSelected;
  189 + if (data_temp && data_temp.length > $index) {
  190 + for (var i = 0; i < data_temp.length; i++) {
  191 + data_temp[i].isstart = false;
  192 + }
  193 + data_temp[$index].isstart = true;
  194 + scope[ctrlAs].$$dataSelectedStart = $index;
  195 + }
  196 + };
  197 + /**
  198 + * 选中的人员双击(删除选中的人员)
  199 + * @param $index
  200 + */
  201 + scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {
  202 + var data_temp = scope[ctrlAs].$$dataSelected;
  203 + if (data_temp && data_temp.length > $index) {
  204 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  205 + scope[ctrlAs].$$dataSelectedStart = undefined;
  206 + }
  207 + data_temp.splice($index, 1);
  208 + }
  209 + };
  210 +
  211 + /**
  212 + * 选中的分班组人员单击(初始人员选择)
  213 + * @param $index
  214 + */
  215 + scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {
  216 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  217 + if (data_temp && data_temp.length > $index) {
  218 + for (var i = 0; i < data_temp.length; i++) {
  219 + data_temp[i].isstart = false;
  220 + for (var j = 0; j < data_temp[i].group.length; j++) {
  221 + data_temp[i].group[j].isselected = false;
  222 + }
  223 + }
  224 + data_temp[$index].isstart = true;
  225 + scope[ctrlAs].$$dataFBSelectedStart = $index;
  226 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  227 + }
  228 + };
  229 + /**
  230 + * 分组内部单击(选中分班中的某组人员)
  231 + * @param $groupindex 组index
  232 + * @param $index 组内部某个index
  233 + * @param $event 事件防止冒泡
  234 + */
  235 + scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {
  236 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  237 + if (data_temp && data_temp.length > $groupindex) {
  238 + if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {
  239 + // $$dataFBInternalSelected的格式如下:
  240 + //{gindex: 1, index: 0}
  241 + for (var i = 0; i < data_temp.length; i++) {
  242 + data_temp[i].isstart = false;
  243 + for (var j = 0; j < data_temp[i].group.length; j++) {
  244 + data_temp[i].group[j].isselected = false;
  245 + }
  246 + }
  247 + data_temp[$groupindex].group[$index].isselected = true;
  248 + scope[ctrlAs].$$dataFBInternalSelected = {
  249 + gindex: $groupindex, index: $index
  250 + };
  251 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  252 + $event.stopPropagation();
  253 + }
  254 + }
  255 +
  256 + };
  257 + /**
  258 + * 选中的分班人员双击(删除选中的人员)
  259 + * @param $index
  260 + */
  261 + scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {
  262 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  263 + if (data_temp && data_temp.length > $index) {
  264 + if (scope[ctrlAs].$$dataFBSelectedStart == $index) {
  265 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  266 + }
  267 + if (scope[ctrlAs].$$dataFBInternalSelected &&
  268 + scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {
  269 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  270 + }
  271 + data_temp.splice($index, 1);
  272 + }
  273 + };
  274 +
  275 + /**
  276 + * 验证内部数据,更新外部model
  277 + */
  278 + scope[ctrlAs].$$internal_validate_model = function() {
  279 + var data_temp = scope[ctrlAs].$$dataSelected;
  280 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  281 + var data_temp3 = scope[ctrlAs].$$dataFBSelected;
  282 + var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;
  283 + var ryDbbms = [];
  284 + var ryDbbm_group = [];
  285 + var ryCids = [];
  286 + var ryCid_group = [];
  287 + var ryStart = 0;
  288 + var i = 0;
  289 + var j = 0;
  290 +
  291 + var isFB = scope[ctrlAs].$$isFB;
  292 +
  293 + if (isFB) {
  294 + if (data_temp3 &&
  295 + data_temp3.length > 0 &&
  296 + data_temp4 != undefined) {
  297 +
  298 + for (i = 0; i < data_temp3.length; i++) {
  299 + for (j = 0; j < data_temp3[i].group.length; j++) {
  300 + ryDbbm_group.push(data_temp3[i].group[j].dbbm);
  301 + ryCid_group.push(data_temp3[i].group[j].id);
  302 + }
  303 + ryDbbms.push(ryDbbm_group.join("-"));
  304 + ryCids.push(ryCid_group.join("-"));
  305 + ryDbbm_group = [];
  306 + ryCid_group = [];
  307 + }
  308 +
  309 + data_temp3[data_temp4].isstart = true;
  310 + ryStart = data_temp4 + 1;
  311 +
  312 + // 更新内部model,用于外部验证
  313 + // 内部model的值暂时随意,以后再改
  314 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  315 +
  316 + // 更新外部model字段
  317 + if ($dbbmrangename_attr) {
  318 + console.log("dbbmrangename=" + ryDbbms.join(','));
  319 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  320 + }
  321 + if (rycidrangename_attr) {
  322 + console.log("rycidrangename=" + ryCids.join(','));
  323 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  324 + }
  325 + if ($rystartname_attr) {
  326 + console.log("rystartname=" + ryStart);
  327 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  328 + }
  329 +
  330 + } else {
  331 + scope[ctrlAs].$$internalmodel = undefined;
  332 + }
  333 +
  334 + } else {
  335 + if (data_temp &&
  336 + data_temp.length > 0 &&
  337 + data_temp2 != undefined) {
  338 +
  339 + for (i = 0; i < data_temp.length; i++) {
  340 + ryDbbms.push(data_temp[i].dbbm);
  341 + ryCids.push(data_temp[i].id);
  342 + }
  343 + data_temp[data_temp2].isstart = true;
  344 + ryStart = data_temp2 + 1;
  345 +
  346 + // 更新内部model,用于外部验证
  347 + // 内部model的值暂时随意,以后再改
  348 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  349 +
  350 + // 更新外部model字段
  351 + if ($dbbmrangename_attr) {
  352 + console.log("dbbmrangename=" + ryDbbms.join(','));
  353 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  354 + }
  355 + if (rycidrangename_attr) {
  356 + console.log("rycidrangename=" + ryCids.join(','));
  357 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  358 + }
  359 + if ($rystartname_attr) {
  360 + console.log("rystartname=" + ryStart);
  361 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  362 + }
  363 +
  364 + } else {
  365 + scope[ctrlAs].$$internalmodel = undefined;
  366 + }
  367 + }
  368 +
  369 + };
  370 +
  371 + // 监控内部数据,$$dataSelected 变化
  372 + scope.$watch(
  373 + function() {
  374 + return scope[ctrlAs].$$dataSelected;
  375 + },
  376 + function(newValue, oldValue) {
  377 + scope[ctrlAs].$$internal_validate_model();
  378 + },
  379 + true
  380 + );
  381 +
  382 + // 监控内部数据,$$dataSelectedStart 变化
  383 + scope.$watch(
  384 + function() {
  385 + return scope[ctrlAs].$$dataSelectedStart;
  386 + },
  387 + function(newValue, oldValue) {
  388 + scope[ctrlAs].$$internal_validate_model();
  389 + },
  390 + true
  391 + );
  392 +
  393 +
  394 + // 监控内部数据,$$dataFBSelected 变化
  395 + scope.$watch(
  396 + function() {
  397 + return scope[ctrlAs].$$dataFBSelected;
  398 + },
  399 + function(newValue, oldValue) {
  400 + scope[ctrlAs].$$internal_validate_model();
  401 + },
  402 + true
  403 + );
  404 +
  405 + // 监控内部数据,$$dataFBSelectedStart 变化
  406 + scope.$watch(
  407 + function() {
  408 + return scope[ctrlAs].$$dataFBSelectedStart;
  409 + },
  410 + function(newValue, oldValue) {
  411 + scope[ctrlAs].$$internal_validate_model();
  412 + },
  413 + true
  414 + );
  415 +
  416 + // 监控内部数据,$$dataFBInternalSelected 变化
  417 + scope.$watch(
  418 + function() {
  419 + return scope[ctrlAs].$$dataFBInternalSelected;
  420 + },
  421 + function(newValue, oldValue) {
  422 + scope[ctrlAs].$$internal_validate_model();
  423 + },
  424 + true
  425 + );
  426 +
  427 + // 监控内部数据,$$isFB 变化
  428 + scope.$watch(
  429 + function() {
  430 + return scope[ctrlAs].$$isFB;
  431 + },
  432 + function(newValue, oldValue) {
  433 + scope[ctrlAs].$$internal_validate_model();
  434 + },
  435 + true
  436 + );
  437 +
  438 + /**
  439 + * 验证数据是否初始化完成,
  440 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  441 + */
  442 + scope[ctrlAs].$$internal_validate_init = function() {
  443 + var self = scope[ctrlAs];
  444 + var data_temp = self.$$data;
  445 + var dataSelect_temp = self.$$dataSelected;
  446 + var dataFBSelect_temp = self.$$dataFBSelected;
  447 + var dbbmnames = null;
  448 + var dbbmnamegroup = null;
  449 + var rycids = null;
  450 + var rycidgroup = null;
  451 +
  452 + var i = 0;
  453 + var j = 0;
  454 + var k = 0;
  455 +
  456 + if (self.$$data_xl_first_init &&
  457 + self.$$data_ry_first_init &&
  458 + self.$$data_rycid_first_init &&
  459 + self.$$data_rystart_first_init && !self.$$data_init) {
  460 + console.log("开始初始化数据");
  461 +
  462 + // 判定是否分班,字符串中包含-就是了
  463 + if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班
  464 + self.$$isFB = true;
  465 +
  466 + // 搭班编码、人员配置id
  467 + dbbmnames = self.$$data_ry_first_data.split(",");
  468 + rycids = self.$$data_rycid_first_data.split(",");
  469 + for (i = 0; i < dbbmnames.length; i++) {
  470 + dataFBSelect_temp.push({
  471 + group: [],
  472 + isstart: false
  473 + });
  474 + dbbmnamegroup = dbbmnames[i].split("-");
  475 + rycidgroup = rycids[i].split("-");
  476 +
  477 + for (k = 0; k < dbbmnamegroup.length; k++) {
  478 + dataFBSelect_temp[i].group.push({
  479 + id: rycidgroup[k],
  480 + dbbm: dbbmnamegroup[k],
  481 + isselected: false
  482 + });
  483 +
  484 + for (j = 0; j < data_temp.length; j++) {
  485 + if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {
  486 + dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;
  487 + dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;
  488 + break;
  489 + }
  490 + }
  491 + }
  492 +
  493 + }
  494 +
  495 + // 初始人员
  496 + scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;
  497 +
  498 +
  499 + } else if (dataSelect_temp.length == 0) {
  500 + self.$$isFB = false;
  501 +
  502 + // 搭班编码、人员配置id
  503 + dbbmnames = self.$$data_ry_first_data.split(",");
  504 + rycids = self.$$data_rycid_first_data.split(",");
  505 + for (i = 0; i < dbbmnames.length; i++) {
  506 + dataSelect_temp.push({
  507 + id: rycids[i],
  508 + dbbm: dbbmnames[i],
  509 + isstart: false
  510 + });
  511 + for (j = 0; j < data_temp.length; j++) {
  512 + if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {
  513 + dataSelect_temp[i].jsy = data_temp[j].jsy;
  514 + dataSelect_temp[i].spy = data_temp[j].spy;
  515 + break;
  516 + }
  517 + }
  518 + }
  519 + // 初始人员
  520 + scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1;
  521 +
  522 + }
  523 +
  524 + console.log("数据初始化完毕!");
  525 + self.$$data_init = true;
  526 + }
  527 +
  528 + };
  529 +
  530 + // 监控初始化标志,线路,人员,起始人员
  531 + scope.$watch(
  532 + function() {
  533 + return scope[ctrlAs].$$data_xl_first_init;
  534 + },
  535 + function(newValue, oldValue) {
  536 + scope[ctrlAs].$$internal_validate_init();
  537 + }
  538 + );
  539 + scope.$watch(
  540 + function() {
  541 + return scope[ctrlAs].$$data_ry_first_init;
  542 + },
  543 + function(newValue, oldValue) {
  544 + scope[ctrlAs].$$internal_validate_init();
  545 + }
  546 + );
  547 + scope.$watch(
  548 + function() {
  549 + return scope[ctrlAs].$$data_rycid_first_init;
  550 + },
  551 + function(newValue, oldValue) {
  552 + scope[ctrlAs].$$internal_validate_init();
  553 + }
  554 + );
  555 + scope.$watch(
  556 + function() {
  557 + return scope[ctrlAs].$$data_rystart_first_init;
  558 + },
  559 + function(newValue, oldValue) {
  560 + scope[ctrlAs].$$internal_validate_init();
  561 + }
  562 + );
  563 +
  564 +
  565 + // 监控线路id的变化
  566 + attr.$observe("xlidvalue", function(value) {
  567 + if (value && value != "") {
  568 + console.log("xlidvalue=" + value);
  569 +
  570 + employeeConfigService_g.rest.list(
  571 + {"xl.id_eq": value, "isCancel_eq" : false, size: 100},
  572 + function(result) {
  573 + // 获取值了
  574 + console.log("人员配置获取了");
  575 +
  576 + scope[ctrlAs].$$data = [];
  577 + for (var i = 0; i < result.content.length; i++) {
  578 + scope[ctrlAs].$$data.push({
  579 + id: result.content[i].id,
  580 + dbbm: result.content[i].dbbm,
  581 + jsy: result.content[i].jsy.personnelName,
  582 + spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName
  583 + });
  584 + }
  585 + if (scope[ctrlAs].$$data_init) {
  586 + scope[ctrlAs].$$dataSelected = [];
  587 + scope[ctrlAs].$$dataSelectedStart = undefined;
  588 +
  589 + scope[ctrlAs].$$dataFBSelected = [];
  590 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  591 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  592 +
  593 + scope[ctrlAs].$$internalmodel = undefined;
  594 + }
  595 + scope[ctrlAs].$$data_xl_first_init = true;
  596 + },
  597 + function(result) {
  598 +
  599 + }
  600 + );
  601 +
  602 + }
  603 + });
  604 +
  605 + // 监控搭班编码范围值的变化
  606 + attr.$observe("dbbmrangevalue", function(value) {
  607 + if (value && value != "") {
  608 + console.log("dbbmrangevalue变换了");
  609 + scope[ctrlAs].$$data_ry_first_init = true;
  610 + scope[ctrlAs].$$data_ry_first_data = value;
  611 + }
  612 + });
  613 +
  614 + // 监控人员配置id范围值的变化
  615 + attr.$observe("rycidrangevalue", function(value) {
  616 + if (value && value != "") {
  617 + console.log("rycidrangevalue变换了");
  618 + scope[ctrlAs].$$data_rycid_first_init = true;
  619 + scope[ctrlAs].$$data_rycid_first_data = value;
  620 + }
  621 + });
  622 +
  623 + // 监控起始人员的变化
  624 + attr.$observe("rystartvalue", function(value) {
  625 + if (value && value != "") {
  626 + console.log("rystartvalue变换了");
  627 + scope[ctrlAs].$$data_rystart_first_init = true;
  628 + scope[ctrlAs].$$data_rystart_first_data = value;
  629 + }
  630 + });
  631 +
  632 + }
  633 + }
  634 +
  635 + }
  636 + }
  637 + }
  638 +]);
  639 +
src/main/resources/static/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroup.js
1 -  
2 -  
3 -/**  
4 - * saGuideboardgroup指令  
5 - * 属性如下:  
6 - * name(必须):控件的名字  
7 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
8 - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}  
9 - * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
10 - * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange  
11 - * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
12 - * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange  
13 - * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}  
14 - * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart  
15 - *  
16 - * required(可选):是否要用required验证  
17 - *  
18 - */  
19 -angular.module('ScheduleApp').directive('saGuideboardgroup', [  
20 - 'GuideboardManageService_g',  
21 - function(guideboardManageService_g) {  
22 - return {  
23 - restrict: 'E',  
24 - templateUrl: '/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroupTemplate.html',  
25 - scope: {  
26 - model: "=" // 独立作用域,关联外部的模型object  
27 - },  
28 - controllerAs: '$saGuideboardgroupCtrl',  
29 - bindToController: true,  
30 - controller: function($scope) {  
31 - var self = this;  
32 - self.$$data = []; // 选择线路后,该线路的路牌数据  
33 -  
34 - // 测试数据  
35 - //self.$$data = [  
36 - // {lpid: 1, lpname: '路1', isstart: false},  
37 - // {lpid: 2, lpname: '路2', isstart: true},  
38 - // {lpid: 3, lpname: '路3', isstart: false}  
39 - //];  
40 -  
41 -  
42 - self.$$dataSelected = []; // 选中的路牌列表  
43 - self.$$dataSelectedStart = undefined; // 起始路牌  
44 -  
45 - //self.$$dataSelected = [  
46 - // {lpid: 11, lpname: '路11', isstart: false},  
47 - // {lpid: 12, lpname: '路12', isstart: true},  
48 - // {lpid: 13, lpname: '路13', isstart: false}  
49 - //];  
50 -  
51 - // saGuideboardgroup组件的ng-model,用于外部绑定等操作  
52 - self.$$internalmodel = undefined;  
53 -  
54 - self.$$data_init = false; // *数据源初始化标志  
55 - self.$$data_xl_first_init = false; // 线路是否初始化  
56 - self.$$data_lp_first_init = false; // 路牌名字是否初始化  
57 - self.$$data_lpid_first_init = false; // 路牌id是否初始化  
58 - self.$$data_lpstart_first_init = false; // 起始路牌是否初始化  
59 -  
60 - },  
61 -  
62 - /**  
63 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
64 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
65 - * @param tElem  
66 - * @param tAttrs  
67 - * @returns {{pre: Function, post: Function}}  
68 - */  
69 - compile: function(tElem, tAttrs) {  
70 - // TODO:获取所有的属性  
71 - var $name_attr = tAttrs["name"]; // 控件的名字  
72 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
73 - var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名  
74 - var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名  
75 - var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名  
76 -  
77 - // controlAs名字  
78 - var ctrlAs = '$saGuideboardgroupCtrl';  
79 -  
80 - // 如果有required属性,添加angularjs required验证  
81 - if ($required_attr != undefined) {  
82 - //console.log(tElem.html());  
83 - tElem.find("div").attr("required", "");  
84 - }  
85 -  
86 - return {  
87 - pre: function(scope, element, attr) {  
88 - // TODO:  
89 - },  
90 -  
91 - /**  
92 - * 相当于link函数。  
93 - * @param scope  
94 - * @param element  
95 - * @param attr  
96 - */  
97 - post: function(scope, element, attr) {  
98 - // name属性  
99 - if ($name_attr) {  
100 - scope[ctrlAs]["$name_attr"] = $name_attr;  
101 - }  
102 -  
103 - // TODO:  
104 -  
105 -  
106 - /**  
107 - * 路牌列表点击(路牌列表中选中路牌)  
108 - * @param $index  
109 - */  
110 - scope[ctrlAs].$$internal_lplist_click = function($index) {  
111 - var data_temp = scope[ctrlAs].$$data;  
112 - if (data_temp && data_temp.length > $index) {  
113 - scope[ctrlAs].$$dataSelected.push({  
114 - lpid: data_temp[$index].lpid,  
115 - lpname: data_temp[$index].lpname,  
116 - isstart: data_temp[$index].isstart  
117 - });  
118 -  
119 - // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌  
120 - if (scope[ctrlAs].$$dataSelectedStart == undefined) {  
121 - scope[ctrlAs].$$internal_sellplist_click(  
122 - scope[ctrlAs].$$dataSelected.length - 1);  
123 - }  
124 - }  
125 - };  
126 - /**  
127 - * 选中的路牌单击(初始路牌选择)  
128 - * @param $index  
129 - */  
130 - scope[ctrlAs].$$internal_sellplist_click = function($index) {  
131 - var data_temp = scope[ctrlAs].$$dataSelected;  
132 - if (data_temp && data_temp.length > $index) {  
133 - for (var i = 0; i < data_temp.length; i++) {  
134 - data_temp[i].isstart = false;  
135 - }  
136 - data_temp[$index].isstart = true;  
137 - scope[ctrlAs].$$dataSelectedStart = $index;  
138 - }  
139 - };  
140 - /**  
141 - * 选中的路牌双击(删除选中的路牌)  
142 - * @param $index  
143 - */  
144 - scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {  
145 - var data_temp = scope[ctrlAs].$$dataSelected;  
146 - if (data_temp && data_temp.length > $index) {  
147 - if (scope[ctrlAs].$$dataSelectedStart == $index) {  
148 - scope[ctrlAs].$$dataSelectedStart = undefined;  
149 - }  
150 - data_temp.splice($index, 1);  
151 - }  
152 - };  
153 -  
154 -  
155 - /**  
156 - * 验证内部数据,更新外部model  
157 - */  
158 - scope[ctrlAs].$$internal_validate_model = function() {  
159 - var data_temp = scope[ctrlAs].$$dataSelected;  
160 - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;  
161 - var lpNames = [];  
162 - var lpIds = [];  
163 - var lpStart = 0;  
164 - var i = 0;  
165 -  
166 - if (data_temp &&  
167 - data_temp.length > 0 &&  
168 - data_temp2 != undefined) {  
169 -  
170 - for (i = 0; i < data_temp.length; i++) {  
171 - lpNames.push(data_temp[i].lpname);  
172 - lpIds.push(data_temp[i].lpid)  
173 - }  
174 - data_temp[data_temp2].isstart = true;  
175 - lpStart = data_temp2 + 1;  
176 -  
177 - // 更新内部model,用于外部验证  
178 - // 内部model的值暂时随意,以后再改  
179 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
180 -  
181 - // 更新外部model字段  
182 - if ($lprangename_attr) {  
183 - console.log("lprangename=" + lpNames.join(','));  
184 - eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");  
185 - }  
186 - if ($lpidrangename_attr) {  
187 - console.log("lpidrangename=" + lpIds.join(','));  
188 - eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");  
189 - }  
190 - if ($lpstartname_attr) {  
191 - console.log("lpstartname=" + lpStart);  
192 - eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");  
193 - }  
194 -  
195 - } else {  
196 - scope[ctrlAs].$$internalmodel = undefined;  
197 - }  
198 -  
199 -  
200 - };  
201 -  
202 - // 监控内部数据,$$data_selected 变化  
203 - scope.$watch(  
204 - function() {  
205 - return scope[ctrlAs].$$dataSelected;  
206 - },  
207 - function(newValue, oldValue) {  
208 - scope[ctrlAs].$$internal_validate_model();  
209 - },  
210 - true  
211 - );  
212 -  
213 - // 监控内部数据,$$data_selected_start 变化  
214 - scope.$watch(  
215 - function() {  
216 - return scope[ctrlAs].$$dataSelectedStart;  
217 - },  
218 - function(newValue, oldValue) {  
219 - scope[ctrlAs].$$internal_validate_model();  
220 - },  
221 - true  
222 - );  
223 -  
224 - /**  
225 - * 验证数据是否初始化完成,  
226 - * 所谓的初始化就是内部所有的数据被有效设定过一次。  
227 - */  
228 - scope[ctrlAs].$$internal_validate_init = function() {  
229 - var self = scope[ctrlAs];  
230 -  
231 - if (self.$$data_xl_first_init &&  
232 - self.$$data_lp_first_init &&  
233 - self.$$data_lpid_first_init &&  
234 - self.$$data_lpstart_first_init) {  
235 - console.log("数据初始化完毕!");  
236 - self.$$data_init = true;  
237 - }  
238 -  
239 - };  
240 -  
241 - // 监控初始化标志,线路,路牌,路牌id,起始路牌  
242 - scope.$watch(  
243 - function() {  
244 - return scope[ctrlAs].$$data_xl_first_init;  
245 - },  
246 - function(newValue, oldValue) {  
247 - scope[ctrlAs].$$internal_validate_init();  
248 - }  
249 - );  
250 - scope.$watch(  
251 - function() {  
252 - return scope[ctrlAs].$$data_lp_first_init;  
253 - },  
254 - function(newValue, oldValue) {  
255 - scope[ctrlAs].$$internal_validate_init();  
256 - }  
257 - );  
258 - scope.$watch(  
259 - function() {  
260 - return scope[ctrlAs].$$data_lpid_first_init;  
261 - },  
262 - function(newValue, oldValue) {  
263 - scope[ctrlAs].$$internal_validate_init();  
264 - }  
265 - );  
266 - scope.$watch(  
267 - function() {  
268 - return scope[ctrlAs].$$data_lpstart_first_init;  
269 - },  
270 - function(newValue, oldValue) {  
271 - scope[ctrlAs].$$internal_validate_init();  
272 - }  
273 - );  
274 -  
275 -  
276 - // 监控线路id的变化  
277 - attr.$observe("xlidvalue", function(value) {  
278 - if (value && value != "") {  
279 - console.log("xlidvalue=" + value);  
280 -  
281 - guideboardManageService_g.rest.list(  
282 - {"xl.id_eq": value, size: 100},  
283 - function(result) {  
284 - // 获取值了  
285 - console.log("路牌获取了");  
286 -  
287 - scope[ctrlAs].$$data = [];  
288 - for (var i = 0; i < result.content.length; i++) {  
289 - scope[ctrlAs].$$data.push({  
290 - lpid: result.content[i].id,  
291 - lpname: result.content[i].lpName,  
292 - isstart: false  
293 - });  
294 - }  
295 - if (scope[ctrlAs].$$data_init) {  
296 - scope[ctrlAs].$$dataSelected = [];  
297 - scope[ctrlAs].$$dataSelectedStart = undefined;  
298 - scope[ctrlAs].$$internalmodel = undefined;  
299 - }  
300 - scope[ctrlAs].$$data_xl_first_init = true;  
301 - },  
302 - function(result) {  
303 -  
304 - }  
305 - );  
306 -  
307 - }  
308 - });  
309 -  
310 - // 监控路牌名称范围值的变化  
311 - attr.$observe("lprangevalue", function(value) {  
312 - if (value && value != "") {  
313 - var data_temp = scope[ctrlAs].$$dataSelected;  
314 - var lpnames = value.split(",");  
315 - var i = 0;  
316 - if (data_temp && data_temp.length == 0) { // 初始创建  
317 - console.log("lprangevalue变换了");  
318 - for (i = 0; i < lpnames.length; i++) {  
319 - scope[ctrlAs].$$dataSelected.push({  
320 - lpname: lpnames[i],  
321 - isstart: false  
322 - });  
323 - }  
324 - } else {  
325 - for (i = 0; i < lpnames.length; i++) {  
326 - data_temp[i].lpname = lpnames[i];  
327 - }  
328 - }  
329 - scope[ctrlAs].$$data_lp_first_init = true;  
330 - }  
331 - });  
332 -  
333 - // 监控路牌id范围值的变化  
334 - attr.$observe("lpidrangevalue", function(value) {  
335 - if (value && value != "") {  
336 - console.log("lpidrangevalue=" + value);  
337 - var data_temp = scope[ctrlAs].$$dataSelected;  
338 - var lpids = value.split(",");  
339 - var i = 0;  
340 - if (data_temp && data_temp.length == 0) { // 初始创建  
341 - console.log("lpidrangevalue");  
342 - for (i = 0; i < lpids.length; i++) {  
343 - scope[ctrlAs].$$dataSelected.push({  
344 - lpid: lpids[i],  
345 - isstart: false  
346 - });  
347 - }  
348 - } else {  
349 - for (i = 0; i < lpids.length; i++) {  
350 - data_temp[i].lpid = lpids[i];  
351 - }  
352 - }  
353 - scope[ctrlAs].$$data_lpid_first_init = true;  
354 - }  
355 - });  
356 -  
357 - // 监控起始路牌的变化  
358 - attr.$observe("lpstartvalue", function(value) {  
359 - if (value && value != "") {  
360 - scope[ctrlAs].$$dataSelectedStart = value - 1;  
361 - scope[ctrlAs].$$data_lpstart_first_init = true;  
362 - }  
363 - });  
364 -  
365 -  
366 -  
367 - }  
368 - }  
369 -  
370 - }  
371 - }  
372 - }  
373 -]);  
374 - 1 +
  2 +
  3 +/**
  4 + * saGuideboardgroup指令
  5 + * 属性如下:
  6 + * name(必须):控件的名字
  7 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  8 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  9 + * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  10 + * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange
  11 + * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  12 + * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange
  13 + * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  14 + * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart
  15 + *
  16 + * required(可选):是否要用required验证
  17 + *
  18 + */
  19 +angular.module('ScheduleApp').directive('saGuideboardgroup', [
  20 + 'GuideboardManageService_g',
  21 + function(guideboardManageService_g) {
  22 + return {
  23 + restrict: 'E',
  24 + templateUrl: '/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroupTemplate.html',
  25 + scope: {
  26 + model: "=" // 独立作用域,关联外部的模型object
  27 + },
  28 + controllerAs: '$saGuideboardgroupCtrl',
  29 + bindToController: true,
  30 + controller: function($scope) {
  31 + var self = this;
  32 + self.$$data = []; // 选择线路后,该线路的路牌数据
  33 +
  34 + // 测试数据
  35 + //self.$$data = [
  36 + // {lpid: 1, lpname: '路1', isstart: false},
  37 + // {lpid: 2, lpname: '路2', isstart: true},
  38 + // {lpid: 3, lpname: '路3', isstart: false}
  39 + //];
  40 +
  41 +
  42 + self.$$dataSelected = []; // 选中的路牌列表
  43 + self.$$dataSelectedStart = undefined; // 起始路牌
  44 +
  45 + //self.$$dataSelected = [
  46 + // {lpid: 11, lpname: '路11', isstart: false},
  47 + // {lpid: 12, lpname: '路12', isstart: true},
  48 + // {lpid: 13, lpname: '路13', isstart: false}
  49 + //];
  50 +
  51 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  52 + self.$$internalmodel = undefined;
  53 +
  54 + self.$$data_init = false; // *数据源初始化标志
  55 + self.$$data_xl_first_init = false; // 线路是否初始化
  56 + self.$$data_lp_first_init = false; // 路牌名字是否初始化
  57 + self.$$data_lpid_first_init = false; // 路牌id是否初始化
  58 + self.$$data_lpstart_first_init = false; // 起始路牌是否初始化
  59 +
  60 + },
  61 +
  62 + /**
  63 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  64 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  65 + * @param tElem
  66 + * @param tAttrs
  67 + * @returns {{pre: Function, post: Function}}
  68 + */
  69 + compile: function(tElem, tAttrs) {
  70 + // TODO:获取所有的属性
  71 + var $name_attr = tAttrs["name"]; // 控件的名字
  72 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  73 + var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名
  74 + var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名
  75 + var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名
  76 +
  77 + // controlAs名字
  78 + var ctrlAs = '$saGuideboardgroupCtrl';
  79 +
  80 + // 如果有required属性,添加angularjs required验证
  81 + if ($required_attr != undefined) {
  82 + //console.log(tElem.html());
  83 + tElem.find("div").attr("required", "");
  84 + }
  85 +
  86 + return {
  87 + pre: function(scope, element, attr) {
  88 + // TODO:
  89 + },
  90 +
  91 + /**
  92 + * 相当于link函数。
  93 + * @param scope
  94 + * @param element
  95 + * @param attr
  96 + */
  97 + post: function(scope, element, attr) {
  98 + // name属性
  99 + if ($name_attr) {
  100 + scope[ctrlAs]["$name_attr"] = $name_attr;
  101 + }
  102 +
  103 + // TODO:
  104 +
  105 +
  106 + /**
  107 + * 路牌列表点击(路牌列表中选中路牌)
  108 + * @param $index
  109 + */
  110 + scope[ctrlAs].$$internal_lplist_click = function($index) {
  111 + var data_temp = scope[ctrlAs].$$data;
  112 + if (data_temp && data_temp.length > $index) {
  113 + scope[ctrlAs].$$dataSelected.push({
  114 + lpid: data_temp[$index].lpid,
  115 + lpname: data_temp[$index].lpname,
  116 + isstart: data_temp[$index].isstart
  117 + });
  118 +
  119 + // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌
  120 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  121 + scope[ctrlAs].$$internal_sellplist_click(
  122 + scope[ctrlAs].$$dataSelected.length - 1);
  123 + }
  124 + }
  125 + };
  126 + /**
  127 + * 选中的路牌单击(初始路牌选择)
  128 + * @param $index
  129 + */
  130 + scope[ctrlAs].$$internal_sellplist_click = function($index) {
  131 + var data_temp = scope[ctrlAs].$$dataSelected;
  132 + if (data_temp && data_temp.length > $index) {
  133 + for (var i = 0; i < data_temp.length; i++) {
  134 + data_temp[i].isstart = false;
  135 + }
  136 + data_temp[$index].isstart = true;
  137 + scope[ctrlAs].$$dataSelectedStart = $index;
  138 + }
  139 + };
  140 + /**
  141 + * 选中的路牌双击(删除选中的路牌)
  142 + * @param $index
  143 + */
  144 + scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {
  145 + var data_temp = scope[ctrlAs].$$dataSelected;
  146 + if (data_temp && data_temp.length > $index) {
  147 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  148 + scope[ctrlAs].$$dataSelectedStart = undefined;
  149 + }
  150 + data_temp.splice($index, 1);
  151 + }
  152 + };
  153 +
  154 +
  155 + /**
  156 + * 验证内部数据,更新外部model
  157 + */
  158 + scope[ctrlAs].$$internal_validate_model = function() {
  159 + var data_temp = scope[ctrlAs].$$dataSelected;
  160 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  161 + var lpNames = [];
  162 + var lpIds = [];
  163 + var lpStart = 0;
  164 + var i = 0;
  165 +
  166 + if (data_temp &&
  167 + data_temp.length > 0 &&
  168 + data_temp2 != undefined) {
  169 +
  170 + for (i = 0; i < data_temp.length; i++) {
  171 + lpNames.push(data_temp[i].lpname);
  172 + lpIds.push(data_temp[i].lpid)
  173 + }
  174 + data_temp[data_temp2].isstart = true;
  175 + lpStart = data_temp2 + 1;
  176 +
  177 + // 更新内部model,用于外部验证
  178 + // 内部model的值暂时随意,以后再改
  179 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  180 +
  181 + // 更新外部model字段
  182 + if ($lprangename_attr) {
  183 + console.log("lprangename=" + lpNames.join(','));
  184 + eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");
  185 + }
  186 + if ($lpidrangename_attr) {
  187 + console.log("lpidrangename=" + lpIds.join(','));
  188 + eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");
  189 + }
  190 + if ($lpstartname_attr) {
  191 + console.log("lpstartname=" + lpStart);
  192 + eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");
  193 + }
  194 +
  195 + } else {
  196 + scope[ctrlAs].$$internalmodel = undefined;
  197 + }
  198 +
  199 +
  200 + };
  201 +
  202 + // 监控内部数据,$$data_selected 变化
  203 + scope.$watch(
  204 + function() {
  205 + return scope[ctrlAs].$$dataSelected;
  206 + },
  207 + function(newValue, oldValue) {
  208 + scope[ctrlAs].$$internal_validate_model();
  209 + },
  210 + true
  211 + );
  212 +
  213 + // 监控内部数据,$$data_selected_start 变化
  214 + scope.$watch(
  215 + function() {
  216 + return scope[ctrlAs].$$dataSelectedStart;
  217 + },
  218 + function(newValue, oldValue) {
  219 + scope[ctrlAs].$$internal_validate_model();
  220 + },
  221 + true
  222 + );
  223 +
  224 + /**
  225 + * 验证数据是否初始化完成,
  226 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  227 + */
  228 + scope[ctrlAs].$$internal_validate_init = function() {
  229 + var self = scope[ctrlAs];
  230 +
  231 + if (self.$$data_xl_first_init &&
  232 + self.$$data_lp_first_init &&
  233 + self.$$data_lpid_first_init &&
  234 + self.$$data_lpstart_first_init) {
  235 + console.log("数据初始化完毕!");
  236 + self.$$data_init = true;
  237 + }
  238 +
  239 + };
  240 +
  241 + // 监控初始化标志,线路,路牌,路牌id,起始路牌
  242 + scope.$watch(
  243 + function() {
  244 + return scope[ctrlAs].$$data_xl_first_init;
  245 + },
  246 + function(newValue, oldValue) {
  247 + scope[ctrlAs].$$internal_validate_init();
  248 + }
  249 + );
  250 + scope.$watch(
  251 + function() {
  252 + return scope[ctrlAs].$$data_lp_first_init;
  253 + },
  254 + function(newValue, oldValue) {
  255 + scope[ctrlAs].$$internal_validate_init();
  256 + }
  257 + );
  258 + scope.$watch(
  259 + function() {
  260 + return scope[ctrlAs].$$data_lpid_first_init;
  261 + },
  262 + function(newValue, oldValue) {
  263 + scope[ctrlAs].$$internal_validate_init();
  264 + }
  265 + );
  266 + scope.$watch(
  267 + function() {
  268 + return scope[ctrlAs].$$data_lpstart_first_init;
  269 + },
  270 + function(newValue, oldValue) {
  271 + scope[ctrlAs].$$internal_validate_init();
  272 + }
  273 + );
  274 +
  275 +
  276 + // 监控线路id的变化
  277 + attr.$observe("xlidvalue", function(value) {
  278 + if (value && value != "") {
  279 + console.log("xlidvalue=" + value);
  280 +
  281 + guideboardManageService_g.rest.list(
  282 + {"xl.id_eq": value, size: 100},
  283 + function(result) {
  284 + // 获取值了
  285 + console.log("路牌获取了");
  286 +
  287 + scope[ctrlAs].$$data = [];
  288 + for (var i = 0; i < result.content.length; i++) {
  289 + scope[ctrlAs].$$data.push({
  290 + lpid: result.content[i].id,
  291 + lpname: result.content[i].lpName,
  292 + isstart: false
  293 + });
  294 + }
  295 + if (scope[ctrlAs].$$data_init) {
  296 + scope[ctrlAs].$$dataSelected = [];
  297 + scope[ctrlAs].$$dataSelectedStart = undefined;
  298 + scope[ctrlAs].$$internalmodel = undefined;
  299 + }
  300 + scope[ctrlAs].$$data_xl_first_init = true;
  301 + },
  302 + function(result) {
  303 +
  304 + }
  305 + );
  306 +
  307 + }
  308 + });
  309 +
  310 + // 监控路牌名称范围值的变化
  311 + attr.$observe("lprangevalue", function(value) {
  312 + if (value && value != "") {
  313 + var data_temp = scope[ctrlAs].$$dataSelected;
  314 + var lpnames = value.split(",");
  315 + var i = 0;
  316 + if (data_temp && data_temp.length == 0) { // 初始创建
  317 + console.log("lprangevalue变换了");
  318 + for (i = 0; i < lpnames.length; i++) {
  319 + scope[ctrlAs].$$dataSelected.push({
  320 + lpname: lpnames[i],
  321 + isstart: false
  322 + });
  323 + }
  324 + } else {
  325 + for (i = 0; i < lpnames.length; i++) {
  326 + data_temp[i].lpname = lpnames[i];
  327 + }
  328 + }
  329 + scope[ctrlAs].$$data_lp_first_init = true;
  330 + }
  331 + });
  332 +
  333 + // 监控路牌id范围值的变化
  334 + attr.$observe("lpidrangevalue", function(value) {
  335 + if (value && value != "") {
  336 + console.log("lpidrangevalue=" + value);
  337 + var data_temp = scope[ctrlAs].$$dataSelected;
  338 + var lpids = value.split(",");
  339 + var i = 0;
  340 + if (data_temp && data_temp.length == 0) { // 初始创建
  341 + console.log("lpidrangevalue");
  342 + for (i = 0; i < lpids.length; i++) {
  343 + scope[ctrlAs].$$dataSelected.push({
  344 + lpid: lpids[i],
  345 + isstart: false
  346 + });
  347 + }
  348 + } else {
  349 + for (i = 0; i < lpids.length; i++) {
  350 + data_temp[i].lpid = lpids[i];
  351 + }
  352 + }
  353 + scope[ctrlAs].$$data_lpid_first_init = true;
  354 + }
  355 + });
  356 +
  357 + // 监控起始路牌的变化
  358 + attr.$observe("lpstartvalue", function(value) {
  359 + if (value && value != "") {
  360 + scope[ctrlAs].$$dataSelectedStart = value - 1;
  361 + scope[ctrlAs].$$data_lpstart_first_init = true;
  362 + }
  363 + });
  364 +
  365 +
  366 +
  367 + }
  368 + }
  369 +
  370 + }
  371 + }
  372 + }
  373 +]);
  374 +
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
@@ -20,152 +20,104 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;loadingWidget&#39;, [&#39;requestNotificationCh @@ -20,152 +20,104 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;loadingWidget&#39;, [&#39;requestNotificationCh
20 } 20 }
21 }; 21 };
22 }]); 22 }]);
23 -angular.module('ScheduleApp').directive("remoteValidaton", [  
24 - 'BusInfoManageService_g',  
25 - 'EmployeeInfoManageService_g',  
26 - 'TimeTableManageService_g',  
27 - function(  
28 - busInfoManageService_g,  
29 - employeeInfoManageService_g,  
30 - timeTableManageService_g  
31 - ) {  
32 - /**  
33 - * 远端验证指令,依赖于ngModel  
34 - * 指令名称 remote-Validation  
35 - * 需要属性 rvtype 表示验证类型  
36 - */  
37 - return {  
38 - restrict: "A",  
39 - require: "^ngModel",  
40 - link: function(scope, element, attr, ngModelCtrl) {  
41 - element.bind("keyup", function() {  
42 - var modelValue = ngModelCtrl.$modelValue;  
43 - var rv1_attr = attr["rv1"];  
44 - if (attr["rvtype"]) {  
45 -  
46 - // 根据rvtype的值,确定使用那个远端验证的url,  
47 - // rv1, rv2, rv3是关联比较值,暂时使用rv1  
48 - // 这个貌似没法通用,根据业务变换  
49 - // TODO:暂时有点乱以后改  
50 - if (attr["rvtype"] == "insideCode") {  
51 - busInfoManageService_g.validate.insideCode(  
52 - {"insideCode_eq": modelValue, type: "equale"},  
53 - function(result) {  
54 - //console.log(result);  
55 - if (result.status == "SUCCESS") {  
56 - ngModelCtrl.$setValidity('remote', true);  
57 - } else {  
58 - ngModelCtrl.$setValidity('remote', false);  
59 - }  
60 - },  
61 - function(result) {  
62 - //console.log(result);  
63 - ngModelCtrl.$setValidity('remote', true);  
64 - }  
65 - );  
66 - } else if (attr["rvtype"] == "jobCode") {  
67 - if (!rv1_attr) {  
68 - ngModelCtrl.$setValidity('remote', false);  
69 - return;  
70 - } 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 + }
71 46
72 - employeeInfoManageService_g.validate.jobCode(  
73 - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},  
74 - function(result) {  
75 - //console.log(result);  
76 - if (result.status == "SUCCESS") {  
77 - ngModelCtrl.$setValidity('remote', true);  
78 - } else {  
79 - ngModelCtrl.$setValidity('remote', false);  
80 - }  
81 - },  
82 - function(result) {  
83 - //console.log(result); 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") {
84 ngModelCtrl.$setValidity('remote', true); 74 ngModelCtrl.$setValidity('remote', true);
  75 + } else {
  76 + ngModelCtrl.$setValidity('remote', false);
85 } 77 }
86 - );  
87 - } else if (attr["rvtype"] == "ttinfoname") {  
88 - if (!rv1_attr) {  
89 - ngModelCtrl.$setValidity('remote', false);  
90 - return; 78 + },
  79 + function(result) {
  80 + ngModelCtrl.$setValidity('remote', true);
91 } 81 }
92 -  
93 - timeTableManageService_g.validate.ttinfoname(  
94 - {"name_eq": modelValue, "xl.id_eq": rv1_attr, type: "equale"},  
95 - function(result) {  
96 - //console.log(result);  
97 - if (result.status == "SUCCESS") {  
98 - ngModelCtrl.$setValidity('remote', true);  
99 - } else {  
100 - ngModelCtrl.$setValidity('remote', false);  
101 - }  
102 - },  
103 - function(result) {  
104 - //console.log(result);  
105 - ngModelCtrl.$setValidity('remote', true);  
106 - }  
107 - );  
108 -  
109 - }  
110 - } else {  
111 - // 没有rvtype,就不用远端验证了  
112 - ngModelCtrl.$setValidity('remote', true); 82 + );
113 } 83 }
  84 + }
  85 + };
114 86
115 - attr.$observe("rv1", function(value) {  
116 - if (attr["rvtype"] == "jobCode") {  
117 - if (!value) {  
118 - ngModelCtrl.$setValidity('remote', false);  
119 - return;  
120 - } 87 + return {
  88 + pre: function(scope, element, attr) {
121 89
122 - employeeInfoManageService_g.validate.jobCode(  
123 - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},  
124 - function(result) {  
125 - //console.log(result);  
126 - if (result.status == "SUCCESS") {  
127 - ngModelCtrl.$setValidity('remote', true);  
128 - } else {  
129 - ngModelCtrl.$setValidity('remote', false);  
130 - }  
131 - },  
132 - function(result) {  
133 - //console.log(result);  
134 - ngModelCtrl.$setValidity('remote', true);  
135 - }  
136 - );  
137 - } else if (attr["rvtype"] == "ttinfoname") {  
138 - if (!value) {  
139 - ngModelCtrl.$setValidity('remote', false); 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) { // 没有修改过模型数据,不验证
140 return; 108 return;
141 } 109 }
142 -  
143 - console.log("rv1:" + value);  
144 -  
145 - timeTableManageService_g.validate.ttinfoname(  
146 - {"name_eq": modelValue, "xl.id_eq": value, type: "equale"},  
147 - function(result) {  
148 - //console.log(result);  
149 - if (result.status == "SUCCESS") {  
150 - ngModelCtrl.$setValidity('remote', true);  
151 - } else {  
152 - ngModelCtrl.$setValidity('remote', false);  
153 - }  
154 - },  
155 - function(result) {  
156 - //console.log(result);  
157 - ngModelCtrl.$setValidity('remote', true);  
158 - }  
159 - ); 110 + $watch_rvparam_obj = JSON.parse(value);
  111 + $$internal_validate(ngModelCtrl);
160 } 112 }
161 -  
162 }); 113 });
163 - });  
164 - }  
165 - }; 114 + }
  115 + };
  116 + }
166 } 117 }
167 - ]  
168 -); 118 + }
  119 +]);
  120 +
169 121
170 angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) { 122 angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
171 return { 123 return {
@@ -830,7 +782,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [ @@ -830,7 +782,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
830 ]); 782 ]);
831 783
832 784
833 -  
834 /** 785 /**
835 * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。 786 * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
836 * name(必须):控件的名字 787 * name(必须):控件的名字
@@ -1154,10 +1105,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [ @@ -1154,10 +1105,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [
1154 }; 1105 };
1155 } 1106 }
1156 ]); 1107 ]);
1157 -  
1158 -  
1159 -  
1160 -  
1161 /** 1108 /**
1162 * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。 1109 * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
1163 * name(必须):控件的名字 1110 * name(必须):控件的名字
@@ -1541,8 +1488,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1541,8 +1488,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1541 } 1488 }
1542 ]); 1489 ]);
1543 1490
1544 -  
1545 -  
1546 /** 1491 /**
1547 * saRadiogroup指令 1492 * saRadiogroup指令
1548 * 属性如下: 1493 * 属性如下:
@@ -3007,8 +2952,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [ @@ -3007,8 +2952,6 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
3007 ]); 2952 ]);
3008 2953
3009 2954
3010 -  
3011 -  
3012 /** 2955 /**
3013 * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。 2956 * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
3014 * 属性如下: 2957 * 属性如下:
src/main/resources/static/pages/scheduleApp/module/common/prj-common-filter.js
1 -// 自定义filter  
2 -  
3 -angular.module('ScheduleApp').filter("dict", [function() {  
4 - /**  
5 - * 字典过滤器,将后台的字典编码转换成文字说明。  
6 - * code,过滤的值,group,过滤的参数(字典group类型),dv没有匹配到的默认值  
7 - * 用例:sfdc | dict:'dctype':'默认值'  
8 - */  
9 - return function(code, group, dv) {  
10 - if (code == null) {  
11 - return dv;  
12 - } else {  
13 - return dictionaryUtils.transformCode(group, code);  
14 - }  
15 - };  
16 -}]);  
17 -  
18 -  
19 -  
20 -angular.module('ScheduleApp').filter("$$pyFilter", function() {  
21 - return function(items, props) {  
22 - var out = [];  
23 - var limit = props["limit"] || 20; // 默认20条记录  
24 -  
25 - if (angular.isArray(items)) {  
26 - items.forEach(function(item) {  
27 - if (out.length < limit) {  
28 - if (props.search) {  
29 - var upTerm = props.search.toUpperCase();  
30 - if(item.fullChars.indexOf(upTerm) != -1  
31 - || item.camelChars.indexOf(upTerm) != -1) {  
32 - out.push(item);  
33 - }  
34 - }  
35 - }  
36 - });  
37 - }  
38 -  
39 - return out;  
40 - }; 1 +// 自定义filter
  2 +
  3 +angular.module('ScheduleApp').filter("dict", [function() {
  4 + /**
  5 + * 字典过滤器,将后台的字典编码转换成文字说明。
  6 + * code,过滤的值,group,过滤的参数(字典group类型),dv没有匹配到的默认值
  7 + * 用例:sfdc | dict:'dctype':'默认值'
  8 + */
  9 + return function(code, group, dv) {
  10 + if (code == null) {
  11 + return dv;
  12 + } else {
  13 + return dictionaryUtils.transformCode(group, code);
  14 + }
  15 + };
  16 +}]);
  17 +
  18 +
  19 +
  20 +angular.module('ScheduleApp').filter("$$pyFilter", function() {
  21 + return function(items, props) {
  22 + var out = [];
  23 + var limit = props["limit"] || 20; // 默认20条记录
  24 +
  25 + if (angular.isArray(items)) {
  26 + items.forEach(function(item) {
  27 + if (out.length < limit) {
  28 + if (props.search) {
  29 + var upTerm = props.search.toUpperCase();
  30 + if(item.fullChars.indexOf(upTerm) != -1
  31 + || item.camelChars.indexOf(upTerm) != -1) {
  32 + out.push(item);
  33 + }
  34 + }
  35 + }
  36 + });
  37 + }
  38 +
  39 + return out;
  40 + };
41 }); 41 });
42 \ No newline at end of file 42 \ 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,cl,qyrq', direction: '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 -  
676 - 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/rerunManage/index.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>  
9 - <a href="/pages/home.html" data-pjax>首页</a>  
10 - <i class="fa fa-circle"></i>  
11 - </li>  
12 - <li>  
13 - <span class="active">运营计划管理</span>  
14 - <i class="fa fa-circle"></i>  
15 - </li>  
16 - <li>  
17 - <span class="active">套跑管理</span>  
18 - </li>  
19 -</ul>  
20 -  
21 -<div class="row">  
22 - <div class="col-md-12" ng-controller="RerunManageCtrl as ctrl">  
23 - <div class="portlet light bordered">  
24 - <div class="portlet-title">  
25 - <div class="caption font-dark">  
26 - <i class="fa fa-database font-dark"></i>  
27 - <span class="caption-subject bold uppercase">套跑信息</span>  
28 - </div>  
29 - <div class="actions">  
30 - <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()">  
31 - <i class="fa fa-plus"></i>  
32 - 添加套跑  
33 - </a>  
34 -  
35 - <div class="btn-group">  
36 - <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">  
37 - <i class="fa fa-share"></i>  
38 - <span>数据工具</span>  
39 - <i class="fa fa-angle-down"></i>  
40 - </a>  
41 - <ul class="dropdown-menu pull-right">  
42 - <li>  
43 - <a href="javascript:" class="tool-action">  
44 - <i class="fa fa-file-excel-o"></i>  
45 - 导入excel  
46 - </a>  
47 - </li>  
48 - <li>  
49 - <a href="javascript:" class="tool-action">  
50 - <i class="fa fa-file-excel-o"></i>  
51 - 导出excel  
52 - </a>  
53 - </li>  
54 - <li class="divider"></li>  
55 - <li>  
56 - <a href="javascript:" class="tool-action">  
57 - <i class="fa fa-refresh"></i>  
58 - 刷行数据  
59 - </a>  
60 - </li>  
61 - </ul>  
62 - </div>  
63 - </div>  
64 - </div>  
65 -  
66 - <div class="portlet-body">  
67 - <div ui-view="rerunManage_list"></div>  
68 - </div>  
69 - </div>  
70 - </div> 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>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">运营计划管理</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <span class="active">套跑管理</span>
  18 + </li>
  19 +</ul>
  20 +
  21 +<div class="row">
  22 + <div class="col-md-12" ng-controller="RerunManageCtrl as ctrl">
  23 + <div class="portlet light bordered">
  24 + <div class="portlet-title">
  25 + <div class="caption font-dark">
  26 + <i class="fa fa-database font-dark"></i>
  27 + <span class="caption-subject bold uppercase">套跑信息</span>
  28 + </div>
  29 + <div class="actions">
  30 + <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  31 + <i class="fa fa-plus"></i>
  32 + 添加套跑
  33 + </a>
  34 +
  35 + <div class="btn-group">
  36 + <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
  37 + <i class="fa fa-share"></i>
  38 + <span>数据工具</span>
  39 + <i class="fa fa-angle-down"></i>
  40 + </a>
  41 + <ul class="dropdown-menu pull-right">
  42 + <li>
  43 + <a href="javascript:" class="tool-action">
  44 + <i class="fa fa-file-excel-o"></i>
  45 + 导入excel
  46 + </a>
  47 + </li>
  48 + <li>
  49 + <a href="javascript:" class="tool-action">
  50 + <i class="fa fa-file-excel-o"></i>
  51 + 导出excel
  52 + </a>
  53 + </li>
  54 + <li class="divider"></li>
  55 + <li>
  56 + <a href="javascript:" class="tool-action">
  57 + <i class="fa fa-refresh"></i>
  58 + 刷行数据
  59 + </a>
  60 + </li>
  61 + </ul>
  62 + </div>
  63 + </div>
  64 + </div>
  65 +
  66 + <div class="portlet-body">
  67 + <div ui-view="rerunManage_list"></div>
  68 + </div>
  69 + </div>
  70 + </div>
71 </div> 71 </div>
72 \ No newline at end of file 72 \ No newline at end of file
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 </div> 147 </div>
148 \ No newline at end of file 148 \ No newline at end of file