Commit d6f2ed6d44f03a6a1fc94efc3391e407dd6cc0bc

Authored by 廖磊
2 parents 656b79e8 914fc508

Merge branch 'minhang' of

http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing 23 changed files with 2734 additions and 90 deletions
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
... ... @@ -88,6 +88,21 @@ public class ChildTaskPlan {
88 88 */
89 89 private String destroyReason;
90 90  
  91 + /**
  92 + * 包括 烂班原因、进出场原因、换车原因 等
  93 + */
  94 + private String reason;
  95 +
  96 + /**
  97 + * 车辆 如果为空,继承主任务
  98 + */
  99 + private String nbbm;
  100 +
  101 + /**
  102 + * 为true 则无售票员, 否则继承主任务
  103 + */
  104 + private boolean noClerk;
  105 +
91 106 /** 创建日期 */
92 107 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
93 108 private Date createDate;
... ... @@ -238,4 +253,28 @@ public class ChildTaskPlan {
238 253 public void setCreateDate(Date createDate) {
239 254 this.createDate = createDate;
240 255 }
  256 +
  257 + public String getReason() {
  258 + return reason;
  259 + }
  260 +
  261 + public void setReason(String reason) {
  262 + this.reason = reason;
  263 + }
  264 +
  265 + public String getNbbm() {
  266 + return nbbm;
  267 + }
  268 +
  269 + public void setNbbm(String nbbm) {
  270 + this.nbbm = nbbm;
  271 + }
  272 +
  273 + public boolean isNoClerk() {
  274 + return noClerk;
  275 + }
  276 +
  277 + public void setNoClerk(boolean noClerk) {
  278 + this.noClerk = noClerk;
  279 + }
241 280 }
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -266,7 +266,6 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int
266 266 "StationRoute s " +
267 267 "WHERE " +
268 268 "s.destroy = 0 " +
269   - "and s.lineCode in(select lineCode from Line where inUse = 1) " +
270 269 "ORDER BY " +
271 270 "lineCode,directions,stationRouteCode")
272 271 List<Map<String, String>> findAllLineWithYgc();
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
... ... @@ -45,14 +45,21 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
45 45 try {
46 46 ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
47 47 //保存起终点名称
48   - String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
  48 + //String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
49 49 if(StringUtils.isEmpty(t.getStartStationName()))
50   - t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
  50 + t.setStartStationName(getStationName(sch.getXlBm(), t.getStartStation()));
  51 + //t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
51 52  
52 53 if(StringUtils.isEmpty(t.getEndStationName()))
53   - t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
  54 + t.setEndStationName(getStationName(sch.getXlBm(), t.getEndStation()));
  55 + //t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
54 56 if(t.getDestroyReason() == null)
55 57 t.setDestroyReason("");
  58 +
  59 + //烂班说明,为兼容之前的数据结构
  60 + if(t.isDestroy() && StringUtils.isEmpty(t.getDestroyReason()))
  61 + t.setDestroyReason(t.getReason());
  62 +
56 63 //先持久化子任务
57 64 rs = super.save(t);
58 65 //关联主任务
... ... @@ -71,6 +78,17 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
71 78 return rs;
72 79 }
73 80  
  81 + private String getStationName(String lineCode, String stationCode){
  82 + String name;
  83 + String prefix1 = lineCode + "_" + 0 + "_",
  84 + prefix2 = lineCode + "_" + 1 + "_";
  85 +
  86 + name = BasicData.getStationNameByCode(stationCode, prefix1);
  87 + if(StringUtils.isEmpty(name))
  88 + name = BasicData.getStationNameByCode(stationCode, prefix2);
  89 + return name;
  90 + }
  91 +
