Commit a1b038dd1a3f89c7d345de9f1c39d45cb2617107

Authored by 潘钊
2 parents 10f61394 e7f7d368

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

Showing 41 changed files with 6191 additions and 2712 deletions
src/main/java/com/bsth/controller/SectionSpeedController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.SectionSpeed;
  7 +import com.bsth.service.SectionSpeedService;
  8 +
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.*;
  11 +
  12 +
  13 +@RestController
  14 +@RequestMapping("sectionspeed")
  15 +public class SectionSpeedController extends BaseController<SectionSpeed, Integer> {
  16 +
  17 + @Autowired
  18 + private SectionSpeedService sectionSpeedService;
  19 +
  20 + /**@description TODO(新增路段限速) */
  21 + @RequestMapping(value="add" , method = RequestMethod.POST)
  22 + public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) {
  23 + return sectionSpeedService.add(map);
  24 + }
  25 +
  26 + /**@description TODO(修改路段) */
  27 + @RequestMapping(value="roadUpd" , method = RequestMethod.POST)
  28 + public Map<String, Object> roadUpd(@RequestParam Map<String, Object> map) {
  29 + return sectionSpeedService.roadUpd(map);
  30 + }
  31 +
  32 + /** @description TODO(根据线路ID与编码及方向查询路段限速信息) */
  33 + @RequestMapping(value="getSectionSpeedInfoList",method=RequestMethod.GET)
  34 + public List<Map<String, Object>> getSectionSpeedInfoList(@RequestParam Map<String, Object> map){
  35 + return sectionSpeedService.getSectionSpeedInfo(map);
  36 + }
  37 +
  38 + /**
  39 + * @Description :TODO(查询路段信息)
  40 + *
  41 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  42 + *
  43 + * @return Map<String, Object>
  44 + */
  45 + @RequestMapping(value = "/analyticSection" , method = RequestMethod.GET)
  46 + public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
  47 + return sectionSpeedService.analyticSection(map);
  48 + }
  49 +
  50 +}
src/main/java/com/bsth/entity/Line.java
@@ -25,116 +25,117 @@ import java.util.Date; @@ -25,116 +25,117 @@ import java.util.Date;
25 @Table(name = "bsth_c_line") 25 @Table(name = "bsth_c_line")
26 public class Line implements Serializable { 26 public class Line implements Serializable {
27 27
28 - // 线路ID  
29 @Id 28 @Id
30 - /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/ 29 + /** 线路ID 主键(唯一标识符) int length(11) */
31 private Integer id; 30 private Integer id;
32 31
33 - // 线路名称 32 + /** 线路名称 varchar length(50) 不能为空 */
34 private String name; 33 private String name;
35 34
36 - // 线路代码 35 + /** 线路编码 varchar length(50) 不能为空 */
37 private String lineCode; 36 private String lineCode;
38 37
39 - // 英文名 38 + /** 英文名 varchar length(50) */
40 private String es; 39 private String es;
41 40
42 - // 简称 41 + /** 简称 varchar length(50) */
43 private String shortName; 42 private String shortName;
44 43
45 - // 起始站名称 44 + /** 起始站名称 varchar length(50) 不能为空
  45 + * 该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值 */
46 private String startStationName; 46 private String startStationName;
47 47
48 - // 起始站首班车时间 00:00 48 + /** 终点站名称 varchar length(50) 不能为空
  49 + * 该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值 */
  50 + private String endStationName;
  51 +
  52 + /** 起始站首班车时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空 */
49 private String startStationFirstTime; 53 private String startStationFirstTime;
50 54
51 - // 起始站末班车时间 00:00 55 + /** 起始站末班车时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空 */
52 private String startStationEndTime; 56 private String startStationEndTime;
53 57
54 - // 终点站名称  
55 - private String endStationName;  
56 -  
57 - // 终点站首班时间 00:00 58 + /** 终点站首班时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空*/
58 private String endStationFirstTime; 59 private String endStationFirstTime;
59 60
60 - // 终点站末班时间 00:00 61 + /** 终点站末班时间 00:00 上海公交APP中某个接口所需要的字段值 */
61 private String endStationEndTime; 62 private String endStationEndTime;
62 63
63 - // 所属公司 64 + /** 所属公司 varchar length(50) */
64 private String company; 65 private String company;
65 66
66 - // 分公司 67 + /** 分公司 varchar length(50)*/
67 private String brancheCompany; 68 private String brancheCompany;
68 69
69 - // 性质(线路类型) 70 + /** 性质(线路类型) varchar length(50) */
70 private String nature; 71 private String nature;
71 72
72 - // 线路等级 73 + /** 线路等级 varchar length(50) */
73 private String level; 74 private String level;
74 75
75 - // 线路长度 76 + /** 线路长度 */
76 private double length; 77 private double length;
77 78
78 - // 线路负责人 79 + /** 线路负责人 varchar length(50) */
79 private String chargeName; 80 private String chargeName;
80 81
81 - // 负责人电话 82 + /** 负责人电话 varchar length(50) */
82 private String telephone; 83 private String telephone;
83 84
84 - // 是否撤销 85 + /** 是否撤销 <1:是;0:否> bit length(50) */
85 private Integer destroy; 86 private Integer destroy;
86 87
87 - // 是否夜宵线 88 + /** 是否夜宵线 <1:是;0:否> bit length(50)*/
88 private Integer supperLine; 89 private Integer supperLine;
89 90
90 - // 起始调度电话 91 + /** 起始调度电话 varchar length(50) */
91 private String startPhone; 92 private String startPhone;
92 93
93 - // 终点调度电话 94 + /** 终点调度电话 varchar length(50) */
94 private String endPhone; 95 private String endPhone;
95 96
96 - // 开辟日期 97 + /** 开辟日期 date*/
97 @DateTimeFormat(pattern ="yyyy-MM-dd") 98 @DateTimeFormat(pattern ="yyyy-MM-dd")
98 private Date openDate; 99 private Date openDate;
99 100
100 - // 线路沿革 101 + /** 线路沿革 varchar length(50) */
101 private String history; 102 private String history;
102 103
103 - // 上海市线路编码 104 + /** 上海市线路编码 varchar length(50) */
104 private String shanghaiLinecode; 105 private String shanghaiLinecode;
105 106
106 - // 设备线路编码 107 + /** 设备线路编码 varchar length(50) */
107 private String eqLinecode; 108 private String eqLinecode;
108 109
109 - /** 配置车辆总数 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */ 110 + /** 配置车辆总数 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11)*/
110 private Integer carSumNumber; 111 private Integer carSumNumber;
111 112
112 - /** 空调车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */ 113 + /** 空调车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */
113 private Integer hvacCarNumber; 114 private Integer hvacCarNumber;
114 115
115 - /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */ 116 + /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */
116 private Integer ordCarNumber; 117 private Integer ordCarNumber;
117 118
118 - /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */ 119 + /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */
119 private String carParkCode; 120 private String carParkCode;
120 121
121 - /** 线路规划类型 <0:双向;1:环线> */ 122 + /** 线路规划类型 <0:双向;1:环线> int length(11) 运管处接口需要的字段 不能为空 */
122 private Integer linePlayType; 123 private Integer linePlayType;
123 124
124 - // 描述 125 + /** 描述 varchar length(255) */
125 private String descriptions; 126 private String descriptions;
126 127
127 - // 创建人 128 + /** 创建人 int length(11) */
128 private Integer createBy; 129 private Integer createBy;
129 130
130 - // 修改人 131 + /** 修改人 int length(11) */
131 private Integer updateBy; 132 private Integer updateBy;
132 133
133 - // 创建日期 134 + /** 创建日期 timestamp */
134 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") 135 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
135 private Date createDate; 136 private Date createDate;
136 137
137 - // 修改日期 138 + /** 修改日期 timestamp */
138 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") 139 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
139 private Date updateDate; 140 private Date updateDate;
140 141
src/main/java/com/bsth/entity/Road.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +@Entity
  8 +@Table(name = "bsth_c_road")
  9 +public class Road {
  10 +
  11 + @Id
  12 + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
  13 + private Integer id;
  14 +
  15 + // 路段编码
  16 + private String roadCode;
  17 +
  18 + // 路段名称
  19 + private String roadName;
  20 +
  21 + // 路段矢量(空间坐标点集合)--百度原始坐标坐标点
  22 + private String broadVector;
  23 +
  24 + // 路段矢量(空间坐标点集合)--GPS坐标点
  25 + private String groadVector;
  26 +
  27 + // 限速
  28 + private Double speed;
  29 +
  30 + public Integer getId() {
  31 + return id;
  32 + }
  33 +
  34 + public void setId(Integer id) {
  35 + this.id = id;
  36 + }
  37 +
  38 + public String getRoadCode() {
  39 + return roadCode;
  40 + }
  41 +
  42 + public void setRoadCode(String roadCode) {
  43 + this.roadCode = roadCode;
  44 + }
  45 +
  46 + public String getRoadName() {
  47 + return roadName;
  48 + }
  49 +
  50 + public void setRoadName(String roadName) {
  51 + this.roadName = roadName;
  52 + }
  53 +
  54 + public String getBroadVector() {
  55 + return broadVector;
  56 + }
  57 +
  58 + public void setBroadVector(String broadVector) {
  59 + this.broadVector = broadVector;
  60 + }
  61 +
  62 + public String getGroadVector() {
  63 + return groadVector;
  64 + }
  65 +
  66 + public void setGroadVector(String groadVector) {
  67 + this.groadVector = groadVector;
  68 + }
  69 +
  70 + public Double getSpeed() {
  71 + return speed;
  72 + }
  73 +
  74 + public void setSpeed(Double speed) {
  75 + this.speed = speed;
  76 + }
  77 +}
src/main/java/com/bsth/entity/SectionRoute.java
@@ -52,6 +52,9 @@ public class SectionRoute { @@ -52,6 +52,9 @@ public class SectionRoute {
52 // 是否撤销 52 // 是否撤销
53 private Integer destroy; 53 private Integer destroy;
54 54
  55 + /** 是否有路段限速数据 <0:无;1:有>*/
  56 + private Integer isRoadeSpeed;
  57 +
55 // 描述 58 // 描述
56 private String descriptions; 59 private String descriptions;
57 60
@@ -76,6 +79,14 @@ public class SectionRoute { @@ -76,6 +79,14 @@ public class SectionRoute {
76 // 线路信息 79 // 线路信息
77 @ManyToOne 80 @ManyToOne
78 private Line line; 81 private Line line;
  82 +
  83 + public Integer getIsRoadeSpeed() {
  84 + return isRoadeSpeed;
  85 + }
  86 +
  87 + public void setIsRoadeSpeed(Integer isRoadeSpeed) {
  88 + this.isRoadeSpeed = isRoadeSpeed;
  89 + }
79 90
80 public Integer getId() { 91 public Integer getId() {
81 return id; 92 return id;
src/main/java/com/bsth/entity/SectionSpeed.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.GeneratedValue;
  5 +import javax.persistence.GenerationType;
  6 +import javax.persistence.Id;
  7 +import javax.persistence.ManyToOne;
  8 +import javax.persistence.Table;
  9 +
  10 +/**
  11 + * @description TODO(路段限速)
  12 + *
  13 + * @author bsth@lq
  14 + *
  15 + * @date 2016年9月14日 14:15:42
  16 + */
  17 +
  18 +
  19 +@Entity
  20 +@Table(name = "bsth_c_sectionspeed")
  21 +public class SectionSpeed {
  22 +
  23 + @Id
  24 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  25 + private Integer id;
  26 +
  27 + // 线路信息
  28 + @ManyToOne
  29 + private Line line;
  30 +
  31 + @ManyToOne
  32 + private Road road;
  33 +
  34 + /** 线路编码 */
  35 + private String lineCode;
  36 +
  37 + private String roadCode;
  38 +
  39 + /** 方向*/
  40 + private Integer directions;
  41 +
  42 + /** 序号*/
  43 + private Integer code;
  44 +
  45 + /** 路段名称 */
  46 + private String sName;
  47 +
  48 + public String getRoadCode() {
  49 + return roadCode;
  50 + }
  51 +
  52 + public void setRoadCode(String roadCode) {
  53 + this.roadCode = roadCode;
  54 + }
  55 +
  56 + public Road getRoad() {
  57 + return road;
  58 + }
  59 +
  60 + public void setRoad(Road road) {
  61 + this.road = road;
  62 + }
  63 +
  64 + public Integer getDirections() {
  65 + return directions;
  66 + }
  67 +
  68 + public void setDirections(Integer directions) {
  69 + this.directions = directions;
  70 + }
  71 +
  72 + public Integer getCode() {
  73 + return code;
  74 + }
  75 +
  76 + public void setCode(Integer code) {
  77 + this.code = code;
  78 + }
  79 +
  80 + public Integer getId() {
  81 + return id;
  82 + }
  83 +
  84 + public void setId(Integer id) {
  85 + this.id = id;
  86 + }
  87 +
  88 + public Line getLine() {
  89 + return line;
  90 + }
  91 +
  92 + public void setLine(Line line) {
  93 + this.line = line;
  94 + }
  95 +
  96 + public String getLineCode() {
  97 + return lineCode;
  98 + }
  99 +
  100 + public void setLineCode(String lineCode) {
  101 + this.lineCode = lineCode;
  102 + }
  103 +
  104 + public String getsName() {
  105 + return sName;
  106 + }
  107 +
  108 + public void setsName(String sName) {
  109 + this.sName = sName;
  110 + }
  111 +
  112 +}
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
@@ -53,6 +53,10 @@ public class CarConfigInfo implements Serializable { @@ -53,6 +53,10 @@ public class CarConfigInfo implements Serializable {
53 @Column(nullable = false) 53 @Column(nullable = false)
54 private int isSwitch; 54 private int isSwitch;
55 55
  56 + /** 是否删除(标记) */
  57 + @Column(nullable = false)
  58 + private Boolean isCancel = false;
  59 +
56 /** 创建人 */ 60 /** 创建人 */
57 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 61 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
58 private SysUser createBy; 62 private SysUser createBy;
@@ -170,4 +174,12 @@ public class CarConfigInfo implements Serializable { @@ -170,4 +174,12 @@ public class CarConfigInfo implements Serializable {
170 public void setUpdateDate(Date updateDate) { 174 public void setUpdateDate(Date updateDate) {
171 this.updateDate = updateDate; 175 this.updateDate = updateDate;
172 } 176 }
  177 +
  178 + public Boolean getIsCancel() {
  179 + return isCancel;
  180 + }
  181 +
  182 + public void setIsCancel(Boolean isCancel) {
  183 + this.isCancel = isCancel;
  184 + }
173 } 185 }
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
@@ -49,6 +49,9 @@ public class EmployeeConfigInfo { @@ -49,6 +49,9 @@ public class EmployeeConfigInfo {
49 @Formula(" dbbm + 0 ") 49 @Formula(" dbbm + 0 ")
50 private Integer dbbmFormula; 50 private Integer dbbmFormula;
51 51
  52 + /** 是否删除(标记) */
  53 + @Column(nullable = false)
  54 + private Boolean isCancel = false;
52 55
53 /** 创建人 */ 56 /** 创建人 */
54 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 57 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
@@ -96,6 +99,22 @@ public class EmployeeConfigInfo { @@ -96,6 +99,22 @@ public class EmployeeConfigInfo {
96 this.jsy = jsy; 99 this.jsy = jsy;
97 } 100 }
98 101
  102 + public Personnel getSpy() {
  103 + return spy;
  104 + }
  105 +
  106 + public void setSpy(Personnel spy) {
  107 + this.spy = spy;
  108 + }
  109 +
  110 + public String getDbbm() {
  111 + return dbbm;
  112 + }
  113 +
  114 + public void setDbbm(String dbbm) {
  115 + this.dbbm = dbbm;
  116 + }
  117 +
99 public Integer getDbbmFormula() { 118 public Integer getDbbmFormula() {
100 return dbbmFormula; 119 return dbbmFormula;
101 } 120 }
@@ -104,6 +123,14 @@ public class EmployeeConfigInfo { @@ -104,6 +123,14 @@ public class EmployeeConfigInfo {
104 this.dbbmFormula = dbbmFormula; 123 this.dbbmFormula = dbbmFormula;
105 } 124 }
106 125
  126 + public Boolean getIsCancel() {
  127 + return isCancel;
  128 + }
  129 +
  130 + public void setIsCancel(Boolean isCancel) {
  131 + this.isCancel = isCancel;
  132 + }
  133 +
107 public SysUser getCreateBy() { 134 public SysUser getCreateBy() {
108 return createBy; 135 return createBy;
109 } 136 }
@@ -120,22 +147,6 @@ public class EmployeeConfigInfo { @@ -120,22 +147,6 @@ public class EmployeeConfigInfo {
120 this.updateBy = updateBy; 147 this.updateBy = updateBy;
121 } 148 }
122 149
123 - public Personnel getSpy() {  
124 - return spy;  
125 - }  
126 -  
127 - public void setSpy(Personnel spy) {  
128 - this.spy = spy;  
129 - }  
130 -  
131 - public String getDbbm() {  
132 - return dbbm;  
133 - }  
134 -  
135 - public void setDbbm(String dbbm) {  
136 - this.dbbm = dbbm;  
137 - }  
138 -  
139 public Date getCreateDate() { 150 public Date getCreateDate() {
140 return createDate; 151 return createDate;
141 } 152 }
src/main/java/com/bsth/entity/search/CustomerSpecs.java
1 package com.bsth.entity.search; 1 package com.bsth.entity.search;
2 2
3 -import java.lang.reflect.Method;  
4 -import java.util.ArrayList;  
5 -import java.util.List;  
6 -import java.util.Map;  
7 -import java.util.Set;  
8 -import java.util.TreeSet;  
9 -  
10 -import javax.persistence.criteria.CriteriaBuilder;  
11 -import javax.persistence.criteria.CriteriaQuery;  
12 -import javax.persistence.criteria.Path;  
13 -import javax.persistence.criteria.Predicate;  
14 -import javax.persistence.criteria.Root;  
15 - 3 +import com.bsth.entity.search.exception.UnrecognizableSearchSymbolException;
16 import org.apache.commons.lang3.StringUtils; 4 import org.apache.commons.lang3.StringUtils;
17 import org.slf4j.Logger; 5 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 6 import org.slf4j.LoggerFactory;
19 import org.springframework.data.jpa.domain.Specification; 7 import org.springframework.data.jpa.domain.Specification;
20 8
21 -import com.bsth.entity.search.exception.UnrecognizableSearchSymbolException; 9 +import javax.persistence.criteria.*;
  10 +import java.lang.reflect.Method;
  11 +import java.util.*;
22 12
23 /** 13 /**
24 * 14 *
@@ -74,6 +64,14 @@ public class CustomerSpecs&lt;T&gt; implements Specification&lt;T&gt; { @@ -74,6 +64,14 @@ public class CustomerSpecs&lt;T&gt; implements Specification&lt;T&gt; {
74 // 值为空的不参与查询 64 // 值为空的不参与查询
75 if (value == null || (value instanceof String && value.equals(""))) 65 if (value == null || (value instanceof String && value.equals("")))
76 continue; 66 continue;
  67 +
  68 + // 如果是布尔值,转换,限定 'true','false' 字符串
  69 + if ("true".equals(value)) {
  70 + value = Boolean.TRUE;
  71 + }
  72 + if ("false".equals(value)) {
  73 + value = Boolean.FALSE;
  74 + }
77 75
78 try { 76 try {
79 if(!eSet.contains(searchs[1])) 77 if(!eSet.contains(searchs[1]))
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -157,4 +157,9 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -157,4 +157,9 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
157 " FROM bsth_c_sectionroute c " + 157 " FROM bsth_c_sectionroute c " +
158 " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true) 158 " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true)
159 List<Object[]> sectionRouteVector(Integer lineId,Integer directions); 159 List<Object[]> sectionRouteVector(Integer lineId,Integer directions);
  160 +
  161 + @Transactional
  162 + @Modifying
  163 + @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true)
  164 + void isRoadSpeedUpd(Integer isR,Integer line,Integer directions);
160 } 165 }
src/main/java/com/bsth/repository/SectionSpeedRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import com.bsth.entity.SectionSpeed;
  11 +
  12 +/**
  13 + * @description TODO(路段限速持久层)
  14 + *
  15 + * @author Administrator
  16 + *
  17 + * @date 2016年9月21日 13:31:25
  18 + */
  19 +@Repository
  20 +public interface SectionSpeedRepository extends BaseRepository<SectionSpeed, Integer>{
  21 +
  22 +
  23 + @Transactional
  24 + @Modifying
  25 + @Query(value="INSERT INTO bsth_c_sectionspeed (" +
  26 + "line , line_code , directions , `code` , s_name,road,road_code ) " +
  27 + " VALUES (" +
  28 + "?1 , ?2 , ?3 , ?4 , ?5,?6,?7)", nativeQuery=true)
  29 + /** @description TODO(路段限速保存) @param (<line:线路ID;versions:版本号;destroy:是否撤销;directions:方向;sValue:限速;code:路段序号> )*/
  30 + /** @param (<lineCode:线路编码;sName:路段名称;sType:路段类型;bLineStr:路段矢量百度坐标;gLineStr:路段矢量WGS坐标;descriptions:说明>)*/
  31 + void add(Integer line,String lineCode,Integer directions,Integer code,String sName,Integer road,String road_code);
  32 +
  33 + @Transactional
  34 + @Modifying
  35 + @Query(value="INSERT INTO bsth_c_road("+
  36 + "broad_vector,groad_vector,road_code,road_name,speed,id)"+
  37 + " VALUES(" +
  38 + "ST_GeomFromText(?1),ST_GeomFromText(?2),?3,?4,?5,?6)", nativeQuery=true)
  39 + void insertRoad(String broad_vector,String groad_vector,String road_code,String road_name,Double speed,Integer id);
  40 +
  41 + @Query(value="SELECT b.`name` as linename, a.speedid, a.bLineStr ,a.line_code,a.s_name,a.speed ,a.line,a.codenumb,a.road,a.directions FROM ("+
  42 + " SELECT p.id AS speedid,p.line,p.line_code,p.road,p.directions,p.`code` AS codenumb,p.s_name,ST_AsText(r.broad_vector) AS bLineStr,r.speed FROM ("+
  43 + " SELECT s.id,s.line,s.line_code,s.road,s.directions,s.`code`,s.s_name FROM bsth_c_sectionspeed s where s.line =?1 and s.line_code=?2 and s.directions=?3) p LEFT JOIN bsth_c_road r ON p.road = r.id) a "+
  44 + " LEFT JOIN bsth_c_line b ON a.line = b.id ORDER BY codenumb asc",nativeQuery = true)
  45 + List<Object[]> getSectionSpeedInfo(int lineId, String lineCode, int directions);
  46 +
  47 + /** 获取路网数据 */
  48 + @Query(value="SELECT ST_AsText(g.bdjw) as SHAPE , id as id ,ldbh,mc FROM jjwgps_t_gjldb g where g.bdjw is not null ",nativeQuery = true)
  49 + List<Object[]> getroadNet();
  50 +
  51 + /** */
  52 + @Query(value="SELECT ST_Contains(ST_Buffer(ST_GeomFromText(?1),0.0005),ST_GeomFromText(?2)) AS result",nativeQuery = true)
  53 + int ST_Contains(String g1,String g2);
  54 +
  55 +
  56 + @Query(value="SELECT id FROM bsth_c_road r where r.road_code = ?1",nativeQuery = true)
  57 + Integer validateRoade(String raodCode);
  58 +
  59 + @Transactional
  60 + @Modifying
  61 + @Query(value="UPDATE bsth_c_sectionspeed set `code` =?1 where id=?2",nativeQuery = true)
  62 + void roadUpdCode(Integer code,Integer sSpeedId);
  63 +
  64 + @Transactional
  65 + @Modifying
  66 + @Query(value="UPDATE bsth_c_road set road_name = ?1 ,speed =?2 where id= ?3",nativeQuery = true)
  67 + void sSpeedUpd(String roadName,Double speed ,Integer id);
  68 +
  69 +}
src/main/java/com/bsth/service/SectionSpeedService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.SectionSpeed;
  7 +
  8 +/**
  9 + * Created by xu on 16/5/31.
  10 + */
  11 +public interface SectionSpeedService extends BaseService<SectionSpeed, Integer> {
  12 +
  13 + /** @description TODO(新增路段限速) @return map ({status:SUCCESS}成功 或者 {status:ERROR}失败) @param map (路段限速信息)*/
  14 + Map<String, Object> add(Map<String, Object> map);
  15 +
  16 + /** @description TODO(修改路段) @return map ({status:SUCCESS}成功 或者 {status:ERROR}失败) @param map (路段限速信息)*/
  17 + Map<String, Object> roadUpd(Map<String, Object> map);
  18 +
  19 + List<Map<String, Object>> getSectionSpeedInfo(Map<String, Object> map);
  20 +
  21 + /** 解析路段 */
  22 + List<Map<String, Object>> analyticSection(Map<String,Object> map);
  23 +
  24 +}
src/main/java/com/bsth/service/impl/SectionSpeedServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.HashMap;
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +
  8 +import com.alibaba.fastjson.JSONArray;
  9 +import com.bsth.common.ResponseCode;
  10 +import com.bsth.entity.SectionSpeed;
  11 +import com.bsth.repository.SectionRouteRepository;
  12 +import com.bsth.repository.SectionSpeedRepository;
  13 +import com.bsth.service.SectionSpeedService;
  14 +import com.bsth.util.TransGPS;
  15 +import com.bsth.util.TransGPS.Location;
  16 +import com.bsth.util.Geo.GeoUtils;
  17 +import com.bsth.util.Geo.Point;
  18 +
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.stereotype.Service;
  21 +import org.springframework.transaction.annotation.Transactional;
  22 +
  23 +/**
  24 + * @description TODO(路段限速service实现类)
  25 + *
  26 + * @author Administrator
  27 + *
  28 + * @date 2016年9月21日 13:30:33
  29 + */
  30 +@Service
  31 +public class SectionSpeedServiceImpl extends BaseServiceImpl<SectionSpeed, Integer> implements SectionSpeedService {
  32 +
  33 + @Autowired
  34 + private SectionSpeedRepository sectionSpeedRepository;
  35 +
  36 + @Autowired
  37 + private SectionRouteRepository sectionRouteRepository;
  38 +
  39 +
  40 + /** @description TODO(新增路段限速) @return map ({status:SUCCESS}成功 或者 {status:ERROR}失败) @param map (路段限速信息)*/
  41 + @Override
  42 + public Map<String, Object> add(Map<String, Object> map) {
  43 +
  44 + /** 返回值 {status:SUCCESS}成功 或者 {status:ERROR}失败*/
  45 + Map<String, Object> resultMap = new HashMap<String, Object>();
  46 +
  47 + /** <line:线路ID;versions:版本号;destroy:是否撤销;directions:方向;sValue:限速;code:路段序号> */
  48 + Integer line = null, versions=null, destroy=null,directions = null,sValue = null,code = null;
  49 +
  50 + /** <lineCode:线路编码;sName:路段名称;sType:路段类型;bLineStr:路段矢量百度坐标;gLineStr:路段矢量WGS坐标;descriptions:说明>*/
  51 + String lineCode ="", sName = "", sType = "",bLineStr="",gLineStr="",descriptions="";
  52 +
  53 + line = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString());
  54 +
  55 + lineCode = map.get("lineCode").equals("") ? null : map.get("lineCode").toString();
  56 +
  57 + directions = map.get("directions").equals("") ? null : Integer.valueOf(map.get("directions").toString());
  58 +
  59 + code = map.get("code").equals("") ? null : Integer.valueOf(map.get("code").toString());
  60 +
  61 + sName = map.get("sName").equals("") ? "" : map.get("sName").toString();
  62 +
  63 + sValue = map.get("sValue").equals("") ? null : Integer.valueOf(map.get("sValue").toString());
  64 +
  65 + sType = map.get("sType").equals("") ? "" : map.get("sType").toString();
  66 +
  67 + bLineStr = map.get("bLineStr").equals("") ? "" : map.get("bLineStr").toString();
  68 +
  69 + String bPolyline = "";
  70 +
  71 + String gPolyline = "";
  72 +
  73 + // 转换成JSON数组
  74 + JSONArray sectionsArray = JSONArray.parseArray(bLineStr);
  75 + //[{"lng":121.337574,"lat":31.116436},{"lng":121.362439,"lat":31.099245},{"lng":121.362008,"lat":31.090834},{"lng":121.349791,"lat":31.093679}]
  76 + // 遍历
  77 + for(int s = 0 ;s<sectionsArray.size();s++) {
  78 +
  79 + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
  80 +
  81 + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
  82 +
  83 + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
  84 +
  85 + String WGSLngStr = String.valueOf(resultPoint.getLng());
  86 +
  87 + String WGSLatStr = String.valueOf(resultPoint.getLat());
  88 +
  89 + if(s<sectionsArray.size()-1){
  90 +
  91 + bPolyline = bPolyline + pointsLngStr + " " + pointsLatStr + ",";
  92 +
  93 + gPolyline = gPolyline + WGSLngStr + " " + WGSLatStr + ",";
  94 +
  95 + }else{
  96 +
  97 + bPolyline = bPolyline + pointsLngStr + " " + pointsLatStr;
  98 +
  99 + gPolyline = gPolyline + WGSLngStr + " " + WGSLatStr;
  100 + }
  101 +
  102 + }
  103 +
  104 +
  105 + bPolyline = "LINESTRING(" + bPolyline +")";
  106 +
  107 + gPolyline = "LINESTRING(" + gPolyline +")";
  108 + /*gLineStr = map.get("gLineStr").equals("") ? "" : map.get("gLineStr").toString();*/
  109 +
  110 + versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
  111 +
  112 + destroy = map.get("destroy").equals("") ? null : Integer.valueOf(map.get("destroy").toString());
  113 +
  114 + descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  115 +
  116 + try {
  117 +
  118 + /** 保存*/
  119 + /*sectionSpeedRepository.add(line, lineCode, directions, code, sName, sValue, sType, bPolyline, gPolyline, versions, destroy, descriptions);*/
  120 +
  121 + resultMap.put("status", ResponseCode.SUCCESS);
  122 +
  123 + } catch (Exception e) {
  124 +
  125 + resultMap.put("status", ResponseCode.ERROR);
  126 +
  127 + logger.error("save erro.", e);
  128 +
  129 + }
  130 +
  131 + return resultMap;
  132 + }
  133 +
  134 + /** 百度坐标转WGS坐标 */
  135 + public Location FromBDPointToWGSPoint(String bLonx,String bLatx) {
  136 +
  137 + double lng = Double.parseDouble(bLonx);
  138 +
  139 + double lat = Double.parseDouble(bLatx);
  140 +
  141 + Location bdLoc = TransGPS.LocationMake(lng, lat);
  142 +
  143 + Location location = TransGPS.bd_decrypt(bdLoc);
  144 +
  145 + Location WGSPoint = TransGPS.transformFromGCJToWGS(location);
  146 +
  147 + return WGSPoint;
  148 +
  149 + }
  150 +
  151 + @Override
  152 + public List<Map<String, Object>> getSectionSpeedInfo(Map<String, Object> map) {
  153 +
  154 + int lineId = Integer.parseInt(map.get("lineId").toString());
  155 +
  156 + String lineCode = map.get("lineCode").toString();
  157 +
  158 + int directions = Integer.parseInt(map.get("directions").toString());
  159 +
  160 + List<Object[]> listObj = sectionSpeedRepository.getSectionSpeedInfo(lineId, lineCode, directions);
  161 +
  162 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  163 +
  164 + if(listObj.size()>0) {
  165 +
  166 + for(int i = 0 ;i<listObj.size();i++){
  167 + Map<String, Object> tempM = new HashMap<String, Object>();
  168 +
  169 + tempM.put("lineName", listObj.get(i)[0]);
  170 +
  171 + tempM.put("id", listObj.get(i)[1]);
  172 +
  173 + tempM.put("bLineStr", listObj.get(i)[2]);
  174 +
  175 + tempM.put("line_code", listObj.get(i)[3]);
  176 +
  177 + tempM.put("s_name", listObj.get(i)[4]);
  178 +
  179 + tempM.put("s_value", listObj.get(i)[5]);
  180 +
  181 + tempM.put("line", listObj.get(i)[6]);
  182 +
  183 + tempM.put("xh", listObj.get(i)[7]);
  184 +
  185 + tempM.put("road", listObj.get(i)[8]);
  186 +
  187 + tempM.put("directions", listObj.get(i)[9]);
  188 + resultList.add(tempM);
  189 +
  190 + }
  191 + }
  192 + return resultList;
  193 + }
  194 +
  195 + @Override
  196 + public List<Map<String, Object>> analyticSection(Map<String, Object> map) {
  197 +
  198 + int lineId = map.get("line.id_eq").equals("") ? 0 : Integer.parseInt(map.get("line.id_eq").toString());
  199 +
  200 + int directions = map.get("directions_eq").equals("") ? 0 : Integer.parseInt(map.get("directions_eq").toString());
  201 +
  202 + String lineCode = map.get("lineCode").toString();
  203 +
  204 + String argus = map.get("argus").toString();
  205 +
  206 + List<Object[]> listObjArray = sectionRouteRepository.getSectionRoute(lineId, directions);
  207 +
  208 + List<Object[]> loadArray = sectionSpeedRepository.getroadNet();
  209 +
  210 + int len = loadArray.size();
  211 +
  212 + int size = listObjArray.size();
  213 +
  214 + List<Map<String, Object>> idArray = new ArrayList<Map<String, Object>>();
  215 +
  216 + if(size > 0) {
  217 +
  218 + for(int i = 0; i< size; i++) {
  219 +
  220 + String g1 = listObjArray.get(i)[16].toString();
  221 +
  222 + for(int k = 0;k<len;k++) {
  223 +
  224 + String g2 = loadArray.get(k)[0].toString();
  225 +
  226 + int isContains = sectionSpeedRepository.ST_Contains(g1, g2);
  227 +
  228 + if(isContains == 1) {
  229 +
  230 + String ldbh = loadArray.get(k)[2].toString();
  231 +
  232 + String mc = loadArray.get(k)[3].toString();
  233 +
  234 + Map<String, Object> mp = new HashMap<>();
  235 +
  236 + mp.put("linestring", g2);
  237 +
  238 + int index = sectionSort(g1,g2);
  239 +
  240 + mp.put("index", index+100);
  241 +
  242 + mp.put("ldbh", ldbh);
  243 +
  244 + mp.put("mc", mc);
  245 +
  246 + mp.put("id", loadArray.get(k)[1].toString());
  247 +
  248 + idArray.add(mp);
  249 +
  250 + }
  251 +
  252 + }
  253 + }
  254 +
  255 + if(argus.equals("1"))
  256 + insertRode(idArray,lineId,directions,lineCode );
  257 +
  258 + }
  259 +
  260 + return idArray;
  261 + }
  262 +
  263 + @Transactional
  264 + private void insertRode(List<Map<String, Object>> idArray,int line,int directions,String lineCode) {
  265 +
  266 + int size = idArray.size();
  267 +
  268 + if(size>0) {
  269 + for(int i =0;i<size;i++) {
  270 +
  271 + String broad_vector = idArray.get(i).get("linestring").toString();
  272 +
  273 + String groad_vector = null;
  274 +
  275 + String road_code = idArray.get(i).get("ldbh").toString();
  276 +
  277 + String road_name = idArray.get(i).get("mc").toString();
  278 +
  279 + Integer id = Integer.parseInt(idArray.get(i).get("id").toString());
  280 +
  281 + Double speed = 60.0d;
  282 +
  283 + Integer index = Integer.parseInt(idArray.get(i).get("index").toString());
  284 +
  285 + Integer vali = sectionSpeedRepository.validateRoade(road_code);
  286 +
  287 + if(vali==null)
  288 + sectionSpeedRepository.insertRoad(broad_vector, groad_vector, road_code, road_name, speed,id);
  289 + else
  290 + id = vali;
  291 +
  292 + sectionSpeedRepository.add(line, lineCode, directions, index, road_name, id,road_code);
  293 +
  294 + }
  295 + }
  296 +
  297 + int isR = 1;
  298 +
  299 + sectionRouteRepository.isRoadSpeedUpd( isR, line, directions);
  300 +
  301 + }
  302 +
  303 + public int sectionSort(String g1,String g2) {
  304 +
  305 + String g1_str = g1.substring(g1.indexOf("(")+1, g1.length()-1);
  306 +
  307 + String g2_str = g2.substring(g2.indexOf("(")+1, g2.length()-1);
  308 +
  309 + String g1_array[] = g1_str.split(",");
  310 +
  311 + String g2_array[] = g2_str.split(",");
  312 +
  313 + int len = g1_array.length;
  314 +
  315 + String pArray[] = g2_array[g2_array.length/2].split(" ");
  316 +
  317 + Point p = new Point(Double.parseDouble(pArray[0]), Double.parseDouble(pArray[1]));
  318 +
  319 + for(int l =0 ;l<len-1;l++) {
  320 +
  321 + List<Point> ps = new ArrayList<Point>();
  322 +
  323 + Point Point1 = new Point(Double.parseDouble(g1_array[l].split(" ")[0]), Double.parseDouble(g1_array[l].split(" ")[1]));
  324 +
  325 + Point Point2 = new Point(Double.parseDouble(g1_array[l+1].split(" ")[0]), Double.parseDouble(g1_array[l+1].split(" ")[1]));
  326 +
  327 + ps.add(Point1);
  328 +
  329 + ps.add(Point2);
  330 +
  331 + boolean b = GeoUtils.isInSection(ps, p);
  332 +
  333 + if(b)
  334 + return l;
  335 +
  336 + }
  337 + return 0;
  338 + }
  339 +
  340 + @Transactional
  341 + public Map<String, Object> roadUpd(Map<String, Object> map) {
  342 + /** 返回值 {status:SUCCESS}成功 或者 {status:ERROR}失败*/
  343 + Map<String, Object> resultMap = new HashMap<String, Object>();
  344 + try {
  345 + Integer code = Integer.parseInt(map.get("code").toString());
  346 + Integer sSpeedId = Integer.parseInt(map.get("sSpeedId").toString());
  347 + String roadName = map.get("roadName").toString();
  348 + Double speed = Double.parseDouble(map.get("speed").toString());
  349 + Integer id = Integer.parseInt(map.get("id").toString());
  350 + sectionSpeedRepository.roadUpdCode(code, sSpeedId);
  351 + sectionSpeedRepository.sSpeedUpd(roadName, speed, id);
  352 + resultMap.put("status", ResponseCode.SUCCESS);
  353 + } catch (Exception e) {
  354 +
  355 + resultMap.put("status", ResponseCode.ERROR);
  356 +
  357 + logger.error("save erro.", e);
  358 +
  359 + }
  360 + return resultMap;
  361 + }
  362 +}
src/main/java/com/bsth/service/schedule/CarConfigInfoServiceImpl.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
  3 +import com.bsth.common.ResponseCode;
3 import com.bsth.entity.schedule.CarConfigInfo; 4 import com.bsth.entity.schedule.CarConfigInfo;
  5 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  6 +import com.bsth.repository.schedule.CarConfigInfoRepository;
4 import com.bsth.service.impl.BaseServiceImpl; 7 import com.bsth.service.impl.BaseServiceImpl;
  8 +import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
6 10
  11 +import javax.transaction.Transactional;
  12 +import java.util.*;
  13 +
7 /** 14 /**
8 * Created by xu on 16/5/9. 15 * Created by xu on 16/5/9.
9 */ 16 */
10 @Service 17 @Service
11 public class CarConfigInfoServiceImpl extends BaseServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService { 18 public class CarConfigInfoServiceImpl extends BaseServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService {
  19 + @Autowired
  20 + private CarConfigInfoRepository carConfigInfoRepository;
  21 + @Autowired
  22 + private ScheduleRule1FlatService scheduleRule1FlatService;
  23 +
  24 + @Override
  25 + @Transactional
  26 + public Map<String, Object> delete(Long aLong) {
  27 + // 获取待作废的车辆配置
  28 + CarConfigInfo carConfigInfo = carConfigInfoRepository.findOne(aLong);
  29 + // 查询有无规则使用过此车辆配置
  30 + Map<String, Object> param = new HashMap<>();
  31 + param.put("carConfigInfo.id_eq", carConfigInfo.getId());
  32 + Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator =
  33 + scheduleRule1FlatService.list(param).iterator();
  34 + boolean isExist = false;
  35 + while (scheduleRule1FlatIterator.hasNext()) {
  36 + ScheduleRule1Flat scheduleRule1Flat = scheduleRule1FlatIterator.next();
  37 + if (scheduleRule1Flat.getCarConfigInfo().getId().equals(carConfigInfo.getId())) {
  38 + isExist = true;
  39 + break;
  40 + }
  41 + }
  42 +
  43 + Map<String, Object> map = new HashMap<>();
  44 +
  45 + if (isExist) {
  46 + throw new RuntimeException("车辆配置已被规则使用,不能删除,请先修改规则!");
  47 + } else {
  48 + carConfigInfo.setIsCancel(true);
  49 + map.put("status", ResponseCode.SUCCESS);
  50 + }
  51 +
  52 + return map;
  53 +
  54 + }
12 } 55 }
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoServiceImpl.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.Line;
3 import com.bsth.entity.schedule.EmployeeConfigInfo; 5 import com.bsth.entity.schedule.EmployeeConfigInfo;
  6 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  7 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
4 import com.bsth.service.impl.BaseServiceImpl; 8 import com.bsth.service.impl.BaseServiceImpl;
  9 +import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
6 11
  12 +import javax.transaction.Transactional;
  13 +import java.util.*;
  14 +
7 /** 15 /**
8 * Created by xu on 16/5/10. 16 * Created by xu on 16/5/10.
9 */ 17 */
10 @Service 18 @Service
11 public class EmployeeConfigInfoServiceImpl extends BaseServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService { 19 public class EmployeeConfigInfoServiceImpl extends BaseServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService {
  20 + @Autowired
  21 + private EmployeeConfigInfoRepository employeeConfigInfoRepository;
  22 + @Autowired
  23 + private ScheduleRule1FlatService scheduleRule1FlatService;
  24 +
  25 +
  26 + @Override
  27 + @Transactional
  28 + public Map<String, Object> delete(Long aLong) {
  29 + // 获取待作废的人员配置
  30 + EmployeeConfigInfo employeeConfigInfo = employeeConfigInfoRepository.findOne(aLong);
  31 + // 获取线路
  32 + Line xl = employeeConfigInfo.getXl();
  33 + // 查找线路的规则,比较人员配置信息
  34 + Map<String, Object> param = new HashMap<>();
  35 + param.put("xl.id_eq", xl.getId());
  36 + Iterator<ScheduleRule1Flat> employeeConfigInfoIterator = scheduleRule1FlatService.list(param).iterator();
  37 + List<String> ryConfigIds = new ArrayList<>();
  38 + while (employeeConfigInfoIterator.hasNext()) {
  39 + ScheduleRule1Flat scheduleRule1Flat = employeeConfigInfoIterator.next();
  40 + ryConfigIds.addAll(Arrays.asList(scheduleRule1Flat.getRyConfigIds().split(",")));
  41 + }
  42 +
  43 + Map<String, Object> map = new HashMap<>();
  44 +
  45 + if (ryConfigIds.contains(employeeConfigInfo.getId().toString())) {
  46 + throw new RuntimeException("人员配置已被规则使用,不能删除,请先修改规则!");
  47 + } else {
  48 + employeeConfigInfo.setIsCancel(true);
  49 + map.put("status", ResponseCode.SUCCESS);
  50 + }
  51 +
  52 + return map;
  53 + }
  54 +
12 } 55 }
src/main/java/com/bsth/util/Geo/AnalySection.java 0 → 100644
  1 +package com.bsth.util.Geo;
  2 +
  3 +import java.sql.Connection;
  4 +import java.sql.PreparedStatement;
  5 +import java.sql.ResultSet;
  6 +import java.sql.SQLException;
  7 +import java.util.ArrayList;
  8 +import java.util.HashMap;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +import org.junit.Test;
  13 +
  14 +import com.bsth.util.db.DBUtils_MS;
  15 +
  16 +public class AnalySection {
  17 +
  18 + public static void main(String[] args) {
  19 +
  20 + String pt = "LINESTRING(121.427084 31.023463, 121.428111 31.0209, 121.428239 31.020581, 121.428282 31.020473, 121.428282 31.020473, 121.428428 31.020522, 121.43158 31.021588, 121.432536 31.021911, 121.432913 31.022039, 121.433123 31.02211, 121.433125 31.02211, 121.433162 31.022123, 121.434294 31.022493, 121.435396 31.022854, 121.435655 31.022939, 121.435665 31.022942, 121.435853 31.023003, 121.436642 31.023259, 121.437547 31.023553, 121.438305 31.023799, 121.438766 31.023948, 121.439166 31.024078, 121.439498 31.024185, 121.440023 31.024356, 121.440195 31.024412, 121.440553 31.024528, 121.440555 31.024529, 121.44287 31.025288, 121.44287 31.025288, 121.443571 31.023482, 121.443571 31.023481, 121.443741 31.023072, 121.443741 31.023071, 121.444873 31.020715, 121.444873 31.020715, 121.445904 31.018896, 121.445904 31.018896, 121.44595 31.018908, 121.448164 31.019475, 121.448169 31.019476, 121.448874 31.019683, 121.450747 31.020041, 121.452977 31.020467, 121.45356 31.020578, 121.453619 31.02059, 121.453624 31.020591, 121.458521 31.021501, 121.45859 31.021514, 121.458592 31.021514, 121.46086 31.021921, 121.460939 31.021935, 121.462975 31.0223, 121.464179 31.022516, 121.46471 31.022611, 121.466105 31.02298, 121.466738 31.023148, 121.466742 31.023149, 121.468916 31.023743, 121.470353 31.024135, 121.470353 31.024135, 121.470276 31.024269, 121.470208 31.024405, 121.470141 31.02456, 121.470114 31.024664, 121.470074 31.024776, 121.470024 31.024888, 121.46997 31.025012, 121.469912 31.025198, 121.469854 31.025434, 121.469804 31.025612, 121.46975 31.025809, 121.469499 31.026165, 121.469319 31.02642, 121.469018 31.026718, 121.468695 31.027043, 121.468542 31.027194, 121.468623 31.027403, 121.468744 31.027704, 121.468928 31.028157, 121.46913 31.028679, 121.469337 31.029197, 121.469467 31.029495, 121.469575 31.029801, 121.469683 31.03006, 121.469223 31.030134, 121.468539 31.030406, 121.467866 31.030848, 121.467374 31.031456, 121.466971 31.032342, 121.467139 31.032383, 121.467994 31.032594, 121.468055 31.032609, 121.468274 31.032663, 121.470605 31.033238, 121.470968 31.033327, 121.471741 31.033518, 121.471742 31.033518, 121.474855 31.034286, 121.475005 31.034323, 121.476549 31.034704, 121.476632 31.034725, 121.476632 31.034725, 121.47662 31.034806, 121.476218 31.037582, 121.476217 31.037587, 121.476177 31.037872, 121.476114 31.038324, 121.47591 31.039777, 121.47575 31.04091, 121.475525 31.042514, 121.475505 31.042654, 121.475491 31.042754, 121.475467 31.042925, 121.475405 31.043366, 121.475326 31.043928, 121.475135 31.04529, 121.475127 31.04535, 121.475113 31.04545, 121.475087 31.045632, 121.475086 31.045637, 121.475032 31.046043, 121.474851 31.047386, 121.474734 31.048258, 121.474734 31.048258, 121.474643 31.048231, 121.473857 31.048001, 121.473609 31.047928, 121.473145 31.047792, 121.472745 31.047675, 121.472411 31.047577, 121.47195 31.047442, 121.471853 31.047413, 121.471565 31.047333, 121.471589 31.047337, 121.471107 31.047196, 121.470985 31.047155, 121.47046 31.046997, 121.469858 31.046811, 121.469571 31.046718, 121.469256 31.046641, 121.468717 31.046471, 121.467855 31.046215, 121.467514 31.046115, 121.467338 31.046803, 121.467226 31.047198, 121.467145 31.047488, 121.467042 31.047832, 121.466966 31.048103, 121.466878 31.04838, 121.466878 31.04838, 121.465844 31.048174, 121.464972 31.048001, 121.46497 31.048001, 121.464618 31.04794, 121.464088 31.047848, 121.463501 31.047746, 121.463204 31.047694, 121.463144 31.047684, 121.462691 31.047605, 121.462691 31.047605, 121.46234 31.047532, 121.461527 31.047362, 121.461477 31.047352, 121.461265 31.047321, 121.460833 31.047258, 121.459616 31.047081, 121.459201 31.047021, 121.4592 31.047021, 121.457806 31.046907, 121.457717 31.047577, 121.457685 31.047818, 121.457635 31.048199, 121.457634 31.048209, 121.457605 31.048459, 121.457595 31.048549, 121.457624 31.050018, 121.457614 31.050178, 121.457598 31.050428, 121.457749 31.050423, 121.457897 31.050427, 121.458072 31.050415, 121.458194 31.050415, 121.458405 31.050415, 121.45853 31.050423, 121.458751 31.050415, 121.458818 31.050415, 121.458818 31.050419, 121.458831 31.050419)";
  21 +
  22 + Connection conn = null;
  23 +
  24 + PreparedStatement ps = null;
  25 +
  26 + ResultSet rs = null;
  27 +
  28 + String sqlSelect = "SELECT ST_AsText(g.bdjw) as SHAPE , g.OGR_FID as id FROM gjld g";
  29 +
  30 + String sqlIntersects = "SELECT ST_Contains(ST_Buffer(ST_GeomFromText(?),0.0005),ST_GeomFromText(?)) AS result";
  31 +
  32 + List<Map<String, Object>> list = new ArrayList<>();
  33 +
  34 + try {
  35 + conn = DBUtils_MS.getConnection();
  36 +
  37 + ps = conn.prepareStatement(sqlSelect);
  38 +
  39 + rs = ps.executeQuery();
  40 +
  41 + while (rs.next()) {
  42 +
  43 + Map<String, Object> map = new HashMap<String, Object>();
  44 +
  45 + map.put("shape", rs.getString("SHAPE"));
  46 +
  47 + map.put("id", rs.getInt("id"));
  48 +
  49 + list.add(map);
  50 + }
  51 +
  52 + ps = null;
  53 +
  54 + rs = null;
  55 +
  56 + for(int i =0;i<list.size();i++) {
  57 +
  58 + ps = conn.prepareStatement(sqlIntersects);
  59 +
  60 + ps.setString(1, pt);
  61 +
  62 + ps.setString(2, list.get(i).get("shape").toString());
  63 +
  64 + rs = ps.executeQuery();
  65 +
  66 + while (rs.next()) {
  67 +
  68 + if(rs.getInt("result")==1) {
  69 + System.out.println(list.get(i).get("id").toString() + "*********************相交");
  70 + }
  71 +
  72 + /*System.out.println(rs.getInt("result"));*/
  73 +
  74 + }
  75 +
  76 + }
  77 + } catch (SQLException e) {
  78 + // TODO Auto-generated catch block
  79 + e.printStackTrace();
  80 + }
  81 + }
  82 +
  83 +}
src/main/java/com/bsth/util/Geo/Bounds.java 0 → 100644
  1 +package com.bsth.util.Geo;
  2 +
  3 +public final class Bounds {
  4 +
  5 + private Point northEast;
  6 + private Point southWest;
  7 +
  8 + public Bounds(Point min, Point max) {
  9 + this.southWest = min;
  10 + this.northEast = max;
  11 + }
  12 +
  13 + public Point getNorthEast() {
  14 + return northEast;
  15 + }
  16 +
  17 + public Point getSouthWest() {
  18 + return southWest;
  19 + }
  20 +}
src/main/java/com/bsth/util/Geo/Circle.java 0 → 100644
  1 +package com.bsth.util.Geo;
  2 +
  3 +public final class Circle {
  4 +
  5 + private Point center;
  6 + private double radius;
  7 +
  8 + public Circle(Point c, double r) {
  9 + this.center = c;
  10 + this.radius = r;
  11 + }
  12 +
  13 + public Point getCenter() {
  14 + return center;
  15 + }
  16 +
  17 + public double getRadius() {
  18 + return radius;
  19 + }
  20 +}
src/main/java/com/bsth/util/Geo/GeoUtils.java 0 → 100644
  1 +package com.bsth.util.Geo;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +
  7 +public class GeoUtils {
  8 +
  9 + private final static double EARTH_RADIUS = 6378137;
  10 + private final static double INLINE_THRESHOLD = Integer.parseInt("120");
  11 + private final static double DRIFT_THRESHOLD = Integer.parseInt("2000");
  12 +
  13 + public static boolean isPointInRect(Point point, Bounds bounds) {
  14 + Point sw = bounds.getSouthWest(); // 西南脚点
  15 + Point ne = bounds.getNorthEast(); // 东北脚点
  16 + return (point.getLon() >= sw.getLon() && point.getLon() <= ne.getLon()
  17 + && point.getLat() >= sw.getLat() && point.getLat() <= ne
  18 + .getLat());
  19 + }
  20 +
  21 + public static boolean isPointInCircle(Point point, Circle circle) {
  22 + // point与圆心距离小于圆形半径,则点在圆内,否则在圆外
  23 + Point c = circle.getCenter();
  24 + double r = circle.getRadius();
  25 +
  26 + double dis = getDistance(point, c);
  27 + if (dis <= r) {
  28 + return true;
  29 + } else {
  30 + return false;
  31 + }
  32 + }
  33 +
  34 + public static boolean isPointInPolygon(Point point, Polygon polygon) {
  35 + Bounds polygonBounds = polygon.getBounds();
  36 + if (!isPointInRect(point, polygonBounds)) {
  37 + return false;
  38 + }
  39 +
  40 + List<Point> pts = polygon.getPoints();// 获取多边形点
  41 +
  42 + // 下述代码来源:http://paulbourke.net/geometry/insidepoly/,进行了部分修改
  43 + // 基本思想是利用射线法,计算射线与多边形各边的交点,如果是偶数,则点在多边形外,否则
  44 + // 在多边形内。还会考虑一些特殊情况,如点在多边形顶点上,点在多边形边上等特殊情况。
  45 +
  46 + int N = pts.size();
  47 + boolean boundOrVertex = true; // 如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
  48 + int intersectCount = 0;// cross points count of x
  49 + double precision = 2e-10; // 浮点类型计算时候与0比较时候的容差
  50 + Point p1, p2;// neighbour bound vertices
  51 + Point p = point; // 测试点
  52 +
  53 + p1 = pts.get(0);// left vertex
  54 + for (int i = 1; i <= N; ++i) {// check all rays
  55 + if (p.equals(p1)) {
  56 + return boundOrVertex;// p is an vertex
  57 + }
  58 +
  59 + p2 = pts.get(i % N);// right vertex
  60 + if (p.getLat() < Math.min(p1.getLat(), p2.getLat())
  61 + || p.getLat() > Math.max(p1.getLat(), p2.getLat())) {// ray
  62 + // is
  63 + // outside
  64 + // of
  65 + // our
  66 + // interests
  67 + p1 = p2;
  68 + continue;// next ray left point
  69 + }
  70 +
  71 + if (p.getLat() > Math.min(p1.getLat(), p2.getLat())
  72 + && p.getLat() < Math.max(p1.getLat(), p2.getLat())) {// ray
  73 + // is
  74 + // crossing
  75 + // over
  76 + // by
  77 + // the
  78 + // algorithm
  79 + // (common
  80 + // part
  81 + // of)
  82 + if (p.getLon() <= Math.max(p1.getLon(), p2.getLon())) {// x is
  83 + // before
  84 + // of
  85 + // ray
  86 + if (p1.getLat() == p2.getLat()
  87 + && p.getLon() >= Math.min(p1.getLon(), p2.getLon())) {// overlies
  88 + // on
  89 + // a
  90 + // horizontal
  91 + // ray
  92 + return boundOrVertex;
  93 + }
  94 +
  95 + if (p1.getLon() == p2.getLon()) {// ray is vertical
  96 + if (p1.getLon() == p.getLon()) {// overlies on a
  97 + // vertical ray
  98 + return boundOrVertex;
  99 + } else {// before ray
  100 + ++intersectCount;
  101 + }
  102 + } else {// cross point on the left side
  103 + double xinters = (p.getLat() - p1.getLat())
  104 + * (p2.getLon() - p1.getLon())
  105 + / (p2.getLat() - p1.getLat()) + p1.getLon();// cross
  106 + // point
  107 + // of
  108 + // lng
  109 + if (Math.abs(p.getLon() - xinters) < precision) {// overlies
  110 + // on
  111 + // a
  112 + // ray
  113 + return boundOrVertex;
  114 + }
  115 +
  116 + if (p.getLon() < xinters) {// before ray
  117 + ++intersectCount;
  118 + }
  119 + }
  120 + }
  121 + } else {// special case when ray is crossing through the vertex
  122 + if (p.getLat() == p2.getLat() && p.getLon() <= p2.getLon()) {// p
  123 + // crossing
  124 + // over
  125 + // p2
  126 + Point p3 = pts.get((i + 1) % N); // next vertex
  127 + if (p.getLat() >= Math.min(p1.getLat(), p3.getLat())
  128 + && p.getLat() <= Math.max(p1.getLat(), p3.getLat())) {// p.lat
  129 + // lies
  130 + // between
  131 + // p1.lat
  132 + // &
  133 + // p3.lat
  134 + ++intersectCount;
  135 + } else {
  136 + intersectCount += 2;
  137 + }
  138 + }
  139 + }
  140 + p1 = p2;// next ray left point
  141 + }
  142 +
  143 + if (intersectCount % 2 == 0) {// 偶数在多边形外
  144 + return false;
  145 + } else { // 奇数在多边形内
  146 + return true;
  147 + }
  148 + }
  149 +
  150 + private static double degreeToRad(double degree) {
  151 + return Math.PI * degree / 180;
  152 + }
  153 +
  154 + private static double radToDegree(double rad) {
  155 + return (180 * rad) / Math.PI;
  156 + }
  157 +
  158 + private static double getRange(double v, double a, double b) {
  159 + v = Math.min(Math.max(v, a), b);
  160 + return v;
  161 + }
  162 +
  163 + private static double getLoop(double v, double a, double b) {
  164 + while (v > b) {
  165 + v -= b - a;
  166 + }
  167 + while (v < a) {
  168 + v += b - a;
  169 + }
  170 + return v;
  171 + }
  172 +
  173 + /**
  174 + * 判断点是否在某个路段
  175 + * @param ps
  176 + * @param p
  177 + * @return
  178 + */
  179 + public static boolean isInSection(List<Point> ps, Point p) {
  180 + for (int i = 0, len = ps.size();i < len - 1;i++) {
  181 + if (isInSection(ps.get(i), ps.get(i + 1), p)) return true;
  182 + }
  183 + return false;
  184 + }
  185 +
  186 + /**
  187 + * 判断点是否在某个线段上
  188 + * @param lp1
  189 + * @param lp2
  190 + * @param p
  191 + * @return
  192 + */
  193 + private static boolean isInSection(Point lp1, Point lp2, Point p) {
  194 + double a = lp1.getLat() - lp2.getLat(), b = lp2.getLon() - lp1.getLon(), c = lp1.getLon()*lp2.getLat() - lp2.getLon()*lp1.getLat();
  195 + double lon = (Math.pow(b, 2)*p.getLon() - a*b*p.getLat() - a*c)/(Math.pow(a, 2) + Math.pow(b, 2));
  196 + double lat = (Math.pow(a, 2)*p.getLat() - a*b*p.getLon() - b*c)/(Math.pow(a, 2) + Math.pow(b, 2));
  197 + Point vp = new Point(lon, lat);
  198 + return getDistance(p, vp) < INLINE_THRESHOLD && isBetween(lp1, lp2, vp);
  199 + }
  200 +
  201 + private static boolean isBetween(Point lp1, Point lp2, Point p) {
  202 + double lon1 = lp1.getLon(), lat1 = lp1.getLat();
  203 + double lon2 = lp2.getLon(), lat2 = lp2.getLat();
  204 + double lon = p.getLon(), lat = p.getLat();
  205 + return (lon > lon1 && lon < lon2 || lon > lon2 && lon < lon1) || (lat > lat1 && lat < lat2 || lat > lat2 && lat < lat1);
  206 + }
  207 +
  208 + public static boolean isDrift(Point p1, Point p2) {
  209 + return getDistance(p1, p2) > DRIFT_THRESHOLD;
  210 + }
  211 +
  212 + public static double getDistance(Point p1, Point p2) {
  213 + double lng1 = getLoop(p1.getLon(), -180, 180), lat1 = getRange(
  214 + p1.getLat(), -74, 74);
  215 + double lng2 = getLoop(p2.getLon(), -180, 180), lat2 = getRange(
  216 + p2.getLat(), -74, 74);
  217 +
  218 + double x1, x2, y1, y2;
  219 + x1 = degreeToRad(lng1);
  220 + y1 = degreeToRad(lat1);
  221 + x2 = degreeToRad(lng2);
  222 + y2 = degreeToRad(lat2);
  223 + return EARTH_RADIUS
  224 + * Math.acos((Math.sin(y1) * Math.sin(y2) + Math.cos(y1)
  225 + * Math.cos(y2) * Math.cos(x2 - x1)));
  226 + }
  227 +
  228 + public static void main(String args[]) {
  229 + String a = "121.644416 31.195991, 121.643949 31.195928, 121.64364 31.195886";
  230 + List<Point> points = new ArrayList<>();
  231 + for(String t1 : a.split(", ")){
  232 + String[] arr = t1.split(" ");
  233 + Point p = new Point(Double.parseDouble(arr[0]), Double.parseDouble(arr[1]));
  234 + points.add(p);
  235 + }
  236 + System.out.println(isInSection(points, new Point(121.644416, 31.195991)));
  237 + }
  238 +}
src/main/java/com/bsth/util/Geo/Point.java 0 → 100644
  1 +package com.bsth.util.Geo;
  2 +
  3 +public class Point {
  4 +
  5 + private double lon;
  6 + private double lat;
  7 +
  8 + public Point(double lon, double lat) {
  9 + this.lon = lon;
  10 + this.lat = lat;
  11 + }
  12 +
  13 + public double getLon() {
  14 + return lon;
  15 + }
  16 +
  17 + public double getLat() {
  18 + return lat;
  19 + }
  20 +}
src/main/java/com/bsth/util/Geo/Polygon.java 0 → 100644
  1 +package com.bsth.util.Geo;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +public final class Polygon {
  7 +
  8 + private List<Point> points;
  9 + private Bounds bounds;
  10 +
  11 + public Polygon(List<Point> ps) {
  12 + this.points = new ArrayList<Point>(ps);
  13 + double minlon = 200, minlat = 200, maxlon = -1, maxlat = -1;
  14 + for (Point p : ps) {
  15 + minlon = p.getLon() < minlon ? p.getLon() : minlon;
  16 + minlat = p.getLat() < minlat ? p.getLat() : minlat;
  17 + maxlon = p.getLon() > maxlon ? p.getLon() : maxlon;
  18 + maxlat = p.getLat() > maxlat ? p.getLat() : maxlat;
  19 + }
  20 + bounds = new Bounds(new Point(minlon, minlat), new Point(maxlon, maxlat));
  21 + }
  22 +
  23 + public List<Point> getPoints() {
  24 + return new ArrayList<Point>(points);
  25 + }
  26 +
  27 + public Bounds getBounds() {
  28 + return bounds;
  29 + }
  30 +}
src/main/java/com/bsth/util/Geo/SHCJ2BDJW.java 0 → 100644
  1 +package com.bsth.util.Geo;
  2 +
  3 +import java.sql.Connection;
  4 +import java.sql.PreparedStatement;
  5 +import java.sql.ResultSet;
  6 +import java.sql.SQLException;
  7 +import java.util.ArrayList;
  8 +import java.util.HashMap;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +
  13 +import com.bsth.util.JWDUtil;
  14 +import com.bsth.util.TransGPS;
  15 +import com.bsth.util.TransGPS.Location;
  16 +import com.bsth.util.db.DBUtils_MS;
  17 +
  18 +public class SHCJ2BDJW {
  19 +
  20 + public static void main(String[] args) {
  21 +
  22 + Connection conn = null;
  23 +
  24 + PreparedStatement ps = null;
  25 +
  26 + ResultSet rs = null;
  27 +
  28 + String sqlSelect = "SELECT b.SHAPESTRING as SHAPE , b.id as ID FROM jjwgps_t_gjldb b where SHAPESTRING is not null order by b.ldbh asc ";
  29 +
  30 + String sqlUpdate = "UPDATE jjwgps_t_gjldb SET bdjw = GeomFromText(?),SHAPE = GeomFromText(?) where id = ?";
  31 +
  32 + List<Map<String, Object>> list = new ArrayList<>();
  33 +
  34 + try {
  35 + conn = DBUtils_MS.getConnection();
  36 +
  37 + ps = conn.prepareStatement(sqlSelect);
  38 +
  39 + rs = ps.executeQuery();
  40 +
  41 + while (rs.next()) {
  42 +
  43 + Map<String, Object> map = new HashMap<String, Object>();
  44 +
  45 + map.put("shape", rs.getString("SHAPE"));
  46 +
  47 + map.put("id", rs.getInt("ID"));
  48 +
  49 + list.add(map);
  50 + }
  51 +
  52 + for(int i =0;i<list.size();i++) {
  53 +
  54 + Map<String, Object> temp = list.get(i);
  55 +
  56 + String lineString = temp.get("shape").toString();
  57 + /*String lineString = "LINESTRING (13532.5305161702 -3677.63275264995, 13433.22401617 -3881.74765264988)";*/
  58 +
  59 +
  60 + String arrayP[] = lineString.substring(lineString.indexOf("(")+1, lineString.length()-1).split(", ");
  61 +
  62 + int id = Integer.parseInt(temp.get("id").toString());
  63 + String geometry = "";
  64 +
  65 + for(int k =0;k<arrayP.length;k++) {
  66 +
  67 + String arrayXY[] = arrayP[k].split(" ");
  68 +
  69 + Double lng = Double.parseDouble(arrayXY[0]);
  70 +
  71 + Double lat = Double.parseDouble(arrayXY[1]);
  72 +
  73 + Map map_2 = JWDUtil.ConvertSHToJW(lng,lat);
  74 +
  75 + Location location = TransGPS.LocationMake(Float.parseFloat(map_2.get("x").toString()), Float.parseFloat(map_2.get("y").toString()));
  76 +
  77 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
  78 +
  79 + if(k==arrayP.length-1)
  80 + geometry = geometry + (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624);
  81 + else
  82 + geometry = geometry + (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624) + ",";
  83 +
  84 +
  85 + }
  86 +
  87 + ps = null;
  88 +
  89 + geometry = "LINESTRING(" + geometry +")";
  90 +
  91 + ps = conn.prepareStatement(sqlUpdate);
  92 +
  93 + ps.setString(1, geometry);
  94 +
  95 + ps.setString(2, lineString);
  96 +
  97 + ps.setInt(3, id);
  98 +
  99 + int stauts = ps.executeUpdate();
  100 +
  101 + }
  102 +
  103 + } catch (SQLException e) {
  104 + // TODO Auto-generated catch block
  105 + e.printStackTrace();
  106 + }
  107 + }
  108 +
  109 +}
src/main/java/com/bsth/util/JWDUtil.java 0 → 100644
  1 +/**
  2 + * JWDUtil.java
  3 + * com.bsth.web.service
  4 + * JwdChange
  5 + */
  6 +package com.bsth.util;
  7 +
  8 +import java.util.HashMap;
  9 +import java.util.Map;
  10 +
  11 +import com.bsth.util.TransGPS.Location;
  12 +
  13 +/**
  14 + * @author caiwangjue
  15 + * @date 2011-10-13 上午09:53:40
  16 + * 经纬度和城建坐标互转
  17 + */
  18 +public class JWDUtil {
  19 +
  20 + /**
  21 + * 经纬度坐标转换成上海城建坐标
  22 + * @param fLon 经度
  23 + * @param fLat 纬度
  24 + * @return 城建坐标Map
  25 + */
  26 + @SuppressWarnings("rawtypes")
  27 + public static Map ConvertJWToSH(double fLon, double fLat)
  28 + {
  29 + double jd = fLon;
  30 + double wd = fLat;
  31 + Map map = ConvertJWDToBeijing(jd, wd);
  32 + //Map rmap = ConvertBeijingToShanghai((Double)map.get("x"), (Double)map.get("y"));
  33 + return map;
  34 + }
  35 +
  36 + /**
  37 + * 上海城建坐标转换为经纬度
  38 + * @param fXX X坐标
  39 + * @param fYY Y坐标
  40 + * @return 经纬度坐标Map
  41 + */
  42 + @SuppressWarnings("rawtypes")
  43 + public static Map ConvertSHToJW(double fXX, double fYY)
  44 + {
  45 + double x = fXX;
  46 + double y = fYY;
  47 + Map map = ConvertShanghaiToBeijing(x, y);
  48 + Map rmap = ConvertBeijingToJWD((Double)map.get("x"), (Double)map.get("y"));
  49 + return rmap;
  50 + }
  51 +
  52 +
  53 + /**
  54 + * 经纬度坐标转换成北京城建坐标
  55 + * @param jd 经度
  56 + * @param wd 纬度
  57 + * @return 城建坐标Map
  58 + */
  59 + @SuppressWarnings({ "unchecked", "rawtypes" })
  60 + private static Map ConvertJWDToBeijing(double jd, double wd)
  61 + {
  62 + Map map = new HashMap();
  63 + double num = 121.4671606;
  64 + double num2 = jd - num;
  65 + double num3 = num2 / 57.2957795130823;
  66 + double a = (wd / 180.0) * Math.PI;
  67 + double num5 = Math.tan(a);
  68 + double num6 = Math.cos(a);
  69 + double num7 = (0.006738525415 * num6) * num6;
  70 + double num8 = num5 * num5;
  71 + double d = 1.0 + num7;
  72 + double num10 = 6399698.9018 / Math.sqrt(d);
  73 + double num11 = ((num3 * num3) * num6) * num6;
  74 + double num12 = num5 * num6;
  75 + double num13 = num12 * num12;
  76 + double num14 = 32005.78006 + (num13 * (133.92133 + (num13 * 0.7031)));
  77 + double num15 = (((6367558.49686 * wd) / 57.29577951308) - ((num12 * num6) * num14)) + ((((((((((((((num8 - 58.0) * num8) + 61.0) * num11) / 30.0) + (((4.0 * num7) + 5.0) * d)) - num8) * num11) / 12.0) + 1.0) * num10) * num5) * num11) / 2.0);
  78 + double num16 = ((((((((((((num8 - 18.0) * num8) - (((58.0 * num8) - 14.0) * num7)) + 5.0) * num11) / 20.0) + d) - num8) * num11) / 6.0) + 1.0) * num10) * (num3 * num6);
  79 + map.put("x", (num15 + -3457140.589));
  80 + map.put("y", num16);
  81 + return map;
  82 + }
  83 +
  84 + /**
  85 + * 上海城建坐标转换为北京城建坐标
  86 + * @param x X坐标
  87 + * @param y Y坐标
  88 + * @return 城建坐标Map
  89 + */
  90 + @SuppressWarnings({ "rawtypes", "unchecked" })
  91 + private static Map ConvertShanghaiToBeijing(double x, double y)
  92 + {
  93 + Map map = new HashMap();
  94 + double num = x;
  95 + x = y;
  96 + y = num;
  97 + double num2 = 3458144.04;
  98 + double num3 = -146121.96;
  99 + double num4 = 1.000140682;
  100 + double num5 = 0.013930556;
  101 + double num6 = (num2 + (num4 * x)) - (num5 * y);
  102 + double num7 = (num3 + (num4 * y)) + (num5 * x);
  103 + map.put("x", num6);
  104 + map.put("y", (num7 + 21000000.0) + 500000.0);
  105 + return map;
  106 + }
  107 +
  108 + /**
  109 + * 北京城建坐标转换为上海城建坐标
  110 + * @param x X坐标
  111 + * @param y Y坐标
  112 + * @return 城建坐标Map
  113 + */
  114 + @SuppressWarnings({ "rawtypes", "unused", "unchecked" })
  115 + private static Map ConvertBeijingToShanghai(double x, double y)
  116 + {
  117 + Map map = new HashMap();
  118 + double num = 3458144.04;
  119 + double num2 = -146121.96;
  120 + double num3 = 1.000140682;
  121 + double num4 = 0.013930556;
  122 + y -= 21500000.0;
  123 + double num5 = ((num3 * (x - num)) + (num4 * (y - num2))) / (Math.pow(num3, 2.0) + Math.pow(num4, 2.0));
  124 + double num6 = ((num3 * (y - num2)) - (num4 * (x - num))) / (Math.pow(num3, 2.0) + Math.pow(num4, 2.0));
  125 + map.put("x", num6);
  126 + map.put("y", num5);
  127 + return map;
  128 + }
  129 +
  130 + /**
  131 + * 北京城建坐标转换为经纬度
  132 + * @param x X坐标
  133 + * @param y Y坐标
  134 + * @return 经纬度坐标Map
  135 + */
  136 + @SuppressWarnings({ "rawtypes", "unchecked" })
  137 + private static Map ConvertBeijingToJWD(double x, double y)
  138 + {
  139 + Map map = new HashMap();
  140 + double num = 123.0;
  141 + y -= 21500000.0;
  142 + double num2 = (x / 1000000.0) - 3.0;
  143 + double num3 = (((((27.11115372595 + (9.02468257083 * num2)) - (0.00579740442 * Math.pow(num2, 2.0))) - (0.00043532572 * Math.pow(num2, 3.0))) + (4.857285E-05 * Math.pow(num2, 4.0))) + (2.15727E-06 * Math.pow(num2, 5.0))) - (1.9288E-07 * Math.pow(num2, 6.0));
  144 + double num4 = Math.tan((num3 * Math.PI) / 180.0);
  145 + double num5 = 0.0067385254147 * Math.pow(Math.cos((num3 * Math.PI) / 180.0), 2.0);
  146 + double num6 = (y * Math.sqrt(1.0 + num5)) / 6399698.90178271;
  147 + double num7 = num3 - ((((1.0 + num5) * num4) * (((90.0 * Math.pow(num6, 2.0)) - ((7.5 * ((5.0 + (3.0 * Math.pow(num4, 2.0))) -
  148 + ((9.0 * num5) * Math.pow(num5, 2.0)))) * Math.pow(num6, 4.0))) + ((0.25 * ((61.0 + (90.0 * Math.pow(num5, 2.0)))
  149 + + (45.0 * Math.pow(num4, 4.0)))) * Math.pow(num6, 6.0)))) / Math.PI);
  150 + double num8 = (((180.0 * num6) - ((30.0 * ((1.0 + (2.0 * Math.pow(num4, 2.0))) + num5)) * Math.pow(num6, 3.0))) +
  151 + ((1.5 * ((5.0 + (28.0 * Math.pow(num4, 2.0))) + (24.0 * Math.pow(num4, 4.0)))) * Math.pow(num6, 5.0))) / (Math.PI * Math.cos((num3 * Math.PI) / 180.0));
  152 + double num9 = num + num8;
  153 + map.put("x", num9);
  154 + map.put("y", num7);
  155 + return map;
  156 + }
  157 +
  158 + @SuppressWarnings({ "rawtypes", "unused" })
  159 + private static Map ConvertJWDToSH(double x, double y)
  160 + {
  161 + Map map = new HashMap();
  162 + double num = 123.0;
  163 +
  164 + return map;
  165 + }
  166 +
  167 + public static void main(String[] args)
  168 + {
  169 + //2447.667013 351.858477
  170 + Map map = JWDUtil.ConvertJWToSH(121.56320853169203, 31.264449981962045);
  171 + /*System.out.println(map.get("x")+"####"+map.get("y"));*/
  172 +
  173 + Map map_2 = JWDUtil.ConvertSHToJW(8733.12663,103.65674);
  174 + System.out.println(map_2.get("x")+"####"+map_2.get("y"));
  175 + Location location = TransGPS.LocationMake(Float.parseFloat(map_2.get("x").toString()), Float.parseFloat(map_2.get("y").toString()));
  176 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
  177 + System.out.println(location.getLng()+","+location.getLat());
  178 + }
  179 +}
src/main/resources/static/pages/base/sectionspeed/css/addmap.css 0 → 100644
  1 + #mapContainer{
  2 + min-width: 100%;
  3 + width: calc(100% + 26px);
  4 + /* margin-top: -28px; */
  5 + border: 2px solid #fdfdfd;
  6 + min-height: 659px;
  7 + height:100%;
  8 + overflow: hidden;
  9 + }
  10 +
  11 + .BMap_pop img:nth-child(10){
  12 +
  13 + display: none !important;
  14 +
  15 +}
  16 +
  17 + #realSearchInput, .select2-container--bootstrap .select2-selection--single {
  18 + height: 47px;
  19 + line-height: 1.42857;
  20 + padding: 6px 24px 6px 12px;
  21 + background-color: #555;
  22 + border: 1px solid #555;
  23 +}
  24 +
  25 + .select2-container--bootstrap .select2-selection--single .select2-selection__rendered {
  26 + color: #fff;
  27 + padding: 0;
  28 + margin-top: 5px;
  29 +}
  30 +.select2-container--bootstrap.select2-container--disabled .select2-selection, .select2-container--bootstrap.select2-container--disabled .select2-selection--multiple .select2-selection__choice {
  31 + background-color: #bfbfbf;
  32 +}
  33 + #pjax-container{
  34 +
  35 + overflow: hidden;
  36 + }
  37 +
  38 + /* 隐藏百度地图logo */
  39 +.anchorBL,
  40 +.anchorBL,
  41 +.amap-logo,
  42 +.amap-copyright{
  43 + display: none;
  44 +}
  45 +
  46 + .mapRightWrap.search {
  47 + height: 47px;
  48 + padding-top: 0;
  49 + background-color: #626775 !important;
  50 +}
  51 +
  52 +.mapRightWrap {
  53 + position: absolute;
  54 + width: 320px;
  55 + height: 150px;
  56 + right: 30px;
  57 + /* background-color: #3B3F51; */
  58 + background-color: #12507c;
  59 + top: 98px;
  60 + /* padding-top: 15px; */
  61 + transition: all .3s ease;
  62 +}
  63 +
  64 +.z-depth-3 {
  65 + box-shadow: 0 12px 15px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);
  66 +}
  67 +
  68 +.mapRightWrap::-webkit-scrollbar-thumb {
  69 + box-shadow: 0 0 0 5px rgba(231, 236, 241, 0.52) inset;
  70 +}
  71 +
  72 +.mapRightWrap.search .input-group input {
  73 + height: 48px;
  74 + background-color: #626775;
  75 + border: 1px solid #626775;
  76 + color: white;
  77 +}
  78 +
  79 +.mapRightWrap.search .input-group .input-group-btn button {
  80 + color: #FFFFFF;
  81 + background-color: #1BBC9B;
  82 + border-color: #1BBC9B;
  83 +}
  84 +
  85 +.mapRightWrap.search .input-group-btn button {
  86 + height: 48px;
  87 + width: 80px;
  88 + font-size: 15px;
  89 +}
  90 +
0 \ No newline at end of file 91 \ No newline at end of file
src/main/resources/static/pages/base/sectionspeed/css/real.css 0 → 100644
  1 +
  2 +.z-depth-1{
  3 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  4 +}
  5 +
  6 +.z-depth-2 {
  7 + box-shadow: 0 8px 17px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
  8 +}
  9 +
  10 +.z-depth-3 {
  11 + box-shadow: 0 12px 15px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);
  12 +}
  13 +
  14 +
  15 +
  16 +
  17 +
  18 +.mapRightWrap.vehicle .slimScrollBar{
  19 + width: 6px !important;
  20 + opacity: 0.5 !important;
  21 + background: #e7ecf1 !important;
  22 + border-radius: 5px !important;
  23 +}
  24 +
  25 +.mapRightWrap.vehicle a.fixed-line{
  26 + text-decoration: none;
  27 + position: fixed;
  28 + top: 218.5px;
  29 + width: 318px;
  30 + left: 1586px;
  31 + background-color: red;
  32 + z-index: 2;
  33 +}
  34 +
  35 +.mapRightWrap.vehicle a.fixed-line .head{
  36 + border-bottom: none;
  37 + margin: 15px 15px 10px 15px;
  38 +}
  39 +
  40 +.mapRightWrap.to_searchPanel{
  41 + transform:rotateY(180deg);
  42 + height: 200px;
  43 +}
  44 +
  45 +.mapRightWrap.to_vehicle{
  46 + transform:rotateY(180deg);
  47 + height: calc(100% - 110px);
  48 +}
  49 +
  50 +.mapRightWrap.to_playBack{
  51 + transform:rotateY(180deg);
  52 + min-height: 454px;
  53 + width: 390px;
  54 + height: auto;
  55 +}
  56 +
  57 +.mapRightWrap.playBack{
  58 + min-height: 374px;
  59 + width: 390px;
  60 + height: auto;
  61 +}
  62 +
  63 +/* .mapRightWrap.playBack form select{
  64 + width: 100%;
  65 +} */
  66 +
  67 +.mapRightWrap.playBack .alert{
  68 + font-size: 13px;
  69 + margin-top: 1px;
  70 + width: calc(100% - 2px);
  71 + margin-left: 1px;
  72 + border-radius: 4px 4px 0 0 !important;
  73 +}
  74 +
  75 +.mapRightWrap.vehicle{
  76 + height: calc(100% - 110px);
  77 + overflow: auto;
  78 + overflow-x: hidden;
  79 +}
  80 +
  81 +.mapRightWrap.search{
  82 + height: 47px;
  83 + padding-top: 0;
  84 + background-color: #626775 !important;
  85 +}
  86 +
  87 +.playBack form{
  88 + padding: 13px 20px 0 0;
  89 + color: #f5f3f3;
  90 +}
  91 +
  92 +.playBack .btn-lg{
  93 + padding: 8px 14px;
  94 + font-size: 16px;
  95 + border-radius: 4px !important;
  96 +}
  97 +
  98 +.playBack hr{
  99 + border-color: #5c6e86;
  100 +}
  101 +
  102 +.playBack form .control-label{
  103 + padding-right: 5px;
  104 + font-family: 微软雅黑;
  105 +}
  106 +
  107 +.playBack form .help-block{
  108 + color: #b6b6b6
  109 +}
  110 +
  111 +.mapRightWrap.search .input-group .input-group-btn button{
  112 + color: #FFFFFF;
  113 + background-color: #1BBC9B;
  114 + border-color: #1BBC9B;
  115 +}
  116 +
  117 +.mapRightWrap.search .input-group .input-group-btn button:hover{
  118 + background-color: #158f76;
  119 + border-color: #13866f;
  120 +}
  121 +
  122 +.mapRightWrap.search .input-group input{
  123 + height: 48px;
  124 + background-color: #626775;
  125 + border: 1px solid #626775;
  126 + color: white;
  127 +}
  128 +
  129 +.mapRightWrap.search .input-group-btn button{
  130 + height: 48px;
  131 + width: 80px;
  132 + font-size: 15px;
  133 +}
  134 +
  135 +.rotate0{
  136 + transform:rotateY(0deg) !important;
  137 +}
  138 +
  139 +.leftUtilsWrap{
  140 + padding-left: 28px;
  141 +}
  142 +
  143 +.leftUtils{
  144 + position: absolute;
  145 + width: 259px;
  146 + height: 40px;
  147 + background-color: #3B3F51;
  148 + z-index: 9999;
  149 + color: #ddd;
  150 + padding-top: 7px;
  151 + top: 20px;
  152 +
  153 + transition: all .5s ease;
  154 +}
  155 +
  156 +.leftUtils span.item{
  157 + line-height: 28px;
  158 + border-right: 1px solid #999;
  159 + padding-right: 10px;
  160 + padding-left: 15px;
  161 + cursor: pointer;
  162 + font-family: 微软雅黑;
  163 +}
  164 +
  165 +.leftUtils span.item:hover{
  166 + color: #fff;
  167 +}
  168 +
  169 +.leftUtils span.item:last-child{
  170 + border-right:none;
  171 +}
  172 +
  173 +.mapTools{
  174 + position: absolute;
  175 + width: 320px;
  176 + height: 60px;
  177 + right: 10px;
  178 + background-color: #3B3F51;
  179 + top: 20px;
  180 + transition: all .5s ease;
  181 +}
  182 +
  183 +.mapTools .item{
  184 + color: #999;
  185 + display: inline-block;
  186 + margin: 24px 0 0 18px;
  187 + font-weight: bold;
  188 + cursor: pointer;
  189 +}
  190 +
  191 +.mapTools.disable .item{
  192 + /* color: #625C5C; */
  193 +}
  194 +
  195 +.mapTools .item.active{
  196 + color: #e5e5e5;
  197 +}
  198 +
  199 +.mapTools .item:hover{
  200 + color: #e5e5e5;
  201 +}
  202 +
  203 +.mapTools .item i{
  204 + font-size: 20px;
  205 +}
  206 +
  207 +html{
  208 + overflow: hidden;
  209 +}
  210 +
  211 +.ctrlMenu {
  212 + position: absolute;
  213 + width: 52px;
  214 + height: 52px;
  215 + background: #3B3F51;
  216 + top: 3px;
  217 + color: white;
  218 + font-size: 12px;
  219 + padding-top: 7px;
  220 + border-radius: 0 2px 52px 0 !important;
  221 + padding-left: 8px;
  222 + font-family: 微软雅黑;
  223 + cursor: pointer;
  224 +}
  225 +
  226 +/* spinner load start ------------------------------- */
  227 +.spinner {
  228 + margin: 50px auto;
  229 + width: 50px;
  230 + height: 40px;
  231 + text-align: center;
  232 + font-size: 10px;
  233 +}
  234 +
  235 +.spinner > div {
  236 + background-color: #69D7E1;
  237 + height: 100%;
  238 + width: 6px;
  239 + display: inline-block;
  240 +
  241 + -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
  242 + animation: sk-stretchdelay 1.2s infinite ease-in-out;
  243 +}
  244 +
  245 +.spinner .rect2 {
  246 + -webkit-animation-delay: -1.1s;
  247 + animation-delay: -1.1s;
  248 +}
  249 +
  250 +.spinner .rect3 {
  251 + -webkit-animation-delay: -1.0s;
  252 + animation-delay: -1.0s;
  253 +}
  254 +
  255 +.spinner .rect4 {
  256 + -webkit-animation-delay: -0.9s;
  257 + animation-delay: -0.9s;
  258 +}
  259 +
  260 +.spinner .rect5 {
  261 + -webkit-animation-delay: -0.8s;
  262 + animation-delay: -0.8s;
  263 +}
  264 +
  265 +@-webkit-keyframes sk-stretchdelay {
  266 + 0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
  267 + 20% { -webkit-transform: scaleY(1.0) }
  268 +}
  269 +
  270 +@keyframes sk-stretchdelay {
  271 + 0%, 40%, 100% {
  272 + transform: scaleY(0.4);
  273 + -webkit-transform: scaleY(0.4);
  274 + } 20% {
  275 + transform: scaleY(1.0);
  276 + -webkit-transform: scaleY(1.0);
  277 + }
  278 +}
  279 +
  280 +.sk-cube-grid {
  281 + width: 40px;
  282 + height: 40px;
  283 + margin: 100px auto;
  284 +}
  285 +
  286 +.sk-cube-grid .sk-cube {
  287 + width: 33%;
  288 + height: 33%;
  289 + background-color: #69D7E1;
  290 + float: left;
  291 + -webkit-animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out;
  292 + animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out;
  293 +}
  294 +.sk-cube-grid .sk-cube1 {
  295 + -webkit-animation-delay: 0.2s;
  296 + animation-delay: 0.2s; }
  297 +.sk-cube-grid .sk-cube2 {
  298 + -webkit-animation-delay: 0.3s;
  299 + animation-delay: 0.3s; }
  300 +.sk-cube-grid .sk-cube3 {
  301 + -webkit-animation-delay: 0.4s;
  302 + animation-delay: 0.4s; }
  303 +.sk-cube-grid .sk-cube4 {
  304 + -webkit-animation-delay: 0.1s;
  305 + animation-delay: 0.1s; }
  306 +.sk-cube-grid .sk-cube5 {
  307 + -webkit-animation-delay: 0.2s;
  308 + animation-delay: 0.2s; }
  309 +.sk-cube-grid .sk-cube6 {
  310 + -webkit-animation-delay: 0.3s;
  311 + animation-delay: 0.3s; }
  312 +.sk-cube-grid .sk-cube7 {
  313 + -webkit-animation-delay: 0s;
  314 + animation-delay: 0s; }
  315 +.sk-cube-grid .sk-cube8 {
  316 + -webkit-animation-delay: 0.1s;
  317 + animation-delay: 0.1s; }
  318 +.sk-cube-grid .sk-cube9 {
  319 + -webkit-animation-delay: 0.2s;
  320 + animation-delay: 0.2s; }
  321 +
  322 +@-webkit-keyframes sk-cubeGridScaleDelay {
  323 + 0%, 70%, 100% {
  324 + -webkit-transform: scale3D(1, 1, 1);
  325 + transform: scale3D(1, 1, 1);
  326 + } 35% {
  327 + -webkit-transform: scale3D(0, 0, 1);
  328 + transform: scale3D(0, 0, 1);
  329 + }
  330 +}
  331 +
  332 +@keyframes sk-cubeGridScaleDelay {
  333 + 0%, 70%, 100% {
  334 + -webkit-transform: scale3D(1, 1, 1);
  335 + transform: scale3D(1, 1, 1);
  336 + } 35% {
  337 + -webkit-transform: scale3D(0, 0, 1);
  338 + transform: scale3D(0, 0, 1);
  339 + }
  340 +}
  341 +/* spinner load end ------------------------------- */
  342 +
  343 +.sk-cube-grid._center{
  344 + position: absolute;
  345 + top: 30%;
  346 + left: 50%;
  347 + transform: translate(-50%, -50%);
  348 + -webkit-transform: translate(-50%, -50%);
  349 +}
  350 +
  351 +.mapRightWrap.vehicle p.head{
  352 + color: #B7B7B7;
  353 + font-size: 18px;
  354 + border-bottom: 1px dashed #556471;
  355 + position: relative;
  356 + margin: 15px;
  357 + padding-bottom: 10px;
  358 + font-family: 微软;
  359 +}
  360 +
  361 +/* .mapRightWrap.vehicle p.head:hover{
  362 + box-shadow: 0 8px 17px 0 rgba(128, 123, 123, 0.2),0 6px 20px 0 rgba(86, 67, 67, 0.19);
  363 +}
  364 + */
  365 +.mapRightWrap.vehicle p.head>span.icon{
  366 + position: absolute;
  367 + right: 10px;
  368 + top: -6px;
  369 + font-size: 24px;
  370 + color: #7C8994;
  371 + transition: all .5s ease;
  372 +
  373 +}
  374 +
  375 +.mapRightWrap.vehicle p.head>span.icon.rotate{
  376 + transform:rotate(180deg);
  377 +}
  378 +
  379 +
  380 +.mapRightWrap.vehicle p.head>span.icon:hover{
  381 + color: #D8D5D5;
  382 +}
  383 +
  384 +.mapRightWrap.vehicle .vehicle-item{
  385 + position: relative;
  386 + color: #C7C7C7;
  387 + padding-left: 8px;
  388 + padding-top: 7px;
  389 + width: 90%;
  390 + margin: auto;
  391 + margin-top: 9px;
  392 + border-bottom: 1px solid #717070;
  393 +}
  394 +
  395 +.mapRightWrap.vehicle .vehicle-item div.text{
  396 + padding: 5px 0 11px 5px;
  397 + color: #aebbae;
  398 + -webkit-user-select: initial;
  399 +}
  400 +
  401 +.mapRightWrap.vehicle .vehicle-item div.text span.nbbm{
  402 + padding: 5px 5px;
  403 + cursor: pointer;
  404 +}
  405 +
  406 +.mapRightWrap.vehicle .vehicle-item.online_0 div.text span.nbbm{
  407 + color: #45D245;
  408 + font-size: 13px;
  409 +}
  410 +
  411 +.mapRightWrap.vehicle .vehicle-item.online_1 div.text span.nbbm{
  412 + color: #ff8375;
  413 +}
  414 +
  415 +
  416 +.mapRightWrap.vehicle .vehicle-item.online_0 div.text span.nbbm:hover{
  417 + color: #45D245;
  418 +}
  419 +
  420 +.mapRightWrap.vehicle .vehicle-item.online_1 div.text span.nbbm:hover{
  421 + color: #f16454;
  422 +}
  423 +
  424 +.mapRightWrap.vehicle .vehicle-item div.text span i{
  425 + font-size: 12px;
  426 +}
  427 +
  428 +/* .mapRightWrap.vehicle .vehicle-item.online div.text span i{
  429 + color: #45D245;
  430 +} */
  431 +
  432 +/* off line */
  433 +.mapRightWrap.vehicle .vehicle-item.offline div.text span i,
  434 +.mapRightWrap.vehicle .vehicle-item.offline div.text span,
  435 +.mapRightWrap.vehicle .vehicle-item.offline div.text{
  436 + color: #aca7a7;
  437 +}
  438 +
  439 +.mapRightWrap.vehicle .vehicle-item div.icon{
  440 + position: absolute;
  441 + right: 15px;
  442 + top: 10px;
  443 + cursor: pointer;
  444 +}
  445 +
  446 +.mapRightWrap.vehicle .vehicle-item div.icon:hover{
  447 + color: #fafafa;
  448 +}
  449 +
  450 +
  451 +.mapRightWrap .search_result{
  452 + position: absolute;
  453 + background: rgba(59, 92, 115,0.95);
  454 + width: 100%;
  455 + top: 60px;
  456 + color: #e5e5e5;
  457 +
  458 + max-height: 500px;
  459 + overflow: auto;
  460 +}
  461 +
  462 +.mapRightWrap .search_result::-webkit-scrollbar-thumb{
  463 + box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.2) inset;
  464 +}
  465 +
  466 +.mapRightWrap .search_result .result_item{
  467 + padding-left: 10px;
  468 + margin: 0;
  469 + padding: 10px;
  470 + cursor: pointer;
  471 +}
  472 +
  473 +.mapRightWrap .search_result .result_item:hover{
  474 + background: #59829e;
  475 + color: #fff;
  476 +}
  477 +
  478 +.mapRightWrap .search_result .result_item:hover span.sub_text{
  479 + color: #eee;
  480 +}
  481 +
  482 +.mapRightWrap .search_result .result_item span.sub_text{
  483 + color: #BBBABA;
  484 + margin-left: 5px;
  485 + font-size: 14px;
  486 +}
  487 +
  488 +.mapRightWrap .search_result .item_vehicle_list{
  489 + /* margin-bottom: 20px; */
  490 + /* border-bottom: 1px solid #F3F5F5; */
  491 +}
  492 +
  493 +.mapRightWrap .search_result .item_vehicle{
  494 + color: #fafcfb;
  495 +}
  496 +
  497 +.mapRightWrap .search_result .item_vehicle.state_online{
  498 + color: #84ffe4;
  499 + font-size: 15px;
  500 +}
  501 +
  502 +/* GaoDe style start------- */
  503 +.mapRightWrap.gaode{
  504 + background: #fff;
  505 + border-radius: 5px !important;
  506 +}
  507 +
  508 +.mapTools.gaode{
  509 + background: #0D9BF2;
  510 + border-radius: 5px !important;
  511 +}
  512 +
  513 +.mapTools.gaode .item{
  514 + color: #fff;
  515 +}
  516 +
  517 +.mapTools.gaode .item.active {
  518 + color: #e1e5ec;
  519 +}
  520 +
  521 +.leftUtils.gaode{
  522 + background: #fafafa;
  523 + border-radius: 5px !important;
  524 + color: #5A5858;
  525 +}
  526 +
  527 +.leftUtils.gaode span.item:hover{
  528 + color: #1C1B1B;
  529 +}
  530 +
  531 +.leftUtils.gaode span.item.active{
  532 + padding-left: 5px;
  533 + color: #0D9BF2;
  534 +}
  535 +
  536 +.leftUtils.gaode span.item.active:before{
  537 + content: "\f00c";
  538 + font: normal normal normal 14px/1 FontAwesome;
  539 +}
  540 +
  541 +.mapRightWrap.gaode.vehicle .vehicle-item{
  542 + background: #fdfdfd;
  543 + color: #2D2929;
  544 +}
  545 +
  546 +.mapRightWrap.gaode.vehicle .vehicle-item div.text {
  547 + color: #999;
  548 +}
  549 +
  550 +.mapRightWrap.gaode.vehicle .vehicle-item.online_0 div.text span {
  551 + color: #23a023;
  552 +}
  553 +
  554 +.mapRightWrap.gaode.playBack form {
  555 + color: #8e8282;
  556 +}
  557 +
  558 +.mapRightWrap.gaode.vehicle p.head{
  559 + border-bottom: 1px dashed #E2DFDF;
  560 + color: #7D7777;
  561 +}
  562 +
  563 +.mapRightWrap.vehicle.gaode p.head>span.icon>a{
  564 + color: #999;
  565 +}
  566 +
  567 +.mapRightWrap.vehicle.gaode p.head>span.icon>a:hover{
  568 + color: #555555;
  569 +}
  570 +
  571 +.mapRightWrap.vehicle.gaode .vehicle-item.offline div.text span i,
  572 +.mapRightWrap.vehicle.gaode .vehicle-item.offline div.text span,
  573 +.mapRightWrap.vehicle.gaode .vehicle-item.offline div.text{
  574 + color: #e43a45;
  575 +}
  576 +
  577 +.mapRightWrap.search.gaode .input-group input{
  578 + background-color: #fafafa;
  579 + border: 1px solid #fafafa;
  580 + color: #333333;
  581 +}
  582 +
  583 +.mapRightWrap.search.gaode .input-group .input-group-btn button{
  584 + background-color: #3598dc;
  585 + border-color: #3598dc;
  586 +}
  587 +
  588 +.mapRightWrap.search.gaode .input-group .input-group-btn button:hover{
  589 + background-color: #217ebd;
  590 + border-color: #1f78b5;
  591 +}
  592 +
  593 +.mapRightWrap.gaode .search_result{
  594 + background: rgba(250, 250, 250, 0.95);
  595 + color: #333333;
  596 +}
  597 +
  598 +.mapRightWrap.gaode .search_result .item_vehicle_list{
  599 + border-bottom: 1px solid #C7C7C7;
  600 +}
  601 +
  602 +.mapRightWrap.gaode .search_result .item_vehicle.state_online{
  603 + color: #3d3dec;
  604 +}
  605 +
  606 +.mapRightWrap.gaode .search_result .result_item span.sub_text{
  607 + color: #8E8D8D;
  608 +}
  609 +
  610 +.mapRightWrap.gaode .search_result .result_item:hover{
  611 + background: #ddd;
  612 + color: #333333;
  613 +}
  614 +
  615 +.mapRightWrap.gaode .search_result .item_vehicle{
  616 + color: #333333;
  617 +}
  618 +
  619 +.mapRightWrap.gaode.playBack hr{
  620 + border-color: #c5c5c5;
  621 +}
  622 +
  623 +.mapRightWrap.gaode .alert-info{
  624 + background-color: #ccc;
  625 + border-color: #ccc;
  626 + color: #555555;
  627 +}
  628 +/* GaoDe style end------- */
  629 +
  630 +
  631 +.map-gps-empty{
  632 + padding: 10px;
  633 + text-align: center;
  634 + color: #b37f7f;
  635 + border-bottom: 1px dashed #556471;
  636 + font-size: 13px;
  637 +}
  638 +
  639 +.mapRightWrap::-webkit-scrollbar-thumb {
  640 + box-shadow: 0 0 0 5px rgba(231, 236, 241, 0.52) inset;
  641 +}
  642 +
  643 +.gps_info_win{
  644 + width: 190px;
  645 + overflow: hidden;
  646 +}
  647 +
  648 +.gps_info_win p{
  649 + margin-bottom: 13px;
  650 + font-size: 13px;
  651 +}
  652 +
  653 +.play-back-list{
  654 + display: none;
  655 + position: absolute;
  656 + width: 295px;
  657 + right: 5px;
  658 + z-index: 9999;
  659 + height: calc(100% - 50px);
  660 + top: 25px;
  661 + padding: 15px 7px 3px;
  662 + background: #2d2b2b;
  663 + border-radius: 5px !important;
  664 +}
  665 +
  666 +.progress-wrap{
  667 + width: calc(100% - 340px);
  668 + height: 10px;
  669 + bottom: 33px;
  670 + left: 20px;
  671 + position: absolute;
  672 + display: none;
  673 +}
  674 +
  675 +.play-back-progress{
  676 + position: absolute;
  677 + height: 10px;
  678 + border-radius: 12px !important;
  679 + cursor: pointer;
  680 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  681 + border: 1px solid #d0d0d0;
  682 + background: white;
  683 + width: 100%;
  684 +}
  685 +
  686 +.progress-body{
  687 + width: 100%;
  688 + height: 100%;
  689 + position: relative;
  690 +}
  691 +
  692 +.play-back-progress-mark{
  693 + position: absolute;
  694 + height: 10px;
  695 + z-index: 10000;
  696 + border-radius: 12px 0 0 12px !important;
  697 + background: #2d2b2b;
  698 + width: 0;
  699 + cursor: pointer;
  700 +
  701 + /* transition: all 1s ease; */
  702 +}
  703 +
  704 +.play-back-btns{
  705 + display: none;
  706 + background: #2d2b2b;
  707 + width: 285px;
  708 + height: 44px;
  709 + position: absolute;
  710 + right: 320px;
  711 + bottom: 58px;
  712 + padding: 9px 0 0 18px;
  713 + border-radius: 15px !important;
  714 +}
  715 +
  716 +.play-back-btns .dropup{
  717 + display: inline-block;
  718 +}
  719 +
  720 +.play-back-btns .dropdown-menu{
  721 + min-width: 80px;
  722 + width: 80px;
  723 +}
  724 +
  725 +.play-back-btns>i.playBtn{
  726 + font-size: 28px;
  727 + margin-right: 7px;
  728 + cursor: pointer;
  729 + color: white;
  730 + vertical-align: middle;
  731 +}
  732 +
  733 +.play-back-btns>i.playBtn:HOVER{
  734 + color: #e0e1e1;
  735 +}
  736 +
  737 +.play-back-btns>i.fa-pause{
  738 + font-size: 26px;
  739 + margin-right: 8px;
  740 +}
  741 +
  742 +.pback-logs{
  743 + color: white;
  744 +}
  745 +
  746 +.pback-logs-item.out{
  747 + color: #f58f83;
  748 +}
  749 +
  750 +.pback-logs-item.in{
  751 + color: #8181d4;
  752 +}
  753 +
  754 +.pback-logs-item{
  755 + padding: 8px 12px;
  756 + border-bottom: 1px dashed #d2d2d2;
  757 +}
  758 +
  759 +.pback-logs-item-date{
  760 + font-size: 13px;
  761 + display: block;
  762 + text-align: left;
  763 + color: #a2a2a2;
  764 +}
  765 +
  766 +.play-back-list .slimScrollBar{
  767 + background: rgb(167, 170, 169) !important;
  768 + border-radius: 7px !important;
  769 +}
  770 +
  771 +.progress-mark-info{
  772 + position: absolute;
  773 + width: 62px;
  774 + height: 27px;
  775 + z-index: 10000;
  776 + background: #2d2b2b;
  777 + display: none;
  778 + top: -30px;
  779 + padding: 4px 3px;
  780 + color: white;
  781 +}
  782 +
  783 +#progress-mark-time{
  784 + /* transition: all 1s ease; */
  785 + top: 12px;
  786 +}
  787 +
  788 +#progress-mark-time-mouse{
  789 + background: #aeaeae;
  790 +}
  791 +
  792 +/* #playSpeed{
  793 + font-size: 15px;
  794 + vertical-align: middle;
  795 + font-weight: 600;
  796 + margin-right: 5px;
  797 + color: #c7c7c7;
  798 + padding: 4px 8px 4px 13px;
  799 + cursor: pointer;
  800 + border-left: 1px solid #4b4a4a;
  801 + border-right: 1px solid #4b4a4a;
  802 +} */
  803 +
  804 +.angle-up-item{
  805 + font-size: 15px;
  806 + vertical-align: middle;
  807 + font-weight: 600;
  808 + margin-right: 5px;
  809 + color: #c7c7c7;
  810 + padding: 10px 3px 10px 8px;
  811 + cursor: pointer;
  812 + border-left: 1px solid #4b4a4a;
  813 +}
  814 +
  815 +#bufferArea.angle-up-item{
  816 + font-weight: 400;
  817 + font-size: 13px;
  818 + border-right: 1px solid #4b4a4a;
  819 + padding-right: 12px;
  820 +}
  821 +
  822 +.angle-up-item:HOVER{
  823 + background: #484949;
  824 +}
  825 +
  826 +.play-back-close{
  827 + font-family: 微软雅黑;
  828 + font-weight: 600;
  829 +}
  830 +
  831 +#playSpeed .fa-angle-up{
  832 + color: #5f5d5d;
  833 + margin-left: 7px;
  834 +}
  835 +
  836 +/* #playSpeed:HOVER{
  837 + background: #484949;
  838 +} */
  839 +
  840 +#playSpeedText{
  841 + display: inline-block;
  842 + width: 20px;
  843 + text-align: center;
  844 +}
  845 +
  846 +/* #playSpeed i{
  847 + color: #5f5d5d;
  848 + margin-left: 7px;
  849 +} */
  850 +
  851 +.layui-layer-msg.layer-bg-green{
  852 + background: #1bbc9b;
  853 + border: 1px solid #1bbc9b;
  854 + color: white;
  855 +}
  856 +
  857 +.layui-layer-msg.layer-bg-red{
  858 + background: red;
  859 + border: 1px solid red;
  860 + color: white;
  861 +}
  862 +
  863 +#bufferAreaWrap{
  864 + display: none;
  865 +}
  866 +
  867 +#bufferAreaConfigPanel ul.list{
  868 + list-style-type:none;
  869 +}
  870 +
  871 +#bufferAreaConfigPanel ul.list li{
  872 + margin: 7px;
  873 +}
  874 +
  875 +#bufferAreaConfigPanel ul.list li:FIRST-CHILD {
  876 + margin-top: 0px;
  877 +}
0 \ No newline at end of file 878 \ No newline at end of file
src/main/resources/static/pages/base/sectionspeed/edit_road_mobal.html 0 → 100644
  1 +<div class="modal fade" id="edit_road_mobal" tabindex="-1" role="basic" aria-hidden="true">
  2 +
  3 + <div class="modal-dialog">
  4 +
  5 + <div class="modal-content">
  6 +
  7 + <div class="modal-header">
  8 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  9 + <h4 class="modal-title">选择修改站点方式</h4>
  10 + </div>
  11 +
  12 + <div class="modal-body">
  13 +
  14 + <form class="form-horizontal" action="/" method="post" id="edit_road_form" role="form">
  15 +
  16 + <div class="alert alert-danger display-hide" id="editRoadFormError">
  17 + <button class="close" data-close="alert"></button>
  18 + 站点名称为必填项
  19 + </div>
  20 +
  21 + <div class="alert alert-danger display-hide" id="serchrname">
  22 + <button class="close" data-close="alert"></button>
  23 + 系统无法生成,请选择其他方式新增
  24 + </div>
  25 +
  26 + <input type="hidden" name="sSpeedId" id="sSpeedIdInput">
  27 +
  28 + <input type="hidden" name="id" id="idInput">
  29 +
  30 + <div class="form-group" id="formRequ">
  31 + <label class="col-md-3 control-label"><span class="required"> * </span>路段名称:</label>
  32 + <div class="col-md-9" id="errorInfo">
  33 + <input type="text" class="form-control input-medium" id="roadNameInput" name="roadName">
  34 + </div>
  35 + </div>
  36 +
  37 + <div class="form-group" id="formRequ">
  38 + <label class="col-md-3 control-label"><span class="required"> * </span>路段序号:</label>
  39 + <div class="col-md-9" id="errorInfo">
  40 + <input type="text" class="form-control input-medium" id="codeInput" name="code">
  41 + </div>
  42 + </div>
  43 +
  44 + <div class="form-group" id="formRequ">
  45 + <label class="col-md-3 control-label"><span class="required"> * </span>路段限速:</label>
  46 + <div class="col-md-9" id="errorInfo">
  47 + <input type="text" class="form-control input-medium" id="speedInput" name="speed">
  48 + </div>
  49 + </div>
  50 +
  51 + </form>
  52 + </div>
  53 + <div class="modal-footer">
  54 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  55 + <button type="button" class="btn btn-primary" id="edit-road-sbmt">提交</button>
  56 + </div>
  57 + </div>
  58 + </div>
  59 +</div>
  60 +<script type="text/javascript">
  61 +
  62 +$('#edit_road_mobal').on('editRoadMobal_show', function(e,objP){
  63 + // 显示选择修改方式弹出层
  64 + $('#edit_road_mobal').modal({show : true,backdrop: 'static',keyboard: false});
  65 +
  66 + $('#roadNameInput').val(objP.name);
  67 +
  68 + $('#speedInput').val(objP.sValue);
  69 +
  70 + $('#sSpeedIdInput').val(objP.id);
  71 +
  72 + $('#idInput').val(objP.roadId)
  73 +
  74 + $('#codeInput').val(objP.code);
  75 +
  76 + // 获取表单元素
  77 + var form = $('#edit_road_form');
  78 +
  79 + // 获取错误提示元素
  80 + var editSelectrequired = $('#editRoadFormError', form);
  81 +
  82 + // 提交数据按钮事件
  83 + $('#edit-road-sbmt').on('click', function() {
  84 +
  85 + // 表单提交
  86 + form.submit();
  87 +
  88 + });
  89 +
  90 + //form 表单验证
  91 + form.validate({
  92 +
  93 + errorElement : 'span',
  94 +
  95 + errorClass : 'help-block help-block-error',
  96 +
  97 + focusInvalid : false,
  98 +
  99 + rules : {
  100 +
  101 + 'roadName' : {
  102 +
  103 + required : true
  104 +
  105 + },
  106 +
  107 + 'code' : {
  108 +
  109 + required : true
  110 +
  111 + },
  112 +
  113 + 'speed' : {
  114 +
  115 + required : true
  116 +
  117 + }
  118 +
  119 + },
  120 +
  121 + invalidHandler : function(event, validator) {
  122 +
  123 + editSelectrequired.show();
  124 +
  125 + App.scrollTo(editSelectrequired, -200);
  126 +
  127 + },
  128 +
  129 + highlight : function(element) {
  130 +
  131 + $(element).closest('.form-group').addClass('has-error');
  132 +
  133 + },
  134 +
  135 + unhighlight : function(element) {
  136 +
  137 + $(element).closest('.form-group').removeClass('has-error');
  138 +
  139 + },
  140 +
  141 + success : function(label) {
  142 +
  143 + label.closest('.form-group').removeClass('has-error');
  144 +
  145 + },
  146 +
  147 + submitHandler : function(f) {
  148 +
  149 + // 隐藏弹出层
  150 + $('#edit_road_mobal').modal('hide');
  151 +
  152 + // 表单序列
  153 + var params = form.serializeJSON();
  154 +
  155 + $post('/sectionspeed/roadUpd', params, function(result) {
  156 +
  157 + // 如果返回结果不为空
  158 + if(result){
  159 +
  160 + // 返回状态码为"SUCCESS" ,则修改成功;返回状态码为"ERROR" ,则修改失败
  161 + if(result.status=='SUCCESS') {
  162 +
  163 + // 弹出修改成功提示消息
  164 + layer.msg('修改成功...');
  165 +
  166 + var seachP = {'lineId':objP.lineId,'lineCode':objP.lineCode,'directions':objP.directions};
  167 + /** 列出路段 */
  168 + PublicFunctions.getSectionSpeedInfoList(seachP,objP.lineName);
  169 +
  170 + } else if(result.status=='ERROR') {
  171 +
  172 + // 弹出修改失败提示消息
  173 + layer.msg('修改失败...');
  174 +
  175 + }
  176 + }
  177 +
  178 + });
  179 + }
  180 + });
  181 +})
  182 +</script>
0 \ No newline at end of file 183 \ No newline at end of file
src/main/resources/static/pages/base/sectionspeed/js/events.js 0 → 100644
  1 +$(function(){
  2 +
  3 + /** 搜索事件 */
  4 + $('#search-btn').on('click',function() {
  5 +
  6 + /** 获取搜索框的值 */
  7 + var lineValueStr = $('#realSearchInput').val();
  8 +
  9 + /** 获取线路名称 */
  10 + var lineName = $("#realSearchInput").select2('data')[0].text;
  11 +
  12 + if(lineValueStr==''){
  13 +
  14 + // 弹出提示消息
  15 + layer.msg('请选择线路...');
  16 +
  17 + return false;
  18 +
  19 + }
  20 +
  21 + /** 切割 */
  22 + var array = lineValueStr.split('_');
  23 +
  24 + /** 线路ID */
  25 + var line = array[0];
  26 +
  27 + /** 方向 */
  28 + var dirc = array[2];
  29 +
  30 + /** 清楚地图覆盖物 */
  31 + SectionSpeedVmapWorlds.clearMarkAndOverlays();
  32 +
  33 + /** 获取线路走向百度坐标 */
  34 + PublicFunctions.getSectionRouteInfo(line,dirc,function(data) {
  35 +
  36 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:上行路段数据> */
  37 + PublicFunctions.linePanlThree(line,data,dirc);
  38 +
  39 + });
  40 +
  41 + var params = {'lineId':array[0],'lineCode':array[1],'directions':array[2]};
  42 + /** 列出路段 */
  43 + PublicFunctions.getSectionSpeedInfoList(params,lineName);
  44 +
  45 + });
  46 +
  47 + $('.mapRightWrap').on('click','#line-jxld',function() {
  48 +
  49 + $('.gps-line-wrap').hide();
  50 +
  51 + $('.flipInX').show();
  52 +
  53 + // 弹出正在加载层
  54 + var index = layer.load(0,{offset:['400px', '85%']});
  55 +
  56 + var id = $('#line-id').val();
  57 +
  58 + var dc = $('#line-dirc').val();
  59 +
  60 + var argus = $('input[name="argus"]:checked').val();
  61 +
  62 + var lineCode = $('#line-code').val();
  63 +
  64 + if(argus ==undefined)
  65 + argus = 0;
  66 +
  67 + PublicFunctions.getAnalyticSection(id,dc,argus,lineCode,function(data) {
  68 +
  69 + layer.close(index);
  70 +
  71 + $('.flipInX').hide();
  72 +
  73 + if(data != null)
  74 + PublicFunctions.analyticSection(data);
  75 +
  76 + /** 获取线路名称 */
  77 + var lineName = $("#realSearchInput").select2('data')[0].text;
  78 +
  79 + /** 列出路段 */
  80 + var params = {'lineId':id,'lineCode':lineCode,'directions':dc};
  81 + PublicFunctions.getSectionSpeedInfoList(params,lineName);
  82 +
  83 + });
  84 + });
  85 +
  86 + $('.mapRightWrap').on('click', '.goto-marker', function() {
  87 +
  88 + var lineStr = $(this).data('deviceid');
  89 +
  90 + var subStr = lineStr.substring(lineStr.indexOf("(")+1,lineStr.length-1);
  91 +
  92 + // 分割折线坐标字符串
  93 + var lineArray = subStr.split(',');
  94 +
  95 + // 地图折线坐标点集合
  96 + var polylineArray = [];
  97 +
  98 + for(var i = 0;i<lineArray.length;i++) {
  99 +
  100 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
  101 +
  102 + }
  103 +
  104 + /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */
  105 + SectionSpeedVmapWorlds.drawingSecitons(polylineArray);
  106 +
  107 + });
  108 +
  109 + $('.mapRightWrap').on('click', '.edit', function() {
  110 +
  111 + var id = $(this).data('id');
  112 +
  113 + var name = $(this).data('name');
  114 +
  115 + var sValue = $(this).data('svalue');
  116 +
  117 + var code = $(this).data('code');
  118 +
  119 + var roadId = $(this).data('road');
  120 +
  121 + var line = $(this).data('line');
  122 +
  123 + var linecode = $(this).data('linecode');
  124 +
  125 + var directions = $(this).data('directions');
  126 + /** 获取线路名称 */
  127 + var lineName = $("#realSearchInput").select2('data')[0].text;
  128 +
  129 + var objP = {'id':id,'name':name,'sValue':sValue,'code':code,'roadId':roadId,'lineId':line,'lineCode':linecode,'directions':directions,'lineName':lineName};
  130 +
  131 + $.get('edit_road_mobal.html', function(m){
  132 +
  133 + $(pjaxContainer).append(m);
  134 +
  135 + $('#edit_road_mobal').trigger('editRoadMobal_show', [objP]);
  136 + });
  137 + });
  138 +
  139 +});
0 \ No newline at end of file 140 \ No newline at end of file
src/main/resources/static/pages/base/sectionspeed/js/function.js 0 → 100644
  1 +var PublicFunctions = function () {
  2 +
  3 + var PubFun = {
  4 +
  5 + /** 获取所有线路 */
  6 + getLineAllInfo : function(cb) {
  7 +
  8 + /** get请求获取所有线路 */
  9 + $get('/line/all', null, function(array){return cb && cb(array);});
  10 +
  11 + },
  12 +
  13 + /** 获取线路走向百度坐标 */
  14 + getSectionRouteInfo : function(lineId,direction,callback) {
  15 +
  16 + $get('/sectionroute/findSection',{'line.id_eq' : lineId , 'directions_eq' : direction},function(resultdata) {
  17 +
  18 + callback && callback(resultdata);
  19 +
  20 + });
  21 +
  22 + },
  23 +
  24 + getSectionSpeedInfoList : function(params,lineName){
  25 +
  26 + $get('/sectionspeed/getSectionSpeedInfoList',params,function(rs) {
  27 +
  28 + $('#vehicle').show();
  29 +
  30 + var resultHtml = template('vehicle_panel_collapse_temp', {list: rs,lineName:lineName,lineId:params.lineId,dirc:params.directions,lineCode:params.lineCode});
  31 +
  32 + $('#vehicle').html(resultHtml);
  33 +
  34 + });
  35 +
  36 + },
  37 +
  38 + getAnalyticSection : function(lineId,direction,argus,lineCode,callback) {
  39 + $get('/sectionspeed/analyticSection',{'line.id_eq' : lineId , 'directions_eq' : direction,'argus':argus,'lineCode':lineCode},function(resultdata) {
  40 +
  41 + callback && callback(resultdata);
  42 +
  43 + });
  44 +
  45 + },
  46 +
  47 + // 查询线路某方向下所有站点的中心百度坐标
  48 + getStationRoutePoint : function(id_,dir_,callback) {
  49 +
  50 + $get('/stationroute/getStationRouteCenterPoints',{lineId:id_,direction:dir_},function(result) {
  51 +
  52 + callback && callback(result);
  53 +
  54 + });
  55 +
  56 + },
  57 +
  58 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:上行路段数据> */
  59 + linePanlThree : function(lineId,data,direction) {
  60 +
  61 + /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */
  62 + PublicFunctions.getStationRoutePoint(lineId,direction,function(resultdata) {
  63 +
  64 + SectionSpeedVmapWorlds.clearMarkAndOverlays();
  65 +
  66 + // 路段数据长度
  67 + var dataLen = data.length;
  68 +
  69 + // 如果大于零
  70 + if(dataLen>0) {
  71 +
  72 + // 地图折线坐标点集合
  73 + var polylineArray = [];
  74 +
  75 + // 编辑路段数据
  76 + for(var d= 0; d<dataLen;d++){
  77 +
  78 + // 获取路段折线坐标字符串
  79 + var sectionBsectionVectorStr = data[d].sectionBsectionVector;
  80 +
  81 + if(sectionBsectionVectorStr==null) {
  82 +
  83 + continue;
  84 +
  85 + }
  86 +
  87 + // 切割段折线坐标字符串
  88 + var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1);
  89 +
  90 + // 分割折线坐标字符串
  91 + var lineArray = tempStr.split(',');
  92 +
  93 + for(var i = 0;i<lineArray.length;i++) {
  94 +
  95 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
  96 +
  97 + }
  98 +
  99 + }
  100 +
  101 + /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */
  102 + SectionSpeedVmapWorlds.drawingUpline(polylineArray,resultdata);
  103 +
  104 + // 如果站点路由数据不为空
  105 + if(resultdata.length>0) {
  106 +
  107 + // 遍历站点路由数据
  108 + for(var s = 0 ; s<resultdata.length;s++) {
  109 +
  110 + // 中心点坐标字符串
  111 + var bJwpointsStr = resultdata[s].bJwpoints;
  112 +
  113 + var stationName = resultdata[s].stationName;
  114 +
  115 + // 起个中心点坐标字符串
  116 + var bJwpointsArray = bJwpointsStr.split(' ');
  117 +
  118 + // 设置中心点
  119 + var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]);
  120 +
  121 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  122 + SectionSpeedVmapWorlds.drawingUpStationPoint(point_center,stationName,s+1);
  123 +
  124 + }
  125 +
  126 + }
  127 +
  128 + }
  129 +
  130 + });
  131 +
  132 + },
  133 +
  134 + analyticSection : function(dataLen) {
  135 +
  136 + // 编辑路段数据
  137 + for(var d= 0; d<dataLen.length;d++){
  138 +
  139 + // 地图折线坐标点集合
  140 + var polylineArray = [];
  141 +
  142 + // 获取路段折线坐标字符串
  143 + var sectionBsectionVectorStr = dataLen[d].linestring;
  144 +
  145 + if(sectionBsectionVectorStr==null) {
  146 +
  147 + continue;
  148 +
  149 + }
  150 +
  151 + // 切割段折线坐标字符串
  152 + var tempStr = sectionBsectionVectorStr.substring(sectionBsectionVectorStr.indexOf("(")+1,sectionBsectionVectorStr.length-1);
  153 +
  154 + // 分割折线坐标字符串
  155 + var lineArray = tempStr.split(',');
  156 +
  157 + for(var i = 0;i<lineArray.length;i++) {
  158 +
  159 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
  160 +
  161 + }
  162 +
  163 + /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */
  164 + SectionSpeedVmapWorlds.drawingSecitons(polylineArray);
  165 +
  166 + }
  167 +
  168 + }
  169 +
  170 + }
  171 +
  172 + return PubFun ;
  173 +
  174 +}();
0 \ No newline at end of file 175 \ No newline at end of file
src/main/resources/static/pages/base/sectionspeed/js/map.js 0 → 100644
  1 +/**
  2 + * @description TODO(路段限速地图JS模块)
  3 + *
  4 + * @author bsth@lq
  5 + *
  6 + * @date 二〇一六年十月二十一日 15:34:33
  7 + *
  8 + */
  9 +
  10 +var SectionSpeedVmapWorlds = function() {
  11 +
  12 + /** 路段限速地图JS模块下的全局变量 <mapB:地图对象;drawingManager:鼠标绘制对象;polyUpline:线路走向对象;bitsPolyline:路段对象> */
  13 + var mapB = '', drawingManager = '',polyUpline = '',bitsPolyline='';
  14 +
  15 + var overlays = [];
  16 +
  17 + /** 路段限速地图JS模块下的全局变量---鼠标绘制参数
  18 + * <strokeColor:边线颜色;
  19 + * fillColor:填充颜色。当参数为空时,圆形将没有填充效果;
  20 + * strokeWeight: 边线的宽度,以像素为单位
  21 + * strokeOpacity:边线透明度,取值范围0 - 1;
  22 + * fillOpacity:填充的透明度,取值范围0 - 1;
  23 + * strokeStyle:边线的样式,solid或dashed> */
  24 + var styleOptions = {strokeColor : "red", fillColor : "red", strokeWeight : 3,strokeOpacity : 0.8,fillOpacity : 0.6, strokeStyle : 'solid'};
  25 +
  26 + /** 鼠标工具参数
  27 + * <anchor:位置;
  28 + * offset:偏离值;
  29 + * scale:工具栏缩放比例;
  30 + * drawingModes:工具模型> */
  31 + var drawingToolOptions = {anchor : BMAP_ANCHOR_TOP_LEFT, offset : new BMap.Size(80, 5),scale : 0.8,drawingModes:[BMAP_DRAWING_POLYLINE]};
  32 +
  33 + /** 路段限速地图JS模块下的全局变量---鼠标监听时间参数
  34 + * <isOpen:是否开启绘制模式;
  35 + * enableDrawingTool:是否显示工具栏;
  36 + * drawingToolOptions:鼠标工具参数;
  37 + * polylineOptions:线的样式> */
  38 + var drawingManagerOptions = {isOpen : false,enableDrawingTool : false,drawingToolOptions : drawingToolOptions,polylineOptions : styleOptions,}
  39 +
  40 + /** 鼠标监听事件 */
  41 + function addDrawingManagerEvent(e,overlay) {}
  42 +
  43 + /** 地图绘制地图走向参数 */
  44 + var polylineOptions = {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5};
  45 +
  46 + /** 自定义标注物图片 */
  47 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10));
  48 +
  49 + /** 创建标注物参数 */
  50 + var RichMarkerOptions = {"anchor" : new BMap.Size(-10,8), "enableDragging" : true};
  51 +
  52 + var Bmap = {
  53 +
  54 + /** 初始化地图 */
  55 + init : function() {
  56 +
  57 + /** 设置中心点 */
  58 + var CENTER_POINT = {lng : 121.528733,lat : 31.237425};
  59 +
  60 + /** 百度API Key */
  61 + var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT';
  62 +
  63 + /** 初始化百度地图 */
  64 + mapB = new BMap.Map("mapContainer",{enableMapClick:false});
  65 +
  66 + /** 中心点和缩放级别 */
  67 + mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);
  68 +
  69 + /** 启用地图拖拽事件,默认启用(可不写) */
  70 + mapB.enableDragging();
  71 +
  72 + /** 启用地图滚轮放大缩小 */
  73 + mapB.enableScrollWheelZoom();
  74 +
  75 + /** 禁用鼠标双击放大 */
  76 + mapB.disableDoubleClickZoom();
  77 +
  78 + /** 启用键盘上下左右键移动地图 */
  79 + mapB.enableKeyboard();
  80 +
  81 + /** 创建鼠标绘制管理类 */
  82 + // drawingManager = new BMapLib.DrawingManager(mapB, drawingManagerOptions);
  83 +
  84 + /** 添加绘画完成事件 */
  85 + // drawingManager.addEventListener('polylinecomplete', addDrawingManagerEvent);
  86 +
  87 + return mapB;
  88 + },
  89 +
  90 + /** 关闭信息窗口 */
  91 + closeMapInfoWin:function() {
  92 +
  93 + mapB.closeInfoWindow();
  94 +
  95 + },
  96 +
  97 + /** 在地图上画出线路走向 */
  98 + drawingUpline : function (polylineArray,resultdata) {
  99 +
  100 + /** 创建线路走向 */
  101 + polyUpline = new BMap.Polyline(polylineArray,polylineOptions);
  102 +
  103 + /** 把折线添加到地图上 */
  104 + mapB.addOverlay(polyUpline);
  105 +
  106 + var ceter_index = Math.round(resultdata.length / 2);
  107 +
  108 + var ceterPointsStr = resultdata[ceter_index].bJwpoints;
  109 +
  110 + var ceterPointsArray = ceterPointsStr.split(' ');
  111 +
  112 + var polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);
  113 +
  114 + var PanOptions_ ={noAnimation :true};
  115 +
  116 + mapB.reset();
  117 +
  118 + mapB.panTo(polyline_center,PanOptions_);
  119 +
  120 + mapB.setZoom(14);
  121 +
  122 + },
  123 +
  124 + /** 在地图上画出路段 */
  125 + drawingSecitons : function(polylineArray) {
  126 +
  127 + /** 创建路段 */
  128 + bitsPolyline = new BMap.Polyline(polylineArray, {strokeColor : "red",strokeWeight : 6,strokeOpacity : 0.5});
  129 +
  130 + /** 把路段添加到地图上 */
  131 + mapB.addOverlay(bitsPolyline);
  132 + },
  133 +
  134 +
  135 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  136 + drawingUpStationPoint : function(point_center,stationName,s) {
  137 +
  138 + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">'
  139 + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
  140 + + '</div>'
  141 + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>';
  142 +
  143 +
  144 + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,RichMarkerOptions);
  145 +
  146 + myRichMarker1.disableDragging();
  147 +
  148 + mapB.addOverlay(myRichMarker1);
  149 +
  150 + /** 创建标注物 */
  151 + marker = new BMap.Marker(point_center,{icon : icon_target});
  152 +
  153 + /** 允许覆盖物在map.clearOverlays方法中被清除。 */
  154 + marker.enableMassClear();
  155 +
  156 + /** 添加 */
  157 + mapB.addOverlay(marker);
  158 + },
  159 +
  160 + /** 清除地图覆盖物 */
  161 + clearMarkAndOverlays : function() {
  162 +
  163 + // 清楚地图覆盖物
  164 + mapB.clearOverlays();
  165 +
  166 + mapB.removeOverlay();
  167 +
  168 + }
  169 +
  170 + }
  171 +
  172 + return Bmap;
  173 +
  174 +}();
0 \ No newline at end of file 175 \ No newline at end of file
src/main/resources/static/pages/base/sectionspeed/js/reload.js 0 → 100644
  1 +/**
  2 + *
  3 + * @Author : bsth@lq
  4 + *
  5 + * @Description : TODO(路段限速初始化加载ldxs.html页面JS模块)
  6 + *
  7 + * @Data : 二〇一六年十月二十一日 15:28:48
  8 + *
  9 + * @Version 公交调度系统BS版 0.1
  10 + *
  11 + */
  12 +
  13 +(function(){
  14 +
  15 + /** 关闭左侧栏 */
  16 + if (!$('body').hasClass('page-sidebar-closed'))
  17 + $('.menu-toggler.sidebar-toggler').click();
  18 +
  19 + /** 延迟(500毫秒)加载 */
  20 + setTimeout(function(){
  21 +
  22 + /** 地图初始化 */
  23 + var mapB = SectionSpeedVmapWorlds.init();
  24 +
  25 + /** 线路下拉框初始化 */
  26 + PublicFunctions.getLineAllInfo(function(array) {
  27 +
  28 + var opGroup = '<option value="">请选择...</option><optgroup label="上行">';
  29 +
  30 + var len_ = array.length;
  31 +
  32 + if(len_>0) {
  33 +
  34 + $.each(array, function(i, g){
  35 +
  36 + opGroup += '<option value="'+ g.id + '_' + g.lineCode +'_0' +'">'+g.name+'</option>';
  37 +
  38 + });
  39 +
  40 + }
  41 +
  42 + opGroup += '</optgroup>';
  43 +
  44 + opGroup += '<optgroup label="下行">';
  45 +
  46 + if(len_>0) {
  47 +
  48 + $.each(array, function(i, g){
  49 +
  50 + opGroup += '<option value="'+ g.id + '_' + g.lineCode +'_1' +'">'+g.name+'</option>';
  51 +
  52 + });
  53 +
  54 + }
  55 +
  56 + opGroup += '</optgroup>';
  57 +
  58 + $('#realSearchInput').html(opGroup).select2();
  59 +
  60 + });
  61 +
  62 + }, 500);
  63 +
  64 +})();
0 \ No newline at end of file 65 \ No newline at end of file
src/main/resources/static/pages/base/sectionspeed/ldxs.html 0 → 100644
  1 +<link href="/pages/base/sectionspeed/css/addmap.css" rel="stylesheet" type="text/css" />
  2 +
  3 +<link href="/pages/base/sectionspeed/css/real.css" rel="stylesheet" type="text/css" />
  4 +
  5 +<!-- 地图容器 -->
  6 +<div id="mapContainer"></div>
  7 +
  8 +<!-- 搜索框 -->
  9 +<div class="mapRightWrap z-depth-3 search" style="top: 35px;">
  10 + <div class="input-group">
  11 + <select name="line" class="form-control" style="width:100%" id="realSearchInput"></select>
  12 + <span class="input-group-btn">
  13 + <button class="btn" type="button" id="search-btn"><i class="fa fa-search"></i> 搜索</button>
  14 + </span>
  15 + </div>
  16 +</div>
  17 +
  18 +<div class="mapRightWrap z-depth-3 vehicle" id="vehicle" style="display:none"></div>
  19 +
  20 +<script id="vehicle_panel_collapse_temp" type="text/html">
  21 +<div class="alert alert-info animated flipInX" style="display:none">
  22 +<i class="fa fa-exclamation-circle"></i> 线路正在解析中...可能需要等待些时间</div>
  23 +<div class="gps-line-wrap">
  24 +
  25 +<p class="head">
  26 + {{lineName}}
  27 +</p>
  28 +{{each list as obj i}}
  29 + <div class="vehicle-item {{if obj.directions==0}}online_{{obj.directions}}{{else}}offline{{/if}}" >
  30 + <div class="text">
  31 + <span class="nbbm goto-marker" data-deviceId="{{obj.bLineStr}}" data-road="{{obj.road}}">
  32 + <i class="fa fa-circle"></i> &nbsp;{{obj.xh}}、{{obj.s_name}}</span>
  33 +
  34 + <span style="font-size: 13px;">&nbsp;限速:{{obj.s_value}}</span>
  35 +
  36 + <a href="javascript:;" class="btn default red-stripe edit"
  37 + data-line="{{obj.line}}"
  38 + data-linecode="{{obj.line_code}}"
  39 + data-directions="{{obj.directions}}"
  40 + data-road = "{{obj.road}}"
  41 + data-id="{{obj.id}}"
  42 + data-name="{{obj.s_name}}"
  43 + data-svalue="{{obj.s_value}}"
  44 + data-code="{{obj.xh}}" style="padding: 3px 5px; margin-left: 4px;"> 修改 </a>
  45 + </div>
  46 + </div>
  47 +{{/each}}
  48 +{{if list.length == 0}}
  49 +<div class="map-gps-empty">没有相关数据</div>
  50 +<div class="map-gps-empty">
  51 + <form role="form" class="form-horizontal">
  52 + <input type="hidden" name="line-id" id="line-id" value="{{lineId}}">
  53 + <input type="hidden" name="line-dirc" id="line-dirc" value="{{dirc}}">
  54 + <input type="hidden" name="line-code" id="line-code" value="{{lineCode}}">
  55 + <div class="form-body">
  56 + <div class="form-group">
  57 + <div class="col-md-6">
  58 + <div class="checkbox-list">
  59 + <label>
  60 + <div class="checker">
  61 + <span class="checked"><input type="checkbox" name="argus" id="argus" value="1"></span> 解析并保存
  62 + </div>
  63 + </label>
  64 + </div>
  65 + </div>
  66 +
  67 + <div class="col-md-6">
  68 + <button type="button" class="btn blue-madison right" id="line-jxld">线路解析</button>
  69 + </div>
  70 + </div>
  71 + </div>
  72 + </form>
  73 +</div>
  74 +{{/if}}
  75 +</div></div>
  76 +</script>
  77 +
  78 +<!-- 地图JS类库 -->
  79 +<script src="/pages/base/sectionspeed/js/map.js" data-exclude=1></script>
  80 +
  81 +<!-- reload事件 -->
  82 +<script src="/pages/base/sectionspeed/js/reload.js"></script>
  83 +
  84 +<!-- 表单元素事件JS类库 -->
  85 +<script src="/pages/base/sectionspeed/js/events.js"></script>
  86 +
  87 +<!-- 函数方法JS类库 -->
  88 +<script src="/pages/base/sectionspeed/js/function.js"></script>
0 \ No newline at end of file 89 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/list.html
@@ -115,10 +115,10 @@ @@ -115,10 +115,10 @@
115 </div> 115 </div>
116 <div class="row" style="margin-top: 10px;"> 116 <div class="row" style="margin-top: 10px;">
117 <div class="col-md-12"> 117 <div class="col-md-12">
118 - <!-- 提示 -->  
119 - <div class="alert alert-warning" style="background-color: #22313F;border-color: #FFFFFF;color: #2ab4c0;">  
120 - <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点.  
121 - </div> 118 + <!-- 提示 -->
  119 + <div class="alert alert-warning" style="background-color: #22313F;border-color: #FFFFFF;color: #2ab4c0;">
  120 + <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点.
  121 + </div>
122 </div> 122 </div>
123 </div> 123 </div>
124 </div> 124 </div>
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
1 -// 自定义指令,指令模版在dt目录下  
2 -  
3 -  
4 -angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) {  
5 - return {  
6 - restrict: 'A',  
7 - link: function(scope, element) {  
8 - // 初始隐藏loading界面  
9 - element.hide();  
10 -  
11 - // 开始请求通知处理  
12 - requestNotificationChannel.onRequestStarted(scope, function() {  
13 - element.show();  
14 - });  
15 - // 请求结束通知处理  
16 - requestNotificationChannel.onRequestEnded(scope, function() {  
17 - element.hide();  
18 - });  
19 - }  
20 - };  
21 -}]);  
22 -  
23 -angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {  
24 - return {  
25 - restrict: 'E',  
26 - templateUrl: '/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html',  
27 - scope: {  
28 - model: "="  
29 - },  
30 - controllerAs: "$saSelectCtrl",  
31 - bindToController: true,  
32 - controller: function() {  
33 - var self = this;  
34 - self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}  
35 - },  
36 - /**  
37 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
38 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
39 - * @param tElem  
40 - * @param tAttrs  
41 - * @returns {{pre: Function, post: Function}}  
42 - */  
43 - compile: function(tElem, tAttrs) {  
44 - // 确定是否使用angularjs required验证  
45 - // 属性 required  
46 - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加  
47 - var required_attr = tAttrs["required"];  
48 - if (required_attr) {  
49 - if (required_attr == "true") {  
50 - // 添加required属性指令  
51 - tElem.find("ui-select").attr("required", "");  
52 - } else {  
53 - // 不等于true,不添加required属性指令  
54 - }  
55 - } else {  
56 - // 不添加required属性指令  
57 - }  
58 -  
59 - //console.log("saSelect" + ":compile = >" + tElem.html());  
60 -  
61 - return {  
62 - pre: function(scope, element, attr) {  
63 - // TODO:  
64 - },  
65 - /**  
66 - * 相当于link函数。  
67 - *  
68 - * 重要属性如下:  
69 - * model 是绑定外部值。  
70 - * dicgroup 字典组的类型  
71 - * name input name属性值  
72 - */  
73 - post: function(scope, element, attr) {  
74 - // 1、获取属性  
75 - var dicgroup_attr = attr['dicgroup']; // 字典组的类型  
76 - var name_attr = attr['name']; // input name属性值  
77 - var dicname_attr = attr['dicname']; // model关联的字典名字段  
78 - var codename_attr = attr['codename']; // model关联的字典值字段  
79 - var placeholder_attr = attr['placeholder']; // select placeholder提示  
80 -  
81 - // 系统的字典对象,使用dictionaryUtils类获取  
82 - var origin_dicgroup;  
83 - var dic_key; // 字典key  
84 -  
85 - if (dicgroup_attr) { // 赋值指定的字典数据  
86 - origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);  
87 - for (dic_key in origin_dicgroup) {  
88 - var data = {}; // 重新组合的字典元素对象  
89 - if (dic_key == "true")  
90 - data.code = true;  
91 - else  
92 - data.code = dic_key;  
93 - data.name = origin_dicgroup[dic_key];  
94 - scope["$saSelectCtrl"].datas.push(data);  
95 - }  
96 - }  
97 -  
98 - if (name_attr) {  
99 - scope["$saSelectCtrl"].nv = name_attr;  
100 - }  
101 - if (placeholder_attr) {  
102 - scope["$saSelectCtrl"].ph = placeholder_attr;  
103 - }  
104 -  
105 - scope["$saSelectCtrl"].select = function($item) {  
106 - if (codename_attr) {  
107 - scope["$saSelectCtrl"].model[codename_attr] = $item.code;  
108 - }  
109 - if (dicname_attr) {  
110 - scope["$saSelectCtrl"].model[dicname_attr] = $item.name;  
111 - }  
112 - };  
113 -  
114 - scope["$saSelectCtrl"].remove = function() {  
115 - if (codename_attr) {  
116 - scope["$saSelectCtrl"].model[codename_attr] = null;  
117 - }  
118 - if (dicname_attr) {  
119 - scope["$saSelectCtrl"].model[dicname_attr] = null;  
120 - }  
121 - scope["$saSelectCtrl"].cmodel = null;  
122 - };  
123 -  
124 - $timeout(function() {  
125 - // 创建内部使用的绑定对象  
126 - var model_code = scope["$saSelectCtrl"].model[codename_attr];  
127 - scope["$saSelectCtrl"].cmodel = model_code;  
128 - }, 0);  
129 - }  
130 - }  
131 - }  
132 - };  
133 -}]);  
134 -  
135 -/**  
136 - * saRadiogroup指令  
137 - * 属性如下:  
138 - * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate  
139 - * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)  
140 - * name(必须):控件的名字  
141 - * required(可选):是否要用required验证  
142 - * disabled(可选):标示单选框是否可选  
143 - *  
144 - */  
145 -angular.module('ScheduleApp').directive("saRadiogroup", [function() {  
146 - /**  
147 - * 使用字典数据的单选按钮组的指令。  
148 - * 指令名称:truefalse-Dic  
149 - */  
150 - return {  
151 - restrict: 'E',  
152 - templateUrl: '/pages/scheduleApp/module/common/dt/MyRadioGroupWrapTemplate.html',  
153 - scope: {  
154 - model: "="  
155 - },  
156 - controllerAs: "$saRadiogroupCtrl",  
157 - bindToController: true,  
158 - controller: function($scope) {  
159 - //$scope["model"] = {selectedOption: null};  
160 - //console.log("controller");  
161 - //console.log("controller:" + $scope["model"]);  
162 -  
163 - var self = this;  
164 - self.$$data = null; // 内部数据  
165 - },  
166 -  
167 - /**  
168 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
169 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
170 - * @param tElem  
171 - * @param tAttrs  
172 - * @returns {{pre: Function, post: Function}}  
173 - */  
174 - compile: function(tElem, tAttrs) {  
175 - // 获取属性  
176 - var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type  
177 - var $name_attr = tAttrs["name"]; // 控件的名字  
178 - var $required_attr = tAttrs["required"]; // 是否要用required验证  
179 - var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选  
180 -  
181 - // controlAs名字  
182 - var ctrlAs = "$saRadiogroupCtrl";  
183 -  
184 - // 如果有required属性,添加angularjs required验证  
185 - if ($required_attr != undefined) {  
186 - tElem.find("input").attr("required", "");  
187 - }  
188 -  
189 - return {  
190 - pre: function(scope, element, attr) {  
191 -  
192 - },  
193 -  
194 - /**  
195 - * 相当于link函数。  
196 - * @param scope  
197 - * @param element  
198 - * @param attr  
199 - */  
200 - post: function(scope, element, attr) {  
201 - //console.log("link");  
202 - //console.log("link:" + scope.model);  
203 - //scope["model"] = {selectedOption: null};  
204 -  
205 - if ($name_attr) {  
206 - scope[ctrlAs].nv = $name_attr;  
207 - }  
208 -  
209 - if ($disabled_attr) {  
210 - scope[ctrlAs].disabled = true;  
211 - }  
212 - if ($dicgroup_attr) {  
213 - var obj = dictionaryUtils.getByGroup($dicgroup_attr);  
214 - scope[ctrlAs].$$data = obj;  
215 - // 处理 scope["dic"] key值  
216 - scope[ctrlAs].dicvalueCalcu = function(value) {  
217 - if (value == "true") {  
218 - //console.log(value);  
219 - return true;  
220 - } else if (value == "false") {  
221 - //console.log(value);  
222 - return false;  
223 - } else {  
224 - return value;  
225 - }  
226 - };  
227 - }  
228 - }  
229 - };  
230 - }  
231 - };  
232 -}]);  
233 -  
234 -angular.module('ScheduleApp').directive("remoteValidaton", [  
235 - 'BusInfoManageService_g',  
236 - 'EmployeeInfoManageService_g',  
237 - 'TimeTableManageService_g',  
238 - function(  
239 - busInfoManageService_g,  
240 - employeeInfoManageService_g,  
241 - timeTableManageService_g  
242 - ) {  
243 - /**  
244 - * 远端验证指令,依赖于ngModel  
245 - * 指令名称 remote-Validation  
246 - * 需要属性 rvtype 表示验证类型  
247 - */  
248 - return {  
249 - restrict: "A",  
250 - require: "^ngModel",  
251 - link: function(scope, element, attr, ngModelCtrl) {  
252 - element.bind("keyup", function() {  
253 - var modelValue = ngModelCtrl.$modelValue;  
254 - var rv1_attr = attr["rv1"];  
255 - if (attr["rvtype"]) {  
256 -  
257 - // 根据rvtype的值,确定使用那个远端验证的url,  
258 - // rv1, rv2, rv3是关联比较值,暂时使用rv1  
259 - // 这个貌似没法通用,根据业务变换  
260 - // TODO:暂时有点乱以后改  
261 - if (attr["rvtype"] == "insideCode") {  
262 - busInfoManageService_g.validate.insideCode(  
263 - {"insideCode_eq": modelValue, type: "equale"},  
264 - function(result) {  
265 - //console.log(result);  
266 - if (result.status == "SUCCESS") {  
267 - ngModelCtrl.$setValidity('remote', true);  
268 - } else {  
269 - ngModelCtrl.$setValidity('remote', false);  
270 - }  
271 - },  
272 - function(result) {  
273 - //console.log(result);  
274 - ngModelCtrl.$setValidity('remote', true);  
275 - }  
276 - );  
277 - } else if (attr["rvtype"] == "jobCode") {  
278 - if (!rv1_attr) {  
279 - ngModelCtrl.$setValidity('remote', false);  
280 - return;  
281 - }  
282 -  
283 - employeeInfoManageService_g.validate.jobCode(  
284 - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},  
285 - function(result) {  
286 - //console.log(result);  
287 - if (result.status == "SUCCESS") {  
288 - ngModelCtrl.$setValidity('remote', true);  
289 - } else {  
290 - ngModelCtrl.$setValidity('remote', false);  
291 - }  
292 - },  
293 - function(result) {  
294 - //console.log(result);  
295 - ngModelCtrl.$setValidity('remote', true);  
296 - }  
297 - );  
298 - } else if (attr["rvtype"] == "ttinfoname") {  
299 - if (!rv1_attr) {  
300 - ngModelCtrl.$setValidity('remote', false);  
301 - return;  
302 - }  
303 -  
304 - timeTableManageService_g.validate.ttinfoname(  
305 - {"name_eq": modelValue, "xl.id_eq": rv1_attr, type: "equale"},  
306 - function(result) {  
307 - //console.log(result);  
308 - if (result.status == "SUCCESS") {  
309 - ngModelCtrl.$setValidity('remote', true);  
310 - } else {  
311 - ngModelCtrl.$setValidity('remote', false);  
312 - }  
313 - },  
314 - function(result) {  
315 - //console.log(result);  
316 - ngModelCtrl.$setValidity('remote', true);  
317 - }  
318 - );  
319 -  
320 - }  
321 - } else {  
322 - // 没有rvtype,就不用远端验证了  
323 - ngModelCtrl.$setValidity('remote', true);  
324 - }  
325 -  
326 - attr.$observe("rv1", function(value) {  
327 - if (attr["rvtype"] == "jobCode") {  
328 - if (!value) {  
329 - ngModelCtrl.$setValidity('remote', false);  
330 - return;  
331 - }  
332 -  
333 - employeeInfoManageService_g.validate.jobCode(  
334 - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},  
335 - function(result) {  
336 - //console.log(result);  
337 - if (result.status == "SUCCESS") {  
338 - ngModelCtrl.$setValidity('remote', true);  
339 - } else {  
340 - ngModelCtrl.$setValidity('remote', false);  
341 - }  
342 - },  
343 - function(result) {  
344 - //console.log(result);  
345 - ngModelCtrl.$setValidity('remote', true);  
346 - }  
347 - );  
348 - } else if (attr["rvtype"] == "ttinfoname") {  
349 - if (!value) {  
350 - ngModelCtrl.$setValidity('remote', false);  
351 - return;  
352 - }  
353 -  
354 - console.log("rv1:" + value);  
355 -  
356 - timeTableManageService_g.validate.ttinfoname(  
357 - {"name_eq": modelValue, "xl.id_eq": value, type: "equale"},  
358 - function(result) {  
359 - //console.log(result);  
360 - if (result.status == "SUCCESS") {  
361 - ngModelCtrl.$setValidity('remote', true);  
362 - } else {  
363 - ngModelCtrl.$setValidity('remote', false);  
364 - }  
365 - },  
366 - function(result) {  
367 - //console.log(result);  
368 - ngModelCtrl.$setValidity('remote', true);  
369 - }  
370 - );  
371 - }  
372 -  
373 - });  
374 - });  
375 - }  
376 - };  
377 - }]);  
378 -  
379 -  
380 -/**  
381 - * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。  
382 - * 1、compile阶段使用的属性如下:  
383 - * required:用于和表单验证连接,指定成required="true"才有效。  
384 - * 2、link阶段使用的属性如下  
385 - * model:关联的模型对象  
386 - * name:表单验证时需要的名字  
387 - * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加  
388 - * modelcolname1:关联的模型字段名字1(一般应该是编码字段)  
389 - * modelcolname2:关联的模型字段名字2(一般应该是名字字段)  
390 - * datacolname1;内部数据对应的字段名字1(与模型字段1对应)  
391 - * datacolname2:内部数据对应的字段名字2(与模型字段2对应)  
392 - * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用  
393 - * placeholder:select placeholder字符串描述  
394 - *  
395 - * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。  
396 - * $$SearchInfoService_g,内部使用的数据服务  
397 - */  
398 -// saSelect2指令使用的内部信service  
399 -angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {  
400 - return {  
401 - xl: $resource(  
402 - '/line/:type',  
403 - {order: 'name', direction: 'ASC'},  
404 - {  
405 - list: {  
406 - method: 'GET',  
407 - isArray: true  
408 - }  
409 - }  
410 - ),  
411 - zd: $resource(  
412 - '/stationroute/stations',  
413 - {order: 'stationCode', direction: 'ASC'},  
414 - {  
415 - list: {  
416 - method: 'GET',  
417 - isArray: true  
418 - }  
419 - }  
420 - ),  
421 - tcc: $resource(  
422 - '/carpark/:type',  
423 - {order: 'parkCode', direction: 'ASC'},  
424 - {  
425 - list: {  
426 - method: 'GET',  
427 - isArray: true  
428 - }  
429 - }  
430 - ),  
431 - ry: $resource(  
432 - '/personnel/:type',  
433 - {order: 'personnelName', direction: 'ASC'},  
434 - {  
435 - list: {  
436 - method: 'GET',  
437 - isArray: true  
438 - }  
439 - }  
440 - ),  
441 - cl: $resource(  
442 - '/cars/:type',  
443 - {order: "insideCode", direction: 'ASC'},  
444 - {  
445 - list: {  
446 - method: 'GET',  
447 - isArray: true  
448 - }  
449 - }  
450 - ),  
451 - ttInfo: $resource(  
452 - '/tic/:type',  
453 - {order: "name", direction: 'ASC'},  
454 - {  
455 - list: {  
456 - method: 'GET',  
457 - isArray: true  
458 - }  
459 - }  
460 - ),  
461 - cci: $resource(  
462 - '/cci/cars',  
463 - {},  
464 - {  
465 - list: {  
466 - method: 'GET',  
467 - isArray: true  
468 - }  
469 - }  
470 -  
471 - ),  
472 - cci2: $resource(  
473 - '/cci/:type',  
474 - {},  
475 - {  
476 - list: {  
477 - method: 'GET',  
478 - isArray: true  
479 - }  
480 - }  
481 - ),  
482 - cci3: $resource(  
483 - '/cci/cars2',  
484 - {},  
485 - {  
486 - list: {  
487 - method: 'GET',  
488 - isArray: true  
489 - }  
490 - }  
491 -  
492 - ),  
493 - eci: $resource(  
494 - '/eci/jsy',  
495 - {},  
496 - {  
497 - list: {  
498 - method: 'GET',  
499 - isArray: true  
500 - }  
501 - }  
502 - ),  
503 - eci2: $resource(  
504 - '/eci/spy',  
505 - {},  
506 - {  
507 - list: {  
508 - method: 'GET',  
509 - isArray: true  
510 - }  
511 - }  
512 - )  
513 - }  
514 -}]);  
515 -angular.module('ScheduleApp').filter("$$pyFilter", function() {  
516 - return function(items, props) {  
517 - var out = [];  
518 - var limit = props["limit"] || 20; // 默认20条记录  
519 -  
520 - if (angular.isArray(items)) {  
521 - items.forEach(function(item) {  
522 - if (out.length < limit) {  
523 - if (props.search) {  
524 - var upTerm = props.search.toUpperCase();  
525 - if(item.fullChars.indexOf(upTerm) != -1  
526 - || item.camelChars.indexOf(upTerm) != -1) {  
527 - out.push(item);  
528 - }  
529 - }  
530 - }  
531 - });  
532 - }  
533 -  
534 - return out;  
535 - };  
536 -});  
537 -angular.module('ScheduleApp').directive("saSelect2", [  
538 - '$timeout', '$$SearchInfoService_g',  
539 - function($timeout, $$searchInfoService_g) {  
540 - return {  
541 - restrict: 'E',  
542 - templateUrl: '/pages/scheduleApp/module/other/MySearchSelectTemplate.html',  
543 - scope: {  
544 - model: "=" // 独立作用域,关联外部的模型对象  
545 - },  
546 - controllerAs: "$saSelectCtrl",  
547 - bindToController: true,  
548 - controller: function($scope) {  
549 - var self = this;  
550 - self.$$data = []; // 内部关联的数据  
551 - },  
552 - /**  
553 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
554 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
555 - * @param tElem  
556 - * @param tAttrs  
557 - * @returns {{pre: Function, post: Function}}  
558 - */  
559 - compile: function(tElem, tAttrs) {  
560 - // 1、获取此阶段使用的属性  
561 - var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。  
562 -  
563 - // 2、处理属性  
564 -  
565 - // 确定是否使用angularjs required验证  
566 - // 属性 required  
567 - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加  
568 - if ($required_attr) {  
569 - if ($required_attr == "true") {  
570 - // 添加required属性指令  
571 - tElem.find("ui-select").attr("required", "");  
572 - } else {  
573 - // 不等于true,不添加required属性指令  
574 - }  
575 - } else {  
576 - // 不添加required属性指令  
577 - }  
578 -  
579 - //console.log("saSelect" + ":compile = >" + tElem.html());  
580 -  
581 - return {  
582 - pre: function(scope, element, attr) {  
583 - // TODO:  
584 - },  
585 - /**  
586 - * 相当于link函数。  
587 - *  
588 - * 重要属性如下:  
589 - * model 是绑定外部值。  
590 - * dicgroup 字典组的类型  
591 - * name input name属性值  
592 - */  
593 - post: function(scope, element, attr) {  
594 - // 1、获取此阶段使用的属性  
595 - var $name_attr = attr["name"]; // 表单验证时需要的名字  
596 - var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加  
597 - var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)  
598 - var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)  
599 - var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)  
600 - var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)  
601 - var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名  
602 - var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述  
603 -  
604 - // 2、处理属性、转换成$saSelectCtrl内部使用的属性  
605 - if ($name_attr) {  
606 - scope["$saSelectCtrl"].$name_attr = $name_attr;  
607 - }  
608 - if ($placeholder_attr) {  
609 - scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;  
610 - }  
611 - if ($showcolname_attr) {  
612 - scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;  
613 - }  
614 -  
615 - // 2-1、添加内部方法,根据type值,改变$$data的值  
616 - scope["$saSelectCtrl"].$$internal_data_change_fn = function() {  
617 - // 根据type属性动态载入数据  
618 - if ($type_attr) {  
619 - $$searchInfoService_g[$type_attr].list(  
620 - {type: "all"},  
621 - function(result) {  
622 - scope["$saSelectCtrl"].$$data = [];  
623 - for (var i = 0; i < result.length; i ++) {  
624 - var data = {}; // data是result的一部分属性集合,根据配置来确定  
625 - if ($datacolname1_attr) {  
626 - data[$datacolname1_attr] = result[i][$datacolname1_attr];  
627 - }  
628 - if ($datacolname2_attr) {  
629 - data[$datacolname2_attr] = result[i][$datacolname2_attr];  
630 - }  
631 - if ($showcolname_attr) {  
632 - // 动态添加基于名字的拼音  
633 - data[$showcolname_attr] = result[i][$showcolname_attr];  
634 - if (data[$showcolname_attr]) {  
635 - data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼  
636 - data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼  
637 - }  
638 - }  
639 - if (data["fullChars"])  
640 - scope["$saSelectCtrl"].$$data.push(data);  
641 - }  
642 - },  
643 - function(result) {  
644 -  
645 - }  
646 - );  
647 - }  
648 - };  
649 -  
650 - // 3、选择、删除事件映射模型和内部数据对应的字段  
651 - scope["$saSelectCtrl"].$select_fn_attr = function($item) {  
652 - if ($modelcolname1_attr && $datacolname1_attr) {  
653 - scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];  
654 - }  
655 - if ($modelcolname2_attr && $datacolname2_attr) {  
656 - scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];  
657 - }  
658 - };  
659 - scope["$saSelectCtrl"].$remove_fn_attr = function() {  
660 - if ($modelcolname1_attr) {  
661 - scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;  
662 - }  
663 - if ($modelcolname2_attr) {  
664 - scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;  
665 - }  
666 - scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空  
667 -  
668 - scope["$saSelectCtrl"].$$internal_data_change_fn();  
669 - };  
670 -  
671 - // 4、搜索事件  
672 - scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {  
673 - //var fullChars = pinyin.getFullChars($search).toUpperCase();  
674 - //var camelChars = pinyin.getCamelChars($search);  
675 - //  
676 - //console.log(fullChars + " " + camelChars);  
677 - // TODO:事件暂时没用,放着以后再说  
678 - };  
679 -  
680 - // 5、全部载入后,输入的  
681 - $timeout(function() {  
682 - // 创建内部使用的绑定对象,用于确认选中那个值  
683 - scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];  
684 -  
685 - scope["$saSelectCtrl"].$$internal_data_change_fn();  
686 - }, 0);  
687 - }  
688 - }  
689 - }  
690 - };  
691 - }  
692 -]);  
693 -  
694 -/**  
695 - * saSelect3指令  
696 - * 属性如下:  
697 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
698 - * name(必须):控件的名字  
699 - * placeholder(可选):占位符字符串  
700 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
701 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
702 - * icname(必须):内部与之对应的字段名,如:icname=code  
703 - * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name  
704 - * icname2(可选):内部与之对应的字段名2,如:icname2=name  
705 - * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name  
706 - * icname3(可选):内部与之对应的字段名3,如:icname2=name  
707 - * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name  
708 - * required(可选):是否要用required验证  
709 - * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点  
710 - * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)  
711 - *  
712 - * 高级属性:  
713 - * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)  
714 - * dataparam(可选):数据源关联的外部参数对象  
715 - *  
716 - */  
717 -angular.module('ScheduleApp').directive("saSelect3", [  
718 - '$timeout',  
719 - '$$SearchInfoService_g',  
720 - function($timeout, $$searchInfoService_g) {  
721 - return {  
722 - restrict: 'E',  
723 - templateUrl: '/pages/scheduleApp/module/common/dt/MyUiSelectWrapTemplate1.html',  
724 - scope: {  
725 - model: "=" // 独立作用域,关联外部的模型object  
726 - },  
727 - controllerAs: "$saSelectCtrl",  
728 - bindToController: true,  
729 - controller: function($scope) {  
730 - var self = this;  
731 - self.$$data = []; // ui-select显示用的数据源  
732 - self.$$data_real= []; // 内部真实的数据源  
733 - },  
734 -  
735 - /**  
736 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
737 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
738 - * @param tElem  
739 - * @param tAttrs  
740 - * @returns {{pre: Function, post: Function}}  
741 - */  
742 - compile: function(tElem, tAttrs) {  
743 - // 获取所有的属性  
744 - var $name_attr = tAttrs["name"]; // 控件的名字  
745 - var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字  
746 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
747 - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名  
748 - var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2  
749 - var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2  
750 - var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3  
751 - var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3  
752 -  
753 - var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段  
754 - var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型  
755 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
756 - var $mlp_attr = tAttrs["mlp"]; // 是否多级属性  
757 - var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性  
758 -  
759 - // controlAs名字  
760 - var ctrlAs = "$saSelectCtrl";  
761 -  
762 - // 数据源初始化标志  
763 - var $$data_init = false;  
764 - // 如果有required属性,添加angularjs required验证  
765 - if ($required_attr != undefined) {  
766 - tElem.find("ui-select").attr("required", "");  
767 - }  
768 -  
769 - // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义  
770 - // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}  
771 - tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");  
772 - // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data  
773 - tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");  
774 - // 原来的设置:item[$saSelectCtrl.$icname_s]  
775 - tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);  
776 - // 原来的设置:{{$saSelectCtrl.$name}}  
777 - tElem.find("ui-select").attr("name", $name_attr);  
778 - // 原来的设置:{{$saSelectCtrl.$placeholder}}  
779 - tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);  
780 -  
781 - return {  
782 - pre: function(scope, element, attr) {  
783 - // TODO:  
784 - },  
785 - /**  
786 - * 相当于link函数。  
787 - * @param scope  
788 - * @param element  
789 - * @param attr  
790 - */  
791 - post: function(scope, element, attr) {  
792 - // 添加选中事件处理函数  
793 - scope[ctrlAs].$$internal_select_fn = function($item) {  
794 - if ($dcname_attr && $icname_attr) {  
795 - if ($mlp_attr) {  
796 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");  
797 - } else {  
798 - scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];  
799 - }  
800 - }  
801 - if ($dcname2_attr && $icname2_attr) {  
802 - if ($mlp_attr) {  
803 - eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");  
804 - } else {  
805 - scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];  
806 - }  
807 - }  
808 - if ($dcname3_attr && $icname3_attr) {  
809 - if ($mlp_attr) {  
810 - eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");  
811 - } else {  
812 - scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];  
813 - }  
814 - }  
815 - };  
816 -  
817 - // 删除选中事件处理函数  
818 - scope[ctrlAs].$$internal_remove_fn = function() {  
819 - scope[ctrlAs].$$internalmodel = undefined;  
820 - if ($mlp_attr) {  
821 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");  
822 - } else {  
823 - scope[ctrlAs].model[$dcname_attr] = undefined;  
824 - }  
825 -  
826 - if ($dcname2_attr) {  
827 - if ($mlp_attr) {  
828 - eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");  
829 - } else {  
830 - scope[ctrlAs].model[$dcname2_attr] = undefined;  
831 - }  
832 - }  
833 - if ($dcname3_attr) {  
834 - if ($mlp_attr) {  
835 - eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");  
836 - } else {  
837 - scope[ctrlAs].model[$dcname3_attr] = undefined;  
838 - }  
839 - }  
840 - };  
841 -  
842 - /**  
843 - * 内部方法,读取字典数据作为数据源。  
844 - * @param dicgroup 字典类型,如:gsType  
845 - * @param ccol 代码字段名  
846 - * @param ncol 名字字段名  
847 - */  
848 - scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {  
849 - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);  
850 - var dic_key; // 字典key  
851 - // 清空内部数据  
852 - scope[ctrlAs].$$data_real = [];  
853 - for (dic_key in origin_dicgroup) {  
854 - var data = {}; // 重新组合的字典元素对象  
855 - if (dic_key == "true")  
856 - data[ccol] = true;  
857 - else  
858 - data[ccol] = dic_key;  
859 - data[ncol] = origin_dicgroup[dic_key];  
860 - scope[ctrlAs].$$data_real.push(data);  
861 - }  
862 - // 这里直接将$$data_real数据深拷贝到$$data  
863 - angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);  
864 -  
865 - console.log(scope[ctrlAs].$$data);  
866 - };  
867 -  
868 - /**  
869 - * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把  
870 - * 内部方法,读取字典数据作为数据源。  
871 - * @param result 原始数据  
872 - * @param dcvalue 传入的关联数据  
873 - */  
874 - scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {  
875 - //console.log("start");  
876 - // 清空内部数据  
877 - scope[ctrlAs].$$data_real = [];  
878 - scope[ctrlAs].$$data = [];  
879 - for (var i = 0; i < result.length; i ++) {  
880 - if ($icname_s_attr) {  
881 - if ($mlp_attr) {  
882 - if (eval("result[i]" + "." + $icname_s_attr)) {  
883 - // 全拼  
884 - result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();  
885 - // 简拼  
886 - result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));  
887 - }  
888 - } else {  
889 - if (result[i][$icname_s_attr]) {  
890 - // 全拼  
891 - result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();  
892 - // 简拼  
893 - result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);  
894 - }  
895 - }  
896 - }  
897 -  
898 - if (result[i]["fullChars"]) { // 有拼音的加入数据源  
899 - scope[ctrlAs].$$data_real.push(result[i]);  
900 - }  
901 -  
902 - }  
903 - //console.log("start2");  
904 -  
905 - // 数量太大取前10条记录作为显示  
906 - if (angular.isArray(scope[ctrlAs].$$data_real)) {  
907 - // 先迭代循环查找已经传过来的值  
908 - if (scope[ctrlAs].$$data_real.length > 0) {  
909 - if (dcvalue) {  
910 - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {  
911 - if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {  
912 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));  
913 - break;  
914 - }  
915 - }  
916 - }  
917 - }  
918 - // 在插入剩余的数据  
919 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
920 - if (scope[ctrlAs].$$data.length < 10) {  
921 - if ($mlp_attr) {  
922 - if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {  
923 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
924 - }  
925 - } else {  
926 - if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {  
927 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
928 - }  
929 - }  
930 - } else {  
931 - break;  
932 - }  
933 - }  
934 - }  
935 -  
936 - //console.log("end");  
937 - };  
938 -  
939 - /**  
940 - * 判定一个对象是否为空对象。  
941 - * @param Obj  
942 - */  
943 - scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {  
944 - console.log(typeof obj);  
945 -  
946 - if (typeof obj === "object" && !(obj instanceof Array)) {  
947 - for (var prop in obj) {  
948 - if (obj.hasOwnProperty(prop)) {  
949 - return false;  
950 - }  
951 - }  
952 - return true;  
953 - } else {  
954 - throw "必须是对象";  
955 - }  
956 - };  
957 -  
958 - // 刷新数据  
959 - scope[ctrlAs].$$internal_refresh_fn = function(search) {  
960 - // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取  
961 - var $dcvalue_attr = attr["dcvalue"];  
962 -  
963 - console.log("刷新数据:" + $dcvalue_attr);  
964 -  
965 - if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化  
966 - if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源  
967 - scope[ctrlAs].$$internal_dic_data(  
968 - $datatype_attr, $icname_attr, $icname_s_attr);  
969 - if ($dcvalue_attr) {  
970 - scope[ctrlAs].$$internalmodel = $dcvalue_attr;  
971 - }  
972 - } else { // 非字典类型数据源  
973 - if (!$dataassociate_attr) {  
974 - $$searchInfoService_g[$datatype_attr].list(  
975 - {type: "all"},  
976 - function(result) {  
977 - //console.log("ok:" + $datatype_attr);  
978 - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);  
979 - //console.log("ok2:" + $datatype_attr);  
980 - if ($dcvalue_attr) {  
981 - scope[ctrlAs].$$internalmodel = $dcvalue_attr;  
982 - }  
983 -  
984 - $$data_init = true;  
985 - },  
986 - function(result) {  
987 -  
988 - }  
989 - );  
990 - }  
991 - }  
992 - }  
993 -  
994 - if ($$data_init) {  
995 - if (search && search != "") { // 有search值  
996 - if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源  
997 - // 处理search  
998 - console.log("search:" + search);  
999 -  
1000 - scope[ctrlAs].$$data = [];  
1001 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
1002 - var upTerm = search.toUpperCase();  
1003 - if (scope[ctrlAs].$$data.length < 10) {  
1004 - if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1  
1005 - || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {  
1006 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
1007 - }  
1008 - } else {  
1009 - break;  
1010 - }  
1011 - }  
1012 - }  
1013 - }  
1014 -  
1015 - }  
1016 -  
1017 - };  
1018 -  
1019 -  
1020 -  
1021 -  
1022 -  
1023 -  
1024 -  
1025 -  
1026 -  
1027 -  
1028 - // TODO:  
1029 -  
1030 - // dom全部载入后调用  
1031 - $timeout(function() {  
1032 - console.log("dom全部载入后调用");  
1033 - }, 0);  
1034 - // 监控dcvalue model值变换  
1035 - attr.$observe("dcvalue", function(value) {  
1036 - console.log("监控dc1 model值变换:" + value);  
1037 - scope[ctrlAs].$$internalmodel = value;  
1038 - }  
1039 - );  
1040 - // 监控获取数据参数变换  
1041 - attr.$observe("dataparam", function(value) {  
1042 - // 判定是否空对象  
1043 - console.log(value);  
1044 - var obj = JSON.parse(value);  
1045 - var $dcvalue_attr = attr["dcvalue"];  
1046 - if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {  
1047 - console.log("dataparam:" + obj);  
1048 -  
1049 - //  
1050 -  
1051 - obj["type"] = "all";  
1052 -  
1053 - $$data_init = false;  
1054 - $$searchInfoService_g[$datatype_attr].list(  
1055 - obj,  
1056 - function(result) {  
1057 - //console.log("ok:" + $datatype_attr);  
1058 - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);  
1059 - //console.log("ok2:" + $datatype_attr);  
1060 - if ($dcvalue_attr) {  
1061 - scope[ctrlAs].$$internalmodel = $dcvalue_attr;  
1062 - }  
1063 -  
1064 - $$data_init = true;  
1065 - },  
1066 - function(result) {  
1067 -  
1068 - }  
1069 - );  
1070 - }  
1071 - }  
1072 - );  
1073 - }  
1074 - };  
1075 - }  
1076 - };  
1077 -  
1078 - }  
1079 -]);  
1080 -  
1081 -/**  
1082 - * saCheckboxgroup指令  
1083 - * 属性如下:  
1084 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
1085 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
1086 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
1087 - * name(必须):控件的名字  
1088 - * required(可选):是否要用required验证  
1089 - * disabled(可选):标示框是否可选  
1090 - *  
1091 - */  
1092 -angular.module('ScheduleApp').directive('saCheckboxgroup', [  
1093 - function() {  
1094 - return {  
1095 - restrict: 'E',  
1096 - templateUrl: '/pages/scheduleApp/module/common/dt/MyCheckboxGroupWrapTemplate.html',  
1097 - scope: {  
1098 - model: "=" // 独立作用域,关联外部的模型object  
1099 - },  
1100 - controllerAs: "$saCheckboxgroupCtrl",  
1101 - bindToController: true,  
1102 - controller: function($scope) {  
1103 - var self = this;  
1104 - self.$$data = []; // 内部的数据  
1105 -  
1106 - // TODO:数据写死,周一至周日选择数据,以后有别的数据再议  
1107 - self.$$data = [  
1108 - {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1109 - {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1110 - {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1111 - {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1112 - {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1113 - {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1114 - {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}  
1115 - ];  
1116 - },  
1117 -  
1118 - /**  
1119 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
1120 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
1121 - * @param tElem  
1122 - * @param tAttrs  
1123 - * @returns {{pre: Function, post: Function}}  
1124 - */  
1125 - compile: function(tElem, tAttrs) {  
1126 - // 获取所有的属性  
1127 - var $name_attr = tAttrs["name"]; // 控件的名字  
1128 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
1129 - var $disabled_attr = tAttrs["disabled"]; // 是否禁用  
1130 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
1131 -  
1132 - // controlAs名字  
1133 - var ctrlAs = '$saCheckboxgroupCtrl';  
1134 -  
1135 - // 如果有required属性,添加angularjs required验证  
1136 - if ($required_attr != undefined) {  
1137 - //console.log(tElem.html());  
1138 - tElem.find("div").attr("required", "");  
1139 - }  
1140 - // 如果有disabled属性,添加禁用标志  
1141 - if ($disabled_attr != undefined) {  
1142 - tElem.find("input").attr("ng-disabled", "true");  
1143 - }  
1144 -  
1145 - return {  
1146 - pre: function(scope, element, attr) {  
1147 - // TODO:  
1148 - },  
1149 - /**  
1150 - * 相当于link函数。  
1151 - * @param scope  
1152 - * @param element  
1153 - * @param attr  
1154 - */  
1155 - post: function(scope, element, attr) {  
1156 - // name属性  
1157 - if ($name_attr) {  
1158 - scope[ctrlAs]["$name_attr"] = $name_attr;  
1159 - }  
1160 -  
1161 - /**  
1162 - * checkbox选择事件处理函数。  
1163 - * @param $d 数据对象,$$data中的元素对象  
1164 - */  
1165 - scope[ctrlAs].$$internal_updateCheck_fn = function($d) {  
1166 - $d.ischecked = !$d.ischecked;  
1167 - console.log($d);  
1168 - };  
1169 -  
1170 - // 测试使用watch监控$$data的变化  
1171 - scope.$watch(  
1172 - function() {  
1173 - return scope[ctrlAs]["$$data"];  
1174 - },  
1175 - function(newValue, oldValue) {  
1176 - // 根据$$data生成对应的数据  
1177 - var rule_days_arr = [];  
1178 - var i;  
1179 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
1180 - if (scope[ctrlAs]["$$data"][i].ischecked)  
1181 - rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);  
1182 - else  
1183 - rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);  
1184 - }  
1185 - scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");  
1186 - //scope[ctrlAs].$$internalmodel = undefined;  
1187 - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);  
1188 -  
1189 - // 更新model  
1190 - if ($dcname_attr) {  
1191 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");  
1192 - }  
1193 -  
1194 -  
1195 - },  
1196 - true  
1197 - );  
1198 -  
1199 - // TODO:  
1200 -  
1201 - // 监控dcvalue model值变换  
1202 - attr.$observe("dcvalue", function(value) {  
1203 - console.log("saCheckboxgroup 监控dc1 model值变换:" + value);  
1204 - if (value) {  
1205 - // 根据value值,修改$$data里的值  
1206 - var data_array = value.split(",");  
1207 - var i;  
1208 - if (data_array.length > scope[ctrlAs]["$$data"].length) {  
1209 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {  
1210 - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {  
1211 - scope[ctrlAs]["$$data"][i].ischecked = true;  
1212 - } else {  
1213 - scope[ctrlAs]["$$data"][i].ischecked = false;  
1214 - }  
1215 - }  
1216 - } else {  
1217 - for (i = 0; i < data_array.length; i ++) {  
1218 - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {  
1219 - scope[ctrlAs]["$$data"][i].ischecked = true;  
1220 - } else {  
1221 - scope[ctrlAs]["$$data"][i].ischecked = false;  
1222 - }  
1223 - }  
1224 - }  
1225 -  
1226 - }  
1227 - });  
1228 - }  
1229 -  
1230 - };  
1231 -  
1232 -  
1233 - }  
1234 -  
1235 - };  
1236 - }  
1237 -]);  
1238 -  
1239 -/**  
1240 - * saDategroup指令  
1241 - * 属性如下:  
1242 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
1243 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
1244 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
1245 - * name(必须):控件的名字  
1246 - * required(可选):是否要用required验证  
1247 - * disabled(可选):标示框是否可选  
1248 - *  
1249 - */  
1250 -angular.module('ScheduleApp').directive('saDategroup', [  
1251 - '$filter',  
1252 - function($filter) {  
1253 - return {  
1254 - restrict: 'E',  
1255 - templateUrl: '/pages/scheduleApp/module/common/dt/MyDateGroupWrapTemplate.html',  
1256 - scope: {  
1257 - model: "=" // 独立作用域,关联外部的模型object  
1258 - },  
1259 - controllerAs: "$saDategroupCtrl",  
1260 - bindToController: true,  
1261 - controller: function($scope) {  
1262 - var self = this;  
1263 - self.$$data = []; // 内部的数据  
1264 - self.$$date_select; // 内部选中的日期  
1265 -  
1266 - //// 测试数据  
1267 - //self.$$data = [  
1268 - // {datestr: '2011-01-01', ischecked: true},  
1269 - // {datestr: '2011-01-01', ischecked: true},  
1270 - // {datestr: '2011-01-01', ischecked: true}  
1271 - //];  
1272 - },  
1273 -  
1274 - /**  
1275 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
1276 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
1277 - * @param tElem  
1278 - * @param tAttrs  
1279 - * @returns {{pre: Function, post: Function}}  
1280 - */  
1281 - compile: function(tElem, tAttrs) {  
1282 - // 获取所有的属性  
1283 - var $name_attr = tAttrs["name"]; // 控件的名字  
1284 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
1285 - var $disabled_attr = tAttrs["disabled"]; // 是否禁用  
1286 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
1287 -  
1288 - // controlAs名字  
1289 - var ctrlAs = '$saDategroupCtrl';  
1290 -  
1291 - // 如果有required属性,添加angularjs required验证  
1292 - if ($required_attr != undefined) {  
1293 - //console.log(tElem.html());  
1294 - tElem.find("div").attr("required", "");  
1295 - }  
1296 - // 如果有disabled属性,添加禁用标志  
1297 - if ($disabled_attr != undefined) {  
1298 - tElem.find("input").attr("ng-disabled", "true");  
1299 - tElem.find("div").attr("ng-disabled", "true");  
1300 - }  
1301 -  
1302 - return {  
1303 - pre: function (scope, element, attr) {  
1304 - // TODO:  
1305 - },  
1306 - /**  
1307 - * 相当于link函数。  
1308 - * @param scope  
1309 - * @param element  
1310 - * @param attr  
1311 - */  
1312 - post: function (scope, element, attr) {  
1313 - // name属性  
1314 - if ($name_attr) {  
1315 - scope[ctrlAs]["$name_attr"] = $name_attr;  
1316 - }  
1317 -  
1318 -  
1319 - // 日期open属性,及方法  
1320 - scope[ctrlAs].$$specialDateOpen = false;  
1321 - scope[ctrlAs].$$specialDate_open = function() {  
1322 - scope[ctrlAs].$$specialDateOpen = true;  
1323 - };  
1324 -  
1325 - // 监控选择的日期  
1326 - scope.$watch(  
1327 - function() {  
1328 - return scope[ctrlAs]['$$date_select'];  
1329 - },  
1330 - function(newValue, oldValue) {  
1331 - if (newValue) {  
1332 - //console.log("saDategroup--->selectdate:" + newValue);  
1333 - // 调用内置filter,转换日期到yyyy-MM-dd格式  
1334 - var text = $filter('date')(newValue, 'yyyy-MM-dd');  
1335 - var i;  
1336 - var isexist = false; // 日期是否已经选择标识  
1337 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
1338 - if (scope[ctrlAs]["$$data"][i].datestr == text) {  
1339 - isexist = true;  
1340 - break;  
1341 - }  
1342 - }  
1343 - if (!isexist) {  
1344 - scope[ctrlAs]["$$data"].push(  
1345 - {  
1346 - datestr: text,  
1347 - ischecked: true  
1348 - }  
1349 - );  
1350 - }  
1351 -  
1352 - }  
1353 -  
1354 - }  
1355 - );  
1356 -  
1357 - /**  
1358 - * 日期点击事件处理函数。  
1359 - * @param $index 索引  
1360 - */  
1361 - scope[ctrlAs].$$internal_datestr_click = function($index) {  
1362 - scope[ctrlAs].$$data.splice($index, 1);  
1363 - };  
1364 -  
1365 - // 测试使用watch监控$$data的变化  
1366 - scope.$watch(  
1367 - function() {  
1368 - return scope[ctrlAs]['$$data'];  
1369 - },  
1370 - function(newValue, oldValue) {  
1371 - // 根据$$data生成对应的数据  
1372 - var special_days_arr = [];  
1373 - var i;  
1374 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
1375 - special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);  
1376 - }  
1377 -  
1378 - scope[ctrlAs].$$internalmodel = special_days_arr.join(",");  
1379 - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);  
1380 -  
1381 - // 更新model  
1382 - if ($dcname_attr) {  
1383 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");  
1384 - }  
1385 - },  
1386 - true  
1387 - );  
1388 -  
1389 - // 监控dcvalue model值变换  
1390 - attr.$observe("dcvalue", function(value) {  
1391 - console.log("saDategroup 监控dc1 model值变换:" + value);  
1392 - if (value) {  
1393 - // 根据value值,修改$$data里的值  
1394 - var date_array = value.split(",");  
1395 - var i;  
1396 - scope[ctrlAs]["$$data"] = [];  
1397 - for (i = 0; i < date_array.length; i++) {  
1398 - scope[ctrlAs]["$$data"].push(  
1399 - {  
1400 - datestr: date_array[i],  
1401 - ischecked: true  
1402 - }  
1403 - );  
1404 - }  
1405 -  
1406 -  
1407 -  
1408 -  
1409 -  
1410 -  
1411 -  
1412 -  
1413 -  
1414 - }  
1415 - });  
1416 -  
1417 - }  
1418 -  
1419 - };  
1420 - }  
1421 - }  
1422 - }  
1423 -]);  
1424 -  
1425 -/**  
1426 - * saGuideboardgroup指令  
1427 - * 属性如下:  
1428 - * name(必须):控件的名字  
1429 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
1430 - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}  
1431 - * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
1432 - * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange  
1433 - * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
1434 - * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange  
1435 - * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}  
1436 - * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart  
1437 - *  
1438 - * required(可选):是否要用required验证  
1439 - *  
1440 - */  
1441 -angular.module('ScheduleApp').directive('saGuideboardgroup', [  
1442 - 'GuideboardManageService_g',  
1443 - function(guideboardManageService_g) {  
1444 - return {  
1445 - restrict: 'E',  
1446 - templateUrl: '/pages/scheduleApp/module/common/dt/MyGuideboardGroupWrapTemplate.html',  
1447 - scope: {  
1448 - model: "=" // 独立作用域,关联外部的模型object  
1449 - },  
1450 - controllerAs: '$saGuideboardgroupCtrl',  
1451 - bindToController: true,  
1452 - controller: function($scope) {  
1453 - var self = this;  
1454 - self.$$data = []; // 选择线路后,该线路的路牌数据  
1455 -  
1456 - // 测试数据  
1457 - //self.$$data = [  
1458 - // {lpid: 1, lpname: '路1', isstart: false},  
1459 - // {lpid: 2, lpname: '路2', isstart: true},  
1460 - // {lpid: 3, lpname: '路3', isstart: false}  
1461 - //];  
1462 -  
1463 -  
1464 - self.$$dataSelected = []; // 选中的路牌列表  
1465 - self.$$dataSelectedStart = undefined; // 起始路牌  
1466 -  
1467 - //self.$$dataSelected = [  
1468 - // {lpid: 11, lpname: '路11', isstart: false},  
1469 - // {lpid: 12, lpname: '路12', isstart: true},  
1470 - // {lpid: 13, lpname: '路13', isstart: false}  
1471 - //];  
1472 -  
1473 - // saGuideboardgroup组件的ng-model,用于外部绑定等操作  
1474 - self.$$internalmodel = undefined;  
1475 -  
1476 - self.$$data_init = false; // *数据源初始化标志  
1477 - self.$$data_xl_first_init = false; // 线路是否初始化  
1478 - self.$$data_lp_first_init = false; // 路牌名字是否初始化  
1479 - self.$$data_lpid_first_init = false; // 路牌id是否初始化  
1480 - self.$$data_lpstart_first_init = false; // 起始路牌是否初始化  
1481 -  
1482 - },  
1483 -  
1484 - /**  
1485 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
1486 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
1487 - * @param tElem  
1488 - * @param tAttrs  
1489 - * @returns {{pre: Function, post: Function}}  
1490 - */  
1491 - compile: function(tElem, tAttrs) {  
1492 - // TODO:获取所有的属性  
1493 - var $name_attr = tAttrs["name"]; // 控件的名字  
1494 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
1495 - var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名  
1496 - var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名  
1497 - var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名  
1498 -  
1499 - // controlAs名字  
1500 - var ctrlAs = '$saGuideboardgroupCtrl';  
1501 -  
1502 - // 如果有required属性,添加angularjs required验证  
1503 - if ($required_attr != undefined) {  
1504 - //console.log(tElem.html());  
1505 - tElem.find("div").attr("required", "");  
1506 - }  
1507 -  
1508 - return {  
1509 - pre: function(scope, element, attr) {  
1510 - // TODO:  
1511 - },  
1512 -  
1513 - /**  
1514 - * 相当于link函数。  
1515 - * @param scope  
1516 - * @param element  
1517 - * @param attr  
1518 - */  
1519 - post: function(scope, element, attr) {  
1520 - // name属性  
1521 - if ($name_attr) {  
1522 - scope[ctrlAs]["$name_attr"] = $name_attr;  
1523 - }  
1524 -  
1525 - // TODO:  
1526 -  
1527 -  
1528 - /**  
1529 - * 路牌列表点击(路牌列表中选中路牌)  
1530 - * @param $index  
1531 - */  
1532 - scope[ctrlAs].$$internal_lplist_click = function($index) {  
1533 - var data_temp = scope[ctrlAs].$$data;  
1534 - if (data_temp && data_temp.length > $index) {  
1535 - scope[ctrlAs].$$dataSelected.push({  
1536 - lpid: data_temp[$index].lpid,  
1537 - lpname: data_temp[$index].lpname,  
1538 - isstart: data_temp[$index].isstart  
1539 - });  
1540 -  
1541 - // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌  
1542 - if (scope[ctrlAs].$$dataSelectedStart == undefined) {  
1543 - scope[ctrlAs].$$internal_sellplist_click(  
1544 - scope[ctrlAs].$$dataSelected.length - 1);  
1545 - }  
1546 - }  
1547 - };  
1548 - /**  
1549 - * 选中的路牌单击(初始路牌选择)  
1550 - * @param $index  
1551 - */  
1552 - scope[ctrlAs].$$internal_sellplist_click = function($index) {  
1553 - var data_temp = scope[ctrlAs].$$dataSelected;  
1554 - if (data_temp && data_temp.length > $index) {  
1555 - for (var i = 0; i < data_temp.length; i++) {  
1556 - data_temp[i].isstart = false;  
1557 - }  
1558 - data_temp[$index].isstart = true;  
1559 - scope[ctrlAs].$$dataSelectedStart = $index;  
1560 - }  
1561 - };  
1562 - /**  
1563 - * 选中的路牌双击(删除选中的路牌)  
1564 - * @param $index  
1565 - */  
1566 - scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {  
1567 - var data_temp = scope[ctrlAs].$$dataSelected;  
1568 - if (data_temp && data_temp.length > $index) {  
1569 - if (scope[ctrlAs].$$dataSelectedStart == $index) {  
1570 - scope[ctrlAs].$$dataSelectedStart = undefined;  
1571 - }  
1572 - data_temp.splice($index, 1);  
1573 - }  
1574 - };  
1575 -  
1576 -  
1577 - /**  
1578 - * 验证内部数据,更新外部model  
1579 - */  
1580 - scope[ctrlAs].$$internal_validate_model = function() {  
1581 - var data_temp = scope[ctrlAs].$$dataSelected;  
1582 - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;  
1583 - var lpNames = [];  
1584 - var lpIds = [];  
1585 - var lpStart = 0;  
1586 - var i = 0;  
1587 -  
1588 - if (data_temp &&  
1589 - data_temp.length > 0 &&  
1590 - data_temp2 != undefined) {  
1591 -  
1592 - for (i = 0; i < data_temp.length; i++) {  
1593 - lpNames.push(data_temp[i].lpname);  
1594 - lpIds.push(data_temp[i].lpid)  
1595 - }  
1596 - data_temp[data_temp2].isstart = true;  
1597 - lpStart = data_temp2 + 1;  
1598 -  
1599 - // 更新内部model,用于外部验证  
1600 - // 内部model的值暂时随意,以后再改  
1601 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
1602 -  
1603 - // 更新外部model字段  
1604 - if ($lprangename_attr) {  
1605 - console.log("lprangename=" + lpNames.join(','));  
1606 - eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");  
1607 - }  
1608 - if ($lpidrangename_attr) {  
1609 - console.log("lpidrangename=" + lpIds.join(','));  
1610 - eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");  
1611 - }  
1612 - if ($lpstartname_attr) {  
1613 - console.log("lpstartname=" + lpStart);  
1614 - eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");  
1615 - }  
1616 -  
1617 - } else {  
1618 - scope[ctrlAs].$$internalmodel = undefined;  
1619 - }  
1620 -  
1621 -  
1622 - };  
1623 -  
1624 - // 监控内部数据,$$data_selected 变化  
1625 - scope.$watch(  
1626 - function() {  
1627 - return scope[ctrlAs].$$dataSelected;  
1628 - },  
1629 - function(newValue, oldValue) {  
1630 - scope[ctrlAs].$$internal_validate_model();  
1631 - },  
1632 - true  
1633 - );  
1634 -  
1635 - // 监控内部数据,$$data_selected_start 变化  
1636 - scope.$watch(  
1637 - function() {  
1638 - return scope[ctrlAs].$$dataSelectedStart;  
1639 - },  
1640 - function(newValue, oldValue) {  
1641 - scope[ctrlAs].$$internal_validate_model();  
1642 - },  
1643 - true  
1644 - );  
1645 -  
1646 - /**  
1647 - * 验证数据是否初始化完成,  
1648 - * 所谓的初始化就是内部所有的数据被有效设定过一次。  
1649 - */  
1650 - scope[ctrlAs].$$internal_validate_init = function() {  
1651 - var self = scope[ctrlAs];  
1652 -  
1653 - if (self.$$data_xl_first_init &&  
1654 - self.$$data_lp_first_init &&  
1655 - self.$$data_lpid_first_init &&  
1656 - self.$$data_lpstart_first_init) {  
1657 - console.log("数据初始化完毕!");  
1658 - self.$$data_init = true;  
1659 - }  
1660 -  
1661 - };  
1662 -  
1663 - // 监控初始化标志,线路,路牌,路牌id,起始路牌  
1664 - scope.$watch(  
1665 - function() {  
1666 - return scope[ctrlAs].$$data_xl_first_init;  
1667 - },  
1668 - function(newValue, oldValue) {  
1669 - scope[ctrlAs].$$internal_validate_init();  
1670 - }  
1671 - );  
1672 - scope.$watch(  
1673 - function() {  
1674 - return scope[ctrlAs].$$data_lp_first_init;  
1675 - },  
1676 - function(newValue, oldValue) {  
1677 - scope[ctrlAs].$$internal_validate_init();  
1678 - }  
1679 - );  
1680 - scope.$watch(  
1681 - function() {  
1682 - return scope[ctrlAs].$$data_lpid_first_init;  
1683 - },  
1684 - function(newValue, oldValue) {  
1685 - scope[ctrlAs].$$internal_validate_init();  
1686 - }  
1687 - );  
1688 - scope.$watch(  
1689 - function() {  
1690 - return scope[ctrlAs].$$data_lpstart_first_init;  
1691 - },  
1692 - function(newValue, oldValue) {  
1693 - scope[ctrlAs].$$internal_validate_init();  
1694 - }  
1695 - );  
1696 -  
1697 -  
1698 - // 监控线路id的变化  
1699 - attr.$observe("xlidvalue", function(value) {  
1700 - if (value && value != "") {  
1701 - console.log("xlidvalue=" + value);  
1702 -  
1703 - guideboardManageService_g.rest.list(  
1704 - {"xl.id_eq": value, size: 100},  
1705 - function(result) {  
1706 - // 获取值了  
1707 - console.log("路牌获取了");  
1708 -  
1709 - scope[ctrlAs].$$data = [];  
1710 - for (var i = 0; i < result.content.length; i++) {  
1711 - scope[ctrlAs].$$data.push({  
1712 - lpid: result.content[i].id,  
1713 - lpname: result.content[i].lpName,  
1714 - isstart: false  
1715 - });  
1716 - }  
1717 - if (scope[ctrlAs].$$data_init) {  
1718 - scope[ctrlAs].$$dataSelected = [];  
1719 - scope[ctrlAs].$$dataSelectedStart = undefined;  
1720 - scope[ctrlAs].$$internalmodel = undefined;  
1721 - }  
1722 - scope[ctrlAs].$$data_xl_first_init = true;  
1723 - },  
1724 - function(result) {  
1725 -  
1726 - }  
1727 - );  
1728 -  
1729 - }  
1730 - });  
1731 -  
1732 - // 监控路牌名称范围值的变化  
1733 - attr.$observe("lprangevalue", function(value) {  
1734 - if (value && value != "") {  
1735 - var data_temp = scope[ctrlAs].$$dataSelected;  
1736 - var lpnames = value.split(",");  
1737 - var i = 0;  
1738 - if (data_temp && data_temp.length == 0) { // 初始创建  
1739 - console.log("lprangevalue变换了");  
1740 - for (i = 0; i < lpnames.length; i++) {  
1741 - scope[ctrlAs].$$dataSelected.push({  
1742 - lpname: lpnames[i],  
1743 - isstart: false  
1744 - });  
1745 - }  
1746 - } else {  
1747 - for (i = 0; i < lpnames.length; i++) {  
1748 - data_temp[i].lpname = lpnames[i];  
1749 - }  
1750 - }  
1751 - scope[ctrlAs].$$data_lp_first_init = true;  
1752 - }  
1753 - });  
1754 -  
1755 - // 监控路牌id范围值的变化  
1756 - attr.$observe("lpidrangevalue", function(value) {  
1757 - if (value && value != "") {  
1758 - console.log("lpidrangevalue=" + value);  
1759 - var data_temp = scope[ctrlAs].$$dataSelected;  
1760 - var lpids = value.split(",");  
1761 - var i = 0;  
1762 - if (data_temp && data_temp.length == 0) { // 初始创建  
1763 - console.log("lpidrangevalue");  
1764 - for (i = 0; i < lpids.length; i++) {  
1765 - scope[ctrlAs].$$dataSelected.push({  
1766 - lpid: lpids[i],  
1767 - isstart: false  
1768 - });  
1769 - }  
1770 - } else {  
1771 - for (i = 0; i < lpids.length; i++) {  
1772 - data_temp[i].lpid = lpids[i];  
1773 - }  
1774 - }  
1775 - scope[ctrlAs].$$data_lpid_first_init = true;  
1776 - }  
1777 - });  
1778 -  
1779 - // 监控起始路牌的变化  
1780 - attr.$observe("lpstartvalue", function(value) {  
1781 - if (value && value != "") {  
1782 - scope[ctrlAs].$$dataSelectedStart = value - 1;  
1783 - scope[ctrlAs].$$data_lpstart_first_init = true;  
1784 - }  
1785 - });  
1786 -  
1787 -  
1788 -  
1789 - }  
1790 - }  
1791 -  
1792 - }  
1793 - }  
1794 - }  
1795 -]);  
1796 -  
1797 -/**  
1798 - * saEmployeegroup指令  
1799 - * 属性如下:  
1800 - * name(必须):控件的名字  
1801 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
1802 - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}  
1803 - * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
1804 - * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange  
1805 - * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
1806 - * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange  
1807 - * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}  
1808 - * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart  
1809 - *  
1810 - * required(可选):是否要用required验证  
1811 - *  
1812 - */  
1813 -angular.module('ScheduleApp').directive('saEmployeegroup', [  
1814 - 'EmployeeConfigService_g',  
1815 - function(employeeConfigService_g) {  
1816 - return {  
1817 - restrict: 'E',  
1818 - templateUrl: '/pages/scheduleApp/module/common/dt/MyEmployeeGroupWrapTemplate.html',  
1819 - scope: {  
1820 - model: "=" // 独立作用域,关联外部的模型object  
1821 - },  
1822 - controllerAs: '$saEmployeegroupCtrl',  
1823 - bindToController: true,  
1824 - controller: function($scope) {  
1825 - var self = this;  
1826 - self.$$data = []; // 选择线路后,该线路的人员配置数据  
1827 -  
1828 - // 测试数据  
1829 - //self.$$data = [  
1830 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},  
1831 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},  
1832 - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}  
1833 - //];  
1834 -  
1835 - self.$$dataSelected = []; // 选中的人员配置列表  
1836 - self.$$dataSelectedStart = undefined; // 起始人员配置  
1837 -  
1838 - //self.$$dataSelected = [  
1839 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},  
1840 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},  
1841 - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}  
1842 - //];  
1843 -  
1844 - self.$$isFB = false; // 是否分班  
1845 - self.$$dataFBSelected = []; // 选中的分班人员组配置列表  
1846 - self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识  
1847 - self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合  
1848 -  
1849 - //self.$$dataFBSelected = [  
1850 - // {isstart: true, group: [  
1851 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},  
1852 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}  
1853 - // ]},  
1854 - // {isstart: false, group: [  
1855 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},  
1856 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}  
1857 - // ]}  
1858 - //];  
1859 -  
1860 - // saGuideboardgroup组件的ng-model,用于外部绑定等操作  
1861 - self.$$internalmodel = undefined;  
1862 -  
1863 - self.$$data_init = false; // *数据源初始化标志  
1864 - self.$$data_xl_first_init = false; // 线路是否初始化  
1865 - self.$$data_ry_first_init = false; // 人员配置是否初始化  
1866 - self.$$data_ry_first_data = undefined; // 人员配置初始化数据  
1867 - self.$$data_rycid_first_init = false; // 人员配置id是否初始化  
1868 - self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据  
1869 - self.$$data_rystart_first_init = false; // 起始人员是否初始化  
1870 - self.$$data_rystart_first_data = undefined; // 起始人员初始化数据  
1871 -  
1872 - },  
1873 -  
1874 - /**  
1875 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
1876 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
1877 - * @param tElem  
1878 - * @param tAttrs  
1879 - * @returns {{pre: Function, post: Function}}  
1880 - */  
1881 - compile: function(tElem, tAttrs) {  
1882 - // TODO:获取所有的属性  
1883 - var $name_attr = tAttrs["name"]; // 控件的名字  
1884 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
1885 - var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名  
1886 - var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名  
1887 - var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名  
1888 -  
1889 - // controlAs名字  
1890 - var ctrlAs = '$saEmployeegroupCtrl';  
1891 -  
1892 - // 如果有required属性,添加angularjs required验证  
1893 - if ($required_attr != undefined) {  
1894 - //console.log(tElem.html());  
1895 - tElem.find("div").attr("required", "");  
1896 - }  
1897 -  
1898 - return {  
1899 - pre: function(scope, element, attr) {  
1900 - // TODO:  
1901 - },  
1902 -  
1903 - /**  
1904 - * 相当于link函数。  
1905 - * @param scope  
1906 - * @param element  
1907 - * @param attr  
1908 - */  
1909 - post: function(scope, element, attr) {  
1910 - // name属性  
1911 - if ($name_attr) {  
1912 - scope[ctrlAs]["$name_attr"] = $name_attr;  
1913 - }  
1914 -  
1915 - /**  
1916 - * 人员配置列表点击(人员配置列表中选中路牌)  
1917 - * @param $index  
1918 - */  
1919 - scope[ctrlAs].$$internal_rylist_click = function($index) {  
1920 - var data_temp = scope[ctrlAs].$$data;  
1921 - if (data_temp && data_temp.length > $index) {  
1922 - if (!scope[ctrlAs].$$isFB) { // 不分班  
1923 - scope[ctrlAs].$$dataSelected.push({  
1924 - id : data_temp[$index].id,  
1925 - dbbm: data_temp[$index].dbbm,  
1926 - jsy: data_temp[$index].jsy,  
1927 - spy: data_temp[$index].spy,  
1928 - isstart: false  
1929 - });  
1930 -  
1931 - // 如果没有指定过初始人员,默认选择此人员作为起始人员  
1932 - if (scope[ctrlAs].$$dataSelectedStart == undefined) {  
1933 - scope[ctrlAs].$$internal_selrylist_click(  
1934 - scope[ctrlAs].$$dataSelected.length - 1);  
1935 - }  
1936 - } else { // 分班  
1937 - if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员  
1938 - scope[ctrlAs].$$dataFBSelected  
1939 - [scope[ctrlAs].$$dataFBInternalSelected.gindex].group  
1940 - [scope[ctrlAs].$$dataFBInternalSelected.index] = {  
1941 - id : data_temp[$index].id,  
1942 - dbbm: data_temp[$index].dbbm,  
1943 - jsy: data_temp[$index].jsy,  
1944 - spy: data_temp[$index].spy,  
1945 - isselected: true  
1946 - };  
1947 -  
1948 - } else {  
1949 - scope[ctrlAs].$$dataFBSelected.push({  
1950 - isstart: false,  
1951 - group: [].concat(  
1952 - {  
1953 - id : data_temp[$index].id,  
1954 - dbbm: data_temp[$index].dbbm,  
1955 - jsy: data_temp[$index].jsy,  
1956 - spy: data_temp[$index].spy,  
1957 - isselected: false  
1958 - }, {  
1959 - id : data_temp[$index].id,  
1960 - dbbm: data_temp[$index].dbbm,  
1961 - jsy: data_temp[$index].jsy,  
1962 - spy: data_temp[$index].spy,  
1963 - isselected: false  
1964 - }  
1965 - )  
1966 - });  
1967 - if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {  
1968 - scope[ctrlAs].$$internal_selrygrouplist_click(  
1969 - scope[ctrlAs].$$dataFBSelected.length - 1);  
1970 - }  
1971 - }  
1972 - }  
1973 -  
1974 - }  
1975 - };  
1976 -  
1977 - /**  
1978 - * 选中的人员单击(初始人员选择)  
1979 - * @param $index  
1980 - */  
1981 - scope[ctrlAs].$$internal_selrylist_click = function($index) {  
1982 - var data_temp = scope[ctrlAs].$$dataSelected;  
1983 - if (data_temp && data_temp.length > $index) {  
1984 - for (var i = 0; i < data_temp.length; i++) {  
1985 - data_temp[i].isstart = false;  
1986 - }  
1987 - data_temp[$index].isstart = true;  
1988 - scope[ctrlAs].$$dataSelectedStart = $index;  
1989 - }  
1990 - };  
1991 - /**  
1992 - * 选中的人员双击(删除选中的人员)  
1993 - * @param $index  
1994 - */  
1995 - scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {  
1996 - var data_temp = scope[ctrlAs].$$dataSelected;  
1997 - if (data_temp && data_temp.length > $index) {  
1998 - if (scope[ctrlAs].$$dataSelectedStart == $index) {  
1999 - scope[ctrlAs].$$dataSelectedStart = undefined;  
2000 - }  
2001 - data_temp.splice($index, 1);  
2002 - }  
2003 - };  
2004 -  
2005 - /**  
2006 - * 选中的分班组人员单击(初始人员选择)  
2007 - * @param $index  
2008 - */  
2009 - scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {  
2010 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
2011 - if (data_temp && data_temp.length > $index) {  
2012 - for (var i = 0; i < data_temp.length; i++) {  
2013 - data_temp[i].isstart = false;  
2014 - for (var j = 0; j < data_temp[i].group.length; j++) {  
2015 - data_temp[i].group[j].isselected = false;  
2016 - }  
2017 - }  
2018 - data_temp[$index].isstart = true;  
2019 - scope[ctrlAs].$$dataFBSelectedStart = $index;  
2020 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
2021 - }  
2022 - };  
2023 - /**  
2024 - * 分组内部单击(选中分班中的某组人员)  
2025 - * @param $groupindex 组index  
2026 - * @param $index 组内部某个index  
2027 - * @param $event 事件防止冒泡  
2028 - */  
2029 - scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {  
2030 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
2031 - if (data_temp && data_temp.length > $groupindex) {  
2032 - if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {  
2033 - // $$dataFBInternalSelected的格式如下:  
2034 - //{gindex: 1, index: 0}  
2035 - for (var i = 0; i < data_temp.length; i++) {  
2036 - data_temp[i].isstart = false;  
2037 - for (var j = 0; j < data_temp[i].group.length; j++) {  
2038 - data_temp[i].group[j].isselected = false;  
2039 - }  
2040 - }  
2041 - data_temp[$groupindex].group[$index].isselected = true;  
2042 - scope[ctrlAs].$$dataFBInternalSelected = {  
2043 - gindex: $groupindex, index: $index  
2044 - };  
2045 - scope[ctrlAs].$$dataFBSelectedStart = undefined;  
2046 - $event.stopPropagation();  
2047 - }  
2048 - }  
2049 -  
2050 - };  
2051 - /**  
2052 - * 选中的分班人员双击(删除选中的人员)  
2053 - * @param $index  
2054 - */  
2055 - scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {  
2056 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
2057 - if (data_temp && data_temp.length > $index) {  
2058 - if (scope[ctrlAs].$$dataFBSelectedStart == $index) {  
2059 - scope[ctrlAs].$$dataFBSelectedStart = undefined;  
2060 - }  
2061 - if (scope[ctrlAs].$$dataFBInternalSelected &&  
2062 - scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {  
2063 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
2064 - }  
2065 - data_temp.splice($index, 1);  
2066 - }  
2067 - };  
2068 -  
2069 - /**  
2070 - * 验证内部数据,更新外部model  
2071 - */  
2072 - scope[ctrlAs].$$internal_validate_model = function() {  
2073 - var data_temp = scope[ctrlAs].$$dataSelected;  
2074 - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;  
2075 - var data_temp3 = scope[ctrlAs].$$dataFBSelected;  
2076 - var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;  
2077 - var ryDbbms = [];  
2078 - var ryDbbm_group = [];  
2079 - var ryCids = [];  
2080 - var ryCid_group = [];  
2081 - var ryStart = 0;  
2082 - var i = 0;  
2083 - var j = 0;  
2084 -  
2085 - var isFB = scope[ctrlAs].$$isFB;  
2086 -  
2087 - if (isFB) {  
2088 - if (data_temp3 &&  
2089 - data_temp3.length > 0 &&  
2090 - data_temp4 != undefined) {  
2091 -  
2092 - for (i = 0; i < data_temp3.length; i++) {  
2093 - for (j = 0; j < data_temp3[i].group.length; j++) {  
2094 - ryDbbm_group.push(data_temp3[i].group[j].dbbm);  
2095 - ryCid_group.push(data_temp3[i].group[j].id);  
2096 - }  
2097 - ryDbbms.push(ryDbbm_group.join("-"));  
2098 - ryCids.push(ryCid_group.join("-"));  
2099 - ryDbbm_group = [];  
2100 - ryCid_group = [];  
2101 - }  
2102 -  
2103 - data_temp3[data_temp4].isstart = true;  
2104 - ryStart = data_temp4 + 1;  
2105 -  
2106 - // 更新内部model,用于外部验证  
2107 - // 内部model的值暂时随意,以后再改  
2108 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
2109 -  
2110 - // 更新外部model字段  
2111 - if ($dbbmrangename_attr) {  
2112 - console.log("dbbmrangename=" + ryDbbms.join(','));  
2113 - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");  
2114 - }  
2115 - if (rycidrangename_attr) {  
2116 - console.log("rycidrangename=" + ryCids.join(','));  
2117 - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");  
2118 - }  
2119 - if ($rystartname_attr) {  
2120 - console.log("rystartname=" + ryStart);  
2121 - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");  
2122 - }  
2123 -  
2124 - } else {  
2125 - scope[ctrlAs].$$internalmodel = undefined;  
2126 - }  
2127 -  
2128 - } else {  
2129 - if (data_temp &&  
2130 - data_temp.length > 0 &&  
2131 - data_temp2 != undefined) {  
2132 -  
2133 - for (i = 0; i < data_temp.length; i++) {  
2134 - ryDbbms.push(data_temp[i].dbbm);  
2135 - ryCids.push(data_temp[i].id);  
2136 - }  
2137 - data_temp[data_temp2].isstart = true;  
2138 - ryStart = data_temp2 + 1;  
2139 -  
2140 - // 更新内部model,用于外部验证  
2141 - // 内部model的值暂时随意,以后再改  
2142 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
2143 -  
2144 - // 更新外部model字段  
2145 - if ($dbbmrangename_attr) {  
2146 - console.log("dbbmrangename=" + ryDbbms.join(','));  
2147 - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");  
2148 - }  
2149 - if (rycidrangename_attr) {  
2150 - console.log("rycidrangename=" + ryCids.join(','));  
2151 - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");  
2152 - }  
2153 - if ($rystartname_attr) {  
2154 - console.log("rystartname=" + ryStart);  
2155 - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");  
2156 - }  
2157 -  
2158 - } else {  
2159 - scope[ctrlAs].$$internalmodel = undefined;  
2160 - }  
2161 - }  
2162 -  
2163 - };  
2164 -  
2165 - // 监控内部数据,$$dataSelected 变化  
2166 - scope.$watch(  
2167 - function() {  
2168 - return scope[ctrlAs].$$dataSelected;  
2169 - },  
2170 - function(newValue, oldValue) {  
2171 - scope[ctrlAs].$$internal_validate_model();  
2172 - },  
2173 - true  
2174 - );  
2175 -  
2176 - // 监控内部数据,$$dataSelectedStart 变化  
2177 - scope.$watch(  
2178 - function() {  
2179 - return scope[ctrlAs].$$dataSelectedStart;  
2180 - },  
2181 - function(newValue, oldValue) {  
2182 - scope[ctrlAs].$$internal_validate_model();  
2183 - },  
2184 - true  
2185 - );  
2186 -  
2187 -  
2188 - // 监控内部数据,$$dataFBSelected 变化  
2189 - scope.$watch(  
2190 - function() {  
2191 - return scope[ctrlAs].$$dataFBSelected;  
2192 - },  
2193 - function(newValue, oldValue) {  
2194 - scope[ctrlAs].$$internal_validate_model();  
2195 - },  
2196 - true  
2197 - );  
2198 -  
2199 - // 监控内部数据,$$dataFBSelectedStart 变化  
2200 - scope.$watch(  
2201 - function() {  
2202 - return scope[ctrlAs].$$dataFBSelectedStart;  
2203 - },  
2204 - function(newValue, oldValue) {  
2205 - scope[ctrlAs].$$internal_validate_model();  
2206 - },  
2207 - true  
2208 - );  
2209 -  
2210 - // 监控内部数据,$$dataFBInternalSelected 变化  
2211 - scope.$watch(  
2212 - function() {  
2213 - return scope[ctrlAs].$$dataFBInternalSelected;  
2214 - },  
2215 - function(newValue, oldValue) {  
2216 - scope[ctrlAs].$$internal_validate_model();  
2217 - },  
2218 - true  
2219 - );  
2220 -  
2221 - // 监控内部数据,$$isFB 变化  
2222 - scope.$watch(  
2223 - function() {  
2224 - return scope[ctrlAs].$$isFB;  
2225 - },  
2226 - function(newValue, oldValue) {  
2227 - scope[ctrlAs].$$internal_validate_model();  
2228 - },  
2229 - true  
2230 - );  
2231 -  
2232 - /**  
2233 - * 验证数据是否初始化完成,  
2234 - * 所谓的初始化就是内部所有的数据被有效设定过一次。  
2235 - */  
2236 - scope[ctrlAs].$$internal_validate_init = function() {  
2237 - var self = scope[ctrlAs];  
2238 - var data_temp = self.$$data;  
2239 - var dataSelect_temp = self.$$dataSelected;  
2240 - var dataFBSelect_temp = self.$$dataFBSelected;  
2241 - var dbbmnames = null;  
2242 - var dbbmnamegroup = null;  
2243 - var rycids = null;  
2244 - var rycidgroup = null;  
2245 -  
2246 - var i = 0;  
2247 - var j = 0;  
2248 - var k = 0;  
2249 -  
2250 - if (self.$$data_xl_first_init &&  
2251 - self.$$data_ry_first_init &&  
2252 - self.$$data_rycid_first_init &&  
2253 - self.$$data_rystart_first_init && !self.$$data_init) {  
2254 - console.log("开始初始化数据");  
2255 -  
2256 - // 判定是否分班,字符串中包含-就是了  
2257 - if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班  
2258 - self.$$isFB = true;  
2259 -  
2260 - // 搭班编码、人员配置id  
2261 - dbbmnames = self.$$data_ry_first_data.split(",");  
2262 - rycids = self.$$data_rycid_first_data.split(",");  
2263 - for (i = 0; i < dbbmnames.length; i++) {  
2264 - dataFBSelect_temp.push({  
2265 - group: [],  
2266 - isstart: false  
2267 - });  
2268 - dbbmnamegroup = dbbmnames[i].split("-");  
2269 - rycidgroup = rycids[i].split("-");  
2270 -  
2271 - for (k = 0; k < dbbmnamegroup.length; k++) {  
2272 - dataFBSelect_temp[i].group.push({  
2273 - id: rycidgroup[k],  
2274 - dbbm: dbbmnamegroup[k],  
2275 - isselected: false  
2276 - });  
2277 -  
2278 - for (j = 0; j < data_temp.length; j++) {  
2279 - if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {  
2280 - dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;  
2281 - dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;  
2282 - break;  
2283 - }  
2284 - }  
2285 - }  
2286 -  
2287 - }  
2288 -  
2289 - // 初始人员  
2290 - scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;  
2291 -  
2292 -  
2293 - } else if (dataSelect_temp.length == 0) {  
2294 - self.$$isFB = false;  
2295 -  
2296 - // 搭班编码、人员配置id  
2297 - dbbmnames = self.$$data_ry_first_data.split(",");  
2298 - rycids = self.$$data_rycid_first_data.split(",");  
2299 - for (i = 0; i < dbbmnames.length; i++) {  
2300 - dataSelect_temp.push({  
2301 - id: rycids[i],  
2302 - dbbm: dbbmnames[i],  
2303 - isstart: false  
2304 - });  
2305 - for (j = 0; j < data_temp.length; j++) {  
2306 - if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {  
2307 - dataSelect_temp[i].jsy = data_temp[j].jsy;  
2308 - dataSelect_temp[i].spy = data_temp[j].spy;  
2309 - break;  
2310 - }  
2311 - }  
2312 - }  
2313 - // 初始人员  
2314 - scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1;  
2315 -  
2316 - }  
2317 -  
2318 - console.log("数据初始化完毕!");  
2319 - self.$$data_init = true;  
2320 - }  
2321 -  
2322 - };  
2323 -  
2324 - // 监控初始化标志,线路,人员,起始人员  
2325 - scope.$watch(  
2326 - function() {  
2327 - return scope[ctrlAs].$$data_xl_first_init;  
2328 - },  
2329 - function(newValue, oldValue) {  
2330 - scope[ctrlAs].$$internal_validate_init();  
2331 - }  
2332 - );  
2333 - scope.$watch(  
2334 - function() {  
2335 - return scope[ctrlAs].$$data_ry_first_init;  
2336 - },  
2337 - function(newValue, oldValue) {  
2338 - scope[ctrlAs].$$internal_validate_init();  
2339 - }  
2340 - );  
2341 - scope.$watch(  
2342 - function() {  
2343 - return scope[ctrlAs].$$data_rycid_first_init;  
2344 - },  
2345 - function(newValue, oldValue) {  
2346 - scope[ctrlAs].$$internal_validate_init();  
2347 - }  
2348 - );  
2349 - scope.$watch(  
2350 - function() {  
2351 - return scope[ctrlAs].$$data_rystart_first_init;  
2352 - },  
2353 - function(newValue, oldValue) {  
2354 - scope[ctrlAs].$$internal_validate_init();  
2355 - }  
2356 - );  
2357 -  
2358 -  
2359 - // 监控线路id的变化  
2360 - attr.$observe("xlidvalue", function(value) {  
2361 - if (value && value != "") {  
2362 - console.log("xlidvalue=" + value);  
2363 -  
2364 - employeeConfigService_g.rest.list(  
2365 - {"xl.id_eq": value, size: 100},  
2366 - function(result) {  
2367 - // 获取值了  
2368 - console.log("人员配置获取了");  
2369 -  
2370 - scope[ctrlAs].$$data = [];  
2371 - for (var i = 0; i < result.content.length; i++) {  
2372 - scope[ctrlAs].$$data.push({  
2373 - id: result.content[i].id,  
2374 - dbbm: result.content[i].dbbm,  
2375 - jsy: result.content[i].jsy.personnelName,  
2376 - spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName  
2377 - });  
2378 - }  
2379 - if (scope[ctrlAs].$$data_init) {  
2380 - scope[ctrlAs].$$dataSelected = [];  
2381 - scope[ctrlAs].$$dataSelectedStart = undefined;  
2382 -  
2383 - scope[ctrlAs].$$dataFBSelected = [];  
2384 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
2385 - scope[ctrlAs].$$dataFBSelectedStart = undefined;  
2386 -  
2387 - scope[ctrlAs].$$internalmodel = undefined;  
2388 - }  
2389 - scope[ctrlAs].$$data_xl_first_init = true;  
2390 - },  
2391 - function(result) {  
2392 -  
2393 - }  
2394 - );  
2395 -  
2396 - }  
2397 - });  
2398 -  
2399 - // 监控搭班编码范围值的变化  
2400 - attr.$observe("dbbmrangevalue", function(value) {  
2401 - if (value && value != "") {  
2402 - console.log("dbbmrangevalue变换了");  
2403 - scope[ctrlAs].$$data_ry_first_init = true;  
2404 - scope[ctrlAs].$$data_ry_first_data = value;  
2405 - }  
2406 - });  
2407 -  
2408 - // 监控人员配置id范围值的变化  
2409 - attr.$observe("rycidrangevalue", function(value) {  
2410 - if (value && value != "") {  
2411 - console.log("rycidrangevalue变换了");  
2412 - scope[ctrlAs].$$data_rycid_first_init = true;  
2413 - scope[ctrlAs].$$data_rycid_first_data = value;  
2414 - }  
2415 - });  
2416 -  
2417 - // 监控起始人员的变化  
2418 - attr.$observe("rystartvalue", function(value) {  
2419 - if (value && value != "") {  
2420 - console.log("rystartvalue变换了");  
2421 - scope[ctrlAs].$$data_rystart_first_init = true;  
2422 - scope[ctrlAs].$$data_rystart_first_data = value;  
2423 - }  
2424 - });  
2425 -  
2426 - }  
2427 - }  
2428 -  
2429 - }  
2430 - }  
2431 - }  
2432 -]); 1 +// 自定义指令,指令模版在dt目录下
  2 +
  3 +
  4 +angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) {
  5 + return {
  6 + restrict: 'A',
  7 + link: function(scope, element) {
  8 + // 初始隐藏loading界面
  9 + element.hide();
  10 +
  11 + // 开始请求通知处理
  12 + requestNotificationChannel.onRequestStarted(scope, function() {
  13 + element.show();
  14 + });
  15 + // 请求结束通知处理
  16 + requestNotificationChannel.onRequestEnded(scope, function() {
  17 + element.hide();
  18 + });
  19 + }
  20 + };
  21 +}]);
  22 +
  23 +angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
  24 + return {
  25 + restrict: 'E',
  26 + templateUrl: '/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html',
  27 + scope: {
  28 + model: "="
  29 + },
  30 + controllerAs: "$saSelectCtrl",
  31 + bindToController: true,
  32 + controller: function() {
  33 + var self = this;
  34 + self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}
  35 + },
  36 + /**
  37 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  38 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  39 + * @param tElem
  40 + * @param tAttrs
  41 + * @returns {{pre: Function, post: Function}}
  42 + */
  43 + compile: function(tElem, tAttrs) {
  44 + // 确定是否使用angularjs required验证
  45 + // 属性 required
  46 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  47 + var required_attr = tAttrs["required"];
  48 + if (required_attr) {
  49 + if (required_attr == "true") {
  50 + // 添加required属性指令
  51 + tElem.find("ui-select").attr("required", "");
  52 + } else {
  53 + // 不等于true,不添加required属性指令
  54 + }
  55 + } else {
  56 + // 不添加required属性指令
  57 + }
  58 +
  59 + //console.log("saSelect" + ":compile = >" + tElem.html());
  60 +
  61 + return {
  62 + pre: function(scope, element, attr) {
  63 + // TODO:
  64 + },
  65 + /**
  66 + * 相当于link函数。
  67 + *
  68 + * 重要属性如下:
  69 + * model 是绑定外部值。
  70 + * dicgroup 字典组的类型
  71 + * name input name属性值
  72 + */
  73 + post: function(scope, element, attr) {
  74 + // 1、获取属性
  75 + var dicgroup_attr = attr['dicgroup']; // 字典组的类型
  76 + var name_attr = attr['name']; // input name属性值
  77 + var dicname_attr = attr['dicname']; // model关联的字典名字段
  78 + var codename_attr = attr['codename']; // model关联的字典值字段
  79 + var placeholder_attr = attr['placeholder']; // select placeholder提示
  80 +
  81 + // 系统的字典对象,使用dictionaryUtils类获取
  82 + var origin_dicgroup;
  83 + var dic_key; // 字典key
  84 +
  85 + if (dicgroup_attr) { // 赋值指定的字典数据
  86 + origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);
  87 + for (dic_key in origin_dicgroup) {
  88 + var data = {}; // 重新组合的字典元素对象
  89 + if (dic_key == "true")
  90 + data.code = true;
  91 + else
  92 + data.code = dic_key;
  93 + data.name = origin_dicgroup[dic_key];
  94 + scope["$saSelectCtrl"].datas.push(data);
  95 + }
  96 + }
  97 +
  98 + if (name_attr) {
  99 + scope["$saSelectCtrl"].nv = name_attr;
  100 + }
  101 + if (placeholder_attr) {
  102 + scope["$saSelectCtrl"].ph = placeholder_attr;
  103 + }
  104 +
  105 + scope["$saSelectCtrl"].select = function($item) {
  106 + if (codename_attr) {
  107 + scope["$saSelectCtrl"].model[codename_attr] = $item.code;
  108 + }
  109 + if (dicname_attr) {
  110 + scope["$saSelectCtrl"].model[dicname_attr] = $item.name;
  111 + }
  112 + };
  113 +
  114 + scope["$saSelectCtrl"].remove = function() {
  115 + if (codename_attr) {
  116 + scope["$saSelectCtrl"].model[codename_attr] = null;
  117 + }
  118 + if (dicname_attr) {
  119 + scope["$saSelectCtrl"].model[dicname_attr] = null;
  120 + }
  121 + scope["$saSelectCtrl"].cmodel = null;
  122 + };
  123 +
  124 + $timeout(function() {
  125 + // 创建内部使用的绑定对象
  126 + var model_code = scope["$saSelectCtrl"].model[codename_attr];
  127 + scope["$saSelectCtrl"].cmodel = model_code;
  128 + }, 0);
  129 + }
  130 + }
  131 + }
  132 + };
  133 +}]);
  134 +
  135 +/**
  136 + * saRadiogroup指令
  137 + * 属性如下:
  138 + * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate
  139 + * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)
  140 + * name(必须):控件的名字
  141 + * required(可选):是否要用required验证
  142 + * disabled(可选):标示单选框是否可选
  143 + *
  144 + */
  145 +angular.module('ScheduleApp').directive("saRadiogroup", [function() {
  146 + /**
  147 + * 使用字典数据的单选按钮组的指令。
  148 + * 指令名称:truefalse-Dic
  149 + */
  150 + return {
  151 + restrict: 'E',
  152 + templateUrl: '/pages/scheduleApp/module/common/dt/MyRadioGroupWrapTemplate.html',
  153 + scope: {
  154 + model: "="
  155 + },
  156 + controllerAs: "$saRadiogroupCtrl",
  157 + bindToController: true,
  158 + controller: function($scope) {
  159 + //$scope["model"] = {selectedOption: null};
  160 + //console.log("controller");
  161 + //console.log("controller:" + $scope["model"]);
  162 +
  163 + var self = this;
  164 + self.$$data = null; // 内部数据
  165 + },
  166 +
  167 + /**
  168 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  169 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  170 + * @param tElem
  171 + * @param tAttrs
  172 + * @returns {{pre: Function, post: Function}}
  173 + */
  174 + compile: function(tElem, tAttrs) {
  175 + // 获取属性
  176 + var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type
  177 + var $name_attr = tAttrs["name"]; // 控件的名字
  178 + var $required_attr = tAttrs["required"]; // 是否要用required验证
  179 + var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选
  180 +
  181 + // controlAs名字
  182 + var ctrlAs = "$saRadiogroupCtrl";
  183 +
  184 + // 如果有required属性,添加angularjs required验证
  185 + if ($required_attr != undefined) {
  186 + tElem.find("input").attr("required", "");
  187 + }
  188 +
  189 + return {
  190 + pre: function(scope, element, attr) {
  191 +
  192 + },
  193 +
  194 + /**
  195 + * 相当于link函数。
  196 + * @param scope
  197 + * @param element
  198 + * @param attr
  199 + */
  200 + post: function(scope, element, attr) {
  201 + //console.log("link");
  202 + //console.log("link:" + scope.model);
  203 + //scope["model"] = {selectedOption: null};
  204 +
  205 + if ($name_attr) {
  206 + scope[ctrlAs].nv = $name_attr;
  207 + }
  208 +
  209 + if ($disabled_attr) {
  210 + scope[ctrlAs].disabled = true;
  211 + }
  212 + if ($dicgroup_attr) {
  213 + var obj = dictionaryUtils.getByGroup($dicgroup_attr);
  214 + scope[ctrlAs].$$data = obj;
  215 + // 处理 scope["dic"] key值
  216 + scope[ctrlAs].dicvalueCalcu = function(value) {
  217 + if (value == "true") {
  218 + //console.log(value);
  219 + return true;
  220 + } else if (value == "false") {
  221 + //console.log(value);
  222 + return false;
  223 + } else {
  224 + return value;
  225 + }
  226 + };
  227 + }
  228 + }
  229 + };
  230 + }
  231 + };
  232 +}]);
  233 +
  234 +angular.module('ScheduleApp').directive("remoteValidaton", [
  235 + 'BusInfoManageService_g',
  236 + 'EmployeeInfoManageService_g',
  237 + 'TimeTableManageService_g',
  238 + function(
  239 + busInfoManageService_g,
  240 + employeeInfoManageService_g,
  241 + timeTableManageService_g
  242 + ) {
  243 + /**
  244 + * 远端验证指令,依赖于ngModel
  245 + * 指令名称 remote-Validation
  246 + * 需要属性 rvtype 表示验证类型
  247 + */
  248 + return {
  249 + restrict: "A",
  250 + require: "^ngModel",
  251 + link: function(scope, element, attr, ngModelCtrl) {
  252 + element.bind("keyup", function() {
  253 + var modelValue = ngModelCtrl.$modelValue;
  254 + var rv1_attr = attr["rv1"];
  255 + if (attr["rvtype"]) {
  256 +
  257 + // 根据rvtype的值,确定使用那个远端验证的url,
  258 + // rv1, rv2, rv3是关联比较值,暂时使用rv1
  259 + // 这个貌似没法通用,根据业务变换
  260 + // TODO:暂时有点乱以后改
  261 + if (attr["rvtype"] == "insideCode") {
  262 + busInfoManageService_g.validate.insideCode(
  263 + {"insideCode_eq": modelValue, type: "equale"},
  264 + function(result) {
  265 + //console.log(result);
  266 + if (result.status == "SUCCESS") {
  267 + ngModelCtrl.$setValidity('remote', true);
  268 + } else {
  269 + ngModelCtrl.$setValidity('remote', false);
  270 + }
  271 + },
  272 + function(result) {
  273 + //console.log(result);
  274 + ngModelCtrl.$setValidity('remote', true);
  275 + }
  276 + );
  277 + } else if (attr["rvtype"] == "jobCode") {
  278 + if (!rv1_attr) {
  279 + ngModelCtrl.$setValidity('remote', false);
  280 + return;
  281 + }
  282 +
  283 + employeeInfoManageService_g.validate.jobCode(
  284 + {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
  285 + function(result) {
  286 + //console.log(result);
  287 + if (result.status == "SUCCESS") {
  288 + ngModelCtrl.$setValidity('remote', true);
  289 + } else {
  290 + ngModelCtrl.$setValidity('remote', false);
  291 + }
  292 + },
  293 + function(result) {
  294 + //console.log(result);
  295 + ngModelCtrl.$setValidity('remote', true);
  296 + }
  297 + );
  298 + } else if (attr["rvtype"] == "ttinfoname") {
  299 + if (!rv1_attr) {
  300 + ngModelCtrl.$setValidity('remote', false);
  301 + return;
  302 + }
  303 +
  304 + timeTableManageService_g.validate.ttinfoname(
  305 + {"name_eq": modelValue, "xl.id_eq": rv1_attr, type: "equale"},
  306 + function(result) {
  307 + //console.log(result);
  308 + if (result.status == "SUCCESS") {
  309 + ngModelCtrl.$setValidity('remote', true);
  310 + } else {
  311 + ngModelCtrl.$setValidity('remote', false);
  312 + }
  313 + },
  314 + function(result) {
  315 + //console.log(result);
  316 + ngModelCtrl.$setValidity('remote', true);
  317 + }
  318 + );
  319 +
  320 + }
  321 + } else {
  322 + // 没有rvtype,就不用远端验证了
  323 + ngModelCtrl.$setValidity('remote', true);
  324 + }
  325 +
  326 + attr.$observe("rv1", function(value) {
  327 + if (attr["rvtype"] == "jobCode") {
  328 + if (!value) {
  329 + ngModelCtrl.$setValidity('remote', false);
  330 + return;
  331 + }
  332 +
  333 + employeeInfoManageService_g.validate.jobCode(
  334 + {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
  335 + function(result) {
  336 + //console.log(result);
  337 + if (result.status == "SUCCESS") {
  338 + ngModelCtrl.$setValidity('remote', true);
  339 + } else {
  340 + ngModelCtrl.$setValidity('remote', false);
  341 + }
  342 + },
  343 + function(result) {
  344 + //console.log(result);
  345 + ngModelCtrl.$setValidity('remote', true);
  346 + }
  347 + );
  348 + } else if (attr["rvtype"] == "ttinfoname") {
  349 + if (!value) {
  350 + ngModelCtrl.$setValidity('remote', false);
  351 + return;
  352 + }
  353 +
  354 + console.log("rv1:" + value);
  355 +
  356 + timeTableManageService_g.validate.ttinfoname(
  357 + {"name_eq": modelValue, "xl.id_eq": value, type: "equale"},
  358 + function(result) {
  359 + //console.log(result);
  360 + if (result.status == "SUCCESS") {
  361 + ngModelCtrl.$setValidity('remote', true);
  362 + } else {
  363 + ngModelCtrl.$setValidity('remote', false);
  364 + }
  365 + },
  366 + function(result) {
  367 + //console.log(result);
  368 + ngModelCtrl.$setValidity('remote', true);
  369 + }
  370 + );
  371 + }
  372 +
  373 + });
  374 + });
  375 + }
  376 + };
  377 + }]);
  378 +
  379 +
  380 +/**
  381 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  382 + * 1、compile阶段使用的属性如下:
  383 + * required:用于和表单验证连接,指定成required="true"才有效。
  384 + * 2、link阶段使用的属性如下
  385 + * model:关联的模型对象
  386 + * name:表单验证时需要的名字
  387 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  388 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  389 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  390 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  391 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  392 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  393 + * placeholder:select placeholder字符串描述
  394 + *
  395 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  396 + * $$SearchInfoService_g,内部使用的数据服务
  397 + */
  398 +// saSelect2指令使用的内部信service
  399 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  400 + return {
  401 + xl: $resource(
  402 + '/line/:type',
  403 + {order: 'name', direction: 'ASC'},
  404 + {
  405 + list: {
  406 + method: 'GET',
  407 + isArray: true
  408 + }
  409 + }
  410 + ),
  411 + zd: $resource(
  412 + '/stationroute/stations',
  413 + {order: 'stationCode', direction: 'ASC'},
  414 + {
  415 + list: {
  416 + method: 'GET',
  417 + isArray: true
  418 + }
  419 + }
  420 + ),
  421 + tcc: $resource(
  422 + '/carpark/:type',
  423 + {order: 'parkCode', direction: 'ASC'},
  424 + {
  425 + list: {
  426 + method: 'GET',
  427 + isArray: true
  428 + }
  429 + }
  430 + ),
  431 + ry: $resource(
  432 + '/personnel/:type',
  433 + {order: 'personnelName', direction: 'ASC'},
  434 + {
  435 + list: {
  436 + method: 'GET',
  437 + isArray: true
  438 + }
  439 + }
  440 + ),
  441 + cl: $resource(
  442 + '/cars/:type',
  443 + {order: "insideCode", direction: 'ASC'},
  444 + {
  445 + list: {
  446 + method: 'GET',
  447 + isArray: true
  448 + }
  449 + }
  450 + ),
  451 + ttInfo: $resource(
  452 + '/tic/:type',
  453 + {order: "name", direction: 'ASC'},
  454 + {
  455 + list: {
  456 + method: 'GET',
  457 + isArray: true
  458 + }
  459 + }
  460 + ),
  461 + cci: $resource(
  462 + '/cci/cars',
  463 + {},
  464 + {
  465 + list: {
  466 + method: 'GET',
  467 + isArray: true
  468 + }
  469 + }
  470 +
  471 + ),
  472 + cci2: $resource(
  473 + '/cci/:type',
  474 + {},
  475 + {
  476 + list: {
  477 + method: 'GET',
  478 + isArray: true
  479 + }
  480 + }
  481 + ),
  482 + cci3: $resource(
  483 + '/cci/cars2',
  484 + {},
  485 + {
  486 + list: {
  487 + method: 'GET',
  488 + isArray: true
  489 + }
  490 + }
  491 +
  492 + ),
  493 + eci: $resource(
  494 + '/eci/jsy',
  495 + {},
  496 + {
  497 + list: {
  498 + method: 'GET',
  499 + isArray: true
  500 + }
  501 + }
  502 + ),
  503 + eci2: $resource(
  504 + '/eci/spy',
  505 + {},
  506 + {
  507 + list: {
  508 + method: 'GET',
  509 + isArray: true
  510 + }
  511 + }
  512 + )
  513 + }
  514 +}]);
  515 +angular.module('ScheduleApp').filter("$$pyFilter", function() {
  516 + return function(items, props) {
  517 + var out = [];
  518 + var limit = props["limit"] || 20; // 默认20条记录
  519 +
  520 + if (angular.isArray(items)) {
  521 + items.forEach(function(item) {
  522 + if (out.length < limit) {
  523 + if (props.search) {
  524 + var upTerm = props.search.toUpperCase();
  525 + if(item.fullChars.indexOf(upTerm) != -1
  526 + || item.camelChars.indexOf(upTerm) != -1) {
  527 + out.push(item);
  528 + }
  529 + }
  530 + }
  531 + });
  532 + }
  533 +
  534 + return out;
  535 + };
  536 +});
  537 +angular.module('ScheduleApp').directive("saSelect2", [
  538 + '$timeout', '$$SearchInfoService_g',
  539 + function($timeout, $$searchInfoService_g) {
  540 + return {
  541 + restrict: 'E',
  542 + templateUrl: '/pages/scheduleApp/module/other/MySearchSelectTemplate.html',
  543 + scope: {
  544 + model: "=" // 独立作用域,关联外部的模型对象
  545 + },
  546 + controllerAs: "$saSelectCtrl",
  547 + bindToController: true,
  548 + controller: function($scope) {
  549 + var self = this;
  550 + self.$$data = []; // 内部关联的数据
  551 + },
  552 + /**
  553 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  554 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  555 + * @param tElem
  556 + * @param tAttrs
  557 + * @returns {{pre: Function, post: Function}}
  558 + */
  559 + compile: function(tElem, tAttrs) {
  560 + // 1、获取此阶段使用的属性
  561 + var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。
  562 +
  563 + // 2、处理属性
  564 +
  565 + // 确定是否使用angularjs required验证
  566 + // 属性 required
  567 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  568 + if ($required_attr) {
  569 + if ($required_attr == "true") {
  570 + // 添加required属性指令
  571 + tElem.find("ui-select").attr("required", "");
  572 + } else {
  573 + // 不等于true,不添加required属性指令
  574 + }
  575 + } else {
  576 + // 不添加required属性指令
  577 + }
  578 +
  579 + //console.log("saSelect" + ":compile = >" + tElem.html());
  580 +
  581 + return {
  582 + pre: function(scope, element, attr) {
  583 + // TODO:
  584 + },
  585 + /**
  586 + * 相当于link函数。
  587 + *
  588 + * 重要属性如下:
  589 + * model 是绑定外部值。
  590 + * dicgroup 字典组的类型
  591 + * name input name属性值
  592 + */
  593 + post: function(scope, element, attr) {
  594 + // 1、获取此阶段使用的属性
  595 + var $name_attr = attr["name"]; // 表单验证时需要的名字
  596 + var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  597 + var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)
  598 + var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)
  599 + var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)
  600 + var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)
  601 + var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名
  602 + var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述
  603 +
  604 + // 2、处理属性、转换成$saSelectCtrl内部使用的属性
  605 + if ($name_attr) {
  606 + scope["$saSelectCtrl"].$name_attr = $name_attr;
  607 + }
  608 + if ($placeholder_attr) {
  609 + scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;
  610 + }
  611 + if ($showcolname_attr) {
  612 + scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;
  613 + }
  614 +
  615 + // 2-1、添加内部方法,根据type值,改变$$data的值
  616 + scope["$saSelectCtrl"].$$internal_data_change_fn = function() {
  617 + // 根据type属性动态载入数据
  618 + if ($type_attr) {
  619 + $$searchInfoService_g[$type_attr].list(
  620 + {type: "all"},
  621 + function(result) {
  622 + scope["$saSelectCtrl"].$$data = [];
  623 + for (var i = 0; i < result.length; i ++) {
  624 + var data = {}; // data是result的一部分属性集合,根据配置来确定
  625 + if ($datacolname1_attr) {
  626 + data[$datacolname1_attr] = result[i][$datacolname1_attr];
  627 + }
  628 + if ($datacolname2_attr) {
  629 + data[$datacolname2_attr] = result[i][$datacolname2_attr];
  630 + }
  631 + if ($showcolname_attr) {
  632 + // 动态添加基于名字的拼音
  633 + data[$showcolname_attr] = result[i][$showcolname_attr];
  634 + if (data[$showcolname_attr]) {
  635 + data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼
  636 + data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼
  637 + }
  638 + }
  639 + if (data["fullChars"])
  640 + scope["$saSelectCtrl"].$$data.push(data);
  641 + }
  642 + },
  643 + function(result) {
  644 +
  645 + }
  646 + );
  647 + }
  648 + };
  649 +
  650 + // 3、选择、删除事件映射模型和内部数据对应的字段
  651 + scope["$saSelectCtrl"].$select_fn_attr = function($item) {
  652 + if ($modelcolname1_attr && $datacolname1_attr) {
  653 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];
  654 + }
  655 + if ($modelcolname2_attr && $datacolname2_attr) {
  656 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];
  657 + }
  658 + };
  659 + scope["$saSelectCtrl"].$remove_fn_attr = function() {
  660 + if ($modelcolname1_attr) {
  661 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;
  662 + }
  663 + if ($modelcolname2_attr) {
  664 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;
  665 + }
  666 + scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空
  667 +
  668 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  669 + };
  670 +
  671 + // 4、搜索事件
  672 + scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {
  673 + //var fullChars = pinyin.getFullChars($search).toUpperCase();
  674 + //var camelChars = pinyin.getCamelChars($search);
  675 + //
  676 + //console.log(fullChars + " " + camelChars);
  677 + // TODO:事件暂时没用,放着以后再说
  678 + };
  679 +
  680 + // 5、全部载入后,输入的
  681 + $timeout(function() {
  682 + // 创建内部使用的绑定对象,用于确认选中那个值
  683 + scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];
  684 +
  685 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  686 + }, 0);
  687 + }
  688 + }
  689 + }
  690 + };
  691 + }
  692 +]);
  693 +
  694 +/**
  695 + * saSelect3指令
  696 + * 属性如下:
  697 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  698 + * name(必须):控件的名字
  699 + * placeholder(可选):占位符字符串
  700 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  701 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  702 + * icname(必须):内部与之对应的字段名,如:icname=code
  703 + * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
  704 + * icname2(可选):内部与之对应的字段名2,如:icname2=name
  705 + * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
  706 + * icname3(可选):内部与之对应的字段名3,如:icname2=name
  707 + * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
  708 + * required(可选):是否要用required验证
  709 + * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
  710 + * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)
  711 + *
  712 + * 高级属性:
  713 + * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)
  714 + * dataparam(可选):数据源关联的外部参数对象
  715 + *
  716 + */
  717 +angular.module('ScheduleApp').directive("saSelect3", [
  718 + '$timeout',
  719 + '$$SearchInfoService_g',
  720 + function($timeout, $$searchInfoService_g) {
  721 + return {
  722 + restrict: 'E',
  723 + templateUrl: '/pages/scheduleApp/module/common/dt/MyUiSelectWrapTemplate1.html',
  724 + scope: {
  725 + model: "=" // 独立作用域,关联外部的模型object
  726 + },
  727 + controllerAs: "$saSelectCtrl",
  728 + bindToController: true,
  729 + controller: function($scope) {
  730 + var self = this;
  731 + self.$$data = []; // ui-select显示用的数据源
  732 + self.$$data_real= []; // 内部真实的数据源
  733 + },
  734 +
  735 + /**
  736 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  737 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  738 + * @param tElem
  739 + * @param tAttrs
  740 + * @returns {{pre: Function, post: Function}}
  741 + */
  742 + compile: function(tElem, tAttrs) {
  743 + // 获取所有的属性
  744 + var $name_attr = tAttrs["name"]; // 控件的名字
  745 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  746 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  747 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  748 + var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
  749 + var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
  750 + var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
  751 + var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
  752 +
  753 + var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
  754 + var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
  755 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  756 + var $mlp_attr = tAttrs["mlp"]; // 是否多级属性
  757 + var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性
  758 +
  759 + // controlAs名字
  760 + var ctrlAs = "$saSelectCtrl";
  761 +
  762 + // 数据源初始化标志
  763 + var $$data_init = false;
  764 + // 如果有required属性,添加angularjs required验证
  765 + if ($required_attr != undefined) {
  766 + tElem.find("ui-select").attr("required", "");
  767 + }
  768 +
  769 + // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义
  770 + // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}
  771 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");
  772 + // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data
  773 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  774 + // 原来的设置:item[$saSelectCtrl.$icname_s]
  775 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);
  776 + // 原来的设置:{{$saSelectCtrl.$name}}
  777 + tElem.find("ui-select").attr("name", $name_attr);
  778 + // 原来的设置:{{$saSelectCtrl.$placeholder}}
  779 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  780 +
  781 + return {
  782 + pre: function(scope, element, attr) {
  783 + // TODO:
  784 + },
  785 + /**
  786 + * 相当于link函数。
  787 + * @param scope
  788 + * @param element
  789 + * @param attr
  790 + */
  791 + post: function(scope, element, attr) {
  792 + // 添加选中事件处理函数
  793 + scope[ctrlAs].$$internal_select_fn = function($item) {
  794 + if ($dcname_attr && $icname_attr) {
  795 + if ($mlp_attr) {
  796 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  797 + } else {
  798 + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
  799 + }
  800 + }
  801 + if ($dcname2_attr && $icname2_attr) {
  802 + if ($mlp_attr) {
  803 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");
  804 + } else {
  805 + scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
  806 + }
  807 + }
  808 + if ($dcname3_attr && $icname3_attr) {
  809 + if ($mlp_attr) {
  810 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
  811 + } else {
  812 + scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
  813 + }
  814 + }
  815 + };
  816 +
  817 + // 删除选中事件处理函数
  818 + scope[ctrlAs].$$internal_remove_fn = function() {
  819 + scope[ctrlAs].$$internalmodel = undefined;
  820 + if ($mlp_attr) {
  821 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  822 + } else {
  823 + scope[ctrlAs].model[$dcname_attr] = undefined;
  824 + }
  825 +
  826 + if ($dcname2_attr) {
  827 + if ($mlp_attr) {
  828 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");
  829 + } else {
  830 + scope[ctrlAs].model[$dcname2_attr] = undefined;
  831 + }
  832 + }
  833 + if ($dcname3_attr) {
  834 + if ($mlp_attr) {
  835 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
  836 + } else {
  837 + scope[ctrlAs].model[$dcname3_attr] = undefined;
  838 + }
  839 + }
  840 + };
  841 +
  842 + /**
  843 + * 内部方法,读取字典数据作为数据源。
  844 + * @param dicgroup 字典类型,如:gsType
  845 + * @param ccol 代码字段名
  846 + * @param ncol 名字字段名
  847 + */
  848 + scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {
  849 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  850 + var dic_key; // 字典key
  851 + // 清空内部数据
  852 + scope[ctrlAs].$$data_real = [];
  853 + for (dic_key in origin_dicgroup) {
  854 + var data = {}; // 重新组合的字典元素对象
  855 + if (dic_key == "true")
  856 + data[ccol] = true;
  857 + else
  858 + data[ccol] = dic_key;
  859 + data[ncol] = origin_dicgroup[dic_key];
  860 + scope[ctrlAs].$$data_real.push(data);
  861 + }
  862 + // 这里直接将$$data_real数据深拷贝到$$data
  863 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  864 +
  865 + console.log(scope[ctrlAs].$$data);
  866 + };
  867 +
  868 + /**
  869 + * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把
  870 + * 内部方法,读取字典数据作为数据源。
  871 + * @param result 原始数据
  872 + * @param dcvalue 传入的关联数据
  873 + */
  874 + scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {
  875 + //console.log("start");
  876 + // 清空内部数据
  877 + scope[ctrlAs].$$data_real = [];
  878 + scope[ctrlAs].$$data = [];
  879 + for (var i = 0; i < result.length; i ++) {
  880 + if ($icname_s_attr) {
  881 + if ($mlp_attr) {
  882 + if (eval("result[i]" + "." + $icname_s_attr)) {
  883 + // 全拼
  884 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();
  885 + // 简拼
  886 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));
  887 + }
  888 + } else {
  889 + if (result[i][$icname_s_attr]) {
  890 + // 全拼
  891 + result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();
  892 + // 简拼
  893 + result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);
  894 + }
  895 + }
  896 + }
  897 +
  898 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  899 + scope[ctrlAs].$$data_real.push(result[i]);
  900 + }
  901 +
  902 + }
  903 + //console.log("start2");
  904 +
  905 + // 数量太大取前10条记录作为显示
  906 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  907 + // 先迭代循环查找已经传过来的值
  908 + if (scope[ctrlAs].$$data_real.length > 0) {
  909 + if (dcvalue) {
  910 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  911 + if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {
  912 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));
  913 + break;
  914 + }
  915 + }
  916 + }
  917 + }
  918 + // 在插入剩余的数据
  919 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  920 + if (scope[ctrlAs].$$data.length < 10) {
  921 + if ($mlp_attr) {
  922 + if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {
  923 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  924 + }
  925 + } else {
  926 + if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {
  927 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  928 + }
  929 + }
  930 + } else {
  931 + break;
  932 + }
  933 + }
  934 + }
  935 +
  936 + //console.log("end");
  937 + };
  938 +
  939 + /**
  940 + * 判定一个对象是否为空对象。
  941 + * @param Obj
  942 + */
  943 + scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {
  944 + console.log(typeof obj);
  945 +
  946 + if (typeof obj === "object" && !(obj instanceof Array)) {
  947 + for (var prop in obj) {
  948 + if (obj.hasOwnProperty(prop)) {
  949 + return false;
  950 + }
  951 + }
  952 + return true;
  953 + } else {
  954 + throw "必须是对象";
  955 + }
  956 + };
  957 +
  958 + // 刷新数据
  959 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  960 + // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取
  961 + var $dcvalue_attr = attr["dcvalue"];
  962 +
  963 + console.log("刷新数据:" + $dcvalue_attr);
  964 +
  965 + if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化
  966 + if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源
  967 + scope[ctrlAs].$$internal_dic_data(
  968 + $datatype_attr, $icname_attr, $icname_s_attr);
  969 + if ($dcvalue_attr) {
  970 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  971 + }
  972 + } else { // 非字典类型数据源
  973 + if (!$dataassociate_attr) {
  974 + $$searchInfoService_g[$datatype_attr].list(
  975 + {type: "all"},
  976 + function(result) {
  977 + //console.log("ok:" + $datatype_attr);
  978 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  979 + //console.log("ok2:" + $datatype_attr);
  980 + if ($dcvalue_attr) {
  981 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  982 + }
  983 +
  984 + $$data_init = true;
  985 + },
  986 + function(result) {
  987 +
  988 + }
  989 + );
  990 + }
  991 + }
  992 + }
  993 +
  994 + if ($$data_init) {
  995 + if (search && search != "") { // 有search值
  996 + if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源
  997 + // 处理search
  998 + console.log("search:" + search);
  999 +
  1000 + scope[ctrlAs].$$data = [];
  1001 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1002 + var upTerm = search.toUpperCase();
  1003 + if (scope[ctrlAs].$$data.length < 10) {
  1004 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  1005 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  1006 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1007 + }
  1008 + } else {
  1009 + break;
  1010 + }
  1011 + }
  1012 + }
  1013 + }
  1014 +
  1015 + }
  1016 +
  1017 + };
  1018 +
  1019 +
  1020 +
  1021 +
  1022 +
  1023 +
  1024 +
  1025 +
  1026 +
  1027 +
  1028 + // TODO:
  1029 +
  1030 + // dom全部载入后调用
  1031 + $timeout(function() {
  1032 + console.log("dom全部载入后调用");
  1033 + }, 0);
  1034 + // 监控dcvalue model值变换
  1035 + attr.$observe("dcvalue", function(value) {
  1036 + console.log("监控dc1 model值变换:" + value);
  1037 + scope[ctrlAs].$$internalmodel = value;
  1038 + }
  1039 + );
  1040 + // 监控获取数据参数变换
  1041 + attr.$observe("dataparam", function(value) {
  1042 + // 判定是否空对象
  1043 + console.log(value);
  1044 + var obj = JSON.parse(value);
  1045 + var $dcvalue_attr = attr["dcvalue"];
  1046 + if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {
  1047 + console.log("dataparam:" + obj);
  1048 +
  1049 + //
  1050 +
  1051 + obj["type"] = "all";
  1052 +
  1053 + $$data_init = false;
  1054 + $$searchInfoService_g[$datatype_attr].list(
  1055 + obj,
  1056 + function(result) {
  1057 + //console.log("ok:" + $datatype_attr);
  1058 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  1059 + //console.log("ok2:" + $datatype_attr);
  1060 + if ($dcvalue_attr) {
  1061 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  1062 + }
  1063 +
  1064 + $$data_init = true;
  1065 + },
  1066 + function(result) {
  1067 +
  1068 + }
  1069 + );
  1070 + }
  1071 + }
  1072 + );
  1073 + }
  1074 + };
  1075 + }
  1076 + };
  1077 +
  1078 + }
  1079 +]);
  1080 +
  1081 +/**
  1082 + * saCheckboxgroup指令
  1083 + * 属性如下:
  1084 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1085 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  1086 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1087 + * name(必须):控件的名字
  1088 + * required(可选):是否要用required验证
  1089 + * disabled(可选):标示框是否可选
  1090 + *
  1091 + */
  1092 +angular.module('ScheduleApp').directive('saCheckboxgroup', [
  1093 + function() {
  1094 + return {
  1095 + restrict: 'E',
  1096 + templateUrl: '/pages/scheduleApp/module/common/dt/MyCheckboxGroupWrapTemplate.html',
  1097 + scope: {
  1098 + model: "=" // 独立作用域,关联外部的模型object
  1099 + },
  1100 + controllerAs: "$saCheckboxgroupCtrl",
  1101 + bindToController: true,
  1102 + controller: function($scope) {
  1103 + var self = this;
  1104 + self.$$data = []; // 内部的数据
  1105 +
  1106 + // TODO:数据写死,周一至周日选择数据,以后有别的数据再议
  1107 + self.$$data = [
  1108 + {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1109 + {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1110 + {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1111 + {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1112 + {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1113 + {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1114 + {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}
  1115 + ];
  1116 + },
  1117 +
  1118 + /**
  1119 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1120 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1121 + * @param tElem
  1122 + * @param tAttrs
  1123 + * @returns {{pre: Function, post: Function}}
  1124 + */
  1125 + compile: function(tElem, tAttrs) {
  1126 + // 获取所有的属性
  1127 + var $name_attr = tAttrs["name"]; // 控件的名字
  1128 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1129 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  1130 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  1131 +
  1132 + // controlAs名字
  1133 + var ctrlAs = '$saCheckboxgroupCtrl';
  1134 +
  1135 + // 如果有required属性,添加angularjs required验证
  1136 + if ($required_attr != undefined) {
  1137 + //console.log(tElem.html());
  1138 + tElem.find("div").attr("required", "");
  1139 + }
  1140 + // 如果有disabled属性,添加禁用标志
  1141 + if ($disabled_attr != undefined) {
  1142 + tElem.find("input").attr("ng-disabled", "true");
  1143 + }
  1144 +
  1145 + return {
  1146 + pre: function(scope, element, attr) {
  1147 + // TODO:
  1148 + },
  1149 + /**
  1150 + * 相当于link函数。
  1151 + * @param scope
  1152 + * @param element
  1153 + * @param attr
  1154 + */
  1155 + post: function(scope, element, attr) {
  1156 + // name属性
  1157 + if ($name_attr) {
  1158 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1159 + }
  1160 +
  1161 + /**
  1162 + * checkbox选择事件处理函数。
  1163 + * @param $d 数据对象,$$data中的元素对象
  1164 + */
  1165 + scope[ctrlAs].$$internal_updateCheck_fn = function($d) {
  1166 + $d.ischecked = !$d.ischecked;
  1167 + console.log($d);
  1168 + };
  1169 +
  1170 + // 测试使用watch监控$$data的变化
  1171 + scope.$watch(
  1172 + function() {
  1173 + return scope[ctrlAs]["$$data"];
  1174 + },
  1175 + function(newValue, oldValue) {
  1176 + // 根据$$data生成对应的数据
  1177 + var rule_days_arr = [];
  1178 + var i;
  1179 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1180 + if (scope[ctrlAs]["$$data"][i].ischecked)
  1181 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);
  1182 + else
  1183 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);
  1184 + }
  1185 + scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");
  1186 + //scope[ctrlAs].$$internalmodel = undefined;
  1187 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  1188 +
  1189 + // 更新model
  1190 + if ($dcname_attr) {
  1191 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");
  1192 + }
  1193 +
  1194 +
  1195 + },
  1196 + true
  1197 + );
  1198 +
  1199 + // TODO:
  1200 +
  1201 + // 监控dcvalue model值变换
  1202 + attr.$observe("dcvalue", function(value) {
  1203 + console.log("saCheckboxgroup 监控dc1 model值变换:" + value);
  1204 + if (value) {
  1205 + // 根据value值,修改$$data里的值
  1206 + var data_array = value.split(",");
  1207 + var i;
  1208 + if (data_array.length > scope[ctrlAs]["$$data"].length) {
  1209 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {
  1210 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  1211 + scope[ctrlAs]["$$data"][i].ischecked = true;
  1212 + } else {
  1213 + scope[ctrlAs]["$$data"][i].ischecked = false;
  1214 + }
  1215 + }
  1216 + } else {
  1217 + for (i = 0; i < data_array.length; i ++) {
  1218 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  1219 + scope[ctrlAs]["$$data"][i].ischecked = true;
  1220 + } else {
  1221 + scope[ctrlAs]["$$data"][i].ischecked = false;
  1222 + }
  1223 + }
  1224 + }
  1225 +
  1226 + }
  1227 + });
  1228 + }
  1229 +
  1230 + };
  1231 +
  1232 +
  1233 + }
  1234 +
  1235 + };
  1236 + }
  1237 +]);
  1238 +
  1239 +/**
  1240 + * saDategroup指令
  1241 + * 属性如下:
  1242 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1243 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  1244 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1245 + * name(必须):控件的名字
  1246 + * required(可选):是否要用required验证
  1247 + * disabled(可选):标示框是否可选
  1248 + *
  1249 + */
  1250 +angular.module('ScheduleApp').directive('saDategroup', [
  1251 + '$filter',
  1252 + function($filter) {
  1253 + return {
  1254 + restrict: 'E',
  1255 + templateUrl: '/pages/scheduleApp/module/common/dt/MyDateGroupWrapTemplate.html',
  1256 + scope: {
  1257 + model: "=" // 独立作用域,关联外部的模型object
  1258 + },
  1259 + controllerAs: "$saDategroupCtrl",
  1260 + bindToController: true,
  1261 + controller: function($scope) {
  1262 + var self = this;
  1263 + self.$$data = []; // 内部的数据
  1264 + self.$$date_select; // 内部选中的日期
  1265 +
  1266 + //// 测试数据
  1267 + //self.$$data = [
  1268 + // {datestr: '2011-01-01', ischecked: true},
  1269 + // {datestr: '2011-01-01', ischecked: true},
  1270 + // {datestr: '2011-01-01', ischecked: true}
  1271 + //];
  1272 + },
  1273 +
  1274 + /**
  1275 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1276 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1277 + * @param tElem
  1278 + * @param tAttrs
  1279 + * @returns {{pre: Function, post: Function}}
  1280 + */
  1281 + compile: function(tElem, tAttrs) {
  1282 + // 获取所有的属性
  1283 + var $name_attr = tAttrs["name"]; // 控件的名字
  1284 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1285 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  1286 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  1287 +
  1288 + // controlAs名字
  1289 + var ctrlAs = '$saDategroupCtrl';
  1290 +
  1291 + // 如果有required属性,添加angularjs required验证
  1292 + if ($required_attr != undefined) {
  1293 + //console.log(tElem.html());
  1294 + tElem.find("div").attr("required", "");
  1295 + }
  1296 + // 如果有disabled属性,添加禁用标志
  1297 + if ($disabled_attr != undefined) {
  1298 + tElem.find("input").attr("ng-disabled", "true");
  1299 + tElem.find("div").attr("ng-disabled", "true");
  1300 + }
  1301 +
  1302 + return {
  1303 + pre: function (scope, element, attr) {
  1304 + // TODO:
  1305 + },
  1306 + /**
  1307 + * 相当于link函数。
  1308 + * @param scope
  1309 + * @param element
  1310 + * @param attr
  1311 + */
  1312 + post: function (scope, element, attr) {
  1313 + // name属性
  1314 + if ($name_attr) {
  1315 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1316 + }
  1317 +
  1318 +
  1319 + // 日期open属性,及方法
  1320 + scope[ctrlAs].$$specialDateOpen = false;
  1321 + scope[ctrlAs].$$specialDate_open = function() {
  1322 + scope[ctrlAs].$$specialDateOpen = true;
  1323 + };
  1324 +
  1325 + // 监控选择的日期
  1326 + scope.$watch(
  1327 + function() {
  1328 + return scope[ctrlAs]['$$date_select'];
  1329 + },
  1330 + function(newValue, oldValue) {
  1331 + if (newValue) {
  1332 + //console.log("saDategroup--->selectdate:" + newValue);
  1333 + // 调用内置filter,转换日期到yyyy-MM-dd格式
  1334 + var text = $filter('date')(newValue, 'yyyy-MM-dd');
  1335 + var i;
  1336 + var isexist = false; // 日期是否已经选择标识
  1337 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1338 + if (scope[ctrlAs]["$$data"][i].datestr == text) {
  1339 + isexist = true;
  1340 + break;
  1341 + }
  1342 + }
  1343 + if (!isexist) {
  1344 + scope[ctrlAs]["$$data"].push(
  1345 + {
  1346 + datestr: text,
  1347 + ischecked: true
  1348 + }
  1349 + );
  1350 + }
  1351 +
  1352 + }
  1353 +
  1354 + }
  1355 + );
  1356 +
  1357 + /**
  1358 + * 日期点击事件处理函数。
  1359 + * @param $index 索引
  1360 + */
  1361 + scope[ctrlAs].$$internal_datestr_click = function($index) {
  1362 + scope[ctrlAs].$$data.splice($index, 1);
  1363 + };
  1364 +
  1365 + // 测试使用watch监控$$data的变化
  1366 + scope.$watch(
  1367 + function() {
  1368 + return scope[ctrlAs]['$$data'];
  1369 + },
  1370 + function(newValue, oldValue) {
  1371 + // 根据$$data生成对应的数据
  1372 + var special_days_arr = [];
  1373 + var i;
  1374 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1375 + special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);
  1376 + }
  1377 +
  1378 + scope[ctrlAs].$$internalmodel = special_days_arr.join(",");
  1379 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  1380 +
  1381 + // 更新model
  1382 + if ($dcname_attr) {
  1383 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");
  1384 + }
  1385 + },
  1386 + true
  1387 + );
  1388 +
  1389 + // 监控dcvalue model值变换
  1390 + attr.$observe("dcvalue", function(value) {
  1391 + console.log("saDategroup 监控dc1 model值变换:" + value);
  1392 + if (value) {
  1393 + // 根据value值,修改$$data里的值
  1394 + var date_array = value.split(",");
  1395 + var i;
  1396 + scope[ctrlAs]["$$data"] = [];
  1397 + for (i = 0; i < date_array.length; i++) {
  1398 + scope[ctrlAs]["$$data"].push(
  1399 + {
  1400 + datestr: date_array[i],
  1401 + ischecked: true
  1402 + }
  1403 + );
  1404 + }
  1405 +
  1406 +
  1407 +
  1408 +
  1409 +
  1410 +
  1411 +
  1412 +
  1413 +
  1414 + }
  1415 + });
  1416 +
  1417 + }
  1418 +
  1419 + };
  1420 + }
  1421 + }
  1422 + }
  1423 +]);
  1424 +
  1425 +/**
  1426 + * saGuideboardgroup指令
  1427 + * 属性如下:
  1428 + * name(必须):控件的名字
  1429 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1430 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  1431 + * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1432 + * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange
  1433 + * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1434 + * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange
  1435 + * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  1436 + * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart
  1437 + *
  1438 + * required(可选):是否要用required验证
  1439 + *
  1440 + */
  1441 +angular.module('ScheduleApp').directive('saGuideboardgroup', [
  1442 + 'GuideboardManageService_g',
  1443 + function(guideboardManageService_g) {
  1444 + return {
  1445 + restrict: 'E',
  1446 + templateUrl: '/pages/scheduleApp/module/common/dt/MyGuideboardGroupWrapTemplate.html',
  1447 + scope: {
  1448 + model: "=" // 独立作用域,关联外部的模型object
  1449 + },
  1450 + controllerAs: '$saGuideboardgroupCtrl',
  1451 + bindToController: true,
  1452 + controller: function($scope) {
  1453 + var self = this;
  1454 + self.$$data = []; // 选择线路后,该线路的路牌数据
  1455 +
  1456 + // 测试数据
  1457 + //self.$$data = [
  1458 + // {lpid: 1, lpname: '路1', isstart: false},
  1459 + // {lpid: 2, lpname: '路2', isstart: true},
  1460 + // {lpid: 3, lpname: '路3', isstart: false}
  1461 + //];
  1462 +
  1463 +
  1464 + self.$$dataSelected = []; // 选中的路牌列表
  1465 + self.$$dataSelectedStart = undefined; // 起始路牌
  1466 +
  1467 + //self.$$dataSelected = [
  1468 + // {lpid: 11, lpname: '路11', isstart: false},
  1469 + // {lpid: 12, lpname: '路12', isstart: true},
  1470 + // {lpid: 13, lpname: '路13', isstart: false}
  1471 + //];
  1472 +
  1473 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  1474 + self.$$internalmodel = undefined;
  1475 +
  1476 + self.$$data_init = false; // *数据源初始化标志
  1477 + self.$$data_xl_first_init = false; // 线路是否初始化
  1478 + self.$$data_lp_first_init = false; // 路牌名字是否初始化
  1479 + self.$$data_lpid_first_init = false; // 路牌id是否初始化
  1480 + self.$$data_lpstart_first_init = false; // 起始路牌是否初始化
  1481 +
  1482 + },
  1483 +
  1484 + /**
  1485 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1486 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1487 + * @param tElem
  1488 + * @param tAttrs
  1489 + * @returns {{pre: Function, post: Function}}
  1490 + */
  1491 + compile: function(tElem, tAttrs) {
  1492 + // TODO:获取所有的属性
  1493 + var $name_attr = tAttrs["name"]; // 控件的名字
  1494 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1495 + var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名
  1496 + var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名
  1497 + var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名
  1498 +
  1499 + // controlAs名字
  1500 + var ctrlAs = '$saGuideboardgroupCtrl';
  1501 +
  1502 + // 如果有required属性,添加angularjs required验证
  1503 + if ($required_attr != undefined) {
  1504 + //console.log(tElem.html());
  1505 + tElem.find("div").attr("required", "");
  1506 + }
  1507 +
  1508 + return {
  1509 + pre: function(scope, element, attr) {
  1510 + // TODO:
  1511 + },
  1512 +
  1513 + /**
  1514 + * 相当于link函数。
  1515 + * @param scope
  1516 + * @param element
  1517 + * @param attr
  1518 + */
  1519 + post: function(scope, element, attr) {
  1520 + // name属性
  1521 + if ($name_attr) {
  1522 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1523 + }
  1524 +
  1525 + // TODO:
  1526 +
  1527 +
  1528 + /**
  1529 + * 路牌列表点击(路牌列表中选中路牌)
  1530 + * @param $index
  1531 + */
  1532 + scope[ctrlAs].$$internal_lplist_click = function($index) {
  1533 + var data_temp = scope[ctrlAs].$$data;
  1534 + if (data_temp && data_temp.length > $index) {
  1535 + scope[ctrlAs].$$dataSelected.push({
  1536 + lpid: data_temp[$index].lpid,
  1537 + lpname: data_temp[$index].lpname,
  1538 + isstart: data_temp[$index].isstart
  1539 + });
  1540 +
  1541 + // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌
  1542 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  1543 + scope[ctrlAs].$$internal_sellplist_click(
  1544 + scope[ctrlAs].$$dataSelected.length - 1);
  1545 + }
  1546 + }
  1547 + };
  1548 + /**
  1549 + * 选中的路牌单击(初始路牌选择)
  1550 + * @param $index
  1551 + */
  1552 + scope[ctrlAs].$$internal_sellplist_click = function($index) {
  1553 + var data_temp = scope[ctrlAs].$$dataSelected;
  1554 + if (data_temp && data_temp.length > $index) {
  1555 + for (var i = 0; i < data_temp.length; i++) {
  1556 + data_temp[i].isstart = false;
  1557 + }
  1558 + data_temp[$index].isstart = true;
  1559 + scope[ctrlAs].$$dataSelectedStart = $index;
  1560 + }
  1561 + };
  1562 + /**
  1563 + * 选中的路牌双击(删除选中的路牌)
  1564 + * @param $index
  1565 + */
  1566 + scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {
  1567 + var data_temp = scope[ctrlAs].$$dataSelected;
  1568 + if (data_temp && data_temp.length > $index) {
  1569 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  1570 + scope[ctrlAs].$$dataSelectedStart = undefined;
  1571 + }
  1572 + data_temp.splice($index, 1);
  1573 + }
  1574 + };
  1575 +
  1576 +
  1577 + /**
  1578 + * 验证内部数据,更新外部model
  1579 + */
  1580 + scope[ctrlAs].$$internal_validate_model = function() {
  1581 + var data_temp = scope[ctrlAs].$$dataSelected;
  1582 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  1583 + var lpNames = [];
  1584 + var lpIds = [];
  1585 + var lpStart = 0;
  1586 + var i = 0;
  1587 +
  1588 + if (data_temp &&
  1589 + data_temp.length > 0 &&
  1590 + data_temp2 != undefined) {
  1591 +
  1592 + for (i = 0; i < data_temp.length; i++) {
  1593 + lpNames.push(data_temp[i].lpname);
  1594 + lpIds.push(data_temp[i].lpid)
  1595 + }
  1596 + data_temp[data_temp2].isstart = true;
  1597 + lpStart = data_temp2 + 1;
  1598 +
  1599 + // 更新内部model,用于外部验证
  1600 + // 内部model的值暂时随意,以后再改
  1601 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  1602 +
  1603 + // 更新外部model字段
  1604 + if ($lprangename_attr) {
  1605 + console.log("lprangename=" + lpNames.join(','));
  1606 + eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");
  1607 + }
  1608 + if ($lpidrangename_attr) {
  1609 + console.log("lpidrangename=" + lpIds.join(','));
  1610 + eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");
  1611 + }
  1612 + if ($lpstartname_attr) {
  1613 + console.log("lpstartname=" + lpStart);
  1614 + eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");
  1615 + }
  1616 +
  1617 + } else {
  1618 + scope[ctrlAs].$$internalmodel = undefined;
  1619 + }
  1620 +
  1621 +
  1622 + };
  1623 +
  1624 + // 监控内部数据,$$data_selected 变化
  1625 + scope.$watch(
  1626 + function() {
  1627 + return scope[ctrlAs].$$dataSelected;
  1628 + },
  1629 + function(newValue, oldValue) {
  1630 + scope[ctrlAs].$$internal_validate_model();
  1631 + },
  1632 + true
  1633 + );
  1634 +
  1635 + // 监控内部数据,$$data_selected_start 变化
  1636 + scope.$watch(
  1637 + function() {
  1638 + return scope[ctrlAs].$$dataSelectedStart;
  1639 + },
  1640 + function(newValue, oldValue) {
  1641 + scope[ctrlAs].$$internal_validate_model();
  1642 + },
  1643 + true
  1644 + );
  1645 +
  1646 + /**
  1647 + * 验证数据是否初始化完成,
  1648 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  1649 + */
  1650 + scope[ctrlAs].$$internal_validate_init = function() {
  1651 + var self = scope[ctrlAs];
  1652 +
  1653 + if (self.$$data_xl_first_init &&
  1654 + self.$$data_lp_first_init &&
  1655 + self.$$data_lpid_first_init &&
  1656 + self.$$data_lpstart_first_init) {
  1657 + console.log("数据初始化完毕!");
  1658 + self.$$data_init = true;
  1659 + }
  1660 +
  1661 + };
  1662 +
  1663 + // 监控初始化标志,线路,路牌,路牌id,起始路牌
  1664 + scope.$watch(
  1665 + function() {
  1666 + return scope[ctrlAs].$$data_xl_first_init;
  1667 + },
  1668 + function(newValue, oldValue) {
  1669 + scope[ctrlAs].$$internal_validate_init();
  1670 + }
  1671 + );
  1672 + scope.$watch(
  1673 + function() {
  1674 + return scope[ctrlAs].$$data_lp_first_init;
  1675 + },
  1676 + function(newValue, oldValue) {
  1677 + scope[ctrlAs].$$internal_validate_init();
  1678 + }
  1679 + );
  1680 + scope.$watch(
  1681 + function() {
  1682 + return scope[ctrlAs].$$data_lpid_first_init;
  1683 + },
  1684 + function(newValue, oldValue) {
  1685 + scope[ctrlAs].$$internal_validate_init();
  1686 + }
  1687 + );
  1688 + scope.$watch(
  1689 + function() {
  1690 + return scope[ctrlAs].$$data_lpstart_first_init;
  1691 + },
  1692 + function(newValue, oldValue) {
  1693 + scope[ctrlAs].$$internal_validate_init();
  1694 + }
  1695 + );
  1696 +
  1697 +
  1698 + // 监控线路id的变化
  1699 + attr.$observe("xlidvalue", function(value) {
  1700 + if (value && value != "") {
  1701 + console.log("xlidvalue=" + value);
  1702 +
  1703 + guideboardManageService_g.rest.list(
  1704 + {"xl.id_eq": value, size: 100},
  1705 + function(result) {
  1706 + // 获取值了
  1707 + console.log("路牌获取了");
  1708 +
  1709 + scope[ctrlAs].$$data = [];
  1710 + for (var i = 0; i < result.content.length; i++) {
  1711 + scope[ctrlAs].$$data.push({
  1712 + lpid: result.content[i].id,
  1713 + lpname: result.content[i].lpName,
  1714 + isstart: false
  1715 + });
  1716 + }
  1717 + if (scope[ctrlAs].$$data_init) {
  1718 + scope[ctrlAs].$$dataSelected = [];
  1719 + scope[ctrlAs].$$dataSelectedStart = undefined;
  1720 + scope[ctrlAs].$$internalmodel = undefined;
  1721 + }
  1722 + scope[ctrlAs].$$data_xl_first_init = true;
  1723 + },
  1724 + function(result) {
  1725 +
  1726 + }
  1727 + );
  1728 +
  1729 + }
  1730 + });
  1731 +
  1732 + // 监控路牌名称范围值的变化
  1733 + attr.$observe("lprangevalue", function(value) {
  1734 + if (value && value != "") {
  1735 + var data_temp = scope[ctrlAs].$$dataSelected;
  1736 + var lpnames = value.split(",");
  1737 + var i = 0;
  1738 + if (data_temp && data_temp.length == 0) { // 初始创建
  1739 + console.log("lprangevalue变换了");
  1740 + for (i = 0; i < lpnames.length; i++) {
  1741 + scope[ctrlAs].$$dataSelected.push({
  1742 + lpname: lpnames[i],
  1743 + isstart: false
  1744 + });
  1745 + }
  1746 + } else {
  1747 + for (i = 0; i < lpnames.length; i++) {
  1748 + data_temp[i].lpname = lpnames[i];
  1749 + }
  1750 + }
  1751 + scope[ctrlAs].$$data_lp_first_init = true;
  1752 + }
  1753 + });
  1754 +
  1755 + // 监控路牌id范围值的变化
  1756 + attr.$observe("lpidrangevalue", function(value) {
  1757 + if (value && value != "") {
  1758 + console.log("lpidrangevalue=" + value);
  1759 + var data_temp = scope[ctrlAs].$$dataSelected;
  1760 + var lpids = value.split(",");
  1761 + var i = 0;
  1762 + if (data_temp && data_temp.length == 0) { // 初始创建
  1763 + console.log("lpidrangevalue");
  1764 + for (i = 0; i < lpids.length; i++) {
  1765 + scope[ctrlAs].$$dataSelected.push({
  1766 + lpid: lpids[i],
  1767 + isstart: false
  1768 + });
  1769 + }
  1770 + } else {
  1771 + for (i = 0; i < lpids.length; i++) {
  1772 + data_temp[i].lpid = lpids[i];
  1773 + }
  1774 + }
  1775 + scope[ctrlAs].$$data_lpid_first_init = true;
  1776 + }
  1777 + });
  1778 +
  1779 + // 监控起始路牌的变化
  1780 + attr.$observe("lpstartvalue", function(value) {
  1781 + if (value && value != "") {
  1782 + scope[ctrlAs].$$dataSelectedStart = value - 1;
  1783 + scope[ctrlAs].$$data_lpstart_first_init = true;
  1784 + }
  1785 + });
  1786 +
  1787 +
  1788 +
  1789 + }
  1790 + }
  1791 +
  1792 + }
  1793 + }
  1794 + }
  1795 +]);
  1796 +
  1797 +/**
  1798 + * saEmployeegroup指令
  1799 + * 属性如下:
  1800 + * name(必须):控件的名字
  1801 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1802 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  1803 + * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1804 + * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange
  1805 + * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1806 + * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange
  1807 + * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  1808 + * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart
  1809 + *
  1810 + * required(可选):是否要用required验证
  1811 + *
  1812 + */
  1813 +angular.module('ScheduleApp').directive('saEmployeegroup', [
  1814 + 'EmployeeConfigService_g',
  1815 + function(employeeConfigService_g) {
  1816 + return {
  1817 + restrict: 'E',
  1818 + templateUrl: '/pages/scheduleApp/module/common/dt/MyEmployeeGroupWrapTemplate.html',
  1819 + scope: {
  1820 + model: "=" // 独立作用域,关联外部的模型object
  1821 + },
  1822 + controllerAs: '$saEmployeegroupCtrl',
  1823 + bindToController: true,
  1824 + controller: function($scope) {
  1825 + var self = this;
  1826 + self.$$data = []; // 选择线路后,该线路的人员配置数据
  1827 +
  1828 + // 测试数据
  1829 + //self.$$data = [
  1830 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},
  1831 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},
  1832 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}
  1833 + //];
  1834 +
  1835 + self.$$dataSelected = []; // 选中的人员配置列表
  1836 + self.$$dataSelectedStart = undefined; // 起始人员配置
  1837 +
  1838 + //self.$$dataSelected = [
  1839 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},
  1840 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},
  1841 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}
  1842 + //];
  1843 +
  1844 + self.$$isFB = false; // 是否分班
  1845 + self.$$dataFBSelected = []; // 选中的分班人员组配置列表
  1846 + self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识
  1847 + self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合
  1848 +
  1849 + //self.$$dataFBSelected = [
  1850 + // {isstart: true, group: [
  1851 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  1852 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  1853 + // ]},
  1854 + // {isstart: false, group: [
  1855 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  1856 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  1857 + // ]}
  1858 + //];
  1859 +
  1860 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  1861 + self.$$internalmodel = undefined;
  1862 +
  1863 + self.$$data_init = false; // *数据源初始化标志
  1864 + self.$$data_xl_first_init = false; // 线路是否初始化
  1865 + self.$$data_ry_first_init = false; // 人员配置是否初始化
  1866 + self.$$data_ry_first_data = undefined; // 人员配置初始化数据
  1867 + self.$$data_rycid_first_init = false; // 人员配置id是否初始化
  1868 + self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据
  1869 + self.$$data_rystart_first_init = false; // 起始人员是否初始化
  1870 + self.$$data_rystart_first_data = undefined; // 起始人员初始化数据
  1871 +
  1872 + },
  1873 +
  1874 + /**
  1875 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1876 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1877 + * @param tElem
  1878 + * @param tAttrs
  1879 + * @returns {{pre: Function, post: Function}}
  1880 + */
  1881 + compile: function(tElem, tAttrs) {
  1882 + // TODO:获取所有的属性
  1883 + var $name_attr = tAttrs["name"]; // 控件的名字
  1884 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1885 + var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名
  1886 + var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名
  1887 + var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名
  1888 +
  1889 + // controlAs名字
  1890 + var ctrlAs = '$saEmployeegroupCtrl';
  1891 +
  1892 + // 如果有required属性,添加angularjs required验证
  1893 + if ($required_attr != undefined) {
  1894 + //console.log(tElem.html());
  1895 + tElem.find("div").attr("required", "");
  1896 + }
  1897 +
  1898 + return {
  1899 + pre: function(scope, element, attr) {
  1900 + // TODO:
  1901 + },
  1902 +
  1903 + /**
  1904 + * 相当于link函数。
  1905 + * @param scope
  1906 + * @param element
  1907 + * @param attr
  1908 + */
  1909 + post: function(scope, element, attr) {
  1910 + // name属性
  1911 + if ($name_attr) {
  1912 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1913 + }
  1914 +
  1915 + /**
  1916 + * 人员配置列表点击(人员配置列表中选中路牌)
  1917 + * @param $index
  1918 + */
  1919 + scope[ctrlAs].$$internal_rylist_click = function($index) {
  1920 + var data_temp = scope[ctrlAs].$$data;
  1921 + if (data_temp && data_temp.length > $index) {
  1922 + if (!scope[ctrlAs].$$isFB) { // 不分班
  1923 + scope[ctrlAs].$$dataSelected.push({
  1924 + id : data_temp[$index].id,
  1925 + dbbm: data_temp[$index].dbbm,
  1926 + jsy: data_temp[$index].jsy,
  1927 + spy: data_temp[$index].spy,
  1928 + isstart: false
  1929 + });
  1930 +
  1931 + // 如果没有指定过初始人员,默认选择此人员作为起始人员
  1932 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  1933 + scope[ctrlAs].$$internal_selrylist_click(
  1934 + scope[ctrlAs].$$dataSelected.length - 1);
  1935 + }
  1936 + } else { // 分班
  1937 + if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员
  1938 + scope[ctrlAs].$$dataFBSelected
  1939 + [scope[ctrlAs].$$dataFBInternalSelected.gindex].group
  1940 + [scope[ctrlAs].$$dataFBInternalSelected.index] = {
  1941 + id : data_temp[$index].id,
  1942 + dbbm: data_temp[$index].dbbm,
  1943 + jsy: data_temp[$index].jsy,
  1944 + spy: data_temp[$index].spy,
  1945 + isselected: true
  1946 + };
  1947 +
  1948 + } else {
  1949 + scope[ctrlAs].$$dataFBSelected.push({
  1950 + isstart: false,
  1951 + group: [].concat(
  1952 + {
  1953 + id : data_temp[$index].id,
  1954 + dbbm: data_temp[$index].dbbm,
  1955 + jsy: data_temp[$index].jsy,
  1956 + spy: data_temp[$index].spy,
  1957 + isselected: false
  1958 + }, {
  1959 + id : data_temp[$index].id,
  1960 + dbbm: data_temp[$index].dbbm,
  1961 + jsy: data_temp[$index].jsy,
  1962 + spy: data_temp[$index].spy,
  1963 + isselected: false
  1964 + }
  1965 + )
  1966 + });
  1967 + if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {
  1968 + scope[ctrlAs].$$internal_selrygrouplist_click(
  1969 + scope[ctrlAs].$$dataFBSelected.length - 1);
  1970 + }
  1971 + }
  1972 + }
  1973 +
  1974 + }
  1975 + };
  1976 +
  1977 + /**
  1978 + * 选中的人员单击(初始人员选择)
  1979 + * @param $index
  1980 + */
  1981 + scope[ctrlAs].$$internal_selrylist_click = function($index) {
  1982 + var data_temp = scope[ctrlAs].$$dataSelected;
  1983 + if (data_temp && data_temp.length > $index) {
  1984 + for (var i = 0; i < data_temp.length; i++) {
  1985 + data_temp[i].isstart = false;
  1986 + }
  1987 + data_temp[$index].isstart = true;
  1988 + scope[ctrlAs].$$dataSelectedStart = $index;
  1989 + }
  1990 + };
  1991 + /**
  1992 + * 选中的人员双击(删除选中的人员)
  1993 + * @param $index
  1994 + */
  1995 + scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {
  1996 + var data_temp = scope[ctrlAs].$$dataSelected;
  1997 + if (data_temp && data_temp.length > $index) {
  1998 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  1999 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2000 + }
  2001 + data_temp.splice($index, 1);
  2002 + }
  2003 + };
  2004 +
  2005 + /**
  2006 + * 选中的分班组人员单击(初始人员选择)
  2007 + * @param $index
  2008 + */
  2009 + scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {
  2010 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2011 + if (data_temp && data_temp.length > $index) {
  2012 + for (var i = 0; i < data_temp.length; i++) {
  2013 + data_temp[i].isstart = false;
  2014 + for (var j = 0; j < data_temp[i].group.length; j++) {
  2015 + data_temp[i].group[j].isselected = false;
  2016 + }
  2017 + }
  2018 + data_temp[$index].isstart = true;
  2019 + scope[ctrlAs].$$dataFBSelectedStart = $index;
  2020 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  2021 + }
  2022 + };
  2023 + /**
  2024 + * 分组内部单击(选中分班中的某组人员)
  2025 + * @param $groupindex 组index
  2026 + * @param $index 组内部某个index
  2027 + * @param $event 事件防止冒泡
  2028 + */
  2029 + scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {
  2030 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2031 + if (data_temp && data_temp.length > $groupindex) {
  2032 + if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {
  2033 + // $$dataFBInternalSelected的格式如下:
  2034 + //{gindex: 1, index: 0}
  2035 + for (var i = 0; i < data_temp.length; i++) {
  2036 + data_temp[i].isstart = false;
  2037 + for (var j = 0; j < data_temp[i].group.length; j++) {
  2038 + data_temp[i].group[j].isselected = false;
  2039 + }
  2040 + }
  2041 + data_temp[$groupindex].group[$index].isselected = true;
  2042 + scope[ctrlAs].$$dataFBInternalSelected = {
  2043 + gindex: $groupindex, index: $index
  2044 + };
  2045 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2046 + $event.stopPropagation();
  2047 + }
  2048 + }
  2049 +
  2050 + };
  2051 + /**
  2052 + * 选中的分班人员双击(删除选中的人员)
  2053 + * @param $index
  2054 + */
  2055 + scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {
  2056 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2057 + if (data_temp && data_temp.length > $index) {
  2058 + if (scope[ctrlAs].$$dataFBSelectedStart == $index) {
  2059 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2060 + }
  2061 + if (scope[ctrlAs].$$dataFBInternalSelected &&
  2062 + scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {
  2063 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  2064 + }
  2065 + data_temp.splice($index, 1);
  2066 + }
  2067 + };
  2068 +
  2069 + /**
  2070 + * 验证内部数据,更新外部model
  2071 + */
  2072 + scope[ctrlAs].$$internal_validate_model = function() {
  2073 + var data_temp = scope[ctrlAs].$$dataSelected;
  2074 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  2075 + var data_temp3 = scope[ctrlAs].$$dataFBSelected;
  2076 + var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;
  2077 + var ryDbbms = [];
  2078 + var ryDbbm_group = [];
  2079 + var ryCids = [];
  2080 + var ryCid_group = [];
  2081 + var ryStart = 0;
  2082 + var i = 0;
  2083 + var j = 0;
  2084 +
  2085 + var isFB = scope[ctrlAs].$$isFB;
  2086 +
  2087 + if (isFB) {
  2088 + if (data_temp3 &&
  2089 + data_temp3.length > 0 &&
  2090 + data_temp4 != undefined) {
  2091 +
  2092 + for (i = 0; i < data_temp3.length; i++) {
  2093 + for (j = 0; j < data_temp3[i].group.length; j++) {
  2094 + ryDbbm_group.push(data_temp3[i].group[j].dbbm);
  2095 + ryCid_group.push(data_temp3[i].group[j].id);
  2096 + }
  2097 + ryDbbms.push(ryDbbm_group.join("-"));
  2098 + ryCids.push(ryCid_group.join("-"));
  2099 + ryDbbm_group = [];
  2100 + ryCid_group = [];
  2101 + }
  2102 +
  2103 + data_temp3[data_temp4].isstart = true;
  2104 + ryStart = data_temp4 + 1;
  2105 +
  2106 + // 更新内部model,用于外部验证
  2107 + // 内部model的值暂时随意,以后再改
  2108 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  2109 +
  2110 + // 更新外部model字段
  2111 + if ($dbbmrangename_attr) {
  2112 + console.log("dbbmrangename=" + ryDbbms.join(','));
  2113 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  2114 + }
  2115 + if (rycidrangename_attr) {
  2116 + console.log("rycidrangename=" + ryCids.join(','));
  2117 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  2118 + }
  2119 + if ($rystartname_attr) {
  2120 + console.log("rystartname=" + ryStart);
  2121 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  2122 + }
  2123 +
  2124 + } else {
  2125 + scope[ctrlAs].$$internalmodel = undefined;
  2126 + }
  2127 +
  2128 + } else {
  2129 + if (data_temp &&
  2130 + data_temp.length > 0 &&
  2131 + data_temp2 != undefined) {
  2132 +
  2133 + for (i = 0; i < data_temp.length; i++) {
  2134 + ryDbbms.push(data_temp[i].dbbm);
  2135 + ryCids.push(data_temp[i].id);
  2136 + }
  2137 + data_temp[data_temp2].isstart = true;
  2138 + ryStart = data_temp2 + 1;
  2139 +
  2140 + // 更新内部model,用于外部验证
  2141 + // 内部model的值暂时随意,以后再改
  2142 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  2143 +
  2144 + // 更新外部model字段
  2145 + if ($dbbmrangename_attr) {
  2146 + console.log("dbbmrangename=" + ryDbbms.join(','));
  2147 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  2148 + }
  2149 + if (rycidrangename_attr) {
  2150 + console.log("rycidrangename=" + ryCids.join(','));
  2151 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  2152 + }
  2153 + if ($rystartname_attr) {
  2154 + console.log("rystartname=" + ryStart);
  2155 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  2156 + }
  2157 +
  2158 + } else {
  2159 + scope[ctrlAs].$$internalmodel = undefined;
  2160 + }
  2161 + }
  2162 +
  2163 + };
  2164 +
  2165 + // 监控内部数据,$$dataSelected 变化
  2166 + scope.$watch(
  2167 + function() {
  2168 + return scope[ctrlAs].$$dataSelected;
  2169 + },
  2170 + function(newValue, oldValue) {
  2171 + scope[ctrlAs].$$internal_validate_model();
  2172 + },
  2173 + true
  2174 + );
  2175 +
  2176 + // 监控内部数据,$$dataSelectedStart 变化
  2177 + scope.$watch(
  2178 + function() {
  2179 + return scope[ctrlAs].$$dataSelectedStart;
  2180 + },
  2181 + function(newValue, oldValue) {
  2182 + scope[ctrlAs].$$internal_validate_model();
  2183 + },
  2184 + true
  2185 + );
  2186 +
  2187 +
  2188 + // 监控内部数据,$$dataFBSelected 变化
  2189 + scope.$watch(
  2190 + function() {
  2191 + return scope[ctrlAs].$$dataFBSelected;
  2192 + },
  2193 + function(newValue, oldValue) {
  2194 + scope[ctrlAs].$$internal_validate_model();
  2195 + },
  2196 + true
  2197 + );
  2198 +
  2199 + // 监控内部数据,$$dataFBSelectedStart 变化
  2200 + scope.$watch(
  2201 + function() {
  2202 + return scope[ctrlAs].$$dataFBSelectedStart;
  2203 + },
  2204 + function(newValue, oldValue) {
  2205 + scope[ctrlAs].$$internal_validate_model();
  2206 + },
  2207 + true
  2208 + );
  2209 +
  2210 + // 监控内部数据,$$dataFBInternalSelected 变化
  2211 + scope.$watch(
  2212 + function() {
  2213 + return scope[ctrlAs].$$dataFBInternalSelected;
  2214 + },
  2215 + function(newValue, oldValue) {
  2216 + scope[ctrlAs].$$internal_validate_model();
  2217 + },
  2218 + true
  2219 + );
  2220 +
  2221 + // 监控内部数据,$$isFB 变化
  2222 + scope.$watch(
  2223 + function() {
  2224 + return scope[ctrlAs].$$isFB;
  2225 + },
  2226 + function(newValue, oldValue) {
  2227 + scope[ctrlAs].$$internal_validate_model();
  2228 + },
  2229 + true
  2230 + );
  2231 +
  2232 + /**
  2233 + * 验证数据是否初始化完成,
  2234 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  2235 + */
  2236 + scope[ctrlAs].$$internal_validate_init = function() {
  2237 + var self = scope[ctrlAs];
  2238 + var data_temp = self.$$data;
  2239 + var dataSelect_temp = self.$$dataSelected;
  2240 + var dataFBSelect_temp = self.$$dataFBSelected;
  2241 + var dbbmnames = null;
  2242 + var dbbmnamegroup = null;
  2243 + var rycids = null;
  2244 + var rycidgroup = null;
  2245 +
  2246 + var i = 0;
  2247 + var j = 0;
  2248 + var k = 0;
  2249 +
  2250 + if (self.$$data_xl_first_init &&
  2251 + self.$$data_ry_first_init &&
  2252 + self.$$data_rycid_first_init &&
  2253 + self.$$data_rystart_first_init && !self.$$data_init) {
  2254 + console.log("开始初始化数据");
  2255 +
  2256 + // 判定是否分班,字符串中包含-就是了
  2257 + if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班
  2258 + self.$$isFB = true;
  2259 +
  2260 + // 搭班编码、人员配置id
  2261 + dbbmnames = self.$$data_ry_first_data.split(",");
  2262 + rycids = self.$$data_rycid_first_data.split(",");
  2263 + for (i = 0; i < dbbmnames.length; i++) {
  2264 + dataFBSelect_temp.push({
  2265 + group: [],
  2266 + isstart: false
  2267 + });
  2268 + dbbmnamegroup = dbbmnames[i].split("-");
  2269 + rycidgroup = rycids[i].split("-");
  2270 +
  2271 + for (k = 0; k < dbbmnamegroup.length; k++) {
  2272 + dataFBSelect_temp[i].group.push({
  2273 + id: rycidgroup[k],
  2274 + dbbm: dbbmnamegroup[k],
  2275 + isselected: false
  2276 + });
  2277 +
  2278 + for (j = 0; j < data_temp.length; j++) {
  2279 + if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {
  2280 + dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;
  2281 + dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;
  2282 + break;
  2283 + }
  2284 + }
  2285 + }
  2286 +
  2287 + }
  2288 +
  2289 + // 初始人员
  2290 + scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;
  2291 +
  2292 +
  2293 + } else if (dataSelect_temp.length == 0) {
  2294 + self.$$isFB = false;
  2295 +
  2296 + // 搭班编码、人员配置id
  2297 + dbbmnames = self.$$data_ry_first_data.split(",");
  2298 + rycids = self.$$data_rycid_first_data.split(",");
  2299 + for (i = 0; i < dbbmnames.length; i++) {
  2300 + dataSelect_temp.push({
  2301 + id: rycids[i],
  2302 + dbbm: dbbmnames[i],
  2303 + isstart: false
  2304 + });
  2305 + for (j = 0; j < data_temp.length; j++) {
  2306 + if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {
  2307 + dataSelect_temp[i].jsy = data_temp[j].jsy;
  2308 + dataSelect_temp[i].spy = data_temp[j].spy;
  2309 + break;
  2310 + }
  2311 + }
  2312 + }
  2313 + // 初始人员
  2314 + scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1;
  2315 +
  2316 + }
  2317 +
  2318 + console.log("数据初始化完毕!");
  2319 + self.$$data_init = true;
  2320 + }
  2321 +
  2322 + };
  2323 +
  2324 + // 监控初始化标志,线路,人员,起始人员
  2325 + scope.$watch(
  2326 + function() {
  2327 + return scope[ctrlAs].$$data_xl_first_init;
  2328 + },
  2329 + function(newValue, oldValue) {
  2330 + scope[ctrlAs].$$internal_validate_init();
  2331 + }
  2332 + );
  2333 + scope.$watch(
  2334 + function() {
  2335 + return scope[ctrlAs].$$data_ry_first_init;
  2336 + },
  2337 + function(newValue, oldValue) {
  2338 + scope[ctrlAs].$$internal_validate_init();
  2339 + }
  2340 + );
  2341 + scope.$watch(
  2342 + function() {
  2343 + return scope[ctrlAs].$$data_rycid_first_init;
  2344 + },
  2345 + function(newValue, oldValue) {
  2346 + scope[ctrlAs].$$internal_validate_init();
  2347 + }
  2348 + );
  2349 + scope.$watch(
  2350 + function() {
  2351 + return scope[ctrlAs].$$data_rystart_first_init;
  2352 + },
  2353 + function(newValue, oldValue) {
  2354 + scope[ctrlAs].$$internal_validate_init();
  2355 + }
  2356 + );
  2357 +
  2358 +
  2359 + // 监控线路id的变化
  2360 + attr.$observe("xlidvalue", function(value) {
  2361 + if (value && value != "") {
  2362 + console.log("xlidvalue=" + value);
  2363 +
  2364 + employeeConfigService_g.rest.list(
  2365 + {"xl.id_eq": value, "isCancel_eq" : false, size: 100},
  2366 + function(result) {
  2367 + // 获取值了
  2368 + console.log("人员配置获取了");
  2369 +
  2370 + scope[ctrlAs].$$data = [];
  2371 + for (var i = 0; i < result.content.length; i++) {
  2372 + scope[ctrlAs].$$data.push({
  2373 + id: result.content[i].id,
  2374 + dbbm: result.content[i].dbbm,
  2375 + jsy: result.content[i].jsy.personnelName,
  2376 + spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName
  2377 + });
  2378 + }
  2379 + if (scope[ctrlAs].$$data_init) {
  2380 + scope[ctrlAs].$$dataSelected = [];
  2381 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2382 +
  2383 + scope[ctrlAs].$$dataFBSelected = [];
  2384 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  2385 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2386 +
  2387 + scope[ctrlAs].$$internalmodel = undefined;
  2388 + }
  2389 + scope[ctrlAs].$$data_xl_first_init = true;
  2390 + },
  2391 + function(result) {
  2392 +
  2393 + }
  2394 + );
  2395 +
  2396 + }
  2397 + });
  2398 +
  2399 + // 监控搭班编码范围值的变化
  2400 + attr.$observe("dbbmrangevalue", function(value) {
  2401 + if (value && value != "") {
  2402 + console.log("dbbmrangevalue变换了");
  2403 + scope[ctrlAs].$$data_ry_first_init = true;
  2404 + scope[ctrlAs].$$data_ry_first_data = value;
  2405 + }
  2406 + });
  2407 +
  2408 + // 监控人员配置id范围值的变化
  2409 + attr.$observe("rycidrangevalue", function(value) {
  2410 + if (value && value != "") {
  2411 + console.log("rycidrangevalue变换了");
  2412 + scope[ctrlAs].$$data_rycid_first_init = true;
  2413 + scope[ctrlAs].$$data_rycid_first_data = value;
  2414 + }
  2415 + });
  2416 +
  2417 + // 监控起始人员的变化
  2418 + attr.$observe("rystartvalue", function(value) {
  2419 + if (value && value != "") {
  2420 + console.log("rystartvalue变换了");
  2421 + scope[ctrlAs].$$data_rystart_first_init = true;
  2422 + scope[ctrlAs].$$data_rystart_first_data = value;
  2423 + }
  2424 + });
  2425 +
  2426 + }
  2427 + }
  2428 +
  2429 + }
  2430 + }
  2431 + }
  2432 +]);
  2433 +
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
@@ -198,7 +198,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusConfigService_g&#39;, [&#39;$resource&#39;, functi @@ -198,7 +198,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusConfigService_g&#39;, [&#39;$resource&#39;, functi
198 return { 198 return {
199 rest : $resource( 199 rest : $resource(
200 '/cci/:id', 200 '/cci/:id',
201 - {order: 'createDate', direction: 'ASC', id: '@id_route'}, 201 + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
202 { 202 {
203 list: { 203 list: {
204 method: 'GET', 204 method: 'GET',
@@ -222,7 +222,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService_g&#39;, [&#39;$resource&#39;, f @@ -222,7 +222,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService_g&#39;, [&#39;$resource&#39;, f
222 return { 222 return {
223 rest : $resource( 223 rest : $resource(
224 '/eci/:id', 224 '/eci/:id',
225 - {order: 'createDate', direction: 'ASC', id: '@id_route'}, 225 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
226 { 226 {
227 list: { 227 list: {
228 method: 'GET', 228 method: 'GET',
@@ -235,6 +235,9 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService_g&#39;, [&#39;$resource&#39;, f @@ -235,6 +235,9 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService_g&#39;, [&#39;$resource&#39;, f
235 }, 235 },
236 save: { 236 save: {
237 method: 'POST' 237 method: 'POST'
  238 + },
  239 + delete: {
  240 + method: 'DELETE'
238 } 241 }
239 } 242 }
240 ), 243 ),
src/main/resources/static/pages/scheduleApp/module/core/busConfig/busConfig.js
@@ -56,6 +56,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusConfigService&#39;, [&#39;BusConfigService_g&#39;, @@ -56,6 +56,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusConfigService&#39;, [&#39;BusConfigService_g&#39;,
56 */ 56 */
57 saveDetail: function(obj) { 57 saveDetail: function(obj) {
58 return service.rest.save(obj).$promise; 58 return service.rest.save(obj).$promise;
  59 + },
  60 + /**
  61 + * 删除信息。
  62 + * @param id 主键id
  63 + * @returns {*|Function|promise|n}
  64 + */
  65 + deleteDetail: function(id) {
  66 + return service.rest.delete({id: id}).$promise;
59 } 67 }
60 }; 68 };
61 69
@@ -184,6 +192,74 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusConfigListCtrl&#39;, [&#39;BusConfigService @@ -184,6 +192,74 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusConfigListCtrl&#39;, [&#39;BusConfigService
184 self.pageChanaged(); 192 self.pageChanaged();
185 }; 193 };
186 194
  195 + // 删除时刻表
  196 + self.deleteEci = function(id) {
  197 + // TODO:
  198 + busConfigService.deleteDetail(id).then(
  199 + function(result) {
  200 + if (result.message) { // 暂时这样做,之后全局拦截
  201 + alert("失败:" + result.message);
  202 + } else {
  203 + alert("作废成功!");
  204 +
  205 + busConfigService.getPage().then(
  206 + function(result) {
  207 + self.pageInfo.totalItems = result.totalElements;
  208 + self.pageInfo.currentPage = result.number + 1;
  209 + self.pageInfo.infos = result.content;
  210 + busConfigService.setCurrentPageNo(result.number + 1);
  211 + },
  212 + function(result) {
  213 + alert("出错啦!");
  214 + }
  215 + );
  216 + }
  217 +
  218 + },
  219 + function(result) {
  220 + alert("出错啦!" + result);
  221 + }
  222 + );
  223 + };
  224 +
  225 + // 撤销修改
  226 + self.redoDeleteEci = function(id) {
  227 + busConfigService.getDetail(id).then(
  228 + function(result) {
  229 + result.isCancel = 'false';
  230 + busConfigService.saveDetail(result).then(
  231 + function(result) {
  232 + if (result.message) { // 暂时这样做,之后全局拦截
  233 + alert("失败:" + result.message);
  234 + } else {
  235 + alert("撤销成功!");
  236 +
  237 + busConfigService.getPage().then(
  238 + function(result) {
  239 + self.pageInfo.totalItems = result.totalElements;
  240 + self.pageInfo.currentPage = result.number + 1;
  241 + self.pageInfo.infos = result.content;
  242 + busConfigService.setCurrentPageNo(result.number + 1);
  243 + },
  244 + function(result) {
  245 + alert("出错啦!");
  246 + }
  247 + );
  248 + }
  249 + },
  250 + function(result) {
  251 + // TODO:弹出框方式以后改
  252 + alert("出错啦!");
  253 + }
  254 + );
  255 + },
  256 + function(result) {
  257 + // TODO:弹出框方式以后改
  258 + alert("出错啦!");
  259 + }
  260 + );
  261 + };
  262 +
187 }]); 263 }]);
188 264
189 angular.module('ScheduleApp').controller('BusConfigFormCtrl', ['BusConfigService', '$stateParams', '$state', '$scope', function(busConfigService, $stateParams, $state, $scope) { 265 angular.module('ScheduleApp').controller('BusConfigFormCtrl', ['BusConfigService', '$stateParams', '$state', '$scope', function(busConfigService, $stateParams, $state, $scope) {
src/main/resources/static/pages/scheduleApp/module/core/busConfig/edit.html
@@ -127,8 +127,17 @@ @@ -127,8 +127,17 @@
127 <div class="form-group has-success has-feedback"> 127 <div class="form-group has-success has-feedback">
128 <label class="col-md-2 control-label">停车场*:</label> 128 <label class="col-md-2 control-label">停车场*:</label>
129 <div class="col-md-3"> 129 <div class="col-md-3">
130 - <input type="text" class="form-control" name="tcd" ng-model="ctrl.busConfigForSave.tcd" required  
131 - placeholder="请输入停车场"/> 130 + <sa-Select3 model="ctrl.busConfigForSave"
  131 + name="tcd"
  132 + placeholder="请输拼音..."
  133 + dcvalue="{{ctrl.busConfigForSave.tcd}}"
  134 + dcname="tcd"
  135 + icname="parkName"
  136 + icnames="parkName"
  137 + datatype="tcc"
  138 + mlp="true"
  139 + required >
  140 + </sa-Select3>
132 </div> 141 </div>
133 <!-- 隐藏块,显示验证信息 --> 142 <!-- 隐藏块,显示验证信息 -->
134 <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required"> 143 <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required">
src/main/resources/static/pages/scheduleApp/module/core/busConfig/form.html
@@ -129,8 +129,17 @@ @@ -129,8 +129,17 @@
129 <div class="form-group has-success has-feedback"> 129 <div class="form-group has-success has-feedback">
130 <label class="col-md-2 control-label">停车场*:</label> 130 <label class="col-md-2 control-label">停车场*:</label>
131 <div class="col-md-3"> 131 <div class="col-md-3">
132 - <input type="text" class="form-control" name="tcd" ng-model="ctrl.busConfigForSave.tcd" required  
133 - placeholder="请输入停车场"/> 132 + <sa-Select3 model="ctrl.busConfigForSave"
  133 + name="tcd"
  134 + placeholder="请输拼音..."
  135 + dcvalue="{{ctrl.busConfigForSave.tcd}}"
  136 + dcname="tcd"
  137 + icname="parkName"
  138 + icnames="parkName"
  139 + datatype="tcc"
  140 + mlp="true"
  141 + required >
  142 + </sa-Select3>
134 </div> 143 </div>
135 <!-- 隐藏块,显示验证信息 --> 144 <!-- 隐藏块,显示验证信息 -->
136 <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required"> 145 <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required">
src/main/resources/static/pages/scheduleApp/module/core/busConfig/list.html
@@ -27,13 +27,13 @@ @@ -27,13 +27,13 @@
27 </sa-Select3> 27 </sa-Select3>
28 </div> 28 </div>
29 </td> 29 </td>
  30 + <td>
  31 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['cl.insideCode_like']" placeholder="输入内部编号..."/>
  32 + </td>
30 <td></td> 33 <td></td>
31 <td></td> 34 <td></td>
32 <td></td> 35 <td></td>
33 <td> 36 <td>
34 - <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().tcd_like"/>  
35 - </td>  
36 - <td>  
37 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" 37 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
38 ng-click="ctrl.pageChanaged()"> 38 ng-click="ctrl.pageChanaged()">
39 <i class="fa fa-search"></i> 搜索</button> 39 <i class="fa fa-search"></i> 搜索</button>
@@ -47,7 +47,7 @@ @@ -47,7 +47,7 @@
47 47
48 </thead> 48 </thead>
49 <tbody> 49 <tbody>
50 - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX"> 50 + <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
51 <td> 51 <td>
52 <span ng-bind="$index + 1"></span> 52 <span ng-bind="$index + 1"></span>
53 </td> 53 </td>
@@ -70,7 +70,9 @@ @@ -70,7 +70,9 @@
70 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> 70 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
71 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> 71 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
72 <a ui-sref="busConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a> 72 <a ui-sref="busConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
73 - <a ui-sref="busConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a> 73 + <a ui-sref="busConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  74 + <a ng-click="ctrl.deleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  75 + <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
74 </td> 76 </td>
75 </tr> 77 </tr>
76 </tbody> 78 </tbody>
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/employeeConfig.js
@@ -57,6 +57,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService&#39;, [&#39;EmployeeConfigS @@ -57,6 +57,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService&#39;, [&#39;EmployeeConfigS
57 */ 57 */
58 saveDetail: function(obj) { 58 saveDetail: function(obj) {
59 return service.rest.save(obj).$promise; 59 return service.rest.save(obj).$promise;
  60 + },
  61 + /**
  62 + * 删除信息。
  63 + * @param id 主键id
  64 + * @returns {*|Function|promise|n}
  65 + */
  66 + deleteDetail: function(id) {
  67 + return service.rest.delete({id: id}).$promise;
60 } 68 }
61 }; 69 };
62 }]); 70 }]);
@@ -183,6 +191,75 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;EmployeeConfigListCtrl&#39;, [&#39;EmployeeCon @@ -183,6 +191,75 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;EmployeeConfigListCtrl&#39;, [&#39;EmployeeCon
183 self.pageInfo.currentPage = 1; 191 self.pageInfo.currentPage = 1;
184 self.pageChanaged(); 192 self.pageChanaged();
185 }; 193 };
  194 +
  195 + // 删除时刻表
  196 + self.deleteEci = function(id) {
  197 + // TODO:
  198 + employeeConfigService.deleteDetail(id).then(
  199 + function(result) {
  200 + if (result.message) { // 暂时这样做,之后全局拦截
  201 + alert("失败:" + result.message);
  202 + } else {
  203 + alert("作废成功!");
  204 +
  205 + employeeConfigService.getPage().then(
  206 + function(result) {
  207 + self.pageInfo.totalItems = result.totalElements;
  208 + self.pageInfo.currentPage = result.number + 1;
  209 + self.pageInfo.infos = result.content;
  210 + employeeConfigService.setCurrentPageNo(result.number + 1);
  211 + },
  212 + function(result) {
  213 + alert("出错啦!");
  214 + }
  215 + );
  216 + }
  217 +
  218 + },
  219 + function(result) {
  220 + alert("出错啦!" + result);
  221 + }
  222 + );
  223 + };
  224 +
  225 + // 撤销修改
  226 + self.redoDeleteEci = function(id) {
  227 + employeeConfigService.getDetail(id).then(
  228 + function(result) {
  229 + result.isCancel = 'false';
  230 + employeeConfigService.saveDetail(result).then(
  231 + function(result) {
  232 + if (result.message) { // 暂时这样做,之后全局拦截
  233 + alert("失败:" + result.message);
  234 + } else {
  235 + alert("撤销成功!");
  236 +
  237 + employeeConfigService.getPage().then(
  238 + function(result) {
  239 + self.pageInfo.totalItems = result.totalElements;
  240 + self.pageInfo.currentPage = result.number + 1;
  241 + self.pageInfo.infos = result.content;
  242 + employeeConfigService.setCurrentPageNo(result.number + 1);
  243 + },
  244 + function(result) {
  245 + alert("出错啦!");
  246 + }
  247 + );
  248 + }
  249 + },
  250 + function(result) {
  251 + // TODO:弹出框方式以后改
  252 + alert("出错啦!");
  253 + }
  254 + );
  255 + },
  256 + function(result) {
  257 + // TODO:弹出框方式以后改
  258 + alert("出错啦!");
  259 + }
  260 + );
  261 + };
  262 +
186 }]); 263 }]);
187 264
188 angular.module('ScheduleApp').controller('EmployeeConfigFormCtrl', ['EmployeeConfigService', '$stateParams', '$state', function(employeeConfigService, $stateParams, $state) { 265 angular.module('ScheduleApp').controller('EmployeeConfigFormCtrl', ['EmployeeConfigService', '$stateParams', '$state', function(employeeConfigService, $stateParams, $state) {
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/list.html
@@ -31,24 +31,18 @@ @@ -31,24 +31,18 @@
31 </div> 31 </div>
32 </td> 32 </td>
33 <td></td> 33 <td></td>
34 - <td></td>  
35 <td> 34 <td>
36 - <div>  
37 - <sa-Select3 model="ctrl.searchCondition()"  
38 - name="ry"  
39 - placeholder="请输拼音..."  
40 - dcvalue="{{ctrl.searchCondition()['jsy.id_eq']}}"  
41 - dcname="jsy.id_eq"  
42 - icname="id"  
43 - icnames="personnelName"  
44 - datatype="ry"  
45 - dataassociate="true"  
46 - dataparam="{{ {'companyCode_eq': ctrl.searchCondition()['xl.company_eq']} | json }}" >  
47 - </sa-Select3>  
48 - </div> 35 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['jsy.jobCode_like']" placeholder="输入工号..."/>
  36 + </td>
  37 + <td>
  38 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['jsy.personnelName_like']" placeholder="输入姓名..."/>
  39 + </td>
  40 + <td>
  41 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['spy.jobCode_like']" placeholder="输入工号..."/>
  42 + </td>
  43 + <td>
  44 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['spy.personnelName_like']" placeholder="输入姓名..."/>
49 </td> 45 </td>
50 - <td></td>  
51 - <td></td>  
52 <td> 46 <td>
53 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" 47 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
54 ng-click="ctrl.pageChanaged()"> 48 ng-click="ctrl.pageChanaged()">
@@ -63,7 +57,7 @@ @@ -63,7 +57,7 @@
63 57
64 </thead> 58 </thead>
65 <tbody> 59 <tbody>
66 - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX"> 60 + <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
67 <td> 61 <td>
68 <span ng-bind="$index + 1"></span> 62 <span ng-bind="$index + 1"></span>
69 </td> 63 </td>
@@ -89,7 +83,9 @@ @@ -89,7 +83,9 @@
89 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> 83 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
90 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> 84 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
91 <a ui-sref="employeeConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a> 85 <a ui-sref="employeeConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
92 - <a ui-sref="employeeConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a> 86 + <a ui-sref="employeeConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  87 + <a ng-click="ctrl.deleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  88 + <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
93 </td> 89 </td>
94 </tr> 90 </tr>
95 </tbody> 91 </tbody>
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/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>  
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 - <a ui-sref="scheduleRuleManage">排班规则管理</a>  
18 - <i class="fa fa-circle"></i>  
19 - </li>  
20 - <li>  
21 - <span class="active">修改排班规则信息</span>  
22 - </li>  
23 -</ul>  
24 -  
25 -<div class="portlet light bordered" ng-controller="ScheduleRuleManageFormCtrl as ctrl">  
26 - <div class="portlet-title">  
27 - <div class="caption">  
28 - <i class="icon-equalizer font-red-sunglo"></i> <span  
29 - class="caption-subject font-red-sunglo bold uppercase">表单</span>  
30 - </div>  
31 - </div>  
32 -  
33 - <div class="portlet-body form">  
34 - <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">  
35 - <!--<div class="alert alert-danger display-hide">-->  
36 - <!--<button class="close" data-close="alert"></button>-->  
37 - <!--您的输入有误,请检查下面的输入项-->  
38 - <!--</div>-->  
39 -  
40 -  
41 - <!-- 其他信息放置在这里 -->  
42 - <div class="form-body">  
43 - <div class="form-group has-success has-feedback">  
44 - <label class="col-md-2 control-label">线路*:</label>  
45 - <div class="col-md-3">  
46 - <sa-Select3 model="ctrl.scheduleRuleManageForSave"  
47 - name="xl"  
48 - placeholder="请输拼音..."  
49 - dcvalue="{{ctrl.scheduleRuleManageForSave.xl.id}}"  
50 - dcname="xl.id"  
51 - icname="id"  
52 - icnames="name"  
53 - datatype="xl"  
54 - mlp="true"  
55 - required >  
56 - </sa-Select3>  
57 - </div>  
58 - <!-- 隐藏块,显示验证信息 -->  
59 - <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">  
60 - 线路必须选择  
61 - </div>  
62 - </div>  
63 - <div class="form-group has-success has-feedback">  
64 - <label class="col-md-2 control-label">车辆配置*:</label>  
65 - <div class="col-md-3">  
66 - <sa-Select3 model="ctrl.scheduleRuleManageForSave"  
67 - name="cl"  
68 - placeholder="请输拼音..."  
69 - dcvalue="{{ctrl.scheduleRuleManageForSave.carConfigInfo.id}}"  
70 - dcname="carConfigInfo.id"  
71 - icname="id"  
72 - icnames="cl.insideCode"  
73 - datatype="cci2"  
74 - dataassociate="true"  
75 - dataparam="{{ {'xl.id_eq': ctrl.scheduleRuleManageForSave.xl.id} | json }}"  
76 - mlp="true"  
77 - required >  
78 - </sa-Select3>  
79 - </div>  
80 - <!-- 隐藏块,显示验证信息 -->  
81 - <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">  
82 - 车辆必须选择  
83 - </div>  
84 - </div>  
85 -  
86 - <div class="form-group has-success has-feedback">  
87 - <label class="col-md-2 control-label">启用日期*:</label>  
88 - <div class="col-md-3">  
89 - <div class="input-group">  
90 - <input type="text" class="form-control"  
91 - name="qyrq" placeholder="请选择启用日期..."  
92 - uib-datepicker-popup="yyyy年MM月dd日"  
93 - is-open="ctrl.qyrqOpen" required  
94 - ng-model="ctrl.scheduleRuleManageForSave.qyrq" readonly/>  
95 - <span class="input-group-btn">  
96 - <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">  
97 - <i class="glyphicon glyphicon-calendar"></i>  
98 - </button>  
99 - </span>  
100 - </div>  
101 - </div>  
102 - <!-- 隐藏块,显示验证信息 -->  
103 - <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required">  
104 - 启用日期必须选择  
105 - </div>  
106 - </div>  
107 -  
108 - <div class="form-group has-success has-feedback">  
109 - <label class="col-md-2 control-label">路牌范围*:</label>  
110 - <div class="col-md-6">  
111 - <sa-Guideboardgroup model="ctrl.scheduleRuleManageForSave"  
112 - name="lprange"  
113 - xlidvalue="{{ctrl.scheduleRuleManageForSave.xl.id}}"  
114 - lprangevalue="{{ctrl.scheduleRuleManageForSave.lpNames}}"  
115 - lprangename="lpNames"  
116 - lpidrangevalue="{{ctrl.scheduleRuleManageForSave.lpIds}}"  
117 - lpidrangename="lpIds"  
118 - lpstartvalue="{{ctrl.scheduleRuleManageForSave.lpStart}}"  
119 - lpstartname="lpStart"  
120 - required  
121 - >  
122 - </sa-Guideboardgroup>  
123 - </div>  
124 - <div class="alert alert-danger well-sm" ng-show="myForm.lprange.$error.required">  
125 - 路牌范围,起始路牌必须选择  
126 - </div>  
127 - </div>  
128 -  
129 - <div class="form-group has-success has-feedback">  
130 - <label class="col-md-2 control-label">人员范围*:</label>  
131 - <div class="col-md-6">  
132 - <sa-Employeegroup model="ctrl.scheduleRuleManageForSave"  
133 - name="ryrange"  
134 - xlidvalue="{{ctrl.scheduleRuleManageForSave.xl.id}}"  
135 - dbbmrangevalue="{{ctrl.scheduleRuleManageForSave.ryDbbms}}"  
136 - dbbmrangename="ryDbbms"  
137 - rycidrangevalue="{{ctrl.scheduleRuleManageForSave.ryConfigIds}}"  
138 - rycidrangename="ryConfigIds"  
139 - rystartvalue="{{ctrl.scheduleRuleManageForSave.ryStart}}"  
140 - rystartname="ryStart"  
141 - required  
142 - >  
143 - </sa-Employeegroup>  
144 - </div>  
145 - <div class="alert alert-danger well-sm" ng-show="myForm.ryrange.$error.required">  
146 - 人员范围,起始人员必须选择  
147 - </div>  
148 - </div>  
149 -  
150 - <!--<div class="form-group">-->  
151 - <!--<label class="col-md-2 control-label">翻班格式:</label>-->  
152 - <!--<div class="col-md-4">-->  
153 - <!--<input type="text" class="form-control" name="fbgs" ng-model="ctrl.scheduleRuleManageForSave.fbgs"-->  
154 - <!--placeholder="车辆翻班格式"/>-->  
155 - <!--</div>-->  
156 - <!--</div>-->  
157 -  
158 -  
159 - <!-- 其他form-group -->  
160 -  
161 - </div>  
162 -  
163 - <!-- TODO:!myForm.$valid 在这里有点问题,改用以下方法验证 -->  
164 - <div class="form-actions">  
165 - <div class="row">  
166 - <div class="col-md-offset-3 col-md-4">  
167 - <button type="submit" class="btn green"  
168 - ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>  
169 - <a type="button" class="btn default" ui-sref="scheduleRuleManage" ><i class="fa fa-times"></i> 取消</a>  
170 - </div>  
171 - </div>  
172 - </div>  
173 -  
174 - </form>  
175 -  
176 - </div>  
177 - 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 + <a ui-sref="scheduleRuleManage">排班规则管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">修改排班规则信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="ScheduleRuleManageFormCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  30 + </div>
  31 + </div>
  32 +
  33 + <div class="portlet-body form">
  34 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  35 + <!--<div class="alert alert-danger display-hide">-->
  36 + <!--<button class="close" data-close="alert"></button>-->
  37 + <!--您的输入有误,请检查下面的输入项-->
  38 + <!--</div>-->
  39 +
  40 +
  41 + <!-- 其他信息放置在这里 -->
  42 + <div class="form-body">
  43 + <div class="form-group has-success has-feedback">
  44 + <label class="col-md-2 control-label">线路*:</label>
  45 + <div class="col-md-3">
  46 + <sa-Select3 model="ctrl.scheduleRuleManageForSave"
  47 + name="xl"
  48 + placeholder="请输拼音..."
  49 + dcvalue="{{ctrl.scheduleRuleManageForSave.xl.id}}"
  50 + dcname="xl.id"
  51 + icname="id"
  52 + icnames="name"
  53 + datatype="xl"
  54 + mlp="true"
  55 + required >
  56 + </sa-Select3>
  57 + </div>
  58 + <!-- 隐藏块,显示验证信息 -->
  59 + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
  60 + 线路必须选择
  61 + </div>
  62 + </div>
  63 + <div class="form-group has-success has-feedback">
  64 + <label class="col-md-2 control-label">车辆配置*:</label>
  65 + <div class="col-md-3">
  66 + <sa-Select3 model="ctrl.scheduleRuleManageForSave"
  67 + name="cl"
  68 + placeholder="请输拼音..."
  69 + dcvalue="{{ctrl.scheduleRuleManageForSave.carConfigInfo.id}}"
  70 + dcname="carConfigInfo.id"
  71 + icname="id"
  72 + icnames="cl.insideCode"
  73 + datatype="cci2"
  74 + dataassociate="true"
  75 + dataparam="{{ {'xl.id_eq': ctrl.scheduleRuleManageForSave.xl.id, 'isCancel_eq': false} | json }}"
  76 + mlp="true"
  77 + required >
  78 + </sa-Select3>
  79 + </div>
  80 + <!-- 隐藏块,显示验证信息 -->
  81 + <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
  82 + 车辆必须选择
  83 + </div>
  84 + </div>
  85 +
  86 + <div class="form-group has-success has-feedback">
  87 + <label class="col-md-2 control-label">启用日期*:</label>
  88 + <div class="col-md-3">
  89 + <div class="input-group">
  90 + <input type="text" class="form-control"
  91 + name="qyrq" placeholder="请选择启用日期..."
  92 + uib-datepicker-popup="yyyy年MM月dd日"
  93 + is-open="ctrl.qyrqOpen" required
  94 + ng-model="ctrl.scheduleRuleManageForSave.qyrq" readonly/>
  95 + <span class="input-group-btn">
  96 + <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
  97 + <i class="glyphicon glyphicon-calendar"></i>
  98 + </button>
  99 + </span>
  100 + </div>
  101 + </div>
  102 + <!-- 隐藏块,显示验证信息 -->
  103 + <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required">
  104 + 启用日期必须选择
  105 + </div>
  106 + </div>
  107 +
  108 + <div class="form-group has-success has-feedback">
  109 + <label class="col-md-2 control-label">路牌范围*:</label>
  110 + <div class="col-md-6">
  111 + <sa-Guideboardgroup model="ctrl.scheduleRuleManageForSave"
  112 + name="lprange"
  113 + xlidvalue="{{ctrl.scheduleRuleManageForSave.xl.id}}"
  114 + lprangevalue="{{ctrl.scheduleRuleManageForSave.lpNames}}"
  115 + lprangename="lpNames"
  116 + lpidrangevalue="{{ctrl.scheduleRuleManageForSave.lpIds}}"
  117 + lpidrangename="lpIds"
  118 + lpstartvalue="{{ctrl.scheduleRuleManageForSave.lpStart}}"
  119 + lpstartname="lpStart"
  120 + required
  121 + >
  122 + </sa-Guideboardgroup>
  123 + </div>
  124 + <div class="alert alert-danger well-sm" ng-show="myForm.lprange.$error.required">
  125 + 路牌范围,起始路牌必须选择
  126 + </div>
  127 + </div>
  128 +
  129 + <div class="form-group has-success has-feedback">
  130 + <label class="col-md-2 control-label">人员范围*:</label>
  131 + <div class="col-md-6">
  132 + <sa-Employeegroup model="ctrl.scheduleRuleManageForSave"
  133 + name="ryrange"
  134 + xlidvalue="{{ctrl.scheduleRuleManageForSave.xl.id}}"
  135 + dbbmrangevalue="{{ctrl.scheduleRuleManageForSave.ryDbbms}}"
  136 + dbbmrangename="ryDbbms"
  137 + rycidrangevalue="{{ctrl.scheduleRuleManageForSave.ryConfigIds}}"
  138 + rycidrangename="ryConfigIds"
  139 + rystartvalue="{{ctrl.scheduleRuleManageForSave.ryStart}}"
  140 + rystartname="ryStart"
  141 + required
  142 + >
  143 + </sa-Employeegroup>
  144 + </div>
  145 + <div class="alert alert-danger well-sm" ng-show="myForm.ryrange.$error.required">
  146 + 人员范围,起始人员必须选择
  147 + </div>
  148 + </div>
  149 +
  150 + <!--<div class="form-group">-->
  151 + <!--<label class="col-md-2 control-label">翻班格式:</label>-->
  152 + <!--<div class="col-md-4">-->
  153 + <!--<input type="text" class="form-control" name="fbgs" ng-model="ctrl.scheduleRuleManageForSave.fbgs"-->
  154 + <!--placeholder="车辆翻班格式"/>-->
  155 + <!--</div>-->
  156 + <!--</div>-->
  157 +
  158 +
  159 + <!-- 其他form-group -->
  160 +
  161 + </div>
  162 +
  163 + <!-- TODO:!myForm.$valid 在这里有点问题,改用以下方法验证 -->
  164 + <div class="form-actions">
  165 + <div class="row">
  166 + <div class="col-md-offset-3 col-md-4">
  167 + <button type="submit" class="btn green"
  168 + ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  169 + <a type="button" class="btn default" ui-sref="scheduleRuleManage" ><i class="fa fa-times"></i> 取消</a>
  170 + </div>
  171 + </div>
  172 + </div>
  173 +
  174 + </form>
  175 +
  176 + </div>
  177 +
  178 +
178 </div> 179 </div>
179 \ No newline at end of file 180 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/form.html
@@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
72 icnames="cl.insideCode" 72 icnames="cl.insideCode"
73 datatype="cci2" 73 datatype="cci2"
74 dataassociate="true" 74 dataassociate="true"
75 - dataparam="{{ {'xl.id_eq': ctrl.scheduleRuleManageForSave.xl.id} | json }}" 75 + dataparam="{{ {'xl.id_eq': ctrl.scheduleRuleManageForSave.xl.id, 'isCancel_eq': false} | json }}"
76 mlp="true" 76 mlp="true"
77 required > 77 required >
78 </sa-Select3> 78 </sa-Select3>