Commit 44810397e25ed206429e46e7564ecebda03e7cad
Merge branch 'minhang' into qingpu
# Conflicts: # README.md # src/main/java/com/bsth/data/gpsdata/GpsRealData.java # src/main/resources/ms-jdbc.properties
Showing
68 changed files
with
5616 additions
and
4839 deletions
README.md
| 1 | -<<<<<<< HEAD | ||
| 2 | -公交调度系统BS版 0.1 | ||
| 3 | -====== | ||
| 4 | ----------- | ||
| 5 | -## 目录 | ||
| 6 | ---------- | ||
| 7 | - * [字典表](#字典表) | ||
| 8 | - * [动态jpa查询实现](#动态jpa查询实现) | ||
| 9 | - * [车载 gps 相关数据](#gps) | ||
| 10 | - * [实时gps数据接口 http](#实时gps接口) | ||
| 11 | - * [进出站数据表结构](#进站数据) | ||
| 12 | - * [异常警报表结构](#异常警报) | ||
| 13 | - * [大间隔](#大间隔) | ||
| 14 | - * [超速](#超速) | ||
| 15 | - * [越界](#越界) | ||
| 16 | - * [越站](#越站) | ||
| 17 | - * [聚集](#聚集) | ||
| 18 | - * [掉线](#掉线) | ||
| 19 | - * [调度消息下发接口HTTP](#调度消息下发接口) | ||
| 20 | - * [调度消息上传接口HTTP](#调度消息上传接口) | ||
| 21 | - | ||
| 22 | ----------- | ||
| 23 | - | ||
| 24 | -## 字典表 | ||
| 25 | ----------- | ||
| 26 | -字典操作全部由前端负责,主要有2种。 | ||
| 27 | - | ||
| 28 | -1、转换字典代码。 | ||
| 29 | - 当pjax的`pjax:success`事件被触发(片段加载完成) | ||
| 30 | - 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换 | ||
| 31 | -``` html | ||
| 32 | ---dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码 | ||
| 33 | -<span class="nt-dictionary" data-group="ScheduleType">out</span> | ||
| 34 | ---to | ||
| 35 | -<span>出场</span> | ||
| 36 | - | ||
| 37 | -<!- dom标签为input时,如下 data-code为要转换的代码 --> | ||
| 38 | -<input class="nt-dictionary" data-group="ScheduleType" data-code="out"> | ||
| 39 | ---to | ||
| 40 | -<input value="出场"> | ||
| 41 | - | ||
| 42 | -<!- dom标签为select时 如下 data-code为要选中的项 --> | ||
| 43 | -<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select> | ||
| 44 | ---to | ||
| 45 | -<select> | ||
| 46 | - <option value="normal">正常班次</option> | ||
| 47 | - <option value="out" selected>出场</option> | ||
| 48 | - <option value="in">进场</option> | ||
| 49 | - <option value="oil">加油</option> | ||
| 50 | - <option value="temp">临加</option> | ||
| 51 | - <option value="region">区间</option> | ||
| 52 | - <option value="venting">放空</option> | ||
| 53 | - <option value="major">放大站</option> | ||
| 54 | -</select> | ||
| 55 | -``` | ||
| 56 | -*原标签的class 除nt-dictionary 外,其余均会被保留* | ||
| 57 | - | ||
| 58 | -2、dictionary.js提供如下方法自行使用 | ||
| 59 | -| 方法名 | 参数|返回| | ||
| 60 | -| ---- | ---- | ---- | ---- | | ||
| 61 | -| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} | | ||
| 62 | -| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}| | ||
| 63 | -| transformCode (转换字典代码)| (group, code) | 上行 | | ||
| 64 | - | ||
| 65 | -## 动态jpa查询实现 | ||
| 66 | ----------- | ||
| 67 | -*参考调度系统枚举com.bsth.entity.search.SearchOperator* | ||
| 68 | - | ||
| 69 | - | ||
| 70 | -## gps | ||
| 71 | ----------- | ||
| 72 | -### 实时gps接口 | ||
| 73 | - | ||
| 74 | -所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/) | ||
| 75 | -根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901) | ||
| 76 | - | ||
| 77 | -<span style="color: red">Response</span>: | ||
| 78 | -```json | ||
| 79 | -{ | ||
| 80 | - "data":[ | ||
| 81 | - { | ||
| 82 | - "companyCode":5, | ||
| 83 | - "lineId":10329, | ||
| 84 | - "deviceId":"05B01901", | ||
| 85 | - "carparkNo":"00000000", | ||
| 86 | - "stopNo":"7C890002", | ||
| 87 | - "lon":121.549866, | ||
| 88 | - "lat":31.238798, | ||
| 89 | - "timestamp":1397104499000, | ||
| 90 | - "speed":42.0, | ||
| 91 | - "direction":245.9, | ||
| 92 | - "state":0, | ||
| 93 | - "upDown":0 | ||
| 94 | - }] | ||
| 95 | -} | ||
| 96 | -``` | ||
| 97 | - | ||
| 98 | -| -- | --|--| | ||
| 99 | -| ---- | ---- | ---- | | ||
| 100 | -| companyCode | int | 公司代码 | | ||
| 101 | -| lineId | int | 线路编码 | | ||
| 102 | -| deviceId | String | 设备编号 | | ||
| 103 | -| carparkNo | String | 停车场编码 | | ||
| 104 | -| stopNo | String | 站点编码 | | ||
| 105 | -| lon | float | 经度 | | ||
| 106 | -| lat | float | 纬度 | | ||
| 107 | -| timestamp | long | 时间戳 | | ||
| 108 | -| speed | float | 速度| | ||
| 109 | -| direction | float | 方向(角度) | | ||
| 110 | -| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) | | ||
| 111 | -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)| | ||
| 112 | - | ||
| 113 | - | ||
| 114 | -### 进站数据 | ||
| 115 | ----------- | ||
| 116 | -表名: | ||
| 117 | - | ||
| 118 | -| .. | .. | .. | | ||
| 119 | -| ---- | ---- | ---- | | ||
| 120 | -| id | int | 主键 | | ||
| 121 | -| deviceId | String | 设备号 | | ||
| 122 | -| lineId | int | 线路编码 | | ||
| 123 | -| stopNo | long | 站点编码 | | ||
| 124 | -| timestamp | long | 时间戳 | | ||
| 125 | -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 126 | -| createDate | Date | 创建时间 | | ||
| 127 | - | ||
| 128 | - | ||
| 129 | -### 异常警报 | ||
| 130 | ----------- | ||
| 131 | - | ||
| 132 | -### 大间隔 | ||
| 133 | ----------- | ||
| 134 | -表名: | ||
| 135 | - | ||
| 136 | -| .. | .. | .. | | ||
| 137 | -| ---- | ---- | ---- | | ||
| 138 | -| id | int | 主键 | | ||
| 139 | -| line | int | 线路编码 | | ||
| 140 | -| station | String | 站点编码 | | ||
| 141 | -| cVehicle | String | 当前车辆编码 | | ||
| 142 | -| lastVehicle | String | 上一个车辆编码 | | ||
| 143 | -| interval | long | 间隔时间(秒) | | ||
| 144 | -| timestamp | long | 时间戳 | | ||
| 145 | -| createDate | Date | 创建时间 | | ||
| 146 | - | ||
| 147 | -### 超速 | ||
| 148 | ----------- | ||
| 149 | -表名: | ||
| 150 | - | ||
| 151 | -| .. | .. | .. | | ||
| 152 | -| ---- | ---- | ---- | | ||
| 153 | -| id | int | 主键 | | ||
| 154 | -| vehicle | String | 车辆编码 | | ||
| 155 | -| line | int | 线路编码 | | ||
| 156 | -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 157 | -| lon | float | 经度 | | ||
| 158 | -| lat | float | 纬度| | ||
| 159 | -| speed | float | 速度 | | ||
| 160 | -| timestamp | long | 时间戳 | | ||
| 161 | -| createDate | Date | 时间 | | ||
| 162 | - | ||
| 163 | -### 越界 | ||
| 164 | ----------- | ||
| 165 | -表名: | ||
| 166 | - | ||
| 167 | -| .. | .. | .. | | ||
| 168 | -| ---- | ---- | ---- | | ||
| 169 | -| id | int | 主键 | | ||
| 170 | -| vehicle | String | 车辆编码 | | ||
| 171 | -| line | int | 线路编码 | | ||
| 172 | -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 173 | -| lon | float | 经度 | | ||
| 174 | -| lat | float | 纬度| | ||
| 175 | -| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值| | ||
| 176 | -| timestamp | long | 时间戳 | | ||
| 177 | -| createDate | Date | 时间 | | ||
| 178 | - | ||
| 179 | - | ||
| 180 | -### 越站 | ||
| 181 | ----------- | ||
| 182 | -表名: | ||
| 183 | - | ||
| 184 | -| .. | .. | .. | | ||
| 185 | -| ---- | ---- | ---- | | ||
| 186 | -| id | int | 主键 | | ||
| 187 | -| line | int | 线路编码 | | ||
| 188 | -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 189 | -| station | String | 站点编码 | | ||
| 190 | -| vehicle | String | 车辆编码 | | ||
| 191 | -| inData | Date | 进站时间 | | ||
| 192 | -| outDate | Date | 出站时间 | | ||
| 193 | - | ||
| 194 | - | ||
| 195 | -### 聚集 | ||
| 196 | ----------- | ||
| 197 | -表名: | ||
| 198 | - | ||
| 199 | -| .. | .. | .. | | ||
| 200 | -| ---- | ---- | ---- | | ||
| 201 | -| id | int | 主键 | | ||
| 202 | -| line | int | 线路编码 | | ||
| 203 | -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 204 | -| stations | String | 站点(多个用 , 号分隔。应该是连续站点) | | ||
| 205 | -| vehicles | String | 车辆编码(多个用 , 号分隔) | | ||
| 206 | -| timestamp | long | 时间戳 | | ||
| 207 | -| createDate | Date | 时间 | | ||
| 208 | - | ||
| 209 | - | ||
| 210 | -### 掉线 | ||
| 211 | ----------- | ||
| 212 | -表名: | ||
| 213 | - | ||
| 214 | -| .. | .. | .. | | ||
| 215 | -| ---- | ---- | ---- | | ||
| 216 | -| id | int | 主键 | | ||
| 217 | -| line | int | 线路编码 | | ||
| 218 | -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 219 | -| vehicle | String | 车辆编码 | | ||
| 220 | -| lon | float | 经度 | | ||
| 221 | -| lat | float | 纬度| | ||
| 222 | -| timestamp | long | 时间戳 | | ||
| 223 | -| createDate | Date | 时间 | | ||
| 224 | - | ||
| 225 | - | ||
| 226 | -### 调度消息下发接口 | ||
| 227 | ----------- | ||
| 228 | -[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/) | ||
| 229 | - | ||
| 230 | -<span style="color: red">Request</span>: | ||
| 231 | -```json | ||
| 232 | -{ | ||
| 233 | - "deviceId":12345, | ||
| 234 | - "timestamp":44324, | ||
| 235 | - "operCode":0x60, | ||
| 236 | - "data":{ | ||
| 237 | - "companyCode":22, | ||
| 238 | - "deviceId":"029L2222", | ||
| 239 | - "timestamp":134326, | ||
| 240 | - "instructType":00, | ||
| 241 | - "dispatchInstruct":0x00, | ||
| 242 | - "msgId":12345, | ||
| 243 | - "alarmTime":201606012000, | ||
| 244 | - "serviceState":00000000, | ||
| 245 | - "txtContent":"你好" | ||
| 246 | - } | ||
| 247 | -} | ||
| 248 | -``` | ||
| 249 | -| .. | .. | .. | | ||
| 250 | -| ---- | ---- | ---- | | ||
| 251 | -| deviceId | string | 设备编号 | | ||
| 252 | -| timestamp | long | 时间戳(ms) | | ||
| 253 | -| operCode | short | 一级协议 | | ||
| 254 | -| data.companyCode | short | 公司代码 | | ||
| 255 | -| data.deviceId | string | 设备编号 | | ||
| 256 | -| data.timestamp | long | 时间戳 | | ||
| 257 | -| data.instructType | short | 保留 默认0 | | ||
| 258 | -| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。| | ||
| 259 | -| data.msgId | long | 同上 | | ||
| 260 | -| data.alarmTime | long | 闹钟 MMddhhmm| | ||
| 261 | -| data.serviceState | long | 多状态字节 先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。| | ||
| 262 | -| data.txtContent | string | 下发的消息文本 | | ||
| 263 | -```json | ||
| 264 | -{ | ||
| 265 | - "deviceId":12345, | ||
| 266 | - "timestamp":44324, | ||
| 267 | - "operCode":0x64, | ||
| 268 | - "data":{ | ||
| 269 | - "cityCode":22, | ||
| 270 | - "deviceId":"029L2222", | ||
| 271 | - "lineId":"134326" | ||
| 272 | - } | ||
| 273 | -} | ||
| 274 | -``` | ||
| 275 | -| .. | .. | .. | | ||
| 276 | -| ---- | ---- | ---- | | ||
| 277 | -| deviceId | string | 设备编号 | | ||
| 278 | -| timestamp | long | 时间戳(ms) | | ||
| 279 | -| operCode | short | 一级协议 | | ||
| 280 | -| data.cityCode | short | 城市区号 | | ||
| 281 | -| data.deviceId | string | 设备编号 | | ||
| 282 | -| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 | | ||
| 283 | - | ||
| 284 | -```json | ||
| 285 | -{ | ||
| 286 | - "deviceId":12345, | ||
| 287 | - "timestamp":44324, | ||
| 288 | - "operCode":0xC0, | ||
| 289 | - "data":{ | ||
| 290 | - "operCode":0x86, | ||
| 291 | - "requestAck":0x06 | ||
| 292 | - } | ||
| 293 | -} | ||
| 294 | -``` | ||
| 295 | -| .. | .. | .. | | ||
| 296 | -| ---- | ---- | ---- | | ||
| 297 | -| deviceId | string | 设备编号 | | ||
| 298 | -| timestamp | long | 时间戳(ms) | | ||
| 299 | -| operCode | short | 一级协议 | | ||
| 300 | -| data.operCode | short | 二级协议 | | ||
| 301 | -| data.requestAck | short | 请求应答字 0x06同意 0x15不同意| | ||
| 302 | - | ||
| 303 | -<span style="color: red">Response</span>: | ||
| 304 | -```json | ||
| 305 | -{ | ||
| 306 | - "errCode":0 | ||
| 307 | -} | ||
| 308 | -``` | ||
| 309 | - | ||
| 310 | - | ||
| 311 | -### 调度消息上传接口 | ||
| 312 | ----------- | ||
| 313 | -上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream) | ||
| 314 | -<span style="color: red">Request</span>: | ||
| 315 | -```json | ||
| 316 | -{ | ||
| 317 | - "deviceId":12345, | ||
| 318 | - "timestamp":44324, | ||
| 319 | - "status":0, | ||
| 320 | - "operCode":0x80, | ||
| 321 | - "data":{ | ||
| 322 | - "operCode":0x26, | ||
| 323 | - "requestCode":22 | ||
| 324 | - } | ||
| 325 | -} | ||
| 326 | -``` | ||
| 327 | -| .. | .. | .. | | ||
| 328 | -| ---- | ---- | ---- | | ||
| 329 | -| deviceId | string | 设备编号 | | ||
| 330 | -| timestamp | long | 时间戳(ms) | | ||
| 331 | -| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 | | ||
| 332 | -| operCode | short | 一级协议 消息确认将无数据 | | ||
| 333 | -| data.operCode | short | 二级协议 | | ||
| 334 | -| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 | | ||
| 335 | -<span style="color: red">Response</span>: | ||
| 336 | -```json | ||
| 337 | -{ | ||
| 338 | - "errCode":0 | ||
| 339 | -} | ||
| 340 | -``` | ||
| 341 | -======= | ||
| 342 | -公交调度系统BS版 0.1 | 1 | +公交调度系统BS版 0.1 |
| 343 | ====== | 2 | ====== |
| 344 | ---------- | 3 | ---------- |
| 345 | ## 目录 | 4 | ## 目录 |
| @@ -704,5 +363,4 @@ | @@ -704,5 +363,4 @@ | ||
| 704 | | direction | float | 角度0-359 | | 363 | | direction | float | 角度0-359 | |
| 705 | | inTemp | int | 车内温度 | | 364 | | inTemp | int | 车内温度 | |
| 706 | | serviceState | long | 设备状态字 | | 365 | | serviceState | long | 设备状态字 | |
| 707 | -| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 | | ||
| 708 | ->>>>>>> PSM-9 | 366 | +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 | |
| 709 | \ No newline at end of file | 367 | \ No newline at end of file |
pom.xml
| @@ -185,6 +185,18 @@ | @@ -185,6 +185,18 @@ | ||
| 185 | <artifactId>kaptcha</artifactId> | 185 | <artifactId>kaptcha</artifactId> |
| 186 | <version>0.0.9</version> | 186 | <version>0.0.9</version> |
| 187 | </dependency> | 187 | </dependency> |
| 188 | + | ||
| 189 | + <dependency> | ||
| 190 | + <groupId>commons-codec</groupId> | ||
| 191 | + <artifactId>commons-codec</artifactId> | ||
| 192 | + <version>1.4</version> | ||
| 193 | + <scope>compile</scope> | ||
| 194 | + </dependency> | ||
| 195 | + <dependency> | ||
| 196 | + <groupId>org.bouncycastle</groupId> | ||
| 197 | + <artifactId>bcprov-jdk15on</artifactId> | ||
| 198 | + <version>1.52</version> | ||
| 199 | + </dependency> | ||
| 188 | </dependencies> | 200 | </dependencies> |
| 189 | 201 | ||
| 190 | <dependencyManagement> | 202 | <dependencyManagement> |
src/main/java/com/bsth/Application.java
| @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary; | @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary; | ||
| 16 | @SpringBootApplication | 16 | @SpringBootApplication |
| 17 | public class Application extends SpringBootServletInitializer { | 17 | public class Application extends SpringBootServletInitializer { |
| 18 | 18 | ||
| 19 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(8); | 19 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(11); |
| 20 | 20 | ||
| 21 | @Override | 21 | @Override |
| 22 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | 22 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
src/main/java/com/bsth/controller/directive/DirectiveController.java
| @@ -62,8 +62,8 @@ public class DirectiveController { | @@ -62,8 +62,8 @@ public class DirectiveController { | ||
| 62 | * @param @param lineId 新线路编码 | 62 | * @param @param lineId 新线路编码 |
| 63 | * @throws | 63 | * @throws |
| 64 | */ | 64 | */ |
| 65 | - @RequestMapping(value = "/lineChnage", method = RequestMethod.GET) | ||
| 66 | - public int lineChange(@RequestParam String nbbm, @RequestParam Integer lineId){ | 65 | + @RequestMapping(value = "/lineChnage", method = RequestMethod.POST) |
| 66 | + public int lineChange(@RequestParam String nbbm, @RequestParam String lineId){ | ||
| 67 | SysUser user = SecurityUtils.getCurrentUser(); | 67 | SysUser user = SecurityUtils.getCurrentUser(); |
| 68 | return directiveService.lineChange(nbbm, lineId, user.getUserName()); | 68 | return directiveService.lineChange(nbbm, lineId, user.getUserName()); |
| 69 | } | 69 | } |
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
| @@ -3,7 +3,6 @@ package com.bsth.controller.directive; | @@ -3,7 +3,6 @@ package com.bsth.controller.directive; | ||
| 3 | import org.slf4j.Logger; | 3 | import org.slf4j.Logger; |
| 4 | import org.slf4j.LoggerFactory; | 4 | import org.slf4j.LoggerFactory; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | -import org.springframework.context.annotation.Scope; | ||
| 7 | import org.springframework.web.bind.annotation.RequestMapping; | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
| 8 | import org.springframework.web.bind.annotation.RequestMethod; | 7 | import org.springframework.web.bind.annotation.RequestMethod; |
| 9 | import org.springframework.web.bind.annotation.RequestParam; | 8 | import org.springframework.web.bind.annotation.RequestParam; |
| @@ -26,7 +25,6 @@ import com.bsth.entity.directive.DirectiveReponse; | @@ -26,7 +25,6 @@ import com.bsth.entity.directive.DirectiveReponse; | ||
| 26 | */ | 25 | */ |
| 27 | @RestController | 26 | @RestController |
| 28 | @RequestMapping("/control") | 27 | @RequestMapping("/control") |
| 29 | -@Scope("prototype") | ||
| 30 | public class UpstreamEntrance { | 28 | public class UpstreamEntrance { |
| 31 | 29 | ||
| 32 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 30 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
src/main/java/com/bsth/controller/forecast/SampleController.java
| @@ -2,7 +2,11 @@ package com.bsth.controller.forecast; | @@ -2,7 +2,11 @@ package com.bsth.controller.forecast; | ||
| 2 | 2 | ||
| 3 | import java.io.UnsupportedEncodingException; | 3 | import java.io.UnsupportedEncodingException; |
| 4 | import java.net.URLDecoder; | 4 | import java.net.URLDecoder; |
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.Map; | ||
| 5 | 7 | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.web.bind.annotation.RequestMapping; | 11 | import org.springframework.web.bind.annotation.RequestMapping; |
| 8 | import org.springframework.web.bind.annotation.RequestParam; | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| @@ -10,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; | @@ -10,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 10 | 14 | ||
| 11 | import com.alibaba.fastjson.JSON; | 15 | import com.alibaba.fastjson.JSON; |
| 12 | import com.alibaba.fastjson.JSONObject; | 16 | import com.alibaba.fastjson.JSONObject; |
| 17 | +import com.bsth.common.ResponseCode; | ||
| 13 | import com.bsth.controller.BaseController; | 18 | import com.bsth.controller.BaseController; |
| 14 | import com.bsth.controller.forecast.dto.CreateSampleParam; | 19 | import com.bsth.controller.forecast.dto.CreateSampleParam; |
| 15 | import com.bsth.entity.forecast.Sample; | 20 | import com.bsth.entity.forecast.Sample; |
| @@ -22,16 +27,20 @@ public class SampleController extends BaseController<Sample, Long>{ | @@ -22,16 +27,20 @@ public class SampleController extends BaseController<Sample, Long>{ | ||
| 22 | @Autowired | 27 | @Autowired |
| 23 | SampleService sampleService; | 28 | SampleService sampleService; |
| 24 | 29 | ||
| 30 | + Logger loger = LoggerFactory.getLogger(this.getClass()); | ||
| 31 | + | ||
| 25 | @RequestMapping("/create/gps") | 32 | @RequestMapping("/create/gps") |
| 26 | - public int createDataByGps(@RequestParam String data){ | ||
| 27 | - | 33 | + public Map<String, Object> createDataByGps(@RequestParam String data){ |
| 34 | + Map<String, Object> rs = new HashMap<>(); | ||
| 28 | try { | 35 | try { |
| 29 | data = URLDecoder.decode(data, "utf-8"); | 36 | data = URLDecoder.decode(data, "utf-8"); |
| 30 | CreateSampleParam param = JSONObject.toJavaObject(JSON.parseObject(data), CreateSampleParam.class); | 37 | CreateSampleParam param = JSONObject.toJavaObject(JSON.parseObject(data), CreateSampleParam.class); |
| 31 | - System.out.println(param); | 38 | + |
| 39 | + rs = sampleService.createDataByGps(param); | ||
| 32 | } catch (UnsupportedEncodingException e) { | 40 | } catch (UnsupportedEncodingException e) { |
| 33 | - e.printStackTrace(); | 41 | + loger.info("", e); |
| 42 | + rs.put("status", ResponseCode.ERROR); | ||
| 34 | } | 43 | } |
| 35 | - return 0; | 44 | + return rs; |
| 36 | } | 45 | } |
| 37 | } | 46 | } |
src/main/java/com/bsth/controller/gps/GpsController.java
| @@ -26,12 +26,12 @@ public class GpsController { | @@ -26,12 +26,12 @@ public class GpsController { | ||
| 26 | GpsService gpsService; | 26 | GpsService gpsService; |
| 27 | 27 | ||
| 28 | @RequestMapping(value = "/real/line/{lineCode}") | 28 | @RequestMapping(value = "/real/line/{lineCode}") |
| 29 | - public List<GpsEntity> findByLineCode(@PathVariable("lineCode") Integer lineCode) { | ||
| 30 | - return gpsRealData.get(lineCode); | 29 | + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { |
| 30 | + return gpsRealData.getByLine(lineCode); | ||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | @RequestMapping(value = "/real/line") | 33 | @RequestMapping(value = "/real/line") |
| 34 | - public List<GpsEntity> findByLineCode(@RequestParam String lineCodes) { | 34 | + public List<GpsEntity> findByLineCodes(@RequestParam String lineCodes) { |
| 35 | return gpsRealData.get(Splitter.on(",").splitToList(lineCodes)); | 35 | return gpsRealData.get(Splitter.on(",").splitToList(lineCodes)); |
| 36 | } | 36 | } |
| 37 | 37 |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | +import java.io.UnsupportedEncodingException; | ||
| 4 | +import java.net.URLDecoder; | ||
| 3 | import java.util.Collection; | 5 | import java.util.Collection; |
| 4 | import java.util.List; | 6 | import java.util.List; |
| 5 | import java.util.Map; | 7 | import java.util.Map; |
| 6 | 8 | ||
| 9 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.web.bind.annotation.PathVariable; | 11 | import org.springframework.web.bind.annotation.PathVariable; |
| 9 | import org.springframework.web.bind.annotation.RequestMapping; | 12 | import org.springframework.web.bind.annotation.RequestMapping; |
| @@ -223,6 +226,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -223,6 +226,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 223 | */ | 226 | */ |
| 224 | @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST) | 227 | @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST) |
| 225 | public Map<String, Object> outgoAdjustAll(@RequestParam String params){ | 228 | public Map<String, Object> outgoAdjustAll(@RequestParam String params){ |
| 229 | + //反转义 | ||
| 230 | + params = StringEscapeUtils.unescapeHtml4(params); | ||
| 226 | return scheduleRealInfoService.outgoAdjustAll(params); | 231 | return scheduleRealInfoService.outgoAdjustAll(params); |
| 227 | } | 232 | } |
| 228 | 233 | ||
| @@ -257,7 +262,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -257,7 +262,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 257 | * @throws | 262 | * @throws |
| 258 | */ | 263 | */ |
| 259 | @RequestMapping(value = "/findRouteByLine") | 264 | @RequestMapping(value = "/findRouteByLine") |
| 260 | - public Map<String, Object> findRouteByLine(@RequestParam Integer lineCode){ | 265 | + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){ |
| 261 | return scheduleRealInfoService.findRouteByLine(lineCode); | 266 | return scheduleRealInfoService.findRouteByLine(lineCode); |
| 262 | } | 267 | } |
| 263 | 268 |
src/main/java/com/bsth/controller/sys/UserController.java
| @@ -7,7 +7,6 @@ import javax.servlet.http.HttpServletRequest; | @@ -7,7 +7,6 @@ import javax.servlet.http.HttpServletRequest; | ||
| 7 | import javax.servlet.http.HttpSession; | 7 | import javax.servlet.http.HttpSession; |
| 8 | 8 | ||
| 9 | import org.apache.commons.lang3.StringUtils; | 9 | import org.apache.commons.lang3.StringUtils; |
| 10 | -import org.apache.commons.net.util.Base64; | ||
| 11 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| 12 | import org.slf4j.LoggerFactory; | 11 | import org.slf4j.LoggerFactory; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController; | @@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 22 | import com.bsth.common.Constants; | 21 | import com.bsth.common.Constants; |
| 23 | import com.bsth.common.ResponseCode; | 22 | import com.bsth.common.ResponseCode; |
| 24 | import com.bsth.controller.BaseController; | 23 | import com.bsth.controller.BaseController; |
| 24 | +import com.bsth.controller.sys.util.RSAUtils; | ||
| 25 | import com.bsth.entity.sys.SysUser; | 25 | import com.bsth.entity.sys.SysUser; |
| 26 | import com.bsth.security.util.SecurityUtils; | 26 | import com.bsth.security.util.SecurityUtils; |
| 27 | import com.bsth.service.sys.SysUserService; | 27 | import com.bsth.service.sys.SysUserService; |
| @@ -35,12 +35,21 @@ public class UserController extends BaseController<SysUser, Integer> { | @@ -35,12 +35,21 @@ public class UserController extends BaseController<SysUser, Integer> { | ||
| 35 | @Autowired | 35 | @Autowired |
| 36 | SysUserService sysUserService; | 36 | SysUserService sysUserService; |
| 37 | 37 | ||
| 38 | + @RequestMapping(value = "/login/jCryptionKey") | ||
| 39 | + public Map<String, Object> jCryptionKey(HttpServletRequest request){ | ||
| 40 | + //公匙返回页面 | ||
| 41 | + Map<String, Object> rs = new HashMap<>(); | ||
| 42 | + rs.put("publickey", RSAUtils.generateBase64PublicKey()); | ||
| 43 | + return rs; | ||
| 44 | + } | ||
| 45 | + | ||
| 38 | //需要验证码的账号 | 46 | //需要验证码的账号 |
| 39 | public static Map<String, Integer> captchaMap = new HashMap<>(); | 47 | public static Map<String, Integer> captchaMap = new HashMap<>(); |
| 40 | 48 | ||
| 41 | @RequestMapping(value = "/login", method = RequestMethod.POST) | 49 | @RequestMapping(value = "/login", method = RequestMethod.POST) |
| 42 | public Map<String, Object> login(HttpServletRequest request, @RequestParam String userName, | 50 | public Map<String, Object> login(HttpServletRequest request, @RequestParam String userName, |
| 43 | - @RequestParam String password) { | 51 | + @RequestParam String password, String captcha) { |
| 52 | + | ||
| 44 | Map<String, Object> rs = new HashMap<>(); | 53 | Map<String, Object> rs = new HashMap<>(); |
| 45 | rs.put("status", ResponseCode.ERROR); | 54 | rs.put("status", ResponseCode.ERROR); |
| 46 | try { | 55 | try { |
| @@ -51,32 +60,26 @@ public class UserController extends BaseController<SysUser, Integer> { | @@ -51,32 +60,26 @@ public class UserController extends BaseController<SysUser, Integer> { | ||
| 51 | //校验验证码 | 60 | //校验验证码 |
| 52 | String verCode = (String) session | 61 | String verCode = (String) session |
| 53 | .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); | 62 | .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); |
| 54 | - String captcha = request.getParameter("captcha"); | ||
| 55 | 63 | ||
| 56 | - if(StringUtils.isBlank(captcha)){ | ||
| 57 | - rs.put("msg", "请输入验证码"); | ||
| 58 | - return rs; | ||
| 59 | - } | 64 | + if(StringUtils.isBlank(captcha)) |
| 65 | + return put(rs, "msg", "请输入验证码"); | ||
| 60 | 66 | ||
| 61 | - if(!verCode.equals(captcha)){ | ||
| 62 | - rs.put("msg", "验证码有误,请刷新后重新输入"); | ||
| 63 | - return rs; | ||
| 64 | - } | 67 | + if(!verCode.equals(captcha)) |
| 68 | + return put(rs, "msg", "验证码有误,请刷新后重新输入"); | ||
| 65 | } | 69 | } |
| 66 | 70 | ||
| 71 | + //解密RSA | ||
| 72 | + userName = RSAUtils.decryptBase64(userName); | ||
| 73 | + password = RSAUtils.decryptBase64(password); | ||
| 74 | + | ||
| 67 | SysUser user = sysUserService.findByUserName(userName); | 75 | SysUser user = sysUserService.findByUserName(userName); |
| 68 | - if (null == user) { | ||
| 69 | - rs.put("msg", "不存在的用户"); | ||
| 70 | - return rs; | ||
| 71 | - } | 76 | + if (null == user) |
| 77 | + return put(rs, "msg", "不存在的用户"); | ||
| 72 | 78 | ||
| 73 | - if (!user.isEnabled()) { | ||
| 74 | - rs.put("msg", "该用户已被锁定,请联系管理员"); | ||
| 75 | - return rs; | ||
| 76 | - } | 79 | + if (!user.isEnabled()) |
| 80 | + return put(rs, "msg", "该用户已被锁定,请联系管理员"); | ||
| 77 | 81 | ||
| 78 | // 校验密码 | 82 | // 校验密码 |
| 79 | - password = fourDecodeBase64(password); | ||
| 80 | boolean matchStatus = new BCryptPasswordEncoder(4).matches(password, user.getPassword()); | 83 | boolean matchStatus = new BCryptPasswordEncoder(4).matches(password, user.getPassword()); |
| 81 | if (!matchStatus) { | 84 | if (!matchStatus) { |
| 82 | rs.put("msg", "密码有误"); | 85 | rs.put("msg", "密码有误"); |
| @@ -109,9 +112,10 @@ public class UserController extends BaseController<SysUser, Integer> { | @@ -109,9 +112,10 @@ public class UserController extends BaseController<SysUser, Integer> { | ||
| 109 | Integer size = captchaMap.get(userName); | 112 | Integer size = captchaMap.get(userName); |
| 110 | return size == null?0:size; | 113 | return size == null?0:size; |
| 111 | } | 114 | } |
| 112 | - | ||
| 113 | - private String fourDecodeBase64(String t) { | ||
| 114 | - return new String(Base64.decodeBase64(Base64.decodeBase64(Base64.decodeBase64(Base64.decodeBase64(t))))); | 115 | + |
| 116 | + public Map<String, Object> put(Map<String, Object> rs, String key, Object val){ | ||
| 117 | + rs.put(key, val); | ||
| 118 | + return rs; | ||
| 115 | } | 119 | } |
| 116 | 120 | ||
| 117 | /** | 121 | /** |
src/main/java/com/bsth/controller/sys/util/RSAUtils.java
0 → 100644
| 1 | +package com.bsth.controller.sys.util; | ||
| 2 | + | ||
| 3 | +import java.security.KeyPair; | ||
| 4 | +import java.security.KeyPairGenerator; | ||
| 5 | +import java.security.SecureRandom; | ||
| 6 | +import java.security.Security; | ||
| 7 | +import java.security.interfaces.RSAPrivateKey; | ||
| 8 | +import java.security.interfaces.RSAPublicKey; | ||
| 9 | + | ||
| 10 | +import javax.crypto.Cipher; | ||
| 11 | + | ||
| 12 | +import org.apache.commons.net.util.Base64; | ||
| 13 | + | ||
| 14 | +public class RSAUtils { | ||
| 15 | + private static final KeyPair keyPair = initKey(); | ||
| 16 | + | ||
| 17 | + private static KeyPair initKey(){ | ||
| 18 | + try { | ||
| 19 | + Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); | ||
| 20 | + SecureRandom random = new SecureRandom(); | ||
| 21 | + KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "BC"); | ||
| 22 | + generator.initialize(1024, random); | ||
| 23 | + return generator.generateKeyPair(); | ||
| 24 | + }catch (Exception e) { | ||
| 25 | + throw new RuntimeException(e); | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 生成public key | ||
| 31 | + * @return | ||
| 32 | + */ | ||
| 33 | + public static String generateBase64PublicKey(){ | ||
| 34 | + RSAPublicKey key = (RSAPublicKey)keyPair.getPublic(); | ||
| 35 | + return new String(Base64.encodeBase64(key.getEncoded())); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 解密 | ||
| 40 | + * @param string | ||
| 41 | + * @return | ||
| 42 | + */ | ||
| 43 | + public static String decryptBase64(String string) { | ||
| 44 | + return new String(decrypt(Base64.decodeBase64(string))); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + private static byte[] decrypt(byte[] string) { | ||
| 48 | + try { | ||
| 49 | + Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); | ||
| 50 | + Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding", "BC"); | ||
| 51 | + RSAPrivateKey pbk = (RSAPrivateKey)keyPair.getPrivate(); | ||
| 52 | + cipher.init(Cipher.DECRYPT_MODE, pbk); | ||
| 53 | + byte[] plainText = cipher.doFinal(string); | ||
| 54 | + return plainText; | ||
| 55 | + }catch (Exception e) { | ||
| 56 | + throw new RuntimeException(e); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | +} |
src/main/java/com/bsth/data/BasicData.java
| @@ -57,7 +57,7 @@ public class BasicData implements CommandLineRunner{ | @@ -57,7 +57,7 @@ public class BasicData implements CommandLineRunner{ | ||
| 57 | public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create(); | 57 | public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create(); |
| 58 | 58 | ||
| 59 | //线路ID和code 对照 | 59 | //线路ID和code 对照 |
| 60 | - public static BiMap<Integer, Integer> lineId2CodeMap; | 60 | + public static BiMap<Integer, String> lineId2CodeMap; |
| 61 | 61 | ||
| 62 | //线路编码和名称对照 | 62 | //线路编码和名称对照 |
| 63 | public static Map<String, String> lineCode2NameMap; | 63 | public static Map<String, String> lineCode2NameMap; |
| @@ -127,7 +127,7 @@ public class BasicData implements CommandLineRunner{ | @@ -127,7 +127,7 @@ public class BasicData implements CommandLineRunner{ | ||
| 127 | 127 | ||
| 128 | 128 | ||
| 129 | private void loadStationRouteInfo() { | 129 | private void loadStationRouteInfo() { |
| 130 | - Iterator<StationRoute> iterator = stationRouteRepository.findAll().iterator(); | 130 | + Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator(); |
| 131 | Map<String, Integer> map = new HashMap<>(); | 131 | Map<String, Integer> map = new HashMap<>(); |
| 132 | StationRoute route; | 132 | StationRoute route; |
| 133 | 133 | ||
| @@ -211,12 +211,12 @@ public class BasicData implements CommandLineRunner{ | @@ -211,12 +211,12 @@ public class BasicData implements CommandLineRunner{ | ||
| 211 | Iterator<Line> iterator = lineRepository.findAll().iterator(); | 211 | Iterator<Line> iterator = lineRepository.findAll().iterator(); |
| 212 | 212 | ||
| 213 | Line line; | 213 | Line line; |
| 214 | - BiMap<Integer, Integer> biMap = HashBiMap.create(); | 214 | + BiMap<Integer, String> biMap = HashBiMap.create(); |
| 215 | Map<String, String> code2name = new HashMap<>(); | 215 | Map<String, String> code2name = new HashMap<>(); |
| 216 | 216 | ||
| 217 | while(iterator.hasNext()){ | 217 | while(iterator.hasNext()){ |
| 218 | line = iterator.next(); | 218 | line = iterator.next(); |
| 219 | - biMap.put(line.getId(), Integer.parseInt(line.getLineCode())); | 219 | + biMap.put(line.getId(), line.getLineCode()); |
| 220 | code2name.put(line.getLineCode(), line.getName()); | 220 | code2name.put(line.getLineCode(), line.getName()); |
| 221 | } | 221 | } |
| 222 | 222 |
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
| @@ -50,7 +50,8 @@ public class ArrivalData_GPS implements CommandLineRunner{ | @@ -50,7 +50,8 @@ public class ArrivalData_GPS implements CommandLineRunner{ | ||
| 50 | 50 | ||
| 51 | @Override | 51 | @Override |
| 52 | public void run(String... arg0) throws Exception { | 52 | public void run(String... arg0) throws Exception { |
| 53 | - Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 12, TimeUnit.SECONDS); | 53 | + logger.info("ArrivalData_GPS,30,10"); |
| 54 | + Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 10, TimeUnit.SECONDS); | ||
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | @Component | 57 | @Component |
| @@ -88,6 +89,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ | @@ -88,6 +89,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ | ||
| 88 | } | 89 | } |
| 89 | //从专业的角度分析一下数据 | 90 | //从专业的角度分析一下数据 |
| 90 | analyseData.analyse(carSet); | 91 | analyseData.analyse(carSet); |
| 92 | + | ||
| 91 | //开始匹配 | 93 | //开始匹配 |
| 92 | Arrival2Schedule.start(carSet); | 94 | Arrival2Schedule.start(carSet); |
| 93 | }catch(Exception e){ | 95 | }catch(Exception e){ |
src/main/java/com/bsth/data/arrival/ArrivalEntity.java
| 1 | package com.bsth.data.arrival; | 1 | package com.bsth.data.arrival; |
| 2 | 2 | ||
| 3 | +import java.text.SimpleDateFormat; | ||
| 3 | import java.util.Date; | 4 | import java.util.Date; |
| 4 | 5 | ||
| 5 | import com.bsth.data.BasicData; | 6 | import com.bsth.data.BasicData; |
| 6 | -import com.bsth.util.DateUtils; | ||
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * | 9 | * |
| @@ -88,7 +88,8 @@ public class ArrivalEntity { | @@ -88,7 +88,8 @@ public class ArrivalEntity { | ||
| 88 | @Override | 88 | @Override |
| 89 | public String toString() { | 89 | public String toString() { |
| 90 | try { | 90 | try { |
| 91 | - return "["+BasicData.deviceId2NbbmMap.get(this.deviceId)+", "+DateUtils.sdfHHmm.format(new Date(this.ts)) | 91 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); |
| 92 | + return "["+BasicData.deviceId2NbbmMap.get(this.deviceId)+", "+sdfHHmm.format(new Date(this.ts)) | ||
| 92 | +","+(this.getUpDown()==0?"上行":"下行")+","+(this.inOut==0?"进":"出")+","+this.stopNo+" ("+this.stopName+")]"; | 93 | +","+(this.getUpDown()==0?"上行":"下行")+","+(this.inOut==0?"进":"出")+","+this.stopNo+" ("+this.stopName+")]"; |
| 93 | } catch (Exception e) { | 94 | } catch (Exception e) { |
| 94 | return ""; | 95 | return ""; |
src/main/java/com/bsth/data/arrival/DataLoader.java
| @@ -141,6 +141,41 @@ public class DataLoader { | @@ -141,6 +141,41 @@ public class DataLoader { | ||
| 141 | return list; | 141 | return list; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | + /** | ||
| 145 | + * | ||
| 146 | + * @Title: loadByLineAndStartTime | ||
| 147 | + * @Description: TODO(根据线路,走向和时间戳加载数据) | ||
| 148 | + */ | ||
| 149 | + public List<ArrivalEntity> loadByLineAndTime(String lineCode, int updown, long st, long et){ | ||
| 150 | + Calendar cal = Calendar.getInstance(); | ||
| 151 | + cal.setTimeInMillis(st); | ||
| 152 | + int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | ||
| 153 | + | ||
| 154 | + Connection conn = null; | ||
| 155 | + PreparedStatement ps = null; | ||
| 156 | + ResultSet rs = null; | ||
| 157 | + | ||
| 158 | + List<ArrivalEntity> list = new ArrayList<>(); | ||
| 159 | + String sql = "select * from bsth_c_arrival_info where weeks_year=? and line_id=? and up_down=? and in_out=0 AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; | ||
| 160 | + try{ | ||
| 161 | + conn = DBUtils_MS.getConnection(); | ||
| 162 | + ps = conn.prepareStatement(sql); | ||
| 163 | + ps.setInt(1, weeks_year); | ||
| 164 | + ps.setString(2, lineCode); | ||
| 165 | + ps.setInt(3, updown); | ||
| 166 | + ps.setLong(4, st); | ||
| 167 | + ps.setLong(5, et); | ||
| 168 | + rs = ps.executeQuery(); | ||
| 169 | + | ||
| 170 | + list = resultSet2Set(rs); | ||
| 171 | + }catch(Exception e){ | ||
| 172 | + logger.error("", e); | ||
| 173 | + }finally { | ||
| 174 | + DBUtils_MS.close(rs, ps, conn); | ||
| 175 | + } | ||
| 176 | + return list; | ||
| 177 | + } | ||
| 178 | + | ||
| 144 | public List<ArrivalEntity> resultSet2Set(ResultSet rs) throws SQLException{ | 179 | public List<ArrivalEntity> resultSet2Set(ResultSet rs) throws SQLException{ |
| 145 | List<ArrivalEntity> list = new ArrayList<>(); | 180 | List<ArrivalEntity> list = new ArrayList<>(); |
| 146 | 181 |
src/main/java/com/bsth/data/directive/DirectiveCreator.java
| @@ -43,7 +43,7 @@ public class DirectiveCreator { | @@ -43,7 +43,7 @@ public class DirectiveCreator { | ||
| 43 | * @return Directive60 返回类型 | 43 | * @return Directive60 返回类型 |
| 44 | * @throws | 44 | * @throws |
| 45 | */ | 45 | */ |
| 46 | - public static D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) { | 46 | + public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) { |
| 47 | Long timestamp = System.currentTimeMillis(); | 47 | Long timestamp = System.currentTimeMillis(); |
| 48 | 48 | ||
| 49 | Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm)); | 49 | Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm)); |
| @@ -81,7 +81,7 @@ public class DirectiveCreator { | @@ -81,7 +81,7 @@ public class DirectiveCreator { | ||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | 83 | ||
| 84 | - public static D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){ | 84 | + public D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){ |
| 85 | SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm"); | 85 | SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm"); |
| 86 | 86 | ||
| 87 | Long timestamp = System.currentTimeMillis(); | 87 | Long timestamp = System.currentTimeMillis(); |
| @@ -129,19 +129,16 @@ public class DirectiveCreator { | @@ -129,19 +129,16 @@ public class DirectiveCreator { | ||
| 129 | * @param @param t 时间戳 | 129 | * @param @param t 时间戳 |
| 130 | * @throws | 130 | * @throws |
| 131 | */ | 131 | */ |
| 132 | - public static D64 createD64(String nbbm, Integer lineCode, long t){ | 132 | + public D64 createD64(String nbbm, String lineCode, long t){ |
| 133 | String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | 133 | String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); |
| 134 | 134 | ||
| 135 | D64 change = new D64(); | 135 | D64 change = new D64(); |
| 136 | D64Data data = new D64Data(); | 136 | D64Data data = new D64Data(); |
| 137 | data.setCityCode(cityCode); | 137 | data.setCityCode(cityCode); |
| 138 | data.setDeviceId(deviceId); | 138 | data.setDeviceId(deviceId); |
| 139 | + | ||
| 139 | //线路编码补满6位数 | 140 | //线路编码补满6位数 |
| 140 | - if(lineCode > 999999){ | ||
| 141 | - logger.error("线路编码不能超过6位,code:" + lineCode); | ||
| 142 | - return null; | ||
| 143 | - } | ||
| 144 | - String lineCodeStr = String.format("%06d", lineCode); | 141 | + String lineCodeStr = padLeft(lineCode, 6, '0'); |
| 145 | data.setLineId(lineCodeStr); | 142 | data.setLineId(lineCodeStr); |
| 146 | 143 | ||
| 147 | change.setDeviceId(deviceId); | 144 | change.setDeviceId(deviceId); |
| @@ -160,7 +157,7 @@ public class DirectiveCreator { | @@ -160,7 +157,7 @@ public class DirectiveCreator { | ||
| 160 | * @param @param lineId 线路ID | 157 | * @param @param lineId 线路ID |
| 161 | * @throws | 158 | * @throws |
| 162 | */ | 159 | */ |
| 163 | - public static String createDeviceRefreshData(String deviceId, Integer lineCode) { | 160 | + public String createDeviceRefreshData(String deviceId, String lineCode) { |
| 164 | Long t = System.currentTimeMillis(); | 161 | Long t = System.currentTimeMillis(); |
| 165 | Map<String, Object> param = new HashMap<>(); | 162 | Map<String, Object> param = new HashMap<>(); |
| 166 | param.put("deviceId", deviceId); | 163 | param.put("deviceId", deviceId); |
| @@ -175,11 +172,7 @@ public class DirectiveCreator { | @@ -175,11 +172,7 @@ public class DirectiveCreator { | ||
| 175 | data.put("centerId", 1); | 172 | data.put("centerId", 1); |
| 176 | 173 | ||
| 177 | //线路编码补满6位数 | 174 | //线路编码补满6位数 |
| 178 | - if(lineCode > 999999){ | ||
| 179 | - logger.error("线路编码不能超过6位,code:" + lineCode); | ||
| 180 | - return null; | ||
| 181 | - } | ||
| 182 | - String lineCodeStr = String.format("%06d", lineCode); | 175 | + String lineCodeStr = padLeft(lineCode, 6, '0'); |
| 183 | 176 | ||
| 184 | data.put("lineId", lineCodeStr); | 177 | data.put("lineId", lineCodeStr); |
| 185 | data.put("lineVersion", 0); | 178 | data.put("lineVersion", 0); |
| @@ -189,7 +182,15 @@ public class DirectiveCreator { | @@ -189,7 +182,15 @@ public class DirectiveCreator { | ||
| 189 | return JSON.toJSONString(param); | 182 | return JSON.toJSONString(param); |
| 190 | } | 183 | } |
| 191 | 184 | ||
| 192 | - public static void main(String[] args) { | ||
| 193 | - System.out.println(String.format("%06d", "1025")); | ||
| 194 | - } | 185 | + public String padLeft(String oriStr,int len,char alexin){ |
| 186 | + String str = ""; | ||
| 187 | + int strlen = oriStr.length(); | ||
| 188 | + if(strlen < len){ | ||
| 189 | + for(int i=0;i<len-strlen;i++){ | ||
| 190 | + str = str+alexin; | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + str = str + oriStr; | ||
| 194 | + return str; | ||
| 195 | + } | ||
| 195 | } | 196 | } |
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
0 → 100644
| 1 | +package com.bsth.data.forecast; | ||
| 2 | + | ||
| 3 | +import java.text.DecimalFormat; | ||
| 4 | +import java.util.ArrayList; | ||
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.List; | ||
| 7 | +import java.util.Map; | ||
| 8 | +import java.util.concurrent.TimeUnit; | ||
| 9 | + | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +import org.springframework.boot.CommandLineRunner; | ||
| 14 | +import org.springframework.stereotype.Component; | ||
| 15 | + | ||
| 16 | +import com.bsth.Application; | ||
| 17 | +import com.bsth.data.forecast.entity.ForecastResult; | ||
| 18 | +import com.bsth.data.forecast.entity.ForecastResult.ForecastResultItem; | ||
| 19 | +import com.bsth.data.forecast.entity.SimpleRoute; | ||
| 20 | +import com.bsth.data.forecast.entity.SimpleRoute.TimeRange; | ||
| 21 | +import com.bsth.data.gpsdata.GpsEntity; | ||
| 22 | +import com.bsth.data.gpsdata.GpsRealData; | ||
| 23 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 24 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 25 | +import com.google.common.collect.ArrayListMultimap; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * | ||
| 29 | + * @ClassName: SampleTimeData | ||
| 30 | + * @Description: TODO(实时到离站预测) | ||
| 31 | + * @author PanZhao | ||
| 32 | + * @date 2016年9月18日 上午10:15:17 | ||
| 33 | + * | ||
| 34 | + */ | ||
| 35 | +@Component | ||
| 36 | +public class ForecastRealServer implements CommandLineRunner { | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + SampleTimeDataLoader dataLoader; | ||
| 40 | + | ||
| 41 | + @Autowired | ||
| 42 | + DayOfSchedule dayOfSchedule; | ||
| 43 | + | ||
| 44 | + @Autowired | ||
| 45 | + GpsRealData gpsRealData; | ||
| 46 | + | ||
| 47 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 48 | + | ||
| 49 | + //车辆 ——> 预测终点时间 | ||
| 50 | + //static Map<String, Float> forecastMap = new HashMap<>(); | ||
| 51 | + //线路_上下行 ——> 封装耗时数据的路由链 | ||
| 52 | + public static ArrayListMultimap<String, SimpleRoute> lineSampleMap; | ||
| 53 | + //车辆 ——> 预测结果 | ||
| 54 | + public static Map<String, ForecastResult> forecastMap; | ||
| 55 | + | ||
| 56 | + static{ | ||
| 57 | + lineSampleMap = ArrayListMultimap.create(); | ||
| 58 | + forecastMap = new HashMap<>(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public void run(String... arg0) throws Exception { | ||
| 63 | + //2小时更新一次站点间耗时数据 | ||
| 64 | + Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * | ||
| 69 | + * @Title: forecast | ||
| 70 | + * @Description: TODO(预测后续时间) | ||
| 71 | + * @param @param nbbm 车辆自编号 | ||
| 72 | + */ | ||
| 73 | +/* public void forecast(String nbbm){ | ||
| 74 | + logger.info("预测," + nbbm); | ||
| 75 | + //当前执行班次 | ||
| 76 | + ScheduleRealInfo sch = dayOfSchedule.execPlamMap().get(nbbm); | ||
| 77 | + if(null == sch) | ||
| 78 | + return; | ||
| 79 | + | ||
| 80 | + //车辆当前位置 | ||
| 81 | + //GpsEntity gps = gpsRealData.findByDeviceId(BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh())); | ||
| 82 | + GpsEntity gps = gpsRealData.findByDeviceId(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); | ||
| 83 | + forecast(nbbm, gps); | ||
| 84 | + }*/ | ||
| 85 | + | ||
| 86 | + public void forecast(String nbbm, GpsEntity gps){ | ||
| 87 | + try{ | ||
| 88 | + long t = System.currentTimeMillis(); | ||
| 89 | + //终点站 | ||
| 90 | + String eStation = null; | ||
| 91 | + //当前执行班次 | ||
| 92 | + ScheduleRealInfo sch = dayOfSchedule.execPlamMap().get(nbbm); | ||
| 93 | + if(null != sch) | ||
| 94 | + eStation = sch.getZdzCode(); | ||
| 95 | + | ||
| 96 | + //预测结果 | ||
| 97 | + ForecastResult forecastRes = new ForecastResult(); | ||
| 98 | + forecastRes.setStation(gps.getStopNo()); | ||
| 99 | + forecastRes.setArrTime(gps.getArrTime()); | ||
| 100 | + forecastRes.setFollows( | ||
| 101 | + calc(gps.getLineId() | ||
| 102 | + ,gps.getUpDown() | ||
| 103 | + , gps.getStopNo(), eStation | ||
| 104 | + , t - gps.getArrTime())); | ||
| 105 | + | ||
| 106 | + forecastMap.put(nbbm, forecastRes); | ||
| 107 | + //GPS附加预计终点时间 | ||
| 108 | + gps.setExpectStopTime(expectStopTime(nbbm)); | ||
| 109 | + }catch(Exception e){ | ||
| 110 | + logger.error("", e); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * | ||
| 116 | + * @Title: expectStopTime | ||
| 117 | + * @Description: TODO(预计到达终点时间) | ||
| 118 | + */ | ||
| 119 | + public Float expectStopTime(String nbbm){ | ||
| 120 | + long t = System.currentTimeMillis() | ||
| 121 | + ,diff = 0L | ||
| 122 | + ,firstExpTime; | ||
| 123 | + | ||
| 124 | + Float rs = null; | ||
| 125 | + ForecastResult forecastRes = forecastMap.get(nbbm); | ||
| 126 | + if(null == forecastRes) | ||
| 127 | + return rs; | ||
| 128 | + | ||
| 129 | + List<ForecastResultItem> trs = forecastRes.getFollows(); | ||
| 130 | + if(null != trs && trs.size() > 0){ | ||
| 131 | + | ||
| 132 | + //当前时间已超过第一个预计到站时间,后续预测时间补上差值 | ||
| 133 | + firstExpTime = trs.get(0).getTime(); | ||
| 134 | + if(firstExpTime < t) | ||
| 135 | + diff = t - firstExpTime; | ||
| 136 | + | ||
| 137 | + rs = ((float)((trs.get(trs.size() - 1).getTime()) - t + diff)) / 1000 / 60; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + //保留2位小数 | ||
| 141 | + if(null != rs) | ||
| 142 | + rs = Float.parseFloat(new DecimalFormat(".00").format(rs)); | ||
| 143 | + | ||
| 144 | + return rs; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * | ||
| 149 | + * @Title: expectDetail | ||
| 150 | + * @Description: TODO(预测明细) | ||
| 151 | + */ | ||
| 152 | + public List<TimeRange> expectDetail(String nbbm){ | ||
| 153 | + | ||
| 154 | + return null; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + | ||
| 158 | + public List<ForecastResultItem> calc(String lineCode, int updown , String sStation, String eStation, long diff){ | ||
| 159 | + long t = System.currentTimeMillis() | ||
| 160 | + , ct = t - diff; | ||
| 161 | + | ||
| 162 | + List<SimpleRoute> srs = lineSampleMap.get(lineCode + "_" + updown); | ||
| 163 | + SimpleRoute curr; | ||
| 164 | + int len = srs.size(); | ||
| 165 | + | ||
| 166 | + List<ForecastResultItem> rs = null; | ||
| 167 | + ForecastResultItem frItem; | ||
| 168 | + | ||
| 169 | + for(int i = 0; i < len; i ++){ | ||
| 170 | + curr = srs.get(i); | ||
| 171 | + | ||
| 172 | + if(curr.stationCode.equals(sStation)){ | ||
| 173 | + rs = new ArrayList<>(); | ||
| 174 | + continue; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + if(null == rs) | ||
| 178 | + continue; | ||
| 179 | + | ||
| 180 | + frItem = new ForecastResultItem(); | ||
| 181 | + frItem.setStationId(curr.stationCode); | ||
| 182 | + frItem.setStationName(curr.stationName); | ||
| 183 | + if(null == curr.ranges || curr.ranges.size() == 0) | ||
| 184 | + break; | ||
| 185 | + | ||
| 186 | + //从多个时区耗时中选择一个 | ||
| 187 | + for(TimeRange tr : curr.ranges){ | ||
| 188 | + if(tr.startTime < t){ | ||
| 189 | + ct += ((long)(tr.runTime * 60 * 1000)); | ||
| 190 | + frItem.setTime(ct); | ||
| 191 | + break; | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + if(null != eStation && eStation.equals(curr.stationCode)) | ||
| 196 | + break; | ||
| 197 | + | ||
| 198 | + rs.add(frItem); | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + return rs; | ||
| 202 | + } | ||
| 203 | +} |
src/main/java/com/bsth/data/forecast/SampleTimeDataLoader.java
0 → 100644
| 1 | +package com.bsth.data.forecast; | ||
| 2 | + | ||
| 3 | +import java.text.SimpleDateFormat; | ||
| 4 | +import java.util.ArrayList; | ||
| 5 | +import java.util.Collections; | ||
| 6 | +import java.util.Comparator; | ||
| 7 | +import java.util.Date; | ||
| 8 | +import java.util.Iterator; | ||
| 9 | +import java.util.List; | ||
| 10 | +import java.util.Set; | ||
| 11 | + | ||
| 12 | +import org.slf4j.Logger; | ||
| 13 | +import org.slf4j.LoggerFactory; | ||
| 14 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | +import org.springframework.stereotype.Component; | ||
| 16 | + | ||
| 17 | +import com.bsth.data.forecast.entity.SimpleRoute; | ||
| 18 | +import com.bsth.data.forecast.entity.SimpleRoute.TimeRange; | ||
| 19 | +import com.bsth.entity.StationRoute; | ||
| 20 | +import com.bsth.entity.forecast.Sample; | ||
| 21 | +import com.bsth.repository.StationRouteRepository; | ||
| 22 | +import com.bsth.repository.forecast.SampleRepository; | ||
| 23 | +import com.google.common.collect.ArrayListMultimap; | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * | ||
| 27 | + * @Title: loadData | ||
| 28 | + * @Description: TODO(从数据库加载数据) | ||
| 29 | + */ | ||
| 30 | +@Component | ||
| 31 | +public class SampleTimeDataLoader extends Thread { | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + SampleRepository sampleRepository; | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + StationRouteRepository stationRouteRepository; | ||
| 38 | + | ||
| 39 | + // 当天日期 | ||
| 40 | + String rq; | ||
| 41 | + | ||
| 42 | + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | ||
| 43 | + | ||
| 44 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 45 | + | ||
| 46 | + @Override | ||
| 47 | + public void run() { | ||
| 48 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 49 | + rq = sdfyyyyMMdd.format(new Date()); | ||
| 50 | + | ||
| 51 | + Iterator<Sample> iterator = sampleRepository.findAll().iterator(); | ||
| 52 | + ArrayListMultimap<String, Sample> sampleMap = ArrayListMultimap.create(); | ||
| 53 | + | ||
| 54 | + Sample sample; | ||
| 55 | + String key; | ||
| 56 | + while (iterator.hasNext()) { | ||
| 57 | + sample = iterator.next(); | ||
| 58 | + key = sample.getLineCode() + "_" + sample.getUpdown() + "_" + sample.getsStation() + "_" | ||
| 59 | + + sample.geteStation(); | ||
| 60 | + sampleMap.put(key, sample); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + // 加载全部路由信息 | ||
| 64 | + List<StationRoute> allRoutes = stationRouteRepository.findAllEffective(); | ||
| 65 | + // 线路和走向分组 | ||
| 66 | + ArrayListMultimap<String, StationRoute> groupMap = ArrayListMultimap.create(); | ||
| 67 | + for (StationRoute sr : allRoutes) | ||
| 68 | + groupMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr); | ||
| 69 | + | ||
| 70 | + ArrayListMultimap<String, SimpleRoute> lineSampleMapCopy = ArrayListMultimap.create(); | ||
| 71 | + // 排序路由链并附加各个时区耗时信息 | ||
| 72 | + StationRouteComp comp = new StationRouteComp(); | ||
| 73 | + Set<String> kys = groupMap.keySet(); | ||
| 74 | + List<StationRoute> routeList; | ||
| 75 | + StationRoute sRoute; | ||
| 76 | + | ||
| 77 | + List<Sample> sapList; | ||
| 78 | + for (String k : kys) { | ||
| 79 | + routeList = groupMap.get(k); | ||
| 80 | + // 排序 | ||
| 81 | + Collections.sort(routeList, comp); | ||
| 82 | + | ||
| 83 | + for (int i = 1; i < routeList.size(); i++) { | ||
| 84 | + sRoute = routeList.get(i); | ||
| 85 | + | ||
| 86 | + sapList = sampleMap.get(k + "_" +routeList.get(i - 1).getStationCode() + "_" + sRoute.getStationCode()); | ||
| 87 | + | ||
| 88 | + lineSampleMapCopy.put(k, createSimpleRoute(sRoute, sapList)); | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + ForecastRealServer.lineSampleMap = lineSampleMapCopy; | ||
| 93 | + logger.info("SampleTimeDataLoader.... over..."); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + private SimpleRoute createSimpleRoute(StationRoute sRoute, List<Sample> list) { | ||
| 97 | + SimpleRoute simple = new SimpleRoute(); | ||
| 98 | + | ||
| 99 | + simple.stationCode = sRoute.getStationCode(); | ||
| 100 | + simple.ranges = new ArrayList<>(); | ||
| 101 | + | ||
| 102 | + try{ | ||
| 103 | + TimeRange tg; | ||
| 104 | + for (Sample s : list) { | ||
| 105 | + tg = new TimeRange(); | ||
| 106 | + tg.startTime = sdfyyyyMMddHHmm.parse(rq + s.getsDate()).getTime(); | ||
| 107 | + tg.endTime = sdfyyyyMMddHHmm.parse(rq + s.geteDate()).getTime(); | ||
| 108 | + tg.runTime = s.getRunTime(); | ||
| 109 | + simple.ranges.add(tg); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + //排序 | ||
| 113 | + Collections.sort(simple.ranges); | ||
| 114 | + }catch(Exception e){ | ||
| 115 | + logger.error("", e); | ||
| 116 | + } | ||
| 117 | + return simple; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public static class StationRouteComp implements Comparator<StationRoute> { | ||
| 121 | + | ||
| 122 | + @Override | ||
| 123 | + public int compare(StationRoute o1, StationRoute o2) { | ||
| 124 | + return o1.getStationRouteCode() - o2.getStationRouteCode(); | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | +} |
src/main/java/com/bsth/data/forecast/entity/ForecastResult.java
0 → 100644
| 1 | +package com.bsth.data.forecast.entity; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * | ||
| 7 | + * @ClassName: ForecastResult | ||
| 8 | + * @Description: TODO(预测结果) | ||
| 9 | + * @author PanZhao | ||
| 10 | + * @date 2016年9月19日 上午11:09:28 | ||
| 11 | + * | ||
| 12 | + */ | ||
| 13 | +public class ForecastResult { | ||
| 14 | + | ||
| 15 | + /** 当前站 */ | ||
| 16 | + private String station; | ||
| 17 | + | ||
| 18 | + /** 到站时间 */ | ||
| 19 | + private long arrTime; | ||
| 20 | + | ||
| 21 | + /** 后续站点预测明细 */ | ||
| 22 | + private List<ForecastResultItem> follows; | ||
| 23 | + | ||
| 24 | + /** 预计到达终点时间(分钟) */ | ||
| 25 | + private Float stopTime; | ||
| 26 | + | ||
| 27 | + public static class ForecastResultItem { | ||
| 28 | + | ||
| 29 | + /** 站点ID */ | ||
| 30 | + private String stationId; | ||
| 31 | + | ||
| 32 | + /** 站点名称 */ | ||
| 33 | + private String stationName; | ||
| 34 | + | ||
| 35 | + /** 时间戳 */ | ||
| 36 | + private long time; | ||
| 37 | + | ||
| 38 | + public String getStationId() { | ||
| 39 | + return stationId; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public void setStationId(String stationId) { | ||
| 43 | + this.stationId = stationId; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public String getStationName() { | ||
| 47 | + return stationName; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public void setStationName(String stationName) { | ||
| 51 | + this.stationName = stationName; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public long getTime() { | ||
| 55 | + return time; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public void setTime(long time) { | ||
| 59 | + this.time = time; | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public String getStation() { | ||
| 64 | + return station; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setStation(String station) { | ||
| 68 | + this.station = station; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public long getArrTime() { | ||
| 72 | + return arrTime; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public void setArrTime(long arrTime) { | ||
| 76 | + this.arrTime = arrTime; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public Float getStopTime() { | ||
| 80 | + return stopTime; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public void setStopTime(Float stopTime) { | ||
| 84 | + this.stopTime = stopTime; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public List<ForecastResultItem> getFollows() { | ||
| 88 | + return follows; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public void setFollows(List<ForecastResultItem> follows) { | ||
| 92 | + this.follows = follows; | ||
| 93 | + } | ||
| 94 | +} |
src/main/java/com/bsth/data/forecast/entity/SimpleRoute.java
0 → 100644
| 1 | +package com.bsth.data.forecast.entity; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * | ||
| 7 | + * @ClassName: SimpleStationRoute | ||
| 8 | + * @Description: TODO(简单的路由耗时封装) | ||
| 9 | + * @author PanZhao | ||
| 10 | + * @date 2016年9月18日 上午10:51:56 | ||
| 11 | + * | ||
| 12 | + */ | ||
| 13 | +public class SimpleRoute { | ||
| 14 | + | ||
| 15 | + /** 站点编码 */ | ||
| 16 | + public String stationCode; | ||
| 17 | + | ||
| 18 | + /** 站点名称 */ | ||
| 19 | + public String stationName; | ||
| 20 | + | ||
| 21 | + public List<TimeRange> ranges; | ||
| 22 | + | ||
| 23 | + public static class TimeRange implements Comparable<TimeRange>{ | ||
| 24 | + | ||
| 25 | + /** 开始时间 */ | ||
| 26 | + public long startTime; | ||
| 27 | + | ||
| 28 | + /** 截止时间 */ | ||
| 29 | + public long endTime; | ||
| 30 | + | ||
| 31 | + /** 运行时间 */ | ||
| 32 | + public float runTime; | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public int compareTo(TimeRange o) { | ||
| 36 | + return (int) (o.startTime - this.startTime); | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | +} |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| @@ -14,7 +14,7 @@ public class GpsEntity { | @@ -14,7 +14,7 @@ public class GpsEntity { | ||
| 14 | private Integer companyCode; | 14 | private Integer companyCode; |
| 15 | 15 | ||
| 16 | /** 线路编码 */ | 16 | /** 线路编码 */ |
| 17 | - private Integer lineId; | 17 | + private String lineId; |
| 18 | 18 | ||
| 19 | /** 设备编码 */ | 19 | /** 设备编码 */ |
| 20 | private String deviceId; | 20 | private String deviceId; |
| @@ -24,6 +24,12 @@ public class GpsEntity { | @@ -24,6 +24,12 @@ public class GpsEntity { | ||
| 24 | 24 | ||
| 25 | /** 站点编码 */ | 25 | /** 站点编码 */ |
| 26 | private String stopNo; | 26 | private String stopNo; |
| 27 | + | ||
| 28 | + /** 站点名称 */ | ||
| 29 | + private String stationName; | ||
| 30 | + | ||
| 31 | + /** 到站时间 */ | ||
| 32 | + private long arrTime; | ||
| 27 | 33 | ||
| 28 | /** 经度 */ | 34 | /** 经度 */ |
| 29 | private Float lon; | 35 | private Float lon; |
| @@ -49,17 +55,14 @@ public class GpsEntity { | @@ -49,17 +55,14 @@ public class GpsEntity { | ||
| 49 | /** 车辆内部编码 */ | 55 | /** 车辆内部编码 */ |
| 50 | private String nbbm; | 56 | private String nbbm; |
| 51 | 57 | ||
| 52 | - /** 站点名称 */ | ||
| 53 | - private String stationName; | ||
| 54 | - | ||
| 55 | - /** 当前班次ID */ | ||
| 56 | - private Long currSchId; | ||
| 57 | - | ||
| 58 | - /** 下一个班次ID */ | ||
| 59 | - private Long nextSchId; | 58 | + /** 预计到达终点时间 */ |
| 59 | + private Float expectStopTime; | ||
| 60 | 60 | ||
| 61 | /** 设备是否在线 */ | 61 | /** 设备是否在线 */ |
| 62 | private boolean online; | 62 | private boolean online; |
| 63 | + | ||
| 64 | + /** 当前执行班次ID */ | ||
| 65 | + private Long schId; | ||
| 63 | 66 | ||
| 64 | public Integer getCompanyCode() { | 67 | public Integer getCompanyCode() { |
| 65 | return companyCode; | 68 | return companyCode; |
| @@ -69,14 +72,6 @@ public class GpsEntity { | @@ -69,14 +72,6 @@ public class GpsEntity { | ||
| 69 | this.companyCode = companyCode; | 72 | this.companyCode = companyCode; |
| 70 | } | 73 | } |
| 71 | 74 | ||
| 72 | - public Integer getLineId() { | ||
| 73 | - return lineId; | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - public void setLineId(Integer lineId) { | ||
| 77 | - this.lineId = lineId; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | public String getDeviceId() { | 75 | public String getDeviceId() { |
| 81 | return deviceId; | 76 | return deviceId; |
| 82 | } | 77 | } |
| @@ -156,22 +151,6 @@ public class GpsEntity { | @@ -156,22 +151,6 @@ public class GpsEntity { | ||
| 156 | public void setUpDown(Integer upDown) { | 151 | public void setUpDown(Integer upDown) { |
| 157 | this.upDown = upDown; | 152 | this.upDown = upDown; |
| 158 | } | 153 | } |
| 159 | - | ||
| 160 | - public Long getCurrSchId() { | ||
| 161 | - return currSchId; | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - public void setCurrSchId(Long currSchId) { | ||
| 165 | - this.currSchId = currSchId; | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - public Long getNextSchId() { | ||
| 169 | - return nextSchId; | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - public void setNextSchId(Long nextSchId) { | ||
| 173 | - this.nextSchId = nextSchId; | ||
| 174 | - } | ||
| 175 | 154 | ||
| 176 | public String getNbbm() { | 155 | public String getNbbm() { |
| 177 | return nbbm; | 156 | return nbbm; |
| @@ -196,4 +175,36 @@ public class GpsEntity { | @@ -196,4 +175,36 @@ public class GpsEntity { | ||
| 196 | public void setOnline(boolean online) { | 175 | public void setOnline(boolean online) { |
| 197 | this.online = online; | 176 | this.online = online; |
| 198 | } | 177 | } |
| 178 | + | ||
| 179 | + public long getArrTime() { | ||
| 180 | + return arrTime; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public void setArrTime(long arrTime) { | ||
| 184 | + this.arrTime = arrTime; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public Float getExpectStopTime() { | ||
| 188 | + return expectStopTime; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public void setExpectStopTime(Float expectStopTime) { | ||
| 192 | + this.expectStopTime = expectStopTime; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public String getLineId() { | ||
| 196 | + return lineId; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + public void setLineId(String lineId) { | ||
| 200 | + this.lineId = lineId; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + public Long getSchId() { | ||
| 204 | + return schId; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + public void setSchId(Long schId) { | ||
| 208 | + this.schId = schId; | ||
| 209 | + } | ||
| 199 | } | 210 | } |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| @@ -25,6 +25,9 @@ import com.alibaba.fastjson.JSON; | @@ -25,6 +25,9 @@ import com.alibaba.fastjson.JSON; | ||
| 25 | import com.alibaba.fastjson.JSONObject; | 25 | import com.alibaba.fastjson.JSONObject; |
| 26 | import com.bsth.Application; | 26 | import com.bsth.Application; |
| 27 | import com.bsth.data.BasicData; | 27 | import com.bsth.data.BasicData; |
| 28 | +import com.bsth.data.forecast.ForecastRealServer; | ||
| 29 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 30 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 28 | import com.bsth.util.ConfigUtil; | 31 | import com.bsth.util.ConfigUtil; |
| 29 | import com.google.common.collect.TreeMultimap; | 32 | import com.google.common.collect.TreeMultimap; |
| 30 | 33 | ||
| @@ -44,7 +47,7 @@ public class GpsRealData implements CommandLineRunner{ | @@ -44,7 +47,7 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 44 | private static Map<String, GpsEntity> gpsMap; | 47 | private static Map<String, GpsEntity> gpsMap; |
| 45 | 48 | ||
| 46 | //按线路分组设备号 | 49 | //按线路分组设备号 |
| 47 | - private static TreeMultimap<Integer, String> lineCode2Devices; | 50 | + private static TreeMultimap<String, String> lineCode2Devices; |
| 48 | 51 | ||
| 49 | // 网关数据接口地址 | 52 | // 网关数据接口地址 |
| 50 | private static String url; | 53 | private static String url; |
| @@ -52,6 +55,11 @@ public class GpsRealData implements CommandLineRunner{ | @@ -52,6 +55,11 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 52 | @Autowired | 55 | @Autowired |
| 53 | GpsDataLoader gpsDataLoader; | 56 | GpsDataLoader gpsDataLoader; |
| 54 | 57 | ||
| 58 | + @Autowired | ||
| 59 | + DayOfSchedule dayOfSchedule; | ||
| 60 | + | ||
| 61 | + @Autowired | ||
| 62 | + ForecastRealServer forecastRealServer; | ||
| 55 | /** | 63 | /** |
| 56 | * 构造函数 | 64 | * 构造函数 |
| 57 | */ | 65 | */ |
| @@ -64,11 +72,25 @@ public class GpsRealData implements CommandLineRunner{ | @@ -64,11 +72,25 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 64 | @Override | 72 | @Override |
| 65 | public void run(String... arg0) throws Exception { | 73 | public void run(String... arg0) throws Exception { |
| 66 | logger.info("gpsDataLoader,20,6"); | 74 | logger.info("gpsDataLoader,20,6"); |
| 67 | - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); | 75 | + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 7, TimeUnit.SECONDS); |
| 68 | } | 76 | } |
| 69 | 77 | ||
| 70 | - public static GpsEntity add(GpsEntity gps) { | 78 | + public GpsEntity add(GpsEntity gps) { |
| 71 | String device = gps.getDeviceId(); | 79 | String device = gps.getDeviceId(); |
| 80 | + GpsEntity old = gpsMap.get(device); | ||
| 81 | + | ||
| 82 | + //定时定距数据附带站点编码改变 | ||
| 83 | + if(null == old || !old.getStopNo().equals(gps.getStopNo())){ | ||
| 84 | + gps.setArrTime(gps.getTimestamp()); | ||
| 85 | + //预测到达终点时间 | ||
| 86 | + forecastRealServer.forecast(gps.getNbbm(), gps); | ||
| 87 | + } | ||
| 88 | + else{ | ||
| 89 | + gps.setArrTime(old.getArrTime()); | ||
| 90 | + //不预测, 重新计算终点时间 | ||
| 91 | + gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm())); | ||
| 92 | + } | ||
| 93 | + | ||
| 72 | gpsMap.put(device, gps); | 94 | gpsMap.put(device, gps); |
| 73 | lineCode2Devices.put(gps.getLineId(), device); | 95 | lineCode2Devices.put(gps.getLineId(), device); |
| 74 | return gps; | 96 | return gps; |
| @@ -86,12 +108,18 @@ public class GpsRealData implements CommandLineRunner{ | @@ -86,12 +108,18 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 86 | * | 108 | * |
| 87 | * @Title: get @Description: TODO(线路编码获取GPS集合) @throws | 109 | * @Title: get @Description: TODO(线路编码获取GPS集合) @throws |
| 88 | */ | 110 | */ |
| 89 | - public List<GpsEntity> get(Integer lineCode) { | 111 | + public List<GpsEntity> getByLine(String lineCode) { |
| 90 | NavigableSet<String> set = lineCode2Devices.get(lineCode); | 112 | NavigableSet<String> set = lineCode2Devices.get(lineCode); |
| 91 | 113 | ||
| 92 | List<GpsEntity> rs = new ArrayList<>(); | 114 | List<GpsEntity> rs = new ArrayList<>(); |
| 115 | + GpsEntity gps; | ||
| 116 | + ScheduleRealInfo sch; | ||
| 93 | for(String device : set){ | 117 | for(String device : set){ |
| 94 | - rs.add(gpsMap.get(device)); | 118 | + gps = gpsMap.get(device); |
| 119 | + sch = dayOfSchedule.execPlamMap().get(gps.getNbbm()); | ||
| 120 | + if(null != sch) | ||
| 121 | + gps.setSchId(sch.getId()); | ||
| 122 | + rs.add(gps); | ||
| 95 | } | 123 | } |
| 96 | 124 | ||
| 97 | return rs; | 125 | return rs; |
| @@ -101,7 +129,7 @@ public class GpsRealData implements CommandLineRunner{ | @@ -101,7 +129,7 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 101 | List<GpsEntity> list = new ArrayList<>(); | 129 | List<GpsEntity> list = new ArrayList<>(); |
| 102 | 130 | ||
| 103 | for(String code : pArray) | 131 | for(String code : pArray) |
| 104 | - list.addAll(get(Integer.parseInt(code))); | 132 | + list.addAll(getByLine(code)); |
| 105 | return list; | 133 | return list; |
| 106 | } | 134 | } |
| 107 | 135 | ||
| @@ -113,6 +141,9 @@ public class GpsRealData implements CommandLineRunner{ | @@ -113,6 +141,9 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 113 | public static class GpsDataLoader extends Thread{ | 141 | public static class GpsDataLoader extends Thread{ |
| 114 | 142 | ||
| 115 | Logger logger = LoggerFactory.getLogger(GpsDataLoader.class); | 143 | Logger logger = LoggerFactory.getLogger(GpsDataLoader.class); |
| 144 | + | ||
| 145 | + @Autowired | ||
| 146 | + GpsRealData gpsRealData; | ||
| 116 | 147 | ||
| 117 | @Override | 148 | @Override |
| 118 | public void run() { | 149 | public void run() { |
| @@ -130,7 +161,7 @@ public class GpsRealData implements CommandLineRunner{ | @@ -130,7 +161,7 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 130 | try { | 161 | try { |
| 131 | httpClient = HttpClients.createDefault(); | 162 | httpClient = HttpClients.createDefault(); |
| 132 | HttpGet get = new HttpGet(url); | 163 | HttpGet get = new HttpGet(url); |
| 133 | - | 164 | + |
| 134 | response = httpClient.execute(get); | 165 | response = httpClient.execute(get); |
| 135 | 166 | ||
| 136 | HttpEntity entity = response.getEntity(); | 167 | HttpEntity entity = response.getEntity(); |
| @@ -156,7 +187,7 @@ public class GpsRealData implements CommandLineRunner{ | @@ -156,7 +187,7 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 156 | 187 | ||
| 157 | gps.setNbbm(nbbm); | 188 | gps.setNbbm(nbbm); |
| 158 | gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); | 189 | gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); |
| 159 | - add(gps); | 190 | + gpsRealData.add(gps); |
| 160 | } | 191 | } |
| 161 | } else | 192 | } else |
| 162 | logger.error("result is null"); | 193 | logger.error("result is null"); |
src/main/java/com/bsth/data/match/Arrival2Schedule.java
| @@ -158,11 +158,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -158,11 +158,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 158 | 158 | ||
| 159 | //漂移判定 | 159 | //漂移判定 |
| 160 | if(driftCheck(mr, arr)){ | 160 | if(driftCheck(mr, arr)){ |
| 161 | - mr.sch.setFcsjActualAll(mr.ts); | ||
| 162 | - //通知客户端 | ||
| 163 | - sendUtils.sendFcsj(mr.sch); | ||
| 164 | - //持久化 | ||
| 165 | - dayOfSchedule.save(mr.sch); | 161 | + carOut(mr); |
| 166 | } | 162 | } |
| 167 | } | 163 | } |
| 168 | } | 164 | } |
| @@ -203,26 +199,58 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -203,26 +199,58 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 203 | //排序后的第一个 就是最合适的匹配 | 199 | //排序后的第一个 就是最合适的匹配 |
| 204 | Collections.sort(mrs, mrComparator); | 200 | Collections.sort(mrs, mrComparator); |
| 205 | mr = mrs.get(0); | 201 | mr = mrs.get(0); |
| 206 | - mr.sch.setZdsjActualAll(mr.ts); | 202 | + carInStop(mr); |
| 203 | + } | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + /** | ||
| 207 | + * | ||
| 208 | + * @Title: carOut | ||
| 209 | + * @Description: TODO(车辆发出) | ||
| 210 | + */ | ||
| 211 | + public void carOut(MatchResult mr){ | ||
| 212 | + //设置发车时间 | ||
| 213 | + mr.sch.setFcsjActualAll(mr.ts); | ||
| 214 | + //通知客户端 | ||
| 215 | + sendUtils.sendFcsj(mr.sch); | ||
| 216 | + //持久化 | ||
| 217 | + dayOfSchedule.save(mr.sch); | ||
| 218 | + //车辆当前执行班次 | ||
| 219 | + dayOfSchedule.addExecPlan(mr.sch); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + /** | ||
| 223 | + * | ||
| 224 | + * @Title: carInStop | ||
| 225 | + * @Description: TODO(车辆进入终点站) | ||
| 226 | + */ | ||
| 227 | + public void carInStop(MatchResult mr){ | ||
| 228 | + mr.sch.setZdsjActualAll(mr.ts); | ||
| 229 | + | ||
| 230 | + int doneSum = dayOfSchedule.doneSum(mr.sch.getClZbh()); | ||
| 231 | + ScheduleRealInfo next = dayOfSchedule.next(mr.sch); | ||
| 232 | + if(null != next){ | ||
| 233 | + next.setQdzArrDateSJ(mr.sch.getZdsjActual()); | ||
| 234 | + //下发调度指令 | ||
| 235 | + directiveService.send60Dispatch(next, doneSum, "到站@系统"); | ||
| 207 | 236 | ||
| 208 | - int doneSum = dayOfSchedule.doneSum(mr.sch.getClZbh()); | ||
| 209 | - ScheduleRealInfo next = dayOfSchedule.next(mr.sch); | ||
| 210 | - if(null != next){ | ||
| 211 | - next.setQdzArrDateSJ(mr.sch.getZdsjActual()); | ||
| 212 | - //下发调度指令 | ||
| 213 | - directiveService.send60Dispatch(next, doneSum, "到站@系统"); | ||
| 214 | - | ||
| 215 | - //起点既停车场的进场班次 | ||
| 216 | - if(next.getBcType().equals("in") && next.getJhlc() == null) | ||
| 217 | - next.setFcsjActualAll(mr.ts); | ||
| 218 | - } | ||
| 219 | - else//下发文本指令(已结束运营) | ||
| 220 | - directiveService.send60Phrase(nbbm, "到达终点 " + mr.sch.getZdzName() + ",已完成当日所有排班。", "系统"); | ||
| 221 | - //通知客户端 | ||
| 222 | - sendUtils.sendZdsj(mr.sch, next, doneSum); | ||
| 223 | - //持久化 | ||
| 224 | - dayOfSchedule.save(mr.sch); | 237 | + //完成“起点既停车场”的进场班次 |
| 238 | + if(next.getBcType().equals("in") && next.getJhlc() == null) | ||
| 239 | + next.setFcsjActualAll(mr.ts); | ||
| 240 | + | ||
| 241 | + //套跑 -下发线路切换指令 | ||
| 242 | + if(!next.getXlBm().equals(mr.sch.getXlBm())) | ||
| 243 | + directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统"); | ||
| 225 | } | 244 | } |
| 245 | + else//下发文本指令(已结束运营) | ||
| 246 | + directiveService.send60Phrase(nbbm, "到达终点 " + mr.sch.getZdzName() + ",已完成当日所有排班。", "系统"); | ||
| 247 | + //通知客户端 | ||
| 248 | + sendUtils.sendZdsj(mr.sch, next, doneSum); | ||
| 249 | + //持久化 | ||
| 250 | + dayOfSchedule.save(mr.sch); | ||
| 251 | + logger.info(mr.sch.getClZbh() + "移除正在执行班次," + mr.sch.getFcsj()); | ||
| 252 | + //移除车辆正在执行班次索引 | ||
| 253 | + dayOfSchedule.removeExecPlan(mr.sch.getClZbh()); | ||
| 226 | } | 254 | } |
| 227 | 255 | ||
| 228 | /** | 256 | /** |
src/main/java/com/bsth/data/match/Arrival2Schedule_old.java deleted
100644 → 0
| 1 | -package com.bsth.data.match; | ||
| 2 | -//package com.bsth.data.match; | ||
| 3 | -// | ||
| 4 | -//import java.util.ArrayList; | ||
| 5 | -//import java.util.Collections; | ||
| 6 | -//import java.util.List; | ||
| 7 | -//import java.util.Set; | ||
| 8 | -// | ||
| 9 | -//import org.slf4j.Logger; | ||
| 10 | -//import org.slf4j.LoggerFactory; | ||
| 11 | -//import org.springframework.beans.BeansException; | ||
| 12 | -//import org.springframework.context.ApplicationContext; | ||
| 13 | -//import org.springframework.context.ApplicationContextAware; | ||
| 14 | -//import org.springframework.stereotype.Component; | ||
| 15 | -// | ||
| 16 | -//import com.bsth.data.arrival.ArrivalComparator; | ||
| 17 | -//import com.bsth.data.arrival.ArrivalData_GPS; | ||
| 18 | -//import com.bsth.data.arrival.ArrivalEntity; | ||
| 19 | -//import com.bsth.data.schedule.DayOfSchedule; | ||
| 20 | -//import com.bsth.data.schedule.ScheduleComparator; | ||
| 21 | -//import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 22 | -//import com.bsth.service.directive.DirectiveService; | ||
| 23 | -//import com.bsth.websocket.handler.SendUtils; | ||
| 24 | -// | ||
| 25 | -///** | ||
| 26 | -// * | ||
| 27 | -// * @ClassName: Arrival2Schedule | ||
| 28 | -// * @Description: TODO(进出数据匹配班次) | ||
| 29 | -// * @author PanZhao | ||
| 30 | -// * @date 2016年8月10日 下午2:26:22 | ||
| 31 | -// * | ||
| 32 | -// */ | ||
| 33 | -//@Component | ||
| 34 | -//public class Arrival2Schedule implements ApplicationContextAware{ | ||
| 35 | -// | ||
| 36 | -// private static ScheduleComparator.FCSJ schComparator; | ||
| 37 | -// private static ArrivalComparator arrComparator; | ||
| 38 | -// private static SendUtils sendUtils; | ||
| 39 | -// private static DayOfSchedule dayOfSchedule; | ||
| 40 | -// private static DirectiveService directiveService; | ||
| 41 | -// | ||
| 42 | -// private final static long MAX_RANGE = 1000 * 60 * 60 * 1L; | ||
| 43 | -// | ||
| 44 | -// static{ | ||
| 45 | -// schComparator = new ScheduleComparator.FCSJ(); | ||
| 46 | -// arrComparator = new ArrivalComparator(); | ||
| 47 | -// } | ||
| 48 | -// | ||
| 49 | -// static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class); | ||
| 50 | -// | ||
| 51 | -// /** | ||
| 52 | -// * | ||
| 53 | -// * @Title: start | ||
| 54 | -// * @Description: TODO(开始) | ||
| 55 | -// * @param @param cars 需要匹配的车辆集合 | ||
| 56 | -// */ | ||
| 57 | -// public static void start(Set<String> cars){ | ||
| 58 | -// | ||
| 59 | -// for(String car : cars){ | ||
| 60 | -// new GpsMatchThread(car).start(); | ||
| 61 | -// } | ||
| 62 | -// } | ||
| 63 | -// | ||
| 64 | -// public static class GpsMatchThread extends Thread{ | ||
| 65 | -// | ||
| 66 | -// String nbbm; | ||
| 67 | -// public GpsMatchThread(String nbbm){ | ||
| 68 | -// this.nbbm = nbbm; | ||
| 69 | -// } | ||
| 70 | -// | ||
| 71 | -// @Override | ||
| 72 | -// public void run() { | ||
| 73 | -// //班次列表 | ||
| 74 | -// List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm); | ||
| 75 | -// //进出起终点数据 | ||
| 76 | -// List<ArrivalEntity> arrList = ArrivalData_GPS.getIncrement(nbbm); | ||
| 77 | -// logger.info("####匹配进出站增量数据 " + arrList.size()); | ||
| 78 | -// //排序 | ||
| 79 | -// Collections.sort(schList, schComparator); | ||
| 80 | -// Collections.sort(arrList, arrComparator); | ||
| 81 | -// | ||
| 82 | -// int si = lastMatchPoint(schList); | ||
| 83 | -// int ai = afterByTime(arrList, lastMatchTime(schList.get(si))); | ||
| 84 | -// | ||
| 85 | -// //按起始索引开始匹配 | ||
| 86 | -// match(arrList, ai, schList, si); | ||
| 87 | -// } | ||
| 88 | -// | ||
| 89 | -// public void match(List<ArrivalEntity> arrList, int ai, List<ScheduleRealInfo> schList, int si){ | ||
| 90 | -// | ||
| 91 | -// int sLen = schList.size(); | ||
| 92 | -// for(; si < sLen; si ++) | ||
| 93 | -// match(arrList, ai, schList.get(si)); | ||
| 94 | -// } | ||
| 95 | -// | ||
| 96 | -// public void match(List<ArrivalEntity> arrList, int ai, ScheduleRealInfo sch){ | ||
| 97 | -// //烂班不参与 | ||
| 98 | -// if(sch.isDestroy()) | ||
| 99 | -// return; | ||
| 100 | -// | ||
| 101 | -// int aLen = arrList.size(); | ||
| 102 | -// | ||
| 103 | -// List<MatchResult> inRsList = new ArrayList<>() | ||
| 104 | -// ,outRsList = new ArrayList<>(); | ||
| 105 | -// | ||
| 106 | -// MatchResult mrs; | ||
| 107 | -// for(;ai < aLen; ai ++){ | ||
| 108 | -// mrs = match(arrList.get(ai), sch); | ||
| 109 | -// if(!mrs.success) | ||
| 110 | -// continue; | ||
| 111 | -// | ||
| 112 | -// if(mrs.inOut == 0) | ||
| 113 | -// inRsList.add(mrs); | ||
| 114 | -// else if(mrs.inOut == 1) | ||
| 115 | -// outRsList.add(mrs); | ||
| 116 | -// } | ||
| 117 | -// | ||
| 118 | -// if(outRsList.size() > 0){ | ||
| 119 | -// //排序后的第一个 就是最合适的匹配 | ||
| 120 | -// Collections.sort(outRsList, new MatchResultComparator()); | ||
| 121 | -// mrs = outRsList.get(0); | ||
| 122 | -// | ||
| 123 | -// mrs.sch.setFcsjActualAll(mrs.ts); | ||
| 124 | -// //通知客户端 | ||
| 125 | -// sendUtils.sendFcsj(mrs.sch); | ||
| 126 | -// //持久化 | ||
| 127 | -// dayOfSchedule.save(mrs.sch); | ||
| 128 | -// } | ||
| 129 | -// | ||
| 130 | -// if(inRsList.size() > 0){ | ||
| 131 | -// //排序后的第一个 就是最合适的匹配 | ||
| 132 | -// Collections.sort(inRsList, new MatchResultComparator()); | ||
| 133 | -// mrs = inRsList.get(0); | ||
| 134 | -// | ||
| 135 | -// /*if(!dayOfSchedule.validEndTime(mrs.sch, mrs.ts)){ | ||
| 136 | -// return; | ||
| 137 | -// }*/ | ||
| 138 | -// | ||
| 139 | -// mrs.sch.setZdsjActualAll(mrs.ts); | ||
| 140 | -// int doneSum = dayOfSchedule.doneSum(mrs.sch.getClZbh()); | ||
| 141 | -// ScheduleRealInfo next = dayOfSchedule.next(mrs.sch); | ||
| 142 | -// if(null != next){ | ||
| 143 | -// next.setQdzArrDateSJ(mrs.sch.getZdsjActual()); | ||
| 144 | -// //下发调度指令 | ||
| 145 | -// directiveService.send60Dispatch(next, doneSum, "系统"); | ||
| 146 | -// } | ||
| 147 | -// else{ | ||
| 148 | -// //下发文本指令(已结束运营) | ||
| 149 | -// directiveService.send60Phrase(nbbm, "到达终点 " + mrs.sch.getZdzName() + ",已完成当日所有排班。", "系统"); | ||
| 150 | -// } | ||
| 151 | -// //通知客户端 | ||
| 152 | -// sendUtils.sendZdsj(mrs.sch, next, doneSum); | ||
| 153 | -// //持久化 | ||
| 154 | -// dayOfSchedule.save(mrs.sch); | ||
| 155 | -// } | ||
| 156 | -// } | ||
| 157 | -// | ||
| 158 | -// public MatchResult match(ArrivalEntity arr, ScheduleRealInfo sch){ | ||
| 159 | -// MatchResult mrs = new MatchResult(); | ||
| 160 | -// mrs.inOut = arr.getInOut(); | ||
| 161 | -// mrs.sch = sch; | ||
| 162 | -// mrs.ts = arr.getTs(); | ||
| 163 | -// | ||
| 164 | -// if(Integer.parseInt(sch.getXlDir()) != arr.getUpDown()){ | ||
| 165 | -// return mrs; | ||
| 166 | -// } | ||
| 167 | -// | ||
| 168 | -// if(arr.getInOut() == 1){ | ||
| 169 | -// if(sch.getFcsjActual() == null | ||
| 170 | -// && sch.getQdzCode().equals(arr.getStopNo()) | ||
| 171 | -// && dayOfSchedule.validStartTime(sch, arr.getTs())){ | ||
| 172 | -// | ||
| 173 | -// mrs.diff = arr.getTs() - sch.getDfsjT(); | ||
| 174 | -// if(Math.abs(mrs.diff) < MAX_RANGE) | ||
| 175 | -// mrs.success = true; | ||
| 176 | -// } | ||
| 177 | -// } | ||
| 178 | -// else if(arr.getInOut() == 0 && sch.getZdsj() != null){ | ||
| 179 | -// if(sch.getZdsjActual() == null | ||
| 180 | -// && sch.getZdzCode().equals(arr.getStopNo()) | ||
| 181 | -// && dayOfSchedule.validEndTime(sch, arr.getTs())){ | ||
| 182 | -// | ||
| 183 | -// mrs.diff = arr.getTs() - sch.getZdsjT(); | ||
| 184 | -// if(Math.abs(mrs.diff) < MAX_RANGE) | ||
| 185 | -// mrs.success = true; | ||
| 186 | -// } | ||
| 187 | -// } | ||
| 188 | -// | ||
| 189 | -// return mrs; | ||
| 190 | -// } | ||
| 191 | -// | ||
| 192 | -// /** | ||
| 193 | -// * | ||
| 194 | -// * @Title: lastMatchPoint | ||
| 195 | -// * @Description: TODO(最后一个已实发的班次索引) | ||
| 196 | -// */ | ||
| 197 | -// public int lastMatchPoint(List<ScheduleRealInfo> schList){ | ||
| 198 | -// int len = schList.size() | ||
| 199 | -// ,rs = 0; | ||
| 200 | -// | ||
| 201 | -// ScheduleRealInfo sch; | ||
| 202 | -// for(int i = len - 2; i >= 0; i --){ | ||
| 203 | -// sch = schList.get(i); | ||
| 204 | -// if(sch.getFcsjActual() != null){ | ||
| 205 | -// rs = i; | ||
| 206 | -// if(sch.getStatus() == 2) | ||
| 207 | -// rs ++; | ||
| 208 | -// break; | ||
| 209 | -// } | ||
| 210 | -// } | ||
| 211 | -// return rs; | ||
| 212 | -// } | ||
| 213 | -// | ||
| 214 | -// public long lastMatchTime(ScheduleRealInfo sch){ | ||
| 215 | -// Long t = 0L; | ||
| 216 | -// if(null != sch.getFcsjActualTime()) | ||
| 217 | -// t = sch.getFcsjActualTime(); | ||
| 218 | -// if(null != sch.getZdsjActualTime()) | ||
| 219 | -// t = sch.getZdsjActualTime(); | ||
| 220 | -// return t; | ||
| 221 | -// } | ||
| 222 | -// | ||
| 223 | -// /** | ||
| 224 | -// * | ||
| 225 | -// * @Title: afterByTime | ||
| 226 | -// * @Description: TODO(参数时间戳之后的起始索引) | ||
| 227 | -// */ | ||
| 228 | -// public int afterByTime(List<ArrivalEntity> arrList, long t){ | ||
| 229 | -// int len = arrList.size() | ||
| 230 | -// ,rs = len - 1; | ||
| 231 | -// | ||
| 232 | -// for(int i = 0; i < len; i ++){ | ||
| 233 | -// if(arrList.get(i).getTs() > t){ | ||
| 234 | -// rs = i; | ||
| 235 | -// break; | ||
| 236 | -// } | ||
| 237 | -// } | ||
| 238 | -// return rs; | ||
| 239 | -// } | ||
| 240 | -// } | ||
| 241 | -// | ||
| 242 | -// @Override | ||
| 243 | -// public void setApplicationContext(ApplicationContext arg0) throws BeansException { | ||
| 244 | -// sendUtils = arg0.getBean(SendUtils.class); | ||
| 245 | -// dayOfSchedule = arg0.getBean(DayOfSchedule.class); | ||
| 246 | -// directiveService = arg0.getBean(DirectiveService.class); | ||
| 247 | -// } | ||
| 248 | -//} |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| 1 | package com.bsth.data.schedule; | 1 | package com.bsth.data.schedule; |
| 2 | 2 | ||
| 3 | import java.text.ParseException; | 3 | import java.text.ParseException; |
| 4 | +import java.text.SimpleDateFormat; | ||
| 4 | import java.util.ArrayList; | 5 | import java.util.ArrayList; |
| 5 | import java.util.Collection; | 6 | import java.util.Collection; |
| 6 | import java.util.Collections; | 7 | import java.util.Collections; |
| @@ -23,8 +24,11 @@ import org.springframework.stereotype.Component; | @@ -23,8 +24,11 @@ import org.springframework.stereotype.Component; | ||
| 23 | import com.alibaba.fastjson.JSON; | 24 | import com.alibaba.fastjson.JSON; |
| 24 | import com.alibaba.fastjson.JSONArray; | 25 | import com.alibaba.fastjson.JSONArray; |
| 25 | import com.bsth.Application; | 26 | import com.bsth.Application; |
| 27 | +import com.bsth.data.BasicData; | ||
| 26 | import com.bsth.data.LineConfigData; | 28 | import com.bsth.data.LineConfigData; |
| 27 | import com.bsth.data.directive.FirstScheduleCheckThread; | 29 | import com.bsth.data.directive.FirstScheduleCheckThread; |
| 30 | +import com.bsth.data.gpsdata.GpsEntity; | ||
| 31 | +import com.bsth.data.gpsdata.GpsRealData; | ||
| 28 | import com.bsth.data.schedule.thread.ScheduleLateThread; | 32 | import com.bsth.data.schedule.thread.ScheduleLateThread; |
| 29 | import com.bsth.data.schedule.thread.SchedulePstThread; | 33 | import com.bsth.data.schedule.thread.SchedulePstThread; |
| 30 | import com.bsth.data.schedule.thread.ScheduleRefreshThread; | 34 | import com.bsth.data.schedule.thread.ScheduleRefreshThread; |
| @@ -60,6 +64,9 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -60,6 +64,9 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 60 | 64 | ||
| 61 | // 车辆和排班起终点站对照(包括进出的停车场,区间起终点) | 65 | // 车辆和排班起终点站对照(包括进出的停车场,区间起终点) |
| 62 | private static TreeMultimap<String, String> nbbm2SEStationMap; | 66 | private static TreeMultimap<String, String> nbbm2SEStationMap; |
| 67 | + | ||
| 68 | + //车辆 ——> 当前执行班次 | ||
| 69 | + private static Map<String, ScheduleRealInfo> carExecutePlanMap; | ||
| 63 | 70 | ||
| 64 | // 持久化缓冲区 | 71 | // 持久化缓冲区 |
| 65 | public static LinkedList<ScheduleRealInfo> pstBuffer; | 72 | public static LinkedList<ScheduleRealInfo> pstBuffer; |
| @@ -81,6 +88,9 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -81,6 +88,9 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 81 | 88 | ||
| 82 | @Autowired | 89 | @Autowired |
| 83 | SendUtils sendUtils; | 90 | SendUtils sendUtils; |
| 91 | + | ||
| 92 | + @Autowired | ||
| 93 | + GpsRealData gpsRealData; | ||
| 84 | 94 | ||
| 85 | /** 线路当前使用的排班的日期 */ | 95 | /** 线路当前使用的排班的日期 */ |
| 86 | public static Map<String, String> currSchDateMap; | 96 | public static Map<String, String> currSchDateMap; |
| @@ -92,6 +102,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -92,6 +102,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 92 | schFCSJComparator = new ScheduleComparator.FCSJ(); | 102 | schFCSJComparator = new ScheduleComparator.FCSJ(); |
| 93 | currSchDateMap = new HashMap<>(); | 103 | currSchDateMap = new HashMap<>(); |
| 94 | nbbm2SEStationMap = TreeMultimap.create(); | 104 | nbbm2SEStationMap = TreeMultimap.create(); |
| 105 | + carExecutePlanMap = new HashMap<>(); | ||
| 95 | } | 106 | } |
| 96 | 107 | ||
| 97 | @Autowired | 108 | @Autowired |
| @@ -130,7 +141,9 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -130,7 +141,9 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 130 | public String calcSchDate(String lineCode) { | 141 | public String calcSchDate(String lineCode) { |
| 131 | LineConfig conf = lineConfigData.get(lineCode); | 142 | LineConfig conf = lineConfigData.get(lineCode); |
| 132 | long ct = System.currentTimeMillis(); | 143 | long ct = System.currentTimeMillis(); |
| 133 | - String schDate = DateUtils.sdfyyyyMMdd.format(new Date(ct)); | 144 | + |
| 145 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 146 | + String schDate = sdfyyyyMMdd.format(new Date(ct)); | ||
| 134 | // 小于当天起始运营时间,则取前一天的排班 | 147 | // 小于当天起始运营时间,则取前一天的排班 |
| 135 | if (ct < conf.getCurrStartTime()) | 148 | if (ct < conf.getCurrStartTime()) |
| 136 | schDate = DateUtils.subtractDay(schDate, 1); | 149 | schDate = DateUtils.subtractDay(schDate, 1); |
| @@ -283,7 +296,10 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -283,7 +296,10 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 283 | 296 | ||
| 284 | try { | 297 | try { |
| 285 | Map<String, Object> data = new HashMap<>(); | 298 | Map<String, Object> data = new HashMap<>(); |
| 286 | - data.put("scheduleDate_eq", DateUtils.sdfyyyyMMdd.parse(schDate)); | 299 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd") |
| 300 | + ,sdfHHmm = new SimpleDateFormat("HH:mm"); | ||
| 301 | + | ||
| 302 | + data.put("scheduleDate_eq", sdfyyyyMMdd.parse(schDate)); | ||
| 287 | data.put("xlBm_eq", lineCode); | 303 | data.put("xlBm_eq", lineCode); |
| 288 | 304 | ||
| 289 | // 查询计划排班 | 305 | // 查询计划排班 |
| @@ -293,13 +309,13 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -293,13 +309,13 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 293 | realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class); | 309 | realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class); |
| 294 | 310 | ||
| 295 | for (ScheduleRealInfo sch : realList) { | 311 | for (ScheduleRealInfo sch : realList) { |
| 296 | - sch.setScheduleDateStr(DateUtils.sdfyyyyMMdd.format(sch.getScheduleDate())); | 312 | + sch.setScheduleDateStr(sdfyyyyMMdd.format(sch.getScheduleDate())); |
| 297 | sch.setRealExecDate(sch.getScheduleDateStr()); | 313 | sch.setRealExecDate(sch.getScheduleDateStr()); |
| 298 | // 计划终点时间 | 314 | // 计划终点时间 |
| 299 | if (sch.getBcsj() != null) { | 315 | if (sch.getBcsj() != null) { |
| 300 | try{ | 316 | try{ |
| 301 | - sch.setZdsjT(DateUtils.sdfHHmm.parse(sch.getFcsj()).getTime() + (sch.getBcsj() * 60 * 1000)); | ||
| 302 | - sch.setZdsj(DateUtils.sdfHHmm.format(sch.getZdsjT())); | 317 | + sch.setZdsjT(sdfHHmm.parse(sch.getFcsj()).getTime() + (sch.getBcsj() * 60 * 1000)); |
| 318 | + sch.setZdsj(sdfHHmm.format(sch.getZdsjT())); | ||
| 303 | sch.setLate(false); | 319 | sch.setLate(false); |
| 304 | }catch(ParseException pe){ | 320 | }catch(ParseException pe){ |
| 305 | logger.error("loadPlanSch... 计算终点时间失败..."); | 321 | logger.error("loadPlanSch... 计算终点时间失败..."); |
| @@ -326,10 +342,11 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -326,10 +342,11 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 326 | id = 0L; | 342 | id = 0L; |
| 327 | id++; | 343 | id++; |
| 328 | 344 | ||
| 345 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 329 | for (ScheduleRealInfo item : list) { | 346 | for (ScheduleRealInfo item : list) { |
| 330 | item.setSpId(item.getId());// 保留原始的计划ID | 347 | item.setSpId(item.getId());// 保留原始的计划ID |
| 331 | item.setId(id++);// 设置ID | 348 | item.setId(id++);// 设置ID |
| 332 | - item.setScheduleDateStr(DateUtils.sdfyyyyMMdd.format(item.getScheduleDate())); | 349 | + item.setScheduleDateStr(sdfyyyyMMdd.format(item.getScheduleDate())); |
| 333 | } | 350 | } |
| 334 | 351 | ||
| 335 | // 入库 | 352 | // 入库 |
| @@ -596,4 +613,44 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -596,4 +613,44 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 596 | public Collection<ScheduleRealInfo> findAll(){ | 613 | public Collection<ScheduleRealInfo> findAll(){ |
| 597 | return nbbmScheduleMap.values(); | 614 | return nbbmScheduleMap.values(); |
| 598 | } | 615 | } |
| 616 | + | ||
| 617 | + public void addExecPlan(ScheduleRealInfo sch){ | ||
| 618 | + carExecutePlanMap.put(sch.getClZbh(), sch); | ||
| 619 | + } | ||
| 620 | + | ||
| 621 | + public void removeExecPlan(String clzbh){ | ||
| 622 | + carExecutePlanMap.remove(clzbh); | ||
| 623 | + } | ||
| 624 | + | ||
| 625 | + public Map<String, ScheduleRealInfo> execPlamMap(){ | ||
| 626 | + return carExecutePlanMap; | ||
| 627 | + } | ||
| 628 | + | ||
| 629 | + /** | ||
| 630 | + * | ||
| 631 | + * @Title: linkToSchPlan | ||
| 632 | + * @Description: TODO(车辆关联到班次) | ||
| 633 | + */ | ||
| 634 | +/* public void linkToSchPlan(String nbbm) { | ||
| 635 | + //当前GPS状态 | ||
| 636 | + GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); | ||
| 637 | + if(null == gps) | ||
| 638 | + return; | ||
| 639 | + | ||
| 640 | + //班次集合 | ||
| 641 | + List<ScheduleRealInfo> schArr = nbbmScheduleMap.get(nbbm); | ||
| 642 | + | ||
| 643 | + for(ScheduleRealInfo sch : schArr){ | ||
| 644 | + if(sch.getStatus() == 2) | ||
| 645 | + continue; | ||
| 646 | + if(sch.isDestroy()) | ||
| 647 | + continue; | ||
| 648 | + if(!sch.getXlBm().equals(gps.getLineId()) | ||
| 649 | + || Integer.parseInt(sch.getXlDir()) != gps.getUpDown().intValue()) | ||
| 650 | + continue; | ||
| 651 | + | ||
| 652 | + addExecPlan(sch); | ||
| 653 | + break; | ||
| 654 | + } | ||
| 655 | + }*/ | ||
| 599 | } | 656 | } |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| 1 | package com.bsth.data.schedule; | 1 | package com.bsth.data.schedule; |
| 2 | 2 | ||
| 3 | import java.text.ParseException; | 3 | import java.text.ParseException; |
| 4 | +import java.text.SimpleDateFormat; | ||
| 4 | import java.util.Collections; | 5 | import java.util.Collections; |
| 5 | import java.util.Date; | 6 | import java.util.Date; |
| 6 | import java.util.List; | 7 | import java.util.List; |
| @@ -13,7 +14,6 @@ import org.springframework.stereotype.Component; | @@ -13,7 +14,6 @@ import org.springframework.stereotype.Component; | ||
| 13 | import com.bsth.data.LineConfigData; | 14 | import com.bsth.data.LineConfigData; |
| 14 | import com.bsth.entity.realcontrol.LineConfig; | 15 | import com.bsth.entity.realcontrol.LineConfig; |
| 15 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 16 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 16 | -import com.bsth.util.DateUtils; | ||
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * | 19 | * |
| @@ -48,11 +48,13 @@ public class SchAttrCalculator { | @@ -48,11 +48,13 @@ public class SchAttrCalculator { | ||
| 48 | * 早于线路开始运营时间的,加一天 | 48 | * 早于线路开始运营时间的,加一天 |
| 49 | * 如该线路 2点开始运营,2016-08-23的班次,则 2016-08-23 0:25 的班次应该调整成 2016-08-24 0:25 | 49 | * 如该线路 2点开始运营,2016-08-23的班次,则 2016-08-23 0:25 的班次应该调整成 2016-08-24 0:25 |
| 50 | */ | 50 | */ |
| 51 | - long st = DateUtils.sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + conf.getStartOpt()).getTime(); | 51 | + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm") |
| 52 | + ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 53 | + long st = sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + conf.getStartOpt()).getTime(); | ||
| 52 | if (st > sch.getFcsjT()) | 54 | if (st > sch.getFcsjT()) |
| 53 | sch.setFcsjAll(sch.getFcsjT() + DAY_TIME); | 55 | sch.setFcsjAll(sch.getFcsjT() + DAY_TIME); |
| 54 | 56 | ||
| 55 | - sch.setRealExecDate(DateUtils.sdfyyyyMMdd.format(new Date(sch.getFcsjT()))); | 57 | + sch.setRealExecDate(sdfyyyyMMdd.format(new Date(sch.getFcsjT()))); |
| 56 | } catch (Exception e) { | 58 | } catch (Exception e) { |
| 57 | logger.error("", e); | 59 | logger.error("", e); |
| 58 | } | 60 | } |
| @@ -69,11 +71,12 @@ public class SchAttrCalculator { | @@ -69,11 +71,12 @@ public class SchAttrCalculator { | ||
| 69 | // 生成时间戳 | 71 | // 生成时间戳 |
| 70 | calcTimestamp(sch); | 72 | calcTimestamp(sch); |
| 71 | 73 | ||
| 74 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | ||
| 72 | // 计划终点时间 | 75 | // 计划终点时间 |
| 73 | if (sch.getBcsj() != null) { | 76 | if (sch.getBcsj() != null) { |
| 74 | Date zdDate = new Date(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000)); | 77 | Date zdDate = new Date(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000)); |
| 75 | sch.setZdsjT(zdDate.getTime()); | 78 | sch.setZdsjT(zdDate.getTime()); |
| 76 | - sch.setZdsj(DateUtils.sdfHHmm.format(zdDate)); | 79 | + sch.setZdsj(sdfHHmm.format(zdDate)); |
| 77 | } | 80 | } |
| 78 | } catch (ParseException e) { | 81 | } catch (ParseException e) { |
| 79 | logger.error("", e); | 82 | logger.error("", e); |
| @@ -132,7 +135,8 @@ public class SchAttrCalculator { | @@ -132,7 +135,8 @@ public class SchAttrCalculator { | ||
| 132 | } | 135 | } |
| 133 | 136 | ||
| 134 | public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { | 137 | public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { |
| 135 | - sch.setFcsjT(DateUtils.sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); | 138 | + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); |
| 139 | + sch.setFcsjT(sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); | ||
| 136 | return this; | 140 | return this; |
| 137 | } | 141 | } |
| 138 | 142 |
src/main/java/com/bsth/entity/StationRoute.java
| @@ -21,7 +21,8 @@ import java.util.Date; | @@ -21,7 +21,8 @@ import java.util.Date; | ||
| 21 | @Table(name = "bsth_c_stationroute") | 21 | @Table(name = "bsth_c_stationroute") |
| 22 | @NamedEntityGraphs({ | 22 | @NamedEntityGraphs({ |
| 23 | @NamedEntityGraph(name = "stationRoute_station", attributeNodes = { | 23 | @NamedEntityGraph(name = "stationRoute_station", attributeNodes = { |
| 24 | - @NamedAttributeNode("station") | 24 | + @NamedAttributeNode("station"), |
| 25 | + @NamedAttributeNode("line") | ||
| 25 | }) | 26 | }) |
| 26 | }) | 27 | }) |
| 27 | public class StationRoute { | 28 | public class StationRoute { |
src/main/java/com/bsth/entity/forecast/Sample.java
| 1 | package com.bsth.entity.forecast; | 1 | package com.bsth.entity.forecast; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import java.text.SimpleDateFormat; | ||
| 5 | +import java.util.Date; | ||
| 6 | + | ||
| 4 | import javax.persistence.Entity; | 7 | import javax.persistence.Entity; |
| 5 | import javax.persistence.GeneratedValue; | 8 | import javax.persistence.GeneratedValue; |
| 6 | import javax.persistence.Id; | 9 | import javax.persistence.Id; |
| 7 | import javax.persistence.Table; | 10 | import javax.persistence.Table; |
| 8 | import javax.persistence.Transient; | 11 | import javax.persistence.Transient; |
| 9 | 12 | ||
| 13 | +import org.slf4j.Logger; | ||
| 14 | +import org.slf4j.LoggerFactory; | ||
| 15 | + | ||
| 16 | +import com.bsth.data.arrival.ArrivalEntity; | ||
| 17 | + | ||
| 10 | /** | 18 | /** |
| 11 | * | 19 | * |
| 12 | * @ClassName: Sample | 20 | * @ClassName: Sample |
| @@ -19,11 +27,36 @@ import javax.persistence.Transient; | @@ -19,11 +27,36 @@ import javax.persistence.Transient; | ||
| 19 | @Table(name = "bsth_forecast_sample") | 27 | @Table(name = "bsth_forecast_sample") |
| 20 | public class Sample { | 28 | public class Sample { |
| 21 | 29 | ||
| 30 | + @Transient | ||
| 31 | + static Logger logger = LoggerFactory.getLogger(Sample.class); | ||
| 32 | + | ||
| 33 | + public Sample(ArrivalEntity prve, ArrivalEntity curr) { | ||
| 34 | + //SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | ||
| 35 | + | ||
| 36 | + this.setsStation(prve.getStopNo()); | ||
| 37 | + this.seteStation(curr.getStopNo()); | ||
| 38 | + this.setsTime(prve.getTs()); | ||
| 39 | + this.seteTime(curr.getTs()); | ||
| 40 | + //this.setsDate(sdfHHmm.format(new Date(prve.getTs()))); | ||
| 41 | + //this.seteDate(sdfHHmm.format(new Date(curr.getTs()))); | ||
| 42 | + | ||
| 43 | + /*try{ | ||
| 44 | + this.setsTime(sdfHHmm.parse(this.sDate).getTime()); | ||
| 45 | + this.seteTime(sdfHHmm.parse(this.eDate).getTime()); | ||
| 46 | + }catch(Exception e){ | ||
| 47 | + logger.error("", e); | ||
| 48 | + }*/ | ||
| 49 | + Long diff = (curr.getTs() - prve.getTs()); | ||
| 50 | + this.setRunTime(Float.parseFloat(diff.toString()) / 1000 / 60); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public Sample(){} | ||
| 54 | + | ||
| 22 | @Id | 55 | @Id |
| 23 | @GeneratedValue | 56 | @GeneratedValue |
| 24 | private Long id; | 57 | private Long id; |
| 25 | 58 | ||
| 26 | - private Integer lineCode; | 59 | + private String lineCode; |
| 27 | 60 | ||
| 28 | // 开始时间 | 61 | // 开始时间 |
| 29 | private String sDate; | 62 | private String sDate; |
| @@ -135,11 +168,11 @@ public class Sample { | @@ -135,11 +168,11 @@ public class Sample { | ||
| 135 | this.runTime = runTime; | 168 | this.runTime = runTime; |
| 136 | } | 169 | } |
| 137 | 170 | ||
| 138 | - public Integer getLineCode() { | 171 | + public String getLineCode() { |
| 139 | return lineCode; | 172 | return lineCode; |
| 140 | } | 173 | } |
| 141 | 174 | ||
| 142 | - public void setLineCode(Integer lineCode) { | 175 | + public void setLineCode(String lineCode) { |
| 143 | this.lineCode = lineCode; | 176 | this.lineCode = lineCode; |
| 144 | } | 177 | } |
| 145 | 178 |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
| 1 | package com.bsth.entity.realcontrol; | 1 | package com.bsth.entity.realcontrol; |
| 2 | 2 | ||
| 3 | import java.text.ParseException; | 3 | import java.text.ParseException; |
| 4 | +import java.text.SimpleDateFormat; | ||
| 4 | import java.util.Date; | 5 | import java.util.Date; |
| 5 | import java.util.HashSet; | 6 | import java.util.HashSet; |
| 6 | import java.util.Set; | 7 | import java.util.Set; |
| @@ -137,7 +138,9 @@ public class LineConfig { | @@ -137,7 +138,9 @@ public class LineConfig { | ||
| 137 | public long getCurrStartTime() { | 138 | public long getCurrStartTime() { |
| 138 | Date d = null; | 139 | Date d = null; |
| 139 | try { | 140 | try { |
| 140 | - d = DateUtils.sdfyyyyMMddHHmm.parse(DateUtils.sdfyyyyMMdd.format(new Date()) + this.startOpt); | 141 | + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm") |
| 142 | + ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 143 | + d = sdfyyyyMMddHHmm.parse(sdfyyyyMMdd.format(new Date()) + this.startOpt); | ||
| 141 | } catch (ParseException e) { | 144 | } catch (ParseException e) { |
| 142 | e.printStackTrace(); | 145 | e.printStackTrace(); |
| 143 | } | 146 | } |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| 1 | package com.bsth.entity.realcontrol; | 1 | package com.bsth.entity.realcontrol; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.sys.SysUser; | 3 | import com.bsth.entity.sys.SysUser; |
| 4 | -import com.bsth.util.DateUtils; | ||
| 5 | import com.fasterxml.jackson.annotation.JsonIgnore; | 4 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 6 | 5 | ||
| 7 | import javax.persistence.*; | 6 | import javax.persistence.*; |
| @@ -9,6 +8,7 @@ import javax.persistence.*; | @@ -9,6 +8,7 @@ import javax.persistence.*; | ||
| 9 | import org.apache.commons.lang3.StringUtils; | 8 | import org.apache.commons.lang3.StringUtils; |
| 10 | 9 | ||
| 11 | import java.text.ParseException; | 10 | import java.text.ParseException; |
| 11 | +import java.text.SimpleDateFormat; | ||
| 12 | import java.util.Date; | 12 | import java.util.Date; |
| 13 | import java.util.HashSet; | 13 | import java.util.HashSet; |
| 14 | import java.util.Set; | 14 | import java.util.Set; |
| @@ -510,13 +510,15 @@ public class ScheduleRealInfo { | @@ -510,13 +510,15 @@ public class ScheduleRealInfo { | ||
| 510 | 510 | ||
| 511 | public void setDfsjAll(Long dfsjT) { | 511 | public void setDfsjAll(Long dfsjT) { |
| 512 | this.dfsjT = dfsjT; | 512 | this.dfsjT = dfsjT; |
| 513 | - this.dfsj = DateUtils.sdfHHmm.format(new Date(this.dfsjT)); | 513 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); |
| 514 | + this.dfsj = sdfHHmm.format(new Date(this.dfsjT)); | ||
| 514 | } | 515 | } |
| 515 | 516 | ||
| 516 | public void setDfsjAll(String dfsj) { | 517 | public void setDfsjAll(String dfsj) { |
| 517 | 518 | ||
| 518 | try { | 519 | try { |
| 519 | - this.dfsjT = DateUtils.sdfyyyyMMddHHmm.parse(this.realExecDate + dfsj).getTime(); | 520 | + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); |
| 521 | + this.dfsjT = sdfyyyyMMddHHmm.parse(this.realExecDate + dfsj).getTime(); | ||
| 520 | this.dfsj = dfsj; | 522 | this.dfsj = dfsj; |
| 521 | } catch (ParseException e) { | 523 | } catch (ParseException e) { |
| 522 | e.printStackTrace(); | 524 | e.printStackTrace(); |
| @@ -525,10 +527,11 @@ public class ScheduleRealInfo { | @@ -525,10 +527,11 @@ public class ScheduleRealInfo { | ||
| 525 | 527 | ||
| 526 | public void calcEndTime(){ | 528 | public void calcEndTime(){ |
| 527 | //计划终点时间 | 529 | //计划终点时间 |
| 530 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | ||
| 528 | if(this.getBcsj() != null){ | 531 | if(this.getBcsj() != null){ |
| 529 | Date zdDate = new Date(this.getDfsjT() + (this.getBcsj() * 60 * 1000)); | 532 | Date zdDate = new Date(this.getDfsjT() + (this.getBcsj() * 60 * 1000)); |
| 530 | this.setZdsjT(zdDate.getTime()); | 533 | this.setZdsjT(zdDate.getTime()); |
| 531 | - this.setZdsj(DateUtils.sdfHHmm.format(zdDate)); | 534 | + this.setZdsj(sdfHHmm.format(zdDate)); |
| 532 | } | 535 | } |
| 533 | } | 536 | } |
| 534 | 537 | ||
| @@ -581,7 +584,8 @@ public class ScheduleRealInfo { | @@ -581,7 +584,8 @@ public class ScheduleRealInfo { | ||
| 581 | */ | 584 | */ |
| 582 | public void setFcsjAll(String fcsj){ | 585 | public void setFcsjAll(String fcsj){ |
| 583 | try { | 586 | try { |
| 584 | - this.fcsjT = DateUtils.sdfyyyyMMddHHmm.parse(this.realExecDate + fcsj).getTime(); | 587 | + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); |
| 588 | + this.fcsjT = sdfyyyyMMddHHmm.parse(this.realExecDate + fcsj).getTime(); | ||
| 585 | this.fcsj = fcsj; | 589 | this.fcsj = fcsj; |
| 586 | } catch (ParseException e) { | 590 | } catch (ParseException e) { |
| 587 | e.printStackTrace(); | 591 | e.printStackTrace(); |
| @@ -596,7 +600,8 @@ public class ScheduleRealInfo { | @@ -596,7 +600,8 @@ public class ScheduleRealInfo { | ||
| 596 | */ | 600 | */ |
| 597 | public void setFcsjAll(Long fcsjT){ | 601 | public void setFcsjAll(Long fcsjT){ |
| 598 | this.fcsjT = fcsjT; | 602 | this.fcsjT = fcsjT; |
| 599 | - this.fcsj = DateUtils.sdfHHmm.format(new Date(fcsjT)); | 603 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); |
| 604 | + this.fcsj = sdfHHmm.format(new Date(fcsjT)); | ||
| 600 | } | 605 | } |
| 601 | 606 | ||
| 602 | /** | 607 | /** |
| @@ -607,7 +612,8 @@ public class ScheduleRealInfo { | @@ -607,7 +612,8 @@ public class ScheduleRealInfo { | ||
| 607 | */ | 612 | */ |
| 608 | public void setFcsjActualAll(String fcsjActual){ | 613 | public void setFcsjActualAll(String fcsjActual){ |
| 609 | try { | 614 | try { |
| 610 | - this.fcsjActualTime = DateUtils.sdfyyyyMMddHHmm.parse(this.realExecDate + fcsjActual).getTime(); | 615 | + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); |
| 616 | + this.fcsjActualTime = sdfyyyyMMddHHmm.parse(this.realExecDate + fcsjActual).getTime(); | ||
| 611 | this.fcsjActual = fcsjActual; | 617 | this.fcsjActual = fcsjActual; |
| 612 | 618 | ||
| 613 | calcStatus(); | 619 | calcStatus(); |
| @@ -624,7 +630,8 @@ public class ScheduleRealInfo { | @@ -624,7 +630,8 @@ public class ScheduleRealInfo { | ||
| 624 | */ | 630 | */ |
| 625 | public void setFcsjActualAll(Long t){ | 631 | public void setFcsjActualAll(Long t){ |
| 626 | this.fcsjActualTime = t; | 632 | this.fcsjActualTime = t; |
| 627 | - this.fcsjActual = DateUtils.sdfHHmm.format(new Date(t)); | 633 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); |
| 634 | + this.fcsjActual = sdfHHmm.format(new Date(t)); | ||
| 628 | 635 | ||
| 629 | //更新班次状态 | 636 | //更新班次状态 |
| 630 | calcStatus(); | 637 | calcStatus(); |
| @@ -638,7 +645,8 @@ public class ScheduleRealInfo { | @@ -638,7 +645,8 @@ public class ScheduleRealInfo { | ||
| 638 | */ | 645 | */ |
| 639 | public void setZdsjActualAll(Long t){ | 646 | public void setZdsjActualAll(Long t){ |
| 640 | this.zdsjActualTime = t; | 647 | this.zdsjActualTime = t; |
| 641 | - this.zdsjActual = DateUtils.sdfHHmm.format(new Date(t)); | 648 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); |
| 649 | + this.zdsjActual = sdfHHmm.format(new Date(t)); | ||
| 642 | 650 | ||
| 643 | //更新班次状态 | 651 | //更新班次状态 |
| 644 | calcStatus(); | 652 | calcStatus(); |
| @@ -653,7 +661,8 @@ public class ScheduleRealInfo { | @@ -653,7 +661,8 @@ public class ScheduleRealInfo { | ||
| 653 | */ | 661 | */ |
| 654 | public void setZdsjActualAll(String zdsjActual){ | 662 | public void setZdsjActualAll(String zdsjActual){ |
| 655 | try { | 663 | try { |
| 656 | - this.zdsjActualTime = DateUtils.sdfyyyyMMddHHmm.parse(this.realExecDate + zdsjActual).getTime(); | 664 | + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); |
| 665 | + this.zdsjActualTime = sdfyyyyMMddHHmm.parse(this.realExecDate + zdsjActual).getTime(); | ||
| 657 | this.zdsjActual = zdsjActual; | 666 | this.zdsjActual = zdsjActual; |
| 658 | 667 | ||
| 659 | calcStatus(); | 668 | calcStatus(); |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -6,6 +6,7 @@ import java.util.Map; | @@ -6,6 +6,7 @@ import java.util.Map; | ||
| 6 | import com.bsth.entity.schedule.CarConfigInfo; | 6 | import com.bsth.entity.schedule.CarConfigInfo; |
| 7 | import org.springframework.data.domain.Page; | 7 | import org.springframework.data.domain.Page; |
| 8 | import org.springframework.data.domain.Pageable; | 8 | import org.springframework.data.domain.Pageable; |
| 9 | +import org.springframework.data.domain.Sort; | ||
| 9 | import org.springframework.data.jpa.domain.Specification; | 10 | import org.springframework.data.jpa.domain.Specification; |
| 10 | import org.springframework.data.jpa.repository.EntityGraph; | 11 | import org.springframework.data.jpa.repository.EntityGraph; |
| 11 | import org.springframework.data.jpa.repository.Modifying; | 12 | import org.springframework.data.jpa.repository.Modifying; |
| @@ -229,8 +230,24 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -229,8 +230,24 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 229 | 230 | ||
| 230 | @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | 231 | @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) |
| 231 | @Query("select s from StationRoute s where s.destroy=0") | 232 | @Query("select s from StationRoute s where s.destroy=0") |
| 232 | - List<StationRoute> findAll2(); | 233 | + List<StationRoute> findAllEffective(); |
| 233 | 234 | ||
| 234 | - @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2") | 235 | + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) |
| 236 | + @Override | ||
| 237 | + Page<StationRoute> findAll(Specification<StationRoute> spec, Pageable pageable); | ||
| 238 | + | ||
| 239 | + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | ||
| 240 | + @Override | ||
| 241 | + List<StationRoute> findAll(Specification<StationRoute> spec); | ||
| 242 | + | ||
| 243 | + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | ||
| 244 | + @Override | ||
| 245 | + List<StationRoute> findAll(Specification<StationRoute> spec, Sort sort); | ||
| 246 | + | ||
| 247 | + | ||
| 248 | + @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2") | ||
| 235 | List<Map<String, Object>> findStations(Integer xlid, Integer xldir); | 249 | List<Map<String, Object>> findStations(Integer xlid, Integer xldir); |
| 250 | + | ||
| 251 | + @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | ||
| 252 | + List<StationRoute> findByLine(String lineCode, int updown); | ||
| 236 | } | 253 | } |
src/main/java/com/bsth/repository/forecast/SampleRepository.java
| @@ -15,5 +15,5 @@ public interface SampleRepository extends BaseRepository<Sample, Long>{ | @@ -15,5 +15,5 @@ public interface SampleRepository extends BaseRepository<Sample, Long>{ | ||
| 15 | @Transactional | 15 | @Transactional |
| 16 | @Modifying | 16 | @Modifying |
| 17 | @Query("delete Sample where lineCode=?1 and updown=?2") | 17 | @Query("delete Sample where lineCode=?1 and updown=?2") |
| 18 | - void deleteByLineAndUpdown(Integer lineCode, int updown); | 18 | + void deleteByLineAndUpdown(String lineCode, int updown); |
| 19 | } | 19 | } |
src/main/java/com/bsth/security/WebSecurityConfig.java
| @@ -13,12 +13,10 @@ import org.springframework.security.core.session.SessionRegistry; | @@ -13,12 +13,10 @@ import org.springframework.security.core.session.SessionRegistry; | ||
| 13 | import org.springframework.security.core.session.SessionRegistryImpl; | 13 | import org.springframework.security.core.session.SessionRegistryImpl; |
| 14 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | 14 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| 15 | import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; | 15 | import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; |
| 16 | -import org.springframework.security.web.authentication.logout.LogoutHandler; | ||
| 17 | import org.springframework.security.web.session.HttpSessionEventPublisher; | 16 | import org.springframework.security.web.session.HttpSessionEventPublisher; |
| 18 | 17 | ||
| 19 | import com.bsth.common.Constants; | 18 | import com.bsth.common.Constants; |
| 20 | import com.bsth.security.filter.LoginInterceptor; | 19 | import com.bsth.security.filter.LoginInterceptor; |
| 21 | -import com.bsth.security.handler.CustomLogoutHandler; | ||
| 22 | 20 | ||
| 23 | @Configuration | 21 | @Configuration |
| 24 | @EnableWebSecurity | 22 | @EnableWebSecurity |
| @@ -59,7 +57,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -59,7 +57,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 59 | //.failureUrl(Constants.LOGIN_PAGE + "?error=true")登录失败跳转的链接 | 57 | //.failureUrl(Constants.LOGIN_PAGE + "?error=true")登录失败跳转的链接 |
| 60 | //.successHandler(loginSuccessHandler())登录成功后处理 | 58 | //.successHandler(loginSuccessHandler())登录成功后处理 |
| 61 | .and().logout() | 59 | .and().logout() |
| 62 | - .addLogoutHandler(logoutHandler()) | 60 | + //.addLogoutHandler(logoutHandler()) |
| 63 | //禁用CXRF | 61 | //禁用CXRF |
| 64 | .and().csrf().disable() | 62 | .and().csrf().disable() |
| 65 | //禁用匿名用户功能 | 63 | //禁用匿名用户功能 |
| @@ -92,10 +90,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -92,10 +90,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 92 | return new LoginSuccessHandler(); | 90 | return new LoginSuccessHandler(); |
| 93 | }*/ | 91 | }*/ |
| 94 | 92 | ||
| 95 | - @Bean | 93 | +/* @Bean |
| 96 | public LogoutHandler logoutHandler(){ | 94 | public LogoutHandler logoutHandler(){ |
| 97 | return new CustomLogoutHandler(); | 95 | return new CustomLogoutHandler(); |
| 98 | - } | 96 | + }*/ |
| 99 | 97 | ||
| 100 | @Bean | 98 | @Bean |
| 101 | public SessionRegistry sessionRegistry() { | 99 | public SessionRegistry sessionRegistry() { |
src/main/java/com/bsth/security/handler/CustomLogoutHandler.java
| 1 | -package com.bsth.security.handler; | ||
| 2 | - | ||
| 3 | -import javax.servlet.http.HttpServletRequest; | ||
| 4 | -import javax.servlet.http.HttpServletResponse; | ||
| 5 | - | ||
| 6 | -import org.springframework.security.core.Authentication; | ||
| 7 | -import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; | ||
| 8 | - | ||
| 9 | -import com.bsth.entity.sys.SysUser; | ||
| 10 | - | ||
| 11 | -public class CustomLogoutHandler extends SecurityContextLogoutHandler{ | ||
| 12 | - | ||
| 13 | - @Override | ||
| 14 | - public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { | ||
| 15 | - SysUser user = (SysUser) authentication.getPrincipal(); | ||
| 16 | - System.out.println(user.getName() + "注销..."); | ||
| 17 | - //日志记录 | ||
| 18 | - | ||
| 19 | - super.logout(request, response, authentication); | ||
| 20 | - } | ||
| 21 | -} | 1 | +//package com.bsth.security.handler; |
| 2 | +// | ||
| 3 | +//import javax.servlet.http.HttpServletRequest; | ||
| 4 | +//import javax.servlet.http.HttpServletResponse; | ||
| 5 | +// | ||
| 6 | +//import org.springframework.security.core.Authentication; | ||
| 7 | +//import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; | ||
| 8 | +// | ||
| 9 | +//import com.bsth.entity.sys.SysUser; | ||
| 10 | +// | ||
| 11 | +//public class CustomLogoutHandler extends SecurityContextLogoutHandler{ | ||
| 12 | +// | ||
| 13 | +// @Override | ||
| 14 | +// public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { | ||
| 15 | +// SysUser user = (SysUser) authentication.getPrincipal(); | ||
| 16 | +// System.out.println(user.getName() + "注销..."); | ||
| 17 | +// //日志记录 | ||
| 18 | +// | ||
| 19 | +// super.logout(request, response, authentication); | ||
| 20 | +// } | ||
| 21 | +//} |
src/main/java/com/bsth/service/directive/DirectiveService.java
| @@ -53,7 +53,7 @@ public interface DirectiveService extends BaseService<D60, Integer>{ | @@ -53,7 +53,7 @@ public interface DirectiveService extends BaseService<D60, Integer>{ | ||
| 53 | * @param @param lineId 新线路编码 | 53 | * @param @param lineId 新线路编码 |
| 54 | * @throws | 54 | * @throws |
| 55 | */ | 55 | */ |
| 56 | - int lineChange(String nbbm, Integer lineId, String sender); | 56 | + int lineChange(String nbbm, String lineId, String sender); |
| 57 | 57 | ||
| 58 | /** | 58 | /** |
| 59 | * | 59 | * |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| @@ -38,7 +38,6 @@ import com.bsth.repository.directive.D64Repository; | @@ -38,7 +38,6 @@ import com.bsth.repository.directive.D64Repository; | ||
| 38 | import com.bsth.repository.directive.D80Repository; | 38 | import com.bsth.repository.directive.D80Repository; |
| 39 | import com.bsth.security.util.SecurityUtils; | 39 | import com.bsth.security.util.SecurityUtils; |
| 40 | import com.bsth.service.impl.BaseServiceImpl; | 40 | import com.bsth.service.impl.BaseServiceImpl; |
| 41 | -import com.bsth.util.DateUtils; | ||
| 42 | import com.bsth.websocket.handler.RealControlSocketHandler; | 41 | import com.bsth.websocket.handler.RealControlSocketHandler; |
| 43 | import com.fasterxml.jackson.core.JsonProcessingException; | 42 | import com.fasterxml.jackson.core.JsonProcessingException; |
| 44 | import com.fasterxml.jackson.databind.ObjectMapper; | 43 | import com.fasterxml.jackson.databind.ObjectMapper; |
| @@ -119,7 +118,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -119,7 +118,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 119 | 118 | ||
| 120 | //下发0x02指令 调度指令(闹钟有效) | 119 | //下发0x02指令 调度指令(闹钟有效) |
| 121 | Long alarmTime = System.currentTimeMillis() + 1000 * 30; | 120 | Long alarmTime = System.currentTimeMillis() + 1000 * 30; |
| 122 | - d60 = DirectiveCreator.createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir()) | 121 | + d60 = new DirectiveCreator().createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir()) |
| 123 | , 0, new Date(alarmTime)); | 122 | , 0, new Date(alarmTime)); |
| 124 | } catch (Exception e) { | 123 | } catch (Exception e) { |
| 125 | logger.error("生成调度指令时出现异常", e); | 124 | logger.error("生成调度指令时出现异常", e); |
| @@ -193,7 +192,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -193,7 +192,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 193 | logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); | 192 | logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); |
| 194 | 193 | ||
| 195 | String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); | 194 | String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); |
| 196 | - D60 d60 = DirectiveCreator.createD60(nbbm, text, (short) 0x03, upDown, state); | 195 | + D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state); |
| 197 | 196 | ||
| 198 | if (null == d60) | 197 | if (null == d60) |
| 199 | return -1; | 198 | return -1; |
| @@ -220,10 +219,12 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -220,10 +219,12 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 220 | * 线路切换 | 219 | * 线路切换 |
| 221 | */ | 220 | */ |
| 222 | @Override | 221 | @Override |
| 223 | - public int lineChange(String nbbm, Integer lineCode, String sender) { | 222 | + public int lineChange(String nbbm, String lineCode, String sender) { |
| 223 | + DirectiveCreator crt = new DirectiveCreator(); | ||
| 224 | + | ||
| 224 | Long t = System.currentTimeMillis(); | 225 | Long t = System.currentTimeMillis(); |
| 225 | //生成64数据包 | 226 | //生成64数据包 |
| 226 | - D64 d64 = DirectiveCreator.createD64(nbbm, lineCode, t); | 227 | + D64 d64 = crt.createD64(nbbm, lineCode, t); |
| 227 | 228 | ||
| 228 | if(null != sender) | 229 | if(null != sender) |
| 229 | d64.setSender(sender); | 230 | d64.setSender(sender); |
| @@ -238,7 +239,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -238,7 +239,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 238 | 239 | ||
| 239 | // 通知设备刷新线路文件,忽略结果 | 240 | // 通知设备刷新线路文件,忽略结果 |
| 240 | if (code == 0) | 241 | if (code == 0) |
| 241 | - GatewayHttpUtils.postJson(DirectiveCreator.createDeviceRefreshData(deviceId, lineCode)); | 242 | + GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode)); |
| 242 | else | 243 | else |
| 243 | d64.setErrorText("[刷新线路文件] 网关通讯失败, code: " + code); | 244 | d64.setErrorText("[刷新线路文件] 网关通讯失败, code: " + code); |
| 244 | 245 | ||
| @@ -278,7 +279,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -278,7 +279,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 278 | state = 0; | 279 | state = 0; |
| 279 | } | 280 | } |
| 280 | 281 | ||
| 281 | - return DirectiveCreator.createD60(nbbm, text, dispatchInstruct, upDown, state); | 282 | + return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state); |
| 282 | } | 283 | } |
| 283 | 284 | ||
| 284 | @Override | 285 | @Override |
| @@ -397,10 +398,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -397,10 +398,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 397 | 398 | ||
| 398 | List<Directive> rs = list.subList(s, e); | 399 | List<Directive> rs = list.subList(s, e); |
| 399 | 400 | ||
| 401 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | ||
| 400 | // 时间格式化,车辆自编号转换 | 402 | // 时间格式化,车辆自编号转换 |
| 401 | for (Directive d : rs) { | 403 | for (Directive d : rs) { |
| 402 | if (d.getTimeHHmm() == null) | 404 | if (d.getTimeHHmm() == null) |
| 403 | - d.setTimeHHmm(DateUtils.sdfHHmm.format(new Date(d.getTimestamp()))); | 405 | + d.setTimeHHmm(sdfHHmm.format(new Date(d.getTimestamp()))); |
| 404 | if (d.getNbbm() == null) | 406 | if (d.getNbbm() == null) |
| 405 | d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId())); | 407 | d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId())); |
| 406 | } | 408 | } |
| @@ -449,9 +451,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -449,9 +451,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 449 | if (e > count) | 451 | if (e > count) |
| 450 | e = count; | 452 | e = count; |
| 451 | 453 | ||
| 454 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | ||
| 452 | List<D80> rs = d80s.subList(s, e); | 455 | List<D80> rs = d80s.subList(s, e); |
| 453 | for(D80 d80 : rs){ | 456 | for(D80 d80 : rs){ |
| 454 | - d80.setTimeStr(DateUtils.sdfHHmm.format(new Date(d80.getTimestamp()))); | 457 | + d80.setTimeStr(sdfHHmm.format(new Date(d80.getTimestamp()))); |
| 455 | } | 458 | } |
| 456 | 459 | ||
| 457 | Map<String, Object> rsMap = new HashMap<>(); | 460 | Map<String, Object> rsMap = new HashMap<>(); |
src/main/java/com/bsth/service/forecast/SampleService.java
| 1 | package com.bsth.service.forecast; | 1 | package com.bsth.service.forecast; |
| 2 | 2 | ||
| 3 | +import java.util.Map; | ||
| 4 | + | ||
| 5 | +import com.bsth.controller.forecast.dto.CreateSampleParam; | ||
| 3 | import com.bsth.entity.forecast.Sample; | 6 | import com.bsth.entity.forecast.Sample; |
| 4 | import com.bsth.service.BaseService; | 7 | import com.bsth.service.BaseService; |
| 5 | 8 | ||
| 6 | public interface SampleService extends BaseService<Sample, Long>{ | 9 | public interface SampleService extends BaseService<Sample, Long>{ |
| 7 | 10 | ||
| 8 | - int createDataByGps(String lineCode, Integer updown); | 11 | + Map<String, Object> createDataByGps(CreateSampleParam param); |
| 9 | 12 | ||
| 10 | } | 13 | } |
src/main/java/com/bsth/service/forecast/SampleServiceImpl.java
| 1 | package com.bsth.service.forecast; | 1 | package com.bsth.service.forecast; |
| 2 | 2 | ||
| 3 | +import java.text.SimpleDateFormat; | ||
| 4 | +import java.util.ArrayList; | ||
| 5 | +import java.util.Collections; | ||
| 6 | +import java.util.Comparator; | ||
| 7 | +import java.util.HashMap; | ||
| 3 | import java.util.Iterator; | 8 | import java.util.Iterator; |
| 9 | +import java.util.List; | ||
| 4 | import java.util.Map; | 10 | import java.util.Map; |
| 5 | 11 | ||
| 6 | import javax.transaction.Transactional; | 12 | import javax.transaction.Transactional; |
| 7 | 13 | ||
| 14 | +import org.slf4j.Logger; | ||
| 15 | +import org.slf4j.LoggerFactory; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 10 | 18 | ||
| 19 | +import com.bsth.common.ResponseCode; | ||
| 20 | +import com.bsth.controller.forecast.dto.CreateSampleParam; | ||
| 11 | import com.bsth.data.BasicData; | 21 | import com.bsth.data.BasicData; |
| 22 | +import com.bsth.data.arrival.ArrivalEntity; | ||
| 23 | +import com.bsth.data.arrival.DataLoader; | ||
| 12 | import com.bsth.entity.forecast.Sample; | 24 | import com.bsth.entity.forecast.Sample; |
| 13 | import com.bsth.repository.forecast.SampleRepository; | 25 | import com.bsth.repository.forecast.SampleRepository; |
| 26 | +import com.bsth.service.forecast.util.CreateByArrivalData; | ||
| 14 | import com.bsth.service.impl.BaseServiceImpl; | 27 | import com.bsth.service.impl.BaseServiceImpl; |
| 15 | 28 | ||
| 16 | @Service | 29 | @Service |
| @@ -19,10 +32,16 @@ public class SampleServiceImpl extends BaseServiceImpl<Sample, Long> implements | @@ -19,10 +32,16 @@ public class SampleServiceImpl extends BaseServiceImpl<Sample, Long> implements | ||
| 19 | @Autowired | 32 | @Autowired |
| 20 | SampleRepository sampleRepository; | 33 | SampleRepository sampleRepository; |
| 21 | 34 | ||
| 35 | + @Autowired | ||
| 36 | + CreateByArrivalData createByArrivalData; | ||
| 37 | + | ||
| 38 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 39 | + | ||
| 22 | @Override | 40 | @Override |
| 23 | public Iterable<Sample> list(Map<String, Object> map) { | 41 | public Iterable<Sample> list(Map<String, Object> map) { |
| 24 | Iterable<Sample> rs = super.list(map); | 42 | Iterable<Sample> rs = super.list(map); |
| 25 | 43 | ||
| 44 | + List<Sample> rsList = new ArrayList<>(); | ||
| 26 | //转换站点名称 | 45 | //转换站点名称 |
| 27 | Iterator<Sample> iterator = rs.iterator(); | 46 | Iterator<Sample> iterator = rs.iterator(); |
| 28 | Sample s; | 47 | Sample s; |
| @@ -30,16 +49,63 @@ public class SampleServiceImpl extends BaseServiceImpl<Sample, Long> implements | @@ -30,16 +49,63 @@ public class SampleServiceImpl extends BaseServiceImpl<Sample, Long> implements | ||
| 30 | s = iterator.next(); | 49 | s = iterator.next(); |
| 31 | s.setsName(BasicData.stationCode2NameMap.get(s.getsStation())); | 50 | s.setsName(BasicData.stationCode2NameMap.get(s.getsStation())); |
| 32 | s.seteName(BasicData.stationCode2NameMap.get(s.geteStation())); | 51 | s.seteName(BasicData.stationCode2NameMap.get(s.geteStation())); |
| 52 | + | ||
| 53 | + rsList.add(s); | ||
| 33 | } | 54 | } |
| 34 | - return rs; | 55 | + |
| 56 | + //排序 | ||
| 57 | + Collections.sort(rsList, new Comparator<Sample>() { | ||
| 58 | + @Override | ||
| 59 | + public int compare(Sample arg0, Sample arg1) { | ||
| 60 | + return arg0.geteDate().compareTo(arg1.geteDate()); | ||
| 61 | + } | ||
| 62 | + }); | ||
| 63 | + | ||
| 64 | + return rsList; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public Map<String, Object> save(Sample t) { | ||
| 69 | + if(null == t.getId()) | ||
| 70 | + t.setTag(t.getTag() + t.getsDate() + " - " + t.geteDate()); | ||
| 71 | + return super.save(t); | ||
| 35 | } | 72 | } |
| 36 | 73 | ||
| 37 | @Transactional | 74 | @Transactional |
| 38 | @Override | 75 | @Override |
| 39 | - public int createDataByGps(String lineCode, Integer updown) { | ||
| 40 | - //删除原有数据 | ||
| 41 | - sampleRepository.deleteByLineAndUpdown(Integer.parseInt(lineCode), updown); | 76 | + public Map<String, Object> createDataByGps(CreateSampleParam param) { |
| 77 | + Map<String, Object> rs = new HashMap<>(); | ||
| 78 | + try{ | ||
| 79 | + //删除原有数据 | ||
| 80 | + sampleRepository.deleteByLineAndUpdown(param.getLineCode(), param.getUpdown()); | ||
| 81 | + | ||
| 82 | + //查询到离站数据 | ||
| 83 | + DataLoader loader = new DataLoader(); | ||
| 84 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 85 | + | ||
| 86 | + long st = sdf.parse(param.getStartDate()).getTime() | ||
| 87 | + ,et = sdf.parse(param.getEndDate()).getTime() | ||
| 88 | + ,i = st | ||
| 89 | + ,range = 1000 * 60 * 60 * 24; | ||
| 90 | + | ||
| 91 | + logger.info("初始值:" + 1500 * (int)((et - st) / range)); | ||
| 92 | + List<ArrivalEntity> all = new ArrayList<>(1500 * (int)((et - st) / range)); | ||
| 93 | + for(; i < et; i += range) | ||
| 94 | + all.addAll(loader.loadByLineAndTime(param.getLineCode(), param.getUpdown() , i, i + range)); | ||
| 95 | + | ||
| 96 | + logger.info("实际数据量:" + all.size()); | ||
| 97 | + | ||
| 98 | + List<Sample> resList = createByArrivalData.create(all, param); | ||
| 99 | + | ||
| 100 | + //入库 | ||
| 101 | + sampleRepository.save(resList); | ||
| 102 | + | ||
| 103 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 104 | + }catch(Exception e){ | ||
| 105 | + logger.error("" , e); | ||
| 106 | + rs.put("status", ResponseCode.ERROR); | ||
| 107 | + } | ||
| 42 | 108 | ||
| 43 | - return 0; | 109 | + return rs; |
| 44 | } | 110 | } |
| 45 | } | 111 | } |
src/main/java/com/bsth/service/forecast/util/CreateByArrivalData.java
0 → 100644
| 1 | +package com.bsth.service.forecast.util; | ||
| 2 | + | ||
| 3 | +import java.text.DecimalFormat; | ||
| 4 | +import java.text.ParseException; | ||
| 5 | +import java.text.SimpleDateFormat; | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | +import java.util.Collections; | ||
| 8 | +import java.util.Comparator; | ||
| 9 | +import java.util.Date; | ||
| 10 | +import java.util.HashMap; | ||
| 11 | +import java.util.List; | ||
| 12 | +import java.util.Map; | ||
| 13 | +import java.util.Set; | ||
| 14 | + | ||
| 15 | +import org.slf4j.Logger; | ||
| 16 | +import org.slf4j.LoggerFactory; | ||
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 18 | +import org.springframework.context.annotation.Scope; | ||
| 19 | +import org.springframework.stereotype.Component; | ||
| 20 | + | ||
| 21 | +import com.bsth.controller.forecast.dto.CreateSampleParam; | ||
| 22 | +import com.bsth.controller.forecast.dto.CreateSampleParam.TimeRange; | ||
| 23 | +import com.bsth.data.arrival.ArrivalComparator; | ||
| 24 | +import com.bsth.data.arrival.ArrivalEntity; | ||
| 25 | +import com.bsth.entity.StationRoute; | ||
| 26 | +import com.bsth.entity.forecast.Sample; | ||
| 27 | +import com.bsth.repository.StationRouteRepository; | ||
| 28 | +import com.google.common.collect.ArrayListMultimap; | ||
| 29 | + | ||
| 30 | +/** | ||
| 31 | + * | ||
| 32 | + * @ClassName: CreateByArrivalData | ||
| 33 | + * @Description: TODO(根据到离站数据生成线路站点间耗时) | ||
| 34 | + * @author PanZhao | ||
| 35 | + * @date 2016年9月17日 下午2:33:20 | ||
| 36 | + * | ||
| 37 | + */ | ||
| 38 | +@Component | ||
| 39 | +@Scope("prototype") | ||
| 40 | +public class CreateByArrivalData { | ||
| 41 | + | ||
| 42 | + @Autowired | ||
| 43 | + StationRouteRepository routeRepository; | ||
| 44 | + | ||
| 45 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd") | ||
| 46 | + ,sdfHHmm = new SimpleDateFormat("HH:mm") | ||
| 47 | + ,sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | ||
| 48 | + | ||
| 49 | + String rq = sdfyyyyMMdd.format(new Date()); | ||
| 50 | + | ||
| 51 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * | ||
| 55 | + * @Title: create | ||
| 56 | + * @Description: TODO(到离站数据 生成站点耗时) | ||
| 57 | + * @throws | ||
| 58 | + */ | ||
| 59 | + public List<Sample> create(List<ArrivalEntity> all, CreateSampleParam param) { | ||
| 60 | + List<Sample> rs = new ArrayList<>(); | ||
| 61 | + try{ | ||
| 62 | + //路由 | ||
| 63 | + List<StationRoute> routes = routeRepository.findByLine(param.getLineCode(), param.getUpdown()); | ||
| 64 | + //按顺序索引路由 | ||
| 65 | + Map<String, Integer> rMap = new HashMap<>(); | ||
| 66 | + for(int i = 0; i < routes.size(); i ++){ | ||
| 67 | + //起点站不要 | ||
| 68 | + if(routes.get(i).getStationMark().equals("B")) | ||
| 69 | + continue; | ||
| 70 | + rMap.put(routes.get(i).getStationCode(), i); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + Collections.sort(all, new ArrivalComparator()); | ||
| 74 | + | ||
| 75 | + //所有的站点耗时数据 | ||
| 76 | + List<Sample> sampleList = calcTimeArray(rMap, all); | ||
| 77 | + //时区分组,取值 | ||
| 78 | + Set<TimeRange> rgs = param.getTimeRange(); | ||
| 79 | + | ||
| 80 | + //生成数据 | ||
| 81 | + for(TimeRange rg : rgs) | ||
| 82 | + rs.addAll(calcCenterVal(sampleList, rg, param.getUpdown())); | ||
| 83 | + }catch(Exception e){ | ||
| 84 | + logger.error("", e); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + return rs; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + private List<Sample> calcTimeArray(Map<String, Integer> rMap, List<ArrivalEntity> arrs) throws ParseException { | ||
| 91 | + | ||
| 92 | + //车辆和所在站点对照 | ||
| 93 | + Map<String, ArrivalEntity> carMap = new HashMap<>(); | ||
| 94 | + | ||
| 95 | + int size = arrs.size(); | ||
| 96 | + ArrivalEntity curr, old; | ||
| 97 | + String device; | ||
| 98 | + | ||
| 99 | + List<Sample> sampleList = new ArrayList<>(); | ||
| 100 | + Sample sample; | ||
| 101 | + for(int i = 0; i < size; i ++){ | ||
| 102 | + curr = arrs.get(i); | ||
| 103 | + device = curr.getDeviceId(); | ||
| 104 | + old = carMap.get(device); | ||
| 105 | + | ||
| 106 | + carMap.put(device, curr); | ||
| 107 | + | ||
| 108 | + if(null == old || null == rMap.get(curr.getStopNo()) | ||
| 109 | + || null == rMap.get(old.getStopNo()) | ||
| 110 | + //跨天的数据不要 | ||
| 111 | + || !sdfyyyyMMdd.format(new Date(old.getTs())).equals(sdfyyyyMMdd.format(new Date(curr.getTs())))) | ||
| 112 | + continue; | ||
| 113 | + | ||
| 114 | + //连续站点 | ||
| 115 | + if(rMap.get(curr.getStopNo()) | ||
| 116 | + - rMap.get(old.getStopNo()) == 1){ | ||
| 117 | + | ||
| 118 | + sample = new Sample(old, curr); | ||
| 119 | + //将日期全部拉到同一天 | ||
| 120 | + sample.setLineCode(old.getLineCode()); | ||
| 121 | + sample.setsTime(sdfyyyyMMddHHmm.parse(rq + sdfHHmm.format(sample.getsTime())).getTime()); | ||
| 122 | + sample.seteTime(sdfyyyyMMddHHmm.parse(rq + sdfHHmm.format(sample.geteTime())).getTime()); | ||
| 123 | + //sample.setsDate(sdfHHmm.format(new Date(sample.getsTime()))); | ||
| 124 | + //sample.seteDate(sdfHHmm.format(new Date(sample.geteTime()))); | ||
| 125 | + sampleList.add(sample); | ||
| 126 | + | ||
| 127 | + } | ||
| 128 | + carMap.put(device, curr); | ||
| 129 | + } | ||
| 130 | + return sampleList; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + | ||
| 134 | + private List<Sample> calcCenterVal(List<Sample> all, TimeRange rg, Integer updown){ | ||
| 135 | + List<Sample> subList = new ArrayList<>() | ||
| 136 | + ,rsList = new ArrayList<>(); | ||
| 137 | + | ||
| 138 | + try{ | ||
| 139 | + Collections.sort(all, new SampleComp2()); | ||
| 140 | + //按时区分组数据 | ||
| 141 | + long st = sdfyyyyMMddHHmm.parse(rq + rg.getS()).getTime() | ||
| 142 | + ,et = sdfyyyyMMddHHmm.parse(rq + rg.getE()).getTime(); | ||
| 143 | + for(Sample s : all){ | ||
| 144 | + if(s.geteTime() > st && s.geteTime() < et) | ||
| 145 | + subList.add(s); | ||
| 146 | + else if(s.geteTime() > et) | ||
| 147 | + break; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + //按站点分组数据 | ||
| 151 | + ArrayListMultimap<String, Sample> arrMap = ArrayListMultimap.create(); | ||
| 152 | + for(Sample s : subList) | ||
| 153 | + arrMap.put(s.getsStation() + "_" + s.geteStation(), s); | ||
| 154 | + | ||
| 155 | + //每个站点间取出一个占比最大的数值 | ||
| 156 | + Set<String> keys = arrMap.keySet(); | ||
| 157 | + Sample sample; | ||
| 158 | + for(String k : keys){ | ||
| 159 | + sample = maxRatioVal(arrMap.get(k)); | ||
| 160 | + | ||
| 161 | + sample.setTag(rg.getTag() + rg.getS() + " - " + rg.getE()); | ||
| 162 | + sample.setsDate(rg.getS()); | ||
| 163 | + sample.seteDate(rg.getE()); | ||
| 164 | + sample.setUpdown(updown); | ||
| 165 | + rsList.add(sample); | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + }catch(Exception e){ | ||
| 169 | + logger.error("", e); | ||
| 170 | + } | ||
| 171 | + return rsList; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + /** | ||
| 175 | + * | ||
| 176 | + * @Title: maxRatioVal | ||
| 177 | + * @Description: TODO(从一组数值中取出占比最大的值) | ||
| 178 | + */ | ||
| 179 | + public Sample maxRatioVal(List<Sample> list){ | ||
| 180 | + //StringBuilder valStr = new StringBuilder(); | ||
| 181 | + if(list.size() == 0) | ||
| 182 | + return null; | ||
| 183 | + //排序 | ||
| 184 | + Collections.sort(list, new SampleComp()); | ||
| 185 | + | ||
| 186 | + ArrayListMultimap<String, Sample> arrMap = ArrayListMultimap.create(); | ||
| 187 | + //1.5分钟范围分组 | ||
| 188 | + int range = 15 | ||
| 189 | + ,curr = (int)(list.get(0).getRunTime() * 10); | ||
| 190 | + | ||
| 191 | + for(Sample s : list){ | ||
| 192 | + if(s.getRunTime() * 10 > curr + range){ | ||
| 193 | + curr += range; | ||
| 194 | + } | ||
| 195 | + arrMap.put(curr + "_" + curr + range, s); | ||
| 196 | + //valStr.append(s.getRunTime() + ","); | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + //数值最多的分组,求个平均值 | ||
| 200 | + String maxKey = maxKey(arrMap); | ||
| 201 | + float absVal = abs(arrMap.get(maxKey)); | ||
| 202 | + | ||
| 203 | + Sample rs = list.get(0); | ||
| 204 | + | ||
| 205 | + DecimalFormat dformat=new DecimalFormat(".00"); | ||
| 206 | + rs.setRunTime(Float.parseFloat(dformat.format(absVal))); | ||
| 207 | + | ||
| 208 | + //logger.info("全部:[ " + valStr + "] ,计算的中间值:" + absVal); | ||
| 209 | + return rs; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + private String maxKey(ArrayListMultimap<String, Sample> arrMap){ | ||
| 213 | + String maxKey = null; | ||
| 214 | + int size = 0; | ||
| 215 | + Set<String> kys = arrMap.keySet(); | ||
| 216 | + for(String k : kys){ | ||
| 217 | + if(null != maxKey && arrMap.get(k).size() < size) | ||
| 218 | + continue; | ||
| 219 | + | ||
| 220 | + size = arrMap.get(k).size(); | ||
| 221 | + maxKey = k; | ||
| 222 | + } | ||
| 223 | + return maxKey; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + private float abs(List<Sample> list){ | ||
| 227 | + float sum = 0; | ||
| 228 | + | ||
| 229 | + for(Sample s : list) | ||
| 230 | + sum += s.getRunTime(); | ||
| 231 | + | ||
| 232 | + return sum / list.size(); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + public static class SampleComp implements Comparator<Sample>{ | ||
| 236 | + | ||
| 237 | + @Override | ||
| 238 | + public int compare(Sample arg0, Sample arg1) { | ||
| 239 | + return (int)(arg0.getRunTime() * 10 - arg1.getRunTime() * 10); | ||
| 240 | + } | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public static class SampleComp2 implements Comparator<Sample>{ | ||
| 244 | + | ||
| 245 | + @Override | ||
| 246 | + public int compare(Sample arg0, Sample arg1) { | ||
| 247 | + return (int)(arg0.geteTime() - arg1.geteTime()); | ||
| 248 | + } | ||
| 249 | + } | ||
| 250 | +} |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -80,7 +80,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -80,7 +80,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 80 | 80 | ||
| 81 | Map<String, Object> outgoAdjustAll(String params); | 81 | Map<String, Object> outgoAdjustAll(String params); |
| 82 | 82 | ||
| 83 | - Map<String, Object> findRouteByLine(Integer lineCode); | 83 | + Map<String, Object> findRouteByLine(String lineCode); |
| 84 | 84 | ||
| 85 | List<Map<String,String>> findLine(String line); | 85 | List<Map<String,String>> findLine(String line); |
| 86 | 86 |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -310,8 +310,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -310,8 +310,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 310 | SysUser user = SecurityUtils.getCurrentUser(); | 310 | SysUser user = SecurityUtils.getCurrentUser(); |
| 311 | String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); | 311 | String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); |
| 312 | 312 | ||
| 313 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 313 | t.setScheduleDateStr(schDate); | 314 | t.setScheduleDateStr(schDate); |
| 314 | - t.setScheduleDate(DateUtils.sdfyyyyMMdd.parse(schDate)); | 315 | + t.setScheduleDate(sdfyyyyMMdd.parse(schDate)); |
| 315 | t.setRealExecDate(schDate); | 316 | t.setRealExecDate(schDate); |
| 316 | t.setCreateBy(user); | 317 | t.setCreateBy(user); |
| 317 | t.setSflj(true); | 318 | t.setSflj(true); |
| @@ -899,7 +900,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -899,7 +900,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 899 | } | 900 | } |
| 900 | 901 | ||
| 901 | @Override | 902 | @Override |
| 902 | - public Map<String, Object> findRouteByLine(Integer lineCode) { | 903 | + public Map<String, Object> findRouteByLine(String lineCode) { |
| 903 | Map<String, Object> map = new HashMap<>(); | 904 | Map<String, Object> map = new HashMap<>(); |
| 904 | //上行 | 905 | //上行 |
| 905 | Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode); | 906 | Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode); |
src/main/java/com/bsth/util/DateUtils.java
| @@ -96,7 +96,7 @@ public class DateUtils { | @@ -96,7 +96,7 @@ public class DateUtils { | ||
| 96 | return (int) (cal.getTimeInMillis() / 1000); | 96 | return (int) (cal.getTimeInMillis() / 1000); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | - public static SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm") | 99 | + private static SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm") |
| 100 | ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd") | 100 | ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd") |
| 101 | ,sdfHHmm = new SimpleDateFormat("HH:mm"); | 101 | ,sdfHHmm = new SimpleDateFormat("HH:mm"); |
| 102 | public static long getTimesByHHmm(String str) throws ParseException{ | 102 | public static long getTimesByHHmm(String str) throws ParseException{ |
src/main/resources/application-dev.properties
| @@ -26,6 +26,6 @@ spring.datasource.validation-query=select 1 | @@ -26,6 +26,6 @@ spring.datasource.validation-query=select 1 | ||
| 26 | ## | 26 | ## |
| 27 | #222.66.0.204:5555 | 27 | #222.66.0.204:5555 |
| 28 | ##\u5B9E\u65F6gps | 28 | ##\u5B9E\u65F6gps |
| 29 | -http.gps.real.url= http://192.168.168.192:8080/transport_server/rtgps/ | 29 | +http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/ |
| 30 | ##\u6D88\u606F\u4E0B\u53D1 | 30 | ##\u6D88\u606F\u4E0B\u53D1 |
| 31 | -http.send.directive = http://192.168.168.192:8080/transport_server/message/ | ||
| 32 | \ No newline at end of file | 31 | \ No newline at end of file |
| 32 | +http.send.directive = http://192.168.168.201:9090/transport_server/message/ | ||
| 33 | \ No newline at end of file | 33 | \ No newline at end of file |
src/main/resources/ms-jdbc.properties
| 1 | ms.mysql.driver= com.mysql.jdbc.Driver | 1 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 2 | -ms.mysql.url= jdbc:mysql://192.168.40.82:3306/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 3 | -ms.mysql.username= root | ||
| 4 | -ms.mysql.password= 123456 | ||
| 5 | - | ||
| 6 | -#ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 | 2 | +#ms.mysql.url= jdbc:mysql://192.168.40.82:3306/ms?useUnicode=true&characterEncoding=utf-8 |
| 7 | #ms.mysql.username= root | 3 | #ms.mysql.username= root |
| 8 | -#ms.mysql.password= panzhao | 4 | +#ms.mysql.password= 123456 |
| 5 | + | ||
| 6 | +ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 7 | +ms.mysql.username= root | ||
| 8 | +ms.mysql.password= panzhao |
src/main/resources/static/assets/plugins/jquery.base64.min.js deleted
100644 → 0
| 1 | -"use strict";jQuery.base64=(function($){var _PADCHAR="=",_ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_VERSION="1.0";function _getbyte64(s,i){var idx=_ALPHA.indexOf(s.charAt(i));if(idx===-1){throw"Cannot decode base64"}return idx}function _decode(s){var pads=0,i,b10,imax=s.length,x=[];s=String(s);if(imax===0){return s}if(imax%4!==0){throw"Cannot decode base64"}if(s.charAt(imax-1)===_PADCHAR){pads=1;if(s.charAt(imax-2)===_PADCHAR){pads=2}imax-=4}for(i=0;i<imax;i+=4){b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6)|_getbyte64(s,i+3);x.push(String.fromCharCode(b10>>16,(b10>>8)&255,b10&255))}switch(pads){case 1:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6);x.push(String.fromCharCode(b10>>16,(b10>>8)&255));break;case 2:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12);x.push(String.fromCharCode(b10>>16));break}return x.join("")}function _getbyte(s,i){var x=s.charCodeAt(i);if(x>255){throw"INVALID_CHARACTER_ERR: DOM Exception 5"}return x}function _encode(s){if(arguments.length!==1){throw"SyntaxError: exactly one argument required"}s=String(s);var i,b10,x=[],imax=s.length-s.length%3;if(s.length===0){return s}for(i=0;i<imax;i+=3){b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8)|_getbyte(s,i+2);x.push(_ALPHA.charAt(b10>>18));x.push(_ALPHA.charAt((b10>>12)&63));x.push(_ALPHA.charAt((b10>>6)&63));x.push(_ALPHA.charAt(b10&63))}switch(s.length-imax){case 1:b10=_getbyte(s,i)<<16;x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_PADCHAR+_PADCHAR);break;case 2:b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8);x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_ALPHA.charAt((b10>>6)&63)+_PADCHAR);break}return x.join("")}return{decode:_decode,encode:_encode,VERSION:_VERSION}}(jQuery)); | ||
| 2 | \ No newline at end of file | 0 | \ No newline at end of file |
src/main/resources/static/assets/plugins/jsencrypt.min.js
0 → 100644
| 1 | +/*! JSEncrypt v2.3.1 | https://npmcdn.com/jsencrypt@2.3.1/LICENSE.txt */ | ||
| 2 | +!function(t,e){"function"==typeof define&&define.amd?define(["exports"],e):e("object"==typeof exports&&"string"!=typeof exports.nodeName?module.exports:t)}(this,function(t){function e(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function i(){return new e(null)}function r(t,e,i,r,s,n){for(;--n>=0;){var o=e*this[t++]+i[r]+s;s=Math.floor(o/67108864),i[r++]=67108863&o}return s}function s(t,e,i,r,s,n){for(var o=32767&e,h=e>>15;--n>=0;){var a=32767&this[t],u=this[t++]>>15,c=h*a+u*o;a=o*a+((32767&c)<<15)+i[r]+(1073741823&s),s=(a>>>30)+(c>>>15)+h*u+(s>>>30),i[r++]=1073741823&a}return s}function n(t,e,i,r,s,n){for(var o=16383&e,h=e>>14;--n>=0;){var a=16383&this[t],u=this[t++]>>14,c=h*a+u*o;a=o*a+((16383&c)<<14)+i[r]+s,s=(a>>28)+(c>>14)+h*u,i[r++]=268435455&a}return s}function o(t){return Be.charAt(t)}function h(t,e){var i=Ke[t.charCodeAt(e)];return null==i?-1:i}function a(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function u(t){this.t=1,this.s=0>t?-1:0,t>0?this[0]=t:-1>t?this[0]=t+this.DV:this.t=0}function c(t){var e=i();return e.fromInt(t),e}function f(t,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(t,i);r=2}this.t=0,this.s=0;for(var s=t.length,n=!1,o=0;--s>=0;){var a=8==r?255&t[s]:h(t,s);0>a?"-"==t.charAt(s)&&(n=!0):(n=!1,0==o?this[this.t++]=a:o+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,o+=r,o>=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&e.ZERO.subTo(this,this)}function p(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function l(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,r=(1<<e)-1,s=!1,n="",h=this.t,a=this.DB-h*this.DB%e;if(h-- >0)for(a<this.DB&&(i=this[h]>>a)>0&&(s=!0,n=o(i));h>=0;)e>a?(i=(this[h]&(1<<a)-1)<<e-a,i|=this[--h]>>(a+=this.DB-e)):(i=this[h]>>(a-=e)&r,0>=a&&(a+=this.DB,--h)),i>0&&(s=!0),s&&(n+=o(i));return s?n:"0"}function d(){var t=i();return e.ZERO.subTo(this,t),t}function g(){return this.s<0?this.negate():this}function m(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(e=i-t.t,0!=e)return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0}function y(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function b(){return this.t<=0?0:this.DB*(this.t-1)+y(this[this.t-1]^this.s&this.DM)}function T(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function S(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s}function R(t,e){var i,r=t%this.DB,s=this.DB-r,n=(1<<s)-1,o=Math.floor(t/this.DB),h=this.s<<r&this.DM;for(i=this.t-1;i>=0;--i)e[i+o+1]=this[i]>>s|h,h=(this[i]&n)<<r;for(i=o-1;i>=0;--i)e[i]=0;e[o]=h,e.t=this.t+o+1,e.s=this.s,e.clamp()}function E(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)return void(e.t=0);var r=t%this.DB,s=this.DB-r,n=(1<<r)-1;e[0]=this[i]>>r;for(var o=i+1;o<this.t;++o)e[o-i-1]|=(this[o]&n)<<s,e[o-i]=this[o]>>r;r>0&&(e[this.t-i-1]|=(this.s&n)<<s),e.t=this.t-i,e.clamp()}function D(t,e){for(var i=0,r=0,s=Math.min(t.t,this.t);s>i;)r+=this[i]-t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r-=t[i],e[i++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=0>r?-1:0,-1>r?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()}function w(t,i){var r=this.abs(),s=t.abs(),n=r.t;for(i.t=n+s.t;--n>=0;)i[n]=0;for(n=0;n<s.t;++n)i[n+r.t]=r.am(0,s[n],i,n,0,r.t);i.s=0,i.clamp(),this.s!=t.s&&e.ZERO.subTo(i,i)}function x(t){for(var e=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){var r=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,r,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()}function B(t,r,s){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=r&&r.fromInt(0),void(null!=s&&this.copyTo(s));null==s&&(s=i());var h=i(),a=this.s,u=t.s,c=this.DB-y(n[n.t-1]);c>0?(n.lShiftTo(c,h),o.lShiftTo(c,s)):(n.copyTo(h),o.copyTo(s));var f=h.t,p=h[f-1];if(0!=p){var l=p*(1<<this.F1)+(f>1?h[f-2]>>this.F2:0),d=this.FV/l,g=(1<<this.F1)/l,m=1<<this.F2,v=s.t,b=v-f,T=null==r?i():r;for(h.dlShiftTo(b,T),s.compareTo(T)>=0&&(s[s.t++]=1,s.subTo(T,s)),e.ONE.dlShiftTo(f,T),T.subTo(h,h);h.t<f;)h[h.t++]=0;for(;--b>=0;){var S=s[--v]==p?this.DM:Math.floor(s[v]*d+(s[v-1]+m)*g);if((s[v]+=h.am(0,S,s,b,0,f))<S)for(h.dlShiftTo(b,T),s.subTo(T,s);s[v]<--S;)s.subTo(T,s)}null!=r&&(s.drShiftTo(f,r),a!=u&&e.ZERO.subTo(r,r)),s.t=f,s.clamp(),c>0&&s.rShiftTo(c,s),0>a&&e.ZERO.subTo(s,s)}}}function K(t){var r=i();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(e.ZERO)>0&&t.subTo(r,r),r}function A(t){this.m=t}function U(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function O(t){return t}function V(t){t.divRemTo(this.m,null,t)}function N(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function J(t,e){t.squareTo(e),this.reduce(e)}function I(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function P(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function M(t){var r=i();return t.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),t.s<0&&r.compareTo(e.ZERO)>0&&this.m.subTo(r,r),r}function L(t){var e=i();return t.copyTo(e),this.reduce(e),e}function q(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=32767&t[e],r=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(i=e+this.m.t,t[i]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function C(t,e){t.squareTo(e),this.reduce(e)}function H(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function j(){return 0==(this.t>0?1&this[0]:this.s)}function k(t,r){if(t>4294967295||1>t)return e.ONE;var s=i(),n=i(),o=r.convert(this),h=y(t)-1;for(o.copyTo(s);--h>=0;)if(r.sqrTo(s,n),(t&1<<h)>0)r.mulTo(n,o,s);else{var a=s;s=n,n=a}return r.revert(s)}function F(t,e){var i;return i=256>t||e.isEven()?new A(e):new P(e),this.exp(t,i)} | ||
| 3 | +// Copyright (c) 2005-2009 Tom Wu | ||
| 4 | +// All Rights Reserved. | ||
| 5 | +// See "LICENSE" for details. | ||
| 6 | +function _(){var t=i();return this.copyTo(t),t}function z(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Z(){return 0==this.t?this.s:this[0]<<24>>24}function G(){return 0==this.t?this.s:this[0]<<16>>16}function $(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function Y(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function W(t){if(null==t&&(t=10),0==this.signum()||2>t||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),s=c(r),n=i(),o=i(),h="";for(this.divRemTo(s,n,o);n.signum()>0;)h=(r+o.intValue()).toString(t).substr(1)+h,n.divRemTo(s,n,o);return o.intValue().toString(t)+h}function Q(t,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),s=Math.pow(i,r),n=!1,o=0,a=0,u=0;u<t.length;++u){var c=h(t,u);0>c?"-"==t.charAt(u)&&0==this.signum()&&(n=!0):(a=i*a+c,++o>=r&&(this.dMultiply(s),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(i,o)),this.dAddOffset(a,0)),n&&e.ZERO.subTo(this,this)}function X(t,i,r){if("number"==typeof i)if(2>t)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),ht,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var s=new Array,n=7&t;s.length=(t>>3)+1,i.nextBytes(s),n>0?s[0]&=(1<<n)-1:s[0]=0,this.fromString(s,256)}}function tt(){var t=this.t,e=new Array;e[0]=this.s;var i,r=this.DB-t*this.DB%8,s=0;if(t-- >0)for(r<this.DB&&(i=this[t]>>r)!=(this.s&this.DM)>>r&&(e[s++]=i|this.s<<this.DB-r);t>=0;)8>r?(i=(this[t]&(1<<r)-1)<<8-r,i|=this[--t]>>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,0>=r&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==s&&(128&this.s)!=(128&i)&&++s,(s>0||i!=this.s)&&(e[s++]=i);return e}function et(t){return 0==this.compareTo(t)}function it(t){return this.compareTo(t)<0?this:t}function rt(t){return this.compareTo(t)>0?this:t}function st(t,e,i){var r,s,n=Math.min(t.t,this.t);for(r=0;n>r;++r)i[r]=e(this[r],t[r]);if(t.t<this.t){for(s=t.s&this.DM,r=n;r<this.t;++r)i[r]=e(this[r],s);i.t=this.t}else{for(s=this.s&this.DM,r=n;r<t.t;++r)i[r]=e(s,t[r]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()}function nt(t,e){return t&e}function ot(t){var e=i();return this.bitwiseTo(t,nt,e),e}function ht(t,e){return t|e}function at(t){var e=i();return this.bitwiseTo(t,ht,e),e}function ut(t,e){return t^e}function ct(t){var e=i();return this.bitwiseTo(t,ut,e),e}function ft(t,e){return t&~e}function pt(t){var e=i();return this.bitwiseTo(t,ft,e),e}function lt(){for(var t=i(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}function dt(t){var e=i();return 0>t?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function gt(t){var e=i();return 0>t?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function mt(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function yt(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+mt(this[t]);return this.s<0?this.t*this.DB:-1}function vt(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function bt(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=vt(this[i]^e);return t}function Tt(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)}function St(t,i){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,i,r),r}function Rt(t){return this.changeBit(t,ht)}function Et(t){return this.changeBit(t,ft)}function Dt(t){return this.changeBit(t,ut)}function wt(t,e){for(var i=0,r=0,s=Math.min(t.t,this.t);s>i;)r+=this[i]+t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r+=t[i],e[i++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=0>r?-1:0,r>0?e[i++]=r:-1>r&&(e[i++]=this.DV+r),e.t=i,e.clamp()}function xt(t){var e=i();return this.addTo(t,e),e}function Bt(t){var e=i();return this.subTo(t,e),e}function Kt(t){var e=i();return this.multiplyTo(t,e),e}function At(){var t=i();return this.squareTo(t),t}function Ut(t){var e=i();return this.divRemTo(t,e,null),e}function Ot(t){var e=i();return this.divRemTo(t,null,e),e}function Vt(t){var e=i(),r=i();return this.divRemTo(t,e,r),new Array(e,r)}function Nt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Jt(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function It(){}function Pt(t){return t}function Mt(t,e,i){t.multiplyTo(e,i)}function Lt(t,e){t.squareTo(e)}function qt(t){return this.exp(t,new It)}function Ct(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;r>0;)i[--r]=0;var s;for(s=i.t-this.t;s>r;++r)i[r+this.t]=this.am(0,t[r],i,r,0,this.t);for(s=Math.min(t.t,e);s>r;++r)this.am(0,t[r],i,r,0,e-r);i.clamp()}function Ht(t,e,i){--e;var r=i.t=this.t+t.t-e;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)i[this.t+r-e]=this.am(e-r,t[r],i,0,0,this.t+r-e);i.clamp(),i.drShiftTo(1,i)}function jt(t){this.r2=i(),this.q3=i(),e.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function kt(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=i();return t.copyTo(e),this.reduce(e),e}function Ft(t){return t}function _t(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function zt(t,e){t.squareTo(e),this.reduce(e)}function Zt(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function Gt(t,e){var r,s,n=t.bitLength(),o=c(1);if(0>=n)return o;r=18>n?1:48>n?3:144>n?4:768>n?5:6,s=8>n?new A(e):e.isEven()?new jt(e):new P(e);var h=new Array,a=3,u=r-1,f=(1<<r)-1;if(h[1]=s.convert(this),r>1){var p=i();for(s.sqrTo(h[1],p);f>=a;)h[a]=i(),s.mulTo(p,h[a-2],h[a]),a+=2}var l,d,g=t.t-1,m=!0,v=i();for(n=y(t[g])-1;g>=0;){for(n>=u?l=t[g]>>n-u&f:(l=(t[g]&(1<<n+1)-1)<<u-n,g>0&&(l|=t[g-1]>>this.DB+n-u)),a=r;0==(1&l);)l>>=1,--a;if((n-=a)<0&&(n+=this.DB,--g),m)h[l].copyTo(o),m=!1;else{for(;a>1;)s.sqrTo(o,v),s.sqrTo(v,o),a-=2;a>0?s.sqrTo(o,v):(d=o,o=v,v=d),s.mulTo(v,h[l],o)}for(;g>=0&&0==(t[g]&1<<n);)s.sqrTo(o,v),d=o,o=v,v=d,--n<0&&(n=this.DB-1,--g)}return s.revert(o)}function $t(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var r=e;e=i,i=r}var s=e.getLowestSetBit(),n=i.getLowestSetBit();if(0>n)return e;for(n>s&&(n=s),n>0&&(e.rShiftTo(n,e),i.rShiftTo(n,i));e.signum()>0;)(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return n>0&&i.lShiftTo(n,i),i}function Yt(t){if(0>=t)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i}function Wt(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return e.ZERO;for(var r=t.clone(),s=this.clone(),n=c(1),o=c(0),h=c(0),a=c(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),i?(n.isEven()&&o.isEven()||(n.addTo(this,n),o.subTo(t,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;s.isEven();)s.rShiftTo(1,s),i?(h.isEven()&&a.isEven()||(h.addTo(this,h),a.subTo(t,a)),h.rShiftTo(1,h)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(s)>=0?(r.subTo(s,r),i&&n.subTo(h,n),o.subTo(a,o)):(s.subTo(r,s),i&&h.subTo(n,h),a.subTo(o,a))}return 0!=s.compareTo(e.ONE)?e.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a}function Qt(t){var e,i=this.abs();if(1==i.t&&i[0]<=Ae[Ae.length-1]){for(e=0;e<Ae.length;++e)if(i[0]==Ae[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<Ae.length;){for(var r=Ae[e],s=e+1;s<Ae.length&&Ue>r;)r*=Ae[s++];for(r=i.modInt(r);s>e;)if(r%Ae[e++]==0)return!1}return i.millerRabin(t)}function Xt(t){var r=this.subtract(e.ONE),s=r.getLowestSetBit();if(0>=s)return!1;var n=r.shiftRight(s);t=t+1>>1,t>Ae.length&&(t=Ae.length);for(var o=i(),h=0;t>h;++h){o.fromInt(Ae[Math.floor(Math.random()*Ae.length)]);var a=o.modPow(n,this);if(0!=a.compareTo(e.ONE)&&0!=a.compareTo(r)){for(var u=1;u++<s&&0!=a.compareTo(r);)if(a=a.modPowInt(2,this),0==a.compareTo(e.ONE))return!1;if(0!=a.compareTo(r))return!1}}return!0}function te(){this.i=0,this.j=0,this.S=new Array}function ee(t){var e,i,r;for(e=0;256>e;++e)this.S[e]=e;for(i=0,e=0;256>e;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0}function ie(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}function re(){return new te}function se(){if(null==Oe){for(Oe=re();Je>Ne;){var t=Math.floor(65536*Math.random());Ve[Ne++]=255&t}for(Oe.init(Ve),Ne=0;Ne<Ve.length;++Ne)Ve[Ne]=0;Ne=0}return Oe.next()}function ne(t){var e;for(e=0;e<t.length;++e)t[e]=se()}function oe(){}function he(t,i){return new e(t,i)}function ae(t,i){if(i<t.length+11)return console.error("Message too long for RSA"),null;for(var r=new Array,s=t.length-1;s>=0&&i>0;){var n=t.charCodeAt(s--);128>n?r[--i]=n:n>127&&2048>n?(r[--i]=63&n|128,r[--i]=n>>6|192):(r[--i]=63&n|128,r[--i]=n>>6&63|128,r[--i]=n>>12|224)}r[--i]=0;for(var o=new oe,h=new Array;i>2;){for(h[0]=0;0==h[0];)o.nextBytes(h);r[--i]=h[0]}return r[--i]=2,r[--i]=0,new e(r)}function ue(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function ce(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=he(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")}function fe(t){return t.modPowInt(this.e,this.n)}function pe(t){var e=ae(t,this.n.bitLength()+7>>3);if(null==e)return null;var i=this.doPublic(e);if(null==i)return null;var r=i.toString(16);return 0==(1&r.length)?r:"0"+r}function le(t,e){for(var i=t.toByteArray(),r=0;r<i.length&&0==i[r];)++r;if(i.length-r!=e-1||2!=i[r])return null;for(++r;0!=i[r];)if(++r>=i.length)return null;for(var s="";++r<i.length;){var n=255&i[r];128>n?s+=String.fromCharCode(n):n>191&&224>n?(s+=String.fromCharCode((31&n)<<6|63&i[r+1]),++r):(s+=String.fromCharCode((15&n)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return s}function de(t,e,i){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=he(t,16),this.e=parseInt(e,16),this.d=he(i,16)):console.error("Invalid RSA private key")}function ge(t,e,i,r,s,n,o,h){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=he(t,16),this.e=parseInt(e,16),this.d=he(i,16),this.p=he(r,16),this.q=he(s,16),this.dmp1=he(n,16),this.dmq1=he(o,16),this.coeff=he(h,16)):console.error("Invalid RSA private key")}function me(t,i){var r=new oe,s=t>>1;this.e=parseInt(i,16);for(var n=new e(i,16);;){for(;this.p=new e(t-s,1,r),0!=this.p.subtract(e.ONE).gcd(n).compareTo(e.ONE)||!this.p.isProbablePrime(10););for(;this.q=new e(s,1,r),0!=this.q.subtract(e.ONE).gcd(n).compareTo(e.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var h=this.p.subtract(e.ONE),a=this.q.subtract(e.ONE),u=h.multiply(a);if(0==u.gcd(n).compareTo(e.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(u),this.dmp1=this.d.mod(h),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}function ye(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)}function ve(t){var e=he(t,16),i=this.doPrivate(e);return null==i?null:le(i,this.n.bitLength()+7>>3)}function be(t){var e,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),r+=Le.charAt(i>>6)+Le.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=Le.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=Le.charAt(i>>2)+Le.charAt((3&i)<<4));(3&r.length)>0;)r+=qe;return r}function Te(t){var e,i,r="",s=0;for(e=0;e<t.length&&t.charAt(e)!=qe;++e)v=Le.indexOf(t.charAt(e)),v<0||(0==s?(r+=o(v>>2),i=3&v,s=1):1==s?(r+=o(i<<2|v>>4),i=15&v,s=2):2==s?(r+=o(i),r+=o(v>>2),i=3&v,s=3):(r+=o(i<<2|v>>4),r+=o(15&v),s=0));return 1==s&&(r+=o(i<<2)),r} | ||
| 7 | +// Copyright (c) 2005 Tom Wu | ||
| 8 | +// All Rights Reserved. | ||
| 9 | +// See "LICENSE" for details. | ||
| 10 | +var Se,Re=0xdeadbeefcafe,Ee=15715070==(16777215&Re);Ee&&"Microsoft Internet Explorer"==navigator.appName?(e.prototype.am=s,Se=30):Ee&&"Netscape"!=navigator.appName?(e.prototype.am=r,Se=26):(e.prototype.am=n,Se=28),e.prototype.DB=Se,e.prototype.DM=(1<<Se)-1,e.prototype.DV=1<<Se;var De=52;e.prototype.FV=Math.pow(2,De),e.prototype.F1=De-Se,e.prototype.F2=2*Se-De;var we,xe,Be="0123456789abcdefghijklmnopqrstuvwxyz",Ke=new Array;for(we="0".charCodeAt(0),xe=0;9>=xe;++xe)Ke[we++]=xe;for(we="a".charCodeAt(0),xe=10;36>xe;++xe)Ke[we++]=xe;for(we="A".charCodeAt(0),xe=10;36>xe;++xe)Ke[we++]=xe;A.prototype.convert=U,A.prototype.revert=O,A.prototype.reduce=V,A.prototype.mulTo=N,A.prototype.sqrTo=J,P.prototype.convert=M,P.prototype.revert=L,P.prototype.reduce=q,P.prototype.mulTo=H,P.prototype.sqrTo=C,e.prototype.copyTo=a,e.prototype.fromInt=u,e.prototype.fromString=f,e.prototype.clamp=p,e.prototype.dlShiftTo=T,e.prototype.drShiftTo=S,e.prototype.lShiftTo=R,e.prototype.rShiftTo=E,e.prototype.subTo=D,e.prototype.multiplyTo=w,e.prototype.squareTo=x,e.prototype.divRemTo=B,e.prototype.invDigit=I,e.prototype.isEven=j,e.prototype.exp=k,e.prototype.toString=l,e.prototype.negate=d,e.prototype.abs=g,e.prototype.compareTo=m,e.prototype.bitLength=b,e.prototype.mod=K,e.prototype.modPowInt=F,e.ZERO=c(0),e.ONE=c(1),It.prototype.convert=Pt,It.prototype.revert=Pt,It.prototype.mulTo=Mt,It.prototype.sqrTo=Lt,jt.prototype.convert=kt,jt.prototype.revert=Ft,jt.prototype.reduce=_t,jt.prototype.mulTo=Zt,jt.prototype.sqrTo=zt;var Ae=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Ue=(1<<26)/Ae[Ae.length-1];e.prototype.chunkSize=$,e.prototype.toRadix=W,e.prototype.fromRadix=Q,e.prototype.fromNumber=X,e.prototype.bitwiseTo=st,e.prototype.changeBit=St,e.prototype.addTo=wt,e.prototype.dMultiply=Nt,e.prototype.dAddOffset=Jt,e.prototype.multiplyLowerTo=Ct,e.prototype.multiplyUpperTo=Ht,e.prototype.modInt=Yt,e.prototype.millerRabin=Xt,e.prototype.clone=_,e.prototype.intValue=z,e.prototype.byteValue=Z,e.prototype.shortValue=G,e.prototype.signum=Y,e.prototype.toByteArray=tt,e.prototype.equals=et,e.prototype.min=it,e.prototype.max=rt,e.prototype.and=ot,e.prototype.or=at,e.prototype.xor=ct,e.prototype.andNot=pt,e.prototype.not=lt,e.prototype.shiftLeft=dt,e.prototype.shiftRight=gt,e.prototype.getLowestSetBit=yt,e.prototype.bitCount=bt,e.prototype.testBit=Tt,e.prototype.setBit=Rt,e.prototype.clearBit=Et,e.prototype.flipBit=Dt,e.prototype.add=xt,e.prototype.subtract=Bt,e.prototype.multiply=Kt,e.prototype.divide=Ut,e.prototype.remainder=Ot,e.prototype.divideAndRemainder=Vt,e.prototype.modPow=Gt,e.prototype.modInverse=Wt,e.prototype.pow=qt,e.prototype.gcd=$t,e.prototype.isProbablePrime=Qt,e.prototype.square=At,te.prototype.init=ee,te.prototype.next=ie;var Oe,Ve,Ne,Je=256;if(null==Ve){Ve=new Array,Ne=0;var Ie;if(window.crypto&&window.crypto.getRandomValues){var Pe=new Uint32Array(256);for(window.crypto.getRandomValues(Pe),Ie=0;Ie<Pe.length;++Ie)Ve[Ne++]=255&Pe[Ie]}var Me=function(t){if(this.count=this.count||0,this.count>=256||Ne>=Je)return void(window.removeEventListener?window.removeEventListener("mousemove",Me,!1):window.detachEvent&&window.detachEvent("onmousemove",Me));try{var e=t.x+t.y;Ve[Ne++]=255&e,this.count+=1}catch(i){}};window.addEventListener?window.addEventListener("mousemove",Me,!1):window.attachEvent&&window.attachEvent("onmousemove",Me)}oe.prototype.nextBytes=ne,ue.prototype.doPublic=fe,ue.prototype.setPublic=ce,ue.prototype.encrypt=pe,ue.prototype.doPrivate=ye,ue.prototype.setPrivate=de,ue.prototype.setPrivateEx=ge,ue.prototype.generate=me,ue.prototype.decrypt=ve, | ||
| 11 | +// Copyright (c) 2011 Kevin M Burns Jr. | ||
| 12 | +// All Rights Reserved. | ||
| 13 | +// See "LICENSE" for details. | ||
| 14 | +// | ||
| 15 | +// Extension to jsbn which adds facilities for asynchronous RSA key generation | ||
| 16 | +// Primarily created to avoid execution timeout on mobile devices | ||
| 17 | +// | ||
| 18 | +// http://www-cs-students.stanford.edu/~tjw/jsbn/ | ||
| 19 | +// | ||
| 20 | +// --- | ||
| 21 | +function(){var t=function(t,r,s){var n=new oe,o=t>>1;this.e=parseInt(r,16);var h=new e(r,16),a=this,u=function(){var r=function(){if(a.p.compareTo(a.q)<=0){var t=a.p;a.p=a.q,a.q=t}var i=a.p.subtract(e.ONE),r=a.q.subtract(e.ONE),n=i.multiply(r);0==n.gcd(h).compareTo(e.ONE)?(a.n=a.p.multiply(a.q),a.d=h.modInverse(n),a.dmp1=a.d.mod(i),a.dmq1=a.d.mod(r),a.coeff=a.q.modInverse(a.p),setTimeout(function(){s()},0)):setTimeout(u,0)},c=function(){a.q=i(),a.q.fromNumberAsync(o,1,n,function(){a.q.subtract(e.ONE).gcda(h,function(t){0==t.compareTo(e.ONE)&&a.q.isProbablePrime(10)?setTimeout(r,0):setTimeout(c,0)})})},f=function(){a.p=i(),a.p.fromNumberAsync(t-o,1,n,function(){a.p.subtract(e.ONE).gcda(h,function(t){0==t.compareTo(e.ONE)&&a.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(f,0)})})};setTimeout(f,0)};setTimeout(u,0)};ue.prototype.generateAsync=t;var r=function(t,e){var i=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){var s=i;i=r,r=s}var n=i.getLowestSetBit(),o=r.getLowestSetBit();if(0>o)return void e(i);o>n&&(o=n),o>0&&(i.rShiftTo(o,i),r.rShiftTo(o,r));var h=function(){(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r)),i.signum()>0?setTimeout(h,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){e(r)},0))};setTimeout(h,10)};e.prototype.gcda=r;var s=function(t,i,r,s){if("number"==typeof i)if(2>t)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),ht,this),this.isEven()&&this.dAddOffset(1,0);var n=this,o=function(){n.dAddOffset(2,0),n.bitLength()>t&&n.subTo(e.ONE.shiftLeft(t-1),n),n.isProbablePrime(i)?setTimeout(function(){s()},0):setTimeout(o,0)};setTimeout(o,0)}else{var h=new Array,a=7&t;h.length=(t>>3)+1,i.nextBytes(h),a>0?h[0]&=(1<<a)-1:h[0]=0,this.fromString(h,256)}};e.prototype.fromNumberAsync=s}();var Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qe="=",Ce=Ce||{};Ce.env=Ce.env||{};var He=Ce,je=Object.prototype,ke="[object Function]",Fe=["toString","valueOf"];Ce.env.parseUA=function(t){var e,i=function(t){var e=0;return parseFloat(t.replace(/\./g,function(){return 1==e++?"":"."}))},r=navigator,s={ie:0,opera:0,gecko:0,webkit:0,chrome:0,mobile:null,air:0,ipad:0,iphone:0,ipod:0,ios:null,android:0,webos:0,caja:r&&r.cajaVersion,secure:!1,os:null},n=t||navigator&&navigator.userAgent,o=window&&window.location,h=o&&o.href;return s.secure=h&&0===h.toLowerCase().indexOf("https"),n&&(/windows|win32/i.test(n)?s.os="windows":/macintosh/i.test(n)?s.os="macintosh":/rhino/i.test(n)&&(s.os="rhino"),/KHTML/.test(n)&&(s.webkit=1),e=n.match(/AppleWebKit\/([^\s]*)/),e&&e[1]&&(s.webkit=i(e[1]),/ Mobile\//.test(n)?(s.mobile="Apple",e=n.match(/OS ([^\s]*)/),e&&e[1]&&(e=i(e[1].replace("_","."))),s.ios=e,s.ipad=s.ipod=s.iphone=0,e=n.match(/iPad|iPod|iPhone/),e&&e[0]&&(s[e[0].toLowerCase()]=s.ios)):(e=n.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/),e&&(s.mobile=e[0]),/webOS/.test(n)&&(s.mobile="WebOS",e=n.match(/webOS\/([^\s]*);/),e&&e[1]&&(s.webos=i(e[1]))),/ Android/.test(n)&&(s.mobile="Android",e=n.match(/Android ([^\s]*);/),e&&e[1]&&(s.android=i(e[1])))),e=n.match(/Chrome\/([^\s]*)/),e&&e[1]?s.chrome=i(e[1]):(e=n.match(/AdobeAIR\/([^\s]*)/),e&&(s.air=e[0]))),s.webkit||(e=n.match(/Opera[\s\/]([^\s]*)/),e&&e[1]?(s.opera=i(e[1]),e=n.match(/Version\/([^\s]*)/),e&&e[1]&&(s.opera=i(e[1])),e=n.match(/Opera Mini[^;]*/),e&&(s.mobile=e[0])):(e=n.match(/MSIE\s([^;]*)/),e&&e[1]?s.ie=i(e[1]):(e=n.match(/Gecko\/([^\s]*)/),e&&(s.gecko=1,e=n.match(/rv:([^\s\)]*)/),e&&e[1]&&(s.gecko=i(e[1]))))))),s},Ce.env.ua=Ce.env.parseUA(),Ce.isFunction=function(t){return"function"==typeof t||je.toString.apply(t)===ke},Ce._IEEnumFix=Ce.env.ua.ie?function(t,e){var i,r,s;for(i=0;i<Fe.length;i+=1)r=Fe[i],s=e[r],He.isFunction(s)&&s!=je[r]&&(t[r]=s)}:function(){},Ce.extend=function(t,e,i){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r,s=function(){};if(s.prototype=e.prototype,t.prototype=new s,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==je.constructor&&(e.prototype.constructor=e),i){for(r in i)He.hasOwnProperty(i,r)&&(t.prototype[r]=i[r]);He._IEEnumFix(t.prototype,i)}},/* | ||
| 22 | + * asn1.js - ASN.1 DER encoder classes | ||
| 23 | + * | ||
| 24 | + * Copyright (c) 2013 Kenji Urushima (kenji.urushima@gmail.com) | ||
| 25 | + * | ||
| 26 | + * This software is licensed under the terms of the MIT License. | ||
| 27 | + * http://kjur.github.com/jsrsasign/license | ||
| 28 | + * | ||
| 29 | + * The above copyright and license notice shall be | ||
| 30 | + * included in all copies or substantial portions of the Software. | ||
| 31 | + */ | ||
| 32 | +/** | ||
| 33 | + * @fileOverview | ||
| 34 | + * @name asn1-1.0.js | ||
| 35 | + * @author Kenji Urushima kenji.urushima@gmail.com | ||
| 36 | + * @version 1.0.2 (2013-May-30) | ||
| 37 | + * @since 2.1 | ||
| 38 | + * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a> | ||
| 39 | + */ | ||
| 40 | +"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.asn1&&KJUR.asn1||(KJUR.asn1={}),KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var i=t.toString(16);if("-"!=i.substr(0,1))i.length%2==1?i="0"+i:i.match(/^[0-7]/)||(i="00"+i);else{var r=i.substr(1),s=r.length;s%2==1?s+=1:i.match(/^[0-7]/)||(s+=2);for(var n="",o=0;s>o;o++)n+="f";var h=new e(n,16),a=h.xor(t).add(e.ONE);i=a.toString(16).replace(/^-/,"")}return i},this.getPEMStringFromHex=function(t,e){var i=CryptoJS.enc.Hex.parse(t),r=CryptoJS.enc.Base64.stringify(i),s=r.replace(/(.{64})/g,"$1\r\n");return s=s.replace(/\r\n$/,""),"-----BEGIN "+e+"-----\r\n"+s+"\r\n-----END "+e+"-----\r\n"}},KJUR.asn1.ASN1Object=function(){var t="";this.getLengthHexFromValue=function(){if("undefined"==typeof this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+t.length+",v="+this.hV;var e=this.hV.length/2,i=e.toString(16);if(i.length%2==1&&(i="0"+i),128>e)return i;var r=i.length/2;if(r>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);var s=128+r;return s.toString(16)+i},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},KJUR.asn1.DERAbstractString=function(t){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.str?this.setString(t.str):"undefined"!=typeof t.hex&&this.setStringHex(t.hex))},Ce.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractTime=function(t){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(t){utc=t.getTime()+6e4*t.getTimezoneOffset();var e=new Date(utc);return e},this.formatDate=function(t,e){var i=this.zeroPadding,r=this.localDateToUTC(t),s=String(r.getFullYear());"utc"==e&&(s=s.substr(2,2));var n=i(String(r.getMonth()+1),2),o=i(String(r.getDate()),2),h=i(String(r.getHours()),2),a=i(String(r.getMinutes()),2),u=i(String(r.getSeconds()),2);return s+n+o+h+a+u+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setByDateValue=function(t,e,i,r,s,n){var o=new Date(Date.UTC(t,e-1,i,r,s,n,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},Ce.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractStructured=function(t){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,"undefined"!=typeof t&&"undefined"!=typeof t.array&&(this.asn1Array=t.array)},Ce.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},Ce.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object),KJUR.asn1.DERInteger=function(t){KJUR.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var i=new e(String(t),10);this.setByBigInteger(i)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.bigint?this.setByBigInteger(t.bigint):"undefined"!=typeof t["int"]?this.setByInteger(t["int"]):"undefined"!=typeof t.hex&&this.setValueHex(t.hex))},Ce.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object),KJUR.asn1.DERBitString=function(t){KJUR.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(0>t||t>7)throw"unused bits shall be from 0 to 7: u = "+t;var i="0"+t;this.hTLV=null,this.isModified=!0,this.hV=i+e},this.setByBinaryString=function(t){t=t.replace(/0+$/,"");var e=8-t.length%8;8==e&&(e=0);for(var i=0;e>=i;i++)t+="0";for(var r="",i=0;i<t.length-1;i+=8){var s=t.substr(i,8),n=parseInt(s,2).toString(16);1==n.length&&(n="0"+n),r+=n}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",i=0;i<t.length;i++)e+=1==t[i]?"1":"0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),i=0;t>i;i++)e[i]=!1;return e},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.hex?this.setHexValueIncludingUnusedBits(t.hex):"undefined"!=typeof t.bin?this.setByBinaryString(t.bin):"undefined"!=typeof t.array&&this.setByBooleanArray(t.array))},Ce.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object),KJUR.asn1.DEROctetString=function(t){KJUR.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Ce.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Ce.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object),KJUR.asn1.DERObjectIdentifier=function(t){var i=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",s=new e(t,10),n=s.toString(2),o=7-n.length%7;7==o&&(o=0);for(var h="",a=0;o>a;a++)h+="0";n=h+n;for(var a=0;a<n.length-1;a+=7){var u=n.substr(a,7);a!=n.length-7&&(u="1"+u),r+=i(parseInt(u,2))}return r};KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var e="",s=t.split("."),n=40*parseInt(s[0])+parseInt(s[1]);e+=i(n),s.splice(0,2);for(var o=0;o<s.length;o++)e+=r(s[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){if("undefined"==typeof KJUR.asn1.x509.OID.name2oidList[t])throw"DERObjectIdentifier oidName undefined: "+t;var e=KJUR.asn1.x509.OID.name2oidList[t];this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.oid?this.setValueOidString(t.oid):"undefined"!=typeof t.hex?this.setValueHex(t.hex):"undefined"!=typeof t.name&&this.setValueName(t.name))},Ce.extend(KJUR.asn1.DERObjectIdentifier,KJUR.asn1.ASN1Object),KJUR.asn1.DERUTF8String=function(t){KJUR.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Ce.extend(KJUR.asn1.DERUTF8String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNumericString=function(t){KJUR.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Ce.extend(KJUR.asn1.DERNumericString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERPrintableString=function(t){KJUR.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Ce.extend(KJUR.asn1.DERPrintableString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERTeletexString=function(t){KJUR.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Ce.extend(KJUR.asn1.DERTeletexString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERIA5String=function(t){KJUR.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Ce.extend(KJUR.asn1.DERIA5String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERUTCTime=function(t){KJUR.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},"undefined"!=typeof t&&("undefined"!=typeof t.str?this.setString(t.str):"undefined"!=typeof t.hex?this.setStringHex(t.hex):"undefined"!=typeof t.date&&this.setByDate(t.date))},Ce.extend(KJUR.asn1.DERUTCTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERGeneralizedTime=function(t){KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen"),this.hV=stohex(this.s)},"undefined"!=typeof t&&("undefined"!=typeof t.str?this.setString(t.str):"undefined"!=typeof t.hex?this.setStringHex(t.hex):"undefined"!=typeof t.date&&this.setByDate(t.date))},Ce.extend(KJUR.asn1.DERGeneralizedTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERSequence=function(t){KJUR.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t+=i.getEncodedHex()}return this.hV=t,this.hV}},Ce.extend(KJUR.asn1.DERSequence,KJUR.asn1.DERAbstractStructured),KJUR.asn1.DERSet=function(t){KJUR.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t.push(i.getEncodedHex())}return t.sort(),this.hV=t.join(""),this.hV}},Ce.extend(KJUR.asn1.DERSet,KJUR.asn1.DERAbstractStructured),KJUR.asn1.DERTaggedObject=function(t){KJUR.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,i){this.hT=e,this.isExplicit=t,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.tag&&(this.hT=t.tag),"undefined"!=typeof t.explicit&&(this.isExplicit=t.explicit),"undefined"!=typeof t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},Ce.extend(KJUR.asn1.DERTaggedObject,KJUR.asn1.ASN1Object), | ||
| 41 | +// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it> | ||
| 42 | +// copyright notice and this permission notice appear in all copies. | ||
| 43 | +// | ||
| 44 | +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 45 | +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 46 | +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 47 | +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 48 | +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 49 | +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 50 | +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 51 | +function(t){"use strict";var e,i={};i.decode=function(i){var r;if(e===t){var s="0123456789ABCDEF",n=" \f\n\r \u2028\u2029";for(e=[],r=0;16>r;++r)e[s.charAt(r)]=r;for(s=s.toLowerCase(),r=10;16>r;++r)e[s.charAt(r)]=r;for(r=0;r<n.length;++r)e[n.charAt(r)]=-1}var o=[],h=0,a=0;for(r=0;r<i.length;++r){var u=i.charAt(r);if("="==u)break;if(u=e[u],-1!=u){if(u===t)throw"Illegal character at offset "+r;h|=u,++a>=2?(o[o.length]=h,h=0,a=0):h<<=4}}if(a)throw"Hex encoding incomplete: 4 bits missing";return o},window.Hex=i}(), | ||
| 52 | +// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it> | ||
| 53 | +// copyright notice and this permission notice appear in all copies. | ||
| 54 | +// | ||
| 55 | +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 56 | +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 57 | +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 58 | +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 59 | +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 60 | +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 61 | +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 62 | +function(t){"use strict";var e,i={};i.decode=function(i){var r;if(e===t){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="= \f\n\r \u2028\u2029";for(e=[],r=0;64>r;++r)e[s.charAt(r)]=r;for(r=0;r<n.length;++r)e[n.charAt(r)]=-1}var o=[],h=0,a=0;for(r=0;r<i.length;++r){var u=i.charAt(r);if("="==u)break;if(u=e[u],-1!=u){if(u===t)throw"Illegal character at offset "+r;h|=u,++a>=4?(o[o.length]=h>>16,o[o.length]=h>>8&255,o[o.length]=255&h,h=0,a=0):h<<=6}}switch(a){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:o[o.length]=h>>10;break;case 3:o[o.length]=h>>16,o[o.length]=h>>8&255}return o},i.re=/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,i.unarmor=function(t){var e=i.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw"RegExp out of sync";t=e[2]}return i.decode(t)},window.Base64=i}(), | ||
| 63 | +// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it> | ||
| 64 | +// copyright notice and this permission notice appear in all copies. | ||
| 65 | +// | ||
| 66 | +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 67 | +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 68 | +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 69 | +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 70 | +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 71 | +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 72 | +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 73 | +function(t){"use strict";function e(t,i){t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=i)}function i(t,e,i,r,s){this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=s}var r=100,s="…",n={tag:function(t,e){var i=document.createElement(t);return i.className=e,i},text:function(t){return document.createTextNode(t)}};e.prototype.get=function(e){if(e===t&&(e=this.pos++),e>=this.enc.length)throw"Requesting byte offset "+e+" on a stream of length "+this.enc.length;return this.enc[e]},e.prototype.hexDigits="0123456789ABCDEF",e.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},e.prototype.hexDump=function(t,e,i){for(var r="",s=t;e>s;++s)if(r+=this.hexByte(this.get(s)),i!==!0)switch(15&s){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},e.prototype.parseStringISO=function(t,e){for(var i="",r=t;e>r;++r)i+=String.fromCharCode(this.get(r));return i},e.prototype.parseStringUTF=function(t,e){for(var i="",r=t;e>r;){var s=this.get(r++);i+=128>s?String.fromCharCode(s):s>191&&224>s?String.fromCharCode((31&s)<<6|63&this.get(r++)):String.fromCharCode((15&s)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return i},e.prototype.parseStringBMP=function(t,e){for(var i="",r=t;e>r;r+=2){var s=this.get(r),n=this.get(r+1);i+=String.fromCharCode((s<<8)+n)}return i},e.prototype.reTime=/^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,e.prototype.parseTime=function(t,e){var i=this.parseStringISO(t,e),r=this.reTime.exec(i);return r?(i=r[1]+"-"+r[2]+"-"+r[3]+" "+r[4],r[5]&&(i+=":"+r[5],r[6]&&(i+=":"+r[6],r[7]&&(i+="."+r[7]))),r[8]&&(i+=" UTC","Z"!=r[8]&&(i+=r[8],r[9]&&(i+=":"+r[9]))),i):"Unrecognized time: "+i},e.prototype.parseInteger=function(t,e){var i=e-t;if(i>4){i<<=3;var r=this.get(t);if(0===r)i-=8;else for(;128>r;)r<<=1,--i;return"("+i+" bit)"}for(var s=0,n=t;e>n;++n)s=s<<8|this.get(n);return s},e.prototype.parseBitString=function(t,e){var i=this.get(t),r=(e-t-1<<3)-i,s="("+r+" bit)";if(20>=r){var n=i;s+=" ";for(var o=e-1;o>t;--o){for(var h=this.get(o),a=n;8>a;++a)s+=h>>a&1?"1":"0";n=0}}return s},e.prototype.parseOctetString=function(t,e){var i=e-t,n="("+i+" byte) ";i>r&&(e=t+r);for(var o=t;e>o;++o)n+=this.hexByte(this.get(o));return i>r&&(n+=s),n},e.prototype.parseOID=function(t,e){for(var i="",r=0,s=0,n=t;e>n;++n){var o=this.get(n);if(r=r<<7|127&o,s+=7,!(128&o)){if(""===i){var h=80>r?40>r?0:1:2;i=h+"."+(r-40*h)}else i+="."+(s>=31?"bigint":r);r=s=0}}return i},i.prototype.typeName=function(){if(this.tag===t)return"unknown";var e=this.tag>>6,i=(this.tag>>5&1,31&this.tag);switch(e){case 0:switch(i){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString";default:return"Universal_"+i.toString(16)}case 1:return"Application_"+i.toString(16);case 2:return"["+i+"]";case 3:return"Private_"+i.toString(16)}},i.prototype.reSeemsASCII=/^[ -~]+$/,i.prototype.content=function(){if(this.tag===t)return null;var e=this.tag>>6,i=31&this.tag,n=this.posContent(),o=Math.abs(this.length);if(0!==e){if(null!==this.sub)return"("+this.sub.length+" elem)";var h=this.stream.parseStringISO(n,n+Math.min(o,r));return this.reSeemsASCII.test(h)?h.substring(0,2*r)+(h.length>2*r?s:""):this.stream.parseOctetString(n,n+o)}switch(i){case 1:return 0===this.stream.get(n)?"false":"true";case 2:return this.stream.parseInteger(n,n+o);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(n,n+o);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(n,n+o);case 6:return this.stream.parseOID(n,n+o);case 16:case 17:return"("+this.sub.length+" elem)";case 12:return this.stream.parseStringUTF(n,n+o);case 18:case 19:case 20:case 21:case 22:case 26:return this.stream.parseStringISO(n,n+o);case 30:return this.stream.parseStringBMP(n,n+o);case 23:case 24:return this.stream.parseTime(n,n+o)}return null},i.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},i.prototype.print=function(e){if(e===t&&(e=""),document.writeln(e+this),null!==this.sub){e+=" ";for(var i=0,r=this.sub.length;r>i;++i)this.sub[i].print(e)}},i.prototype.toPrettyString=function(e){e===t&&(e="");var i=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(i+="+"),i+=this.length,32&this.tag?i+=" (constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(i+=" (encapsulates)"),i+="\n",null!==this.sub){e+=" ";for(var r=0,s=this.sub.length;s>r;++r)i+=this.sub[r].toPrettyString(e)}return i},i.prototype.toDOM=function(){var t=n.tag("div","node");t.asn1=this;var e=n.tag("div","head"),i=this.typeName().replace(/_/g," ");e.innerHTML=i;var r=this.content();if(null!==r){r=String(r).replace(/</g,"<");var s=n.tag("span","preview");s.appendChild(n.text(r)),e.appendChild(s)}t.appendChild(e),this.node=t,this.head=e;var o=n.tag("div","value");if(i="Offset: "+this.stream.pos+"<br/>",i+="Length: "+this.header+"+",i+=this.length>=0?this.length:-this.length+" (undefined)",32&this.tag?i+="<br/>(constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(i+="<br/>(encapsulates)"),null!==r&&(i+="<br/>Value:<br/><b>"+r+"</b>","object"==typeof oids&&6==this.tag)){var h=oids[r];h&&(h.d&&(i+="<br/>"+h.d),h.c&&(i+="<br/>"+h.c),h.w&&(i+="<br/>(warning!)"))}o.innerHTML=i,t.appendChild(o);var a=n.tag("div","sub");if(null!==this.sub)for(var u=0,c=this.sub.length;c>u;++u)a.appendChild(this.sub[u].toDOM());return t.appendChild(a),e.onclick=function(){t.className="node collapsed"==t.className?"node":"node collapsed"},t},i.prototype.posStart=function(){return this.stream.pos},i.prototype.posContent=function(){return this.stream.pos+this.header},i.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},i.prototype.fakeHover=function(t){this.node.className+=" hover",t&&(this.head.className+=" hover")},i.prototype.fakeOut=function(t){var e=/ ?hover/;this.node.className=this.node.className.replace(e,""),t&&(this.head.className=this.head.className.replace(e,""))},i.prototype.toHexDOM_sub=function(t,e,i,r,s){if(!(r>=s)){var o=n.tag("span",e);o.appendChild(n.text(i.hexDump(r,s))),t.appendChild(o)}},i.prototype.toHexDOM=function(e){var i=n.tag("span","hex");if(e===t&&(e=i),this.head.hexNode=i,this.head.onmouseover=function(){this.hexNode.className="hexCurrent"},this.head.onmouseout=function(){this.hexNode.className="hex"},i.asn1=this,i.onmouseover=function(){var t=!e.selected;t&&(e.selected=this.asn1,this.className="hexCurrent"),this.asn1.fakeHover(t)},i.onmouseout=function(){var t=e.selected==this.asn1;this.asn1.fakeOut(t),t&&(e.selected=null,this.className="hex")},this.toHexDOM_sub(i,"tag",this.stream,this.posStart(),this.posStart()+1),this.toHexDOM_sub(i,this.length>=0?"dlen":"ulen",this.stream,this.posStart()+1,this.posContent()),null===this.sub)i.appendChild(n.text(this.stream.hexDump(this.posContent(),this.posEnd())));else if(this.sub.length>0){var r=this.sub[0],s=this.sub[this.sub.length-1];this.toHexDOM_sub(i,"intro",this.stream,this.posContent(),r.posStart());for(var o=0,h=this.sub.length;h>o;++o)i.appendChild(this.sub[o].toHexDOM(e));this.toHexDOM_sub(i,"outro",this.stream,s.posEnd(),this.posEnd())}return i},i.prototype.toHexString=function(t){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},i.decodeLength=function(t){var e=t.get(),i=127&e;if(i==e)return i;if(i>3)throw"Length over 24 bits not supported at position "+(t.pos-1);if(0===i)return-1;e=0;for(var r=0;i>r;++r)e=e<<8|t.get();return e},i.hasContent=function(t,r,s){if(32&t)return!0;if(3>t||t>4)return!1;var n=new e(s);3==t&&n.get();var o=n.get();if(o>>6&1)return!1;try{var h=i.decodeLength(n);return n.pos-s.pos+h==r}catch(a){return!1}},i.decode=function(t){t instanceof e||(t=new e(t,0));var r=new e(t),s=t.get(),n=i.decodeLength(t),o=t.pos-r.pos,h=null;if(i.hasContent(s,n,t)){var a=t.pos;if(3==s&&t.get(),h=[],n>=0){for(var u=a+n;t.pos<u;)h[h.length]=i.decode(t);if(t.pos!=u)throw"Content size is not correct for container starting at offset "+a}else try{for(;;){var c=i.decode(t);if(0===c.tag)break;h[h.length]=c}n=a-t.pos}catch(f){throw"Exception while decoding undefined length content: "+f}}else t.pos+=n;return new i(r,o,n,s,h)},i.test=function(){for(var t=[{value:[39],expected:39},{value:[129,201],expected:201},{value:[131,254,220,186],expected:16702650}],r=0,s=t.length;s>r;++r){var n=new e(t[r].value,0),o=i.decodeLength(n);o!=t[r].expected&&document.write("In test["+r+"] expected "+t[r].expected+" got "+o+"\n")}},window.ASN1=i}(),ASN1.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,i=2*this.length;return t.substr(e,i)},ue.prototype.parseKey=function(t){try{var e=0,i=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,s=r.test(t)?Hex.decode(t):Base64.unarmor(t),n=ASN1.decode(s);if(3===n.sub.length&&(n=n.sub[2].sub[0]),9===n.sub.length){e=n.sub[1].getHexStringValue(),this.n=he(e,16),i=n.sub[2].getHexStringValue(),this.e=parseInt(i,16);var o=n.sub[3].getHexStringValue();this.d=he(o,16);var h=n.sub[4].getHexStringValue();this.p=he(h,16);var a=n.sub[5].getHexStringValue();this.q=he(a,16);var u=n.sub[6].getHexStringValue();this.dmp1=he(u,16);var c=n.sub[7].getHexStringValue();this.dmq1=he(c,16);var f=n.sub[8].getHexStringValue();this.coeff=he(f,16)}else{if(2!==n.sub.length)return!1;var p=n.sub[1],l=p.sub[0];e=l.sub[0].getHexStringValue(),this.n=he(e,16),i=l.sub[1].getHexStringValue(),this.e=parseInt(i,16)}return!0}catch(d){return!1}},ue.prototype.getPrivateBaseKey=function(){var t={array:[new KJUR.asn1.DERInteger({"int":0}),new KJUR.asn1.DERInteger({bigint:this.n}),new KJUR.asn1.DERInteger({"int":this.e}),new KJUR.asn1.DERInteger({bigint:this.d}),new KJUR.asn1.DERInteger({bigint:this.p}),new KJUR.asn1.DERInteger({bigint:this.q}),new KJUR.asn1.DERInteger({bigint:this.dmp1}),new KJUR.asn1.DERInteger({bigint:this.dmq1}),new KJUR.asn1.DERInteger({bigint:this.coeff})]},e=new KJUR.asn1.DERSequence(t);return e.getEncodedHex()},ue.prototype.getPrivateBaseKeyB64=function(){return be(this.getPrivateBaseKey())},ue.prototype.getPublicBaseKey=function(){var t={array:[new KJUR.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new KJUR.asn1.DERNull]},e=new KJUR.asn1.DERSequence(t);t={array:[new KJUR.asn1.DERInteger({bigint:this.n}),new KJUR.asn1.DERInteger({"int":this.e})]};var i=new KJUR.asn1.DERSequence(t);t={hex:"00"+i.getEncodedHex()};var r=new KJUR.asn1.DERBitString(t);t={array:[e,r]};var s=new KJUR.asn1.DERSequence(t);return s.getEncodedHex()},ue.prototype.getPublicBaseKeyB64=function(){return be(this.getPublicBaseKey())},ue.prototype.wordwrap=function(t,e){if(e=e||64,!t)return t;var i="(.{1,"+e+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(i,"g")).join("\n")},ue.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return t+=this.wordwrap(this.getPrivateBaseKeyB64())+"\n",t+="-----END RSA PRIVATE KEY-----"},ue.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return t+=this.wordwrap(this.getPublicBaseKeyB64())+"\n",t+="-----END PUBLIC KEY-----"},ue.prototype.hasPublicKeyProperty=function(t){return t=t||{},t.hasOwnProperty("n")&&t.hasOwnProperty("e")},ue.prototype.hasPrivateKeyProperty=function(t){return t=t||{},t.hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},ue.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)};var _e=function(t){ue.call(this),t&&("string"==typeof t?this.parseKey(t):(this.hasPrivateKeyProperty(t)||this.hasPublicKeyProperty(t))&&this.parsePropertiesFrom(t))};_e.prototype=new ue,_e.prototype.constructor=_e;var ze=function(t){t=t||{},this.default_key_size=parseInt(t.default_key_size)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null};ze.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new _e(t)},ze.prototype.setPrivateKey=function(t){this.setKey(t)},ze.prototype.setPublicKey=function(t){this.setKey(t)},ze.prototype.decrypt=function(t){try{return this.getKey().decrypt(Te(t))}catch(e){return!1}},ze.prototype.encrypt=function(t){try{return be(this.getKey().encrypt(t))}catch(e){return!1}},ze.prototype.getKey=function(t){if(!this.key){if(this.key=new _e,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},ze.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},ze.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},ze.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},ze.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},ze.version="2.3.1",t.JSEncrypt=ze}); | ||
| 0 | \ No newline at end of file | 74 | \ No newline at end of file |
src/main/resources/static/index.html
| 1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
| 2 | -<html> | 2 | +<html lang="zh"> |
| 3 | <head> | 3 | <head> |
| 4 | +<meta name="renderer" content="webkit" /> | ||
| 5 | +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
| 4 | <meta charset="UTF-8"> | 6 | <meta charset="UTF-8"> |
| 5 | <title>调度系统</title> | 7 | <title>调度系统</title> |
| 6 | -<meta name=”renderer” content=”webkit”> | ||
| 7 | -<meta http-equiv=”X-UA-Compatible” content=”IE=Edge,chrome=1″ > | ||
| 8 | 8 | ||
| 9 | <meta http-equiv="Pragma" content="no-cache"> | 9 | <meta http-equiv="Pragma" content="no-cache"> |
| 10 | <meta http-equiv="Cache-control" content="no-cache"> | 10 | <meta http-equiv="Cache-control" content="no-cache"> |
src/main/resources/static/login.html
| 1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
| 2 | -<html lang="en"> | 2 | +<html lang="zh"> |
| 3 | <head> | 3 | <head> |
| 4 | +<meta name="renderer" content="webkit" /> | ||
| 5 | +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
| 4 | <meta charset="utf-8" /> | 6 | <meta charset="utf-8" /> |
| 5 | <title>登录</title> | 7 | <title>登录</title> |
| 6 | <link | 8 | <link |
| @@ -158,10 +160,23 @@ h3.logo-text{ | @@ -158,10 +160,23 @@ h3.logo-text{ | ||
| 158 | font-family: 华文楷体,华文细黑; | 160 | font-family: 华文楷体,华文细黑; |
| 159 | font-size: 28px; | 161 | font-size: 28px; |
| 160 | } | 162 | } |
| 163 | + | ||
| 164 | +.warn-note{ | ||
| 165 | + width: 100%; | ||
| 166 | + position: absolute; | ||
| 167 | + top: 0; | ||
| 168 | + z-index: 2; | ||
| 169 | + text-align: center; | ||
| 170 | + background: #ff4646; | ||
| 171 | + color: white; | ||
| 172 | + padding: 12px; | ||
| 173 | + display: none; | ||
| 174 | +} | ||
| 161 | </style> | 175 | </style> |
| 162 | </head> | 176 | </head> |
| 163 | 177 | ||
| 164 | <body> | 178 | <body> |
| 179 | + <div class="warn-note">警告!系统目前仅在 WebKit 内核下完成兼容性测试,请使用 Google Chrome 浏览器进入系统。</div> | ||
| 165 | <div class="wrapper ng-scope"> | 180 | <div class="wrapper ng-scope"> |
| 166 | <div id="loginPanel" class="dialog dialog-shadow"> | 181 | <div id="loginPanel" class="dialog dialog-shadow"> |
| 167 | <br> | 182 | <br> |
| @@ -196,7 +211,7 @@ h3.logo-text{ | @@ -196,7 +211,7 @@ h3.logo-text{ | ||
| 196 | </form> | 211 | </form> |
| 197 | <br><br> | 212 | <br><br> |
| 198 | <div class="form-actions" > | 213 | <div class="form-actions" > |
| 199 | - <button type="button" class="btn blue-steel" id="loginBtn" disabled="disabled">登录</button> | 214 | + <button class="btn blue-steel" id="loginBtn" disabled="disabled">登录</button> |
| 200 | </div> | 215 | </div> |
| 201 | 216 | ||
| 202 | <div class="alert alert-danger"></div> | 217 | <div class="alert alert-danger"></div> |
| @@ -207,9 +222,13 @@ h3.logo-text{ | @@ -207,9 +222,13 @@ h3.logo-text{ | ||
| 207 | 222 | ||
| 208 | <!-- jQuery --> | 223 | <!-- jQuery --> |
| 209 | <script src="/metronic_v4.5.4/plugins/jquery.min.js" ></script> | 224 | <script src="/metronic_v4.5.4/plugins/jquery.min.js" ></script> |
| 210 | -<script src="/assets/plugins/jquery.base64.min.js" ></script> | ||
| 211 | - | 225 | +<script src="/assets/plugins/jsencrypt.min.js" ></script> |
| 212 | <script> | 226 | <script> |
| 227 | +window.onload=function(){ | ||
| 228 | + var body=document.getElementsByTagName("body")[0]; | ||
| 229 | + if(typeof body.style.WebkitAnimation=="undefined") | ||
| 230 | + $('.warn-note').fadeIn(); | ||
| 231 | +} | ||
| 213 | !function(){ | 232 | !function(){ |
| 214 | var form = $('#loginPanel form') | 233 | var form = $('#loginPanel form') |
| 215 | ,nameInput = $('input[name=userName]', form) | 234 | ,nameInput = $('input[name=userName]', form) |
| @@ -217,6 +236,13 @@ h3.logo-text{ | @@ -217,6 +236,13 @@ h3.logo-text{ | ||
| 217 | ,msgAlert = $('#loginPanel .alert-danger'); | 236 | ,msgAlert = $('#loginPanel .alert-danger'); |
| 218 | 237 | ||
| 219 | $('input', form).on('keyup', checkBtnStatus); | 238 | $('input', form).on('keyup', checkBtnStatus); |
| 239 | + | ||
| 240 | + var keys; | ||
| 241 | + $.get('/user/login/jCryptionKey', function(data){ | ||
| 242 | + keys = data.publickey; | ||
| 243 | + }); | ||
| 244 | + | ||
| 245 | + | ||
| 220 | 246 | ||
| 221 | function checkBtnStatus(){ | 247 | function checkBtnStatus(){ |
| 222 | var es = $('input:visible', form); | 248 | var es = $('input:visible', form); |
| @@ -257,8 +283,14 @@ h3.logo-text{ | @@ -257,8 +283,14 @@ h3.logo-text{ | ||
| 257 | $('#loginBtn').on('click', function(){ | 283 | $('#loginBtn').on('click', function(){ |
| 258 | if(lock || $(this).attr('disabled')) return; | 284 | if(lock || $(this).attr('disabled')) return; |
| 259 | var userName = nameInput.val() | 285 | var userName = nameInput.val() |
| 260 | - ,pwd = fourBase64(pwdInput.val()); | 286 | + ,pwd = pwdInput.val(); |
| 261 | 287 | ||
| 288 | + //RSA加密 | ||
| 289 | + var encrypt = new JSEncrypt(); | ||
| 290 | + encrypt.setPublicKey(keys); | ||
| 291 | + userName = encrypt.encrypt(userName); | ||
| 292 | + pwd = encrypt.encrypt(pwd); | ||
| 293 | + //登录 | ||
| 262 | login(userName, pwd); | 294 | login(userName, pwd); |
| 263 | }); | 295 | }); |
| 264 | 296 | ||
| @@ -266,6 +298,7 @@ h3.logo-text{ | @@ -266,6 +298,7 @@ h3.logo-text{ | ||
| 266 | function login(userName, pwd){ | 298 | function login(userName, pwd){ |
| 267 | lock = true; | 299 | lock = true; |
| 268 | $('#loginBtn').attr('disabled', 'disabled'); | 300 | $('#loginBtn').attr('disabled', 'disabled'); |
| 301 | + | ||
| 269 | var params = { | 302 | var params = { |
| 270 | userName: userName, | 303 | userName: userName, |
| 271 | password: pwd, | 304 | password: pwd, |
| @@ -340,11 +373,6 @@ h3.logo-text{ | @@ -340,11 +373,6 @@ h3.logo-text{ | ||
| 340 | $(this).attr('src', '/captcha.jpg?t=' + Math.random()); | 373 | $(this).attr('src', '/captcha.jpg?t=' + Math.random()); |
| 341 | }); | 374 | }); |
| 342 | 375 | ||
| 343 | - function fourBase64(t){ | ||
| 344 | - var ed = $.base64.encode; | ||
| 345 | - return ed(ed(ed(ed(t)))); | ||
| 346 | - } | ||
| 347 | - | ||
| 348 | function error(rs){ | 376 | function error(rs){ |
| 349 | return rs.status == 'ERROR' || rs.status == 500; | 377 | return rs.status == 'ERROR' || rs.status == 500; |
| 350 | } | 378 | } |
src/main/resources/static/pages/control/line/child_pages/child_task.html
| @@ -176,7 +176,7 @@ $(function(){ | @@ -176,7 +176,7 @@ $(function(){ | ||
| 176 | var scheduleIdMap; | 176 | var scheduleIdMap; |
| 177 | 177 | ||
| 178 | //滚动时固定表头 | 178 | //滚动时固定表头 |
| 179 | - $('.custom-table-panel').on('scroll', function(){ | 179 | + $('#childTaskDiv .custom-table-panel').on('scroll', function(){ |
| 180 | var top = $(this).scrollTop() | 180 | var top = $(this).scrollTop() |
| 181 | ,$header = $(this).find('.custom-table-header'); | 181 | ,$header = $(this).find('.custom-table-header'); |
| 182 | $header.css('top', top); | 182 | $header.css('top', top); |
src/main/resources/static/pages/control/line/css/lineControl.css
| @@ -267,8 +267,8 @@ body{ | @@ -267,8 +267,8 @@ body{ | ||
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | .portlet-fullscreen .nav-tabs > li > a:hover | 269 | .portlet-fullscreen .nav-tabs > li > a:hover |
| 270 | -,.portlet-fullscreen .nav-tabs > li > a:active{ | ||
| 271 | - border: none; | 270 | +/* ,.portlet-fullscreen .nav-tabs > li > a:active */{ |
| 271 | + border: none; | ||
| 272 | background: #0E5384; | 272 | background: #0E5384; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| @@ -279,10 +279,11 @@ body{ | @@ -279,10 +279,11 @@ body{ | ||
| 279 | .portlet-fullscreen .nav-tabs>li.active>a{ | 279 | .portlet-fullscreen .nav-tabs>li.active>a{ |
| 280 | background: #FFFFFF; | 280 | background: #FFFFFF; |
| 281 | color: #0A3F64; | 281 | color: #0A3F64; |
| 282 | - border: 1px solid #FFFFFF; | 282 | + border: none; |
| 283 | border-radius: 5px 5px 0 0 !important; | 283 | border-radius: 5px 5px 0 0 !important; |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | + | ||
| 286 | .portlet-fullscreen .nav-tabs { | 287 | .portlet-fullscreen .nav-tabs { |
| 287 | /* border-bottom: 1px solid #337AB7; */ | 288 | /* border-bottom: 1px solid #337AB7; */ |
| 288 | } | 289 | } |
| @@ -397,7 +398,7 @@ body{ | @@ -397,7 +398,7 @@ body{ | ||
| 397 | .card_wrap .line_chart .top .center{ | 398 | .card_wrap .line_chart .top .center{ |
| 398 | height: 100%; | 399 | height: 100%; |
| 399 | font-size: 15px; | 400 | font-size: 15px; |
| 400 | - color: #5E96D2; | 401 | + color: #babdbd; |
| 401 | padding: 10px 0px; | 402 | padding: 10px 0px; |
| 402 | width: auto; | 403 | width: auto; |
| 403 | float: left; | 404 | float: left; |
| @@ -644,16 +645,24 @@ body{ | @@ -644,16 +645,24 @@ body{ | ||
| 644 | height: 25px; | 645 | height: 25px; |
| 645 | fill: rgba(253, 253, 253, 0.17); | 646 | fill: rgba(253, 253, 253, 0.17); |
| 646 | rx: 5px; | 647 | rx: 5px; |
| 647 | - stroke: #26c281; | ||
| 648 | } | 648 | } |
| 649 | 649 | ||
| 650 | .vehci-g.up text, | 650 | .vehci-g.up text, |
| 651 | .vehci-g.down text{ | 651 | .vehci-g.down text{ |
| 652 | - stroke: #26c281; | ||
| 653 | font-size: 12px; | 652 | font-size: 12px; |
| 654 | cursor: default; | 653 | cursor: default; |
| 655 | } | 654 | } |
| 656 | 655 | ||
| 656 | +.vehci-g.up text, | ||
| 657 | +.vehci-g.up rect{ | ||
| 658 | + stroke: #337ac4; | ||
| 659 | +} | ||
| 660 | + | ||
| 661 | +.vehci-g.down text, | ||
| 662 | +.vehci-g.down rect{ | ||
| 663 | + stroke: #e43a45; | ||
| 664 | +} | ||
| 665 | + | ||
| 657 | .vehci-g.updown-error rect, | 666 | .vehci-g.updown-error rect, |
| 658 | .vehci-g.updown-error text{ | 667 | .vehci-g.updown-error text{ |
| 659 | stroke: #CACA17; | 668 | stroke: #CACA17; |
| @@ -1035,7 +1044,8 @@ height: 400px; | @@ -1035,7 +1044,8 @@ height: 400px; | ||
| 1035 | } | 1044 | } |
| 1036 | 1045 | ||
| 1037 | .station_text { | 1046 | .station_text { |
| 1038 | - letter-spacing: -2.6px; | 1047 | + /* letter-spacing: -2.6px; */ |
| 1048 | + font-family: 华文细黑,华文黑体,宋体; | ||
| 1039 | } | 1049 | } |
| 1040 | } | 1050 | } |
| 1041 | 1051 | ||
| @@ -1577,7 +1587,11 @@ height: 400px; | @@ -1577,7 +1587,11 @@ height: 400px; | ||
| 1577 | ::-webkit-scrollbar { | 1587 | ::-webkit-scrollbar { |
| 1578 | width: 15px; | 1588 | width: 15px; |
| 1579 | height: 16px; | 1589 | height: 16px; |
| 1580 | -} | 1590 | +} |
| 1591 | + | ||
| 1592 | +#tab_home .custom-table-panel::-webkit-scrollbar{ | ||
| 1593 | + border-top: 1px solid #e7ecf1; | ||
| 1594 | +} | ||
| 1581 | 1595 | ||
| 1582 | ::-webkit-scrollbar-track, | 1596 | ::-webkit-scrollbar-track, |
| 1583 | ::-webkit-scrollbar-thumb { | 1597 | ::-webkit-scrollbar-thumb { |
| @@ -2588,4 +2602,65 @@ tr.child_task td:nth-child(1):AFTER{ | @@ -2588,4 +2602,65 @@ tr.child_task td:nth-child(1):AFTER{ | ||
| 2588 | font-size: 10px; | 2602 | font-size: 10px; |
| 2589 | color: #bdbdbd; | 2603 | color: #bdbdbd; |
| 2590 | margin-left: 3px; | 2604 | margin-left: 3px; |
| 2605 | +} | ||
| 2606 | + | ||
| 2607 | +.card_wrap .custom-table-panel{ | ||
| 2608 | + height: calc(100% - 40px); | ||
| 2609 | +} | ||
| 2610 | + | ||
| 2611 | +#tab_home .card_wrap table tr td{ | ||
| 2612 | + white-space: nowrap; | ||
| 2613 | + overflow: hidden; | ||
| 2614 | + text-overflow: ellipsis; | ||
| 2615 | + cursor: pointer; | ||
| 2616 | +} | ||
| 2617 | +.sm-text{ | ||
| 2618 | + font-size: 12px; | ||
| 2619 | + color: #9a9a9a; | ||
| 2620 | +} | ||
| 2621 | + | ||
| 2622 | +td.lt-no-data{ | ||
| 2623 | + text-align: left; | ||
| 2624 | + font-size: 12px !important; | ||
| 2625 | + color: #ff7676; | ||
| 2626 | + text-indent: 8px; | ||
| 2627 | +} | ||
| 2628 | + | ||
| 2629 | +tr._home_tr_active td.lt-no-data{ | ||
| 2630 | + color: #ffffff; | ||
| 2631 | +} | ||
| 2632 | + | ||
| 2633 | +tr._home_tr_active { | ||
| 2634 | + background: #6a96c5; | ||
| 2635 | + color: #ffffff; | ||
| 2636 | +} | ||
| 2637 | + | ||
| 2638 | +tr._home_tr_active .sm-text{ | ||
| 2639 | + color: #ded8d8; | ||
| 2640 | +} | ||
| 2641 | + | ||
| 2642 | +abbr.abnormal{ | ||
| 2643 | + color: red; | ||
| 2644 | +} | ||
| 2645 | + | ||
| 2646 | +tr._home_tr_active abbr.abnormal{ | ||
| 2647 | + color: #ffffff; | ||
| 2648 | +} | ||
| 2649 | + | ||
| 2650 | +.line_chart:BEFORE { | ||
| 2651 | + content: "\f178"; | ||
| 2652 | + font: normal normal normal 14px/1 FontAwesome; | ||
| 2653 | + position: absolute; | ||
| 2654 | + top: 20px; | ||
| 2655 | + left: 20px; | ||
| 2656 | + color: #d0d0d0; | ||
| 2657 | +} | ||
| 2658 | + | ||
| 2659 | +.line_chart:AFTER { | ||
| 2660 | + content: "\f177"; | ||
| 2661 | + font: normal normal normal 14px/1 FontAwesome; | ||
| 2662 | + position: absolute; | ||
| 2663 | + bottom: 20px; | ||
| 2664 | + right: 20px; | ||
| 2665 | + color: #d0d0d0; | ||
| 2591 | } | 2666 | } |
| 2592 | \ No newline at end of file | 2667 | \ No newline at end of file |
src/main/resources/static/pages/control/line/index.html
| @@ -25,11 +25,39 @@ | @@ -25,11 +25,39 @@ | ||
| 25 | </div> | 25 | </div> |
| 26 | <div class="actions col_hide_1280" > | 26 | <div class="actions col_hide_1280" > |
| 27 | <div class="btn-group"> | 27 | <div class="btn-group"> |
| 28 | - <button type="button" class="btn btn-default" id="deviceReport"> | ||
| 29 | - <i class="fa fa-code-fork"></i> 设备上报</button> | ||
| 30 | - | ||
| 31 | - <button type="button" class="btn btn-default" id="msgAndDirect"> | ||
| 32 | - <i class="fa fa-bell"></i> 调度指令</button> | 28 | + |
| 29 | + <div class="btn-group"> | ||
| 30 | + <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" > | ||
| 31 | + <i class="fa fa-database"></i> 基础数据 | ||
| 32 | + <i class="fa fa-angle-down"></i> | ||
| 33 | + </button> | ||
| 34 | + <ul class="dropdown-menu"> | ||
| 35 | + <li> | ||
| 36 | + <a href="javascript:;" id=""> 车辆配置 </a> | ||
| 37 | + </li> | ||
| 38 | + <li> | ||
| 39 | + <a href="javascript:;" id=""> 人员配置 </a> | ||
| 40 | + </li> | ||
| 41 | + </ul> | ||
| 42 | + </div> | ||
| 43 | + | ||
| 44 | + <div class="btn-group"> | ||
| 45 | + <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" > | ||
| 46 | + <i class="fa fa-bus"></i> 车载设备 | ||
| 47 | + <i class="fa fa-angle-down"></i> | ||
| 48 | + </button> | ||
| 49 | + <ul class="dropdown-menu"> | ||
| 50 | + <li> | ||
| 51 | + <a href="javascript:;" id="deviceConfig"> 设备管理 </a> | ||
| 52 | + </li> | ||
| 53 | + <li> | ||
| 54 | + <a href="javascript:;" id="deviceReport"> 设备上报记录 </a> | ||
| 55 | + </li> | ||
| 56 | + <li> | ||
| 57 | + <a href="javascript:;" id="msgAndDirect"> 指令下发记录 </a> | ||
| 58 | + </li> | ||
| 59 | + </ul> | ||
| 60 | + </div> | ||
| 33 | 61 | ||
| 34 | <div class="btn-group"> | 62 | <div class="btn-group"> |
| 35 | <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" > | 63 | <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" > |
| @@ -174,7 +202,7 @@ | @@ -174,7 +202,7 @@ | ||
| 174 | </li> | 202 | </li> |
| 175 | <li class="menu-item submenu"> | 203 | <li class="menu-item submenu"> |
| 176 | <button type="button" class="menu-btn"> | 204 | <button type="button" class="menu-btn"> |
| 177 | - <span class="menu-text">车辆状态发送</span> | 205 | + <span class="menu-text">车辆状态切换</span> |
| 178 | </button> | 206 | </button> |
| 179 | <menu class="menu"> | 207 | <menu class="menu"> |
| 180 | <li class="menu-item"> | 208 | <li class="menu-item"> |
src/main/resources/static/pages/control/line/js/data.js
| @@ -9,7 +9,7 @@ var _data = (function(){ | @@ -9,7 +9,7 @@ var _data = (function(){ | ||
| 9 | //实时GPS数据 | 9 | //实时GPS数据 |
| 10 | var allGps = {}; | 10 | var allGps = {}; |
| 11 | //10秒刷新一次实时GPS | 11 | //10秒刷新一次实时GPS |
| 12 | - var realGpsT = 1000 * 10; | 12 | + var realGpsT = 1000 * 8; |
| 13 | 13 | ||
| 14 | var dateStr = moment().format('YYYY-MM-DD'); | 14 | var dateStr = moment().format('YYYY-MM-DD'); |
| 15 | //实际排班 | 15 | //实际排班 |
| @@ -33,26 +33,6 @@ var _data = (function(){ | @@ -33,26 +33,6 @@ var _data = (function(){ | ||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | var dataObject = { | 35 | var dataObject = { |
| 36 | - /*//班次发车 | ||
| 37 | - setFcsj: function(schId, fcsj, fcsjT){ | ||
| 38 | - schedules[schId].fcsjActual = fcsj; | ||
| 39 | - schedules[schId].fcsjActualTime = fcsjT; | ||
| 40 | - },*/ | ||
| 41 | - //根据线路编码获取上行和下行班次 | ||
| 42 | - /*findByLineAll: function(xlbm){ | ||
| 43 | - var array = [],sch; | ||
| 44 | - for(var id in schedules){ | ||
| 45 | - sch = schedules[id]; | ||
| 46 | - if(sch.xlBm == xlbm) | ||
| 47 | - array.push(e); | ||
| 48 | - } | ||
| 49 | - //排序 | ||
| 50 | - array.sort(function(a, b){ | ||
| 51 | - return a.fcsjT - b.fcsjT; | ||
| 52 | - }); | ||
| 53 | - | ||
| 54 | - return array; | ||
| 55 | - },*/ | ||
| 56 | //根据线路和上下行获取计划排班 | 36 | //根据线路和上下行获取计划排班 |
| 57 | findSchByLine: function(xlbm, upDown){ | 37 | findSchByLine: function(xlbm, upDown){ |
| 58 | var array = []; | 38 | var array = []; |
| @@ -160,14 +140,10 @@ var _data = (function(){ | @@ -160,14 +140,10 @@ var _data = (function(){ | ||
| 160 | attachSchedulInfo: function(gpsArray){ | 140 | attachSchedulInfo: function(gpsArray){ |
| 161 | $.each(gpsArray, function(){ | 141 | $.each(gpsArray, function(){ |
| 162 | gps = this; | 142 | gps = this; |
| 163 | - if(gps.currSchId) | ||
| 164 | - gps.currSch = schedules[gps.currSchId]; | ||
| 165 | - if(gps.nextSchId) | ||
| 166 | - gps.nextSch = schedules[gps.nextSchId]; | 143 | + if(gps.schId) |
| 144 | + gps.sch = schedules[gps.schId]; | ||
| 167 | 145 | ||
| 168 | }); | 146 | }); |
| 169 | - | ||
| 170 | - return gpsArray; | ||
| 171 | } | 147 | } |
| 172 | //查询站点路由 | 148 | //查询站点路由 |
| 173 | ,queryStationRoute : function(lineId,container, cb, width){ | 149 | ,queryStationRoute : function(lineId,container, cb, width){ |
| @@ -273,8 +249,9 @@ var _data = (function(){ | @@ -273,8 +249,9 @@ var _data = (function(){ | ||
| 273 | } | 249 | } |
| 274 | 250 | ||
| 275 | function refreshGpsProxy(){ | 251 | function refreshGpsProxy(){ |
| 276 | - refreshGps(function(add, up){ | ||
| 277 | - $('#tab_home,#tab_map #mapContainer').trigger('gps_refresh', [add, up]); | 252 | + refreshGps(function(all){ |
| 253 | + //触发元素刷新事件 | ||
| 254 | + $('#tab_home,#tab_map #mapContainer').trigger('gps_refresh', [all]); | ||
| 278 | }); | 255 | }); |
| 279 | } | 256 | } |
| 280 | var upSort = function(a, b){ | 257 | var upSort = function(a, b){ |
| @@ -316,22 +293,49 @@ var _data = (function(){ | @@ -316,22 +293,49 @@ var _data = (function(){ | ||
| 316 | if(!gpsList || gpsList.length == 0) | 293 | if(!gpsList || gpsList.length == 0) |
| 317 | return; | 294 | return; |
| 318 | 295 | ||
| 319 | - var prve = allGps | ||
| 320 | - ,addArray = [] | ||
| 321 | - ,upArray = [] | ||
| 322 | - ,oldGps; | 296 | + //var prve = allGps |
| 297 | + //,addArray = [] | ||
| 298 | + //,upArray = [] | ||
| 299 | + // ,oldGps; | ||
| 323 | for(var i = 0, gps; gps=gpsList[i++];){ | 300 | for(var i = 0, gps; gps=gpsList[i++];){ |
| 324 | - oldGps = prve[gps.deviceId]; | 301 | + /*oldGps = prve[gps.deviceId]; |
| 325 | if(!oldGps){ | 302 | if(!oldGps){ |
| 326 | addArray.push(gps); | 303 | addArray.push(gps); |
| 327 | } | 304 | } |
| 328 | else if(gps.timestamp > oldGps.timestamp){ | 305 | else if(gps.timestamp > oldGps.timestamp){ |
| 329 | //更新 | 306 | //更新 |
| 330 | upArray.push(gps); | 307 | upArray.push(gps); |
| 331 | - } | 308 | + }*/ |
| 309 | + //addArray.push(gps); | ||
| 310 | +/* if(prve[gps.deviceId] && | ||
| 311 | + gps.timestamp == prve[gps.deviceId].timestamp) | ||
| 312 | + continue;*/ | ||
| 313 | + //异常状态检查 | ||
| 314 | + abnormalCheck(gps); | ||
| 315 | + //关联班次信息 | ||
| 316 | + if(gps.schId) | ||
| 317 | + gps.sch = schedules[gps.schId]; | ||
| 318 | + | ||
| 332 | allGps[gps.deviceId] = gps; | 319 | allGps[gps.deviceId] = gps; |
| 333 | } | 320 | } |
| 334 | - cb && cb(addArray, upArray); | 321 | + //cb && cb(addArray, upArray); |
| 322 | + cb && cb(allGps); | ||
| 323 | + } | ||
| 324 | + | ||
| 325 | + function abnormalCheck(gps){ | ||
| 326 | + var routes = stationRoute[gps.lineId][gps.upDown] | ||
| 327 | + ,rs; | ||
| 328 | + $.each(routes , function(){ | ||
| 329 | + if(this.stationCode == gps.stopNo){ | ||
| 330 | + rs = 1; | ||
| 331 | + return false; | ||
| 332 | + } | ||
| 333 | + }); | ||
| 334 | + | ||
| 335 | + if(!rs){ | ||
| 336 | + gps.abnormal = true; | ||
| 337 | + gps.abnormalText = '走向异常?'; | ||
| 338 | + } | ||
| 335 | } | 339 | } |
| 336 | 340 | ||
| 337 | function getGpsError(jqXHR, textStatus){ | 341 | function getGpsError(jqXHR, textStatus){ |
src/main/resources/static/pages/control/line/js/drawSvg.js
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | var drawSvg = (function(){ | 5 | var drawSvg = (function(){ |
| 6 | 6 | ||
| 7 | var mt = 44//顶部距离 | 7 | var mt = 44//顶部距离 |
| 8 | - ,p = 112//上下行之间的间隔 132 | 8 | + ,p = 116//上下行之间的间隔 |
| 9 | ,x = d3.scale.linear() | 9 | ,x = d3.scale.linear() |
| 10 | ,w | 10 | ,w |
| 11 | ,homeSvgMapp = {} | 11 | ,homeSvgMapp = {} |
| @@ -69,12 +69,14 @@ var drawSvg = (function(){ | @@ -69,12 +69,14 @@ var drawSvg = (function(){ | ||
| 69 | init: function(lineId, data, container, w, mtop){ | 69 | init: function(lineId, data, container, w, mtop){ |
| 70 | if(!data || data.length == 0) | 70 | if(!data || data.length == 0) |
| 71 | return; | 71 | return; |
| 72 | - | 72 | + |
| 73 | mt = mtop; | 73 | mt = mtop; |
| 74 | - //起终点站 | 74 | + //索引起终点站 |
| 75 | $.each(data, function(){ | 75 | $.each(data, function(){ |
| 76 | - if(this.stationMark == 'B' || this.stationMark == 'E' ) | 76 | + if(this.stationMark == 'B' || this.stationMark == 'E' ){ |
| 77 | seGps[lineId + '_' + this.id[0]] = []; | 77 | seGps[lineId + '_' + this.id[0]] = []; |
| 78 | + seGps[lineId + '_' + this.id[1]] = []; | ||
| 79 | + } | ||
| 78 | }); | 80 | }); |
| 79 | 81 | ||
| 80 | var svg = d3.select('#' + container).append('svg') | 82 | var svg = d3.select('#' + container).append('svg') |
| @@ -94,22 +96,6 @@ var drawSvg = (function(){ | @@ -94,22 +96,6 @@ var drawSvg = (function(){ | ||
| 94 | //下行线条 | 96 | //下行线条 |
| 95 | drawPath(svg, data, 'down', 10); | 97 | drawPath(svg, data, 'down', 10); |
| 96 | 98 | ||
| 97 | -/* //左弧线 path | ||
| 98 | - svg.append('path') | ||
| 99 | - .attr('d', function(){ | ||
| 100 | - var cx = x(0) - 8; | ||
| 101 | - return arcPath(cx , mt + 5,cx - 20); | ||
| 102 | - }) | ||
| 103 | - .attr('class', 'up_path arc'); | ||
| 104 | - | ||
| 105 | - //右弧线 path | ||
| 106 | - svg.append('path') | ||
| 107 | - .attr('d', function(){ | ||
| 108 | - var cx = x(dLen - 1) + 8; | ||
| 109 | - return arcPath(cx , mt + 5,cx + 20); | ||
| 110 | - }) | ||
| 111 | - .attr('class', 'down_path arc');*/ | ||
| 112 | - | ||
| 113 | var g = svg.append('g').selectAll('g') | 99 | var g = svg.append('g').selectAll('g') |
| 114 | .data(data) | 100 | .data(data) |
| 115 | .enter() | 101 | .enter() |
| @@ -183,12 +169,11 @@ var drawSvg = (function(){ | @@ -183,12 +169,11 @@ var drawSvg = (function(){ | ||
| 183 | if(!gpsArray || gpsArray.length == 0) | 169 | if(!gpsArray || gpsArray.length == 0) |
| 184 | return; | 170 | return; |
| 185 | 171 | ||
| 186 | - //console.log('len', gpsArray.length); | ||
| 187 | //暂时先清空重新画 | 172 | //暂时先清空重新画 |
| 188 | var fGps = gpsArray[0]; | 173 | var fGps = gpsArray[0]; |
| 189 | var hSvg = homeSvgMapp[fGps.lineId] | 174 | var hSvg = homeSvgMapp[fGps.lineId] |
| 190 | ,aSvg = aloneSvgMapp[fGps.lineId]; | 175 | ,aSvg = aloneSvgMapp[fGps.lineId]; |
| 191 | - //svg.selectAll('.vehci-g').remove(); | 176 | + |
| 192 | if(fGps.upDown == 0){ | 177 | if(fGps.upDown == 0){ |
| 193 | hSvg.selectAll('.vehci-g.up').remove(); | 178 | hSvg.selectAll('.vehci-g.up').remove(); |
| 194 | hSvg.selectAll('.start.park').remove(); | 179 | hSvg.selectAll('.start.park').remove(); |
| @@ -205,8 +190,9 @@ var drawSvg = (function(){ | @@ -205,8 +190,9 @@ var drawSvg = (function(){ | ||
| 205 | } | 190 | } |
| 206 | 191 | ||
| 207 | for(var i = 0, gps; gps = gpsArray[i ++];){ | 192 | for(var i = 0, gps; gps = gpsArray[i ++];){ |
| 193 | + //首页svg | ||
| 208 | drawGpsToSvg(gps, hSvg); | 194 | drawGpsToSvg(gps, hSvg); |
| 209 | - | 195 | + //单线路svg |
| 210 | drawGpsToSvg(gps, aSvg, true); | 196 | drawGpsToSvg(gps, aSvg, true); |
| 211 | } | 197 | } |
| 212 | 198 | ||
| @@ -215,25 +201,28 @@ var drawSvg = (function(){ | @@ -215,25 +201,28 @@ var drawSvg = (function(){ | ||
| 215 | for(var eid in seGps){ | 201 | for(var eid in seGps){ |
| 216 | len = seGps[eid].length; | 202 | len = seGps[eid].length; |
| 217 | if(len > 0){ | 203 | if(len > 0){ |
| 218 | - var a_e = $('#' + eid, aSvg[0]) | ||
| 219 | - ,a_x = parseInt(a_e.attr('cx')) | ||
| 220 | - ,a_y = parseInt(a_e.attr('cy')); | ||
| 221 | - tempStartAndStop(aSvg, eid, a_e, a_x, a_y); | ||
| 222 | - | 204 | + //首页svg |
| 223 | var h_e = $('#' + eid, hSvg[0]) | 205 | var h_e = $('#' + eid, hSvg[0]) |
| 224 | ,h_x = parseInt(h_e.attr('cx')) | 206 | ,h_x = parseInt(h_e.attr('cx')) |
| 225 | ,h_y = parseInt(h_e.attr('cy')); | 207 | ,h_y = parseInt(h_e.attr('cy')); |
| 226 | tempStartAndStop(hSvg, eid ,h_e , h_x, h_y); | 208 | tempStartAndStop(hSvg, eid ,h_e , h_x, h_y); |
| 209 | + //单线路svg | ||
| 210 | + var a_e = $('#' + eid, aSvg[0]) | ||
| 211 | + ,a_x = parseInt(a_e.attr('cx')) | ||
| 212 | + ,a_y = parseInt(a_e.attr('cy')); | ||
| 213 | + tempStartAndStop(aSvg, eid, a_e, a_x, a_y); | ||
| 227 | } | 214 | } |
| 228 | } | 215 | } |
| 229 | 216 | ||
| 230 | function tempStartAndStop(svg, eid, e, x, y){ | 217 | function tempStartAndStop(svg, eid, e, x, y){ |
| 218 | + var se = e.attr('class').indexOf('start') != -1?'start':'end'; | ||
| 231 | 219 | ||
| 232 | - var gs = svg.append('g').classed({'start': e.attr('class').indexOf('start') != -1, 'park': true}) | 220 | + var gs = svg.append('g').attr('class', se + ' park') |
| 233 | .selectAll('g').data(seGps[eid]).enter().append('g'); | 221 | .selectAll('g').data(seGps[eid]).enter().append('g'); |
| 234 | 222 | ||
| 223 | + | ||
| 235 | //Y轴居中 | 224 | //Y轴居中 |
| 236 | - y = (y + 66) - len * 13; | 225 | + //y = (y + 66) - len * 13; |
| 237 | gs.append('rect') | 226 | gs.append('rect') |
| 238 | .attr('x', x + 15) | 227 | .attr('x', x + 15) |
| 239 | .attr('y', function(d, i){ | 228 | .attr('y', function(d, i){ |
| @@ -297,6 +286,7 @@ var drawSvg = (function(){ | @@ -297,6 +286,7 @@ var drawSvg = (function(){ | ||
| 297 | } | 286 | } |
| 298 | }; | 287 | }; |
| 299 | 288 | ||
| 289 | + //flag 2张svg , 起终点只画一次 | ||
| 300 | function drawGpsToSvg(gps, svg, flag){ | 290 | function drawGpsToSvg(gps, svg, flag){ |
| 301 | var stionId = gps.lineId + '_' + gps.stopNo | 291 | var stionId = gps.lineId + '_' + gps.stopNo |
| 302 | ,station = $('#' + stionId, svg[0])/* | 292 | ,station = $('#' + stionId, svg[0])/* |
src/main/resources/static/pages/control/line/js/home.js
| @@ -35,10 +35,17 @@ var _home = (function() { | @@ -35,10 +35,17 @@ var _home = (function() { | ||
| 35 | $('.card_wrap').css('height', ah / 3); | 35 | $('.card_wrap').css('height', ah / 3); |
| 36 | 36 | ||
| 37 | // 滚动条 | 37 | // 滚动条 |
| 38 | - $('.card_wrap .table_wrap').slimscroll({ | 38 | + /*$('.card_wrap .table_wrap').slimscroll({ |
| 39 | height : '187px', | 39 | height : '187px', |
| 40 | alwaysVisible : true, | 40 | alwaysVisible : true, |
| 41 | opacity : .8 | 41 | opacity : .8 |
| 42 | + });*/ | ||
| 43 | + | ||
| 44 | + //table 滚动时固定表头 | ||
| 45 | + $('#tab_home .custom-table-panel').on('scroll', function(){ | ||
| 46 | + var top = $(this).scrollTop() | ||
| 47 | + ,$header = $(this).find('.custom-table-header'); | ||
| 48 | + $header.css('top', top); | ||
| 42 | }); | 49 | }); |
| 43 | 50 | ||
| 44 | // SVG线路图 | 51 | // SVG线路图 |
| @@ -54,19 +61,20 @@ var _home = (function() { | @@ -54,19 +61,20 @@ var _home = (function() { | ||
| 54 | // 模拟图GPS刷新事件 | 61 | // 模拟图GPS刷新事件 |
| 55 | $('#tab_home').on( | 62 | $('#tab_home').on( |
| 56 | 'gps_refresh', | 63 | 'gps_refresh', |
| 57 | - function(e, add, up) { | 64 | + function(e, allGps) { |
| 58 | // 现在先每次全量画 | 65 | // 现在先每次全量画 |
| 59 | - var list = _data.findAllGps(); | ||
| 60 | - _data.attachSchedulInfo(list); | 66 | + //var list = _data.findAllGps(); |
| 67 | + //allGps = _data.attachSchedulInfo(allGps); | ||
| 61 | 68 | ||
| 62 | // drawSvg.drawVehicle(list); | 69 | // drawSvg.drawVehicle(list); |
| 63 | // 按线路分组 | 70 | // 按线路分组 |
| 64 | - var listMap = groupByLine(list); | ||
| 65 | - | 71 | + var listMap = groupByLine(allGps); |
| 72 | + | ||
| 66 | for ( var key in listMap) { | 73 | for ( var key in listMap) { |
| 67 | var htmlStr = template('home_table_temp', { | 74 | var htmlStr = template('home_table_temp', { |
| 68 | list : listMap[key] | 75 | list : listMap[key] |
| 69 | }); | 76 | }); |
| 77 | + //表格 | ||
| 70 | $('#tab_' + key).find('tbody').html(htmlStr); | 78 | $('#tab_' + key).find('tbody').html(htmlStr); |
| 71 | // 更新badge | 79 | // 更新badge |
| 72 | $('#' + key + '_badge').text( | 80 | $('#' + key + '_badge').text( |
| @@ -84,7 +92,7 @@ var _home = (function() { | @@ -84,7 +92,7 @@ var _home = (function() { | ||
| 84 | $('.load-anim').fadeOut(800); | 92 | $('.load-anim').fadeOut(800); |
| 85 | $('menu.menu').show(); | 93 | $('menu.menu').show(); |
| 86 | }, 400); | 94 | }, 400); |
| 87 | - | 95 | +/* |
| 88 | setTimeout(function() { | 96 | setTimeout(function() { |
| 89 | // 提示文本 | 97 | // 提示文本 |
| 90 | var promptFlag = storage.getItem('promptFlag_0913'); | 98 | var promptFlag = storage.getItem('promptFlag_0913'); |
| @@ -97,7 +105,7 @@ var _home = (function() { | @@ -97,7 +105,7 @@ var _home = (function() { | ||
| 97 | storage.setItem('promptFlag_0913', 1); | 105 | storage.setItem('promptFlag_0913', 1); |
| 98 | } | 106 | } |
| 99 | }, 1500); | 107 | }, 1500); |
| 100 | - } | 108 | +*/ } |
| 101 | } | 109 | } |
| 102 | 110 | ||
| 103 | function gpslistToMap(gpslist){ | 111 | function gpslistToMap(gpslist){ |
| @@ -117,10 +125,23 @@ var _home = (function() { | @@ -117,10 +125,23 @@ var _home = (function() { | ||
| 117 | 125 | ||
| 118 | rs[key].push(this); | 126 | rs[key].push(this); |
| 119 | }); | 127 | }); |
| 128 | + | ||
| 129 | + //排序 | ||
| 130 | + for(var k in rs){ | ||
| 131 | + rs[k].sort(gpsSort); | ||
| 132 | + } | ||
| 120 | return rs; | 133 | return rs; |
| 121 | } | 134 | } |
| 122 | 135 | ||
| 123 | - | 136 | + function gpsSort(a, b){ |
| 137 | + if(!a.expectStopTime) | ||
| 138 | + return 1; | ||
| 139 | + if(!b.expectStopTime) | ||
| 140 | + return 0; | ||
| 141 | + | ||
| 142 | + return a.expectStopTime - b.expectStopTime; | ||
| 143 | + } | ||
| 144 | + | ||
| 124 | countDown('home.js'); | 145 | countDown('home.js'); |
| 125 | return homeObject; | 146 | return homeObject; |
| 126 | })(); | 147 | })(); |
| 127 | \ No newline at end of file | 148 | \ No newline at end of file |
src/main/resources/static/pages/control/line/js/homeMenu.js
| @@ -34,7 +34,12 @@ var _home_menu = (function(){ | @@ -34,7 +34,12 @@ var _home_menu = (function(){ | ||
| 34 | $('#homeMenu').removeClass('show-menu'); | 34 | $('#homeMenu').removeClass('show-menu'); |
| 35 | }); | 35 | }); |
| 36 | }); | 36 | }); |
| 37 | - | 37 | + //点击选中 |
| 38 | + $('.portlet-fullscreen').on('click', '.vehicDataTable tr td', function(e){ | ||
| 39 | + e.preventDefault(); | ||
| 40 | + $('.vehicDataTable tr._home_tr_active').removeClass('_home_tr_active'); | ||
| 41 | + $(this).parent().addClass('_home_tr_active'); | ||
| 42 | + }); | ||
| 38 | 43 | ||
| 39 | function showMenu(x, y) { | 44 | function showMenu(x, y) { |
| 40 | var menu = $('#homeMenu'), | 45 | var menu = $('#homeMenu'), |
src/main/resources/static/pages/control/line/js/main.js
| 1 | var _main = (function(){ | 1 | var _main = (function(){ |
| 2 | - | ||
| 3 | -/*setTimeout(function(){ | ||
| 4 | - //生成头部选项卡 | ||
| 5 | - var topTabs = '', tabPanels = ''; | ||
| 6 | - $.each(_data.getLines(), function(i, line){ | ||
| 7 | - topTabs += '<li ><a data-id="'+line.lineCode+'" href="#tab_line_'+line.lineCode+'" data-toggle="tab" '+ | ||
| 8 | - 'aria-expanded="false"> '+line.name+'<span>(<zz>0</zz>,<zz>0</zz> <zz>托管</zz>)</span> </a></li>'; | ||
| 9 | - | ||
| 10 | - tabPanels += '<div class="tab-pane fade tab_line" data-id="'+line.lineCode+'" id="tab_line_'+line.lineCode+'"></div>'; | ||
| 11 | - | ||
| 12 | - }); | ||
| 13 | - $('#top-tabs-wrap .nav-tabs').append(topTabs); | ||
| 14 | - $('#top-tabs-wrap .tab-content').append(tabPanels); | ||
| 15 | - | ||
| 16 | - //加载地图页数据 | ||
| 17 | - $('#tab_map').load('/pages/mapmonitor/real/real.html'); | ||
| 18 | - | ||
| 19 | - //初始化单线路调度页面 | ||
| 20 | - _alone.init(function(){ | ||
| 21 | - //初始化信使 | ||
| 22 | - _messenger.init(); | ||
| 23 | - //初始化主页 | ||
| 24 | - homeObject.init(); | ||
| 25 | - | ||
| 26 | - $.each(_data.getLines(), function(){ | ||
| 27 | - //计算应发未发数量 | ||
| 28 | - _messenger.setYFWFNum(this.lineCode); | ||
| 29 | - }); | ||
| 30 | - }); | ||
| 31 | - | ||
| 32 | - //监控模式下,拦截post请求 | ||
| 33 | - if(operationMode == 0){ | ||
| 34 | - $(document).on('ajaxSend', interceptPOST); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | -}, 200)*/ | ||
| 38 | 2 | ||
| 39 | - | ||
| 40 | - /*var startEp = EventProxy.create("template", function (template, data, l10n) { | ||
| 41 | - _.template(template, data, l10n); | ||
| 42 | - });*/ | ||
| 43 | var initEp; | 3 | var initEp; |
| 44 | var mainInstance = { | 4 | var mainInstance = { |
| 45 | start: function(){ | 5 | start: function(){ |
src/main/resources/static/pages/control/line/temps/home_tp.html
| @@ -27,26 +27,42 @@ | @@ -27,26 +27,42 @@ | ||
| 27 | 27 | ||
| 28 | </div> | 28 | </div> |
| 29 | </div> | 29 | </div> |
| 30 | - <table class="table table-striped table-bordered table-advance" | ||
| 31 | - style="table-layout: fixed;"> | ||
| 32 | - <thead> | ||
| 33 | - <tr> | ||
| 34 | - <th style="width: 22%;">车辆编码</th> | ||
| 35 | - <th style="width: 17%;">路牌</th> | ||
| 36 | - <th style="width: 17%;">速度</th> | ||
| 37 | - <th style="width: 22%;">终点时间</th> | ||
| 38 | - <th style="width: 22%;" class="col_hide_1680">下一班</th> | ||
| 39 | - </tr> | ||
| 40 | - </thead> | ||
| 41 | - </table> | ||
| 42 | - <div class="table_wrap"> | ||
| 43 | - <table | ||
| 44 | - class="table table-striped table-bordered table-advance table-hover vehicDataTable" | ||
| 45 | - style="table-layout: fixed;" id="tab_{{lineObj.lineCode}}_0"> | ||
| 46 | - <tbody> | ||
| 47 | - </tbody> | ||
| 48 | - </table> | 30 | + <div class="custom-table-panel"> |
| 31 | + <div style="height: 33px;position: relative;"> | ||
| 32 | + <div class="custom-table-header" style="min-width: 700px;"> | ||
| 33 | + <table class="table table-bordered table-advance" > | ||
| 34 | + <thead> | ||
| 35 | + <tr> | ||
| 36 | + <th width="14%">车辆编码</th> | ||
| 37 | + <th width="8%">速度</th> | ||
| 38 | + <th width="14%">终点时间</th> | ||
| 39 | + <th width="16%">当前站点</th> | ||
| 40 | + <th width="16%">终点站</th> | ||
| 41 | + <th width="11%">计划终点</th> | ||
| 42 | + <th width="10%">驾驶员</th> | ||
| 43 | + <th width="10%">售票员</th> | ||
| 44 | + </tr> | ||
| 45 | + </thead> | ||
| 46 | + </table> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | + <div class="custom-table-body" style="min-width: 700px;"> | ||
| 50 | + <table class="table table-bordered vehicDataTable" id="tab_{{lineObj.lineCode}}_0"> | ||
| 51 | + <colgroup> | ||
| 52 | + <col width="14%"></col> | ||
| 53 | + <col width="8%"></col> | ||
| 54 | + <col width="14%"></col> | ||
| 55 | + <col width="16%"></col> | ||
| 56 | + <col width="16%"></col> | ||
| 57 | + <col width="11%"></col> | ||
| 58 | + <col width="10%"></col> | ||
| 59 | + <col width="10%"></col> | ||
| 60 | + </colgroup> | ||
| 61 | + <tbody></tbody> | ||
| 62 | + </table> | ||
| 63 | + </div> | ||
| 49 | </div> | 64 | </div> |
| 65 | + | ||
| 50 | </div> | 66 | </div> |
| 51 | <div class="col-lg-8 line_chart" id="line_chart_{{lineObj.lineCode}}"> | 67 | <div class="col-lg-8 line_chart" id="line_chart_{{lineObj.lineCode}}"> |
| 52 | <div class="top"> | 68 | <div class="top"> |
| @@ -74,25 +90,40 @@ | @@ -74,25 +90,40 @@ | ||
| 74 | </ul>--> | 90 | </ul>--> |
| 75 | </div> | 91 | </div> |
| 76 | </div> | 92 | </div> |
| 77 | - <table class="table table-striped table-bordered table-advance" | ||
| 78 | - style="table-layout: fixed;"> | ||
| 79 | - <thead> | ||
| 80 | - <tr> | ||
| 81 | - <th style="width: 22%;">车辆编码</th> | ||
| 82 | - <th style="width: 17%;">路牌</th> | ||
| 83 | - <th style="width: 17%;">速度</th> | ||
| 84 | - <th style="width: 22%;">终点时间</th> | ||
| 85 | - <th style="width: 22%;" class="col_hide_1680">下一班</th> | ||
| 86 | - </tr> | ||
| 87 | - </thead> | ||
| 88 | - </table> | ||
| 89 | - <div class="table_wrap"> | ||
| 90 | - <table | ||
| 91 | - class="table table-striped table-bordered table-advance table-hover vehicDataTable" | ||
| 92 | - style="table-layout: fixed;" id="tab_{{lineObj.lineCode}}_1"> | ||
| 93 | - <tbody> | ||
| 94 | - </tbody> | ||
| 95 | - </table> | 93 | + <div class="custom-table-panel"> |
| 94 | + <div style="height: 33px;position: relative;"> | ||
| 95 | + <div class="custom-table-header" style="min-width: 700px;"> | ||
| 96 | + <table class="table table-bordered table-advance" > | ||
| 97 | + <thead> | ||
| 98 | + <tr> | ||
| 99 | + <th width="14%">车辆编码</th> | ||
| 100 | + <th width="8%">速度</th> | ||
| 101 | + <th width="14%">终点时间</th> | ||
| 102 | + <th width="16%">当前站点</th> | ||
| 103 | + <th width="16%">终点站</th> | ||
| 104 | + <th width="11%">计划终点</th> | ||
| 105 | + <th width="10%">驾驶员</th> | ||
| 106 | + <th width="10%">售票员</th> | ||
| 107 | + </tr> | ||
| 108 | + </thead> | ||
| 109 | + </table> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | + <div class="custom-table-body" style="min-width: 700px;"> | ||
| 113 | + <table class="table table-bordered vehicDataTable" id="tab_{{lineObj.lineCode}}_1"> | ||
| 114 | + <colgroup> | ||
| 115 | + <col width="14%"></col> | ||
| 116 | + <col width="8%"></col> | ||
| 117 | + <col width="14%"></col> | ||
| 118 | + <col width="16%"></col> | ||
| 119 | + <col width="16%"></col> | ||
| 120 | + <col width="11%"></col> | ||
| 121 | + <col width="10%"></col> | ||
| 122 | + <col width="10%"></col> | ||
| 123 | + </colgroup> | ||
| 124 | + <tbody></tbody> | ||
| 125 | + </table> | ||
| 126 | + </div> | ||
| 96 | </div> | 127 | </div> |
| 97 | </div> | 128 | </div> |
| 98 | </div> | 129 | </div> |
| @@ -122,23 +153,30 @@ | @@ -122,23 +153,30 @@ | ||
| 122 | <script id="home_table_temp" type="text/html"> | 153 | <script id="home_table_temp" type="text/html"> |
| 123 | {{each list as obj i}} | 154 | {{each list as obj i}} |
| 124 | <tr data-nbbm="{{obj.nbbm}}" data-device="{{obj.deviceId}}"> | 155 | <tr data-nbbm="{{obj.nbbm}}" data-device="{{obj.deviceId}}"> |
| 125 | - <td style="width: 22%;"> {{obj.nbbm}} </td> | ||
| 126 | - <td style="width: 17%;"> | ||
| 127 | - {{if obj.currSch != null}} | ||
| 128 | - {{obj.currSch.lpName}} | 156 | + <td title="{{obj.nbbm}}"> |
| 157 | + {{if !obj.abnormal}} | ||
| 158 | + {{obj.nbbm}} | ||
| 159 | + {{else}} | ||
| 160 | + <abbr class="abnormal" title="{{obj.abnormalText}}">{{obj.nbbm}}</abbr> | ||
| 161 | + {{/if}} | ||
| 162 | + </td> | ||
| 163 | + <td> {{obj.speed}} </td> | ||
| 164 | + <td> | ||
| 165 | + {{if obj.expectStopTime != null}} | ||
| 166 | + {{obj.expectStopTime}} <span class="sm-text">分钟</span> | ||
| 129 | {{else}} | 167 | {{else}} |
| 130 | - 无 | 168 | + <span class="sm-text">无</span> |
| 131 | {{/if}} | 169 | {{/if}} |
| 132 | </td> | 170 | </td> |
| 133 | - <td style="width: 17%;"> {{obj.speed}} </td> | ||
| 134 | - <td style="width: 22%;" > 暂无 </td> | ||
| 135 | - <td style="width: 22%;" class="col_hide_1680"> | ||
| 136 | -{{if obj.nextSch != null}} | ||
| 137 | - {{obj.nextSch.dfsj}} | ||
| 138 | -{{else}} | ||
| 139 | - 无 | ||
| 140 | -{{/if}} | ||
| 141 | - </td> | 171 | + <td title="{{obj.stationName}}"> {{obj.stationName}} </td> |
| 172 | + {{if obj.sch != null}} | ||
| 173 | + <td title="{{obj.sch.zdzName}}"> {{obj.sch.zdzName}} </td> | ||
| 174 | + <td>{{obj.sch.zdsj}}</td> | ||
| 175 | + <td> {{obj.sch.jName}} </td> | ||
| 176 | + <td> {{obj.sch.sName}} </td> | ||
| 177 | + {{else}} | ||
| 178 | + <td colspan=4 class="lt-no-data">无班次信息</td> | ||
| 179 | + {{/if}} | ||
| 142 | </tr> | 180 | </tr> |
| 143 | {{/each}} | 181 | {{/each}} |
| 144 | </script> | 182 | </script> |
src/main/resources/static/pages/control/line/temps/tooltip_tp.html
| @@ -9,14 +9,7 @@ | @@ -9,14 +9,7 @@ | ||
| 9 | <div><a href="javascript:;" data-for="station" class="tip_modal">{{stationName}}</a></div> | 9 | <div><a href="javascript:;" data-for="station" class="tip_modal">{{stationName}}</a></div> |
| 10 | <div>速度:{{speed}}</div> | 10 | <div>速度:{{speed}}</div> |
| 11 | <hr > | 11 | <hr > |
| 12 | - <div>预计 ? 分钟后到达<a href="javascript:;" data-for="station" class="tip_modal">下一站</a></div> | ||
| 13 | - <div>终点站: | ||
| 14 | - <a href="javascript:;" data-for="station" > | ||
| 15 | - {{if currSch != null}} | ||
| 16 | - {{currSch.zdzName}} | ||
| 17 | - {{/if}} | ||
| 18 | - | ||
| 19 | - </a></div> | 12 | + <div>预计 {{expectStopTime}} 分钟到达终点</div> |
| 20 | <hr > | 13 | <hr > |
| 21 | <div class="subtitle">{{fromNow}}更新(在线)</div> | 14 | <div class="subtitle">{{fromNow}}更新(在线)</div> |
| 22 | <div class="subtitle" style="margin-top: 8px;"> | 15 | <div class="subtitle" style="margin-top: 8px;"> |
src/main/resources/static/pages/forecast/sample/css/main.css
| @@ -311,4 +311,16 @@ rect.f_rect{ | @@ -311,4 +311,16 @@ rect.f_rect{ | ||
| 311 | overflow-x: hidden; | 311 | overflow-x: hidden; |
| 312 | padding-right: 15px; | 312 | padding-right: 15px; |
| 313 | margin: 15px 0px; | 313 | margin: 15px 0px; |
| 314 | -} | ||
| 315 | \ No newline at end of file | 314 | \ No newline at end of file |
| 315 | +} | ||
| 316 | + | ||
| 317 | +#forecast_sample_modal ul.tabs-left li{ | ||
| 318 | +} | ||
| 319 | + | ||
| 320 | +#forecast_sample_modal span.desc { | ||
| 321 | + color: #5580a5; | ||
| 322 | + text-align: left; | ||
| 323 | + font-size: 12px; | ||
| 324 | +} | ||
| 325 | +#forecast_sample_modal ul.tabs-left li.active span.desc{ | ||
| 326 | + color: #989292; | ||
| 327 | +} |
src/main/resources/static/pages/forecast/sample/js/svg.js
| @@ -7,7 +7,8 @@ var sampleSvg = (function(){ | @@ -7,7 +7,8 @@ var sampleSvg = (function(){ | ||
| 7 | , margin | 7 | , margin |
| 8 | , _opt | 8 | , _opt |
| 9 | , svg | 9 | , svg |
| 10 | - , _data; | 10 | + , _data |
| 11 | + ,defaultTag; | ||
| 11 | 12 | ||
| 12 | var stationMapp = {}; | 13 | var stationMapp = {}; |
| 13 | //路由 | 14 | //路由 |
| @@ -70,7 +71,7 @@ var sampleSvg = (function(){ | @@ -70,7 +71,7 @@ var sampleSvg = (function(){ | ||
| 70 | }); | 71 | }); |
| 71 | 72 | ||
| 72 | var h = rts[rts.length - 1].cy + 50; | 73 | var h = rts[rts.length - 1].cy + 50; |
| 73 | - svg.style('height', h).style('opacity', 0); | 74 | + svg.style('height', h)/*.style('opacity', 0)*/; |
| 74 | $('#svgWrap').css('height', h + 6); | 75 | $('#svgWrap').css('height', h + 6); |
| 75 | 76 | ||
| 76 | //画线 | 77 | //画线 |
| @@ -97,7 +98,7 @@ var sampleSvg = (function(){ | @@ -97,7 +98,7 @@ var sampleSvg = (function(){ | ||
| 97 | showTags(); | 98 | showTags(); |
| 98 | 99 | ||
| 99 | //d3 anim | 100 | //d3 anim |
| 100 | - svg.transition().delay(100).style('opacity', 1); | 101 | + //svg.transition().delay(100).style('opacity', 1); |
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | //tag 点击事件 | 104 | //tag 点击事件 |
| @@ -141,7 +142,7 @@ var sampleSvg = (function(){ | @@ -141,7 +142,7 @@ var sampleSvg = (function(){ | ||
| 141 | .attr('x', function(d){return d.cp[0]}) | 142 | .attr('x', function(d){return d.cp[0]}) |
| 142 | .attr('y', function(d){return d.cp[1]}) | 143 | .attr('y', function(d){return d.cp[1]}) |
| 143 | .attr('class', 'f_text') | 144 | .attr('class', 'f_text') |
| 144 | - .text(function(d){return d.runTime + 'm'}); | 145 | + .text(function(d){return d.runTime + '分'}); |
| 145 | } | 146 | } |
| 146 | 147 | ||
| 147 | 148 | ||
| @@ -151,24 +152,35 @@ var sampleSvg = (function(){ | @@ -151,24 +152,35 @@ var sampleSvg = (function(){ | ||
| 151 | } | 152 | } |
| 152 | 153 | ||
| 153 | function showTags(){ | 154 | function showTags(){ |
| 155 | + var index = layer.msg('加载中', {icon: 16, time: 0,shade:0.3}); | ||
| 154 | //查询 耗时信息 | 156 | //查询 耗时信息 |
| 155 | $.get('/sample/all', {'lineCode_eq': _opt.lineCode, 'updown_eq': _opt.updown}, function(rs){ | 157 | $.get('/sample/all', {'lineCode_eq': _opt.lineCode, 'updown_eq': _opt.updown}, function(rs){ |
| 156 | //按tag分组数据 | 158 | //按tag分组数据 |
| 157 | _data = {}; | 159 | _data = {}; |
| 158 | - var tags = '';// | 160 | + var tags = '', ct;// |
| 159 | $.each(rs, function(i, d){ | 161 | $.each(rs, function(i, d){ |
| 160 | - if(!_data[d.tag]){ | ||
| 161 | - _data[d.tag] = []; | ||
| 162 | - tags += '<a class="tag" title="'+d.tag+'">'+(d.tag + ' ' + d.sDate + ' - ' + d.eDate)+'</a>'; | 162 | + ct = cutTag(d.tag); |
| 163 | + if(!_data[ct]){ | ||
| 164 | + _data[ct] = []; | ||
| 165 | + tags += '<a class="tag" title="'+ct+'">'+ d.tag +'</a>'; | ||
| 163 | } | 166 | } |
| 164 | - _data[d.tag].push(d); | 167 | + _data[ct].push(d); |
| 165 | }); | 168 | }); |
| 166 | 169 | ||
| 167 | var wrap = $('#trafficChart .sample_tags'); | 170 | var wrap = $('#trafficChart .sample_tags'); |
| 168 | wrap.find('a.tag').remove(); | 171 | wrap.find('a.tag').remove(); |
| 169 | wrap.append(tags); | 172 | wrap.append(tags); |
| 170 | - //选中第一个tag | ||
| 171 | - $('#trafficChart .sample_tags a.tag:eq(0)').click(); | 173 | + |
| 174 | + if(defaultTag){ | ||
| 175 | + $(defaultTag).click(); | ||
| 176 | + defaultTag = null; | ||
| 177 | + } | ||
| 178 | + else{ | ||
| 179 | + //选中第一个tag | ||
| 180 | + $('#trafficChart .sample_tags a.tag:eq(0)').click(); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + layer.close(index); | ||
| 172 | }); | 184 | }); |
| 173 | } | 185 | } |
| 174 | 186 | ||
| @@ -185,7 +197,7 @@ var sampleSvg = (function(){ | @@ -185,7 +197,7 @@ var sampleSvg = (function(){ | ||
| 185 | $.get('/pages/forecast/sample/modal.html', function(rs){ | 197 | $.get('/pages/forecast/sample/modal.html', function(rs){ |
| 186 | var index = layer.open({ | 198 | var index = layer.open({ |
| 187 | type: 1, | 199 | type: 1, |
| 188 | - area: '550px', | 200 | + area: '560px', |
| 189 | content: rs, | 201 | content: rs, |
| 190 | shift: 5, | 202 | shift: 5, |
| 191 | title: '人工编辑', | 203 | title: '人工编辑', |
| @@ -200,7 +212,8 @@ var sampleSvg = (function(){ | @@ -200,7 +212,8 @@ var sampleSvg = (function(){ | ||
| 200 | 212 | ||
| 201 | var drawObject = { | 213 | var drawObject = { |
| 202 | draw: draw , | 214 | draw: draw , |
| 203 | - popAddModal: popAddModal | 215 | + popAddModal: popAddModal, |
| 216 | + setDefaultTag: function(tag){defaultTag = tag; return drawObject;} | ||
| 204 | } | 217 | } |
| 205 | 218 | ||
| 206 | //分析path d 路径中间点 | 219 | //分析path d 路径中间点 |
| @@ -230,5 +243,9 @@ var sampleSvg = (function(){ | @@ -230,5 +243,9 @@ var sampleSvg = (function(){ | ||
| 230 | return cp; | 243 | return cp; |
| 231 | } | 244 | } |
| 232 | 245 | ||
| 246 | + function cutTag(tag){ | ||
| 247 | + return tag.replace(new RegExp(/:/g),'').replace(new RegExp(/ /g),'').replace(new RegExp(/-/g) ,''); | ||
| 248 | + } | ||
| 249 | + | ||
| 233 | return drawObject; | 250 | return drawObject; |
| 234 | })(); | 251 | })(); |
| 235 | \ No newline at end of file | 252 | \ No newline at end of file |
src/main/resources/static/pages/forecast/sample/main.html
| @@ -264,8 +264,10 @@ | @@ -264,8 +264,10 @@ | ||
| 264 | delete param.dr_etime; | 264 | delete param.dr_etime; |
| 265 | param.timeRange = timeRange; | 265 | param.timeRange = timeRange; |
| 266 | 266 | ||
| 267 | - $.post('/sample/create/gps', {data: encodeURI(JSON.stringify(param))}, function(rs){ | ||
| 268 | - console.log(rs); | 267 | + layer.msg('服务器正在处理数据,请稍等...', {icon: 16, shade: 0.3}); |
| 268 | + $post('/sample/create/gps', {data: encodeURI(JSON.stringify(param))}, function(rs){ | ||
| 269 | + layer.closeAll(); | ||
| 270 | + drawSvg(); | ||
| 269 | }); | 271 | }); |
| 270 | } | 272 | } |
| 271 | }catch (e){ | 273 | }catch (e){ |
src/main/resources/static/pages/forecast/sample/modal.html
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | <ul class="nav nav-tabs tabs-left"> | 8 | <ul class="nav nav-tabs tabs-left"> |
| 9 | {{each data as obj i}} | 9 | {{each data as obj i}} |
| 10 | <li > | 10 | <li > |
| 11 | - <a href="#tab_sample_{{i}}" data-toggle="tab" title="{{obj.t}}"> {{obj.t}} </a> | 11 | + <a href="#tab_sample_{{i}}" data-toggle="tab" title="{{obj.t}}"> {{#obj.escapeTag}} </a> |
| 12 | </li> | 12 | </li> |
| 13 | {{/each}} | 13 | {{/each}} |
| 14 | <li ><a href="#tab_sample_add" data-toggle="tab" style="font-size: 12px;color: red;"> <i class="fa fa-plus"></i> 新增 </a></li> | 14 | <li ><a href="#tab_sample_add" data-toggle="tab" style="font-size: 12px;color: red;"> <i class="fa fa-plus"></i> 新增 </a></li> |
| @@ -89,9 +89,9 @@ | @@ -89,9 +89,9 @@ | ||
| 89 | <label class="col-md-3 control-label">时区:</label> | 89 | <label class="col-md-3 control-label">时区:</label> |
| 90 | <div class="col-md-9"> | 90 | <div class="col-md-9"> |
| 91 | <select class="form-control" name="tag" style="width:100%;" multiple required> | 91 | <select class="form-control" name="tag" style="width:100%;" multiple required> |
| 92 | - <option value="早高峰">早高峰</option> | ||
| 93 | - <option value="平峰">平峰</option> | ||
| 94 | - <option value="晚高峰">晚高峰</option> | 92 | + {{each tsArray as t i}} |
| 93 | + <option value="{{t}}">{{t}}</option> | ||
| 94 | + {{/each}} | ||
| 95 | </select> | 95 | </select> |
| 96 | </div> | 96 | </div> |
| 97 | </div> | 97 | </div> |
| @@ -129,9 +129,12 @@ | @@ -129,9 +129,12 @@ | ||
| 129 | <script> | 129 | <script> |
| 130 | !function(){ | 130 | !function(){ |
| 131 | var _data,_opt,id, currentData, layero, drawObject; | 131 | var _data,_opt,id, currentData, layero, drawObject; |
| 132 | - var tagRange = {'早高峰': {s: '06:31', e: '08:30'}, '平峰': {s: '08:31', e: '16:00'}, '晚高峰': {s: '16:01', e: '18:00'}}; | 132 | + var tagRange = {}; |
| 133 | 133 | ||
| 134 | $('#forecast_sample_modal').on('init', function(e, rs){ | 134 | $('#forecast_sample_modal').on('init', function(e, rs){ |
| 135 | + //提取出tag Range | ||
| 136 | + var tsArray = extractTag(rs._data); | ||
| 137 | + | ||
| 135 | _data = rs._data; | 138 | _data = rs._data; |
| 136 | _opt = rs._opt; | 139 | _opt = rs._opt; |
| 137 | drawObject = rs.drawObject; | 140 | drawObject = rs.drawObject; |
| @@ -147,8 +150,14 @@ | @@ -147,8 +150,14 @@ | ||
| 147 | var eid = id, sid = _prve.stationCode; | 150 | var eid = id, sid = _prve.stationCode; |
| 148 | var sampData = searchData(sid, eid); | 151 | var sampData = searchData(sid, eid); |
| 149 | var baseData = {sid: sid, eid: eid, sName: toName(sid), eName: toName(eid)}; | 152 | var baseData = {sid: sid, eid: eid, sName: toName(sid), eName: toName(eid)}; |
| 150 | - console.log('baseData', baseData); | ||
| 151 | - var html = template('forecast_sample_tab_detail_temp', {data: sampData, base: baseData}); | 153 | + |
| 154 | + //tag加换行符 | ||
| 155 | + $.each(sampData, function(){ | ||
| 156 | + var t = this.d.tag.replace(new RegExp(/ /g),''); | ||
| 157 | + this.escapeTag = t.substr(0, t.length - 11) + '<br>' + '<span class="desc">' + t.substr(t.length - 11, 11) + '</span>'; | ||
| 158 | + }); | ||
| 159 | + | ||
| 160 | + var html = template('forecast_sample_tab_detail_temp', {data: sampData, base: baseData, tsArray: tsArray}); | ||
| 152 | $('#forecast_sample_modal .row').html(html); | 161 | $('#forecast_sample_modal .row').html(html); |
| 153 | //默认选中tab | 162 | //默认选中tab |
| 154 | defaultSelect(rs.tag); | 163 | defaultSelect(rs.tag); |
| @@ -180,6 +189,10 @@ | @@ -180,6 +189,10 @@ | ||
| 180 | $post('/sample', param, function(){ | 189 | $post('/sample', param, function(){ |
| 181 | layer.closeAll(); | 190 | layer.closeAll(); |
| 182 | layer.msg('保存成功!'); | 191 | layer.msg('保存成功!'); |
| 192 | + | ||
| 193 | + if(rs.tag) | ||
| 194 | + drawObject.setDefaultTag('#trafficChart .sample_tags a.tag[title='+rs.tag+']'); | ||
| 195 | + | ||
| 183 | drawObject.draw(_opt); | 196 | drawObject.draw(_opt); |
| 184 | }); | 197 | }); |
| 185 | } | 198 | } |
| @@ -294,5 +307,23 @@ | @@ -294,5 +307,23 @@ | ||
| 294 | } | 307 | } |
| 295 | return rs; | 308 | return rs; |
| 296 | } | 309 | } |
| 310 | + | ||
| 311 | + function extractTag(_data){ | ||
| 312 | + var rs = []; | ||
| 313 | + var len, t, s, e; | ||
| 314 | + for(var key in _data){ | ||
| 315 | + len = key.length; | ||
| 316 | + t = key.substring(0, len - 8); | ||
| 317 | + s = key.substring(len - 8, len - 4); | ||
| 318 | + e = key.substring(len - 4, len); | ||
| 319 | + | ||
| 320 | + s = s.substr(0, 2) + ':' + s.substr(2); | ||
| 321 | + e = e.substr(0, 2) + ':' + e.substr(2); | ||
| 322 | + tagRange[t] = {s: s, e: e}; | ||
| 323 | + rs.push(t); | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + return rs; | ||
| 327 | + } | ||
| 297 | }(); | 328 | }(); |
| 298 | </script> | 329 | </script> |
| 299 | \ No newline at end of file | 330 | \ No newline at end of file |
src/main/resources/static/pages/mapmonitor/alone/wrap.html
| @@ -32,8 +32,8 @@ | @@ -32,8 +32,8 @@ | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | function refreshGpsProxy(){ | 34 | function refreshGpsProxy(){ |
| 35 | - refreshGps(function(add, up){ | ||
| 36 | - $('#tab_map #mapContainer').trigger('gps_refresh', [add, up]); | 35 | + refreshGps(function(all){ |
| 36 | + $('#tab_map #mapContainer').trigger('gps_refresh', [all]); | ||
| 37 | }); | 37 | }); |
| 38 | } | 38 | } |
| 39 | function refreshGps(cb){ | 39 | function refreshGps(cb){ |
| @@ -48,23 +48,11 @@ | @@ -48,23 +48,11 @@ | ||
| 48 | function getGpsSuccess(gpsList){ | 48 | function getGpsSuccess(gpsList){ |
| 49 | if(!gpsList || gpsList.length == 0) | 49 | if(!gpsList || gpsList.length == 0) |
| 50 | return; | 50 | return; |
| 51 | - | ||
| 52 | - var prve = allGps | ||
| 53 | - ,addArray = [] | ||
| 54 | - ,upArray = [] | ||
| 55 | - ,oldGps; | 51 | + |
| 56 | for(var i = 0, gps; gps=gpsList[i++];){ | 52 | for(var i = 0, gps; gps=gpsList[i++];){ |
| 57 | - oldGps = prve[gps.deviceId]; | ||
| 58 | - if(!oldGps){ | ||
| 59 | - addArray.push(gps); | ||
| 60 | - } | ||
| 61 | - else if(gps.timestamp > oldGps.timestamp){ | ||
| 62 | - //更新 | ||
| 63 | - upArray.push(gps); | ||
| 64 | - } | ||
| 65 | allGps[gps.deviceId] = gps; | 53 | allGps[gps.deviceId] = gps; |
| 66 | } | 54 | } |
| 67 | - cb && cb(addArray, upArray); | 55 | + cb && cb(allGps); |
| 68 | } | 56 | } |
| 69 | 57 | ||
| 70 | function getGpsError(jqXHR, textStatus){ | 58 | function getGpsError(jqXHR, textStatus){ |
src/main/resources/static/pages/mapmonitor/real/real.html
| @@ -124,19 +124,18 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) { | @@ -124,19 +124,18 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) { | ||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | //GPS刷新事件 | 126 | //GPS刷新事件 |
| 127 | -$('#mapContainer').on('gps_refresh', function(e, add, up){ | 127 | +$('#mapContainer').on('gps_refresh', function(e, all){ |
| 128 | if($(this).is(":hidden")) | 128 | if($(this).is(":hidden")) |
| 129 | return; | 129 | return; |
| 130 | - var all = add ,gps; | 130 | +/* var all = add ,gps; |
| 131 | if(up) | 131 | if(up) |
| 132 | - all = all.concat(up); | 132 | + all = all.concat(up); */ |
| 133 | 133 | ||
| 134 | $.each(all, function(){ | 134 | $.each(all, function(){ |
| 135 | consts.allGps[this.deviceId] = this; | 135 | consts.allGps[this.deviceId] = this; |
| 136 | }); | 136 | }); |
| 137 | 137 | ||
| 138 | var type = $('.mapTools .item.active').data('click'); | 138 | var type = $('.mapTools .item.active').data('click'); |
| 139 | - console.log(type); | ||
| 140 | switch (type) { | 139 | switch (type) { |
| 141 | case 'vehicle': | 140 | case 'vehicle': |
| 142 | lineGroup.gpsRefresh(); | 141 | lineGroup.gpsRefresh(); |
src/main/resources/static/pages/scheduleApp/module/common/dt/MyEmployeeGroupWrapTemplate.html
| 1 | -<div name="{{$saEmployeegroupCtrl.$name_attr}}" | ||
| 2 | - ng-model="$saEmployeegroupCtrl.$$internalmodel"> | ||
| 3 | - | ||
| 4 | - <style> | ||
| 5 | - .employee-select { | ||
| 6 | - min-height: 180px; | ||
| 7 | - border: 1px solid #ddd; | ||
| 8 | - } | ||
| 9 | - .employee-select .employee-input { | ||
| 10 | - margin: 5px 5px 0px 5px; | ||
| 11 | - padding-left: 0; | ||
| 12 | - } | ||
| 13 | - .employee-select .employee-select-cont { | ||
| 14 | - text-align: left; | ||
| 15 | - min-height: 60px; | ||
| 16 | - padding-right: 0px; | ||
| 17 | - } | ||
| 18 | - .employee-select .employee-select-body { | ||
| 19 | - margin-top: 5px; | ||
| 20 | - overflow: auto; | ||
| 21 | - width: auto; | ||
| 22 | - min-height: 5px; | ||
| 23 | - } | ||
| 24 | - .employee-select .employee { | ||
| 25 | - display: inline-block; | ||
| 26 | - padding: 8px; | ||
| 27 | - min-width: 50px; | ||
| 28 | - text-align: center; | ||
| 29 | - border: 1px solid #C1C1C1; | ||
| 30 | - color: #666; | ||
| 31 | - border-radius: 5px !important; | ||
| 32 | - margin: 5px; | ||
| 33 | - } | ||
| 34 | - .employee-select .employee.active { | ||
| 35 | - color: white; | ||
| 36 | - background: #5A81A7; | ||
| 37 | - border: 1px solid #5A81A7; | ||
| 38 | - } | ||
| 39 | - .employee-select .employee.start { | ||
| 40 | - color: white; | ||
| 41 | - background: #32C5D2; | ||
| 42 | - border: 1px solid #32C5D2; | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - .employee-select .employeeGroup { | ||
| 46 | - display: inline-block; | ||
| 47 | - padding: 8px; | ||
| 48 | - min-width: 50px; | ||
| 49 | - text-align: center; | ||
| 50 | - border: 1px solid #C1C1C1; | ||
| 51 | - color: #666; | ||
| 52 | - border-radius: 5px !important; | ||
| 53 | - margin: 5px; | ||
| 54 | - } | ||
| 55 | - .employee-select .employeeGroup.active { | ||
| 56 | - color: white; | ||
| 57 | - background: #8DA29F; | ||
| 58 | - border: 1px solid #8DA29F; | ||
| 59 | - min-width: 100px; | ||
| 60 | - max-width: 200px; | ||
| 61 | - } | ||
| 62 | - .employee-select .employeeGroup.start { | ||
| 63 | - color: white; | ||
| 64 | - background: #32C5D2; | ||
| 65 | - border: 1px solid #32C5D2; | ||
| 66 | - min-width: 100px; | ||
| 67 | - max-width: 200px; | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - | ||
| 71 | - </style> | ||
| 72 | - | ||
| 73 | - <div class="col-md-12 employee-select"> | ||
| 74 | - <div class="col-md-12 employee-input"> | ||
| 75 | - <div class="col-md-9"> | ||
| 76 | - 人员列表,共{{$saEmployeegroupCtrl.$$data.length}}组 | ||
| 77 | - | ||
| 78 | - </div> | ||
| 79 | - <div class="checkbox col-md-3" style="min-height: 19px; color: black;"> | ||
| 80 | - <label> | ||
| 81 | - <input type="checkbox" ng-model="$saEmployeegroupCtrl.$$isFB"/> | ||
| 82 | - 是否分班 | ||
| 83 | - </label> | ||
| 84 | - </div> | ||
| 85 | - | ||
| 86 | - </div> | ||
| 87 | - <div class="col-md-12 employee-select-cont"> | ||
| 88 | - <div class="employee-select-body"> | ||
| 89 | - <div class="employee active" | ||
| 90 | - ng-repeat="$d in $saEmployeegroupCtrl.$$data track by $index" | ||
| 91 | - ng-click="$saEmployeegroupCtrl.$$internal_rylist_click($index)"> | ||
| 92 | - <span ng-if="$d.spy"> | ||
| 93 | - {{$d.jsy}}-{{$d.spy}} | ||
| 94 | - <i class="fa fa-ticket" aria-hidden="true"></i> | ||
| 95 | - </span> | ||
| 96 | - <span ng-if="!$d.spy"> | ||
| 97 | - <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 98 | - {{$d.jsy}} | ||
| 99 | - </span> | ||
| 100 | - </div> | ||
| 101 | - </div> | ||
| 102 | - </div> | ||
| 103 | - | ||
| 104 | - <!-- 不分班 --> | ||
| 105 | - <div class="col-md-12 employee-input" ng-if="!$saEmployeegroupCtrl.$$isFB"> | ||
| 106 | - <div class="col-md-12"> | ||
| 107 | - 已经选中的人员列表,共{{$saEmployeegroupCtrl.$$dataSelected.length}}组, | ||
| 108 | - 初始人员,{{$saEmployeegroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataSelectedStart + 1) + "组"}} | ||
| 109 | - </div> | ||
| 110 | - </div> | ||
| 111 | - <div class="col-md-12 employee-select-cont" ng-if="!$saEmployeegroupCtrl.$$isFB"> | ||
| 112 | - <div class="employee-select-body"> | ||
| 113 | - <div ng-class="{employee: true, active: true, start: $d.isstart}" | ||
| 114 | - ng-repeat="$d in $saEmployeegroupCtrl.$$dataSelected track by $index" | ||
| 115 | - ng-click="$saEmployeegroupCtrl.$$internal_selrylist_click($index)" | ||
| 116 | - ng-dblclick="$saEmployeegroupCtrl.$$internal_selrylist_dbclick($index)"> | ||
| 117 | - <span ng-if="$d.spy"> | ||
| 118 | - {{$d.jsy}}-{{$d.spy}} | ||
| 119 | - <i class="fa fa-ticket" aria-hidden="true"></i> | ||
| 120 | - </span> | ||
| 121 | - <span ng-if="!$d.spy"> | ||
| 122 | - <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 123 | - {{$d.jsy}} | ||
| 124 | - </span> | ||
| 125 | - | ||
| 126 | - </div> | ||
| 127 | - </div> | ||
| 128 | - </div> | ||
| 129 | - | ||
| 130 | - <!-- 分班 --> | ||
| 131 | - <div class="col-md-12 employee-input" ng-if="$saEmployeegroupCtrl.$$isFB"> | ||
| 132 | - <div class="col-md-12"> | ||
| 133 | - 已经选中的分班人员列表,共{{$saEmployeegroupCtrl.$$dataFBSelected.length}}组, | ||
| 134 | - 初始分班人员,{{$saEmployeegroupCtrl.$$dataFBSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataFBSelectedStart + 1) + "组"}} | ||
| 135 | - </div> | ||
| 136 | - </div> | ||
| 137 | - <div class="col-md-12 employee-select-cont" ng-if="$saEmployeegroupCtrl.$$isFB"> | ||
| 138 | - <div class="employee-select-body"> | ||
| 139 | - <div ng-class="{employeeGroup: true, active: true, start: $d.isstart}" | ||
| 140 | - ng-repeat="$d in $saEmployeegroupCtrl.$$dataFBSelected track by $index" | ||
| 141 | - ng-click="$saEmployeegroupCtrl.$$internal_selrygrouplist_click($index)" | ||
| 142 | - ng-dblclick="$saEmployeegroupCtrl.$$internal_selrygrouplist_dbclick($index)"> | ||
| 143 | - | ||
| 144 | - <div> | ||
| 145 | - <i class="fa fa-sun-o" aria-hidden="true"></i> | ||
| 146 | - <div ng-class="{employee: true, active: true, start: $d.group[0].isselected}" | ||
| 147 | - ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 0, $event)" | ||
| 148 | - ng-if="$d.group[0].spy"> | ||
| 149 | - <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 150 | - {{$d.group[0].jsy}} | ||
| 151 | - - | ||
| 152 | - <i class="fa fa-ticket" aria-hidden="true"></i> | ||
| 153 | - {{$d.group[0].spy}} | ||
| 154 | - </div> | ||
| 155 | - <div ng-class="{employee: true, active: true, start: $d.group[0].isselected}" | ||
| 156 | - ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 0, $event)" | ||
| 157 | - ng-if="!$d.group[0].spy"> | ||
| 158 | - <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 159 | - {{$d.group[0].jsy}} | ||
| 160 | - </div> | ||
| 161 | - </div> | ||
| 162 | - | ||
| 163 | - <div> | ||
| 164 | - <i class="fa fa-moon-o" aria-hidden="true"></i> | ||
| 165 | - <div ng-class="{employee: true, active: true, start: $d.group[1].isselected}" | ||
| 166 | - ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 1, $event)" | ||
| 167 | - ng-if="$d.group[1].spy"> | ||
| 168 | - <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 169 | - {{$d.group[1].jsy}} | ||
| 170 | - - | ||
| 171 | - <i class="fa fa-ticket" aria-hidden="true"></i> | ||
| 172 | - {{$d.group[1].spy}} | ||
| 173 | - </div> | ||
| 174 | - <div ng-class="{employee: true, active: true, start: $d.group[1].isselected}" | ||
| 175 | - ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 1, $event)" | ||
| 176 | - ng-if="!$d.group[1].spy"> | ||
| 177 | - <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 178 | - {{$d.group[1].jsy}} | ||
| 179 | - </div> | ||
| 180 | - </div> | ||
| 181 | - | ||
| 182 | - | ||
| 183 | - </div> | ||
| 184 | - | ||
| 185 | - </div> | ||
| 186 | - </div> | ||
| 187 | - | ||
| 188 | - | ||
| 189 | - | ||
| 190 | - </div> | ||
| 191 | - | 1 | +<div name="{{$saEmployeegroupCtrl.$name_attr}}" |
| 2 | + ng-model="$saEmployeegroupCtrl.$$internalmodel"> | ||
| 3 | + | ||
| 4 | + <style> | ||
| 5 | + .employee-select { | ||
| 6 | + min-height: 180px; | ||
| 7 | + border: 1px solid #ddd; | ||
| 8 | + } | ||
| 9 | + .employee-select .employee-input { | ||
| 10 | + margin: 5px 5px 0px 5px; | ||
| 11 | + padding-left: 0; | ||
| 12 | + } | ||
| 13 | + .employee-select .employee-select-cont { | ||
| 14 | + text-align: left; | ||
| 15 | + min-height: 60px; | ||
| 16 | + padding-right: 0px; | ||
| 17 | + } | ||
| 18 | + .employee-select .employee-select-body { | ||
| 19 | + margin-top: 5px; | ||
| 20 | + overflow: auto; | ||
| 21 | + width: auto; | ||
| 22 | + min-height: 5px; | ||
| 23 | + } | ||
| 24 | + .employee-select .employee { | ||
| 25 | + display: inline-block; | ||
| 26 | + padding: 8px; | ||
| 27 | + min-width: 50px; | ||
| 28 | + text-align: center; | ||
| 29 | + border: 1px solid #C1C1C1; | ||
| 30 | + color: #666; | ||
| 31 | + border-radius: 5px !important; | ||
| 32 | + margin: 5px; | ||
| 33 | + } | ||
| 34 | + .employee-select .employee.active { | ||
| 35 | + color: white; | ||
| 36 | + background: #5A81A7; | ||
| 37 | + border: 1px solid #5A81A7; | ||
| 38 | + } | ||
| 39 | + .employee-select .employee.start { | ||
| 40 | + color: white; | ||
| 41 | + background: #32C5D2; | ||
| 42 | + border: 1px solid #32C5D2; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + .employee-select .employeeGroup { | ||
| 46 | + display: inline-block; | ||
| 47 | + padding: 8px; | ||
| 48 | + min-width: 50px; | ||
| 49 | + text-align: center; | ||
| 50 | + border: 1px solid #C1C1C1; | ||
| 51 | + color: #666; | ||
| 52 | + border-radius: 5px !important; | ||
| 53 | + margin: 5px; | ||
| 54 | + } | ||
| 55 | + .employee-select .employeeGroup.active { | ||
| 56 | + color: white; | ||
| 57 | + background: #8DA29F; | ||
| 58 | + border: 1px solid #8DA29F; | ||
| 59 | + min-width: 100px; | ||
| 60 | + max-width: 200px; | ||
| 61 | + } | ||
| 62 | + .employee-select .employeeGroup.start { | ||
| 63 | + color: white; | ||
| 64 | + background: #32C5D2; | ||
| 65 | + border: 1px solid #32C5D2; | ||
| 66 | + min-width: 100px; | ||
| 67 | + max-width: 200px; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + </style> | ||
| 72 | + | ||
| 73 | + <div class="col-md-12 employee-select"> | ||
| 74 | + <div class="col-md-12 employee-input"> | ||
| 75 | + <div class="col-md-9"> | ||
| 76 | + 人员列表,共{{$saEmployeegroupCtrl.$$data.length}}组 | ||
| 77 | + | ||
| 78 | + </div> | ||
| 79 | + <div class="checkbox col-md-3" style="min-height: 19px; color: black;"> | ||
| 80 | + <label> | ||
| 81 | + <input type="checkbox" ng-model="$saEmployeegroupCtrl.$$isFB"/> | ||
| 82 | + 是否分班 | ||
| 83 | + </label> | ||
| 84 | + </div> | ||
| 85 | + | ||
| 86 | + </div> | ||
| 87 | + <div class="col-md-12 employee-select-cont"> | ||
| 88 | + <div class="employee-select-body"> | ||
| 89 | + <div class="employee active" | ||
| 90 | + ng-repeat="$d in $saEmployeegroupCtrl.$$data track by $index" | ||
| 91 | + ng-click="$saEmployeegroupCtrl.$$internal_rylist_click($index)"> | ||
| 92 | + <span ng-if="$d.spy"> | ||
| 93 | + {{$d.jsy}}-{{$d.spy}} | ||
| 94 | + <i class="fa fa-ticket" aria-hidden="true"></i> | ||
| 95 | + </span> | ||
| 96 | + <span ng-if="!$d.spy"> | ||
| 97 | + <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 98 | + {{$d.jsy}} | ||
| 99 | + </span> | ||
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | + </div> | ||
| 103 | + | ||
| 104 | + <!-- 不分班 --> | ||
| 105 | + <div class="col-md-12 employee-input" ng-if="!$saEmployeegroupCtrl.$$isFB"> | ||
| 106 | + <div class="col-md-12"> | ||
| 107 | + 已经选中的人员列表,共{{$saEmployeegroupCtrl.$$dataSelected.length}}组, | ||
| 108 | + 初始人员,{{$saEmployeegroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataSelectedStart + 1) + "组"}} | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + <div class="col-md-12 employee-select-cont" ng-if="!$saEmployeegroupCtrl.$$isFB"> | ||
| 112 | + <div class="employee-select-body"> | ||
| 113 | + <div ng-class="{employee: true, active: true, start: $d.isstart}" | ||
| 114 | + ng-repeat="$d in $saEmployeegroupCtrl.$$dataSelected track by $index" | ||
| 115 | + ng-click="$saEmployeegroupCtrl.$$internal_selrylist_click($index)" | ||
| 116 | + ng-dblclick="$saEmployeegroupCtrl.$$internal_selrylist_dbclick($index)"> | ||
| 117 | + <span ng-if="$d.spy"> | ||
| 118 | + {{$d.jsy}}-{{$d.spy}} | ||
| 119 | + <i class="fa fa-ticket" aria-hidden="true"></i> | ||
| 120 | + </span> | ||
| 121 | + <span ng-if="!$d.spy"> | ||
| 122 | + <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 123 | + {{$d.jsy}} | ||
| 124 | + </span> | ||
| 125 | + | ||
| 126 | + </div> | ||
| 127 | + </div> | ||
| 128 | + </div> | ||
| 129 | + | ||
| 130 | + <!-- 分班 --> | ||
| 131 | + <div class="col-md-12 employee-input" ng-if="$saEmployeegroupCtrl.$$isFB"> | ||
| 132 | + <div class="col-md-12"> | ||
| 133 | + 已经选中的分班人员列表,共{{$saEmployeegroupCtrl.$$dataFBSelected.length}}组, | ||
| 134 | + 初始分班人员,{{$saEmployeegroupCtrl.$$dataFBSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataFBSelectedStart + 1) + "组"}} | ||
| 135 | + </div> | ||
| 136 | + </div> | ||
| 137 | + <div class="col-md-12 employee-select-cont" ng-if="$saEmployeegroupCtrl.$$isFB"> | ||
| 138 | + <div class="employee-select-body"> | ||
| 139 | + <div ng-class="{employeeGroup: true, active: true, start: $d.isstart}" | ||
| 140 | + ng-repeat="$d in $saEmployeegroupCtrl.$$dataFBSelected track by $index" | ||
| 141 | + ng-click="$saEmployeegroupCtrl.$$internal_selrygrouplist_click($index)" | ||
| 142 | + ng-dblclick="$saEmployeegroupCtrl.$$internal_selrygrouplist_dbclick($index)"> | ||
| 143 | + | ||
| 144 | + <div> | ||
| 145 | + <i class="fa fa-sun-o" aria-hidden="true"></i> | ||
| 146 | + <div ng-class="{employee: true, active: true, start: $d.group[0].isselected}" | ||
| 147 | + ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 0, $event)" | ||
| 148 | + ng-if="$d.group[0].spy"> | ||
| 149 | + <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 150 | + {{$d.group[0].jsy}} | ||
| 151 | + - | ||
| 152 | + <i class="fa fa-ticket" aria-hidden="true"></i> | ||
| 153 | + {{$d.group[0].spy}} | ||
| 154 | + </div> | ||
| 155 | + <div ng-class="{employee: true, active: true, start: $d.group[0].isselected}" | ||
| 156 | + ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 0, $event)" | ||
| 157 | + ng-if="!$d.group[0].spy"> | ||
| 158 | + <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 159 | + {{$d.group[0].jsy}} | ||
| 160 | + </div> | ||
| 161 | + </div> | ||
| 162 | + | ||
| 163 | + <div> | ||
| 164 | + <i class="fa fa-moon-o" aria-hidden="true"></i> | ||
| 165 | + <div ng-class="{employee: true, active: true, start: $d.group[1].isselected}" | ||
| 166 | + ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 1, $event)" | ||
| 167 | + ng-if="$d.group[1].spy"> | ||
| 168 | + <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 169 | + {{$d.group[1].jsy}} | ||
| 170 | + - | ||
| 171 | + <i class="fa fa-ticket" aria-hidden="true"></i> | ||
| 172 | + {{$d.group[1].spy}} | ||
| 173 | + </div> | ||
| 174 | + <div ng-class="{employee: true, active: true, start: $d.group[1].isselected}" | ||
| 175 | + ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 1, $event)" | ||
| 176 | + ng-if="!$d.group[1].spy"> | ||
| 177 | + <i class="fa fa-bus" aria-hidden="true"></i> | ||
| 178 | + {{$d.group[1].jsy}} | ||
| 179 | + </div> | ||
| 180 | + </div> | ||
| 181 | + | ||
| 182 | + | ||
| 183 | + </div> | ||
| 184 | + | ||
| 185 | + </div> | ||
| 186 | + </div> | ||
| 187 | + | ||
| 188 | + | ||
| 189 | + | ||
| 190 | + </div> | ||
| 191 | + | ||
| 192 | </div> | 192 | </div> |
| 193 | \ No newline at end of file | 193 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/dt/MyGuideboardGroupWrapTemplate.html
| 1 | -<div name="{{$saGuideboardgroupCtrl.$name_attr}}" | ||
| 2 | - ng-model="$saGuideboardgroupCtrl.$$internalmodel"> | ||
| 3 | - | ||
| 4 | - <style> | ||
| 5 | - .guideboard-select { | ||
| 6 | - min-height: 180px; | ||
| 7 | - border: 1px solid #ddd; | ||
| 8 | - } | ||
| 9 | - .guideboard-select .guideboard-input { | ||
| 10 | - margin: 5px 5px 0px 5px; | ||
| 11 | - padding-left: 0; | ||
| 12 | - } | ||
| 13 | - .guideboard-select .guideboard-select-cont { | ||
| 14 | - text-align: left; | ||
| 15 | - min-height: 60px; | ||
| 16 | - padding-right: 0px; | ||
| 17 | - } | ||
| 18 | - .guideboard-select .guideboard-select-body { | ||
| 19 | - margin-top: 5px; | ||
| 20 | - overflow: auto; | ||
| 21 | - width: auto; | ||
| 22 | - min-height: 5px; | ||
| 23 | - } | ||
| 24 | - .guideboard-select .guideboard { | ||
| 25 | - display: inline-block; | ||
| 26 | - padding: 8px; | ||
| 27 | - min-width: 50px; | ||
| 28 | - text-align: center; | ||
| 29 | - border: 1px solid #C1C1C1; | ||
| 30 | - color: #666; | ||
| 31 | - border-radius: 5px !important; | ||
| 32 | - margin: 5px; | ||
| 33 | - } | ||
| 34 | - .guideboard-select .guideboard.active { | ||
| 35 | - color: white; | ||
| 36 | - background: #4095E8; | ||
| 37 | - border: 1px solid #4095E8; | ||
| 38 | - } | ||
| 39 | - .guideboard-select .guideboard.start { | ||
| 40 | - color: white; | ||
| 41 | - background: #32C5D2; | ||
| 42 | - border: 1px solid #32C5D2; | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - </style> | ||
| 46 | - | ||
| 47 | - <div class="col-md-12 guideboard-select"> | ||
| 48 | - <div class="col-md-12 guideboard-input"> | ||
| 49 | - <div class="col-md-9"> | ||
| 50 | - 路牌列表,共{{$saGuideboardgroupCtrl.$$data.length}}个 | ||
| 51 | - </div> | ||
| 52 | - </div> | ||
| 53 | - <div class="col-md-12 guideboard-select-cont"> | ||
| 54 | - <div class="guideboard-select-body"> | ||
| 55 | - <div class="guideboard active" | ||
| 56 | - ng-repeat="$d in $saGuideboardgroupCtrl.$$data track by $index" | ||
| 57 | - ng-click="$saGuideboardgroupCtrl.$$internal_lplist_click($index)"> | ||
| 58 | - <i class="fa fa-map-signs" aria-hidden="true"></i> | ||
| 59 | - {{$d.lpname}} | ||
| 60 | - </div> | ||
| 61 | - </div> | ||
| 62 | - </div> | ||
| 63 | - <div class="col-md-12 guideboard-input"> | ||
| 64 | - <div class="col-md-12"> | ||
| 65 | - 已经选中的路牌列表,共{{$saGuideboardgroupCtrl.$$dataSelected.length}}个, | ||
| 66 | - 初始路牌,{{$saGuideboardgroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saGuideboardgroupCtrl.$$dataSelectedStart + 1) + "个"}} | ||
| 67 | - </div> | ||
| 68 | - </div> | ||
| 69 | - <div class="col-md-12 guideboard-select-cont"> | ||
| 70 | - <div class="guideboard-select-body"> | ||
| 71 | - <div ng-class="{guideboard: true, active: true, start: $d.isstart}" | ||
| 72 | - ng-repeat="$d in $saGuideboardgroupCtrl.$$dataSelected track by $index" | ||
| 73 | - ng-click="$saGuideboardgroupCtrl.$$internal_sellplist_click($index)" | ||
| 74 | - ng-dblclick="$saGuideboardgroupCtrl.$$internal_sellplist_dbclick($index)"> | ||
| 75 | - <i class="fa fa-map-signs" aria-hidden="true"></i> | ||
| 76 | - {{$d.lpname}} | ||
| 77 | - </div> | ||
| 78 | - </div> | ||
| 79 | - </div> | ||
| 80 | - </div> | ||
| 81 | - | 1 | +<div name="{{$saGuideboardgroupCtrl.$name_attr}}" |
| 2 | + ng-model="$saGuideboardgroupCtrl.$$internalmodel"> | ||
| 3 | + | ||
| 4 | + <style> | ||
| 5 | + .guideboard-select { | ||
| 6 | + min-height: 180px; | ||
| 7 | + border: 1px solid #ddd; | ||
| 8 | + } | ||
| 9 | + .guideboard-select .guideboard-input { | ||
| 10 | + margin: 5px 5px 0px 5px; | ||
| 11 | + padding-left: 0; | ||
| 12 | + } | ||
| 13 | + .guideboard-select .guideboard-select-cont { | ||
| 14 | + text-align: left; | ||
| 15 | + min-height: 60px; | ||
| 16 | + padding-right: 0px; | ||
| 17 | + } | ||
| 18 | + .guideboard-select .guideboard-select-body { | ||
| 19 | + margin-top: 5px; | ||
| 20 | + overflow: auto; | ||
| 21 | + width: auto; | ||
| 22 | + min-height: 5px; | ||
| 23 | + } | ||
| 24 | + .guideboard-select .guideboard { | ||
| 25 | + display: inline-block; | ||
| 26 | + padding: 8px; | ||
| 27 | + min-width: 50px; | ||
| 28 | + text-align: center; | ||
| 29 | + border: 1px solid #C1C1C1; | ||
| 30 | + color: #666; | ||
| 31 | + border-radius: 5px !important; | ||
| 32 | + margin: 5px; | ||
| 33 | + } | ||
| 34 | + .guideboard-select .guideboard.active { | ||
| 35 | + color: white; | ||
| 36 | + background: #4095E8; | ||
| 37 | + border: 1px solid #4095E8; | ||
| 38 | + } | ||
| 39 | + .guideboard-select .guideboard.start { | ||
| 40 | + color: white; | ||
| 41 | + background: #32C5D2; | ||
| 42 | + border: 1px solid #32C5D2; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + </style> | ||
| 46 | + | ||
| 47 | + <div class="col-md-12 guideboard-select"> | ||
| 48 | + <div class="col-md-12 guideboard-input"> | ||
| 49 | + <div class="col-md-9"> | ||
| 50 | + 路牌列表,共{{$saGuideboardgroupCtrl.$$data.length}}个 | ||
| 51 | + </div> | ||
| 52 | + </div> | ||
| 53 | + <div class="col-md-12 guideboard-select-cont"> | ||
| 54 | + <div class="guideboard-select-body"> | ||
| 55 | + <div class="guideboard active" | ||
| 56 | + ng-repeat="$d in $saGuideboardgroupCtrl.$$data track by $index" | ||
| 57 | + ng-click="$saGuideboardgroupCtrl.$$internal_lplist_click($index)"> | ||
| 58 | + <i class="fa fa-map-signs" aria-hidden="true"></i> | ||
| 59 | + {{$d.lpname}} | ||
| 60 | + </div> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + <div class="col-md-12 guideboard-input"> | ||
| 64 | + <div class="col-md-12"> | ||
| 65 | + 已经选中的路牌列表,共{{$saGuideboardgroupCtrl.$$dataSelected.length}}个, | ||
| 66 | + 初始路牌,{{$saGuideboardgroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saGuideboardgroupCtrl.$$dataSelectedStart + 1) + "个"}} | ||
| 67 | + </div> | ||
| 68 | + </div> | ||
| 69 | + <div class="col-md-12 guideboard-select-cont"> | ||
| 70 | + <div class="guideboard-select-body"> | ||
| 71 | + <div ng-class="{guideboard: true, active: true, start: $d.isstart}" | ||
| 72 | + ng-repeat="$d in $saGuideboardgroupCtrl.$$dataSelected track by $index" | ||
| 73 | + ng-click="$saGuideboardgroupCtrl.$$internal_sellplist_click($index)" | ||
| 74 | + ng-dblclick="$saGuideboardgroupCtrl.$$internal_sellplist_dbclick($index)"> | ||
| 75 | + <i class="fa fa-map-signs" aria-hidden="true"></i> | ||
| 76 | + {{$d.lpname}} | ||
| 77 | + </div> | ||
| 78 | + </div> | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + | ||
| 82 | </div> | 82 | </div> |
| 83 | \ No newline at end of file | 83 | \ No newline at end of file |
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) { | ||
| 2254 | - console.log("开始初始化数据"); | ||
| 2255 | - | ||
| 2256 | - // 判定是否分班,字符串中包含-就是了 | ||
| 2257 | - if (self.$$data_ry_first_data.indexOf("-") != -1) { // 分班 | ||
| 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 { | ||
| 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 | -]); | ||
| 2433 | - | 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) { | ||
| 2254 | + console.log("开始初始化数据"); | ||
| 2255 | + | ||
| 2256 | + // 判定是否分班,字符串中包含-就是了 | ||
| 2257 | + if (self.$$data_ry_first_data.indexOf("-") != -1) { // 分班 | ||
| 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 { | ||
| 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 | +]); | ||
| 2433 | + |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
| 1 | -// ui route 配置 | ||
| 2 | - | ||
| 3 | -/** 配置所有模块页面route */ | ||
| 4 | -ScheduleApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { | ||
| 5 | - // 默认路由 | ||
| 6 | - //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 7 | - | ||
| 8 | - $stateProvider | ||
| 9 | - // 车辆基础信息模块配置 | ||
| 10 | - .state("busInfoManage", { | ||
| 11 | - url: '/busInfoManage', | ||
| 12 | - views: { | ||
| 13 | - "": { | ||
| 14 | - templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/index.html' | ||
| 15 | - }, | ||
| 16 | - "busInfoManage_list@busInfoManage": { | ||
| 17 | - templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/list.html' | ||
| 18 | - } | ||
| 19 | - }, | ||
| 20 | - | ||
| 21 | - resolve: { | ||
| 22 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 23 | - return $ocLazyLoad.load({ | ||
| 24 | - name: 'busInfoManage_module', | ||
| 25 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 26 | - files: [ | ||
| 27 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 28 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 29 | - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 30 | - "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js" | ||
| 31 | - ] | ||
| 32 | - }); | ||
| 33 | - }] | ||
| 34 | - } | ||
| 35 | - }) | ||
| 36 | - .state("busInfoManage_form", { | ||
| 37 | - url: '/busInfoManage_form', | ||
| 38 | - views: { | ||
| 39 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/form.html'} | ||
| 40 | - }, | ||
| 41 | - resolve: { | ||
| 42 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 43 | - return $ocLazyLoad.load({ | ||
| 44 | - name: 'busInfoManage_form_module', | ||
| 45 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 46 | - files: [ | ||
| 47 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 48 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 49 | - "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js" | ||
| 50 | - ] | ||
| 51 | - }); | ||
| 52 | - }] | ||
| 53 | - } | ||
| 54 | - }) | ||
| 55 | - .state("busInfoManage_edit", { | ||
| 56 | - url: '/busInfoManage_edit/:id', | ||
| 57 | - views: { | ||
| 58 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/edit.html'} | ||
| 59 | - }, | ||
| 60 | - resolve: { | ||
| 61 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 62 | - return $ocLazyLoad.load({ | ||
| 63 | - name: 'busInfoManage_edit_module', | ||
| 64 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 65 | - files: [ | ||
| 66 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 67 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 68 | - "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js" | ||
| 69 | - ] | ||
| 70 | - }); | ||
| 71 | - }] | ||
| 72 | - } | ||
| 73 | - }) | ||
| 74 | - .state("busInfoManage_detail", { | ||
| 75 | - url: '/busInfoManage_detail/:id', | ||
| 76 | - views: { | ||
| 77 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/detail.html'} | ||
| 78 | - }, | ||
| 79 | - resolve: { | ||
| 80 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 81 | - return $ocLazyLoad.load({ | ||
| 82 | - name: 'busInfoManage_detail_module', | ||
| 83 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 84 | - files: [ | ||
| 85 | - "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js" | ||
| 86 | - ] | ||
| 87 | - }); | ||
| 88 | - }] | ||
| 89 | - } | ||
| 90 | - }) | ||
| 91 | - | ||
| 92 | - // 人员基础信息模块配置 | ||
| 93 | - .state("employeeInfoManage", { | ||
| 94 | - url: '/employeeInfoManage', | ||
| 95 | - views: { | ||
| 96 | - "": { | ||
| 97 | - templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html' | ||
| 98 | - }, | ||
| 99 | - "employeeInfoManage_list@employeeInfoManage": { | ||
| 100 | - templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html' | ||
| 101 | - } | ||
| 102 | - }, | ||
| 103 | - | ||
| 104 | - resolve: { | ||
| 105 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 106 | - return $ocLazyLoad.load({ | ||
| 107 | - name: 'employeeInfoManage_module', | ||
| 108 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 109 | - files: [ | ||
| 110 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 111 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 112 | - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 113 | - "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js" | ||
| 114 | - ] | ||
| 115 | - }); | ||
| 116 | - }] | ||
| 117 | - } | ||
| 118 | - }) | ||
| 119 | - .state("employeeInfoManage_form", { | ||
| 120 | - url: '/employeeInfoManage_form', | ||
| 121 | - views: { | ||
| 122 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html'} | ||
| 123 | - }, | ||
| 124 | - resolve: { | ||
| 125 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 126 | - return $ocLazyLoad.load({ | ||
| 127 | - name: 'employeeInfoManage_form_module', | ||
| 128 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 129 | - files: [ | ||
| 130 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 131 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 132 | - "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js" | ||
| 133 | - ] | ||
| 134 | - }); | ||
| 135 | - }] | ||
| 136 | - } | ||
| 137 | - }) | ||
| 138 | - .state("employeeInfoManage_edit", { | ||
| 139 | - url: '/employeeInfoManage_edit/:id', | ||
| 140 | - views: { | ||
| 141 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html'} | ||
| 142 | - }, | ||
| 143 | - resolve: { | ||
| 144 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 145 | - return $ocLazyLoad.load({ | ||
| 146 | - name: 'employeeInfoManage_edit_module', | ||
| 147 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 148 | - files: [ | ||
| 149 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 150 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 151 | - "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js" | ||
| 152 | - ] | ||
| 153 | - }); | ||
| 154 | - }] | ||
| 155 | - } | ||
| 156 | - }) | ||
| 157 | - .state("employeeInfoManage_detail", { | ||
| 158 | - url: '/employeeInfoManage_detail/:id', | ||
| 159 | - views: { | ||
| 160 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/detail.html'} | ||
| 161 | - }, | ||
| 162 | - resolve: { | ||
| 163 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 164 | - return $ocLazyLoad.load({ | ||
| 165 | - name: 'employeeInfoManage_detail_module', | ||
| 166 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 167 | - files: [ | ||
| 168 | - "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js" | ||
| 169 | - ] | ||
| 170 | - }); | ||
| 171 | - }] | ||
| 172 | - } | ||
| 173 | - }) | ||
| 174 | - | ||
| 175 | - // 车辆设备信息模块配置 | ||
| 176 | - .state("deviceInfoManage", { | ||
| 177 | - url: '/deviceInfoManage', | ||
| 178 | - views: { | ||
| 179 | - "": { | ||
| 180 | - templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html' | ||
| 181 | - }, | ||
| 182 | - "deviceInfoManage_list@deviceInfoManage": { | ||
| 183 | - templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html' | ||
| 184 | - } | ||
| 185 | - }, | ||
| 186 | - | ||
| 187 | - resolve: { | ||
| 188 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 189 | - return $ocLazyLoad.load({ | ||
| 190 | - name: 'deviceInfoManage_module', | ||
| 191 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 192 | - files: [ | ||
| 193 | - "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js" | ||
| 194 | - ] | ||
| 195 | - }); | ||
| 196 | - }] | ||
| 197 | - } | ||
| 198 | - }) | ||
| 199 | - .state("deviceInfoManage_form", { | ||
| 200 | - url: '/deviceInfoManage_form', | ||
| 201 | - views: { | ||
| 202 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html'} | ||
| 203 | - }, | ||
| 204 | - resolve: { | ||
| 205 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 206 | - return $ocLazyLoad.load({ | ||
| 207 | - name: 'deviceInfoManage_form_module', | ||
| 208 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 209 | - files: [ | ||
| 210 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 211 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 212 | - "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js" | ||
| 213 | - ] | ||
| 214 | - }); | ||
| 215 | - }] | ||
| 216 | - } | ||
| 217 | - }) | ||
| 218 | - .state("deviceInfoManage_edit", { | ||
| 219 | - url: '/deviceInfoManage_edit/:id', | ||
| 220 | - views: { | ||
| 221 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html'} | ||
| 222 | - }, | ||
| 223 | - resolve: { | ||
| 224 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 225 | - return $ocLazyLoad.load({ | ||
| 226 | - name: 'deviceInfoManage_edit_module', | ||
| 227 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 228 | - files: [ | ||
| 229 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 230 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 231 | - "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js" | ||
| 232 | - ] | ||
| 233 | - }); | ||
| 234 | - }] | ||
| 235 | - } | ||
| 236 | - }) | ||
| 237 | - .state("deviceInfoManage_detail", { | ||
| 238 | - url: '/deviceInfoManage_detail/:id', | ||
| 239 | - views: { | ||
| 240 | - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/detail.html'} | ||
| 241 | - }, | ||
| 242 | - resolve: { | ||
| 243 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 244 | - return $ocLazyLoad.load({ | ||
| 245 | - name: 'deviceInfoManage_detail_module', | ||
| 246 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 247 | - files: [ | ||
| 248 | - "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js" | ||
| 249 | - ] | ||
| 250 | - }); | ||
| 251 | - }] | ||
| 252 | - } | ||
| 253 | - }) | ||
| 254 | - | ||
| 255 | - // 车辆配置模块 | ||
| 256 | - .state("busConfig", { | ||
| 257 | - url: '/busConfig', | ||
| 258 | - views: { | ||
| 259 | - "": { | ||
| 260 | - templateUrl: 'pages/scheduleApp/module/core/busConfig/index.html' | ||
| 261 | - }, | ||
| 262 | - "busConfig_list@busConfig": { | ||
| 263 | - templateUrl: 'pages/scheduleApp/module/core/busConfig/list.html' | ||
| 264 | - } | ||
| 265 | - }, | ||
| 266 | - | ||
| 267 | - resolve: { | ||
| 268 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 269 | - return $ocLazyLoad.load({ | ||
| 270 | - name: 'busConfig_module', | ||
| 271 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 272 | - files: [ | ||
| 273 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 274 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 275 | - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 276 | - "pages/scheduleApp/module/core/busConfig/busConfig.js" | ||
| 277 | - ] | ||
| 278 | - }); | ||
| 279 | - }] | ||
| 280 | - } | ||
| 281 | - }) | ||
| 282 | - .state("busConfig_form", { | ||
| 283 | - url: '/busConfig_form', | ||
| 284 | - views: { | ||
| 285 | - "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/form.html'} | ||
| 286 | - }, | ||
| 287 | - resolve: { | ||
| 288 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 289 | - return $ocLazyLoad.load({ | ||
| 290 | - name: 'busConfig_form_module', | ||
| 291 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 292 | - files: [ | ||
| 293 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 294 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 295 | - "pages/scheduleApp/module/core/busConfig/busConfig.js" | ||
| 296 | - ] | ||
| 297 | - }); | ||
| 298 | - }] | ||
| 299 | - } | ||
| 300 | - }) | ||
| 301 | - .state("busConfig_edit", { | ||
| 302 | - url: '/busConfig_edit/:id', | ||
| 303 | - views: { | ||
| 304 | - "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/edit.html'} | ||
| 305 | - }, | ||
| 306 | - resolve: { | ||
| 307 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 308 | - return $ocLazyLoad.load({ | ||
| 309 | - name: 'busConfig_edit_module', | ||
| 310 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 311 | - files: [ | ||
| 312 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 313 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 314 | - "pages/scheduleApp/module/core/busConfig/busConfig.js" | ||
| 315 | - ] | ||
| 316 | - }); | ||
| 317 | - }] | ||
| 318 | - } | ||
| 319 | - }) | ||
| 320 | - .state("busConfig_detail", { | ||
| 321 | - url: '/busConfig_detail/:id', | ||
| 322 | - views: { | ||
| 323 | - "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/detail.html'} | ||
| 324 | - }, | ||
| 325 | - resolve: { | ||
| 326 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 327 | - return $ocLazyLoad.load({ | ||
| 328 | - name: 'busConfig_detail_module', | ||
| 329 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 330 | - files: [ | ||
| 331 | - "pages/scheduleApp/module/core/busConfig/busConfig.js" | ||
| 332 | - ] | ||
| 333 | - }); | ||
| 334 | - }] | ||
| 335 | - } | ||
| 336 | - }) | ||
| 337 | - | ||
| 338 | - // 人员配置模块 | ||
| 339 | - .state("employeeConfig", { | ||
| 340 | - url: '/employeeConfig', | ||
| 341 | - views: { | ||
| 342 | - "": { | ||
| 343 | - templateUrl: 'pages/scheduleApp/module/core/employeeConfig/index.html' | ||
| 344 | - }, | ||
| 345 | - "employeeConfig_list@employeeConfig": { | ||
| 346 | - templateUrl: 'pages/scheduleApp/module/core/employeeConfig/list.html' | ||
| 347 | - } | ||
| 348 | - }, | ||
| 349 | - | ||
| 350 | - resolve: { | ||
| 351 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 352 | - return $ocLazyLoad.load({ | ||
| 353 | - name: 'employeeConfig_module', | ||
| 354 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 355 | - files: [ | ||
| 356 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 357 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 358 | - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 359 | - "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js" | ||
| 360 | - ] | ||
| 361 | - }); | ||
| 362 | - }] | ||
| 363 | - } | ||
| 364 | - }) | ||
| 365 | - .state("employeeConfig_form", { | ||
| 366 | - url: '/employeeConfig_form', | ||
| 367 | - views: { | ||
| 368 | - "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/form.html'} | ||
| 369 | - }, | ||
| 370 | - resolve: { | ||
| 371 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 372 | - return $ocLazyLoad.load({ | ||
| 373 | - name: 'employeeConfig_form_module', | ||
| 374 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 375 | - files: [ | ||
| 376 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 377 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 378 | - "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js" | ||
| 379 | - ] | ||
| 380 | - }); | ||
| 381 | - }] | ||
| 382 | - } | ||
| 383 | - }) | ||
| 384 | - .state("employeeConfig_edit", { | ||
| 385 | - url: '/employeeConfig_edit/:id', | ||
| 386 | - views: { | ||
| 387 | - "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/edit.html'} | ||
| 388 | - }, | ||
| 389 | - resolve: { | ||
| 390 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 391 | - return $ocLazyLoad.load({ | ||
| 392 | - name: 'employeeConfig_edit_module', | ||
| 393 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 394 | - files: [ | ||
| 395 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 396 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 397 | - "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js" | ||
| 398 | - ] | ||
| 399 | - }); | ||
| 400 | - }] | ||
| 401 | - } | ||
| 402 | - }) | ||
| 403 | - .state("employeeConfig_detail", { | ||
| 404 | - url: '/employeeConfig_detail/:id', | ||
| 405 | - views: { | ||
| 406 | - "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/detail.html'} | ||
| 407 | - }, | ||
| 408 | - resolve: { | ||
| 409 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 410 | - return $ocLazyLoad.load({ | ||
| 411 | - name: 'employeeConfig_detail_module', | ||
| 412 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 413 | - files: [ | ||
| 414 | - "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js" | ||
| 415 | - ] | ||
| 416 | - }); | ||
| 417 | - }] | ||
| 418 | - } | ||
| 419 | - }) | ||
| 420 | - | ||
| 421 | - // 路牌管理 | ||
| 422 | - .state("guideboardManage", { | ||
| 423 | - url: '/guideboardManage', | ||
| 424 | - views: { | ||
| 425 | - "": { | ||
| 426 | - templateUrl: 'pages/scheduleApp/module/core/guideboardManage/index.html' | ||
| 427 | - }, | ||
| 428 | - "guideboardManage_list@guideboardManage": { | ||
| 429 | - templateUrl: 'pages/scheduleApp/module/core/guideboardManage/list.html' | ||
| 430 | - } | ||
| 431 | - }, | ||
| 432 | - | ||
| 433 | - resolve: { | ||
| 434 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 435 | - return $ocLazyLoad.load({ | ||
| 436 | - name: 'guideboardManage_module', | ||
| 437 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 438 | - files: [ | ||
| 439 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 440 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 441 | - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 442 | - "pages/scheduleApp/module/core/guideboardManage/guideboardManage.js" | ||
| 443 | - ] | ||
| 444 | - }); | ||
| 445 | - }] | ||
| 446 | - } | ||
| 447 | - }) | ||
| 448 | - .state("guideboardManage_detail", { | ||
| 449 | - url: '/guideboardManage_detail/:id', | ||
| 450 | - views: { | ||
| 451 | - "": {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/detail.html'} | ||
| 452 | - }, | ||
| 453 | - resolve: { | ||
| 454 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 455 | - return $ocLazyLoad.load({ | ||
| 456 | - name: 'guideboardManage_detail_module', | ||
| 457 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 458 | - files: [ | ||
| 459 | - "pages/scheduleApp/module/core/guideboardManage/guideboardManage.js" | ||
| 460 | - ] | ||
| 461 | - }); | ||
| 462 | - }] | ||
| 463 | - } | ||
| 464 | - }) | ||
| 465 | - | ||
| 466 | - | ||
| 467 | - // 时刻表管理 | ||
| 468 | - .state("timeTableManage", { | ||
| 469 | - url: '/timeTableManage', | ||
| 470 | - views: { | ||
| 471 | - "": { | ||
| 472 | - templateUrl: 'pages/scheduleApp/module/core/timeTableManage/index.html' | ||
| 473 | - }, | ||
| 474 | - "timeTableManage_list@timeTableManage": { | ||
| 475 | - templateUrl: 'pages/scheduleApp/module/core/timeTableManage/list.html' | ||
| 476 | - } | ||
| 477 | - }, | ||
| 478 | - | ||
| 479 | - resolve: { | ||
| 480 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 481 | - return $ocLazyLoad.load({ | ||
| 482 | - name: 'timeTableManage_module', | ||
| 483 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 484 | - files: [ | ||
| 485 | - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 486 | - "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js" | ||
| 487 | - ] | ||
| 488 | - }); | ||
| 489 | - }] | ||
| 490 | - } | ||
| 491 | - }) | ||
| 492 | - .state("timeTableManage_form", { | ||
| 493 | - url: '/timeTableManage_form', | ||
| 494 | - views: { | ||
| 495 | - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/form.html'} | ||
| 496 | - }, | ||
| 497 | - resolve: { | ||
| 498 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 499 | - return $ocLazyLoad.load({ | ||
| 500 | - name: 'timeTableManage_form_module', | ||
| 501 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 502 | - files: [ | ||
| 503 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 504 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 505 | - "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js" | ||
| 506 | - ] | ||
| 507 | - }); | ||
| 508 | - }] | ||
| 509 | - } | ||
| 510 | - }) | ||
| 511 | - .state("timeTableManage_edit", { | ||
| 512 | - url: '/timeTableManage_edit/:id', | ||
| 513 | - views: { | ||
| 514 | - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/edit.html'} | ||
| 515 | - }, | ||
| 516 | - resolve: { | ||
| 517 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 518 | - return $ocLazyLoad.load({ | ||
| 519 | - name: 'timeTableManage_edit_module', | ||
| 520 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 521 | - files: [ | ||
| 522 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 523 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 524 | - "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js" | ||
| 525 | - ] | ||
| 526 | - }); | ||
| 527 | - }] | ||
| 528 | - } | ||
| 529 | - }) | ||
| 530 | - .state("timeTableManage_detail", { | ||
| 531 | - url: '/timeTableManage_detail/:id', | ||
| 532 | - views: { | ||
| 533 | - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail.html'} | ||
| 534 | - }, | ||
| 535 | - resolve: { | ||
| 536 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 537 | - return $ocLazyLoad.load({ | ||
| 538 | - name: 'timeTableManage_detail_module', | ||
| 539 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 540 | - files: [ | ||
| 541 | - "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js" | ||
| 542 | - ] | ||
| 543 | - }); | ||
| 544 | - }] | ||
| 545 | - } | ||
| 546 | - }) | ||
| 547 | - .state("timeTableDetailInfoManage", { | ||
| 548 | - url: '/timeTableDetailInfoManage/:xlid/:ttid/:xlname/:ttname', | ||
| 549 | - views: { | ||
| 550 | - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail_info.html'} | ||
| 551 | - }, | ||
| 552 | - resolve: { | ||
| 553 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 554 | - return $ocLazyLoad.load({ | ||
| 555 | - name: 'timeTableDetailInfoManage_module', | ||
| 556 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 557 | - files: [ | ||
| 558 | - "pages/scheduleApp/module/core/timeTableManage/timeTableDetailManage.js" | ||
| 559 | - ] | ||
| 560 | - }); | ||
| 561 | - }] | ||
| 562 | - } | ||
| 563 | - }) | ||
| 564 | - .state("timeTableDetailInfoManage_detail_edit", { | ||
| 565 | - url: '/timeTableDetailInfoManage_detail_edit/:id/:xlid/:ttid/:xlname/:ttname', | ||
| 566 | - views: { | ||
| 567 | - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail_info_edit.html'} | ||
| 568 | - }, | ||
| 569 | - resolve: { | ||
| 570 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 571 | - return $ocLazyLoad.load({ | ||
| 572 | - name: 'timeTableDetailInfoManage_module', | ||
| 573 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 574 | - files: [ | ||
| 575 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 576 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 577 | - "pages/scheduleApp/module/core/timeTableManage/timeTableDetailManage.js" | ||
| 578 | - ] | ||
| 579 | - }); | ||
| 580 | - }] | ||
| 581 | - } | ||
| 582 | - }) | ||
| 583 | - | ||
| 584 | - // 排班规则管理模块 | ||
| 585 | - .state("scheduleRuleManage", { | ||
| 586 | - url: '/scheduleRuleManage', | ||
| 587 | - views: { | ||
| 588 | - "": { | ||
| 589 | - templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/index.html' | ||
| 590 | - }, | ||
| 591 | - "scheduleRuleManage_list@scheduleRuleManage": { | ||
| 592 | - templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/list.html' | ||
| 593 | - } | ||
| 594 | - }, | ||
| 595 | - | ||
| 596 | - resolve: { | ||
| 597 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 598 | - return $ocLazyLoad.load({ | ||
| 599 | - name: 'scheduleRuleManage_module', | ||
| 600 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 601 | - files: [ | ||
| 602 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 603 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 604 | - "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" | ||
| 605 | - ] | ||
| 606 | - }); | ||
| 607 | - }] | ||
| 608 | - } | ||
| 609 | - }) | ||
| 610 | - .state("scheduleRuleManage_form", { | ||
| 611 | - url: '/scheduleRuleManage_form', | ||
| 612 | - views: { | ||
| 613 | - "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/form.html'} | ||
| 614 | - }, | ||
| 615 | - resolve: { | ||
| 616 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 617 | - return $ocLazyLoad.load({ | ||
| 618 | - name: 'scheduleRuleManage_form_module', | ||
| 619 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 620 | - files: [ | ||
| 621 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 622 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 623 | - "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" | ||
| 624 | - ] | ||
| 625 | - }); | ||
| 626 | - }] | ||
| 627 | - } | ||
| 628 | - }) | ||
| 629 | - .state("scheduleRuleManage_edit", { | ||
| 630 | - url: '/scheduleRuleManage_edit/:id', | ||
| 631 | - views: { | ||
| 632 | - "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/edit.html'} | ||
| 633 | - }, | ||
| 634 | - resolve: { | ||
| 635 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 636 | - return $ocLazyLoad.load({ | ||
| 637 | - name: 'scheduleRuleManage_edit_module', | ||
| 638 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 639 | - files: [ | ||
| 640 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 641 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 642 | - "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" | ||
| 643 | - ] | ||
| 644 | - }); | ||
| 645 | - }] | ||
| 646 | - } | ||
| 647 | - }) | ||
| 648 | - .state("scheduleRuleManage_detail", { | ||
| 649 | - url: '/scheduleRuleManage_detail/:id', | ||
| 650 | - views: { | ||
| 651 | - "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/detail.html'} | ||
| 652 | - }, | ||
| 653 | - resolve: { | ||
| 654 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 655 | - return $ocLazyLoad.load({ | ||
| 656 | - name: 'scheduleRuleManage_detail_module', | ||
| 657 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 658 | - files: [ | ||
| 659 | - "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" | ||
| 660 | - ] | ||
| 661 | - }); | ||
| 662 | - }] | ||
| 663 | - } | ||
| 664 | - }) | ||
| 665 | - | ||
| 666 | - // 排班计划管理模块 | ||
| 667 | - .state("schedulePlanManage", { | ||
| 668 | - url: '/schedulePlanManage', | ||
| 669 | - views: { | ||
| 670 | - "": { | ||
| 671 | - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/index.html' | ||
| 672 | - }, | ||
| 673 | - "schedulePlanManage_list@schedulePlanManage": { | ||
| 674 | - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/list.html' | ||
| 675 | - } | ||
| 676 | - }, | ||
| 677 | - | ||
| 678 | - resolve: { | ||
| 679 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 680 | - return $ocLazyLoad.load({ | ||
| 681 | - name: 'schedulePlanManage_module', | ||
| 682 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 683 | - files: [ | ||
| 684 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 685 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 686 | - "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanManage.js" | ||
| 687 | - ] | ||
| 688 | - }); | ||
| 689 | - }] | ||
| 690 | - } | ||
| 691 | - }) | ||
| 692 | - .state("schedulePlanManage_form", { | ||
| 693 | - url: '/schedulePlanManage_form', | ||
| 694 | - views: { | ||
| 695 | - "": { | ||
| 696 | - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/form.html' | ||
| 697 | - } | ||
| 698 | - }, | ||
| 699 | - | ||
| 700 | - resolve: { | ||
| 701 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 702 | - return $ocLazyLoad.load({ | ||
| 703 | - name: 'schedulePlanManage_form_module', | ||
| 704 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 705 | - files: [ | ||
| 706 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 707 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 708 | - "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanManage.js" | ||
| 709 | - ] | ||
| 710 | - }); | ||
| 711 | - }] | ||
| 712 | - } | ||
| 713 | - }) | ||
| 714 | - | ||
| 715 | - // 排班计划明细管理模块 | ||
| 716 | - .state("schedulePlanInfoManage", { | ||
| 717 | - url: '/schedulePlanInfoManage/:spid/:xlname/:ttname/:stime/:etime', | ||
| 718 | - views: { | ||
| 719 | - "": { | ||
| 720 | - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/index_info.html' | ||
| 721 | - }, | ||
| 722 | - "schedulePlanInfoManage_list@schedulePlanInfoManage": { | ||
| 723 | - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/list_info.html' | ||
| 724 | - } | ||
| 725 | - }, | ||
| 726 | - | ||
| 727 | - resolve: { | ||
| 728 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 729 | - return $ocLazyLoad.load({ | ||
| 730 | - name: 'schedulePlanInfoManage_module', | ||
| 731 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 732 | - files: [ | ||
| 733 | - "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanInfoManage.js" | ||
| 734 | - ] | ||
| 735 | - }); | ||
| 736 | - }] | ||
| 737 | - } | ||
| 738 | - }) | ||
| 739 | - | ||
| 740 | - // 排班调度值勤日报模块 | ||
| 741 | - .state("schedulePlanReportManage", { | ||
| 742 | - url: '/schedulePlanReportManage', | ||
| 743 | - views: { | ||
| 744 | - "": { | ||
| 745 | - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/index_report.html' | ||
| 746 | - }, | ||
| 747 | - "schedulePlanReportManage_list@schedulePlanReportManage": { | ||
| 748 | - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/list_report.html' | ||
| 749 | - } | ||
| 750 | - }, | ||
| 751 | - | ||
| 752 | - resolve: { | ||
| 753 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 754 | - return $ocLazyLoad.load({ | ||
| 755 | - name: 'schedulePlanManage_module', | ||
| 756 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 757 | - files: [ | ||
| 758 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 759 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 760 | - "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js" | ||
| 761 | - ] | ||
| 762 | - }); | ||
| 763 | - }] | ||
| 764 | - } | ||
| 765 | - }) | ||
| 766 | - | ||
| 767 | - .state("schedulePlanReportManage_edit", { | ||
| 768 | - url: '/schedulePlanReportManage_edit', | ||
| 769 | - params: {type: 0, groupInfo: null}, | ||
| 770 | - views: { | ||
| 771 | - "": { | ||
| 772 | - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/edit_report.html' | ||
| 773 | - } | ||
| 774 | - }, | ||
| 775 | - | ||
| 776 | - resolve: { | ||
| 777 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 778 | - return $ocLazyLoad.load({ | ||
| 779 | - name: 'schedulePlanReportManage_edit_module', | ||
| 780 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 781 | - files: [ | ||
| 782 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 783 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 784 | - "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js" | ||
| 785 | - ] | ||
| 786 | - }); | ||
| 787 | - }] | ||
| 788 | - } | ||
| 789 | - }) | ||
| 790 | - | ||
| 791 | - // 线路运营概览模块 | ||
| 792 | - .state("busLineInfoStat", { | ||
| 793 | - url: '/busLineInfoStat', | ||
| 794 | - views: { | ||
| 795 | - "": { | ||
| 796 | - templateUrl: 'pages/scheduleApp/module/core/busLineInfoStat/index.html' | ||
| 797 | - }, | ||
| 798 | - "busLineInfoStat_list@busLineInfoStat": { | ||
| 799 | - templateUrl: 'pages/scheduleApp/module/core/busLineInfoStat/list.html' | ||
| 800 | - } | ||
| 801 | - }, | ||
| 802 | - | ||
| 803 | - resolve: { | ||
| 804 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 805 | - return $ocLazyLoad.load({ | ||
| 806 | - name: 'busLineInfoStat_module', | ||
| 807 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 808 | - files: [ | ||
| 809 | - "pages/scheduleApp/module/core/busLineInfoStat/busLineInfoStat.js" | ||
| 810 | - ] | ||
| 811 | - }); | ||
| 812 | - }] | ||
| 813 | - } | ||
| 814 | - }) | ||
| 815 | - | ||
| 816 | - | ||
| 817 | - | ||
| 818 | - | ||
| 819 | - | ||
| 820 | - // TODO: | ||
| 821 | - | ||
| 822 | - ; | ||
| 823 | - | 1 | +// ui route 配置 |
| 2 | + | ||
| 3 | +/** 配置所有模块页面route */ | ||
| 4 | +ScheduleApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { | ||
| 5 | + // 默认路由 | ||
| 6 | + //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 7 | + | ||
| 8 | + $stateProvider | ||
| 9 | + // 车辆基础信息模块配置 | ||
| 10 | + .state("busInfoManage", { | ||
| 11 | + url: '/busInfoManage', | ||
| 12 | + views: { | ||
| 13 | + "": { | ||
| 14 | + templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/index.html' | ||
| 15 | + }, | ||
| 16 | + "busInfoManage_list@busInfoManage": { | ||
| 17 | + templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/list.html' | ||
| 18 | + } | ||
| 19 | + }, | ||
| 20 | + | ||
| 21 | + resolve: { | ||
| 22 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 23 | + return $ocLazyLoad.load({ | ||
| 24 | + name: 'busInfoManage_module', | ||
| 25 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 26 | + files: [ | ||
| 27 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 28 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 29 | + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 30 | + "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js" | ||
| 31 | + ] | ||
| 32 | + }); | ||
| 33 | + }] | ||
| 34 | + } | ||
| 35 | + }) | ||
| 36 | + .state("busInfoManage_form", { | ||
| 37 | + url: '/busInfoManage_form', | ||
| 38 | + views: { | ||
| 39 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/form.html'} | ||
| 40 | + }, | ||
| 41 | + resolve: { | ||
| 42 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 43 | + return $ocLazyLoad.load({ | ||
| 44 | + name: 'busInfoManage_form_module', | ||
| 45 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 46 | + files: [ | ||
| 47 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 48 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 49 | + "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js" | ||
| 50 | + ] | ||
| 51 | + }); | ||
| 52 | + }] | ||
| 53 | + } | ||
| 54 | + }) | ||
| 55 | + .state("busInfoManage_edit", { | ||
| 56 | + url: '/busInfoManage_edit/:id', | ||
| 57 | + views: { | ||
| 58 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/edit.html'} | ||
| 59 | + }, | ||
| 60 | + resolve: { | ||
| 61 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 62 | + return $ocLazyLoad.load({ | ||
| 63 | + name: 'busInfoManage_edit_module', | ||
| 64 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 65 | + files: [ | ||
| 66 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 67 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 68 | + "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js" | ||
| 69 | + ] | ||
| 70 | + }); | ||
| 71 | + }] | ||
| 72 | + } | ||
| 73 | + }) | ||
| 74 | + .state("busInfoManage_detail", { | ||
| 75 | + url: '/busInfoManage_detail/:id', | ||
| 76 | + views: { | ||
| 77 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/detail.html'} | ||
| 78 | + }, | ||
| 79 | + resolve: { | ||
| 80 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 81 | + return $ocLazyLoad.load({ | ||
| 82 | + name: 'busInfoManage_detail_module', | ||
| 83 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 84 | + files: [ | ||
| 85 | + "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js" | ||
| 86 | + ] | ||
| 87 | + }); | ||
| 88 | + }] | ||
| 89 | + } | ||
| 90 | + }) | ||
| 91 | + | ||
| 92 | + // 人员基础信息模块配置 | ||
| 93 | + .state("employeeInfoManage", { | ||
| 94 | + url: '/employeeInfoManage', | ||
| 95 | + views: { | ||
| 96 | + "": { | ||
| 97 | + templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html' | ||
| 98 | + }, | ||
| 99 | + "employeeInfoManage_list@employeeInfoManage": { | ||
| 100 | + templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html' | ||
| 101 | + } | ||
| 102 | + }, | ||
| 103 | + | ||
| 104 | + resolve: { | ||
| 105 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 106 | + return $ocLazyLoad.load({ | ||
| 107 | + name: 'employeeInfoManage_module', | ||
| 108 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 109 | + files: [ | ||
| 110 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 111 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 112 | + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 113 | + "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js" | ||
| 114 | + ] | ||
| 115 | + }); | ||
| 116 | + }] | ||
| 117 | + } | ||
| 118 | + }) | ||
| 119 | + .state("employeeInfoManage_form", { | ||
| 120 | + url: '/employeeInfoManage_form', | ||
| 121 | + views: { | ||
| 122 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html'} | ||
| 123 | + }, | ||
| 124 | + resolve: { | ||
| 125 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 126 | + return $ocLazyLoad.load({ | ||
| 127 | + name: 'employeeInfoManage_form_module', | ||
| 128 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 129 | + files: [ | ||
| 130 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 131 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 132 | + "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js" | ||
| 133 | + ] | ||
| 134 | + }); | ||
| 135 | + }] | ||
| 136 | + } | ||
| 137 | + }) | ||
| 138 | + .state("employeeInfoManage_edit", { | ||
| 139 | + url: '/employeeInfoManage_edit/:id', | ||
| 140 | + views: { | ||
| 141 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html'} | ||
| 142 | + }, | ||
| 143 | + resolve: { | ||
| 144 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 145 | + return $ocLazyLoad.load({ | ||
| 146 | + name: 'employeeInfoManage_edit_module', | ||
| 147 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 148 | + files: [ | ||
| 149 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 150 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 151 | + "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js" | ||
| 152 | + ] | ||
| 153 | + }); | ||
| 154 | + }] | ||
| 155 | + } | ||
| 156 | + }) | ||
| 157 | + .state("employeeInfoManage_detail", { | ||
| 158 | + url: '/employeeInfoManage_detail/:id', | ||
| 159 | + views: { | ||
| 160 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/detail.html'} | ||
| 161 | + }, | ||
| 162 | + resolve: { | ||
| 163 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 164 | + return $ocLazyLoad.load({ | ||
| 165 | + name: 'employeeInfoManage_detail_module', | ||
| 166 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 167 | + files: [ | ||
| 168 | + "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js" | ||
| 169 | + ] | ||
| 170 | + }); | ||
| 171 | + }] | ||
| 172 | + } | ||
| 173 | + }) | ||
| 174 | + | ||
| 175 | + // 车辆设备信息模块配置 | ||
| 176 | + .state("deviceInfoManage", { | ||
| 177 | + url: '/deviceInfoManage', | ||
| 178 | + views: { | ||
| 179 | + "": { | ||
| 180 | + templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html' | ||
| 181 | + }, | ||
| 182 | + "deviceInfoManage_list@deviceInfoManage": { | ||
| 183 | + templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html' | ||
| 184 | + } | ||
| 185 | + }, | ||
| 186 | + | ||
| 187 | + resolve: { | ||
| 188 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 189 | + return $ocLazyLoad.load({ | ||
| 190 | + name: 'deviceInfoManage_module', | ||
| 191 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 192 | + files: [ | ||
| 193 | + "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js" | ||
| 194 | + ] | ||
| 195 | + }); | ||
| 196 | + }] | ||
| 197 | + } | ||
| 198 | + }) | ||
| 199 | + .state("deviceInfoManage_form", { | ||
| 200 | + url: '/deviceInfoManage_form', | ||
| 201 | + views: { | ||
| 202 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html'} | ||
| 203 | + }, | ||
| 204 | + resolve: { | ||
| 205 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 206 | + return $ocLazyLoad.load({ | ||
| 207 | + name: 'deviceInfoManage_form_module', | ||
| 208 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 209 | + files: [ | ||
| 210 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 211 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 212 | + "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js" | ||
| 213 | + ] | ||
| 214 | + }); | ||
| 215 | + }] | ||
| 216 | + } | ||
| 217 | + }) | ||
| 218 | + .state("deviceInfoManage_edit", { | ||
| 219 | + url: '/deviceInfoManage_edit/:id', | ||
| 220 | + views: { | ||
| 221 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html'} | ||
| 222 | + }, | ||
| 223 | + resolve: { | ||
| 224 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 225 | + return $ocLazyLoad.load({ | ||
| 226 | + name: 'deviceInfoManage_edit_module', | ||
| 227 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 228 | + files: [ | ||
| 229 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 230 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 231 | + "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js" | ||
| 232 | + ] | ||
| 233 | + }); | ||
| 234 | + }] | ||
| 235 | + } | ||
| 236 | + }) | ||
| 237 | + .state("deviceInfoManage_detail", { | ||
| 238 | + url: '/deviceInfoManage_detail/:id', | ||
| 239 | + views: { | ||
| 240 | + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/detail.html'} | ||
| 241 | + }, | ||
| 242 | + resolve: { | ||
| 243 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 244 | + return $ocLazyLoad.load({ | ||
| 245 | + name: 'deviceInfoManage_detail_module', | ||
| 246 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 247 | + files: [ | ||
| 248 | + "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js" | ||
| 249 | + ] | ||
| 250 | + }); | ||
| 251 | + }] | ||
| 252 | + } | ||
| 253 | + }) | ||
| 254 | + | ||
| 255 | + // 车辆配置模块 | ||
| 256 | + .state("busConfig", { | ||
| 257 | + url: '/busConfig', | ||
| 258 | + views: { | ||
| 259 | + "": { | ||
| 260 | + templateUrl: 'pages/scheduleApp/module/core/busConfig/index.html' | ||
| 261 | + }, | ||
| 262 | + "busConfig_list@busConfig": { | ||
| 263 | + templateUrl: 'pages/scheduleApp/module/core/busConfig/list.html' | ||
| 264 | + } | ||
| 265 | + }, | ||
| 266 | + | ||
| 267 | + resolve: { | ||
| 268 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 269 | + return $ocLazyLoad.load({ | ||
| 270 | + name: 'busConfig_module', | ||
| 271 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 272 | + files: [ | ||
| 273 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 274 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 275 | + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 276 | + "pages/scheduleApp/module/core/busConfig/busConfig.js" | ||
| 277 | + ] | ||
| 278 | + }); | ||
| 279 | + }] | ||
| 280 | + } | ||
| 281 | + }) | ||
| 282 | + .state("busConfig_form", { | ||
| 283 | + url: '/busConfig_form', | ||
| 284 | + views: { | ||
| 285 | + "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/form.html'} | ||
| 286 | + }, | ||
| 287 | + resolve: { | ||
| 288 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 289 | + return $ocLazyLoad.load({ | ||
| 290 | + name: 'busConfig_form_module', | ||
| 291 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 292 | + files: [ | ||
| 293 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 294 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 295 | + "pages/scheduleApp/module/core/busConfig/busConfig.js" | ||
| 296 | + ] | ||
| 297 | + }); | ||
| 298 | + }] | ||
| 299 | + } | ||
| 300 | + }) | ||
| 301 | + .state("busConfig_edit", { | ||
| 302 | + url: '/busConfig_edit/:id', | ||
| 303 | + views: { | ||
| 304 | + "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/edit.html'} | ||
| 305 | + }, | ||
| 306 | + resolve: { | ||
| 307 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 308 | + return $ocLazyLoad.load({ | ||
| 309 | + name: 'busConfig_edit_module', | ||
| 310 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 311 | + files: [ | ||
| 312 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 313 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 314 | + "pages/scheduleApp/module/core/busConfig/busConfig.js" | ||
| 315 | + ] | ||
| 316 | + }); | ||
| 317 | + }] | ||
| 318 | + } | ||
| 319 | + }) | ||
| 320 | + .state("busConfig_detail", { | ||
| 321 | + url: '/busConfig_detail/:id', | ||
| 322 | + views: { | ||
| 323 | + "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/detail.html'} | ||
| 324 | + }, | ||
| 325 | + resolve: { | ||
| 326 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 327 | + return $ocLazyLoad.load({ | ||
| 328 | + name: 'busConfig_detail_module', | ||
| 329 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 330 | + files: [ | ||
| 331 | + "pages/scheduleApp/module/core/busConfig/busConfig.js" | ||
| 332 | + ] | ||
| 333 | + }); | ||
| 334 | + }] | ||
| 335 | + } | ||
| 336 | + }) | ||
| 337 | + | ||
| 338 | + // 人员配置模块 | ||
| 339 | + .state("employeeConfig", { | ||
| 340 | + url: '/employeeConfig', | ||
| 341 | + views: { | ||
| 342 | + "": { | ||
| 343 | + templateUrl: 'pages/scheduleApp/module/core/employeeConfig/index.html' | ||
| 344 | + }, | ||
| 345 | + "employeeConfig_list@employeeConfig": { | ||
| 346 | + templateUrl: 'pages/scheduleApp/module/core/employeeConfig/list.html' | ||
| 347 | + } | ||
| 348 | + }, | ||
| 349 | + | ||
| 350 | + resolve: { | ||
| 351 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 352 | + return $ocLazyLoad.load({ | ||
| 353 | + name: 'employeeConfig_module', | ||
| 354 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 355 | + files: [ | ||
| 356 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 357 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 358 | + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 359 | + "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js" | ||
| 360 | + ] | ||
| 361 | + }); | ||
| 362 | + }] | ||
| 363 | + } | ||
| 364 | + }) | ||
| 365 | + .state("employeeConfig_form", { | ||
| 366 | + url: '/employeeConfig_form', | ||
| 367 | + views: { | ||
| 368 | + "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/form.html'} | ||
| 369 | + }, | ||
| 370 | + resolve: { | ||
| 371 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 372 | + return $ocLazyLoad.load({ | ||
| 373 | + name: 'employeeConfig_form_module', | ||
| 374 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 375 | + files: [ | ||
| 376 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 377 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 378 | + "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js" | ||
| 379 | + ] | ||
| 380 | + }); | ||
| 381 | + }] | ||
| 382 | + } | ||
| 383 | + }) | ||
| 384 | + .state("employeeConfig_edit", { | ||
| 385 | + url: '/employeeConfig_edit/:id', | ||
| 386 | + views: { | ||
| 387 | + "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/edit.html'} | ||
| 388 | + }, | ||
| 389 | + resolve: { | ||
| 390 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 391 | + return $ocLazyLoad.load({ | ||
| 392 | + name: 'employeeConfig_edit_module', | ||
| 393 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 394 | + files: [ | ||
| 395 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 396 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 397 | + "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js" | ||
| 398 | + ] | ||
| 399 | + }); | ||
| 400 | + }] | ||
| 401 | + } | ||
| 402 | + }) | ||
| 403 | + .state("employeeConfig_detail", { | ||
| 404 | + url: '/employeeConfig_detail/:id', | ||
| 405 | + views: { | ||
| 406 | + "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/detail.html'} | ||
| 407 | + }, | ||
| 408 | + resolve: { | ||
| 409 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 410 | + return $ocLazyLoad.load({ | ||
| 411 | + name: 'employeeConfig_detail_module', | ||
| 412 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 413 | + files: [ | ||
| 414 | + "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js" | ||
| 415 | + ] | ||
| 416 | + }); | ||
| 417 | + }] | ||
| 418 | + } | ||
| 419 | + }) | ||
| 420 | + | ||
| 421 | + // 路牌管理 | ||
| 422 | + .state("guideboardManage", { | ||
| 423 | + url: '/guideboardManage', | ||
| 424 | + views: { | ||
| 425 | + "": { | ||
| 426 | + templateUrl: 'pages/scheduleApp/module/core/guideboardManage/index.html' | ||
| 427 | + }, | ||
| 428 | + "guideboardManage_list@guideboardManage": { | ||
| 429 | + templateUrl: 'pages/scheduleApp/module/core/guideboardManage/list.html' | ||
| 430 | + } | ||
| 431 | + }, | ||
| 432 | + | ||
| 433 | + resolve: { | ||
| 434 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 435 | + return $ocLazyLoad.load({ | ||
| 436 | + name: 'guideboardManage_module', | ||
| 437 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 438 | + files: [ | ||
| 439 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 440 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 441 | + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 442 | + "pages/scheduleApp/module/core/guideboardManage/guideboardManage.js" | ||
| 443 | + ] | ||
| 444 | + }); | ||
| 445 | + }] | ||
| 446 | + } | ||
| 447 | + }) | ||
| 448 | + .state("guideboardManage_detail", { | ||
| 449 | + url: '/guideboardManage_detail/:id', | ||
| 450 | + views: { | ||
| 451 | + "": {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/detail.html'} | ||
| 452 | + }, | ||
| 453 | + resolve: { | ||
| 454 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 455 | + return $ocLazyLoad.load({ | ||
| 456 | + name: 'guideboardManage_detail_module', | ||
| 457 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 458 | + files: [ | ||
| 459 | + "pages/scheduleApp/module/core/guideboardManage/guideboardManage.js" | ||
| 460 | + ] | ||
| 461 | + }); | ||
| 462 | + }] | ||
| 463 | + } | ||
| 464 | + }) | ||
| 465 | + | ||
| 466 | + | ||
| 467 | + // 时刻表管理 | ||
| 468 | + .state("timeTableManage", { | ||
| 469 | + url: '/timeTableManage', | ||
| 470 | + views: { | ||
| 471 | + "": { | ||
| 472 | + templateUrl: 'pages/scheduleApp/module/core/timeTableManage/index.html' | ||
| 473 | + }, | ||
| 474 | + "timeTableManage_list@timeTableManage": { | ||
| 475 | + templateUrl: 'pages/scheduleApp/module/core/timeTableManage/list.html' | ||
| 476 | + } | ||
| 477 | + }, | ||
| 478 | + | ||
| 479 | + resolve: { | ||
| 480 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 481 | + return $ocLazyLoad.load({ | ||
| 482 | + name: 'timeTableManage_module', | ||
| 483 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 484 | + files: [ | ||
| 485 | + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 486 | + "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js" | ||
| 487 | + ] | ||
| 488 | + }); | ||
| 489 | + }] | ||
| 490 | + } | ||
| 491 | + }) | ||
| 492 | + .state("timeTableManage_form", { | ||
| 493 | + url: '/timeTableManage_form', | ||
| 494 | + views: { | ||
| 495 | + "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/form.html'} | ||
| 496 | + }, | ||
| 497 | + resolve: { | ||
| 498 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 499 | + return $ocLazyLoad.load({ | ||
| 500 | + name: 'timeTableManage_form_module', | ||
| 501 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 502 | + files: [ | ||
| 503 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 504 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 505 | + "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js" | ||
| 506 | + ] | ||
| 507 | + }); | ||
| 508 | + }] | ||
| 509 | + } | ||
| 510 | + }) | ||
| 511 | + .state("timeTableManage_edit", { | ||
| 512 | + url: '/timeTableManage_edit/:id', | ||
| 513 | + views: { | ||
| 514 | + "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/edit.html'} | ||
| 515 | + }, | ||
| 516 | + resolve: { | ||
| 517 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 518 | + return $ocLazyLoad.load({ | ||
| 519 | + name: 'timeTableManage_edit_module', | ||
| 520 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 521 | + files: [ | ||
| 522 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 523 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 524 | + "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js" | ||
| 525 | + ] | ||
| 526 | + }); | ||
| 527 | + }] | ||
| 528 | + } | ||
| 529 | + }) | ||
| 530 | + .state("timeTableManage_detail", { | ||
| 531 | + url: '/timeTableManage_detail/:id', | ||
| 532 | + views: { | ||
| 533 | + "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail.html'} | ||
| 534 | + }, | ||
| 535 | + resolve: { | ||
| 536 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 537 | + return $ocLazyLoad.load({ | ||
| 538 | + name: 'timeTableManage_detail_module', | ||
| 539 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 540 | + files: [ | ||
| 541 | + "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js" | ||
| 542 | + ] | ||
| 543 | + }); | ||
| 544 | + }] | ||
| 545 | + } | ||
| 546 | + }) | ||
| 547 | + .state("timeTableDetailInfoManage", { | ||
| 548 | + url: '/timeTableDetailInfoManage/:xlid/:ttid/:xlname/:ttname', | ||
| 549 | + views: { | ||
| 550 | + "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail_info.html'} | ||
| 551 | + }, | ||
| 552 | + resolve: { | ||
| 553 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 554 | + return $ocLazyLoad.load({ | ||
| 555 | + name: 'timeTableDetailInfoManage_module', | ||
| 556 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 557 | + files: [ | ||
| 558 | + "pages/scheduleApp/module/core/timeTableManage/timeTableDetailManage.js" | ||
| 559 | + ] | ||
| 560 | + }); | ||
| 561 | + }] | ||
| 562 | + } | ||
| 563 | + }) | ||
| 564 | + .state("timeTableDetailInfoManage_detail_edit", { | ||
| 565 | + url: '/timeTableDetailInfoManage_detail_edit/:id/:xlid/:ttid/:xlname/:ttname', | ||
| 566 | + views: { | ||
| 567 | + "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail_info_edit.html'} | ||
| 568 | + }, | ||
| 569 | + resolve: { | ||
| 570 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 571 | + return $ocLazyLoad.load({ | ||
| 572 | + name: 'timeTableDetailInfoManage_module', | ||
| 573 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 574 | + files: [ | ||
| 575 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 576 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 577 | + "pages/scheduleApp/module/core/timeTableManage/timeTableDetailManage.js" | ||
| 578 | + ] | ||
| 579 | + }); | ||
| 580 | + }] | ||
| 581 | + } | ||
| 582 | + }) | ||
| 583 | + | ||
| 584 | + // 排班规则管理模块 | ||
| 585 | + .state("scheduleRuleManage", { | ||
| 586 | + url: '/scheduleRuleManage', | ||
| 587 | + views: { | ||
| 588 | + "": { | ||
| 589 | + templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/index.html' | ||
| 590 | + }, | ||
| 591 | + "scheduleRuleManage_list@scheduleRuleManage": { | ||
| 592 | + templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/list.html' | ||
| 593 | + } | ||
| 594 | + }, | ||
| 595 | + | ||
| 596 | + resolve: { | ||
| 597 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 598 | + return $ocLazyLoad.load({ | ||
| 599 | + name: 'scheduleRuleManage_module', | ||
| 600 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 601 | + files: [ | ||
| 602 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 603 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 604 | + "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" | ||
| 605 | + ] | ||
| 606 | + }); | ||
| 607 | + }] | ||
| 608 | + } | ||
| 609 | + }) | ||
| 610 | + .state("scheduleRuleManage_form", { | ||
| 611 | + url: '/scheduleRuleManage_form', | ||
| 612 | + views: { | ||
| 613 | + "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/form.html'} | ||
| 614 | + }, | ||
| 615 | + resolve: { | ||
| 616 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 617 | + return $ocLazyLoad.load({ | ||
| 618 | + name: 'scheduleRuleManage_form_module', | ||
| 619 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 620 | + files: [ | ||
| 621 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 622 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 623 | + "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" | ||
| 624 | + ] | ||
| 625 | + }); | ||
| 626 | + }] | ||
| 627 | + } | ||
| 628 | + }) | ||
| 629 | + .state("scheduleRuleManage_edit", { | ||
| 630 | + url: '/scheduleRuleManage_edit/:id', | ||
| 631 | + views: { | ||
| 632 | + "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/edit.html'} | ||
| 633 | + }, | ||
| 634 | + resolve: { | ||
| 635 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 636 | + return $ocLazyLoad.load({ | ||
| 637 | + name: 'scheduleRuleManage_edit_module', | ||
| 638 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 639 | + files: [ | ||
| 640 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 641 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 642 | + "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" | ||
| 643 | + ] | ||
| 644 | + }); | ||
| 645 | + }] | ||
| 646 | + } | ||
| 647 | + }) | ||
| 648 | + .state("scheduleRuleManage_detail", { | ||
| 649 | + url: '/scheduleRuleManage_detail/:id', | ||
| 650 | + views: { | ||
| 651 | + "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/detail.html'} | ||
| 652 | + }, | ||
| 653 | + resolve: { | ||
| 654 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 655 | + return $ocLazyLoad.load({ | ||
| 656 | + name: 'scheduleRuleManage_detail_module', | ||
| 657 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 658 | + files: [ | ||
| 659 | + "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" | ||
| 660 | + ] | ||
| 661 | + }); | ||
| 662 | + }] | ||
| 663 | + } | ||
| 664 | + }) | ||
| 665 | + | ||
| 666 | + // 排班计划管理模块 | ||
| 667 | + .state("schedulePlanManage", { | ||
| 668 | + url: '/schedulePlanManage', | ||
| 669 | + views: { | ||
| 670 | + "": { | ||
| 671 | + templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/index.html' | ||
| 672 | + }, | ||
| 673 | + "schedulePlanManage_list@schedulePlanManage": { | ||
| 674 | + templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/list.html' | ||
| 675 | + } | ||
| 676 | + }, | ||
| 677 | + | ||
| 678 | + resolve: { | ||
| 679 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 680 | + return $ocLazyLoad.load({ | ||
| 681 | + name: 'schedulePlanManage_module', | ||
| 682 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 683 | + files: [ | ||
| 684 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 685 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 686 | + "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanManage.js" | ||
| 687 | + ] | ||
| 688 | + }); | ||
| 689 | + }] | ||
| 690 | + } | ||
| 691 | + }) | ||
| 692 | + .state("schedulePlanManage_form", { | ||
| 693 | + url: '/schedulePlanManage_form', | ||
| 694 | + views: { | ||
| 695 | + "": { | ||
| 696 | + templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/form.html' | ||
| 697 | + } | ||
| 698 | + }, | ||
| 699 | + | ||
| 700 | + resolve: { | ||
| 701 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 702 | + return $ocLazyLoad.load({ | ||
| 703 | + name: 'schedulePlanManage_form_module', | ||
| 704 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 705 | + files: [ | ||
| 706 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 707 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 708 | + "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanManage.js" | ||
| 709 | + ] | ||
| 710 | + }); | ||
| 711 | + }] | ||
| 712 | + } | ||
| 713 | + }) | ||
| 714 | + | ||
| 715 | + // 排班计划明细管理模块 | ||
| 716 | + .state("schedulePlanInfoManage", { | ||
| 717 | + url: '/schedulePlanInfoManage/:spid/:xlname/:ttname/:stime/:etime', | ||
| 718 | + views: { | ||
| 719 | + "": { | ||
| 720 | + templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/index_info.html' | ||
| 721 | + }, | ||
| 722 | + "schedulePlanInfoManage_list@schedulePlanInfoManage": { | ||
| 723 | + templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/list_info.html' | ||
| 724 | + } | ||
| 725 | + }, | ||
| 726 | + | ||
| 727 | + resolve: { | ||
| 728 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 729 | + return $ocLazyLoad.load({ | ||
| 730 | + name: 'schedulePlanInfoManage_module', | ||
| 731 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 732 | + files: [ | ||
| 733 | + "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanInfoManage.js" | ||
| 734 | + ] | ||
| 735 | + }); | ||
| 736 | + }] | ||
| 737 | + } | ||
| 738 | + }) | ||
| 739 | + | ||
| 740 | + // 排班调度值勤日报模块 | ||
| 741 | + .state("schedulePlanReportManage", { | ||
| 742 | + url: '/schedulePlanReportManage', | ||
| 743 | + views: { | ||
| 744 | + "": { | ||
| 745 | + templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/index_report.html' | ||
| 746 | + }, | ||
| 747 | + "schedulePlanReportManage_list@schedulePlanReportManage": { | ||
| 748 | + templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/list_report.html' | ||
| 749 | + } | ||
| 750 | + }, | ||
| 751 | + | ||
| 752 | + resolve: { | ||
| 753 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 754 | + return $ocLazyLoad.load({ | ||
| 755 | + name: 'schedulePlanManage_module', | ||
| 756 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 757 | + files: [ | ||
| 758 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 759 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 760 | + "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js" | ||
| 761 | + ] | ||
| 762 | + }); | ||
| 763 | + }] | ||
| 764 | + } | ||
| 765 | + }) | ||
| 766 | + | ||
| 767 | + .state("schedulePlanReportManage_edit", { | ||
| 768 | + url: '/schedulePlanReportManage_edit', | ||
| 769 | + params: {type: 0, groupInfo: null}, | ||
| 770 | + views: { | ||
| 771 | + "": { | ||
| 772 | + templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/edit_report.html' | ||
| 773 | + } | ||
| 774 | + }, | ||
| 775 | + | ||
| 776 | + resolve: { | ||
| 777 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 778 | + return $ocLazyLoad.load({ | ||
| 779 | + name: 'schedulePlanReportManage_edit_module', | ||
| 780 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 781 | + files: [ | ||
| 782 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 783 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 784 | + "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js" | ||
| 785 | + ] | ||
| 786 | + }); | ||
| 787 | + }] | ||
| 788 | + } | ||
| 789 | + }) | ||
| 790 | + | ||
| 791 | + // 线路运营概览模块 | ||
| 792 | + .state("busLineInfoStat", { | ||
| 793 | + url: '/busLineInfoStat', | ||
| 794 | + views: { | ||
| 795 | + "": { | ||
| 796 | + templateUrl: 'pages/scheduleApp/module/core/busLineInfoStat/index.html' | ||
| 797 | + }, | ||
| 798 | + "busLineInfoStat_list@busLineInfoStat": { | ||
| 799 | + templateUrl: 'pages/scheduleApp/module/core/busLineInfoStat/list.html' | ||
| 800 | + } | ||
| 801 | + }, | ||
| 802 | + | ||
| 803 | + resolve: { | ||
| 804 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 805 | + return $ocLazyLoad.load({ | ||
| 806 | + name: 'busLineInfoStat_module', | ||
| 807 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 808 | + files: [ | ||
| 809 | + "pages/scheduleApp/module/core/busLineInfoStat/busLineInfoStat.js" | ||
| 810 | + ] | ||
| 811 | + }); | ||
| 812 | + }] | ||
| 813 | + } | ||
| 814 | + }) | ||
| 815 | + | ||
| 816 | + | ||
| 817 | + | ||
| 818 | + | ||
| 819 | + | ||
| 820 | + // TODO: | ||
| 821 | + | ||
| 822 | + ; | ||
| 823 | + | ||
| 824 | }]); | 824 | }]); |
| 825 | \ No newline at end of file | 825 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js
| 1 | -// 调度值勤日报管理 service controller 等写在一起 | ||
| 2 | -// TODO:使用的global服务需要修正 | ||
| 3 | -angular.module('ScheduleApp').factory('SchedulePlanReportManageService', [ | ||
| 4 | - 'SchedulePlanInfoManageService_g', 'SchedulePlanManageService_g', '$q', | ||
| 5 | - function(service, service2, $q) { | ||
| 6 | - /** 当前的查询条件信息 */ | ||
| 7 | - var currentSearchCondition = {}; | ||
| 8 | - | ||
| 9 | - return { | ||
| 10 | - /** | ||
| 11 | - * 获取查询条件信息, | ||
| 12 | - * 用于给controller用来和页面数据绑定。 | ||
| 13 | - */ | ||
| 14 | - getSearchCondition: function() { | ||
| 15 | - return currentSearchCondition; | ||
| 16 | - }, | ||
| 17 | - /** | ||
| 18 | - * 重置查询条件信息。 | ||
| 19 | - */ | ||
| 20 | - resetSearchCondition: function() { | ||
| 21 | - var key; | ||
| 22 | - for (key in currentSearchCondition) { | ||
| 23 | - currentSearchCondition[key] = undefined; | ||
| 24 | - } | ||
| 25 | - }, | ||
| 26 | - /** | ||
| 27 | - * 组装查询参数,返回一个promise查询结果。 | ||
| 28 | - * @param params 查询参数 | ||
| 29 | - * @return 返回一个 promise | ||
| 30 | - */ | ||
| 31 | - getPage: function() { | ||
| 32 | - var params = currentSearchCondition; // 查询条件 | ||
| 33 | - | ||
| 34 | - // promise | ||
| 35 | - var deferred = $q.defer(); | ||
| 36 | - | ||
| 37 | - // 如果线路id和日期都没有,从后台获取一组参数,如果还没有,就设定死一组参数 | ||
| 38 | - if (!params.xlid && !params.sdate) { | ||
| 39 | - service2.tommorw.list().$promise.then( | ||
| 40 | - function(result) { | ||
| 41 | - if (result) { | ||
| 42 | - // 线路id | ||
| 43 | - params.xlid = result.xl.id; | ||
| 44 | - // 时间 | ||
| 45 | - var dd = new Date(); | ||
| 46 | - dd.setHours(0); | ||
| 47 | - dd.setMinutes(0); | ||
| 48 | - dd.setSeconds(0); | ||
| 49 | - dd.setMilliseconds(0); | ||
| 50 | - dd.setTime(dd.getTime() + 24 * 3600 * 1000); | ||
| 51 | - params.sdate = dd; | ||
| 52 | - } else { | ||
| 53 | - // 如果没有选中线路、日期,默认选中一个 | ||
| 54 | - params.xlid = 2; | ||
| 55 | - params.sdate = new Date(); | ||
| 56 | - params.sdate.setTime(1472140800000); | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - // 调用方法 | ||
| 60 | - service.groupinfo.list(params).$promise.then( | ||
| 61 | - function(result_internal) { | ||
| 62 | - deferred.resolve(result_internal); | ||
| 63 | - }, | ||
| 64 | - function(result_internal_error) { | ||
| 65 | - deferred.reject(result_internal_error); | ||
| 66 | - } | ||
| 67 | - ); | ||
| 68 | - | ||
| 69 | - }, | ||
| 70 | - function(result_error) { | ||
| 71 | - // 如果没有选中线路、日期,默认选中一个 | ||
| 72 | - params.xlid = 2; | ||
| 73 | - params.sdate = new Date(); | ||
| 74 | - params.sdate.setTime(1472140800000); | ||
| 75 | - | ||
| 76 | - // 调用方法 | ||
| 77 | - service.groupinfo.list(params).$promise.then( | ||
| 78 | - function(result_internal) { | ||
| 79 | - deferred.resolve(result_internal); | ||
| 80 | - }, | ||
| 81 | - function(result_internal_error) { | ||
| 82 | - deferred.reject(result_internal_error); | ||
| 83 | - } | ||
| 84 | - ); | ||
| 85 | - } | ||
| 86 | - ); | ||
| 87 | - } else { | ||
| 88 | - // 调用方法 | ||
| 89 | - service.groupinfo.list(params).$promise.then( | ||
| 90 | - function(result_internal) { | ||
| 91 | - deferred.resolve(result_internal); | ||
| 92 | - }, | ||
| 93 | - function(result_internal_error) { | ||
| 94 | - deferred.reject(result_internal_error); | ||
| 95 | - } | ||
| 96 | - ); | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - return deferred.promise; | ||
| 100 | - | ||
| 101 | - }, | ||
| 102 | - /** | ||
| 103 | - * 获取明细信息。 | ||
| 104 | - * @param id 车辆id | ||
| 105 | - * @return 返回一个 promise | ||
| 106 | - */ | ||
| 107 | - getDetail: function(id) { | ||
| 108 | - var params = {id: id}; | ||
| 109 | - return service.get(params).$promise; | ||
| 110 | - }, | ||
| 111 | - /** | ||
| 112 | - * 保存信息。 | ||
| 113 | - * @param obj 车辆详细信息 | ||
| 114 | - * @return 返回一个 promise | ||
| 115 | - */ | ||
| 116 | - saveDetail: function(obj) { | ||
| 117 | - return service.save(obj).$promise; | ||
| 118 | - }, | ||
| 119 | - /** | ||
| 120 | - * 更新分组信息。 | ||
| 121 | - * @param obj | ||
| 122 | - * @returns {*|Function|promise|n} | ||
| 123 | - */ | ||
| 124 | - updateDetail: function(obj) { | ||
| 125 | - return service.updateGroupInfo.update(obj).$promise; | ||
| 126 | - } | ||
| 127 | - }; | ||
| 128 | - | ||
| 129 | - }]); | ||
| 130 | - | ||
| 131 | -angular.module('ScheduleApp').controller('SchedulePlanReportManageCtrl', [ | ||
| 132 | - 'SchedulePlanReportManageService', '$state', | ||
| 133 | - function(schedulePlanReportManageService, $state) { | ||
| 134 | - var self = this; | ||
| 135 | - | ||
| 136 | - // 切换到form状态 | ||
| 137 | - self.goForm = function() { | ||
| 138 | - alert("切换"); | ||
| 139 | - } | ||
| 140 | - } | ||
| 141 | -]); | ||
| 142 | - | ||
| 143 | -angular.module('ScheduleApp').controller('SchedulePlanReportManageListCtrl', [ | ||
| 144 | - 'SchedulePlanReportManageService', '$scope', '$state', | ||
| 145 | - function(schedulePlanReportManageService, $scope, $state) { | ||
| 146 | - | ||
| 147 | - var self = this; | ||
| 148 | - self.pageInfo = { | ||
| 149 | - infos: [] | ||
| 150 | - }; | ||
| 151 | - | ||
| 152 | - // 日期 日期控件开关 | ||
| 153 | - self.scheduleDateOpen = false; | ||
| 154 | - self.scheduleDate_open = function() { | ||
| 155 | - self.scheduleDateOpen = true; | ||
| 156 | - }; | ||
| 157 | - | ||
| 158 | - // 翻页的时候调用 | ||
| 159 | - self.pageChanaged = function() { | ||
| 160 | - schedulePlanReportManageService.getPage().then( | ||
| 161 | - function(result) { | ||
| 162 | - self.pageInfo.infos = result; | ||
| 163 | - }, | ||
| 164 | - function(result) { | ||
| 165 | - alert("出错啦!"); | ||
| 166 | - } | ||
| 167 | - ); | ||
| 168 | - }; | ||
| 169 | - // 获取查询条件数据 | ||
| 170 | - self.searchCondition = function() { | ||
| 171 | - return schedulePlanReportManageService.getSearchCondition(); | ||
| 172 | - }; | ||
| 173 | - // 重置查询条件 | ||
| 174 | - self.resetSearchCondition = function() { | ||
| 175 | - return schedulePlanReportManageService.resetSearchCondition(); | ||
| 176 | - }; | ||
| 177 | - | ||
| 178 | - // 监控条件变化,触发查询 | ||
| 179 | - $scope.$watch( | ||
| 180 | - function() { | ||
| 181 | - return schedulePlanReportManageService.getSearchCondition(); | ||
| 182 | - }, | ||
| 183 | - function(newValue, oldValue) { | ||
| 184 | - if (newValue) { | ||
| 185 | - if (newValue.xlid && newValue.sdate) { | ||
| 186 | - self.pageChanaged(); | ||
| 187 | - } | ||
| 188 | - } | ||
| 189 | - }, | ||
| 190 | - true | ||
| 191 | - ); | ||
| 192 | - | ||
| 193 | - /** | ||
| 194 | - * ui-route中param不定义在template-url后,定义在params参数对象中 | ||
| 195 | - * 参数说明,type=更新方式,groupInfo=分组排班信息 | ||
| 196 | - * @param type 1=替换车辆,2=修改出场班次1,3=替换分组人员(驾驶员1和售票员1) | ||
| 197 | - // 有分班的话,4=修改出场班次2,5=修改分组人员(驾驶员2和售票员2) | ||
| 198 | - * @param groupInfo 列表单条数据,表示每条线路,每天,每个路牌谁跑的 | ||
| 199 | - */ | ||
| 200 | - self.goEditForm = function(type, groupInfo) { | ||
| 201 | - $state.go("schedulePlanReportManage_edit", { | ||
| 202 | - type: type, | ||
| 203 | - groupInfo: groupInfo | ||
| 204 | - }); | ||
| 205 | - }; | ||
| 206 | - | ||
| 207 | - | ||
| 208 | - // 初始创建的时候,获取一次列表数据 | ||
| 209 | - self.pageChanaged(); | ||
| 210 | - | ||
| 211 | - } | ||
| 212 | -]); | ||
| 213 | - | ||
| 214 | -angular.module('ScheduleApp').controller('SchedulePlanReportManageFormCtrl', [ | ||
| 215 | - 'SchedulePlanReportManageService', | ||
| 216 | - '$stateParams', | ||
| 217 | - '$state', | ||
| 218 | - function(schedulePlanReportManageService, $stateParams, $state) { | ||
| 219 | - var self = this; | ||
| 220 | - | ||
| 221 | - // 传过来的值 | ||
| 222 | - var type_src = $stateParams.type; | ||
| 223 | - var groupInfo_src = $stateParams.groupInfo; | ||
| 224 | - | ||
| 225 | - // 时间正则表达式(格式hh:mm,如:06:39) | ||
| 226 | - self.time_regex = /^(([0-1]\d)|(2[0-4])):[0-5]\d$/; | ||
| 227 | - | ||
| 228 | - // 欲修改的groupInfo值 | ||
| 229 | - self.groupInfo_src = groupInfo_src; | ||
| 230 | - self.groupInfo = {}; | ||
| 231 | - self.type = type_src; | ||
| 232 | - angular.copy(groupInfo_src, self.groupInfo); | ||
| 233 | - | ||
| 234 | - // 提交方法 | ||
| 235 | - self.submit = function() { | ||
| 236 | - var param = { | ||
| 237 | - type: self.type, | ||
| 238 | - src: self.groupInfo_src, | ||
| 239 | - update: self.groupInfo | ||
| 240 | - }; | ||
| 241 | - schedulePlanReportManageService.updateDetail(param).then( | ||
| 242 | - function(result) { | ||
| 243 | - if (result.status == 'SUCCESS') { | ||
| 244 | - alert("保存成功!"); | ||
| 245 | - $state.go("schedulePlanReportManage"); | ||
| 246 | - } else { | ||
| 247 | - alert("保存异常!"); | ||
| 248 | - } | ||
| 249 | - }, | ||
| 250 | - function(result) { | ||
| 251 | - alert("出错啦!"); | ||
| 252 | - } | ||
| 253 | - ); | ||
| 254 | - } | ||
| 255 | - | ||
| 256 | - } | ||
| 257 | -]); | ||
| 258 | - | ||
| 259 | -angular.module('ScheduleApp').controller('SchedulePlanReportManageDetailCtrl', ['SchedulePlanReportManageService', '$stateParams', function(schedulePlanReportManageService, $stateParams) { | ||
| 260 | - // TODO: | ||
| 261 | -}]); | ||
| 262 | - | ||
| 263 | - | 1 | +// 调度值勤日报管理 service controller 等写在一起 |
| 2 | +// TODO:使用的global服务需要修正 | ||
| 3 | +angular.module('ScheduleApp').factory('SchedulePlanReportManageService', [ | ||
| 4 | + 'SchedulePlanInfoManageService_g', 'SchedulePlanManageService_g', '$q', | ||
| 5 | + function(service, service2, $q) { | ||
| 6 | + /** 当前的查询条件信息 */ | ||
| 7 | + var currentSearchCondition = {}; | ||
| 8 | + | ||
| 9 | + return { | ||
| 10 | + /** | ||
| 11 | + * 获取查询条件信息, | ||
| 12 | + * 用于给controller用来和页面数据绑定。 | ||
| 13 | + */ | ||
| 14 | + getSearchCondition: function() { | ||
| 15 | + return currentSearchCondition; | ||
| 16 | + }, | ||
| 17 | + /** | ||
| 18 | + * 重置查询条件信息。 | ||
| 19 | + */ | ||
| 20 | + resetSearchCondition: function() { | ||
| 21 | + var key; | ||
| 22 | + for (key in currentSearchCondition) { | ||
| 23 | + currentSearchCondition[key] = undefined; | ||
| 24 | + } | ||
| 25 | + }, | ||
| 26 | + /** | ||
| 27 | + * 组装查询参数,返回一个promise查询结果。 | ||
| 28 | + * @param params 查询参数 | ||
| 29 | + * @return 返回一个 promise | ||
| 30 | + */ | ||
| 31 | + getPage: function() { | ||
| 32 | + var params = currentSearchCondition; // 查询条件 | ||
| 33 | + | ||
| 34 | + // promise | ||
| 35 | + var deferred = $q.defer(); | ||
| 36 | + | ||
| 37 | + // 如果线路id和日期都没有,从后台获取一组参数,如果还没有,就设定死一组参数 | ||
| 38 | + if (!params.xlid && !params.sdate) { | ||
| 39 | + service2.tommorw.list().$promise.then( | ||
| 40 | + function(result) { | ||
| 41 | + if (result) { | ||
| 42 | + // 线路id | ||
| 43 | + params.xlid = result.xl.id; | ||
| 44 | + // 时间 | ||
| 45 | + var dd = new Date(); | ||
| 46 | + dd.setHours(0); | ||
| 47 | + dd.setMinutes(0); | ||
| 48 | + dd.setSeconds(0); | ||
| 49 | + dd.setMilliseconds(0); | ||
| 50 | + dd.setTime(dd.getTime() + 24 * 3600 * 1000); | ||
| 51 | + params.sdate = dd; | ||
| 52 | + } else { | ||
| 53 | + // 如果没有选中线路、日期,默认选中一个 | ||
| 54 | + params.xlid = 2; | ||
| 55 | + params.sdate = new Date(); | ||
| 56 | + params.sdate.setTime(1472140800000); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + // 调用方法 | ||
| 60 | + service.groupinfo.list(params).$promise.then( | ||
| 61 | + function(result_internal) { | ||
| 62 | + deferred.resolve(result_internal); | ||
| 63 | + }, | ||
| 64 | + function(result_internal_error) { | ||
| 65 | + deferred.reject(result_internal_error); | ||
| 66 | + } | ||
| 67 | + ); | ||
| 68 | + | ||
| 69 | + }, | ||
| 70 | + function(result_error) { | ||
| 71 | + // 如果没有选中线路、日期,默认选中一个 | ||
| 72 | + params.xlid = 2; | ||
| 73 | + params.sdate = new Date(); | ||
| 74 | + params.sdate.setTime(1472140800000); | ||
| 75 | + | ||
| 76 | + // 调用方法 | ||
| 77 | + service.groupinfo.list(params).$promise.then( | ||
| 78 | + function(result_internal) { | ||
| 79 | + deferred.resolve(result_internal); | ||
| 80 | + }, | ||
| 81 | + function(result_internal_error) { | ||
| 82 | + deferred.reject(result_internal_error); | ||
| 83 | + } | ||
| 84 | + ); | ||
| 85 | + } | ||
| 86 | + ); | ||
| 87 | + } else { | ||
| 88 | + // 调用方法 | ||
| 89 | + service.groupinfo.list(params).$promise.then( | ||
| 90 | + function(result_internal) { | ||
| 91 | + deferred.resolve(result_internal); | ||
| 92 | + }, | ||
| 93 | + function(result_internal_error) { | ||
| 94 | + deferred.reject(result_internal_error); | ||
| 95 | + } | ||
| 96 | + ); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + return deferred.promise; | ||
| 100 | + | ||
| 101 | + }, | ||
| 102 | + /** | ||
| 103 | + * 获取明细信息。 | ||
| 104 | + * @param id 车辆id | ||
| 105 | + * @return 返回一个 promise | ||
| 106 | + */ | ||
| 107 | + getDetail: function(id) { | ||
| 108 | + var params = {id: id}; | ||
| 109 | + return service.get(params).$promise; | ||
| 110 | + }, | ||
| 111 | + /** | ||
| 112 | + * 保存信息。 | ||
| 113 | + * @param obj 车辆详细信息 | ||
| 114 | + * @return 返回一个 promise | ||
| 115 | + */ | ||
| 116 | + saveDetail: function(obj) { | ||
| 117 | + return service.save(obj).$promise; | ||
| 118 | + }, | ||
| 119 | + /** | ||
| 120 | + * 更新分组信息。 | ||
| 121 | + * @param obj | ||
| 122 | + * @returns {*|Function|promise|n} | ||
| 123 | + */ | ||
| 124 | + updateDetail: function(obj) { | ||
| 125 | + return service.updateGroupInfo.update(obj).$promise; | ||
| 126 | + } | ||
| 127 | + }; | ||
| 128 | + | ||
| 129 | + }]); | ||
| 130 | + | ||
| 131 | +angular.module('ScheduleApp').controller('SchedulePlanReportManageCtrl', [ | ||
| 132 | + 'SchedulePlanReportManageService', '$state', | ||
| 133 | + function(schedulePlanReportManageService, $state) { | ||
| 134 | + var self = this; | ||
| 135 | + | ||
| 136 | + // 切换到form状态 | ||
| 137 | + self.goForm = function() { | ||
| 138 | + alert("切换"); | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | +]); | ||
| 142 | + | ||
| 143 | +angular.module('ScheduleApp').controller('SchedulePlanReportManageListCtrl', [ | ||
| 144 | + 'SchedulePlanReportManageService', '$scope', '$state', | ||
| 145 | + function(schedulePlanReportManageService, $scope, $state) { | ||
| 146 | + | ||
| 147 | + var self = this; | ||
| 148 | + self.pageInfo = { | ||
| 149 | + infos: [] | ||
| 150 | + }; | ||
| 151 | + | ||
| 152 | + // 日期 日期控件开关 | ||
| 153 | + self.scheduleDateOpen = false; | ||
| 154 | + self.scheduleDate_open = function() { | ||
| 155 | + self.scheduleDateOpen = true; | ||
| 156 | + }; | ||
| 157 | + | ||
| 158 | + // 翻页的时候调用 | ||
| 159 | + self.pageChanaged = function() { | ||
| 160 | + schedulePlanReportManageService.getPage().then( | ||
| 161 | + function(result) { | ||
| 162 | + self.pageInfo.infos = result; | ||
| 163 | + }, | ||
| 164 | + function(result) { | ||
| 165 | + alert("出错啦!"); | ||
| 166 | + } | ||
| 167 | + ); | ||
| 168 | + }; | ||
| 169 | + // 获取查询条件数据 | ||
| 170 | + self.searchCondition = function() { | ||
| 171 | + return schedulePlanReportManageService.getSearchCondition(); | ||
| 172 | + }; | ||
| 173 | + // 重置查询条件 | ||
| 174 | + self.resetSearchCondition = function() { | ||
| 175 | + return schedulePlanReportManageService.resetSearchCondition(); | ||
| 176 | + }; | ||
| 177 | + | ||
| 178 | + // 监控条件变化,触发查询 | ||
| 179 | + $scope.$watch( | ||
| 180 | + function() { | ||
| 181 | + return schedulePlanReportManageService.getSearchCondition(); | ||
| 182 | + }, | ||
| 183 | + function(newValue, oldValue) { | ||
| 184 | + if (newValue) { | ||
| 185 | + if (newValue.xlid && newValue.sdate) { | ||
| 186 | + self.pageChanaged(); | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + }, | ||
| 190 | + true | ||
| 191 | + ); | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * ui-route中param不定义在template-url后,定义在params参数对象中 | ||
| 195 | + * 参数说明,type=更新方式,groupInfo=分组排班信息 | ||
| 196 | + * @param type 1=替换车辆,2=修改出场班次1,3=替换分组人员(驾驶员1和售票员1) | ||
| 197 | + // 有分班的话,4=修改出场班次2,5=修改分组人员(驾驶员2和售票员2) | ||
| 198 | + * @param groupInfo 列表单条数据,表示每条线路,每天,每个路牌谁跑的 | ||
| 199 | + */ | ||
| 200 | + self.goEditForm = function(type, groupInfo) { | ||
| 201 | + $state.go("schedulePlanReportManage_edit", { | ||
| 202 | + type: type, | ||
| 203 | + groupInfo: groupInfo | ||
| 204 | + }); | ||
| 205 | + }; | ||
| 206 | + | ||
| 207 | + | ||
| 208 | + // 初始创建的时候,获取一次列表数据 | ||
| 209 | + self.pageChanaged(); | ||
| 210 | + | ||
| 211 | + } | ||
| 212 | +]); | ||
| 213 | + | ||
| 214 | +angular.module('ScheduleApp').controller('SchedulePlanReportManageFormCtrl', [ | ||
| 215 | + 'SchedulePlanReportManageService', | ||
| 216 | + '$stateParams', | ||
| 217 | + '$state', | ||
| 218 | + function(schedulePlanReportManageService, $stateParams, $state) { | ||
| 219 | + var self = this; | ||
| 220 | + | ||
| 221 | + // 传过来的值 | ||
| 222 | + var type_src = $stateParams.type; | ||
| 223 | + var groupInfo_src = $stateParams.groupInfo; | ||
| 224 | + | ||
| 225 | + // 时间正则表达式(格式hh:mm,如:06:39) | ||
| 226 | + self.time_regex = /^(([0-1]\d)|(2[0-4])):[0-5]\d$/; | ||
| 227 | + | ||
| 228 | + // 欲修改的groupInfo值 | ||
| 229 | + self.groupInfo_src = groupInfo_src; | ||
| 230 | + self.groupInfo = {}; | ||
| 231 | + self.type = type_src; | ||
| 232 | + angular.copy(groupInfo_src, self.groupInfo); | ||
| 233 | + | ||
| 234 | + // 提交方法 | ||
| 235 | + self.submit = function() { | ||
| 236 | + var param = { | ||
| 237 | + type: self.type, | ||
| 238 | + src: self.groupInfo_src, | ||
| 239 | + update: self.groupInfo | ||
| 240 | + }; | ||
| 241 | + schedulePlanReportManageService.updateDetail(param).then( | ||
| 242 | + function(result) { | ||
| 243 | + if (result.status == 'SUCCESS') { | ||
| 244 | + alert("保存成功!"); | ||
| 245 | + $state.go("schedulePlanReportManage"); | ||
| 246 | + } else { | ||
| 247 | + alert("保存异常!"); | ||
| 248 | + } | ||
| 249 | + }, | ||
| 250 | + function(result) { | ||
| 251 | + alert("出错啦!"); | ||
| 252 | + } | ||
| 253 | + ); | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + } | ||
| 257 | +]); | ||
| 258 | + | ||
| 259 | +angular.module('ScheduleApp').controller('SchedulePlanReportManageDetailCtrl', ['SchedulePlanReportManageService', '$stateParams', function(schedulePlanReportManageService, $stateParams) { | ||
| 260 | + // TODO: | ||
| 261 | +}]); | ||
| 262 | + | ||
| 263 | + |