74 92 @Override
75 93 public Map<String, Object> delete(Long id) {
76 94 Map<String, Object> rs;
... ...
src/main/resources/static/pages/base/timesmodel/js/base-fun.js
... ... @@ -382,13 +382,14 @@ var BaseFun = function() {
382 382 *
383 383 *
384 384 **/
385   - abstractBcByWorkTime : function(bxlpbc , map , dataMap , saa , cara , bxrcObj , dgminpcs ,deletebcNum) {
  385 + abstractBcByWorkTime : function(bxlpbc , map , dataMap , saa , cara , bxrcObj , dgminpcs ,deletebcNum ,zwxeLpNum) {
386 386 var rsultA = new Array() , dgzjsj = baseF.getDateTime('13:00');
387 387 // 定义13:00 ~ 晚高峰开始以前剔除规则. 如果剔除的班次数不够,则去晚高峰之后剔除剩下的班次.
388 388 var xwmaxtcbcNum = parseInt(( dataMap.wgfsjd[0].st - dgzjsj) / (60000 * saa[0].zzsj.dgzzsj));
389 389 // 定义早高峰结束 ~ 13:00 剔除规则.如果剔除的班次数不够,则去晚高峰之后剔除剩下的班次.
390 390 var swmaxtcbcNum = parseInt(( dgzjsj - dataMap.zgfsjd[0].ed) / (60000 * saa[0].zzsj.dgzzsj));
391 391 var sumGs = 0;
  392 + dgminpcs = zwxeLpNum==0 ? bxlpbc.length : dgminpcs;
392 393 for(var a = 0 ; a < bxlpbc.length ; a++) {
393 394 // 定义该版型下对应的路牌的班次数组、班次数组长度、该路牌上是否有首末班车。
394 395 var lpbc = bxlpbc[a].lpbc, lpbclen_ = lpbc.length;
... ... @@ -396,6 +397,7 @@ var BaseFun = function() {
396 397 continue;
397 398 var isFlag = baseF.lpDownIsHaveFirstAndLastBc(lpbc , dataMap.smbcsjArr) , tcbcgzA = new Array();
398 399 if(bxrcObj.type == '五工二休') {
  400 + // continue;
399 401 // 定义晚高峰后能剔除多少班次数.
400 402 var wgfhtcbcNum = parseInt(( dataMap.wgfzhsjd[0].ed - dataMap.wgfsjd[0].ed ) / (60000 * saa[0].zzsj.dgzzsj));
401 403 if(isFlag) {
... ... @@ -409,11 +411,12 @@ var BaseFun = function() {
409 411 // 剔除不在高峰时间段内的班次.
410 412 baseF.spliceBc02(lpbc , tcbcgzA , dataMap , 'desc' , false);
411 413 }else {
  414 + //continue;
412 415 // 单档 一个路牌一档劳动力
413 416 if(bxlpbc[a].keepOff==1) {
414 417 // 如果低谷至少配车数大于零,则该班型下的路牌 存在一些 分班路牌,这里的分班 指的是 这个路牌先满足的前提条件就是 是单档。
415   - // 为了满足工时的要求,在低谷断开一段时间.
416   - if(dgminpcs > 0) {
  418 + // 为了满足工时的要求,在低谷断开一段时间.a <= dgminpcs
  419 + if(a <= dgminpcs) {
417 420 if( a % 2 == 0) {
418 421 if(deletebcNum < swmaxtcbcNum || isFlag) {
419 422 tcbcgzA.push({'minsj': dataMap.zgfsjd[0].ed , 'maxsj' : dgzjsj , 'order' : 'asc' , 'deletebcNum' : deletebcNum});
... ... @@ -433,10 +436,10 @@ var BaseFun = function() {
433 436 baseF.spliceBc02(lpbc , tcbcgzA , dataMap , true);
434 437 baseF.affimBzGs(lpbc , bxlpbc[a].bzgs, dataMap, saa , true , a);
435 438 // 该班型下的路牌 不存在分班路牌.
436   - }else if(dgminpcs == 0){
  439 + }else {
437 440 // 按规则剔除班次.不分班.路牌班次不会断开.
438 441 baseF.isdk02(lpbc , dataMap , saa , deletebcNum , false);
439   - //baseF.affimBzGs(lpbc , bxlpbc[a].bzgs, dataMap, saa , false , a);
  442 + baseF.affimBzGs(lpbc , bxlpbc[a].bzgs, dataMap, saa , false , a);
440 443 }
441 444 // 双档 一个路牌两档劳动力
442 445 }else if(bxlpbc[a].keepOff==2) {
... ... @@ -607,8 +610,10 @@ var BaseFun = function() {
607 610 // 判断是否在高峰时间范围.【true--表示在,false--表示不在】.
608 611 if(!baseF.isPeakTimeScope(fcsj,dataMap) && fcsj > tcbcgzA[t].minsj && fcsj < tcbcgzA[t].maxsj) {
609 612 if(order == 'asc') {
610   - arr[a-1].isfb = isfb ? 1 : 0;
611   - arr[a-1].STOPTIME = 0;
  613 + if(a>0) {
  614 + arr[a-1].isfb = isfb ? 1 : 0;
  615 + arr[a-1].STOPTIME = 0;
  616 + }
612 617 }else if(order == 'desc') {
613 618 var index_ = a + tcbcgzA[t].deletebcNum * 2;
614 619 arr[index_].STOPTIME = 0;
... ... @@ -637,6 +642,7 @@ var BaseFun = function() {
637 642 dgmaxtzsj = parseInt(map.dgmaxtzsj);
638 643 // 计算低谷最少配车数 (低谷上行行驶时间 + 低谷下行行驶时间 + 低谷最大停站时间*2) / 低谷最大发车间隙.
639 644 var dgminpcs = Math.round((dataMap.dgxxsjArr[0] + dataMap.dgxxsjArr[1] + dataMap.dgtzsj[0] + dataMap.dgtzsj[1]) / dgmaxfcjx);
  645 + var zwxeLpNum = baseF.cuontZwxeLpNum(bxrclist);
640 646 // var dgminpcs = 4;
641 647 // 定义返回数组.
642 648 var rs = new Array();
... ... @@ -711,12 +717,23 @@ var BaseFun = function() {
711 717 avgMakerCarNum = parseInt(avgMakerCarNum / bxlpbc.length);
712 718 // console.log(bxlpbc);
713 719 // 调整某班型下的各个路牌对应的班次以及工时、停站时间、是否分班.
714   - rs = rs.concat(baseF.abstractBcByWorkTime(bxlpbc , map , dataMap , saa , cara , bxrclist[x] , dgminpcs , avgMakerCarNum));
  720 + rs = rs.concat(baseF.abstractBcByWorkTime(bxlpbc , map , dataMap , saa , cara , bxrclist[x] , dgminpcs , avgMakerCarNum ,zwxeLpNum));
715 721 }
716 722 }
717 723 return rs;
718 724 },
719 725  
  726 + cuontZwxeLpNum : function(list) {
  727 + var count = 0;
  728 + for(var c = 0 ; c<list.length;c++) {
  729 + if(list[c].type == '五工二休') {
  730 + count = list[c].fpcls;
  731 + break;
  732 + }
  733 + }
  734 + return count;
  735 + },
  736 +
720 737 /**
721 738 * @description (TODO) 更新路牌数组的路牌名称.
722 739 * @param cara 路牌数组
... ... @@ -778,17 +795,15 @@ var BaseFun = function() {
778 795 // 第一步 根据表单中的参数得到所有路牌下的班次数[从各路牌下的第一个班次发车时间 到 营运结束时间点并且是连续的班次数].
779 796 var allLMapBc = baseF.GetByArgusInitAllLpDownedBcCollections(saa , cara , map , seMap , dataMap);
780 797  
781   - // return {'json':jsonArray,'bxrcgs':null};
782   -
783 798 // 第二步 纵向调整
784 799 baseF.evenStartDepartSpace(allLMapBc , dataMap);
785 800  
786 801 // 第三步 剔除首末班车以外的班次,并确认首末班车.
787 802 var markArray = baseF.markFirstAndLastBusAlsoDietNotInRangeBc(allLMapBc , dataMap);
788   -
  803 + // return {'json':markArray,'bxrcgs':null};
789 804 // 第四步 横向调整
790 805 baseF.resizeByPitStopTime(cara , markArray , dataMap);
791   -
  806 + // return {'json':markArray,'bxrcgs':null};
792 807 /**
793 808 * 第五步 把班型合理的分配到各个路牌上.
794 809 *
... ... @@ -798,17 +813,13 @@ var BaseFun = function() {
798 813 */
799 814 // 切割班型/人次/配车数 字符串 为 数组对象.
800 815 var list = baseF.getBxRcListCollection(map.bxrc);
801   -
802 816 // 把班型分配到对应的具体路牌上.
803 817 baseF.bxAlloTotLp(list,cara);
804   -
805 818 // 第六步 抽车来满足工时.
806 819 var tempA = baseF.abstractCar(list , markArray , cara , saa , dataMap , map);
807   -
  820 + // return {'json':tempA,'bxrcgs':null};
808 821 // 第七步 确定吃饭时间.
809 822 baseF.markeEatTime(list , tempA , cara , saa , dataMap ,map);
810   -
811   -
812 823 baseF.resizeByPitStopTime(cara , tempA , dataMap);
813 824 baseF.updfcno01(tempA,0);
814 825 // return {'json':tempA,'bxrcgs':null};
... ... @@ -1064,12 +1075,13 @@ var BaseFun = function() {
1064 1075 var lLen = list.length , cLen = clzs.length;
1065 1076 if(lLen<= 0 || cLen<=0 )
1066 1077 return false;
1067   - // 最多车次与总车次的比例.
1068   - var blnum = Math.round(cLen/list[0].fpcls);
  1078 + list.sort(function(a,b){return a.fpcls-b.fpcls});
1069 1079 // 定义已经分配出去的路牌.
1070 1080 var rs = new Array();
1071 1081 // 遍历
1072 1082 for(var r = 0 ; r < lLen ; r++) {
  1083 + // 车次与总车次的比例.
  1084 + var blnum = Math.round(cLen/list[r].fpcls);
1073 1085 // 得到没有分配出去的路牌.
1074 1086 var dxa = baseF.chaji_array(clzs,rs);
1075 1087 // 定义当前车次数.
... ... @@ -1077,29 +1089,32 @@ var BaseFun = function() {
1077 1089 // 定义记录当前分割路牌的次数下标.分配到班型车次下的路牌数组.
1078 1090 var index = 0 , sslp = new Array();
1079 1091 // 当前车次所有占比例.
1080   - var tempint = parseInt(rsnum/blnum);
  1092 + //var tempint = parseInt(rsnum/blnum);
1081 1093 // 判断如果比例小1 则为当前车次数.
1082   - blnum = tempint <= 1 ? rsnum : blnum;
  1094 + //blnum = tempint <= 1 ? rsnum : blnum;
1083 1095 // 判断当前班型车次数组下标值.如果为倒数第二个或者之前.
1084 1096 if(r < lLen-1) {
1085 1097 // 遍历
1086   - for(var c = 0 ; c < tempint ; c++) {
  1098 + for(var c = 0 ; c < rsnum ; c++) {
1087 1099 // 创建新的没有分配出去的路牌数组.
1088 1100 var temp = dxa.concat();
1089 1101 // 创建切割路牌数组.
1090 1102 var tagA = new Array();
1091 1103 // 判断切割的下标值是否小于等于路牌数组的倒数第二个或者之前.
1092 1104 if(index <= (dxa.length-blnum) ) {
1093   - tagA = temp.splice(index,blnum);
  1105 + /*tagA = temp.splice(index,blnum);*/
  1106 + tagA = temp.splice(index,1);
1094 1107 }else {
1095   - tagA = temp.splice((dxa.length-blnum),blnum);
  1108 + /*tagA = temp.splice((dxa.length-blnum),blnum);*/
  1109 + tagA = temp.splice((dxa.length-blnum),1);
1096 1110 }
1097 1111 // 组合切割路牌数组.赋值给已分配出去的路牌.
1098 1112 rs = rs.concat(tagA);
1099 1113 // 赋值给分配到班型车次下的路牌数组.
1100 1114 sslp = sslp.concat(tagA);
1101 1115 // 记录切割下标.
1102   - index = index + 1 + blnum;
  1116 + index = index + blnum;
  1117 + // index = index + blnum;
1103 1118 }
1104 1119 // 分配到班型车次下的路牌数组.
1105 1120 list[r].sslp = sslp;
... ... @@ -1302,10 +1317,10 @@ var BaseFun = function() {
1302 1317 var sgbcfcsj = baseF.getDateTime(sslpbcA[r+1].fcsj),
1303 1318 dqbcddsj = baseF.getDateTime(sslpbcA[r].ARRIVALTIME),
1304 1319 dqbcfcsj = baseF.getDateTime(sslpbcA[r].fcsj);
  1320 + // 定义当前班次方向下标代码[0代表上行;1代表下行].
  1321 + var cctag = baseF.dirDmToIndex(sslpbcA[r].xlDir); // dataMap.smbcsjArr
1305 1322 // 定义每每相邻两个班次之间的时间差分钟数(也就是停站时间.)
1306 1323 var dxmin = parseInt( (sgbcfcsj - dqbcddsj)/60000);
1307   - // 定义当前班次方向下标代码[0代表上行;1代表下行].
1308   - var cctag = baseF.dirDmToIndex(sslpbcA[r].xlDir);
1309 1324 // 定义是否高峰
1310 1325 var flag = baseF.isPeakTimeScope(dqbcfcsj , dataMap);
1311 1326 // 获取行驶时间.
... ... @@ -1348,22 +1363,41 @@ var BaseFun = function() {
1348 1363 }
1349 1364 }
1350 1365 if(flag) {
1351   - // 修改当前班次的停站时间.
1352   - sslpbcA[r].STOPTIME = parseInt(dxmin) ;
1353   - // 当前班次的到达时间 + 停站时间 作为下一个班次的发车时间.
1354   - dqbcddsj.setMinutes(dqbcddsj.getMinutes() + dxmin);
1355   - // 修改下一个班次的发车时间.
1356   - sslpbcA[r+1].fcsj = baseF.getTimeStr(dqbcddsj);
1357   - // 下一个班次的发车时间 + 行驶时间 作为下一个班次的到达时间.
1358   - dqbcddsj.setMinutes(dqbcddsj.getMinutes() + sslpbcA[r+1].bcsj);
1359   - // 修改下一个班次的到达时间.
1360   - sslpbcA[r+1].ARRIVALTIME = baseF.getTimeStr(dqbcddsj);
  1366 + if(!baseF.isDirSmbc(baseF.dirDmToIndex(sslpbcA[r+1].xlDir) , sslpbcA[r+1].fcsj , dataMap)) {
  1367 + // 修改当前班次的停站时间.
  1368 + sslpbcA[r].STOPTIME = parseInt(dxmin) ;
  1369 + // 当前班次的到达时间 + 停站时间 作为下一个班次的发车时间.
  1370 + dqbcddsj.setMinutes(dqbcddsj.getMinutes() + dxmin);
  1371 + // 修改下一个班次的发车时间.
  1372 + sslpbcA[r+1].fcsj = baseF.getTimeStr(dqbcddsj);
  1373 + // 下一个班次的发车时间 + 行驶时间 作为下一个班次的到达时间.
  1374 + dqbcddsj.setMinutes(dqbcddsj.getMinutes() + sslpbcA[r+1].bcsj);
  1375 + // 修改下一个班次的到达时间.
  1376 + sslpbcA[r+1].ARRIVALTIME = baseF.getTimeStr(dqbcddsj);
  1377 + }else {
  1378 + if(r>0) {
  1379 + // 修改当前班次的停站时间.
  1380 + sslpbcA[r].STOPTIME = parseInt(dxmin) ;
  1381 + sgbcfcsj.setMinutes(sgbcfcsj.getMinutes() - sslpbcA[r].STOPTIME);
  1382 + sslpbcA[r].ARRIVALTIME = baseF.getTimeStr(sgbcfcsj);
  1383 + sgbcfcsj.setMinutes(sgbcfcsj.getMinutes() - sslpbcA[r].bcsj);
  1384 + sslpbcA[r].fcsj = baseF.getTimeStr(sgbcfcsj);
  1385 + sslpbcA[r-1].STOPTIME = parseInt( ( sgbcfcsj - baseF.getDateTime(sslpbcA[r-1].ARRIVALTIME))/60000);
  1386 + }
  1387 + }
1361 1388 }
1362 1389 }
1363 1390 }
1364 1391 }
1365 1392 },
1366 1393  
  1394 + isDirSmbc : function(dirDm , fcsj , dataMap) {
  1395 + var falg = false;
  1396 + if(fcsj == dataMap.smbcsjArr[dirDm].kssj || fcsj == dataMap.smbcsjArr[dirDm].jssj)
  1397 + falg = true;
  1398 + return falg;
  1399 + },
  1400 +
1367 1401 BXPplaceClassesTime01 : function(saa,cara,map,seMap,dataMap,lpNoA) {
1368 1402 var jsonArray = baseF.plgfbc(saa,cara,map,seMap,dataMap);
1369 1403 var list = baseF.splitBxRc(map.bxrc);
... ...
src/main/resources/static/pages/base/timesmodel/js/gantt.js
... ... @@ -420,7 +420,8 @@
420 420 * @return 返回甘特图的参数配置信息.
421 421 * */
422 422 function getGraphArgus(p) {
423   - var MULTIPLE = Math.round(105/parseInt(p.stopAraay[0].sxsj)) >=4 ? Math.round(90/parseInt(p.stopAraay[0].sxsj)) : Math.round(90/parseInt(p.stopAraay[0].sxsj)) *2;
  423 + var bs = p.stopAraay[0].sxsj > 40 ? 4 : 2;
  424 + var MULTIPLE = Math.round(105/parseInt(p.stopAraay[0].sxsj)) >3 ? Math.round(90/parseInt(p.stopAraay[0].sxsj)) : Math.round(90/parseInt(p.stopAraay[0].sxsj)) *bs;
424 425 var VALUEKEYNAME = 'Worldwide Gross' ,
425 426 DXHOURS = 24,MINUTE = 60,WIDTH = DXHOURS*MINUTE,MARGINLEFT = 380,HEIGHT = p.yAxisCarArray.length*60 + 240,
426 427 MARGINBOTTOM = 240,OFFSETX = 90,OFFSETY = 180,OFFSETUPY = 120,OFFSETDOWNY = 60,
... ...
src/main/resources/static/pages/scheduleApp/Gruntfile.js
... ... @@ -87,7 +87,8 @@ module.exports = function (grunt) {
87 87 'module/common/dts2/bcGroup/saBcgroup.js', // 班次选择整合指令
88 88 'module/common/dts2/ttinfotable/saTimeTable.js', // 时刻表显示指令
89 89 'module/common/dts2/scheduleplan/saScpdate.js', // saScpdate指令(非通用指令,只在排版计划form中使用)
90   - 'module/common/dts2/scheduleplan/saPlaninfoedit.js' // saPlaninfoedit指令(非通用指令,只在调度执勤日报中使用)
  90 + 'module/common/dts2/scheduleplan/saPlaninfoedit.js', // saPlaninfoedit指令(非通用指令,只在调度执勤日报中使用)
  91 + 'module/common/dts2/scheduleplan/saPlaninfoedit2.js' // saPlaninfoedit2指令(非通用指令,只在调度执勤日报中使用)
91 92 ],
92 93 dest: 'module/common/prj-common-directive.js'
93 94 },
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
... ... @@ -196,8 +196,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
196 196 */
197 197 scope[ctrlAs].$$internal_validate_model = function() {
198 198 // TODO:
199   - console.log(scope[ctrlAs].$$internal_select_value);
200   - console.log(scope[ctrlAs].$$data_real);
  199 + //console.log(scope[ctrlAs].$$internal_select_value);
  200 + //console.log(scope[ctrlAs].$$data_real);
201 201  
202 202 if (scope[ctrlAs].$$internal_select_value) {
203 203 var select_value_temp = scope[ctrlAs].$$internal_select_value;
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saPlanInfoEdit2.js 0 → 100644
  1 +/**
  2 + * saPlaninfoedit2指令,排班明细编辑控件,用在调度执勤日报的修改功能
  3 + * name(必须),控件的名字
  4 + * ds,外部数据源
  5 + * fd, 表单数据源
  6 + */
  7 +angular.module('ScheduleApp').directive(
  8 + 'saPlaninfoedit2',
  9 + [
  10 + function() {
  11 + return {
  12 + restrict: 'E',
  13 + templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saPlaninfoeditTemplate.html',
  14 + scope: { // 独立作用域
  15 + ds: '=ngModel', // 时刻明细数据源头
  16 + fd: '=formData' // 表单数据源(车辆、驾驶员、售票员信息)
  17 + },
  18 + controllerAs: '$saPlanInfoEditCtrl',
  19 + bindToController: true,
  20 + controller: function() {
  21 + //var self = this;
  22 +
  23 + },
  24 +
  25 + compile: function(tElem, tAttrs) {
  26 + // 获取属性
  27 + var $attr_name = tAttrs["name"]; // 控件的名字
  28 + if (!$attr_name) {
  29 + throw {msg: "saPlaninfoedit2指令name属性不能为空"};
  30 + }
  31 +
  32 + // 内部controlAs名字
  33 + var ctrlAs = '$saPlanInfoEditCtrl';
  34 +
  35 +
  36 + // 内部变量,原始车辆,人员数据
  37 + var old_cl = {}; // key:{车辆id_车辆自编号},value:所在list下标数组
  38 + var old_j = {}; // key:{驾驶员id_姓名_工号}, value:所在list下标数组
  39 + var old_s = {}; // key:{售票员id_姓名_工号}, value:所在list下标数组
  40 + var old_isfb = false; // 是否有分班
  41 + var old_isfb_index = 0; // 分班开始索引
  42 + var old_hasJCBC = false; // 是否有进场班次
  43 + var old_max_fcno = 0; // 最大发车顺序号
  44 + var old_firstJCBCFcno = 0; // 第一个进场班次发车顺序号
  45 + var old_half_bcs = 0; // 一般的班次数量
  46 +
  47 + // 内部变量,变更的车辆,变更的人员
  48 + var new_cl1 = undefined; // 新的车辆1(车辆id_车辆自编号)
  49 + var new_cl2 = undefined; // 新的车辆2(车辆id_车辆自编号)
  50 + var new_j1 = undefined; // 新的驾驶员1(驾驶员id_姓名_工号)
  51 + var new_j2 = undefined; // 新的驾驶员2(驾驶员id_姓名_工号)
  52 + var new_s1 = undefined; // 新的售票员1(售票员id_姓名_工号)
  53 + var new_s2 = undefined; // 新的售票员2(售票员id_姓名_工号)
  54 +
  55 +
  56 + // 表单值,被赋值的次数
  57 + var form_data_assign_count = {
  58 + cl1 : 1,
  59 + cl2 : 1,
  60 + j1 : 1,
  61 + j2 : 1,
  62 + j3 : 1,
  63 + s1 : 1,
  64 + s2 : 1,
  65 + s3 : 1
  66 + };
  67 +
  68 + return {
  69 + pre: function(scope, element, attr) {
  70 +
  71 + },
  72 + post: function(scope, element, attr) {
  73 +
  74 + /**
  75 + * 刷新车辆数据。
  76 + */
  77 + scope[ctrlAs].$$internal_refresh_dsdata_cl = function() {
  78 + if (new_cl1) {
  79 + var new_cl1_id = new_cl1.split("_")[0];
  80 + var new_cl1_zbh = new_cl1.split("_")[1];
  81 +
  82 + if (new_cl2) {
  83 + var new_cl2_id = new_cl2.split("_")[0];
  84 + var new_cl2_zbh = new_cl2.split("_")[1];
  85 +
  86 + if (old_isfb) { // 使用分班判定
  87 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  88 + if (index < old_isfb_index) {
  89 + obj.cl = new_cl1_id;
  90 + obj.clZbh = new_cl1_zbh;
  91 + } else {
  92 + obj.cl = new_cl2_id;
  93 + obj.clZbh = new_cl2_zbh;
  94 + }
  95 + });
  96 +
  97 + } else if (old_hasJCBC && old_firstJCBCFcno < old_max_fcno) { // 使用进出场判定
  98 + angular.forEach(scope[ctrlAs].ds, function(obj) {
  99 + if (obj.fcno <= old_firstJCBCFcno) {
  100 + obj.cl = new_cl1_id;
  101 + obj.clZbh = new_cl1_zbh;
  102 + } else {
  103 + obj.cl = new_cl2_id;
  104 + obj.clZbh = new_cl2_zbh;
  105 + }
  106 + });
  107 + } else { // 使用一半一半班次判定
  108 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  109 + if (index < old_half_bcs) {
  110 + obj.cl = new_cl1_id;
  111 + obj.clZbh = new_cl1_zbh;
  112 + } else {
  113 + obj.cl = new_cl2_id;
  114 + obj.clZbh = new_cl2_zbh;
  115 + }
  116 + });
  117 + }
  118 +
  119 + } else {
  120 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  121 + obj.cl = new_cl1_id;
  122 + obj.clZbh = new_cl1_zbh;
  123 + });
  124 + }
  125 +
  126 + } else {
  127 + // 清空,不使用旧的
  128 + angular.forEach(old_cl, function(value, key) {
  129 + angular.forEach(value, function(i) {
  130 + //scope[ctrlAs].ds[i].cl = key.split("_")[0];
  131 + //scope[ctrlAs].ds[i].clZbh = key.split("_")[1];
  132 + scope[ctrlAs].ds[i].cl = undefined;
  133 + scope[ctrlAs].ds[i].clZbh = undefined;
  134 + });
  135 + });
  136 + }
  137 + };
  138 +
  139 + /**
  140 + * 刷新驾驶员数据。
  141 + */
  142 + scope[ctrlAs].$$internal_refresh_dsdata_j = function() {
  143 + if (new_j1) {
  144 + var new_j1_id = new_j1.split("_")[0];
  145 + var new_j1_name = new_j1.split("_")[1];
  146 + var new_j1_gh = new_j1.split("_")[2];
  147 + if (new_j1_gh && new_j1_gh.indexOf("-") > 0) {
  148 + new_j1_gh = new_j1_gh.substr(3); // 修正工号,把 55- 这种前缀去掉
  149 + }
  150 +
  151 + if (new_j2) {
  152 + var new_j2_id = new_j2.split("_")[0];
  153 + var new_j2_name = new_j2.split("_")[1];
  154 + var new_j2_gh = new_j2.split("_")[2];
  155 + if (new_j2_gh && new_j2_gh.indexOf("-") > 0) {
  156 + new_j2_gh = new_j2_gh.substr(3); // 修正工号,把 55- 这种前缀去掉
  157 + }
  158 +
  159 + if (old_isfb) { // 使用分班判定
  160 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  161 + if (index < old_isfb_index) {
  162 + obj.j = new_j1_id;
  163 + obj.jGh = new_j1_gh;
  164 + obj.jName = new_j1_name;
  165 + } else {
  166 + obj.j = new_j2_id;
  167 + obj.jGh = new_j2_gh;
  168 + obj.jName = new_j2_name;
  169 + }
  170 + });
  171 +
  172 + } else if (old_hasJCBC && old_firstJCBCFcno < old_max_fcno) { // 使用进出场判定
  173 + angular.forEach(scope[ctrlAs].ds, function(obj) {
  174 + if (obj.fcno <= old_firstJCBCFcno) {
  175 + obj.j = new_j1_id;
  176 + obj.jGh = new_j1_gh;
  177 + obj.jName = new_j1_name;
  178 + } else {
  179 + obj.j = new_j2_id;
  180 + obj.jGh = new_j2_gh;
  181 + obj.jName = new_j2_name;
  182 + }
  183 + });
  184 + } else { // 使用一半一半班次判定
  185 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  186 + if (index < old_half_bcs) {
  187 + obj.j = new_j1_id;
  188 + obj.jGh = new_j1_gh;
  189 + obj.jName = new_j1_name;
  190 + } else {
  191 + obj.j = new_j2_id;
  192 + obj.jGh = new_j2_gh;
  193 + obj.jName = new_j2_name;
  194 + }
  195 + });
  196 + }
  197 +
  198 + } else {
  199 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  200 + obj.j = new_j1_id;
  201 + obj.jGh = new_j1_gh;
  202 + obj.jName = new_j1_name;
  203 + });
  204 + }
  205 +
  206 + } else {
  207 + // 清空,不使用使用旧的
  208 + angular.forEach(old_j, function(value, key) {
  209 + angular.forEach(value, function(i) {
  210 + //scope[ctrlAs].ds[i].j = key.split("_")[0];
  211 + //scope[ctrlAs].ds[i].jName = key.split("_")[1];
  212 + //scope[ctrlAs].ds[i].jGh = key.split("_")[2];
  213 + scope[ctrlAs].ds[i].j = undefined;
  214 + scope[ctrlAs].ds[i].jName = undefined;
  215 + scope[ctrlAs].ds[i].jGh = undefined;
  216 + });
  217 + });
  218 + }
  219 + };
  220 +
  221 + /**
  222 + * 刷新售票员数据(和驾驶员配对的,有驾驶员,才有售票员)。
  223 + */
  224 + scope[ctrlAs].$$internal_refresh_dsdata_s = function() {
  225 + var j_id = undefined;
  226 + var s_id = undefined;
  227 + var s_gh = undefined;
  228 + var s_name = undefined;
  229 +
  230 + if (new_j1) {
  231 + j_id = new_j1.split("_")[0];
  232 + if (new_s1) {
  233 + s_id = new_s1.split("_")[0];
  234 + s_name = new_s1.split("_")[1];
  235 + s_gh = new_s1.split("_")[2];
  236 + if (s_gh && s_gh.indexOf("-") > 0) { // 修正工号,把 55- 这种前缀去掉
  237 + s_gh = s_gh.substr(3);
  238 + }
  239 + } else {
  240 + s_id = undefined;
  241 + s_gh = undefined;
  242 + s_name = undefined
  243 + }
  244 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  245 + if (obj.j == j_id) {
  246 + obj.s = s_id;
  247 + obj.sGh = s_gh;
  248 + obj.sName = s_name;
  249 + }
  250 + });
  251 + }
  252 + if (new_j2) {
  253 + j_id = new_j2.split("_")[0];
  254 + if (new_s2) {
  255 + s_id = new_s2.split("_")[0];
  256 + s_name = new_s2.split("_")[1];
  257 + s_gh = new_s2.split("_")[2];
  258 + if (s_gh && s_gh.indexOf("-") > 0) { // 修正工号,把 55- 这种前缀去掉
  259 + s_gh = s_gh.substr(3);
  260 + }
  261 + } else {
  262 + s_id = undefined;
  263 + s_gh = undefined;
  264 + s_name = undefined
  265 + }
  266 +
  267 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  268 + if (obj.j == j_id) {
  269 + obj.s = s_id;
  270 + obj.sGh = s_gh;
  271 + obj.sName = s_name;
  272 + }
  273 + });
  274 + }
  275 + };
  276 +
  277 +
  278 + //-------------- 监控表单车辆1的变化 ----------------//
  279 + scope.$watch(
  280 + function() {
  281 + return scope[ctrlAs].fd.cl1;
  282 + },
  283 + function(newValue, oldValue) {
  284 + // 初始化new_cl1
  285 + if (newValue.id) {
  286 + if (newValue.id && newValue.zbh) {
  287 + new_cl1 = newValue.id + "_" + newValue.zbh;
  288 + } else {
  289 + new_cl1 = undefined;
  290 + }
  291 + } else {
  292 + new_cl1 = undefined;
  293 + }
  294 +
  295 + scope[ctrlAs].$$internal_refresh_dsdata_cl();
  296 + },
  297 + true
  298 + );
  299 +
  300 + //-------------- 监控表单车辆2的变化 ----------------//
  301 + scope.$watch(
  302 + function() {
  303 + return scope[ctrlAs].fd.cl2;
  304 + },
  305 + function(newValue, oldValue) {
  306 + // 初始化new_cl2
  307 + if (newValue.id) {
  308 + if (newValue.id && newValue.zbh) {
  309 + new_cl2 = newValue.id + "_" + newValue.zbh;
  310 + } else {
  311 + new_cl2 = undefined;
  312 + }
  313 + } else {
  314 + new_cl2 = undefined;
  315 + }
  316 +
  317 + scope[ctrlAs].$$internal_refresh_dsdata_cl();
  318 + },
  319 + true
  320 + );
  321 +
  322 + //-------------- 监控表单驾驶员1的变化 ----------------//
  323 + scope.$watch(
  324 + function() {
  325 + return scope[ctrlAs].fd.j1;
  326 + },
  327 + function(newValue, oldValue) {
  328 + // 初始化j1
  329 + if (newValue.id) {
  330 + if (newValue.id && newValue.name && newValue.jobCode) {
  331 + new_j1 = newValue.id + "_" + newValue.name + "_" + newValue.jobCode;
  332 + } else {
  333 + new_j1 = undefined;
  334 + }
  335 + } else {
  336 + new_j1 = undefined;
  337 + }
  338 +
  339 + scope[ctrlAs].$$internal_refresh_dsdata_j();
  340 + scope[ctrlAs].$$internal_refresh_dsdata_s();
  341 + },
  342 + true
  343 + );
  344 +
  345 + //-------------- 监控表单售票员1的变化 ----------------//
  346 + scope.$watch(
  347 + function() {
  348 + return scope[ctrlAs].fd.s1;
  349 + },
  350 + function(newValue, oldValue) {
  351 + // 初始化s1
  352 + if (newValue.id) {
  353 + if (newValue.id && newValue.name && newValue.jobCode) {
  354 + new_s1 = newValue.id + "_" + newValue.name + "_" + newValue.jobCode;
  355 + } else {
  356 + new_s1 = undefined;
  357 + }
  358 + } else {
  359 + new_s1 = undefined;
  360 + }
  361 + scope[ctrlAs].$$internal_refresh_dsdata_j();
  362 + scope[ctrlAs].$$internal_refresh_dsdata_s();
  363 + },
  364 + true
  365 + );
  366 +
  367 + //-------------- 监控表单驾驶员2的变化 ----------------//
  368 + scope.$watch(
  369 + function() {
  370 + return scope[ctrlAs].fd.j2;
  371 + },
  372 + function(newValue, oldValue) {
  373 + // 初始化j2
  374 + if (newValue.id) {
  375 + if (newValue.id && newValue.name && newValue.jobCode) {
  376 + new_j2 = newValue.id + "_" + newValue.name + "_" + newValue.jobCode;
  377 + } else {
  378 + new_j2 = undefined;
  379 + }
  380 + } else {
  381 + new_j2 = undefined;
  382 + }
  383 +
  384 + scope[ctrlAs].$$internal_refresh_dsdata_j();
  385 + scope[ctrlAs].$$internal_refresh_dsdata_s();
  386 + },
  387 + true
  388 + );
  389 +
  390 + //-------------- 监控表单售票员2的变化 ----------------//
  391 + scope.$watch(
  392 + function() {
  393 + return scope[ctrlAs].fd.s2;
  394 + },
  395 + function(newValue, oldValue) {
  396 + // 初始化s2
  397 + if (newValue && newValue.id) {
  398 + if (newValue.id && newValue.name && newValue.jobCode) {
  399 + new_s2 = newValue.id + "_" + newValue.name + "_" + newValue.jobCode;
  400 + } else {
  401 + new_s2 = undefined;
  402 + }
  403 + } else {
  404 + new_s2 = undefined;
  405 + }
  406 +
  407 + scope[ctrlAs].$$internal_refresh_dsdata_j();
  408 + scope[ctrlAs].$$internal_refresh_dsdata_s();
  409 + },
  410 + true
  411 + );
  412 +
  413 + //-------------------- 监控ds的变化,更新数据源,初始化formdata的数据 ---------------//
  414 + scope.$watch(
  415 + function() {
  416 + return scope[ctrlAs].ds;
  417 + },
  418 + function(newValue, oldValue) {
  419 + if (newValue && newValue.length > 0) {
  420 + var j1 = newValue[0].j;
  421 +
  422 + var cl_ids = []; // 车辆ids数组(有顺序)
  423 + var j_s_ids = []; // 驾驶员ids,售票员ids,[{j:id,s:id},...](有顺序)
  424 + var isRepeat = false;
  425 + var i = 0;
  426 +
  427 + angular.forEach(newValue, function(obj, index) {
  428 + var k1 = obj.cl + "_" + obj.clZbh;
  429 + var k2 = !obj.j? undefined: obj.j + "_" + obj.jName + "_" + obj.jGh;
  430 + var k3 = !obj.s? undefined: obj.s + "_" + obj.sName + "_" + obj.sGh;
  431 +
  432 + if (!old_cl[k1]) {
  433 + old_cl[k1] = [];
  434 + }
  435 + if (!old_j[k2] && k2) {
  436 + old_j[k2] = [];
  437 + }
  438 + if (!old_s[k3] && k3) {
  439 + old_s[k3] = [];
  440 + }
  441 +
  442 + // 闭包
  443 + (function(i) {
  444 + old_cl[k1].push(i);
  445 + if (k2) {
  446 + old_j[k2].push(i);
  447 + }
  448 + if (k3) {
  449 + old_s[k3].push(i);
  450 + }
  451 + })(index);
  452 +
  453 + // 判断是否分班
  454 + if (j1 != obj.j && !old_isfb) {
  455 + old_isfb = true;
  456 + old_isfb_index = index;
  457 + }
  458 +
  459 + // 判断进出场
  460 + if (obj.bcType == 'in' && !old_hasJCBC) {
  461 + old_hasJCBC = true;
  462 + old_firstJCBCFcno = obj.fcno;
  463 + }
  464 +
  465 + //-------------- formdata用数据处理 -------------//
  466 + // 车辆处理
  467 + isRepeat = false;
  468 + if (obj.cl) {
  469 + for (i = 0; i < cl_ids.length; i++) {
  470 + if (cl_ids[i] == obj.cl) {
  471 + isRepeat = true;
  472 + break;
  473 + }
  474 + }
  475 + if (!isRepeat) {
  476 + cl_ids.push(obj.cl);
  477 + }
  478 + }
  479 +
  480 + // 人员处理(以驾驶员id为主,没有的话,售票员不管了)
  481 + isRepeat = false;
  482 + if (obj.j) {
  483 + for (i = 0; i < j_s_ids.length; i++) {
  484 + if (j_s_ids[i].j == obj.j) {
  485 + isRepeat = true;
  486 + break;
  487 + }
  488 + }
  489 + if (!isRepeat) {
  490 + j_s_ids.push({
  491 + j: obj.j,
  492 + s: !obj.s? undefined: obj.s
  493 + });
  494 + }
  495 + }
  496 + });
  497 +
  498 + old_max_fcno = newValue[newValue.length - 1].fcno;
  499 + old_half_bcs = newValue.length / 2;
  500 +
  501 + // 更新formdata
  502 + for (i = 0; i < cl_ids.length; i++) { // 车辆更新前两辆
  503 + if (i >= 2) {
  504 + break;
  505 + } else {
  506 + form_data_assign_count["cl" + (i + 1)] = 0;
  507 + scope[ctrlAs].fd["cl" + (i + 1)].id = cl_ids[i];
  508 + }
  509 + }
  510 + for (i = 0; i < j_s_ids.length; i++) { // 人员更新
  511 + if (i >= 3) {
  512 + break;
  513 + } else {
  514 + form_data_assign_count["j" + (i + 1)] = 0;
  515 + scope[ctrlAs].fd["j" + (i + 1)].id = j_s_ids[i].j;
  516 +
  517 + form_data_assign_count["s" + (i + 1)] = 0;
  518 + scope[ctrlAs].fd["s" + (i + 1)].id = j_s_ids[i].s;
  519 + }
  520 + }
  521 + }
  522 + }
  523 + );
  524 + }
  525 + }
  526 + }
  527 + };
  528 + }
  529 + ]
  530 +);
0 531 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -1501,8 +1501,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1501 1501 */
1502 1502 scope[ctrlAs].$$internal_validate_model = function() {
1503 1503 // TODO:
1504   - console.log(scope[ctrlAs].$$internal_select_value);
1505   - console.log(scope[ctrlAs].$$data_real);
  1504 + //console.log(scope[ctrlAs].$$internal_select_value);
  1505 + //console.log(scope[ctrlAs].$$data_real);
1506 1506  
1507 1507 if (scope[ctrlAs].$$internal_select_value) {
1508 1508 var select_value_temp = scope[ctrlAs].$$internal_select_value;
... ... @@ -1515,7 +1515,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1515 1515 }
1516 1516 }
1517 1517 if (obj) { // 在data中判定有没有
1518   - // TODO:
  1518 + // 初始化的时候,模拟选中uiselect
1519 1519 scope[ctrlAs].$$internal_select_fn(obj);
1520 1520  
1521 1521 for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
... ... @@ -4771,4 +4771,534 @@ angular.module(&#39;ScheduleApp&#39;).directive(
4771 4771 };
4772 4772 }
4773 4773 ]
  4774 +);
  4775 +/**
  4776 + * saPlaninfoedit2指令,排班明细编辑控件,用在调度执勤日报的修改功能
  4777 + * name(必须),控件的名字
  4778 + * ds,外部数据源
  4779 + * fd, 表单数据源
  4780 + */
  4781 +angular.module('ScheduleApp').directive(
  4782 + 'saPlaninfoedit2',
  4783 + [
  4784 + function() {
  4785 + return {
  4786 + restrict: 'E',
  4787 + templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saPlaninfoeditTemplate.html',
  4788 + scope: { // 独立作用域
  4789 + ds: '=ngModel', // 时刻明细数据源头
  4790 + fd: '=formData' // 表单数据源(车辆、驾驶员、售票员信息)
  4791 + },
  4792 + controllerAs: '$saPlanInfoEditCtrl',
  4793 + bindToController: true,
  4794 + controller: function() {
  4795 + //var self = this;
  4796 +
  4797 + },
  4798 +
  4799 + compile: function(tElem, tAttrs) {
  4800 + // 获取属性
  4801 + var $attr_name = tAttrs["name"]; // 控件的名字
  4802 + if (!$attr_name) {
  4803 + throw {msg: "saPlaninfoedit2指令name属性不能为空"};
  4804 + }
  4805 +
  4806 + // 内部controlAs名字
  4807 + var ctrlAs = '$saPlanInfoEditCtrl';
  4808 +
  4809 +
  4810 + // 内部变量,原始车辆,人员数据
  4811 + var old_cl = {}; // key:{车辆id_车辆自编号},value:所在list下标数组
  4812 + var old_j = {}; // key:{驾驶员id_姓名_工号}, value:所在list下标数组
  4813 + var old_s = {}; // key:{售票员id_姓名_工号}, value:所在list下标数组
  4814 + var old_isfb = false; // 是否有分班
  4815 + var old_isfb_index = 0; // 分班开始索引
  4816 + var old_hasJCBC = false; // 是否有进场班次
  4817 + var old_max_fcno = 0; // 最大发车顺序号
  4818 + var old_firstJCBCFcno = 0; // 第一个进场班次发车顺序号
  4819 + var old_half_bcs = 0; // 一般的班次数量
  4820 +
  4821 + // 内部变量,变更的车辆,变更的人员
  4822 + var new_cl1 = undefined; // 新的车辆1(车辆id_车辆自编号)
  4823 + var new_cl2 = undefined; // 新的车辆2(车辆id_车辆自编号)
  4824 + var new_j1 = undefined; // 新的驾驶员1(驾驶员id_姓名_工号)
  4825 + var new_j2 = undefined; // 新的驾驶员2(驾驶员id_姓名_工号)
  4826 + var new_s1 = undefined; // 新的售票员1(售票员id_姓名_工号)
  4827 + var new_s2 = undefined; // 新的售票员2(售票员id_姓名_工号)
  4828 +
  4829 +
  4830 + // 表单值,被赋值的次数
  4831 + var form_data_assign_count = {
  4832 + cl1 : 1,
  4833 + cl2 : 1,
  4834 + j1 : 1,
  4835 + j2 : 1,
  4836 + j3 : 1,
  4837 + s1 : 1,
  4838 + s2 : 1,
  4839 + s3 : 1
  4840 + };
  4841 +
  4842 + return {
  4843 + pre: function(scope, element, attr) {
  4844 +
  4845 + },
  4846 + post: function(scope, element, attr) {
  4847 +
  4848 + /**
  4849 + * 刷新车辆数据。
  4850 + */
  4851 + scope[ctrlAs].$$internal_refresh_dsdata_cl = function() {
  4852 + if (new_cl1) {
  4853 + var new_cl1_id = new_cl1.split("_")[0];
  4854 + var new_cl1_zbh = new_cl1.split("_")[1];
  4855 +
  4856 + if (new_cl2) {
  4857 + var new_cl2_id = new_cl2.split("_")[0];
  4858 + var new_cl2_zbh = new_cl2.split("_")[1];
  4859 +
  4860 + if (old_isfb) { // 使用分班判定
  4861 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  4862 + if (index < old_isfb_index) {
  4863 + obj.cl = new_cl1_id;
  4864 + obj.clZbh = new_cl1_zbh;
  4865 + } else {
  4866 + obj.cl = new_cl2_id;
  4867 + obj.clZbh = new_cl2_zbh;
  4868 + }
  4869 + });
  4870 +
  4871 + } else if (old_hasJCBC && old_firstJCBCFcno < old_max_fcno) { // 使用进出场判定
  4872 + angular.forEach(scope[ctrlAs].ds, function(obj) {
  4873 + if (obj.fcno <= old_firstJCBCFcno) {
  4874 + obj.cl = new_cl1_id;
  4875 + obj.clZbh = new_cl1_zbh;
  4876 + } else {
  4877 + obj.cl = new_cl2_id;
  4878 + obj.clZbh = new_cl2_zbh;
  4879 + }
  4880 + });
  4881 + } else { // 使用一半一半班次判定
  4882 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  4883 + if (index < old_half_bcs) {
  4884 + obj.cl = new_cl1_id;
  4885 + obj.clZbh = new_cl1_zbh;
  4886 + } else {
  4887 + obj.cl = new_cl2_id;
  4888 + obj.clZbh = new_cl2_zbh;
  4889 + }
  4890 + });
  4891 + }
  4892 +
  4893 + } else {
  4894 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  4895 + obj.cl = new_cl1_id;
  4896 + obj.clZbh = new_cl1_zbh;
  4897 + });
  4898 + }
  4899 +
  4900 + } else {
  4901 + // 清空,不使用旧的
  4902 + angular.forEach(old_cl, function(value, key) {
  4903 + angular.forEach(value, function(i) {
  4904 + //scope[ctrlAs].ds[i].cl = key.split("_")[0];
  4905 + //scope[ctrlAs].ds[i].clZbh = key.split("_")[1];
  4906 + scope[ctrlAs].ds[i].cl = undefined;
  4907 + scope[ctrlAs].ds[i].clZbh = undefined;
  4908 + });
  4909 + });
  4910 + }
  4911 + };
  4912 +
  4913 + /**
  4914 + * 刷新驾驶员数据。
  4915 + */
  4916 + scope[ctrlAs].$$internal_refresh_dsdata_j = function() {
  4917 + if (new_j1) {
  4918 + var new_j1_id = new_j1.split("_")[0];
  4919 + var new_j1_name = new_j1.split("_")[1];
  4920 + var new_j1_gh = new_j1.split("_")[2];
  4921 + if (new_j1_gh && new_j1_gh.indexOf("-") > 0) {
  4922 + new_j1_gh = new_j1_gh.substr(3); // 修正工号,把 55- 这种前缀去掉
  4923 + }
  4924 +
  4925 + if (new_j2) {
  4926 + var new_j2_id = new_j2.split("_")[0];
  4927 + var new_j2_name = new_j2.split("_")[1];
  4928 + var new_j2_gh = new_j2.split("_")[2];
  4929 + if (new_j2_gh && new_j2_gh.indexOf("-") > 0) {
  4930 + new_j2_gh = new_j2_gh.substr(3); // 修正工号,把 55- 这种前缀去掉
  4931 + }
  4932 +
  4933 + if (old_isfb) { // 使用分班判定
  4934 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  4935 + if (index < old_isfb_index) {
  4936 + obj.j = new_j1_id;
  4937 + obj.jGh = new_j1_gh;
  4938 + obj.jName = new_j1_name;
  4939 + } else {
  4940 + obj.j = new_j2_id;
  4941 + obj.jGh = new_j2_gh;
  4942 + obj.jName = new_j2_name;
  4943 + }
  4944 + });
  4945 +
  4946 + } else if (old_hasJCBC && old_firstJCBCFcno < old_max_fcno) { // 使用进出场判定
  4947 + angular.forEach(scope[ctrlAs].ds, function(obj) {
  4948 + if (obj.fcno <= old_firstJCBCFcno) {
  4949 + obj.j = new_j1_id;
  4950 + obj.jGh = new_j1_gh;
  4951 + obj.jName = new_j1_name;
  4952 + } else {
  4953 + obj.j = new_j2_id;
  4954 + obj.jGh = new_j2_gh;
  4955 + obj.jName = new_j2_name;
  4956 + }
  4957 + });
  4958 + } else { // 使用一半一半班次判定
  4959 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  4960 + if (index < old_half_bcs) {
  4961 + obj.j = new_j1_id;
  4962 + obj.jGh = new_j1_gh;
  4963 + obj.jName = new_j1_name;
  4964 + } else {
  4965 + obj.j = new_j2_id;
  4966 + obj.jGh = new_j2_gh;
  4967 + obj.jName = new_j2_name;
  4968 + }
  4969 + });
  4970 + }
  4971 +
  4972 + } else {
  4973 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  4974 + obj.j = new_j1_id;
  4975 + obj.jGh = new_j1_gh;
  4976 + obj.jName = new_j1_name;
  4977 + });
  4978 + }
  4979 +
  4980 + } else {
  4981 + // 清空,不使用使用旧的
  4982 + angular.forEach(old_j, function(value, key) {
  4983 + angular.forEach(value, function(i) {
  4984 + //scope[ctrlAs].ds[i].j = key.split("_")[0];
  4985 + //scope[ctrlAs].ds[i].jName = key.split("_")[1];
  4986 + //scope[ctrlAs].ds[i].jGh = key.split("_")[2];
  4987 + scope[ctrlAs].ds[i].j = undefined;
  4988 + scope[ctrlAs].ds[i].jName = undefined;
  4989 + scope[ctrlAs].ds[i].jGh = undefined;
  4990 + });
  4991 + });
  4992 + }
  4993 + };
  4994 +
  4995 + /**
  4996 + * 刷新售票员数据(和驾驶员配对的,有驾驶员,才有售票员)。
  4997 + */
  4998 + scope[ctrlAs].$$internal_refresh_dsdata_s = function() {
  4999 + var j_id = undefined;
  5000 + var s_id = undefined;
  5001 + var s_gh = undefined;
  5002 + var s_name = undefined;
  5003 +
  5004 + if (new_j1) {
  5005 + j_id = new_j1.split("_")[0];
  5006 + if (new_s1) {
  5007 + s_id = new_s1.split("_")[0];
  5008 + s_name = new_s1.split("_")[1];
  5009 + s_gh = new_s1.split("_")[2];
  5010 + if (s_gh && s_gh.indexOf("-") > 0) { // 修正工号,把 55- 这种前缀去掉
  5011 + s_gh = s_gh.substr(3);
  5012 + }
  5013 + } else {
  5014 + s_id = undefined;
  5015 + s_gh = undefined;
  5016 + s_name = undefined
  5017 + }
  5018 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  5019 + if (obj.j == j_id) {
  5020 + obj.s = s_id;
  5021 + obj.sGh = s_gh;
  5022 + obj.sName = s_name;
  5023 + }
  5024 + });
  5025 + }
  5026 + if (new_j2) {
  5027 + j_id = new_j2.split("_")[0];
  5028 + if (new_s2) {
  5029 + s_id = new_s2.split("_")[0];
  5030 + s_name = new_s2.split("_")[1];
  5031 + s_gh = new_s2.split("_")[2];
  5032 + if (s_gh && s_gh.indexOf("-") > 0) { // 修正工号,把 55- 这种前缀去掉
  5033 + s_gh = s_gh.substr(3);
  5034 + }
  5035 + } else {
  5036 + s_id = undefined;
  5037 + s_gh = undefined;
  5038 + s_name = undefined
  5039 + }
  5040 +
  5041 + angular.forEach(scope[ctrlAs].ds, function(obj, index) {
  5042 + if (obj.j == j_id) {
  5043 + obj.s = s_id;
  5044 + obj.sGh = s_gh;
  5045 + obj.sName = s_name;
  5046 + }
  5047 + });
  5048 + }
  5049 + };
  5050 +
  5051 +
  5052 + //-------------- 监控表单车辆1的变化 ----------------//
  5053 + scope.$watch(
  5054 + function() {
  5055 + return scope[ctrlAs].fd.cl1;
  5056 + },
  5057 + function(newValue, oldValue) {
  5058 + // 初始化new_cl1
  5059 + if (newValue.id) {
  5060 + if (newValue.id && newValue.zbh) {
  5061 + new_cl1 = newValue.id + "_" + newValue.zbh;
  5062 + } else {
  5063 + new_cl1 = undefined;
  5064 + }
  5065 + } else {
  5066 + new_cl1 = undefined;
  5067 + }
  5068 +
  5069 + scope[ctrlAs].$$internal_refresh_dsdata_cl();
  5070 + },
  5071 + true
  5072 + );
  5073 +
  5074 + //-------------- 监控表单车辆2的变化 ----------------//
  5075 + scope.$watch(
  5076 + function() {
  5077 + return scope[ctrlAs].fd.cl2;
  5078 + },
  5079 + function(newValue, oldValue) {
  5080 + // 初始化new_cl2
  5081 + if (newValue.id) {
  5082 + if (newValue.id && newValue.zbh) {
  5083 + new_cl2 = newValue.id + "_" + newValue.zbh;
  5084 + } else {
  5085 + new_cl2 = undefined;
  5086 + }
  5087 + } else {
  5088 + new_cl2 = undefined;
  5089 + }
  5090 +
  5091 + scope[ctrlAs].$$internal_refresh_dsdata_cl();
  5092 + },
  5093 + true
  5094 + );
  5095 +
  5096 + //-------------- 监控表单驾驶员1的变化 ----------------//
  5097 + scope.$watch(
  5098 + function() {
  5099 + return scope[ctrlAs].fd.j1;
  5100 + },
  5101 + function(newValue, oldValue) {
  5102 + // 初始化j1
  5103 + if (newValue.id) {
  5104 + if (newValue.id && newValue.name && newValue.jobCode) {
  5105 + new_j1 = newValue.id + "_" + newValue.name + "_" + newValue.jobCode;
  5106 + } else {
  5107 + new_j1 = undefined;
  5108 + }
  5109 + } else {
  5110 + new_j1 = undefined;
  5111 + }
  5112 +
  5113 + scope[ctrlAs].$$internal_refresh_dsdata_j();
  5114 + scope[ctrlAs].$$internal_refresh_dsdata_s();
  5115 + },
  5116 + true
  5117 + );
  5118 +
  5119 + //-------------- 监控表单售票员1的变化 ----------------//
  5120 + scope.$watch(
  5121 + function() {
  5122 + return scope[ctrlAs].fd.s1;
  5123 + },
  5124 + function(newValue, oldValue) {
  5125 + // 初始化s1
  5126 + if (newValue.id) {
  5127 + if (newValue.id && newValue.name && newValue.jobCode) {
  5128 + new_s1 = newValue.id + "_" + newValue.name + "_" + newValue.jobCode;
  5129 + } else {
  5130 + new_s1 = undefined;
  5131 + }
  5132 + } else {
  5133 + new_s1 = undefined;
  5134 + }
  5135 + scope[ctrlAs].$$internal_refresh_dsdata_j();
  5136 + scope[ctrlAs].$$internal_refresh_dsdata_s();
  5137 + },
  5138 + true
  5139 + );
  5140 +
  5141 + //-------------- 监控表单驾驶员2的变化 ----------------//
  5142 + scope.$watch(
  5143 + function() {
  5144 + return scope[ctrlAs].fd.j2;
  5145 + },
  5146 + function(newValue, oldValue) {
  5147 + // 初始化j2
  5148 + if (newValue.id) {
  5149 + if (newValue.id && newValue.name && newValue.jobCode) {
  5150 + new_j2 = newValue.id + "_" + newValue.name + "_" + newValue.jobCode;
  5151 + } else {
  5152 + new_j2 = undefined;
  5153 + }
  5154 + } else {
  5155 + new_j2 = undefined;
  5156 + }
  5157 +
  5158 + scope[ctrlAs].$$internal_refresh_dsdata_j();
  5159 + scope[ctrlAs].$$internal_refresh_dsdata_s();
  5160 + },
  5161 + true
  5162 + );
  5163 +
  5164 + //-------------- 监控表单售票员2的变化 ----------------//
  5165 + scope.$watch(
  5166 + function() {
  5167 + return scope[ctrlAs].fd.s2;
  5168 + },
  5169 + function(newValue, oldValue) {
  5170 + // 初始化s2
  5171 + if (newValue && newValue.id) {
  5172 + if (newValue.id && newValue.name && newValue.jobCode) {
  5173 + new_s2 = newValue.id + "_" + newValue.name + "_" + newValue.jobCode;
  5174 + } else {
  5175 + new_s2 = undefined;
  5176 + }
  5177 + } else {
  5178 + new_s2 = undefined;
  5179 + }
  5180 +
  5181 + scope[ctrlAs].$$internal_refresh_dsdata_j();
  5182 + scope[ctrlAs].$$internal_refresh_dsdata_s();
  5183 + },
  5184 + true
  5185 + );
  5186 +
  5187 + //-------------------- 监控ds的变化,更新数据源,初始化formdata的数据 ---------------//
  5188 + scope.$watch(
  5189 + function() {
  5190 + return scope[ctrlAs].ds;
  5191 + },
  5192 + function(newValue, oldValue) {
  5193 + if (newValue && newValue.length > 0) {
  5194 + var j1 = newValue[0].j;
  5195 +
  5196 + var cl_ids = []; // 车辆ids数组(有顺序)
  5197 + var j_s_ids = []; // 驾驶员ids,售票员ids,[{j:id,s:id},...](有顺序)
  5198 + var isRepeat = false;
  5199 + var i = 0;
  5200 +
  5201 + angular.forEach(newValue, function(obj, index) {
  5202 + var k1 = obj.cl + "_" + obj.clZbh;
  5203 + var k2 = !obj.j? undefined: obj.j + "_" + obj.jName + "_" + obj.jGh;
  5204 + var k3 = !obj.s? undefined: obj.s + "_" + obj.sName + "_" + obj.sGh;
  5205 +
  5206 + if (!old_cl[k1]) {
  5207 + old_cl[k1] = [];
  5208 + }
  5209 + if (!old_j[k2] && k2) {
  5210 + old_j[k2] = [];
  5211 + }
  5212 + if (!old_s[k3] && k3) {
  5213 + old_s[k3] = [];
  5214 + }
  5215 +
  5216 + // 闭包
  5217 + (function(i) {
  5218 + old_cl[k1].push(i);
  5219 + if (k2) {
  5220 + old_j[k2].push(i);
  5221 + }
  5222 + if (k3) {
  5223 + old_s[k3].push(i);
  5224 + }
  5225 + })(index);
  5226 +
  5227 + // 判断是否分班
  5228 + if (j1 != obj.j && !old_isfb) {
  5229 + old_isfb = true;
  5230 + old_isfb_index = index;
  5231 + }
  5232 +
  5233 + // 判断进出场
  5234 + if (obj.bcType == 'in' && !old_hasJCBC) {
  5235 + old_hasJCBC = true;
  5236 + old_firstJCBCFcno = obj.fcno;
  5237 + }
  5238 +
  5239 + //-------------- formdata用数据处理 -------------//
  5240 + // 车辆处理
  5241 + isRepeat = false;
  5242 + if (obj.cl) {
  5243 + for (i = 0; i < cl_ids.length; i++) {
  5244 + if (cl_ids[i] == obj.cl) {
  5245 + isRepeat = true;
  5246 + break;
  5247 + }
  5248 + }
  5249 + if (!isRepeat) {
  5250 + cl_ids.push(obj.cl);
  5251 + }
  5252 + }
  5253 +
  5254 + // 人员处理(以驾驶员id为主,没有的话,售票员不管了)
  5255 + isRepeat = false;
  5256 + if (obj.j) {
  5257 + for (i = 0; i < j_s_ids.length; i++) {
  5258 + if (j_s_ids[i].j == obj.j) {
  5259 + isRepeat = true;
  5260 + break;
  5261 + }
  5262 + }
  5263 + if (!isRepeat) {
  5264 + j_s_ids.push({
  5265 + j: obj.j,
  5266 + s: !obj.s? undefined: obj.s
  5267 + });
  5268 + }
  5269 + }
  5270 + });
  5271 +
  5272 + old_max_fcno = newValue[newValue.length - 1].fcno;
  5273 + old_half_bcs = newValue.length / 2;
  5274 +
  5275 + // 更新formdata
  5276 + for (i = 0; i < cl_ids.length; i++) { // 车辆更新前两辆
  5277 + if (i >= 2) {
  5278 + break;
  5279 + } else {
  5280 + form_data_assign_count["cl" + (i + 1)] = 0;
  5281 + scope[ctrlAs].fd["cl" + (i + 1)].id = cl_ids[i];
  5282 + }
  5283 + }
  5284 + for (i = 0; i < j_s_ids.length; i++) { // 人员更新
  5285 + if (i >= 3) {
  5286 + break;
  5287 + } else {
  5288 + form_data_assign_count["j" + (i + 1)] = 0;
  5289 + scope[ctrlAs].fd["j" + (i + 1)].id = j_s_ids[i].j;
  5290 +
  5291 + form_data_assign_count["s" + (i + 1)] = 0;
  5292 + scope[ctrlAs].fd["s" + (i + 1)].id = j_s_ids[i].s;
  5293 + }
  5294 + }
  5295 + }
  5296 + }
  5297 + );
  5298 + }
  5299 + }
  5300 + }
  5301 + };
  5302 + }
  5303 + ]
