Commit 7dfd8bc865828f2bf4bc701dc16b1a8ac1888810
1 parent
44301ffb
时刻表预览更新
1、添加到达时间 2、在头部添加上行下行的起站点和终点站说明 3、点击任何一个班次,高亮显示并且下一个班次也高亮并移动到列表中间
Showing
4 changed files
with
1026 additions
and
482 deletions
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreView.js
| @@ -18,6 +18,21 @@ angular.module("ScheduleApp").directive( | @@ -18,6 +18,21 @@ angular.module("ScheduleApp").directive( | ||
| 18 | controller : function() { | 18 | controller : function() { |
| 19 | var self = this; | 19 | var self = this; |
| 20 | 20 | ||
| 21 | + // 内部班次时刻模型 | ||
| 22 | + self.internalBcModel = { | ||
| 23 | + up_qdz_name : "", // 上行起点站名字 | ||
| 24 | + down_qdz_name : "", // 下行起点站名字 | ||
| 25 | + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | ||
| 26 | + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | ||
| 27 | + }; | ||
| 28 | + | ||
| 29 | + // 内部各个路牌block车次链模型 | ||
| 30 | + self.internalLpBlockModel = { | ||
| 31 | + // key:路牌名字 | ||
| 32 | + // value: 数组(按照发车时间排序) | ||
| 33 | + // value 数据内对象 {fcsj:发车时间,isUp:是否上行,fcno:发车顺序号,index:对应的班次列表索引} | ||
| 34 | + }; | ||
| 35 | + | ||
| 21 | // TODO: | 36 | // TODO: |
| 22 | }, | 37 | }, |
| 23 | 38 | ||
| @@ -34,15 +49,274 @@ angular.module("ScheduleApp").directive( | @@ -34,15 +49,274 @@ angular.module("ScheduleApp").directive( | ||
| 34 | throw new Error("saTimeTablePreview指令 name属性required"); | 49 | throw new Error("saTimeTablePreview指令 name属性required"); |
| 35 | } | 50 | } |
| 36 | 51 | ||
| 52 | + // 内部controlAs名字 | ||
| 53 | + var ctrlAs = "$saTimeTablePreviewCtrl"; | ||
| 54 | + | ||
| 37 | // TODO: | 55 | // TODO: |
| 38 | 56 | ||
| 57 | + //------------------ 内部方法 --------------------// | ||
| 58 | + var date_wrap_prefix = "2000-01-01 "; // 包装日期的前缀 | ||
| 59 | + var date_wrap_format = "YYYY-MM-DD HH:mm"; // 日期格式 | ||
| 60 | + /** | ||
| 61 | + * 将时间包装成日期,方便计算。 | ||
| 62 | + * @param timeStr 时间格式,如 06:30 | ||
| 63 | + * @returns moment对象 | ||
| 64 | + */ | ||
| 65 | + var _fun_WrapTime = function(timeStr) { | ||
| 66 | + return moment( | ||
| 67 | + date_wrap_prefix + timeStr, | ||
| 68 | + date_wrap_format | ||
| 69 | + ); | ||
| 70 | + }; | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 点击班次html元素(dl),触发班次移动,如下: | ||
| 74 | + * 1、点击上行班次,下一个下行班次在下行班次列表中移到中间位置 | ||
| 75 | + * 2、点击下行班次,下一个上行班次在上行班次列表中移到中间位置 | ||
| 76 | + * @param ctrl 内部控制器 | ||
| 77 | + * @param index 班次索引 | ||
| 78 | + * @param isUp 是否上行 | ||
| 79 | + * @private | ||
| 80 | + */ | ||
| 81 | + var _fun_bcDDViewMove = function(ctrl, index, isUp) { | ||
| 82 | + // 获取当前点击班次对象 | ||
| 83 | + var oBc; | ||
| 84 | + if (isUp) { | ||
| 85 | + oBc = ctrl.internalBcModel.up_bc_list_asc[index]; | ||
| 86 | + } else { | ||
| 87 | + oBc = ctrl.internalBcModel.down_bc_list_asc[index]; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + // 找出车次链中的下一个班次索引,没有就undefined | ||
| 91 | + var nextIndex = undefined; | ||
| 92 | + var nextBlockBc = undefined; | ||
| 93 | + var currentBlockBcIndex = undefined; | ||
| 94 | + angular.forEach(ctrl.internalLpBlockModel[oBc.lpName], function(data, i) { | ||
| 95 | + if (data.fcsj == oBc.fcsj) { | ||
| 96 | + currentBlockBcIndex = i; | ||
| 97 | + } | ||
| 98 | + }); | ||
| 99 | + if (currentBlockBcIndex != undefined && | ||
| 100 | + currentBlockBcIndex < (ctrl.internalLpBlockModel[oBc.lpName].length - 1)) { | ||
| 101 | + nextBlockBc = ctrl.internalLpBlockModel[oBc.lpName][currentBlockBcIndex + 1]; | ||
| 102 | + nextIndex = nextBlockBc.index; | ||
| 103 | + } | ||
| 104 | + // 先删除click标记,再添加 | ||
| 105 | + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data) { | ||
| 106 | + delete data["isClick"]; | ||
| 107 | + }); | ||
| 108 | + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data) { | ||
| 109 | + delete data["isClick"]; | ||
| 110 | + }); | ||
| 111 | + oBc.isClick = true; | ||
| 112 | + if (nextIndex) { | ||
| 113 | + if (nextBlockBc.isUp) { | ||
| 114 | + ctrl.internalBcModel.up_bc_list_asc[nextIndex].isClick = true; | ||
| 115 | + } else { | ||
| 116 | + ctrl.internalBcModel.down_bc_list_asc[nextIndex].isClick = true; | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + // 移动,同方向不移动 | ||
| 121 | + var clientHeight = angular.element("#temp").height() - 34; | ||
| 122 | + if (nextBlockBc && isUp != nextBlockBc.isUp) { | ||
| 123 | + if (isUp) { // 移动下行 | ||
| 124 | + angular.element(".ttpv_table_scrollbar:eq(1)").animate( | ||
| 125 | + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400); | ||
| 126 | + } else { // 移动上行 | ||
| 127 | + angular.element(".ttpv_table_scrollbar:eq(0)").animate( | ||
| 128 | + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400); | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + }; | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * 刷新内部数据。 | ||
| 136 | + * @param ctrl 内部控制器对象($saTimeTablePreviewCtrl) | ||
| 137 | + * @private | ||
| 138 | + */ | ||
| 139 | + var _fun_refreshInternalModel = function(ctrl) { | ||
| 140 | + // 初始化内部数据 | ||
| 141 | + ctrl.internalBcModel = { | ||
| 142 | + up_qdz_name : "", // 上行起点站名字 | ||
| 143 | + up_zdz_name : "", // 上行终点站名字 | ||
| 144 | + down_qdz_name : "", // 下行起点站名字 | ||
| 145 | + down_zdz_name : "", // 下行终点站名字 | ||
| 146 | + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | ||
| 147 | + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | ||
| 148 | + }; | ||
| 149 | + ctrl.internalLpBlockModel = { | ||
| 150 | + | ||
| 151 | + }; | ||
| 152 | + | ||
| 153 | + // ngModel传入的数据 | ||
| 154 | + var dataSource = ctrl.ds.bcList; | ||
| 155 | + | ||
| 156 | + // 构造上下行班次列表,并确定上下行的首发站点 | ||
| 157 | + angular.forEach(dataSource, function(bcObj) { | ||
| 158 | + var _internalBcObj = {}; | ||
| 159 | + // 构造内部班次对象 | ||
| 160 | + _internalBcObj.lpName = bcObj.lp.lpName; // 路牌 | ||
| 161 | + _internalBcObj.fcsj = bcObj.fcsj; // 发车时间 | ||
| 162 | + _internalBcObj.ddsj = _fun_WrapTime(bcObj.fcsj).add(bcObj.bcsj, "m").format("HH:mm"); | ||
| 163 | + _internalBcObj.qdzName = bcObj.qdzName; // 起点站名字 | ||
| 164 | + _internalBcObj.zdzName = bcObj.zdzName; // 终点站名字 | ||
| 165 | + _internalBcObj.bcType = bcObj.bcType; // 班次类型 | ||
| 166 | + _internalBcObj.isTs = bcObj.isTS; // 是否停驶 | ||
| 167 | + _internalBcObj.isFb = bcObj.isFB; // 是否分班 | ||
| 168 | + _internalBcObj.remark = bcObj.remark; // 备注 | ||
| 169 | + _internalBcObj._fcno = bcObj.fcno; // 发车顺序号 | ||
| 170 | + | ||
| 171 | + if (bcObj.xlDir == "0") { // 上行 | ||
| 172 | + ctrl.internalBcModel.up_bc_list_asc.push(_internalBcObj); | ||
| 173 | + // 确定起点站 | ||
| 174 | + if (ctrl.internalBcModel.up_qdz_name == "") { | ||
| 175 | + if (bcObj.bcType == "normal") { | ||
| 176 | + ctrl.internalBcModel.up_qdz_name = bcObj.qdzName; | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + // 确定终点站 | ||
| 180 | + if (ctrl.internalBcModel.up_zdz_name == "") { | ||
| 181 | + if (bcObj.bcType == "normal") { | ||
| 182 | + ctrl.internalBcModel.up_zdz_name = bcObj.zdzName; | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + if (bcObj.xlDir == "1") { // 下行 | ||
| 187 | + ctrl.internalBcModel.down_bc_list_asc.push(_internalBcObj); | ||
| 188 | + // 确定起点站 | ||
| 189 | + if (ctrl.internalBcModel.down_qdz_name == "") { | ||
| 190 | + if (bcObj.bcType == "normal") { | ||
| 191 | + ctrl.internalBcModel.down_qdz_name = bcObj.qdzName; | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + // 确定终点站 | ||
| 195 | + if (ctrl.internalBcModel.down_zdz_name == "") { | ||
| 196 | + if (bcObj.bcType == "normal") { | ||
| 197 | + ctrl.internalBcModel.down_zdz_name = bcObj.zdzName; | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + }); | ||
| 203 | + | ||
| 204 | + // 发车时间升序排序上行班次 | ||
| 205 | + ctrl.internalBcModel.up_bc_list_asc.sort(function(a, b) { | ||
| 206 | + var a_wrapTime = _fun_WrapTime(a.fcsj); | ||
| 207 | + var b_wrapTime = _fun_WrapTime(b.fcsj); | ||
| 208 | + | ||
| 209 | + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | ||
| 210 | + // TODO:以后要配合首班车的发车时间判定 | ||
| 211 | + if (a.fcsj.indexOf("00:") == 0 || | ||
| 212 | + a.fcsj.indexOf("01:") == 0 || | ||
| 213 | + a.fcsj.indexOf("02:") == 0) { | ||
| 214 | + a_wrapTime.add(1, "day"); | ||
| 215 | + } | ||
| 216 | + if (b.fcsj.indexOf("00:") == 0 || | ||
| 217 | + b.fcsj.indexOf("01:") == 0 || | ||
| 218 | + b.fcsj.indexOf("02:") == 0) { | ||
| 219 | + b_wrapTime.add(1, "day"); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + if (a_wrapTime.isBefore(b_wrapTime)) { | ||
| 223 | + return -1; | ||
| 224 | + } else if (a_wrapTime.isAfter(b_wrapTime)) { | ||
| 225 | + return 1; | ||
| 226 | + } else { | ||
| 227 | + return 0; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + }); | ||
| 231 | + // 发车时间升序排序下行班次 | ||
| 232 | + ctrl.internalBcModel.down_bc_list_asc.sort(function(a, b) { | ||
| 233 | + var a_wrapTime = _fun_WrapTime(a.fcsj); | ||
| 234 | + var b_wrapTime = _fun_WrapTime(b.fcsj); | ||
| 235 | + | ||
| 236 | + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | ||
| 237 | + // TODO:以后要配合首班车的发车时间判定 | ||
| 238 | + if (a.fcsj.indexOf("00:") == 0 || | ||
| 239 | + a.fcsj.indexOf("01:") == 0 || | ||
| 240 | + a.fcsj.indexOf("02:") == 0) { | ||
| 241 | + a_wrapTime.add(1, "day"); | ||
| 242 | + } | ||
| 243 | + if (b.fcsj.indexOf("00:") == 0 || | ||
| 244 | + b.fcsj.indexOf("01:") == 0 || | ||
| 245 | + b.fcsj.indexOf("02:") == 0) { | ||
| 246 | + b_wrapTime.add(1, "day"); | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + if (a_wrapTime.isBefore(b_wrapTime)) { | ||
| 250 | + return -1; | ||
| 251 | + } else if (a_wrapTime.isAfter(b_wrapTime)) { | ||
| 252 | + return 1; | ||
| 253 | + } else { | ||
| 254 | + return 0; | ||
| 255 | + } | ||
| 256 | + }); | ||
| 257 | + | ||
| 258 | + // 构造路牌block车次链,按照发车顺序排序 | ||
| 259 | + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data, index) { | ||
| 260 | + if (!ctrl.internalLpBlockModel[data.lpName]) { | ||
| 261 | + ctrl.internalLpBlockModel[data.lpName] = []; | ||
| 262 | + } | ||
| 263 | + ctrl.internalLpBlockModel[data.lpName].push({ | ||
| 264 | + fcsj : data.fcsj, | ||
| 265 | + isUp : true, | ||
| 266 | + fcno : data._fcno, | ||
| 267 | + index : index | ||
| 268 | + }); | ||
| 269 | + }); | ||
| 270 | + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data, index) { | ||
| 271 | + if (!ctrl.internalLpBlockModel[data.lpName]) { | ||
| 272 | + ctrl.internalLpBlockModel[data.lpName] = []; | ||
| 273 | + } | ||
| 274 | + ctrl.internalLpBlockModel[data.lpName].push({ | ||
| 275 | + fcsj : data.fcsj, | ||
| 276 | + isUp : false, | ||
| 277 | + fcno : data._fcno, | ||
| 278 | + index : index | ||
| 279 | + }); | ||
| 280 | + }); | ||
| 281 | + angular.forEach(ctrl.internalLpBlockModel, function(value, key) { | ||
| 282 | + value.sort(function (a, b) { | ||
| 283 | + if (a.fcno < b.fcno) { | ||
| 284 | + return -1; | ||
| 285 | + } else if (a.fcno > b.fcno) { | ||
| 286 | + return 1; | ||
| 287 | + } else { | ||
| 288 | + return 0; | ||
| 289 | + } | ||
| 290 | + }); | ||
| 291 | + }); | ||
| 292 | + | ||
| 293 | + | ||
| 294 | + }; | ||
| 295 | + | ||
| 39 | return { | 296 | return { |
| 40 | pre : function(scope, element, attr) { | 297 | pre : function(scope, element, attr) { |
| 41 | // TODO: | 298 | // TODO: |
| 42 | }, | 299 | }, |
| 43 | post : function(scope, element, attr) { | 300 | post : function(scope, element, attr) { |
| 44 | - // TODO: | 301 | + // 班次html点击事件 |
| 302 | + scope[ctrlAs].$$bcDD_Click = function(index, xlDir) { | ||
| 303 | + _fun_bcDDViewMove(scope[ctrlAs], index, xlDir); | ||
| 304 | + }; | ||
| 45 | 305 | ||
| 306 | + // 监控ngModel绑定的外部数据源的刷新状态变化 | ||
| 307 | + scope.$watch( | ||
| 308 | + function() { | ||
| 309 | + return scope[ctrlAs].ds.refreshInfos; | ||
| 310 | + }, | ||
| 311 | + function(newValue, oldValue) { | ||
| 312 | + if (newValue === undefined && oldValue === undefined) { | ||
| 313 | + return; | ||
| 314 | + } | ||
| 315 | + console.log("saTimetable2 refresh"); | ||
| 316 | + _fun_refreshInternalModel(scope[ctrlAs]); | ||
| 317 | + }, | ||
| 318 | + true | ||
| 319 | + ); | ||
| 46 | } | 320 | } |
| 47 | }; | 321 | }; |
| 48 | } | 322 | } |
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreViewTemplate.html
| @@ -65,7 +65,7 @@ | @@ -65,7 +65,7 @@ | ||
| 65 | /** 表格样式 */ | 65 | /** 表格样式 */ |
| 66 | .ttpv_table { | 66 | .ttpv_table { |
| 67 | position: relative; | 67 | position: relative; |
| 68 | - padding-top: 30px; | 68 | + padding-top: 34px; |
| 69 | font-size: 13px; | 69 | font-size: 13px; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| @@ -74,7 +74,6 @@ | @@ -74,7 +74,6 @@ | ||
| 74 | /*width: 100%;*/ | 74 | /*width: 100%;*/ |
| 75 | margin: 0; | 75 | margin: 0; |
| 76 | /*border-bottom: 1px solid;*/ | 76 | /*border-bottom: 1px solid;*/ |
| 77 | - height: 30px; | ||
| 78 | cursor: default; | 77 | cursor: default; |
| 79 | } | 78 | } |
| 80 | .ttpv_table dl { | 79 | .ttpv_table dl { |
| @@ -91,7 +90,7 @@ | @@ -91,7 +90,7 @@ | ||
| 91 | overflow: hidden; | 90 | overflow: hidden; |
| 92 | text-overflow: ellipsis; | 91 | text-overflow: ellipsis; |
| 93 | height: 100%; | 92 | height: 100%; |
| 94 | - line-height: 30px; | 93 | + line-height: 34px; |
| 95 | border-right: 1px solid; | 94 | border-right: 1px solid; |
| 96 | text-indent: 5px; | 95 | text-indent: 5px; |
| 97 | } | 96 | } |
| @@ -100,37 +99,22 @@ | @@ -100,37 +99,22 @@ | ||
| 100 | font-size: 13px; | 99 | font-size: 13px; |
| 101 | /*border-bottom: 1px solid #dedede;*/ | 100 | /*border-bottom: 1px solid #dedede;*/ |
| 102 | border-top: 1px solid #dedede; | 101 | border-top: 1px solid #dedede; |
| 103 | - } | ||
| 104 | - | ||
| 105 | - .ttpv_table dl dt:nth-of-type(1), .ttpv_table dl dd:nth-of-type(1) { | ||
| 106 | - width: 50px; | ||
| 107 | - text-align: center; | ||
| 108 | - } | ||
| 109 | - .ttpv_table dl dt:nth-of-type(2), .ttpv_table dl dd:nth-of-type(2) { | ||
| 110 | - width: 80px; | ||
| 111 | - text-align: center; | ||
| 112 | - } | ||
| 113 | - .ttpv_table dl dt:nth-of-type(3), .ttpv_table dl dd:nth-of-type(3) { | ||
| 114 | - width: 120px; | ||
| 115 | - text-align: left; | ||
| 116 | - } | ||
| 117 | - .ttpv_table dl dt:nth-of-type(4), .ttpv_table dl dd:nth-of-type(4) { | ||
| 118 | - width: 220px; | ||
| 119 | text-align: center; | 102 | text-align: center; |
| 120 | } | 103 | } |
| 121 | 104 | ||
| 122 | .ttpv_table > .ttpv_table_head { | 105 | .ttpv_table > .ttpv_table_head { |
| 123 | position: absolute; | 106 | position: absolute; |
| 124 | top: 0; | 107 | top: 0; |
| 125 | - height: 30px; | 108 | + height: 34px; |
| 126 | background: #f5f5f5; | 109 | background: #f5f5f5; |
| 127 | /*width: 100%;*/ | 110 | /*width: 100%;*/ |
| 128 | - line-height: 30px; | 111 | + line-height: 34px; |
| 129 | z-index: 1; | 112 | z-index: 1; |
| 130 | } | 113 | } |
| 131 | .ttpv_table_head dl { | 114 | .ttpv_table_head dl { |
| 132 | border-bottom: 2px solid #96b9d7; | 115 | border-bottom: 2px solid #96b9d7; |
| 133 | color: #333333; | 116 | color: #333333; |
| 117 | + height: 34px; | ||
| 134 | background-color: #f5f5f5; | 118 | background-color: #f5f5f5; |
| 135 | } | 119 | } |
| 136 | .ttpv_table_head dl dt { | 120 | .ttpv_table_head dl dt { |
| @@ -138,6 +122,27 @@ | @@ -138,6 +122,27 @@ | ||
| 138 | font-size: 12px; | 122 | font-size: 12px; |
| 139 | } | 123 | } |
| 140 | 124 | ||
| 125 | + .ttpv_table_head dl dt:nth-of-type(1) { | ||
| 126 | + width: 50px; | ||
| 127 | + height: 34px; | ||
| 128 | + } | ||
| 129 | + .ttpv_table_head dl dt:nth-of-type(2) { | ||
| 130 | + width: 55px; | ||
| 131 | + height: 34px; | ||
| 132 | + } | ||
| 133 | + .ttpv_table_head dl dt:nth-of-type(3) { | ||
| 134 | + width: 120px; | ||
| 135 | + height: 34px; | ||
| 136 | + } | ||
| 137 | + .ttpv_table_head dl dt:nth-of-type(4) { | ||
| 138 | + width: 100px; | ||
| 139 | + height: 34px; | ||
| 140 | + } | ||
| 141 | + .ttpv_table_head dl dt:nth-of-type(5) { | ||
| 142 | + width: 200px; | ||
| 143 | + height: 34px; | ||
| 144 | + } | ||
| 145 | + | ||
| 141 | .ttpv_table > .ttpv_table_body { | 146 | .ttpv_table > .ttpv_table_body { |
| 142 | /*width: 100%;*/ | 147 | /*width: 100%;*/ |
| 143 | position: absolute; | 148 | position: absolute; |
| @@ -157,12 +162,43 @@ | @@ -157,12 +162,43 @@ | ||
| 157 | color: #501a1a !important; | 162 | color: #501a1a !important; |
| 158 | } | 163 | } |
| 159 | 164 | ||
| 165 | + .ttpv_table_body dd.istsClick { | ||
| 166 | + background: linear-gradient(to right,#8baabf,#105383,#808086)!important; | ||
| 167 | + } | ||
| 168 | + .ttpv_table_body dd.regionClick { | ||
| 169 | + background: linear-gradient(to right,#8baabf,#686d7b,#a09997)!important; | ||
| 170 | + } | ||
| 171 | + .ttpv_table_body dd.isfbClick { | ||
| 172 | + background: linear-gradient(to right,#8baabf,#adff00,#a09997)!important; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + .ttpv_table_body dl dd:nth-of-type(1) { | ||
| 176 | + width: 50px; | ||
| 177 | + height: 30px; | ||
| 178 | + } | ||
| 179 | + .ttpv_table_body dl dd:nth-of-type(2) { | ||
| 180 | + width: 55px; | ||
| 181 | + height: 30px; | ||
| 182 | + } | ||
| 183 | + .ttpv_table_body dl dd:nth-of-type(3) { | ||
| 184 | + width: 120px; | ||
| 185 | + height: 30px; | ||
| 186 | + text-align: left; | ||
| 187 | + } | ||
| 188 | + .ttpv_table_body dl dd:nth-of-type(4) { | ||
| 189 | + width: 100px; | ||
| 190 | + height: 30px; | ||
| 191 | + } | ||
| 192 | + .ttpv_table_body dl dd:nth-of-type(5) { | ||
| 193 | + width: 200px; | ||
| 194 | + height: 30px; | ||
| 195 | + } | ||
| 196 | + | ||
| 160 | .ttpv_table_body dd:nth-of-type(1) { | 197 | .ttpv_table_body dd:nth-of-type(1) { |
| 161 | color: #2765A7; | 198 | color: #2765A7; |
| 162 | background: #eae8e8; | 199 | background: #eae8e8; |
| 163 | /*border-bottom: 1px solid #b3b3b3;*/ | 200 | /*border-bottom: 1px solid #b3b3b3;*/ |
| 164 | border-right: 1px solid #b3b3b3; | 201 | border-right: 1px solid #b3b3b3; |
| 165 | - text-align: center; | ||
| 166 | text-indent: -3px; | 202 | text-indent: -3px; |
| 167 | } | 203 | } |
| 168 | .ttpv_table_body dd:nth-of-type(n + 2) { | 204 | .ttpv_table_body dd:nth-of-type(n + 2) { |
| @@ -177,6 +213,11 @@ | @@ -177,6 +213,11 @@ | ||
| 177 | background: linear-gradient(to right, #fafafa, #f5fbff); | 213 | background: linear-gradient(to right, #fafafa, #f5fbff); |
| 178 | } | 214 | } |
| 179 | 215 | ||
| 216 | + .isClick { | ||
| 217 | + background: #8baabf!important; | ||
| 218 | + color: #fff!important; | ||
| 219 | + } | ||
| 220 | + | ||
| 180 | </style> | 221 | </style> |
| 181 | 222 | ||
| 182 | <style> | 223 | <style> |
| @@ -214,9 +255,12 @@ | @@ -214,9 +255,12 @@ | ||
| 214 | <div class="detail-panel"> | 255 | <div class="detail-panel"> |
| 215 | <div class="detail-wrap" > | 256 | <div class="detail-wrap" > |
| 216 | <h3 class="detail-title"> | 257 | <h3 class="detail-title"> |
| 217 | - 上行起始站点:{{$saTimeTablePreviewCtrl.ds.up_qdz_name}} | 258 | + 上行: |
| 259 | + {{$saTimeTablePreviewCtrl.internalBcModel.up_qdz_name}} | ||
| 260 | + <i class="fa fa-angle-double-right" aria-hidden="true"></i> | ||
| 261 | + {{$saTimeTablePreviewCtrl.internalBcModel.up_zdz_name}} | ||
| 218 | </h3> | 262 | </h3> |
| 219 | - <div class="detail-body"> | 263 | + <div id="temp" class="detail-body"> |
| 220 | <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".upFixHead"> | 264 | <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".upFixHead"> |
| 221 | <div class="ttpv_table"> | 265 | <div class="ttpv_table"> |
| 222 | <div class="ttpv_table_head upFixHead"> | 266 | <div class="ttpv_table_head upFixHead"> |
| @@ -224,14 +268,25 @@ | @@ -224,14 +268,25 @@ | ||
| 224 | <dt>序号</dt> | 268 | <dt>序号</dt> |
| 225 | <dt>路牌</dt> | 269 | <dt>路牌</dt> |
| 226 | <dt>发车时间</dt> | 270 | <dt>发车时间</dt> |
| 271 | + <dt>到达时间</dt> | ||
| 227 | <dt>备注</dt> | 272 | <dt>备注</dt> |
| 228 | </dl> | 273 | </dl> |
| 229 | </div> | 274 | </div> |
| 230 | <div class="ttpv_table_body"> | 275 | <div class="ttpv_table_body"> |
| 231 | - <dl ng-repeat="bc in $saTimeTablePreviewCtrl.ds.up_bc_list_asc track by $index"> | 276 | + <dl ng-repeat="bc in $saTimeTablePreviewCtrl.internalBcModel.up_bc_list_asc track by $index" |
| 277 | + ng-click="$saTimeTablePreviewCtrl.$$bcDD_Click($index, true)"> | ||
| 232 | <dd>{{$index + 1}}</dd> | 278 | <dd>{{$index + 1}}</dd> |
| 233 | - <dd>{{bc.lp.lpName}}</dd> | ||
| 234 | - <dd ng-class="{ists: bc.isTS, region: bc.bcType == 'region', isfb: bc.isFB}"> | 279 | + <dd ng-class="{isClick : bc.isClick}"> |
| 280 | + {{bc.lpName}} | ||
| 281 | + </dd> | ||
| 282 | + <dd ng-class="{ | ||
| 283 | + ists: (bc.isTs && !bc.isClick), | ||
| 284 | + istsClick: (bc.isTs && bc.isClick), | ||
| 285 | + region: (bc.bcType == 'region' && !bc.isClick), | ||
| 286 | + regionClick : (bc.bcType == 'region' && bc.isClick), | ||
| 287 | + isfb: (bc.isFb && !bc.isClick), | ||
| 288 | + isfbClick : (bc.isFb && bc.isClick), | ||
| 289 | + isClick: bc.isClick}"> | ||
| 235 | {{bc.fcsj}} | 290 | {{bc.fcsj}} |
| 236 | <span class="badge" | 291 | <span class="badge" |
| 237 | style="border-radius: 2px !important; background-color: #f9a124;" | 292 | style="border-radius: 2px !important; background-color: #f9a124;" |
| @@ -240,7 +295,10 @@ | @@ -240,7 +295,10 @@ | ||
| 240 | style="border-radius: 2px !important; background-color: #f9a124;" | 295 | style="border-radius: 2px !important; background-color: #f9a124;" |
| 241 | ng-show="bc.bcType == 'in'">进场</span> | 296 | ng-show="bc.bcType == 'in'">进场</span> |
| 242 | </dd> | 297 | </dd> |
| 243 | - <dd>{{bc.remark}}</dd> | 298 | + <dd ng-class="{isClick : bc.isClick}"> |
| 299 | + {{bc.ddsj}} | ||
| 300 | + </dd> | ||
| 301 | + <dd ng-class="{isClick : bc.isClick}">{{bc.remark}}</dd> | ||
| 244 | </dl> | 302 | </dl> |
| 245 | </div> | 303 | </div> |
| 246 | </div> | 304 | </div> |
| @@ -254,7 +312,10 @@ | @@ -254,7 +312,10 @@ | ||
| 254 | <div class="detail-panel"> | 312 | <div class="detail-panel"> |
| 255 | <div class="detail-wrap" > | 313 | <div class="detail-wrap" > |
| 256 | <h3 class="detail-title"> | 314 | <h3 class="detail-title"> |
| 257 | - 下行起始站点:{{$saTimeTablePreviewCtrl.ds.down_qdz_name}} | 315 | + 下行: |
| 316 | + {{$saTimeTablePreviewCtrl.internalBcModel.down_qdz_name}} | ||
| 317 | + <i class="fa fa-angle-double-right" aria-hidden="true"></i> | ||
| 318 | + {{$saTimeTablePreviewCtrl.internalBcModel.down_zdz_name}} | ||
| 258 | </h3> | 319 | </h3> |
| 259 | <div class="detail-body"> | 320 | <div class="detail-body"> |
| 260 | <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".downFixHead"> | 321 | <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".downFixHead"> |
| @@ -264,14 +325,25 @@ | @@ -264,14 +325,25 @@ | ||
| 264 | <dt>序号</dt> | 325 | <dt>序号</dt> |
| 265 | <dt>路牌</dt> | 326 | <dt>路牌</dt> |
| 266 | <dt>发车时间</dt> | 327 | <dt>发车时间</dt> |
| 328 | + <dt>到达时间</dt> | ||
| 267 | <dt>备注</dt> | 329 | <dt>备注</dt> |
| 268 | </dl> | 330 | </dl> |
| 269 | </div> | 331 | </div> |
| 270 | <div class="ttpv_table_body"> | 332 | <div class="ttpv_table_body"> |
| 271 | - <dl ng-repeat="bc in $saTimeTablePreviewCtrl.ds.down_bc_list_asc track by $index"> | 333 | + <dl ng-repeat="bc in $saTimeTablePreviewCtrl.internalBcModel.down_bc_list_asc track by $index" |
| 334 | + ng-click="$saTimeTablePreviewCtrl.$$bcDD_Click($index, false)"> | ||
| 272 | <dd>{{$index + 1}}</dd> | 335 | <dd>{{$index + 1}}</dd> |
| 273 | - <dd>{{bc.lp.lpName}}</dd> | ||
| 274 | - <dd ng-class="{ists: bc.isTS, region: bc.bcType == 'region', isfb: bc.isFB}"> | 336 | + <dd ng-class="{isClick : bc.isClick}"> |
| 337 | + {{bc.lpName}} | ||
| 338 | + </dd> | ||
| 339 | + <dd ng-class="{ | ||
| 340 | + ists: (bc.isTs && !bc.isClick), | ||
| 341 | + istsClick: (bc.isTs && bc.isClick), | ||
| 342 | + region: (bc.bcType == 'region' && !bc.isClick), | ||
| 343 | + regionClick : (bc.bcType == 'region' && bc.isClick), | ||
| 344 | + isfb: (bc.isFb && !bc.isClick), | ||
| 345 | + isfbClick : (bc.isFb && bc.isClick), | ||
| 346 | + isClick: bc.isClick}"> | ||
| 275 | {{bc.fcsj}} | 347 | {{bc.fcsj}} |
| 276 | <span class="badge" | 348 | <span class="badge" |
| 277 | style="border-radius: 2px !important; background-color: #f9a124;" | 349 | style="border-radius: 2px !important; background-color: #f9a124;" |
| @@ -280,7 +352,10 @@ | @@ -280,7 +352,10 @@ | ||
| 280 | style="border-radius: 2px !important; background-color: #f9a124;" | 352 | style="border-radius: 2px !important; background-color: #f9a124;" |
| 281 | ng-show="bc.bcType == 'in'">进场</span> | 353 | ng-show="bc.bcType == 'in'">进场</span> |
| 282 | </dd> | 354 | </dd> |
| 283 | - <dd>{{bc.remark}}</dd> | 355 | + <dd ng-class="{isClick : bc.isClick}"> |
| 356 | + {{bc.ddsj}} | ||
| 357 | + </dd> | ||
| 358 | + <dd ng-class="{isClick : bc.isClick}">{{bc.remark}}</dd> | ||
| 284 | </dl> | 359 | </dl> |
| 285 | </div> | 360 | </div> |
| 286 | </div> | 361 | </div> |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
| @@ -4427,6 +4427,21 @@ angular.module("ScheduleApp").directive( | @@ -4427,6 +4427,21 @@ angular.module("ScheduleApp").directive( | ||
| 4427 | controller : function() { | 4427 | controller : function() { |
| 4428 | var self = this; | 4428 | var self = this; |
| 4429 | 4429 | ||
| 4430 | + // 内部班次时刻模型 | ||
| 4431 | + self.internalBcModel = { | ||
| 4432 | + up_qdz_name : "", // 上行起点站名字 | ||
| 4433 | + down_qdz_name : "", // 下行起点站名字 | ||
| 4434 | + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | ||
| 4435 | + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | ||
| 4436 | + }; | ||
| 4437 | + | ||
| 4438 | + // 内部各个路牌block车次链模型 | ||
| 4439 | + self.internalLpBlockModel = { | ||
| 4440 | + // key:路牌名字 | ||
| 4441 | + // value: 数组(按照发车时间排序) | ||
| 4442 | + // value 数据内对象 {fcsj:发车时间,isUp:是否上行,fcno:发车顺序号,index:对应的班次列表索引} | ||
| 4443 | + }; | ||
| 4444 | + | ||
| 4430 | // TODO: | 4445 | // TODO: |
| 4431 | }, | 4446 | }, |
| 4432 | 4447 | ||
| @@ -4443,15 +4458,274 @@ angular.module("ScheduleApp").directive( | @@ -4443,15 +4458,274 @@ angular.module("ScheduleApp").directive( | ||
| 4443 | throw new Error("saTimeTablePreview指令 name属性required"); | 4458 | throw new Error("saTimeTablePreview指令 name属性required"); |
| 4444 | } | 4459 | } |
| 4445 | 4460 | ||
| 4461 | + // 内部controlAs名字 | ||
| 4462 | + var ctrlAs = "$saTimeTablePreviewCtrl"; | ||
| 4463 | + | ||
| 4446 | // TODO: | 4464 | // TODO: |
| 4447 | 4465 | ||
| 4466 | + //------------------ 内部方法 --------------------// | ||
| 4467 | + var date_wrap_prefix = "2000-01-01 "; // 包装日期的前缀 | ||
| 4468 | + var date_wrap_format = "YYYY-MM-DD HH:mm"; // 日期格式 | ||
| 4469 | + /** | ||
| 4470 | + * 将时间包装成日期,方便计算。 | ||
| 4471 | + * @param timeStr 时间格式,如 06:30 | ||
| 4472 | + * @returns moment对象 | ||
| 4473 | + */ | ||
| 4474 | + var _fun_WrapTime = function(timeStr) { | ||
| 4475 | + return moment( | ||
| 4476 | + date_wrap_prefix + timeStr, | ||
| 4477 | + date_wrap_format | ||
| 4478 | + ); | ||
| 4479 | + }; | ||
| 4480 | + | ||
| 4481 | + /** | ||
| 4482 | + * 点击班次html元素(dl),触发班次移动,如下: | ||
| 4483 | + * 1、点击上行班次,下一个下行班次在下行班次列表中移到中间位置 | ||
| 4484 | + * 2、点击下行班次,下一个上行班次在上行班次列表中移到中间位置 | ||
| 4485 | + * @param ctrl 内部控制器 | ||
| 4486 | + * @param index 班次索引 | ||
| 4487 | + * @param isUp 是否上行 | ||
| 4488 | + * @private | ||
| 4489 | + */ | ||
| 4490 | + var _fun_bcDDViewMove = function(ctrl, index, isUp) { | ||
| 4491 | + // 获取当前点击班次对象 | ||
| 4492 | + var oBc; | ||
| 4493 | + if (isUp) { | ||
| 4494 | + oBc = ctrl.internalBcModel.up_bc_list_asc[index]; | ||
| 4495 | + } else { | ||
| 4496 | + oBc = ctrl.internalBcModel.down_bc_list_asc[index]; | ||
| 4497 | + } | ||
| 4498 | + | ||
| 4499 | + // 找出车次链中的下一个班次索引,没有就undefined | ||
| 4500 | + var nextIndex = undefined; | ||
| 4501 | + var nextBlockBc = undefined; | ||
| 4502 | + var currentBlockBcIndex = undefined; | ||
| 4503 | + angular.forEach(ctrl.internalLpBlockModel[oBc.lpName], function(data, i) { | ||
| 4504 | + if (data.fcsj == oBc.fcsj) { | ||
| 4505 | + currentBlockBcIndex = i; | ||
| 4506 | + } | ||
| 4507 | + }); | ||
| 4508 | + if (currentBlockBcIndex != undefined && | ||
| 4509 | + currentBlockBcIndex < (ctrl.internalLpBlockModel[oBc.lpName].length - 1)) { | ||
| 4510 | + nextBlockBc = ctrl.internalLpBlockModel[oBc.lpName][currentBlockBcIndex + 1]; | ||
| 4511 | + nextIndex = nextBlockBc.index; | ||
| 4512 | + } | ||
| 4513 | + // 先删除click标记,再添加 | ||
| 4514 | + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data) { | ||
| 4515 | + delete data["isClick"]; | ||
| 4516 | + }); | ||
| 4517 | + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data) { | ||
| 4518 | + delete data["isClick"]; | ||
| 4519 | + }); | ||
| 4520 | + oBc.isClick = true; | ||
| 4521 | + if (nextIndex) { | ||
| 4522 | + if (nextBlockBc.isUp) { | ||
| 4523 | + ctrl.internalBcModel.up_bc_list_asc[nextIndex].isClick = true; | ||
| 4524 | + } else { | ||
| 4525 | + ctrl.internalBcModel.down_bc_list_asc[nextIndex].isClick = true; | ||
| 4526 | + } | ||
| 4527 | + } | ||
| 4528 | + | ||
| 4529 | + // 移动,同方向不移动 | ||
| 4530 | + var clientHeight = angular.element("#temp").height() - 34; | ||
| 4531 | + if (nextBlockBc && isUp != nextBlockBc.isUp) { | ||
| 4532 | + if (isUp) { // 移动下行 | ||
| 4533 | + angular.element(".ttpv_table_scrollbar:eq(1)").animate( | ||
| 4534 | + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400); | ||
| 4535 | + } else { // 移动上行 | ||
| 4536 | + angular.element(".ttpv_table_scrollbar:eq(0)").animate( | ||
| 4537 | + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400); | ||
| 4538 | + } | ||
| 4539 | + } | ||
| 4540 | + | ||
| 4541 | + }; | ||
| 4542 | + | ||
| 4543 | + /** | ||
| 4544 | + * 刷新内部数据。 | ||
| 4545 | + * @param ctrl 内部控制器对象($saTimeTablePreviewCtrl) | ||
| 4546 | + * @private | ||
| 4547 | + */ | ||
| 4548 | + var _fun_refreshInternalModel = function(ctrl) { | ||
| 4549 | + // 初始化内部数据 | ||
| 4550 | + ctrl.internalBcModel = { | ||
| 4551 | + up_qdz_name : "", // 上行起点站名字 | ||
| 4552 | + up_zdz_name : "", // 上行终点站名字 | ||
| 4553 | + down_qdz_name : "", // 下行起点站名字 | ||
| 4554 | + down_zdz_name : "", // 下行终点站名字 | ||
| 4555 | + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | ||
| 4556 | + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | ||
| 4557 | + }; | ||
| 4558 | + ctrl.internalLpBlockModel = { | ||
| 4559 | + | ||
| 4560 | + }; | ||
| 4561 | + | ||
| 4562 | + // ngModel传入的数据 | ||
| 4563 | + var dataSource = ctrl.ds.bcList; | ||
| 4564 | + | ||
| 4565 | + // 构造上下行班次列表,并确定上下行的首发站点 | ||
| 4566 | + angular.forEach(dataSource, function(bcObj) { | ||
| 4567 | + var _internalBcObj = {}; | ||
| 4568 | + // 构造内部班次对象 | ||
| 4569 | + _internalBcObj.lpName = bcObj.lp.lpName; // 路牌 | ||
| 4570 | + _internalBcObj.fcsj = bcObj.fcsj; // 发车时间 | ||
| 4571 | + _internalBcObj.ddsj = _fun_WrapTime(bcObj.fcsj).add(bcObj.bcsj, "m").format("HH:mm"); | ||
| 4572 | + _internalBcObj.qdzName = bcObj.qdzName; // 起点站名字 | ||
| 4573 | + _internalBcObj.zdzName = bcObj.zdzName; // 终点站名字 | ||
| 4574 | + _internalBcObj.bcType = bcObj.bcType; // 班次类型 | ||
| 4575 | + _internalBcObj.isTs = bcObj.isTS; // 是否停驶 | ||
| 4576 | + _internalBcObj.isFb = bcObj.isFB; // 是否分班 | ||
| 4577 | + _internalBcObj.remark = bcObj.remark; // 备注 | ||
| 4578 | + _internalBcObj._fcno = bcObj.fcno; // 发车顺序号 | ||
| 4579 | + | ||
| 4580 | + if (bcObj.xlDir == "0") { // 上行 | ||
| 4581 | + ctrl.internalBcModel.up_bc_list_asc.push(_internalBcObj); | ||
| 4582 | + // 确定起点站 | ||
| 4583 | + if (ctrl.internalBcModel.up_qdz_name == "") { | ||
| 4584 | + if (bcObj.bcType == "normal") { | ||
| 4585 | + ctrl.internalBcModel.up_qdz_name = bcObj.qdzName; | ||
| 4586 | + } | ||
| 4587 | + } | ||
| 4588 | + // 确定终点站 | ||
| 4589 | + if (ctrl.internalBcModel.up_zdz_name == "") { | ||
| 4590 | + if (bcObj.bcType == "normal") { | ||
| 4591 | + ctrl.internalBcModel.up_zdz_name = bcObj.zdzName; | ||
| 4592 | + } | ||
| 4593 | + } | ||
| 4594 | + } | ||
| 4595 | + if (bcObj.xlDir == "1") { // 下行 | ||
| 4596 | + ctrl.internalBcModel.down_bc_list_asc.push(_internalBcObj); | ||
| 4597 | + // 确定起点站 | ||
| 4598 | + if (ctrl.internalBcModel.down_qdz_name == "") { | ||
| 4599 | + if (bcObj.bcType == "normal") { | ||
| 4600 | + ctrl.internalBcModel.down_qdz_name = bcObj.qdzName; | ||
| 4601 | + } | ||
| 4602 | + } | ||
| 4603 | + // 确定终点站 | ||
| 4604 | + if (ctrl.internalBcModel.down_zdz_name == "") { | ||
| 4605 | + if (bcObj.bcType == "normal") { | ||
| 4606 | + ctrl.internalBcModel.down_zdz_name = bcObj.zdzName; | ||
| 4607 | + } | ||
| 4608 | + } | ||
| 4609 | + } | ||
| 4610 | + | ||
| 4611 | + }); | ||
| 4612 | + | ||
| 4613 | + // 发车时间升序排序上行班次 | ||
| 4614 | + ctrl.internalBcModel.up_bc_list_asc.sort(function(a, b) { | ||
| 4615 | + var a_wrapTime = _fun_WrapTime(a.fcsj); | ||
| 4616 | + var b_wrapTime = _fun_WrapTime(b.fcsj); | ||
| 4617 | + | ||
| 4618 | + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | ||
| 4619 | + // TODO:以后要配合首班车的发车时间判定 | ||
| 4620 | + if (a.fcsj.indexOf("00:") == 0 || | ||
| 4621 | + a.fcsj.indexOf("01:") == 0 || | ||
| 4622 | + a.fcsj.indexOf("02:") == 0) { | ||
| 4623 | + a_wrapTime.add(1, "day"); | ||
| 4624 | + } | ||
| 4625 | + if (b.fcsj.indexOf("00:") == 0 || | ||
| 4626 | + b.fcsj.indexOf("01:") == 0 || | ||
| 4627 | + b.fcsj.indexOf("02:") == 0) { | ||
| 4628 | + b_wrapTime.add(1, "day"); | ||
| 4629 | + } | ||
| 4630 | + | ||
| 4631 | + if (a_wrapTime.isBefore(b_wrapTime)) { | ||
| 4632 | + return -1; | ||
| 4633 | + } else if (a_wrapTime.isAfter(b_wrapTime)) { | ||
| 4634 | + return 1; | ||
| 4635 | + } else { | ||
| 4636 | + return 0; | ||
| 4637 | + } | ||
| 4638 | + | ||
| 4639 | + }); | ||
| 4640 | + // 发车时间升序排序下行班次 | ||
| 4641 | + ctrl.internalBcModel.down_bc_list_asc.sort(function(a, b) { | ||
| 4642 | + var a_wrapTime = _fun_WrapTime(a.fcsj); | ||
| 4643 | + var b_wrapTime = _fun_WrapTime(b.fcsj); | ||
| 4644 | + | ||
| 4645 | + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | ||
| 4646 | + // TODO:以后要配合首班车的发车时间判定 | ||
| 4647 | + if (a.fcsj.indexOf("00:") == 0 || | ||
| 4648 | + a.fcsj.indexOf("01:") == 0 || | ||
| 4649 | + a.fcsj.indexOf("02:") == 0) { | ||
| 4650 | + a_wrapTime.add(1, "day"); | ||
| 4651 | + } | ||
| 4652 | + if (b.fcsj.indexOf("00:") == 0 || | ||
| 4653 | + b.fcsj.indexOf("01:") == 0 || | ||
| 4654 | + b.fcsj.indexOf("02:") == 0) { | ||
| 4655 | + b_wrapTime.add(1, "day"); | ||
| 4656 | + } | ||
| 4657 | + | ||
| 4658 | + if (a_wrapTime.isBefore(b_wrapTime)) { | ||
| 4659 | + return -1; | ||
| 4660 | + } else if (a_wrapTime.isAfter(b_wrapTime)) { | ||
| 4661 | + return 1; | ||
| 4662 | + } else { | ||
| 4663 | + return 0; | ||
| 4664 | + } | ||
| 4665 | + }); | ||
| 4666 | + | ||
| 4667 | + // 构造路牌block车次链,按照发车顺序排序 | ||
| 4668 | + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data, index) { | ||
| 4669 | + if (!ctrl.internalLpBlockModel[data.lpName]) { | ||
| 4670 | + ctrl.internalLpBlockModel[data.lpName] = []; | ||
| 4671 | + } | ||
| 4672 | + ctrl.internalLpBlockModel[data.lpName].push({ | ||
| 4673 | + fcsj : data.fcsj, | ||
| 4674 | + isUp : true, | ||
| 4675 | + fcno : data._fcno, | ||
| 4676 | + index : index | ||
| 4677 | + }); | ||
| 4678 | + }); | ||
| 4679 | + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data, index) { | ||
| 4680 | + if (!ctrl.internalLpBlockModel[data.lpName]) { | ||
| 4681 | + ctrl.internalLpBlockModel[data.lpName] = []; | ||
| 4682 | + } | ||
| 4683 | + ctrl.internalLpBlockModel[data.lpName].push({ | ||
| 4684 | + fcsj : data.fcsj, | ||
| 4685 | + isUp : false, | ||
| 4686 | + fcno : data._fcno, | ||
| 4687 | + index : index | ||
| 4688 | + }); | ||
| 4689 | + }); | ||
| 4690 | + angular.forEach(ctrl.internalLpBlockModel, function(value, key) { | ||
| 4691 | + value.sort(function (a, b) { | ||
| 4692 | + if (a.fcno < b.fcno) { | ||
| 4693 | + return -1; | ||
| 4694 | + } else if (a.fcno > b.fcno) { | ||
| 4695 | + return 1; | ||
| 4696 | + } else { | ||
| 4697 | + return 0; | ||
| 4698 | + } | ||
| 4699 | + }); | ||
| 4700 | + }); | ||
| 4701 | + | ||
| 4702 | + | ||
| 4703 | + }; | ||
| 4704 | + | ||
| 4448 | return { | 4705 | return { |
| 4449 | pre : function(scope, element, attr) { | 4706 | pre : function(scope, element, attr) { |
| 4450 | // TODO: | 4707 | // TODO: |
| 4451 | }, | 4708 | }, |
| 4452 | post : function(scope, element, attr) { | 4709 | post : function(scope, element, attr) { |
| 4453 | - // TODO: | 4710 | + // 班次html点击事件 |
| 4711 | + scope[ctrlAs].$$bcDD_Click = function(index, xlDir) { | ||
| 4712 | + _fun_bcDDViewMove(scope[ctrlAs], index, xlDir); | ||
| 4713 | + }; | ||
| 4454 | 4714 | ||
| 4715 | + // 监控ngModel绑定的外部数据源的刷新状态变化 | ||
| 4716 | + scope.$watch( | ||
| 4717 | + function() { | ||
| 4718 | + return scope[ctrlAs].ds.refreshInfos; | ||
| 4719 | + }, | ||
| 4720 | + function(newValue, oldValue) { | ||
| 4721 | + if (newValue === undefined && oldValue === undefined) { | ||
| 4722 | + return; | ||
| 4723 | + } | ||
| 4724 | + console.log("saTimetable2 refresh"); | ||
| 4725 | + _fun_refreshInternalModel(scope[ctrlAs]); | ||
| 4726 | + }, | ||
| 4727 | + true | ||
| 4728 | + ); | ||
| 4455 | } | 4729 | } |
| 4456 | }; | 4730 | }; |
| 4457 | } | 4731 | } |
| @@ -4547,177 +4821,177 @@ angular.module('ScheduleApp').directive( | @@ -4547,177 +4821,177 @@ angular.module('ScheduleApp').directive( | ||
| 4547 | } | 4821 | } |
| 4548 | ] | 4822 | ] |
| 4549 | ); | 4823 | ); |
| 4550 | -/** | ||
| 4551 | - * saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的) | ||
| 4552 | - * 属性如下: | ||
| 4553 | - * name(必须):控件的名字 | ||
| 4554 | - * columns(必须,独立作用域):字段名字列表,格式:[{name:[字段名],desc:[字段描述]}...] | ||
| 4555 | - * ordercolumns(必须,独立作用域):字段排序列表,格式:{order: '字段1,字段2',direction: 'ASC,DESC'} | ||
| 4556 | - */ | ||
| 4557 | -angular.module('ScheduleApp').directive( | ||
| 4558 | - 'saOrderoption', | ||
| 4559 | - [ | ||
| 4560 | - function() { | ||
| 4561 | - return { | ||
| 4562 | - restrict: 'E', | ||
| 4563 | - templateUrl: '/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html', | ||
| 4564 | - scope: { | ||
| 4565 | - columns: '=', | ||
| 4566 | - ordercolumns: '=' | ||
| 4567 | - }, | ||
| 4568 | - controllerAs: '$saOrderOptionCtrl', | ||
| 4569 | - bindToController: true, | ||
| 4570 | - controller: function() { | ||
| 4571 | - var self = this; | ||
| 4572 | - | ||
| 4573 | - // 字段列表是否预载入 | ||
| 4574 | - self.$$columns_loaded = false; | ||
| 4575 | - // 字段排序是否预载入 | ||
| 4576 | - self.$$ordercolumns_loaded = false; | ||
| 4577 | - | ||
| 4578 | - | ||
| 4579 | - // 每组选项内部数据源 | ||
| 4580 | - // 格式:[{column:[选中的字段名],dir:[ASC/DESC]}] | ||
| 4581 | - self.$$selectgroupds = []; | ||
| 4582 | - | ||
| 4583 | - // TODO:选择事件 | ||
| 4584 | - | ||
| 4585 | - self.$$select_column_change = function() { | ||
| 4586 | - self.$$refresh_selectgroupds(); | ||
| 4587 | - }; | ||
| 4588 | - | ||
| 4589 | - self.$$select_dir_change = function() { | ||
| 4590 | - self.$$refresh_selectgroupds(); | ||
| 4591 | - }; | ||
| 4592 | - | ||
| 4593 | - self.$$add_option_click = function(index) { | ||
| 4594 | - self.$$selectgroupds.splice(index, 0, { | ||
| 4595 | - column: self.columns[0].name, | ||
| 4596 | - dir: "ASC" | ||
| 4597 | - }); | ||
| 4598 | - self.$$refresh_selectgroupds(); | ||
| 4599 | - }; | ||
| 4600 | - self.$$del_option_click = function(index) { | ||
| 4601 | - self.$$selectgroupds.splice(index, 1); | ||
| 4602 | - self.$$refresh_selectgroupds(); | ||
| 4603 | - }; | ||
| 4604 | - | ||
| 4605 | - // 刷新选项内部数据源 | ||
| 4606 | - self.$$refresh_selectgroupds = function() { | ||
| 4607 | - if (!self.$$columns_loaded || !self.$$ordercolumns_loaded || self.columns.length == 0) { | ||
| 4608 | - // 没有载入完成,或者字段列表为空 | ||
| 4609 | - return; | ||
| 4610 | - } | ||
| 4611 | - | ||
| 4612 | - if (self.$$selectgroupds.length == 0) { // 默认添加一组排序 | ||
| 4613 | - self.$$selectgroupds.push({ | ||
| 4614 | - column: self.columns[0].name, | ||
| 4615 | - dir: "ASC" | ||
| 4616 | - }); | ||
| 4617 | - } | ||
| 4618 | - | ||
| 4619 | - // 重新计算ordercolumns | ||
| 4620 | - | ||
| 4621 | - var aColumn = []; | ||
| 4622 | - var aDir = []; | ||
| 4623 | - for (var i = 0; i < self.$$selectgroupds.length; i++) { | ||
| 4624 | - aColumn.push(self.$$selectgroupds[i].column); | ||
| 4625 | - aDir.push(self.$$selectgroupds[i].dir); | ||
| 4626 | - } | ||
| 4627 | - if (self.ordercolumns) { | ||
| 4628 | - self.ordercolumns.order = aColumn.join(","); | ||
| 4629 | - self.ordercolumns.direction = aDir.join(","); | ||
| 4630 | - } else { | ||
| 4631 | - self.ordercolumns = {order: aColumn.join(","), direction: aDir.join(",")} | ||
| 4632 | - } | ||
| 4633 | - | ||
| 4634 | - } | ||
| 4635 | - }, | ||
| 4636 | - compile: function(tElem, tAttrs) { | ||
| 4637 | - // 获取所有属性,并验证 | ||
| 4638 | - var $name_attr = tAttrs['name']; // 控件的名字 | ||
| 4639 | - if (!$name_attr) { | ||
| 4640 | - throw "必须有名称属性"; | ||
| 4641 | - } | ||
| 4642 | - | ||
| 4643 | - // controlAs名字 | ||
| 4644 | - var ctrlAs = '$saOrderOptionCtrl'; | ||
| 4645 | - | ||
| 4646 | - // TODO: | ||
| 4647 | - | ||
| 4648 | - | ||
| 4649 | - | ||
| 4650 | - return { | ||
| 4651 | - pre: function(scope, element, attr) { | ||
| 4652 | - | ||
| 4653 | - }, | ||
| 4654 | - | ||
| 4655 | - post: function(scope, element, attr) { | ||
| 4656 | - | ||
| 4657 | - //--------------------- 监控属性方法 -------------------// | ||
| 4658 | - // 监控字段名字列表 | ||
| 4659 | - scope.$watch( | ||
| 4660 | - function() { | ||
| 4661 | - return scope[ctrlAs].columns; | ||
| 4662 | - }, | ||
| 4663 | - function(newValue, oldValue) { | ||
| 4664 | - if (!scope[ctrlAs].$$columns_loaded) { | ||
| 4665 | - // TODO:格式判定以后做,假设格式是对的 | ||
| 4666 | - | ||
| 4667 | - | ||
| 4668 | - } | ||
| 4669 | - | ||
| 4670 | - scope[ctrlAs].$$columns_loaded = true; | ||
| 4671 | - scope[ctrlAs].$$refresh_selectgroupds(); | ||
| 4672 | - }, | ||
| 4673 | - true | ||
| 4674 | - ); | ||
| 4675 | - // 监控字段排序列表 | ||
| 4676 | - scope.$watch( | ||
| 4677 | - function() { | ||
| 4678 | - return scope[ctrlAs].ordercolumns; | ||
| 4679 | - }, | ||
| 4680 | - function(newValue, oldValue) { | ||
| 4681 | - if (!scope[ctrlAs].$$ordercolumns_loaded) { | ||
| 4682 | - if (newValue) { | ||
| 4683 | - var aColumns = []; // 排序的字段 | ||
| 4684 | - var aDirs = []; // 排序字段对应的排序方向 | ||
| 4685 | - | ||
| 4686 | - if (newValue.order) { | ||
| 4687 | - aColumns = newValue.order.split(","); | ||
| 4688 | - } | ||
| 4689 | - if (newValue.direction) { | ||
| 4690 | - aDirs = newValue.direction.split(","); | ||
| 4691 | - } | ||
| 4692 | - | ||
| 4693 | - for (var i = 0; i < aColumns.length; i++) { | ||
| 4694 | - if (i < aDirs.length) { | ||
| 4695 | - scope[ctrlAs].$$selectgroupds.push({ | ||
| 4696 | - column: aColumns[i], | ||
| 4697 | - dir: aDirs[i] | ||
| 4698 | - }); | ||
| 4699 | - } else { | ||
| 4700 | - scope[ctrlAs].$$selectgroupds.push({ | ||
| 4701 | - column: aColumns[i], | ||
| 4702 | - dir: 'ASC' | ||
| 4703 | - }); | ||
| 4704 | - } | ||
| 4705 | - } | ||
| 4706 | - } | ||
| 4707 | - } | ||
| 4708 | - scope[ctrlAs].$$ordercolumns_loaded = true; | ||
| 4709 | - scope[ctrlAs].$$refresh_selectgroupds(); | ||
| 4710 | - | ||
| 4711 | - }, | ||
| 4712 | - true | ||
| 4713 | - ); | ||
| 4714 | - } | ||
| 4715 | - | ||
| 4716 | - }; | ||
| 4717 | - } | ||
| 4718 | - }; | ||
| 4719 | - } | ||
| 4720 | - ] | 4824 | +/** |
| 4825 | + * saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的) | ||
| 4826 | + * 属性如下: | ||
| 4827 | + * name(必须):控件的名字 | ||
| 4828 | + * columns(必须,独立作用域):字段名字列表,格式:[{name:[字段名],desc:[字段描述]}...] | ||
| 4829 | + * ordercolumns(必须,独立作用域):字段排序列表,格式:{order: '字段1,字段2',direction: 'ASC,DESC'} | ||
| 4830 | + */ | ||
| 4831 | +angular.module('ScheduleApp').directive( | ||
| 4832 | + 'saOrderoption', | ||
| 4833 | + [ | ||
| 4834 | + function() { | ||
| 4835 | + return { | ||
| 4836 | + restrict: 'E', | ||
| 4837 | + templateUrl: '/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html', | ||
| 4838 | + scope: { | ||
| 4839 | + columns: '=', | ||
| 4840 | + ordercolumns: '=' | ||
| 4841 | + }, | ||
| 4842 | + controllerAs: '$saOrderOptionCtrl', | ||
| 4843 | + bindToController: true, | ||
| 4844 | + controller: function() { | ||
| 4845 | + var self = this; | ||
| 4846 | + | ||
| 4847 | + // 字段列表是否预载入 | ||
| 4848 | + self.$$columns_loaded = false; | ||
| 4849 | + // 字段排序是否预载入 | ||
| 4850 | + self.$$ordercolumns_loaded = false; | ||
| 4851 | + | ||
| 4852 | + | ||
| 4853 | + // 每组选项内部数据源 | ||
| 4854 | + // 格式:[{column:[选中的字段名],dir:[ASC/DESC]}] | ||
| 4855 | + self.$$selectgroupds = []; | ||
| 4856 | + | ||
| 4857 | + // TODO:选择事件 | ||
| 4858 | + | ||
| 4859 | + self.$$select_column_change = function() { | ||
| 4860 | + self.$$refresh_selectgroupds(); | ||
| 4861 | + }; | ||
| 4862 | + | ||
| 4863 | + self.$$select_dir_change = function() { | ||
| 4864 | + self.$$refresh_selectgroupds(); | ||
| 4865 | + }; | ||
| 4866 | + | ||
| 4867 | + self.$$add_option_click = function(index) { | ||
| 4868 | + self.$$selectgroupds.splice(index, 0, { | ||
| 4869 | + column: self.columns[0].name, | ||
| 4870 | + dir: "ASC" | ||
| 4871 | + }); | ||
| 4872 | + self.$$refresh_selectgroupds(); | ||
| 4873 | + }; | ||
| 4874 | + self.$$del_option_click = function(index) { | ||
| 4875 | + self.$$selectgroupds.splice(index, 1); | ||
| 4876 | + self.$$refresh_selectgroupds(); | ||
| 4877 | + }; | ||
| 4878 | + | ||
| 4879 | + // 刷新选项内部数据源 | ||
| 4880 | + self.$$refresh_selectgroupds = function() { | ||
| 4881 | + if (!self.$$columns_loaded || !self.$$ordercolumns_loaded || self.columns.length == 0) { | ||
| 4882 | + // 没有载入完成,或者字段列表为空 | ||
| 4883 | + return; | ||
| 4884 | + } | ||
| 4885 | + | ||
| 4886 | + if (self.$$selectgroupds.length == 0) { // 默认添加一组排序 | ||
| 4887 | + self.$$selectgroupds.push({ | ||
| 4888 | + column: self.columns[0].name, | ||
| 4889 | + dir: "ASC" | ||
| 4890 | + }); | ||
| 4891 | + } | ||
| 4892 | + | ||
| 4893 | + // 重新计算ordercolumns | ||
| 4894 | + | ||
| 4895 | + var aColumn = []; | ||
| 4896 | + var aDir = []; | ||
| 4897 | + for (var i = 0; i < self.$$selectgroupds.length; i++) { | ||
| 4898 | + aColumn.push(self.$$selectgroupds[i].column); | ||
| 4899 | + aDir.push(self.$$selectgroupds[i].dir); | ||
| 4900 | + } | ||
| 4901 | + if (self.ordercolumns) { | ||
| 4902 | + self.ordercolumns.order = aColumn.join(","); | ||
| 4903 | + self.ordercolumns.direction = aDir.join(","); | ||
| 4904 | + } else { | ||
| 4905 | + self.ordercolumns = {order: aColumn.join(","), direction: aDir.join(",")} | ||
| 4906 | + } | ||
| 4907 | + | ||
| 4908 | + } | ||
| 4909 | + }, | ||
| 4910 | + compile: function(tElem, tAttrs) { | ||
| 4911 | + // 获取所有属性,并验证 | ||
| 4912 | + var $name_attr = tAttrs['name']; // 控件的名字 | ||
| 4913 | + if (!$name_attr) { | ||
| 4914 | + throw "必须有名称属性"; | ||
| 4915 | + } | ||
| 4916 | + | ||
| 4917 | + // controlAs名字 | ||
| 4918 | + var ctrlAs = '$saOrderOptionCtrl'; | ||
| 4919 | + | ||
| 4920 | + // TODO: | ||
| 4921 | + | ||
| 4922 | + | ||
| 4923 | + | ||
| 4924 | + return { | ||
| 4925 | + pre: function(scope, element, attr) { | ||
| 4926 | + | ||
| 4927 | + }, | ||
| 4928 | + | ||
| 4929 | + post: function(scope, element, attr) { | ||
| 4930 | + | ||
| 4931 | + //--------------------- 监控属性方法 -------------------// | ||
| 4932 | + // 监控字段名字列表 | ||
| 4933 | + scope.$watch( | ||
| 4934 | + function() { | ||
| 4935 | + return scope[ctrlAs].columns; | ||
| 4936 | + }, | ||
| 4937 | + function(newValue, oldValue) { | ||
| 4938 | + if (!scope[ctrlAs].$$columns_loaded) { | ||
| 4939 | + // TODO:格式判定以后做,假设格式是对的 | ||
| 4940 | + | ||
| 4941 | + | ||
| 4942 | + } | ||
| 4943 | + | ||
| 4944 | + scope[ctrlAs].$$columns_loaded = true; | ||
| 4945 | + scope[ctrlAs].$$refresh_selectgroupds(); | ||
| 4946 | + }, | ||
| 4947 | + true | ||
| 4948 | + ); | ||
| 4949 | + // 监控字段排序列表 | ||
| 4950 | + scope.$watch( | ||
| 4951 | + function() { | ||
| 4952 | + return scope[ctrlAs].ordercolumns; | ||
| 4953 | + }, | ||
| 4954 | + function(newValue, oldValue) { | ||
| 4955 | + if (!scope[ctrlAs].$$ordercolumns_loaded) { | ||
| 4956 | + if (newValue) { | ||
| 4957 | + var aColumns = []; // 排序的字段 | ||
| 4958 | + var aDirs = []; // 排序字段对应的排序方向 | ||
| 4959 | + | ||
| 4960 | + if (newValue.order) { | ||
| 4961 | + aColumns = newValue.order.split(","); | ||
| 4962 | + } | ||
| 4963 | + if (newValue.direction) { | ||
| 4964 | + aDirs = newValue.direction.split(","); | ||
| 4965 | + } | ||
| 4966 | + | ||
| 4967 | + for (var i = 0; i < aColumns.length; i++) { | ||
| 4968 | + if (i < aDirs.length) { | ||
| 4969 | + scope[ctrlAs].$$selectgroupds.push({ | ||
| 4970 | + column: aColumns[i], | ||
| 4971 | + dir: aDirs[i] | ||
| 4972 | + }); | ||
| 4973 | + } else { | ||
| 4974 | + scope[ctrlAs].$$selectgroupds.push({ | ||
| 4975 | + column: aColumns[i], | ||
| 4976 | + dir: 'ASC' | ||
| 4977 | + }); | ||
| 4978 | + } | ||
| 4979 | + } | ||
| 4980 | + } | ||
| 4981 | + } | ||
| 4982 | + scope[ctrlAs].$$ordercolumns_loaded = true; | ||
| 4983 | + scope[ctrlAs].$$refresh_selectgroupds(); | ||
| 4984 | + | ||
| 4985 | + }, | ||
| 4986 | + true | ||
| 4987 | + ); | ||
| 4988 | + } | ||
| 4989 | + | ||
| 4990 | + }; | ||
| 4991 | + } | ||
| 4992 | + }; | ||
| 4993 | + } | ||
| 4994 | + ] | ||
| 4721 | ); | 4995 | ); |
| 4722 | /** | 4996 | /** |
| 4723 | * saScpdate指令(非通用指令,只在排班计划form中使用)。 | 4997 | * saScpdate指令(非通用指令,只在排班计划form中使用)。 |
| @@ -4950,193 +5224,193 @@ angular.module('ScheduleApp').directive( | @@ -4950,193 +5224,193 @@ angular.module('ScheduleApp').directive( | ||
| 4950 | } | 5224 | } |
| 4951 | ] | 5225 | ] |
| 4952 | ); | 5226 | ); |
| 4953 | -/** | ||
| 4954 | - * saSrule指令(非通用指令,只在排班计划form中使用)。 | ||
| 4955 | - * 属性如下: | ||
| 4956 | - * name(必须):控件的名字 | ||
| 4957 | - * xlid(必须):线路id | ||
| 4958 | - * from(必须):独立作用域-绑定的开始时间属性名 | ||
| 4959 | - * to(必须):独立作用域-绑定的结束时间属性名 | ||
| 4960 | - * error(必须):独立作用域-绑定的错误描述属性名 | ||
| 4961 | - */ | ||
| 4962 | -angular.module('ScheduleApp').directive( | ||
| 4963 | - 'saSrule', | ||
| 4964 | - [ | ||
| 4965 | - 'SchedulePlanManageService_g', | ||
| 4966 | - function(service) { | ||
| 4967 | - return { | ||
| 4968 | - restrict: 'E', | ||
| 4969 | - templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html', | ||
| 4970 | - scope: { | ||
| 4971 | - from: '=', | ||
| 4972 | - to: '=', | ||
| 4973 | - xlid: '=', | ||
| 4974 | - error: '=' | ||
| 4975 | - }, | ||
| 4976 | - controllerAs: '$saSruleCtrl', | ||
| 4977 | - bindToController: true, | ||
| 4978 | - controller: function() { | ||
| 4979 | - var self = this; | ||
| 4980 | - | ||
| 4981 | - // 内部ng-model值,用于和required配对 | ||
| 4982 | - self.$$internalmodel = undefined; | ||
| 4983 | - | ||
| 4984 | - // 内部数据源(时刻表的一些信息) | ||
| 4985 | - self.$$count = 0; | ||
| 4986 | - self.$$qyCount = 0; | ||
| 4987 | - self.$$qyErrorCount = 0; | ||
| 4988 | - self.$$errorInfos = []; | ||
| 4989 | - | ||
| 4990 | - }, | ||
| 4991 | - compile: function(tElem, tAttrs) { | ||
| 4992 | - // 获取所有属性,并验证 | ||
| 4993 | - var $name_attr = tAttrs['name']; // 控件的名字 | ||
| 4994 | - if (!$name_attr) { | ||
| 4995 | - throw "必须有名称属性"; | ||
| 4996 | - } | ||
| 4997 | - | ||
| 4998 | - // controlAs名字 | ||
| 4999 | - var ctrlAs = '$saSruleCtrl'; | ||
| 5000 | - | ||
| 5001 | - // 线路id | ||
| 5002 | - var xl_id = undefined; | ||
| 5003 | - // 开始时间 | ||
| 5004 | - var from_date = undefined; | ||
| 5005 | - // 结束时间 | ||
| 5006 | - var to_date = undefined; | ||
| 5007 | - | ||
| 5008 | - // 内部添加required验证,将所有的错误应用到required验证上去 | ||
| 5009 | - tElem.find("div").attr("required", ""); | ||
| 5010 | - | ||
| 5011 | - return { | ||
| 5012 | - pre: function(scope, element, attr) { | ||
| 5013 | - | ||
| 5014 | - }, | ||
| 5015 | - | ||
| 5016 | - post: function(scope, element, attr) { | ||
| 5017 | - // 属性值 | ||
| 5018 | - if ($name_attr) { | ||
| 5019 | - scope[ctrlAs]["$name_attr"] = $name_attr; | ||
| 5020 | - } | ||
| 5021 | - | ||
| 5022 | - // 开始日期open属性,及方法 | ||
| 5023 | - scope[ctrlAs].$$fromDateOpen = false; | ||
| 5024 | - scope[ctrlAs].$$fromDate_open = function() { | ||
| 5025 | - scope[ctrlAs].$$fromDateOpen = true; | ||
| 5026 | - }; | ||
| 5027 | - | ||
| 5028 | - // 结束日期open属性,及方法 | ||
| 5029 | - scope[ctrlAs].$$toDateOpen = false; | ||
| 5030 | - scope[ctrlAs].$$toDate_open = function() { | ||
| 5031 | - scope[ctrlAs].$$toDateOpen = true; | ||
| 5032 | - }; | ||
| 5033 | - | ||
| 5034 | - // 内部模型刷新 | ||
| 5035 | - scope[ctrlAs].$$internal_model_refresh = function() { | ||
| 5036 | - if (!xl_id) { | ||
| 5037 | - scope[ctrlAs].$$internalmodel = undefined; | ||
| 5038 | - scope[ctrlAs].error = "线路必须选择"; | ||
| 5039 | - return; | ||
| 5040 | - } | ||
| 5041 | - if (!from_date) { | ||
| 5042 | - scope[ctrlAs].$$internalmodel = undefined; | ||
| 5043 | - scope[ctrlAs].error = "开始日期必须选择"; | ||
| 5044 | - return; | ||
| 5045 | - } | ||
| 5046 | - if (!to_date) { | ||
| 5047 | - scope[ctrlAs].$$internalmodel = undefined; | ||
| 5048 | - scope[ctrlAs].error = "结束日期必须选择"; | ||
| 5049 | - return; | ||
| 5050 | - } | ||
| 5051 | - if (from_date > to_date) { | ||
| 5052 | - scope[ctrlAs].$$internalmodel = undefined; | ||
| 5053 | - scope[ctrlAs].error = "开始日期必须在结束日期之前"; | ||
| 5054 | - return; | ||
| 5055 | - } | ||
| 5056 | - | ||
| 5057 | - scope[ctrlAs].$$count = 0; | ||
| 5058 | - scope[ctrlAs].$$qyCount = 0; | ||
| 5059 | - scope[ctrlAs].$$qyErrorCount = 0; | ||
| 5060 | - scope[ctrlAs].$$errorInfos = []; | ||
| 5061 | - | ||
| 5062 | - if (scope[ctrlAs].$$qyCount == 0) { | ||
| 5063 | - scope[ctrlAs].$$internalmodel = undefined; | ||
| 5064 | - scope[ctrlAs].error = "无可启用的规则数"; | ||
| 5065 | - } | ||
| 5066 | - | ||
| 5067 | - var QClass = service.v_rules; | ||
| 5068 | - QClass.val({xlid: xl_id, from: from_date, to: to_date}, | ||
| 5069 | - function(result) { | ||
| 5070 | - scope[ctrlAs].$$count = result.data.count; | ||
| 5071 | - scope[ctrlAs].$$qyCount = result.data.qyCount; | ||
| 5072 | - scope[ctrlAs].$$qyErrorCount = result.data.qyErrorCount; | ||
| 5073 | - | ||
| 5074 | - angular.forEach(result.data.errorInfos, function(obj) { | ||
| 5075 | - scope[ctrlAs].$$errorInfos.push({ | ||
| 5076 | - ruleId: obj.ruleId, | ||
| 5077 | - clZbh: obj.clZbh, | ||
| 5078 | - qyrq: moment(obj.qyrq).format("YYYY年MM月DD日"), | ||
| 5079 | - infos: obj.errorDescList.join("") | ||
| 5080 | - }); | ||
| 5081 | - }); | ||
| 5082 | - | ||
| 5083 | - if (scope[ctrlAs].$$qyErrorCount > 0) { | ||
| 5084 | - scope[ctrlAs].$$internalmodel = undefined; | ||
| 5085 | - scope[ctrlAs].error = "有错误的规则"; | ||
| 5086 | - } else { | ||
| 5087 | - scope[ctrlAs].$$internalmodel = "ok"; | ||
| 5088 | - scope[ctrlAs].$$errorInfos = []; | ||
| 5089 | - } | ||
| 5090 | - }, | ||
| 5091 | - function() { | ||
| 5092 | - scope[ctrlAs].$$internalmodel = undefined; | ||
| 5093 | - scope[ctrlAs].error = "获取规则数据失败!"; | ||
| 5094 | - } | ||
| 5095 | - ); | ||
| 5096 | - | ||
| 5097 | - scope[ctrlAs].$$internalmodel = "ok"; | ||
| 5098 | - }; | ||
| 5099 | - | ||
| 5100 | - scope[ctrlAs].$$internal_model_refresh(); // 初始执行 | ||
| 5101 | - | ||
| 5102 | - //--------------------- 监控属性方法 -------------------// | ||
| 5103 | - // 监控线路id模型值变化 | ||
| 5104 | - scope.$watch( | ||
| 5105 | - function() { | ||
| 5106 | - return scope[ctrlAs].xlid; | ||
| 5107 | - }, | ||
| 5108 | - function(newValue, oldValue) { | ||
| 5109 | - xl_id = newValue; | ||
| 5110 | - scope[ctrlAs].$$internal_model_refresh(); | ||
| 5111 | - } | ||
| 5112 | - ); | ||
| 5113 | - | ||
| 5114 | - // 监控开始时间模型值变化 | ||
| 5115 | - scope.$watch( | ||
| 5116 | - function() { | ||
| 5117 | - return scope[ctrlAs].from; | ||
| 5118 | - }, | ||
| 5119 | - function(newValue, oldValue) { | ||
| 5120 | - from_date = newValue; | ||
| 5121 | - scope[ctrlAs].$$internal_model_refresh(); | ||
| 5122 | - } | ||
| 5123 | - ); | ||
| 5124 | - // 监控结束时间模型值变化 | ||
| 5125 | - scope.$watch( | ||
| 5126 | - function() { | ||
| 5127 | - return scope[ctrlAs].to; | ||
| 5128 | - }, | ||
| 5129 | - function(newValue, oldValue) { | ||
| 5130 | - to_date = newValue; | ||
| 5131 | - scope[ctrlAs].$$internal_model_refresh(); | ||
| 5132 | - } | ||
| 5133 | - ); | ||
| 5134 | - } | ||
| 5135 | - }; | ||
| 5136 | - } | ||
| 5137 | - }; | ||
| 5138 | - } | ||
| 5139 | - ] | 5227 | +/** |
| 5228 | + * saSrule指令(非通用指令,只在排班计划form中使用)。 | ||
| 5229 | + * 属性如下: | ||
| 5230 | + * name(必须):控件的名字 | ||
| 5231 | + * xlid(必须):线路id | ||
| 5232 | + * from(必须):独立作用域-绑定的开始时间属性名 | ||
| 5233 | + * to(必须):独立作用域-绑定的结束时间属性名 | ||
| 5234 | + * error(必须):独立作用域-绑定的错误描述属性名 | ||
| 5235 | + */ | ||
| 5236 | +angular.module('ScheduleApp').directive( | ||
| 5237 | + 'saSrule', | ||
| 5238 | + [ | ||
| 5239 | + 'SchedulePlanManageService_g', | ||
| 5240 | + function(service) { | ||
| 5241 | + return { | ||
| 5242 | + restrict: 'E', | ||
| 5243 | + templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html', | ||
| 5244 | + scope: { | ||
| 5245 | + from: '=', | ||
| 5246 | + to: '=', | ||
| 5247 | + xlid: '=', | ||
| 5248 | + error: '=' | ||
| 5249 | + }, | ||
| 5250 | + controllerAs: '$saSruleCtrl', | ||
| 5251 | + bindToController: true, | ||
| 5252 | + controller: function() { | ||
| 5253 | + var self = this; | ||
| 5254 | + | ||
| 5255 | + // 内部ng-model值,用于和required配对 | ||
| 5256 | + self.$$internalmodel = undefined; | ||
| 5257 | + | ||
| 5258 | + // 内部数据源(时刻表的一些信息) | ||
| 5259 | + self.$$count = 0; | ||
| 5260 | + self.$$qyCount = 0; | ||
| 5261 | + self.$$qyErrorCount = 0; | ||
| 5262 | + self.$$errorInfos = []; | ||
| 5263 | + | ||
| 5264 | + }, | ||
| 5265 | + compile: function(tElem, tAttrs) { | ||
| 5266 | + // 获取所有属性,并验证 | ||
| 5267 | + var $name_attr = tAttrs['name']; // 控件的名字 | ||
| 5268 | + if (!$name_attr) { | ||
| 5269 | + throw "必须有名称属性"; | ||
| 5270 | + } | ||
| 5271 | + | ||
| 5272 | + // controlAs名字 | ||
| 5273 | + var ctrlAs = '$saSruleCtrl'; | ||
| 5274 | + | ||
| 5275 | + // 线路id | ||
| 5276 | + var xl_id = undefined; | ||
| 5277 | + // 开始时间 | ||
| 5278 | + var from_date = undefined; | ||
| 5279 | + // 结束时间 | ||
| 5280 | + var to_date = undefined; | ||
| 5281 | + | ||
| 5282 | + // 内部添加required验证,将所有的错误应用到required验证上去 | ||
| 5283 | + tElem.find("div").attr("required", ""); | ||
| 5284 | + | ||
| 5285 | + return { | ||
| 5286 | + pre: function(scope, element, attr) { | ||
| 5287 | + | ||
| 5288 | + }, | ||
| 5289 | + | ||
| 5290 | + post: function(scope, element, attr) { | ||
| 5291 | + // 属性值 | ||
| 5292 | + if ($name_attr) { | ||
| 5293 | + scope[ctrlAs]["$name_attr"] = $name_attr; | ||
| 5294 | + } | ||
| 5295 | + | ||
| 5296 | + // 开始日期open属性,及方法 | ||
| 5297 | + scope[ctrlAs].$$fromDateOpen = false; | ||
| 5298 | + scope[ctrlAs].$$fromDate_open = function() { | ||
| 5299 | + scope[ctrlAs].$$fromDateOpen = true; | ||
| 5300 | + }; | ||
| 5301 | + | ||
| 5302 | + // 结束日期open属性,及方法 | ||
| 5303 | + scope[ctrlAs].$$toDateOpen = false; | ||
| 5304 | + scope[ctrlAs].$$toDate_open = function() { | ||
| 5305 | + scope[ctrlAs].$$toDateOpen = true; | ||
| 5306 | + }; | ||
| 5307 | + | ||
| 5308 | + // 内部模型刷新 | ||
| 5309 | + scope[ctrlAs].$$internal_model_refresh = function() { | ||
| 5310 | + if (!xl_id) { | ||
| 5311 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 5312 | + scope[ctrlAs].error = "线路必须选择"; | ||
| 5313 | + return; | ||
| 5314 | + } | ||
| 5315 | + if (!from_date) { | ||
| 5316 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 5317 | + scope[ctrlAs].error = "开始日期必须选择"; | ||
| 5318 | + return; | ||
| 5319 | + } | ||
| 5320 | + if (!to_date) { | ||
| 5321 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 5322 | + scope[ctrlAs].error = "结束日期必须选择"; | ||
| 5323 | + return; | ||
| 5324 | + } | ||
| 5325 | + if (from_date > to_date) { | ||
| 5326 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 5327 | + scope[ctrlAs].error = "开始日期必须在结束日期之前"; | ||
| 5328 | + return; | ||
| 5329 | + } | ||
| 5330 | + | ||
| 5331 | + scope[ctrlAs].$$count = 0; | ||
| 5332 | + scope[ctrlAs].$$qyCount = 0; | ||
| 5333 | + scope[ctrlAs].$$qyErrorCount = 0; | ||
| 5334 | + scope[ctrlAs].$$errorInfos = []; | ||
| 5335 | + | ||
| 5336 | + if (scope[ctrlAs].$$qyCount == 0) { | ||
| 5337 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 5338 | + scope[ctrlAs].error = "无可启用的规则数"; | ||
| 5339 | + } | ||
| 5340 | + | ||
| 5341 | + var QClass = service.v_rules; | ||
| 5342 | + QClass.val({xlid: xl_id, from: from_date, to: to_date}, | ||
| 5343 | + function(result) { | ||
| 5344 | + scope[ctrlAs].$$count = result.data.count; | ||
| 5345 | + scope[ctrlAs].$$qyCount = result.data.qyCount; | ||
| 5346 | + scope[ctrlAs].$$qyErrorCount = result.data.qyErrorCount; | ||
| 5347 | + | ||
| 5348 | + angular.forEach(result.data.errorInfos, function(obj) { | ||
| 5349 | + scope[ctrlAs].$$errorInfos.push({ | ||
| 5350 | + ruleId: obj.ruleId, | ||
| 5351 | + clZbh: obj.clZbh, | ||
| 5352 | + qyrq: moment(obj.qyrq).format("YYYY年MM月DD日"), | ||
| 5353 | + infos: obj.errorDescList.join("") | ||
| 5354 | + }); | ||
| 5355 | + }); | ||
| 5356 | + | ||
| 5357 | + if (scope[ctrlAs].$$qyErrorCount > 0) { | ||
| 5358 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 5359 | + scope[ctrlAs].error = "有错误的规则"; | ||
| 5360 | + } else { | ||
| 5361 | + scope[ctrlAs].$$internalmodel = "ok"; | ||
| 5362 | + scope[ctrlAs].$$errorInfos = []; | ||
| 5363 | + } | ||
| 5364 | + }, | ||
| 5365 | + function() { | ||
| 5366 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 5367 | + scope[ctrlAs].error = "获取规则数据失败!"; | ||
| 5368 | + } | ||
| 5369 | + ); | ||
| 5370 | + | ||
| 5371 | + scope[ctrlAs].$$internalmodel = "ok"; | ||
| 5372 | + }; | ||
| 5373 | + | ||
| 5374 | + scope[ctrlAs].$$internal_model_refresh(); // 初始执行 | ||
| 5375 | + | ||
| 5376 | + //--------------------- 监控属性方法 -------------------// | ||
| 5377 | + // 监控线路id模型值变化 | ||
| 5378 | + scope.$watch( | ||
| 5379 | + function() { | ||
| 5380 | + return scope[ctrlAs].xlid; | ||
| 5381 | + }, | ||
| 5382 | + function(newValue, oldValue) { | ||
| 5383 | + xl_id = newValue; | ||
| 5384 | + scope[ctrlAs].$$internal_model_refresh(); | ||
| 5385 | + } | ||
| 5386 | + ); | ||
| 5387 | + | ||
| 5388 | + // 监控开始时间模型值变化 | ||
| 5389 | + scope.$watch( | ||
| 5390 | + function() { | ||
| 5391 | + return scope[ctrlAs].from; | ||
| 5392 | + }, | ||
| 5393 | + function(newValue, oldValue) { | ||
| 5394 | + from_date = newValue; | ||
| 5395 | + scope[ctrlAs].$$internal_model_refresh(); | ||
| 5396 | + } | ||
| 5397 | + ); | ||
| 5398 | + // 监控结束时间模型值变化 | ||
| 5399 | + scope.$watch( | ||
| 5400 | + function() { | ||
| 5401 | + return scope[ctrlAs].to; | ||
| 5402 | + }, | ||
| 5403 | + function(newValue, oldValue) { | ||
| 5404 | + to_date = newValue; | ||
| 5405 | + scope[ctrlAs].$$internal_model_refresh(); | ||
| 5406 | + } | ||
| 5407 | + ); | ||
| 5408 | + } | ||
| 5409 | + }; | ||
| 5410 | + } | ||
| 5411 | + }; | ||
| 5412 | + } | ||
| 5413 | + ] | ||
| 5140 | ); | 5414 | ); |
| 5141 | /** | 5415 | /** |
| 5142 | * saPlaninfoedit指令,排班明细编辑控件,用在调度执勤日报的修改功能 | 5416 | * saPlaninfoedit指令,排班明细编辑控件,用在调度执勤日报的修改功能 |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js
| @@ -22,10 +22,8 @@ angular.module('ScheduleApp').factory( | @@ -22,10 +22,8 @@ angular.module('ScheduleApp').factory( | ||
| 22 | 22 | ||
| 23 | // 时刻表信息(预览视图使用) | 23 | // 时刻表信息(预览视图使用) |
| 24 | var pvInfo = { | 24 | var pvInfo = { |
| 25 | - up_qdz_name : "", // 上行起点站名字 | ||
| 26 | - down_qdz_name : "", // 下行起点站名字 | ||
| 27 | - up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | ||
| 28 | - down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | 25 | + bcList : [], // 班次列表 |
| 26 | + refreshInfos : undefined // 刷新信息 | ||
| 29 | }; | 27 | }; |
| 30 | 28 | ||
| 31 | return { | 29 | return { |
| @@ -48,91 +46,14 @@ angular.module('ScheduleApp').factory( | @@ -48,91 +46,14 @@ angular.module('ScheduleApp').factory( | ||
| 48 | {page : 0, size : 1000, "ttinfo.id_eq" : ttid}, | 46 | {page : 0, size : 1000, "ttinfo.id_eq" : ttid}, |
| 49 | function(result) { | 47 | function(result) { |
| 50 | if (result.content.length > 0) { | 48 | if (result.content.length > 0) { |
| 51 | - pvInfo = { | ||
| 52 | - up_qdz_name : "", // 上行起点站名字 | ||
| 53 | - down_qdz_name : "", // 下行起点站名字 | ||
| 54 | - up_bc_list_asc : [], // 上行班次列表(按照发车时间升序) | ||
| 55 | - down_bc_list_asc : [] // 下行班次列表(按照发车时间升序) | ||
| 56 | - }; | ||
| 57 | - | ||
| 58 | - // 构造上下行班次列表,并确定上下行的首发站点 | ||
| 59 | - angular.forEach(result.content, function(bcObj) { | ||
| 60 | - if (bcObj.xlDir == "0") { // 上行 | ||
| 61 | - pvInfo.up_bc_list_asc.push(bcObj); | ||
| 62 | - | ||
| 63 | - // 确定首发站点 | ||
| 64 | - if (pvInfo.up_qdz_name == "") { | ||
| 65 | - if (bcObj.bcType == "normal") { | ||
| 66 | - pvInfo.up_qdz_name = bcObj.qdzName; | ||
| 67 | - } | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - if (bcObj.xlDir == "1") { // 下行 | ||
| 71 | - pvInfo.down_bc_list_asc.push(bcObj); | ||
| 72 | - | ||
| 73 | - // 确定首发站点 | ||
| 74 | - if (pvInfo.down_qdz_name == "") { | ||
| 75 | - if (bcObj.bcType == "normal") { | ||
| 76 | - pvInfo.down_qdz_name = bcObj.qdzName; | ||
| 77 | - } | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - }); | ||
| 81 | - | ||
| 82 | - // 发车时间升序排序上行班次 | ||
| 83 | - pvInfo.up_bc_list_asc.sort(function(a, b) { | ||
| 84 | - var a_wrapTime = moment("2000-01-01 " + a.fcsj, "YYYY-MM-DD HH:mm"); | ||
| 85 | - var b_wrapTime = moment("2000-01-01 " + b.fcsj, "YYYY-MM-DD HH:mm"); | ||
| 86 | - | ||
| 87 | - // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | ||
| 88 | - // TODO:以后要配合首班车的发车时间判定 | ||
| 89 | - if (a.fcsj.indexOf("00:") == 0 || | ||
| 90 | - a.fcsj.indexOf("01:") == 0 || | ||
| 91 | - a.fcsj.indexOf("02:") == 0) { | ||
| 92 | - a_wrapTime.add(1, "day"); | ||
| 93 | - } | ||
| 94 | - if (b.fcsj.indexOf("00:") == 0 || | ||
| 95 | - b.fcsj.indexOf("01:") == 0 || | ||
| 96 | - b.fcsj.indexOf("02:") == 0) { | ||
| 97 | - b_wrapTime.add(1, "day"); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - | ||
| 101 | - if (a_wrapTime.isBefore(b_wrapTime)) { | ||
| 102 | - return -1; | ||
| 103 | - } else if (a_wrapTime.isAfter(b_wrapTime)) { | ||
| 104 | - return 1; | ||
| 105 | - } else { | ||
| 106 | - return 0; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - }); | ||
| 110 | - // 发车时间升序排序下行班次 | ||
| 111 | - pvInfo.down_bc_list_asc.sort(function(a, b) { | ||
| 112 | - var a_wrapTime = moment("2000-01-01 " + a.fcsj, "YYYY-MM-DD HH:mm"); | ||
| 113 | - var b_wrapTime = moment("2000-01-01 " + b.fcsj, "YYYY-MM-DD HH:mm"); | ||
| 114 | - | ||
| 115 | - // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定 | ||
| 116 | - // TODO:以后要配合首班车的发车时间判定 | ||
| 117 | - if (a.fcsj.indexOf("00:") == 0 || | ||
| 118 | - a.fcsj.indexOf("01:") == 0 || | ||
| 119 | - a.fcsj.indexOf("02:") == 0) { | ||
| 120 | - a_wrapTime.add(1, "day"); | ||
| 121 | - } | ||
| 122 | - if (b.fcsj.indexOf("00:") == 0 || | ||
| 123 | - b.fcsj.indexOf("01:") == 0 || | ||
| 124 | - b.fcsj.indexOf("02:") == 0) { | ||
| 125 | - b_wrapTime.add(1, "day"); | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - if (a_wrapTime.isBefore(b_wrapTime)) { | ||
| 129 | - return -1; | ||
| 130 | - } else if (a_wrapTime.isAfter(b_wrapTime)) { | ||
| 131 | - return 1; | ||
| 132 | - } else { | ||
| 133 | - return 0; | ||
| 134 | - } | ||
| 135 | - }); | 49 | + pvInfo.bcList = result.content; |
| 50 | + if (pvInfo.refreshInfos == undefined) { | ||
| 51 | + pvInfo.refreshInfos = { | ||
| 52 | + count : 1 // 刷新次数 | ||
| 53 | + }; | ||
| 54 | + } else { | ||
| 55 | + pvInfo.refreshInfos.count ++; | ||
| 56 | + } | ||
| 136 | } | 57 | } |
| 137 | } | 58 | } |
| 138 | ); | 59 | ); |