4774 5304 );
4775 5305 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit.html
... ... @@ -59,14 +59,14 @@
59 59 iterobjexp="item.insideCode"
60 60 searchph="请输拼音..."
61 61 searchexp="this.insideCode"
62   - <!--required -->
  62 + required
63 63 >
64 64 </sa-Select5>
65 65 </div>
66   - <!--&lt;!&ndash; 隐藏块,显示验证信息 &ndash;&gt;-->
67   - <!--<div class="alert alert-danger well-sm" ng-show="myForm.cl1.$error.required">-->
68   - <!--车辆1必须选择-->
69   - <!--</div>-->
  66 + <!-- 隐藏块,显示验证信息 -->
  67 + <div class="alert alert-danger well-sm" ng-show="myForm.cl1.$error.required">
  68 + 车辆1必须选择
  69 + </div>
70 70 </div>
71 71 <div class="form-group has-success has-feedback">
72 72 <label class="col-md-5 control-label">车辆2:</label>
... ... @@ -99,14 +99,14 @@
99 99 iterobjexp="item.personnelName + '(' + item.jobCode + ')'"
100 100 searchph="请输拼音..."
101 101 searchexp="this.personnelName"
102   - <!--required -->
  102 + required
103 103 >
104 104 </sa-Select5>
105 105 </div>
106   - <!--&lt;!&ndash; 隐藏块,显示验证信息 &ndash;&gt;-->
107   - <!--<div class="alert alert-danger well-sm" ng-show="myForm.j1.$error.required">-->
108   - <!--驾驶员必须选择-->
109   - <!--</div>-->
  106 + <!-- 隐藏块,显示验证信息 -->
  107 + <div class="alert alert-danger well-sm" ng-show="myForm.j1.$error.required">
  108 + 驾驶员必须选择
  109 + </div>
110 110 </div>
111 111  
112 112 <div class="form-group has-success has-feedback">
... ... @@ -204,18 +204,26 @@
204 204 <div class="form-group has-success has-feedback">
205 205 <label class="col-md-2 control-label">排班明细:</label>
206 206 <div class="col-md-10">
207   - <sa-Planinfoedit name="spi"
208   - ng-model="ctrl.formData.planInfos"
209   - ng-model-options="{ getterSetter: true }"
210   - cl1="{{ctrl.formData.cl1}}"
211   - cl2="{{ctrl.formData.cl2}}"
212   - j1="{{ctrl.formData.j1}}"
213   - j2="{{ctrl.formData.j2}}"
214   - s1="{{ctrl.formData.s1}}"
215   - s2="{{ctrl.formData.s2}}"
  207 + <!--<sa-Planinfoedit name="spi"-->
  208 + <!--ng-model="ctrl.planInfos"-->
  209 + <!--ng-model-options="{ getterSetter: true }"-->
  210 + <!--cl1="{{ctrl.formData.cl1}}"-->
  211 + <!--cl2="{{ctrl.formData.cl2}}"-->
  212 + <!--j1="{{ctrl.formData.j1}}"-->
  213 + <!--j2="{{ctrl.formData.j2}}"-->
  214 + <!--s1="{{ctrl.formData.s1}}"-->
  215 + <!--s2="{{ctrl.formData.s2}}"-->
  216 + <!-->
  217 +
  218 + <!--</sa-Planinfoedit>-->
  219 +
  220 + <sa-Planinfoedit2 name="spi"
  221 + ng-model="ctrl.planInfos"
  222 + ng-model-options="{ getterSetter: true }"
  223 + form-data="ctrl.formData"
216 224 >
217 225  
218   - </sa-Planinfoedit>
  226 + </sa-Planinfoedit2>
219 227 </div>
220 228 </div>
221 229 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/module.js
... ... @@ -264,7 +264,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(
264 264 self.formData.j3 = {}; // 驾驶员3
265 265 self.formData.s3 = {}; // 售票员3
266 266  
267   - self.formData.planInfos = undefined; // 排班明细
  267 + self.planInfos = undefined; // 排班明细
268 268  
269 269 var sdd = new Date();
270 270 sdd.setTime(self.sd);
... ... @@ -277,12 +277,12 @@ angular.module(&#39;ScheduleApp&#39;).controller(
277 277  
278 278 // 获取排班明细数据
279 279 SPlanInfo.list(params, function(rst) {
280   - self.formData.planInfos = rst.content;
  280 + self.planInfos = rst.content;
281 281 });
282 282  
283 283 // 提交方法
284 284 self.submit = function() {
285   - service.batchUpdatePlanInfo(self.formData.planInfos).then(
  285 + service.batchUpdatePlanInfo(self.planInfos).then(
286 286 function() {
287 287 $state.go("schedulePlanReportExtManage");
288 288 },
... ...
src/main/resources/static/real_control_v2/css/line_schedule.css
... ... @@ -691,7 +691,7 @@ label.destroy-sch small{
691 691 text-align: center;
692 692 }
693 693 .sub-task-table dl dt:nth-of-type(2), .sub-task-table dl dd:nth-of-type(2) {
694   - width: 15%;
  694 + width: 13%;
695 695 }
696 696 .sub-task-table dl dt:nth-of-type(3), .sub-task-table dl dd:nth-of-type(3) {
697 697 width: 16%;
... ... @@ -706,7 +706,7 @@ label.destroy-sch small{
706 706 width: 11%;
707 707 }
708 708 .sub-task-table dl dt:nth-of-type(7), .sub-task-table dl dd:nth-of-type(7) {
709   - width: 14%;
  709 + width: 16%;
710 710 }
711 711 .sub-task-table dl dt:nth-of-type(8), .sub-task-table dl dd:nth-of-type(8) {
712 712 width: 9%;
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -1255,4 +1255,183 @@ ul.left_tabs_lg li{
1255 1255 text-indent: 12px;
1256 1256 margin-bottom: 0;
1257 1257 padding: 18px 5px;
  1258 +}
  1259 +
  1260 +.sub_task_form_v2{
  1261 + background: #f9f9f9;
  1262 + padding: 12px 15px;
  1263 + border-radius: 5px 0 5px 5px;
  1264 + border: 1px solid #dfdfdf;
  1265 + position: relative;
  1266 + margin-bottom: 20px;
  1267 +}
  1268 +
  1269 +.task_form_close_icon{
  1270 + background: #f9f9f9;
  1271 + padding: 0px 4px;
  1272 + position: absolute;
  1273 + top: -8px;
  1274 + right: -8px;
  1275 + color: #898989;
  1276 + font-size: 15px;
  1277 + border: 1px solid #dfdfdf;
  1278 + border-radius: 100%;
  1279 + border-left: none;
  1280 + border-bottom: none;
  1281 + transition: all .03s;
  1282 +}
  1283 +
  1284 +.task_form_close_icon:hover{
  1285 + border: 1px solid #ff1515;
  1286 + border-left: none;
  1287 + border-bottom: none;
  1288 + color: #e03e3e;
  1289 +}
  1290 +
  1291 +.sub_task_form_v2:hover::after{
  1292 + color: #5f5b5b;
  1293 +}
  1294 +
  1295 +.sub_task_form_v2.uk-form-horizontal .uk-form-label{
  1296 + width: 80px;
  1297 +}
  1298 +
  1299 +.sub_task_form_v2.uk-form-horizontal .uk-form-controls{
  1300 + margin-left: 85px;
  1301 +}
  1302 +
  1303 +.sub_task_form_v2.uk-form-horizontal .uk-form-controls input[type=text],
  1304 +.sub_task_form_v2.uk-form-horizontal .uk-form-controls input[type=time],
  1305 +.sub_task_form_v2.uk-form-horizontal .uk-form-controls select{
  1306 + width: 100%;
  1307 +}
  1308 +
  1309 +#add-sub-task-main-modal .uk-modal-footer{
  1310 + background: none;
  1311 + border-top: none;
  1312 +}
  1313 +
  1314 +#add-sub-task-main-modal .uk-grid+.uk-grid{
  1315 + margin-top: 12px;
  1316 +}
  1317 +
  1318 +#add-sub-task-main-modal .plus_icon_span{
  1319 + font-size: 26px;
  1320 + color: #b2b2b2;
  1321 + padding: 10px 64px;
  1322 + display: inline-block;
  1323 + border: 1px dashed grey;
  1324 + margin: 15px 0;
  1325 + border-radius: 5px;
  1326 + cursor: pointer;
  1327 +}
  1328 +
  1329 +#add-sub-task-main-modal .uk-animation-fade{
  1330 + animation-duration: .3s;
  1331 +}
  1332 +
  1333 +#add-sub-task-main-modal .forms{
  1334 + max-height: 488px;
  1335 + overflow-y: auto;
  1336 + overflow-x: hidden;
  1337 + padding: 8px 8px 0 0;
  1338 +}
  1339 +
  1340 +.add_custom_wrap .forms .sub_task_form_v2:last-child{
  1341 + margin-bottom: 0;
  1342 +}
  1343 +
  1344 +.sub_task_form_v2.repeat_main:before{
  1345 + content: '复';
  1346 + position: absolute;
  1347 + top: -10px;
  1348 + font-size: 12px;
  1349 + color: #2196F3;
  1350 + background: #ffffff;
  1351 + padding: 0 3px;
  1352 + font-weight: 600;
  1353 +}
  1354 +
  1355 +.sub_task_form_v2.repeat_main.destroy_form:before{
  1356 + color: #F44336;
  1357 +}
  1358 +
  1359 +.sub_task_form_v2.repeat_main{
  1360 + background: #f4faff;
  1361 +}
  1362 +
  1363 +.sub_task_form_v2.destroy_form{
  1364 + background-color: #fff5f4 !important;
  1365 +}
  1366 +
  1367 +.uk-form>.half_change_car_box{
  1368 + margin: -10px 0 15px;
  1369 + padding: 3px 5px;
  1370 + display: inline-block;
  1371 + border: 1px solid #dfdddd;
  1372 + color: #918f8f;
  1373 +}
  1374 +
  1375 +.half_change_car_box input[type=checkbox]{
  1376 + vertical-align: top;
  1377 +}
  1378 +
  1379 +.uk-form>.half_change_car_box.active{
  1380 + background: #4CAF50;
  1381 + color: #fff;
  1382 +}
  1383 +
  1384 +.uk-form>.half_change_car_box.active input[type=checkbox]{
  1385 + background: #4caf50;
  1386 + border-color: #4caf50;
  1387 +}
  1388 +
  1389 +.uk-form>.half_change_car_box.active input[type=checkbox]:before{
  1390 + color: #ffffff;
  1391 +}
  1392 +
  1393 +.sub_task_form_v2.change_car{
  1394 + z-index: 99;
  1395 +}
  1396 +
  1397 +.st_range_top_form{
  1398 + padding: 0 0 15px 5px;
  1399 + border: 1px solid #c4bb76;
  1400 + background: #e5e1c1;
  1401 + margin-bottom: 15px;
  1402 + box-shadow: 0px 4px 3px 0 rgba(142, 138, 138, 0.2), 0px 4px 5px 0 rgba(157, 156, 156, 0.19);
  1403 +}
  1404 +
  1405 +.st_range_top_form .uk-form-row{
  1406 + margin-top: 20px;
  1407 +}
  1408 +
  1409 +.uk-form-horizontal.st_range_top_form .uk-form-label{
  1410 + width: 80px;
  1411 +}
  1412 +
  1413 +.uk-form-horizontal.st_range_top_form .uk-form-controls{
  1414 + margin-left: 84px;
  1415 +}
  1416 +
  1417 +.uk-form-horizontal.st_range_top_form .uk-form-controls select{
  1418 + width: calc(100% - 2px);
  1419 +}
  1420 +
  1421 +.sub_task_form_v2.service_st_form{
  1422 + background: #f4faff;
  1423 +}
  1424 +
  1425 +.uk-modal .uk-form.fv-form.sub_task_form_v2{
  1426 + margin-bottom: 20px !important;
  1427 +}
  1428 +
  1429 +.sub_task_table_wrap .ct_table>.ct_table_body{
  1430 + border-bottom: none;
  1431 +}
  1432 +
  1433 +.add_range_wrap>.err_panel{
  1434 + font-size: 16px;
  1435 + color: #a44a4a;
  1436 + font-family: 微软雅黑;
1258 1437 }
1259 1438 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
... ... @@ -3,7 +3,7 @@
3 3 <a href="" class="uk-modal-close uk-close"></a>
4 4 <div class="uk-modal-header">
5 5 <h2>临加/子任务</h2></div>
6   - <div class="uk-panel uk-panel-box uk-panel-box-primary">
  6 + <div class="uk-panel uk-panel-box uk-panel-box-primary" style="padding: 12px;">
7 7 <form class="uk-form uk-form-horizontal search-form">
8 8 <div class="uk-grid">
9 9 <div class="uk-width-1-3">
... ... @@ -51,13 +51,13 @@
51 51 </div>
52 52 </div>
53 53  
54   - <div class="uk-panel uk-panel-box uk-panel-box-secondary" style="padding-bottom: 0;">
  54 + <div class="uk-panel uk-panel-box uk-panel-box-secondary" style="padding-bottom: 0;box-shadow: 0px -2px 4px 0 rgba(214, 214, 214, 0.2), 0px -2px 3px 0 rgba(123, 122, 122, 0.19);">
55 55 <h3 class="uk-panel-title" id="childTaskTitle">
56 56 子任务列表
57 57 <a id="addChildTaskBtn" data-uk-tooltip title="添加子任务"><i
58 58 class="uk-icon-plus"></i> </a>
59 59 </h3>
60   - <div class="ct_table_wrap ct_table_no_border sub_task_table_wrap" style="height: 142px;">
  60 + <div class="ct_table_wrap ct_table_no_border sub_task_table_wrap" style="height: 147px;">
61 61 <div class="ct_table sub-task-table">
62 62 <div class="ct_table_head">
63 63 <dl>
... ... @@ -126,7 +126,12 @@
126 126 {{each list as task i}}
127 127 <dl data-id="{{task.id}}">
128 128 <dd>{{i+1}}</dd>
129   - <dd><span class="nt-dictionary" data-group="ChildTaskType">{{task.type2}}</span></dd>
  129 + <dd>
  130 + <span class="nt-dictionary" data-group="ChildTaskType">{{task.type2}}</span>
  131 + {{if task.noClerk}}
  132 + (无售)
  133 + {{/if}}
  134 + </dd>
130 135 <dd>{{task.startStationName}}</dd>
131 136 <dd>{{task.endStationName}}</dd>
132 137 <dd>{{task.startDate}}</dd>
... ... @@ -137,9 +142,12 @@
137 142 {{if task.destroy}}
138 143 <small style="color:red;">烂班</small>
139 144 {{/if}}
  145 + {{if task.nbbm!=null}},{{task.nbbm}}{{/if}}
140 146 )
141 147 </dd>
142   - <dd title="{{task.remarks}}">{{task.remarks}}</dd>
  148 + <dd title="{{task.remarks}}">
  149 + {{task.remarks}}
  150 + </dd>
143 151 </dl>
144 152 {{/each}}
145 153 </script>
... ... @@ -328,8 +336,6 @@
328 336 }, modal_opts);
329 337 };
330 338  
331   - $('#addChildTaskBtn').on('click', add_sub_task_other);
332   -
333 339 //回场子任务
334 340 var add_sub_task_in = function () {
335 341 var sch = getActiveSch();
... ... @@ -408,6 +414,18 @@
408 414 }, modal_opts);
409 415 };
410 416  
  417 + var add_sub_task = function () {
  418 + var sch = getActiveSch();
  419 + if (!sch)
  420 + return notify_err('无法获取到主任务信息!');
  421 +
  422 + open_modal(folder + '/sub_task_v2/main.html', {
  423 + sch: sch
  424 + }, modal_opts);
  425 + };
  426 +
  427 + $('#addChildTaskBtn').on('click', add_sub_task);
  428 +
411 429 var callbackHandler = {
412 430 add_temp_sch: add_temp_sch,
413 431 remove_sch: remove_sch,
... ... @@ -416,7 +434,9 @@
416 434 remove_sub_task: remove_sub_task,
417 435 add_sub_task_out: add_sub_task_out,
418 436 add_sub_task_range_turn: add_sub_task_range_turn,
419   - add_oil: add_oil
  437 + add_oil: add_oil,
  438 +
  439 + add_sub_task: add_sub_task
420 440 };
421 441  
422 442 //右键菜单
... ... @@ -431,7 +451,7 @@
431 451 name: "临加班次"
432 452 },
433 453 "add_sub_task": {
434   - name: "添加子任务",
  454 + name: "添加子任务"/*,
435 455 items: {
436 456 'add_oil':{
437 457 name: '空驶进出场'
... ... @@ -448,7 +468,7 @@
448 468 'add_sub_task_other': {
449 469 name: '自定义'
450 470 }
451   - }
  471 + }*/
452 472 },
453 473 'remove_sch': {
454 474 name: '删除'
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_custom.html 0 → 100644
  1 +<div class="add_custom_wrap">
  2 + <div class="forms"></div>
  3 + <span class="plus_icon_span">
  4 + <i class="uk-icon-plus"></i>
  5 + </span>
  6 + <form class="uk-form remarks_form">
  7 + <div class="uk-grid">
  8 + <div class="uk-width-1-1">
  9 + <div class="uk-form-row ct-stacked">
  10 + <div class="uk-form-controls" style="margin-top: 5px;">
  11 + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;"
  12 + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea>
  13 + </div>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + </form>
  18 + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;">
  19 + <button type="button" class="uk-button uk-modal-close">取消</button>
  20 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  21 + </div>
  22 +
  23 + <script>
  24 + (function () {
  25 + var wrap = '#add-sub-task-main-modal .add_custom_wrap',
  26 + sch, fs=[];
  27 +
  28 + $(wrap).on('init', function (e, data) {
  29 + e.stopPropagation();
  30 + sch = data.sch;
  31 + $('.plus_icon_span', wrap).trigger('click');
  32 + });
  33 +
  34 + //plsu icon
  35 + $('.plus_icon_span', wrap).on('click', addTaskForm);
  36 +
  37 + var bcTypeMap = {'in': 2, 'out': 3, 'normal': 1};
  38 + function addTaskForm() {
  39 + var htmlStr = template('sub-task-v2-form-temp', {sch: sch})
  40 + var f = $(htmlStr);
  41 + $('.forms', wrap).append(f);
  42 + //字典转换
  43 + dictionaryUtils.transformDom($('.nt-dictionary', f));
  44 +
  45 + //班次类型切换
  46 + if(bcTypeMap[sch.bcType])
  47 + $('[name=type2]', f).val(bcTypeMap[sch.bcType])
  48 + $('[name=type2]', f).trigger('change');
  49 +
  50 + //滚动条到底
  51 + $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight);
  52 +
  53 + //起点站trigger change
  54 + $('[name=startStation]',f).trigger('change');
  55 +
  56 + f.prev('.sub_task_form_v2').find('[name=endDate]').trigger('input');
  57 +
  58 + f.formValidation({
  59 + framework: 'uikit',
  60 + locale: 'zh_CN'
  61 + }).on('add_reason_field', function () {
  62 + $(this).formValidation('addField', 'reason');
  63 + });
  64 + }
  65 +
  66 + //提交
  67 + $('button[type=submit]', wrap).on('click', function () {
  68 + $(this).addClass('disabled').attr('disabled','disabled');
  69 + dataArray = [];
  70 + $('form.sub_task_form_v2', wrap).data('valid', false)
  71 + .formValidation('validate');
  72 + });
  73 +
  74 + var dataArray = [];
  75 + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) {
  76 + e.preventDefault();
  77 +
  78 + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this)
  79 + , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id}));
  80 + $(this).data('valid', true);
  81 +
  82 + if(allValidSuccess()){
  83 + var i = 0, rst;
  84 + (function () {
  85 + var f = arguments.callee;
  86 + if(i >= dataArray.length){
  87 + //完成后更新前端数据
  88 + gb_schedule_table.updateSchedule(rst);
  89 + UIkit.modal('#add-sub-task-main-modal').hide();
  90 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  91 + return;
  92 + }
  93 + var data = dataArray[i];
  94 + //里程为0的不保存
  95 + if(data.mileage==0){
  96 + i++;
  97 + f();
  98 + }
  99 + else{
  100 + //营运子任务不写备注
  101 + if(data.mileageType == 'service' && !data.destroy)
  102 + data.remarks = '';
  103 + gb_common.$post('/childTask', data, function (rs) {
  104 + notify_succ('子任务添加成功');
  105 + rst = rs.t;
  106 + i++;
  107 + f();
  108 + });
  109 + }
  110 + })();
  111 + }
  112 + });
  113 + //校验不过
  114 + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () {
  115 + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled');
  116 + });
  117 +
  118 + function allValidSuccess() {
  119 + var flag = true;
  120 + $('form.sub_task_form_v2', wrap).each(function (i, f) {
  121 + if(!$(f).data('valid')){
  122 + flag = false;
  123 + return false;
  124 + }
  125 + });
  126 + return flag;
  127 + }
  128 +
  129 + function $f(name, f) {
  130 + return $('[name=' + name + ']', f);
  131 + }
  132 + })();
  133 + </script>
  134 +</div>
0 135 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_in_out.html 0 → 100644
  1 +<div class="add_inOut_wrap">
  2 + <div class="forms"></div>
  3 + <form class="uk-form remarks_form">
  4 + <div class="uk-grid">
  5 + <div class="uk-width-1-1">
  6 + <div class="uk-form-row ct-stacked">
  7 + <div class="uk-form-controls" style="margin-top: 5px;">
  8 + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;"
  9 + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea>
  10 + </div>
  11 + </div>
  12 + </div>
  13 + </div>
  14 + </form>
  15 + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;">
  16 + <button type="button" class="uk-button uk-modal-close">取消</button>
  17 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  18 + </div>
  19 +
  20 + <script>
  21 + (function () {
  22 + var wrap = '#add-sub-task-main-modal .add_inOut_wrap',
  23 + sch, sf, inf, outf, destroyf;
  24 +
  25 + $(wrap).on('init', function (e, data) {
  26 + e.stopPropagation();
  27 + sch = data.sch;
  28 +
  29 + //线路上
  30 + sf = addTaskForm();
  31 + //进场
  32 + inf = addTaskForm();
  33 + //出场
  34 + outf = addTaskForm();
  35 +
  36 + setTimeout(function () {
  37 + //复主任务
  38 + repeat_main(sf);
  39 + //进场子任务
  40 + repeat_In(inf);
  41 + //出场子任务
  42 + repeat_Out(outf);
  43 + }, 500);
  44 +
  45 + //营运终点和进场起点改变事件
  46 + $f('endStation', sf).on('change', changeServiceEnd);
  47 + //$f('startStation', inf).on('change', changeServiceEnd);
  48 + });
  49 +
  50 + function addTaskForm() {
  51 + var htmlStr = template('sub-task-v2-form-temp', {sch: sch});
  52 + var f = $(htmlStr);
  53 + $('.forms', wrap).append(f);
  54 + //字典转换
  55 + dictionaryUtils.transformDom($('.nt-dictionary', f));
  56 +
  57 + //班次类型切换
  58 + $('select[name=type2]', f).trigger('change');
  59 +
  60 + //滚动条到底
  61 + $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight);
  62 +
  63 + f.formValidation({
  64 + framework: 'uikit',
  65 + locale: 'zh_CN'
  66 + }).on('add_reason_field', function () {
  67 + $(this).formValidation('addField', 'reason');
  68 + });
  69 + return f;
  70 + }
  71 +
  72 + /**
  73 + * 复主任务
  74 + * @param f
  75 + */
  76 + function repeat_main(f) {
  77 + f.addClass('repeat_main');
  78 + $f('type2', f).html('<option value="1">线路上站点间</option>');
  79 + $f('mileage', f).val(sch.jhlc).trigger('input');
  80 + $f('mileageType', f).val('service').attr('disabled', 'disabled');
  81 + //主任务是烂班
  82 + if (sch.status == -1) {
  83 + $f('destroy', f)[0].checked = true;
  84 + $f('reason', f).val(sch.adjustExps);
  85 + $('.destroy_reason_wrap', f).show();
  86 + $f('mileage', f).val(sch.jhlcOrig);
  87 + $('input,select', f).attr('disabled', 'disabled');
  88 + f.addClass('destroy_form');
  89 + }
  90 + else if (sch.status == 2) {
  91 + $f('destroy', f).parents('label').hide();
  92 + $f('endDate', f).val(sch.zdsjActual);
  93 + $('input,select', f).attr('disabled', 'disabled');
  94 + }
  95 + }
  96 +
  97 + function repeat_In(f) {
  98 + $f('type2', f).html('<option value="2">进场</option>').trigger('change');
  99 + if (sch.status != -1)
  100 + $f('startStation', f).val(sch.zdzCode);//主任务终点进场
  101 +
  102 + //起点改变
  103 + $f('startStation', f).on('change', function () {
  104 + $f('endStation', outf).val($(this).val());//.trigger('change');
  105 + }).trigger('change');
  106 +
  107 + //烂班原因
  108 + if(sch.status == -1 &&
  109 + gb_common.inOutExps.indexOf(sch.adjustExps)!=-1)
  110 + $f('inOutReason',inf).val(sch.adjustExps).trigger('change');
  111 + }
  112 +
  113 + function repeat_Out(f) {
  114 + $f('type2', f).html('<option value="3">出场</option>').trigger('change');
  115 +
  116 + var code;
  117 + if (sch.status != -1)
  118 + code=sch.zdzCode;
  119 + else
  120 + code=sch.qdzCode;
  121 + $f('endStation', f).val(code).trigger('change'); //出场到主任务终点
  122 + $f('startDate', f).val($f('endDate', inf).val()).trigger('input');//开始时间
  123 + }
  124 +
  125 + function $f(name, f) {
  126 + return $('[name=' + name + ']', f);
  127 + }
  128 +
  129 + /**
  130 + * 切换营运终点
  131 + */
  132 + function changeServiceEnd() {
  133 + var eCode = $(this).val();
  134 + if(half_form){
  135 + half_form.remove();
  136 + changeCarBox.remove();
  137 + }
  138 + if(eCode==sch.qdzCode || eCode==sch.zdzCode){
  139 + $f('startStation',inf).val(eCode).trigger('change');
  140 + return;
  141 + }
  142 +
  143 + //进场起点
  144 + $f('startStation',inf).val(eCode);
  145 +
  146 + //中途进场
  147 + showHalfPanel(eCode);
  148 + }
  149 +
  150 + var half_form, changeCarBox;
  151 + function showHalfPanel(station) {
  152 + half_form = $(template('sub-task-v2-form-temp', {sch: sch}));
  153 + half_form.addClass('repeat_main destroy_form');
  154 + //字典转换
  155 + dictionaryUtils.transformDom($('.nt-dictionary', half_form));
  156 + sf.after(half_form);
  157 +
  158 +
  159 + //班次类型切换
  160 + $f('type2', half_form).trigger('change');
  161 + //设置起点
  162 + $f('startStation',half_form).val(station).trigger('change');
  163 + //烂班
  164 + $f('destroy',half_form)[0].checked=true;
  165 + $f('mileageType',half_form).attr('disabled','disabled');
  166 + $f('type2',half_form).html('<option value="1">线路上站点间</option>');
  167 + $('.destroy_reason_wrap',half_form).show();
  168 + half_form.attr('destroy', true);
  169 +
  170 + setTimeout(function () {
  171 + //烂班开始时间
  172 + $f('startDate',half_form).val($f('endDate',sf).val()).trigger('input');
  173 + }, 300);
  174 +
  175 + //换车营运
  176 + var se = $f('startStation',half_form)[0],
  177 + sname = se.options[se.options.selectedIndex].text;
  178 + changeCarBox = $('<form class="uk-form"><label class="half_change_car_box"><input type="checkbox"> 换车出场至【'+sname+'】继续营运</label></form>');
  179 + half_form.after(changeCarBox);
  180 +
  181 + //删除
  182 + $('.task_form_close_icon', half_form).on('click', function () {
  183 + changeCarBox.remove();
  184 + $f('type2',outf).trigger('change');
  185 + });
  186 +
  187 + //校验
  188 + half_form.formValidation({
  189 + framework: 'uikit',
  190 + locale: 'zh_CN'
  191 + }).on('add_reason_field', function () {
  192 + $(this).formValidation('addField', 'reason');
  193 + });
  194 + }
  195 +
  196 + $(wrap).on('click', '.half_change_car_box>input[type=checkbox]', function () {
  197 + var box=$(this).parents('.half_change_car_box');
  198 + if(this.checked){
  199 + box.addClass('active');
  200 + enableChangeCar();
  201 + }
  202 + else{
  203 + box.removeClass('active');
  204 + disabledChangeCar();
  205 + }
  206 + });
  207 +
  208 + /**
  209 + * 换车出场
  210 + */
  211 + function enableChangeCar() {
  212 + var htmlStr = template('st-v2-domains-changecar-form-temp', {inOutExps: gb_common.inOutExps});
  213 + $('.domains', half_form).html(htmlStr);
  214 + $('.domains', outf).html(htmlStr);
  215 + half_form.css('z-index', 99).trigger('add_reason_field');
  216 + outf.trigger('add_reason_field');
  217 +
  218 + //车辆 autocomplete
  219 + var data = gb_data_basic.carsArray();
  220 + gb_common.carAutocomplete($('.autocomplete-cars', half_form), data);
  221 +
  222 + //同步车辆编码
  223 + $f('nbbm', half_form).on('input change', function () {
  224 + $f('nbbm', outf).val($(this).val());
  225 + });
  226 +
  227 + half_form.removeClass('destroy_form');
  228 +
  229 + //出场终点
  230 + $f('endStation',outf).val($f('endStation',sf).val());
  231 + }
  232 +
  233 + function disabledChangeCar() {
  234 + $f('type2',outf).trigger('change');
  235 + $f('endStation',sf).trigger('change');
  236 + }
  237 +
  238 +
  239 + //提交
  240 + $('button[type=submit]', wrap).on('click', function () {
  241 + $(this).addClass('disabled').attr('disabled','disabled');
  242 + dataArray = [];
  243 + $('form.sub_task_form_v2', wrap).data('valid', false)
  244 + .formValidation('validate');
  245 + });
  246 +
  247 + var dataArray = [];
  248 + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) {
  249 + e.preventDefault();
  250 +
  251 + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this)
  252 + , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id}));
  253 + $(this).data('valid', true);
  254 +
  255 + if(allValidSuccess()){
  256 + var i = 0, rst;
  257 + (function () {
  258 + var f = arguments.callee;
  259 + if(i >= dataArray.length){
  260 + //完成后更新前端数据
  261 + gb_schedule_table.updateSchedule(rst);
  262 + UIkit.modal('#add-sub-task-main-modal').hide();
  263 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  264 + return;
  265 + }
  266 + var data = dataArray[i];
  267 + //里程为0的不保存
  268 + if(data.mileage==0){
  269 + i++;
  270 + f();
  271 + }
  272 + else{
  273 + //营运子任务不写备注
  274 + if(data.mileageType == 'service' && !data.destroy)
  275 + data.remarks = '';
  276 + gb_common.$post('/childTask', data, function (rs) {
  277 + notify_succ('子任务添加成功');
  278 + rst = rs.t;
  279 + i++;
  280 + f();
  281 + });
  282 + }
  283 + })();
  284 + }
  285 + });
  286 + //校验不过
  287 + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () {
  288 + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled');
  289 + });
  290 +
  291 + function allValidSuccess() {
  292 + var flag = true;
  293 + $('form.sub_task_form_v2', wrap).each(function (i, f) {
  294 + if(!$(f).data('valid')){
  295 + flag = false;
  296 + return false;
  297 + }
  298 + });
  299 + return flag;
  300 + }
  301 + })();
  302 + </script>
  303 +</div>
0 304 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_range_turn.html 0 → 100644
  1 +<div class="add_range_wrap">
  2 + <div>
  3 + <form class="uk-form uk-form-horizontal st_range_top_form">
  4 + <div class="uk-grid">
  5 + <div class="uk-width-1-3">
  6 + <div class="uk-form-row" style="padding-left: 10px;">
  7 + <label class="uk-form-label">调头站点</label>
  8 + <div class="uk-form-controls">
  9 + <select id="turnStationSelect">
  10 + <option value="">请选择...</option>
  11 + </select>
  12 + </div>
  13 + </div>
  14 + </div>
  15 + <div class="uk-width-1-3">
  16 + <div class="uk-form-row">
  17 + <label class="uk-form-label">调头原因</label>
  18 + <div class="uk-form-controls">
  19 + <select id="turnReason" style="width: calc(100% - 13px);">
  20 + <option value="">请选择...</option>
  21 + </select>
  22 + </div>
  23 + </div>
  24 + </div>
  25 + <div class="uk-width-1-3" style="padding: 28px 0 0 28px;">
  26 + <label id="emptyTurnCbox"></label>
  27 + </div>
  28 + </div>
  29 + </form>
  30 + </div>
  31 +
  32 + <div class="forms"></div>
  33 + <form class="uk-form remarks_form">
  34 + <div class="uk-grid">
  35 + <div class="uk-width-1-1">
  36 + <div class="uk-form-row ct-stacked">
  37 + <div class="uk-form-controls" style="margin-top: 5px;">
  38 + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;"
  39 + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea>
  40 + </div>
  41 + </div>
  42 + </div>
  43 + </div>
  44 + </form>
  45 + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;">
  46 + <button type="button" class="uk-button uk-modal-close">取消</button>
  47 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  48 + </div>
  49 +
  50 + <script>
  51 + (function () {
  52 + var wrap = '#add-sub-task-main-modal .add_range_wrap',
  53 + sch, nextSch, stationRoutes, f1, f2, df1, df2, topf = $('.st_range_top_form', wrap);
  54 +
  55 + $(wrap).on('init', function (e, data) {
  56 + e.stopPropagation();
  57 + sch = data.sch;
  58 + nextSch = gb_schedule_table.getNextNormalSch(sch);
  59 + if(!nextSch || nextSch.bcType!='normal'){
  60 + $(wrap).html('<div class="err_panel">无法做区间调头,原因是没有找到返程班次!</div>');
  61 + return;
  62 + }
  63 +
  64 + //站点路由
  65 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  66 + return a.stationRouteCode - b.stationRouteCode;
  67 + }), 'directions');
  68 + //第一段营运
  69 + f1 = addTaskForm();
  70 + $f('startStation', f1).trigger('change');
  71 +
  72 + disabled_form(f1);
  73 + $('.domains', f1).empty();
  74 + //top form 站点select
  75 + $('#turnStationSelect', topf).append($f('startStation', f1).html()).on('change', changeTurnStation);
  76 + //top form 原因select
  77 + var opts = '';
  78 + $.each(gb_common.adjustExps, function () {
  79 + opts += '<option value="' + this + '">' + this + '</option>';
  80 + });
  81 + $('#turnReason', topf).append(opts).on('change', changeTurnReason);
  82 + //调头空驶
  83 + $('#emptyTurnCbox',topf).html('<input type="checkbox"> 调头空驶回 ' + sch.qdzName);
  84 + $('#emptyTurnCbox input',topf).on('click', emptyTurn);
  85 + });
  86 +
  87 +
  88 + function addTaskForm() {
  89 + var htmlStr = template('sub-task-v2-form-temp', {sch: sch});
  90 + var f = $(htmlStr);
  91 + $('.forms', wrap).append(f);
  92 + //字典转换
  93 + dictionaryUtils.transformDom($('.nt-dictionary', f));
  94 +
  95 + //班次类型切换
  96 + $('select[name=type2]', f).trigger('change');
  97 +
  98 + //滚动条到底
  99 + //$('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight);
  100 +
  101 + f.formValidation({
  102 + framework: 'uikit',
  103 + locale: 'zh_CN'
  104 + }).on('add_reason_field', function () {
  105 + $(this).formValidation('addField', 'reason');
  106 + });
  107 + return f;
  108 + }
  109 +
  110 + function disabled_form(f) {
  111 + //$('input,select',f).attr('disabled', 'disabled');
  112 + $f('type2', f).attr('disabled', 'disabled');
  113 + $f('startStation', f).attr('disabled', 'disabled');
  114 + $f('endStation', f).attr('disabled', 'disabled');
  115 + $f('mileageType', f).attr('disabled', 'disabled');
  116 + $f('destroy', f).attr('disabled', 'disabled');
  117 + return f;
  118 + }
  119 +
  120 + function $f(name, f) {
  121 + return $('[name=' + name + ']', f);
  122 + }
  123 +
  124 +
  125 + /**
  126 + * 切换调头站点
  127 + */
  128 + function changeTurnStation() {
  129 + f1.nextAll('.sub_task_form_v2').remove();
  130 +
  131 + //烂班1
  132 + df1 = destroyForm(disabled_form(addTaskForm()));
  133 + //烂班2
  134 + df2 = destroyForm(disabled_form(addTaskForm()));
  135 + //营运2
  136 + f2 = disabled_form(addTaskForm());
  137 + $('.domains', f2).empty();
  138 + //掉头站点编码
  139 + var eCode = $('#turnStationSelect', topf).val();
  140 +
  141 + //营运1终点
  142 + $f('endStation', f1).val(eCode).trigger('change');
  143 + //烂班1起点
  144 + $f('startStation', df1).val(eCode).trigger('change');
  145 + //烂班2
  146 + $f('startStation', df2).val(sch.zdzCode);
  147 + $f('endStation', df2).val(eCode);
  148 + $f('mileage', df2).val($f('mileage', df1).val()).trigger('input');
  149 + $('[sch_id_inp]', df2).val(nextSch.id);
  150 + //营运2
  151 + $f('startStation', f2).val(eCode);
  152 + $f('endStation', f2).val(sch.qdzCode);
  153 + $f('startDate',f2).val($f('endDate',f1).val());
  154 + $f('mileage', f2).val($f('mileage', f1).val()).trigger('input');
  155 + $('[sch_id_inp]', f2).val(nextSch.id);
  156 +
  157 + //set css
  158 + setCss();
  159 + //reason
  160 + changeTurnReason();
  161 + }
  162 +
  163 + /**
  164 + * 切换调头原因
  165 + */
  166 + function changeTurnReason() {
  167 + var reason = $('#turnReason',topf).val();
  168 + if(reason){
  169 + $('.sub_task_form_v2 [name=reason]', wrap).val(reason).trigger('change');
  170 + //var reInput=$('.remarks_form [name=remarks]', wrap);
  171 + //reInput.val(reInput.val() + reason + ',');
  172 + }
  173 + }
  174 +
  175 + function destroyForm(f) {
  176 + $f('destroy', f)[0].checked = true;
  177 + $('.destroy_reason_wrap', f).show();
  178 + f.addClass('destroy_form');
  179 + f.attr('destroy', true);
  180 + return f;
  181 + }
  182 +
  183 + function setCss() {
  184 + $('.sub_task_form_v2', wrap).each(function () {
  185 + if($(this).hasClass('destroy_form'))
  186 + return true;
  187 +
  188 + if($f('mileageType', this).val()=='service')
  189 + $(this).addClass('service_st_form');
  190 + else
  191 + $(this).removeClass('service_st_form');
  192 + });
  193 + }
  194 +
  195 + /**
  196 + * 空驶调头
  197 + */
  198 + function emptyTurn() {
  199 + if($('#turnStationSelect', topf).val()==''){
  200 + notify_err('你必须先选择调头站点!');
  201 + this.checked=false;
  202 + return;
  203 + }
  204 + if(this.checked){
  205 + //烂班2 烂全程
  206 + $f('startStation', df2).val(sch.zdzCode);
  207 + $f('endStation', df2).val(sch.qdzCode);
  208 + $f('mileage', df2).val(nextSch.jhlcOrig);
  209 + $f('startDate', df2).val(nextSch.dfsj);
  210 + $f('endDate', df2).val(nextSch.zdsj);
  211 + //营运2 变空驶
  212 + f2.removeClass('service_st_form');
  213 + $f('mileageType',f2).val('empty');
  214 + }
  215 + else{
  216 + changeTurnStation();
  217 + }
  218 + }
  219 +
  220 + //提交
  221 + $('button[type=submit]', wrap).on('click', function () {
  222 + $(this).addClass('disabled').attr('disabled','disabled');
  223 + dataArray = [];
  224 + $('form.sub_task_form_v2', wrap).data('valid', false)
  225 + .formValidation('validate');
  226 + });
  227 +
  228 + var dataArray = [];
  229 + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) {
  230 + e.preventDefault();
  231 +
  232 + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this)
  233 + , {remarks: $('#form-s-t',wrap).val()}));
  234 + $(this).data('valid', true);
  235 +
  236 + if (allValidSuccess()) {
  237 + var i = 0;
  238 + (function () {
  239 + var f = arguments.callee;
  240 + if (i >= dataArray.length) {
  241 + /**
  242 + * 为班次添加备注
  243 + */
  244 + //var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $.trim($('#turnReason', modal).val()) + '在' + $('[name=endStation] option:selected', csf).text() + '调头';
  245 + //gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g'));
  246 + UIkit.modal('#add-sub-task-main-modal').hide();
  247 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  248 + return;
  249 + }
  250 + var data = dataArray[i];
  251 + //营运子任务不写备注
  252 + if(data.mileageType == 'service' && !data.destroy)
  253 + data.remarks = '';
  254 + gb_common.$post('/childTask', data, function (rs) {
  255 + notify_succ('子任务添加成功');
  256 + gb_schedule_table.updateSchedule(rs.t);
  257 + i++;
  258 + f();
  259 + });
  260 + })();
  261 + }
  262 + });
  263 + //校验不过
  264 + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () {
  265 + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled');
  266 + });
  267 +
  268 + function allValidSuccess() {
  269 + var flag = true;
  270 + $('form.sub_task_form_v2', wrap).each(function (i, f) {
  271 + if(!$(f).data('valid')){
  272 + flag = false;
  273 + return false;
  274 + }
  275 + });
  276 + return flag;
  277 + }
  278 + })();
  279 + </script>
  280 +</div>
0 281 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/main.html 0 → 100644
  1 +<div class="uk-modal ct_move_modal" id="add-sub-task-main-modal">
  2 + <div class="uk-modal-dialog" style="width: 1100px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>添加子任务</h2></div>
  6 +
  7 + <div class="uk-grid uk-grid-small">
  8 + <div class="uk-width-2-10">
  9 + <ul data-uk-switcher="{connect:'#tempScheduleContent',swiping:false}" class="uk-nav uk-nav-side left_tabs_lg">
  10 + <li name="normal"><a>1、子任务</a></li>
  11 + <li name="in_out"><a>2、进出场</a></li>
  12 + <li name="range_turn"><a>3、区间调头</a></li>
  13 + </ul>
  14 + </div>
  15 + <div class="uk-width-8-10">
  16 + <ul id="tempScheduleContent" class="uk-switcher">
  17 + <li class="tab_cont normalCont"></li>
  18 + <li class="tab_cont inOutCont"></li>
  19 + <li class="tab_cont rangeTurnCont"></li>
  20 + </ul>
  21 + </div>
  22 + </div>
  23 + </div>
  24 +
  25 + <script id="sub-task-v2-form-temp" type="text/html">
  26 + <form class="uk-form uk-form-horizontal uk-animation-fade sub_task_form_v2">
  27 + <span class="task_form_close_icon">
  28 + <i class="uk-icon-times"></i>
  29 + </span>
  30 + <input type="hidden" value="{{sch.id}}" name="schedule.id" sch_id_inp>
  31 + <input type="hidden" value="正常" name="type1">
  32 + <div class="uk-grid">
  33 + <div class="uk-width-1-3">
  34 + <div class="uk-form-row">
  35 + <label class="uk-form-label">班次类型</label>
  36 + <div class="uk-form-controls">
  37 + <select class="form-control nt-dictionary" data-code="-100" name="type2"
  38 + data-group=ChildTaskType></select>
  39 + </div>
  40 + </div>
  41 + </div>
  42 + <div class="uk-width-1-3">
  43 + <div class="uk-form-row">
  44 + <label class="uk-form-label">起点 </label>
  45 + <div class="uk-form-controls">
  46 + <select name="startStation" required></select>
  47 + </div>
  48 + </div>
  49 + </div>
  50 + <div class="uk-width-1-3">
  51 + <div class="uk-form-row">
  52 + <label class="uk-form-label">终点</label>
  53 + <div class="uk-form-controls">
  54 + <select name="endStation" required></select>
  55 + </div>
  56 + </div>
  57 + </div>
  58 + </div>
  59 +
  60 + <div class="uk-grid">
  61 + <div class="uk-width-1-3">
  62 + <div class="uk-form-row">
  63 + <label class="uk-form-label">开始时间</label>
  64 + <div class="uk-form-controls">
  65 + <input name="startDate" value="{{sch.fcsjActual==null?sch.dfsj:sch.fcsjActual}}" type="time"
  66 + required>
  67 + </div>
  68 + </div>
  69 + </div>
  70 + <div class="uk-width-1-3">
  71 + <div class="uk-form-row">
  72 + <label class="uk-form-label">结束时间</label>
  73 + <div class="uk-form-controls">
  74 + <input name="endDate" type="time" required>
  75 + </div>
  76 + </div>
  77 + </div>
  78 + <div class="uk-width-1-3">
  79 + <div class="uk-form-row">
  80 + <label class="uk-form-label">公里数</label>
  81 + <div class="uk-form-controls">
  82 + <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false"
  83 + required>
  84 + </div>
  85 + </div>
  86 + </div>
  87 + </div>
  88 +
  89 + <div class="uk-grid">
  90 + <div class="uk-width-2-3 domains"></div>
  91 + <div class="uk-width-1-3">
  92 + <div class="uk-form-row">
  93 + <label class="uk-form-label">里程类型</label>
  94 + <div class="uk-form-controls">
  95 + <select class="form-control nt-dictionary" required name="mileageType"
  96 + data-group="MileageType"></select>
  97 + </div>
  98 + </div>
  99 + </div>
  100 + </div>
  101 + </form>
  102 + </script>
  103 +
  104 + <script id="st-v2-domains-changecar-form-temp" type="text/html">
  105 + <div class="uk-grid">
  106 + <div class="uk-width-1-2">
  107 + <div class="uk-form-row">
  108 + <label class="uk-form-label">车辆编码</label>
  109 + <div class="uk-form-controls">
  110 + <div class="uk-autocomplete autocomplete-cars">
  111 + <input type="text" name="nbbm" placeholder="车辆自编号">
  112 + </div>
  113 + </div>
  114 + </div>
  115 + </div>
  116 + <div class="uk-width-1-2 destroy_reason_wrap">
  117 + <div class="uk-form-row">
  118 + <label class="uk-form-label">换车原因</label>
  119 + <div class="uk-form-controls">
  120 + <select class="form-control" name="reason" required>
  121 + <option value="">请选择...</option>
  122 + {{each inOutExps as exp i}}
  123 + <option value="{{exp}}">{{exp}}</option>
  124 + {{/each}}
  125 + </select>
  126 + </div>
  127 + </div>
  128 + </div>
  129 + </div>
  130 + </script>
  131 +
  132 + <script id="st-v2-domains-inout-form-temp" type="text/html">
  133 + <div class="uk-grid">
  134 + <div class="uk-width-1-2">
  135 + <div class="uk-form-row" style="padding-top: 5px;">
  136 + <label class="uk-form-label"></label>
  137 + <div class="uk-form-controls">
  138 + <label data-uk-tooltip title="如是无人售票线路,忽略这个选项">
  139 + <input type="checkbox" value=1 name="noClerk" class="i-cbox"> 无售票员
  140 + </label>
  141 + </div>
  142 + </div>
  143 + </div>
  144 + <div class="uk-width-1-2 destroy_reason_wrap">
  145 + <div class="uk-form-row">
  146 + <label class="uk-form-label">进出场原因</label>
  147 + <div class="uk-form-controls">
  148 + <select class="form-control" name="reason" required>
  149 + <option value="">请选择...</option>
  150 + {{each inOutExps as exp i}}
  151 + <option value="{{exp}}">{{exp}}</option>
  152 + {{/each}}
  153 + </select>
  154 + </div>
  155 + </div>
  156 + </div>
  157 + </div>
  158 + </script>
  159 +
  160 + <script id="st-v2-domains-service-form-temp" type="text/html">
  161 + <div class="uk-grid">
  162 + <div class="uk-width-1-2">
  163 + <div class="uk-form-row" style="padding-top: 5px;">
  164 + <label class="uk-form-label"></label>
  165 + <div class="uk-form-controls">
  166 + <label>
  167 + <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班
  168 + </label>
  169 + </div>
  170 + </div>
  171 + </div>
  172 + <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;">
  173 + <div class="uk-form-row">
  174 + <label class="uk-form-label">烂班原因</label>
  175 + <div class="uk-form-controls">
  176 + <select class="form-control" name="reason" required>
  177 + <option value="">请选择...</option>
  178 + {{each adjustExps as exp i}}
  179 + <option value="{{exp}}">{{exp}}</option>
  180 + {{/each}}
  181 + </select>
  182 + </div>
  183 + </div>
  184 + </div>
  185 + </div>
  186 + </script>
  187 + <script>
  188 + (function () {
  189 + var modal = '#add-sub-task-main-modal', sch,
  190 + stationRoutes,
  191 + parks,
  192 + information;
  193 +
  194 + $(modal).on('init', function (e, data) {
  195 + e.stopPropagation();
  196 + sch = data.sch;
  197 +
  198 + //站点路由
  199 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  200 + return a.stationRouteCode - b.stationRouteCode;
  201 + }), 'directions');
  202 + //停车场
  203 + parks = gb_data_basic.simpleParksArray();
  204 + //线路标准
  205 + information = gb_data_basic.getLineInformation(sch.xlBm);
  206 +
  207 + var st_doms = gb_schedule_context_menu.get_st_doms();
  208 + //普通
  209 + $('.normalCont', modal).html(st_doms.custom_dom);
  210 + $('.add_custom_wrap', modal).trigger('init', data);
  211 +
  212 + //进出场班次
  213 + if(sch.bcType=='in'||sch.bcType=='out'){
  214 + $('.left_tabs_lg li[name=in_out]').remove();
  215 + $('.left_tabs_lg li[name=range_turn]').remove();
  216 + }
  217 + else{
  218 + //进出场
  219 + $('.inOutCont', modal).html(st_doms.inout_dom);
  220 + $('.add_inOut_wrap', modal).trigger('init', data);
  221 + //区间调头
  222 + $('.rangeTurnCont', modal).html(st_doms.range_dom);
  223 + $('.add_range_wrap', modal).trigger('init', data);
  224 + }
  225 + });
  226 +
  227 + //班次类型切换事件
  228 + $(modal).on('change', 'select[name=type2]', reCalcInputs_type);
  229 + //烂班选项点击事件
  230 + $(modal).on('change', 'input[name=destroy]', destroyClick);
  231 + //起终点站切换事件
  232 + $(modal).on('change', 'select[name=startStation],select[name=endStation]', reCalcInputs_station);
  233 + //开始时间和公里数改变
  234 + $(modal).on('input', 'input[name=startDate], input[name=mileage]', reCalcEndTime);
  235 + //终点时间改变
  236 + $(modal).on('input', 'input[name=endDate]', reCalcNext_s_time);
  237 + //进出场原因切换
  238 + $(modal).on('change', 'select[name=reason]', reSynchroReason);
  239 + //关闭
  240 + $(modal).on('click', '.task_form_close_icon', closeTaskForm);
  241 +
  242 + /**
  243 + * 根据班次类型切换起终点下拉框
  244 + */
  245 + function reCalcInputs_type() {
  246 + var f = $(this).parents('.sub_task_form_v2');
  247 +
  248 + var routes = stationRoutes[sch.xlDir]
  249 + , lastCode = routes[routes.length - 1].stationCode
  250 + , opts = '', park_opts = '';
  251 + //station options
  252 + $.each(routes, function () {
  253 + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'
  254 + });
  255 + //park options
  256 + for (var code in parks)
  257 + park_opts += '<option value="' + code + '">' + parks[code] + '</option>';
  258 +
  259 + var qdz = $f('startStation', f), zdz = $f('endStation', f), mType = $f('mileageType', f);
  260 + var domainsTemp;
  261 + switch ($(this).val()) {
  262 + case '3'://出场
  263 + qdz.html(park_opts).val(information.carPark);
  264 + zdz.html(opts);
  265 + mType.val('empty').attr('disabled', 'disabled');
  266 + domainsTemp = 'st-v2-domains-inout-form-temp';
  267 + //如果上一个form是进场
  268 + try {
  269 + var prev_f = f.prev('.sub_task_form_v2');
  270 + if ($f('type2', prev_f).val() == 2)
  271 + zdz.val($f('startStation', prev_f).val());
  272 + } catch (e) {
  273 + console.log(e);
  274 + }
  275 + break;
  276 + case '2'://进场
  277 + qdz.html(opts)
  278 + zdz.html(park_opts).val(information.carPark);
  279 + mType.val('empty').attr('disabled', 'disabled');
  280 + domainsTemp = 'st-v2-domains-inout-form-temp';
  281 + break;
  282 + default:
  283 + qdz.html(opts);
  284 + zdz.html(opts).val(lastCode);
  285 + mType.val('service').removeAttr('disabled');
  286 + domainsTemp = 'st-v2-domains-service-form-temp';
  287 + }
  288 +
  289 + //可变选项区域
  290 + $('.domains', f).html(template(domainsTemp, {
  291 + adjustExps: gb_common.adjustExps,
  292 + inOutExps: gb_common.inOutExps
  293 + }));
  294 +
  295 + //校验reason
  296 + f.trigger('add_reason_field');
  297 + //qdz.trigger('change');
  298 + //zdz.trigger('change');
  299 + }
  300 +
  301 + /**
  302 + * 根据站位站距计算公里和时间
  303 + */
  304 + function reCalcInputs_station() {
  305 + var f = $(this).parents('.sub_task_form_v2')
  306 + , type2 = $f('type2', f).val()//班次类型
  307 + , qdzCode = $f('startStation', f).val()//起点站
  308 + , zdzCode = $f('endStation', f).val()//终点站
  309 + , startDate = $f('startDate', f).val();//开始时间
  310 + var mileage, time, upDown;
  311 + switch (type2) {
  312 + case '2':
  313 + upDown = inout_updown(qdzCode, sch);
  314 + break;
  315 + case '3':
  316 + upDown = inout_updown(zdzCode, sch);
  317 + break;
  318 + default:
  319 + upDown = sch.xlDir
  320 + }
  321 +
  322 + switch (upDown + '_' + type2) {
  323 + case '0_3'://上行出场
  324 + mileage = information.upOutMileage;
  325 + time = information.upOutTimer;
  326 + break;
  327 + case '1_3'://下行出场
  328 + mileage = information.downOutMileage;
  329 + time = information.downOutTimer;
  330 + break;
  331 + case '0_2'://上行进场
  332 + mileage = information.upInMileage;
  333 + time = information.upInTimer;
  334 + break;
  335 + case '1_2'://下行进场
  336 + mileage = information.downInMileage;
  337 + time = information.downInTimer;
  338 + break;
  339 + default:
  340 + //线路上站点间
  341 + mileage = calcMileageByRoutes(stationRoutes[upDown], qdzCode, zdzCode);
  342 + time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage);
  343 + }
  344 +
  345 + $f('mileage', f).val(mileage);
  346 + var et = moment(startDate, 'HH:mm').add(time, 'minutes');
  347 + $f('endDate', f).val(et.format('HH:mm'));
  348 +
  349 + if (type2 != 1) {
  350 + reCalcEndTime.call(this);
  351 + }
  352 + }
  353 +
  354 + /**
  355 + * 计算结束时间
  356 + */
  357 + function reCalcEndTime() {
  358 + var f = $(this).parents('.sub_task_form_v2')
  359 + , startDate = $f('startDate', f).val()//开始时间
  360 + , mileage = $f('mileage', f).val()//公里
  361 + , type2 = $f('type2', f).val();//班次类型
  362 + if (!startDate || !mileage)
  363 + return;
  364 +
  365 + var time;
  366 + if (type2 == 1) {
  367 + time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage);
  368 + }
  369 + else if (type2 == 2) {
  370 + //进场
  371 + var qdzCode = $f('startStation', f).val(),
  372 + updown = inout_updown(qdzCode, sch);
  373 +
  374 + if (updown == -1)
  375 + return;
  376 + time = updown == 0 ? information.upInTimer : information.downInTimer;
  377 + }
  378 + else if (type2 == 3) {
  379 + //出场
  380 + var zdzCode = $f('endStation', f).val(),
  381 + updown = inout_updown(zdzCode, sch);
  382 +
  383 + if (updown == -1)
  384 + return;
  385 + time = updown == 0 ? information.upOutTimer : information.downOutTimer;
  386 + }
  387 +
  388 + var et = moment(startDate, 'HH:mm').add(time, 'minutes');
  389 + $f('endDate', f).val(et.format('HH:mm')).trigger('input');
  390 + }
  391 +
  392 + /**
  393 + * 将结束时间写入下一个表单的开始时间
  394 + */
  395 + function reCalcNext_s_time() {
  396 + var f = $(this).parents('.sub_task_form_v2'),
  397 + et = $f('endDate', f).val();
  398 +
  399 + var nf = gb_common.next_elem('sub_task_form_v2', f);
  400 +
  401 + if (f.attr('destroy'))
  402 + et = $f('startDate', f).val();
  403 +
  404 + if (nf.length > 0) {
  405 + $f('startDate', nf).val(et).trigger('input');
  406 + }
  407 + }
  408 +
  409 + /**
  410 + * 切换原因
  411 + */
  412 + function reSynchroReason() {
  413 + var f = $(this).parents('.sub_task_form_v2'),
  414 + reason = $(this).val();
  415 +
  416 + var nf = gb_common.next_elem('sub_task_form_v2', f),
  417 + nInput = $f('reason', nf);
  418 +
  419 + if (nf.length > 0 && nInput.length > 0) {
  420 + nInput.val(reason).trigger('change');
  421 + }
  422 + else {
  423 + var cont = f.parents('li.tab_cont'),
  424 + remInput = $('.remarks_form [name=remarks]', cont);
  425 +
  426 + if(remInput.val()==reason + ',')
  427 + return;
  428 + remInput.val(remInput.val() + reason + ',');
  429 + }
  430 + }
  431 +
  432 + function calcMileageByRoutes(routes, s, e) {
  433 + var code, flag, mileage = 0;
  434 + $.each(routes, function () {
  435 + code = this['stationCode'];
  436 + if (flag) {
  437 + if (!this.distances)
  438 + this.distances = 0;
  439 + mileage = gb_common.accAdd(mileage, this.distances);
  440 + }
  441 + if (code == s)
  442 + flag = true;
  443 + if (code == e)
  444 + return false;
  445 + });
  446 + return mileage;
  447 + }
  448 +
  449 + function destroyClick() {
  450 + var f = $(this).parents('.sub_task_form_v2');
  451 + if (this.checked) {
  452 + $('.destroy_reason_wrap', f).show();
  453 + f.attr('destroy', true).addClass('destroy_form');
  454 + }
  455 + else {
  456 + $('.destroy_reason_wrap', f).hide();
  457 + f.removeAttr('destroy').removeClass('destroy_form');
  458 + }
  459 + }
  460 +
  461 + function $f(name, f) {
  462 + return $('[name=' + name + ']', f);
  463 + }
  464 +
  465 + function closeTaskForm() {
  466 + $(this).parents('.sub_task_form_v2').remove();
  467 + }
  468 +
  469 + /**
  470 + * 进出场上下行
  471 + * @param qdzCode
  472 + * @param sch
  473 + */
  474 + function inout_updown(station, sch) {
  475 + if (station == sch.qdzCode)
  476 + return sch.xlDir;
  477 + else if (station == sch.zdzCode)
  478 + return sch.xlDir == 0 ? 1 : 0;
  479 + else
  480 + return -1;
  481 + }
  482 +
  483 + })();
  484 + </script>
  485 +</div>
0 486 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/js/common.js
... ... @@ -21,6 +21,9 @@ var gb_common = (function () {
21 21 0x12: '报警'
22 22 };
23 23  
  24 + var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他'];
  25 + var inOutExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他'];
  26 +
24 27 var groupBy = function (list, field) {
25 28 var rs = {},
26 29 key;
... ... @@ -324,6 +327,17 @@ var gb_common = (function () {
324 327 return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e;
325 328 };
326 329  
  330 + function accDiv(arg1,arg2){
  331 + var t1=0,t2=0,r1,r2;
  332 + try{t1=arg1.toString().split(".")[1].length}catch(e){}
  333 + try{t2=arg2.toString().split(".")[1].length}catch(e){}
  334 + with(Math){
  335 + r1=Number(arg1.toString().replace(".",""))
  336 + r2=Number(arg2.toString().replace(".",""))
  337 + return (r1/r2)*pow(10,t2-t1);
  338 + }
  339 + }
  340 +
327 341 function mul(a, b) {
328 342 var c = 0,
329 343 d = a.toString(),
... ... @@ -372,6 +386,26 @@ var gb_common = (function () {
372 386 return rs;
373 387 };
374 388  
  389 + var next_elem = function (clazz, e) {
  390 + var ne = e.next();
  391 + if(ne.length==0)
  392 + return [];
  393 + else if(ne.hasClass(clazz))
  394 + return ne;
  395 + else
  396 + return next_elem(clazz, ne);
  397 + };
  398 +
  399 + var getDisabledVal = function (f) {
  400 + var rs = {};
  401 + $('input,select', f).each(function () {
  402 + if($(this).attr('disabled')){
  403 + rs[$(this).attr('name')]=$(this).val();
  404 + }
  405 + });
  406 + return rs;
  407 + };
  408 +
375 409 return {
376 410 reqCode80: reqCode80,
377 411 groupBy: groupBy,
... ... @@ -395,7 +429,13 @@ var gb_common = (function () {
395 429 trim: trim,
396 430 remarksAutocomplete: remarksAutocomplete,
397 431 flatpickrDateTimeConfig: flatpickrDateTimeConfig,
398   - inverse: inverse
  432 + inverse: inverse,
  433 + accDiv: accDiv,
  434 + mul: mul,
  435 + adjustExps: adjustExps,
  436 + inOutExps: inOutExps,
  437 + next_elem: next_elem,
  438 + getDisabledVal: getDisabledVal
399 439  
400 440 //whichTransitionEvent:whichTransitionEvent
401 441 };
... ...
src/main/resources/static/real_control_v2/js/forms/form_embed.js
... ... @@ -61,7 +61,7 @@ var gb_embed_form_hanlde = (function () {
61 61  
62 62 }
63 63 });
64   - }
  64 + };
65 65  
66 66  
67 67 return {
... ...
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
... ... @@ -7,7 +7,23 @@ var gb_schedule_context_menu = (function () {
7 7 bgclose: false
8 8 },
9 9 folder = '/real_control_v2/fragments/line_schedule/context_menu';
  10 +
  11 + //提前缓存子任务的片段页面
  12 + var st_doms={};
  13 + $.get(folder + '/sub_task_v2/add_custom.html', function (dom) {
  14 + st_doms.custom_dom=dom;
  15 + });
  16 + $.get(folder + '/sub_task_v2/add_in_out.html', function (dom) {
  17 + st_doms.inout_dom=dom;
  18 + });
  19 + $.get(folder + '/sub_task_v2/add_range_turn.html', function (dom) {
  20 + st_doms.range_dom=dom;
  21 + });
  22 +
10 23 var callbackHandler = {
  24 + get_st_doms: function () {
  25 + return st_doms;
  26 + },
11 27 dftz: function (sch) {
12 28 open_modal(folder + '/dftz.html', {
13 29 sch: sch
... ... @@ -234,6 +250,11 @@ var gb_schedule_context_menu = (function () {
234 250 open_modal(folder + '/add_temp_sch.html', {
235 251 sch: sch
236 252 }, modal_opts);
  253 + },
  254 + add_sub_task: function (sch) {
  255 + open_modal(folder + '/sub_task_v2/main.html', {
  256 + sch: sch
  257 + }, modal_opts);
237 258 }
238 259 };
239 260  
... ... @@ -274,7 +295,7 @@ var gb_schedule_context_menu = (function () {
274 295 },
275 296 'lj_zrw': {
276 297 name: '临加/子任务'
277   - },
  298 + }/*,
278 299 'shortcut': {
279 300 name: '...',
280 301 items: {
... ... @@ -294,6 +315,13 @@ var gb_schedule_context_menu = (function () {
294 315 name: '(子任务)区间调头'
295 316 }
296 317 }
  318 + }*/,
  319 + 'sep3': '---------',
  320 + 'add_temp_sch': {
  321 + name: '添加临加班次'
  322 + },
  323 + 'add_sub_task': {
  324 + name: '添加子任务'
297 325 },
298 326 'sep4': '---------',
299 327 'tzrc': {
... ... @@ -305,7 +333,7 @@ var gb_schedule_context_menu = (function () {
305 333 'wdtz': {
306 334 name: '误点调整'
307 335 },
308   - 'sep3': '---------',
  336 + 'sep4': '---------',
309 337 'lp_change': {
310 338 name: '路牌对调'
311 339 }
... ...
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
... ... @@ -557,6 +557,20 @@ var gb_schedule_table = (function () {
557 557 }
558 558 };
559 559  
  560 + /* 下一个班次普通班次 */
  561 + var getNextNormalSch = function (sch) {
  562 +
  563 + var array = gb_common.get_vals(line2Schedule[sch.xlBm]).filter(function (a) {
  564 + return a.clZbh == sch.clZbh && a.bcType=='normal';
  565 + }).sort(schedule_sort);
  566 +
  567 + for (var i = 0, item; item = array[i++];) {
  568 + if (array[i].id == sch.id) {
  569 + return i < array.length ? array[i + 1] : null;
  570 + }
  571 + }
  572 + };
  573 +
560 574 /** 添加备注信息 */
561 575 var addRemarks = function (list, remarks) {
562 576 //if(!list || list)
... ... @@ -630,6 +644,7 @@ var gb_schedule_table = (function () {
630 644 reLoadAndRefresh: reLoadAndRefresh,
631 645 showLateBadge: showLateBadge,
632 646 cancelLateBadge: cancelLateBadge,
633   - refreshAll: refreshAll
  647 + refreshAll: refreshAll,
  648 + getNextNormalSch: getNextNormalSch
634 649 };
635 650 })();
... ...
src/main/resources/static/real_control_v2/js/main.js
... ... @@ -169,8 +169,8 @@ var disabled_submit_btn = function (form) {
169 169 function showUpdateDescription() {
170 170 //更新说明
171 171 var updateDescription = {
172   - date: '2017-06-22',
173   - text: '<h5>优化了轨迹回放,可放大缩小窗口、可拖动进度条、手动呼出线路配车...</h5>'
  172 + date: '2017-07-05',
  173 + text: '<h5>稍微调整了添加子任务的界面</h5><h5>1、现在进出场子任务也必须选择进场原因</h5><h5>2、现在进出场子任务可以勾选 “无售票员” 如果是无人售票线路,请忽略这个选项</h5><h5>3、现在做中途进场子任务时,可以勾选“换车出场至中途站继续营运”</h5>'
174 174 };
175 175  
176 176 var storage = window.localStorage
... ...