Commit da1b70f07837ed726467eb9c3a3d4e752a6f6958

Authored by 徐烜
1 parent 88927f88

1、计划调度添加时刻表和排班设定线路区间功能(具体查看更新的前端和后端代码)

src/main/java/com/bsth/controller/schedule/core/legacy/TTInfoDetailController.java
... ... @@ -3,6 +3,7 @@ package com.bsth.controller.schedule.core.legacy;
3 3 import com.bsth.common.ResponseCode;
4 4 import com.bsth.controller.schedule.BController;
5 5 import com.bsth.controller.schedule.core.TTInfoDetailController_facade;
  6 +import com.bsth.controller.schedule.dto.LineRegionDto;
6 7 import com.bsth.entity.schedule.TTInfoDetail;
7 8 import com.bsth.service.schedule.TTInfoDetailService;
8 9 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
... ... @@ -31,6 +32,11 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> {
31 32 @Autowired
32 33 private TTInfoDetailService ttInfoDetailService;
33 34  
  35 + @RequestMapping(value = "/lineregion", method = RequestMethod.GET)
  36 + public List<LineRegionDto> findLineRegion(Integer lineId, Integer lineVersion, Integer lineDir) {
  37 + return this.ttInfoDetailService.findLineRegion(lineId, lineVersion, lineDir);
  38 + }
  39 +
34 40 @RequestMapping(value = "/bcdetail", method = RequestMethod.GET)
35 41 public List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) {
36 42 return ttInfoDetailService.findBcdetails(xlId, ttinfoId, lpId);
... ...
src/main/java/com/bsth/controller/schedule/dto/LineRegionDto.java 0 → 100644
  1 +package com.bsth.controller.schedule.dto;
  2 +
  3 +import java.util.List;
  4 +
  5 +/**
  6 + * 线路预设区间dto。
  7 + */
  8 +public class LineRegionDto {
  9 + /** 区间Id */
  10 + private Integer regionId;
  11 + /** 区间名 */
  12 + private String regionName;
  13 + /** 线路Id */
  14 + private Integer lineId;
  15 + /** 线路方向 */
  16 + private Integer lineDir;
  17 + /** 线路站点路由dto */
  18 + private List<LineStationRouteDto> lineStationRouteDtoList;
  19 +
  20 + public Integer getRegionId() {
  21 + return regionId;
  22 + }
  23 +
  24 + public void setRegionId(Integer regionId) {
  25 + this.regionId = regionId;
  26 + }
  27 +
  28 + public String getRegionName() {
  29 + return regionName;
  30 + }
  31 +
  32 + public void setRegionName(String regionName) {
  33 + this.regionName = regionName;
  34 + }
  35 +
  36 + public Integer getLineId() {
  37 + return lineId;
  38 + }
  39 +
  40 + public void setLineId(Integer lineId) {
  41 + this.lineId = lineId;
  42 + }
  43 +
  44 + public Integer getLineDir() {
  45 + return lineDir;
  46 + }
  47 +
  48 + public void setLineDir(Integer lineDir) {
  49 + this.lineDir = lineDir;
  50 + }
  51 +
  52 + public List<LineStationRouteDto> getLineStationRouteDtoList() {
  53 + return lineStationRouteDtoList;
  54 + }
  55 +
  56 + public void setLineStationRouteDtoList(List<LineStationRouteDto> lineStationRouteDtoList) {
  57 + this.lineStationRouteDtoList = lineStationRouteDtoList;
  58 + }
  59 +
  60 + public LineRegionDto() {}
  61 + public LineRegionDto(Builder builder) {
  62 + this.regionId = builder.regionId;
  63 + this.regionName = builder.regionName;
  64 + this.lineId = builder.lineId;
  65 + this.lineDir = builder.lineDir;
  66 + this.lineStationRouteDtoList = builder.lineStationRouteDtoList;
  67 + }
  68 +
  69 + public static Builder getBuilder() {
  70 + return new Builder();
  71 + }
  72 + public static class Builder {
  73 + /** 区间Id */
  74 + private Integer regionId;
  75 + /** 区间名 */
  76 + private String regionName;
  77 + /** 线路Id */
  78 + private Integer lineId;
  79 + /** 线路方向 */
  80 + private Integer lineDir;
  81 + /** 线路站点路由dto */
  82 + private List<LineStationRouteDto> lineStationRouteDtoList;
  83 +
  84 + public Builder setRegionId(Integer regionId) {
  85 + this.regionId = regionId;
  86 + return this;
  87 + }
  88 +
  89 + public Builder setRegionName(String regionName) {
  90 + this.regionName = regionName;
  91 + return this;
  92 + }
  93 +
  94 + public Builder setLineId(Integer lineId) {
  95 + this.lineId = lineId;
  96 + return this;
  97 + }
  98 +
  99 + public Builder setLineDir(Integer lineDir) {
  100 + this.lineDir = lineDir;
  101 + return this;
  102 + }
  103 +
  104 + public Builder setLineStationRouteDtoList(List<LineStationRouteDto> lineStationRouteDtoList) {
  105 + this.lineStationRouteDtoList = lineStationRouteDtoList;
  106 + return this;
  107 + }
  108 +
  109 + public LineRegionDto build() {
  110 + return new LineRegionDto(this);
  111 + }
  112 + }
  113 +}
... ...
src/main/java/com/bsth/controller/schedule/dto/LineStationRouteDto.java 0 → 100644
  1 +package com.bsth.controller.schedule.dto;
  2 +
  3 +/**
  4 + * 线路站点路由dto。
  5 + */
  6 +public class LineStationRouteDto {
  7 + /** 站点名字 */
  8 + private String stationName;
  9 + /** 站点编码 */
  10 + private String stationCode;
  11 +
  12 + public String getStationName() {
  13 + return stationName;
  14 + }
  15 +
  16 + public void setStationName(String stationName) {
  17 + this.stationName = stationName;
  18 + }
  19 +
  20 + public String getStationCode() {
  21 + return stationCode;
  22 + }
  23 +
  24 + public void setStationCode(String stationCode) {
  25 + this.stationCode = stationCode;
  26 + }
  27 +
  28 + public LineStationRouteDto() {}
  29 + public LineStationRouteDto(Builder builder) {
  30 + this.stationName = builder.stationName;
  31 + this.stationCode = builder.stationCode;
  32 + }
  33 +
  34 + public static Builder getBuilder() {
  35 + return new Builder();
  36 + }
  37 + public static class Builder {
  38 + /** 站点名字 */
  39 + private String stationName;
  40 + /** 站点编码 */
  41 + private String stationCode;
  42 +
  43 + public Builder setStationName(String stationName) {
  44 + this.stationName = stationName;
  45 + return this;
  46 + }
  47 +
  48 + public Builder setStationCode(String stationCode) {
  49 + this.stationCode = stationCode;
  50 + return this;
  51 + }
  52 +
  53 + public LineStationRouteDto build() {
  54 + return new LineStationRouteDto(this);
  55 + }
  56 + }
  57 +}
... ...
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
... ... @@ -127,6 +127,9 @@ public class SchedulePlanInfo extends BEntity {
127 127 @Column(nullable = false)
128 128 private String bcType;
129 129  
  130 + /** 班次类型为区间时,关联预设线路区间id */
  131 + private Integer lineRegion;
  132 +
130 133 // 重要的新增字段
131 134 /** 关联的时刻表id */
132 135 private Long ttInfo;
... ... @@ -348,6 +351,9 @@ public class SchedulePlanInfo extends BEntity {
348 351  
349 352 this.sName = employeeConfigInfo.getSpy().getPersonnelName();
350 353 }
  354 +
  355 + // 时刻表新增的线路区间
  356 + this.lineRegion = ttInfoDetail.getLineRegion() == null ? null : ttInfoDetail.getLineRegion().getId();
351 357 }
352 358  
353 359 // 时刻明细数据
... ... @@ -425,9 +431,10 @@ public class SchedulePlanInfo extends BEntity {
425 431 "xl_dir, qdz_code, qdz_name, zdz_code, zdz_name, " +
426 432 "fcsj, fcno, bcs, jhlc, bcsj, bc_type, " +
427 433 "tt_info, tt_info_name, remark, schedule_plan, " +
  434 + "line_region, " +
428 435 "create_by, update_by, create_date, update_date) " +
429 436 "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
430   - "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  437 + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
431 438 return sql;
432 439 }
433 440  
... ... @@ -468,10 +475,11 @@ public class SchedulePlanInfo extends BEntity {
468 475 if (this.ttInfoName != null) ps.setString(34, this.ttInfoName); else ps.setNull(34, Types.VARCHAR);
469 476 if (this.remark != null) ps.setString(35, this.remark); else ps.setNull(35, Types.VARCHAR);
470 477 if (this.schedulePlan != null) ps.setLong(36, this.schedulePlan.getId()); else ps.setNull(36, Types.BIGINT);
471   - if (this.getCreateBy() != null) ps.setInt(37, this.getCreateBy().getId()); else ps.setNull(37, Types.INTEGER);
472   - if (this.getUpdateBy() != null) ps.setInt(38, this.getUpdateBy().getId()); else ps.setNull(38, Types.INTEGER);
473   - if (this.getCreateDate() != null) ps.setTimestamp(39, new java.sql.Timestamp(this.getCreateDate().getTime())); else ps.setNull(39, Types.TIMESTAMP);
474   - if (this.getUpdateDate() != null) ps.setTimestamp(40, new java.sql.Timestamp(this.getUpdateDate().getTime())); else ps.setNull(40, Types.TIMESTAMP);
  478 + if (this.lineRegion != null) ps.setLong(37, this.lineRegion); else ps.setNull(37, Types.INTEGER);
  479 + if (this.getCreateBy() != null) ps.setInt(38, this.getCreateBy().getId()); else ps.setNull(38, Types.INTEGER);
  480 + if (this.getUpdateBy() != null) ps.setInt(39, this.getUpdateBy().getId()); else ps.setNull(39, Types.INTEGER);
  481 + if (this.getCreateDate() != null) ps.setTimestamp(40, new java.sql.Timestamp(this.getCreateDate().getTime())); else ps.setNull(40, Types.TIMESTAMP);
  482 + if (this.getUpdateDate() != null) ps.setTimestamp(41, new java.sql.Timestamp(this.getUpdateDate().getTime())); else ps.setNull(41, Types.TIMESTAMP);
475 483 }
476 484  
477 485 public Long getId() {
... ... @@ -793,4 +801,12 @@ public class SchedulePlanInfo extends BEntity {
793 801 public void setModifyCount(Integer modifyCount) {
794 802 this.modifyCount = modifyCount;
795 803 }
  804 +
  805 + public Integer getLineRegion() {
  806 + return lineRegion;
  807 + }
  808 +
  809 + public void setLineRegion(Integer lineRegion) {
  810 + this.lineRegion = lineRegion;
  811 + }
796 812 }
... ...
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
... ... @@ -2,6 +2,7 @@ package com.bsth.entity.schedule;
2 2  
3 3 import com.bsth.entity.CarPark;
4 4 import com.bsth.entity.Line;
  5 +import com.bsth.entity.LineRegion;
5 6 import com.bsth.entity.Station;
6 7 import com.bsth.service.schedule.utils.TimeTableProto;
7 8 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
... ... @@ -87,6 +88,10 @@ public class TTInfoDetail extends BEntity {
87 88 @Column(nullable = false)
88 89 private String bcType;
89 90  
  91 + /** 班次类型为区间时,关联预设线路区间对象 表 bsth_c_line_region */
  92 + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
  93 + private LineRegion lineRegion;
  94 +
90 95 /** 是否分班(表示这个班次是否是晚班班次,就是换另外一个驾驶员开)*/
91 96 private Boolean isFB;
92 97 /** 是否停驶(表示此班次执行完成,停在终点站,不进场) */
... ... @@ -343,4 +348,12 @@ public class TTInfoDetail extends BEntity {
343 348 public void setLineVersion(int lineVersion) {
344 349 this.lineVersion = lineVersion;
345 350 }
  351 +
  352 + public LineRegion getLineRegion() {
  353 + return lineRegion;
  354 + }
  355 +
  356 + public void setLineRegion(LineRegion lineRegion) {
  357 + this.lineRegion = lineRegion;
  358 + }
346 359 }
... ...
src/main/java/com/bsth/repository/schedule/TTInfoDetailRepository.java
1 1 package com.bsth.repository.schedule;
2 2  
  3 +import com.bsth.entity.LineRegion;
3 4 import com.bsth.entity.schedule.TTInfoDetail;
4 5 import com.bsth.repository.BaseRepository;
5 6 import org.springframework.data.domain.Page;
... ... @@ -18,6 +19,13 @@ import java.util.List;
18 19 @Repository
19 20 public interface TTInfoDetailRepository extends BaseRepository<TTInfoDetail, Long> {
20 21  
  22 + @Query(value = "select distinct lr " +
  23 + "from LineRegion lr " +
  24 + "left join fetch lr.stationRoutes lru " +
  25 + "where lr.line = ?1 and lr.version = ?2 and lr.direction = ?3")
  26 + List<LineRegion> findLineRegion(Integer lineId, Integer lineVersion, Integer lineDir);
  27 +
  28 +
21 29 @EntityGraph(value = "tTInfoDetail_xl_lp_qdz_zdz_tcc", type = EntityGraph.EntityGraphType.FETCH)
22 30 @Override
23 31 Page<TTInfoDetail> findAll(Specification<TTInfoDetail> spec, Pageable pageable);
... ...
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
1 1 package com.bsth.service.schedule;
2 2  
  3 +import com.bsth.controller.schedule.dto.LineRegionDto;
3 4 import com.bsth.entity.schedule.TTInfoDetail;
4 5 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
5 6 import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
... ... @@ -17,6 +18,16 @@ import java.util.Map;
17 18 public interface TTInfoDetailService extends BService<TTInfoDetail, Long> {
18 19  
19 20 /**
  21 + * 查找线路预设区间。
  22 + * @param lineId 线路Id
  23 + * @param lineVersion 线路版本
  24 + * @param lineDir 线路方向
  25 + * @return dto列表
  26 + */
  27 + List<LineRegionDto> findLineRegion(Integer lineId, Integer lineVersion, Integer lineDir);
  28 +
  29 +
  30 + /**
20 31 * 获取待编辑的数据。
21 32 * @param xlid 线路id
22 33 * @param ttid 时刻表id
... ...
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
... ... @@ -3,9 +3,9 @@ package com.bsth.service.schedule.impl;
3 3 import com.alibaba.fastjson.JSONArray;
4 4 import com.alibaba.fastjson.JSONObject;
5 5 import com.bsth.common.ResponseCode;
6   -import com.bsth.entity.CarPark;
7   -import com.bsth.entity.Line;
8   -import com.bsth.entity.LineInformation;
  6 +import com.bsth.controller.schedule.dto.LineRegionDto;
  7 +import com.bsth.controller.schedule.dto.LineStationRouteDto;
  8 +import com.bsth.entity.*;
9 9 import com.bsth.entity.schedule.GuideboardInfo;
10 10 import com.bsth.entity.schedule.TTInfo;
11 11 import com.bsth.entity.schedule.TTInfoDetail;
... ... @@ -121,6 +121,33 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
121 121 }
122 122  
123 123 @Override
  124 + public List<LineRegionDto> findLineRegion(Integer lineId, Integer lineVersion, Integer lineDir) {
  125 + List<LineRegionDto> lineRegionDtoList = new ArrayList<>();
  126 + List<LineRegion> lineRegionList = this.ttInfoDetailRepository.findLineRegion(lineId, lineVersion, lineDir);
  127 + for (LineRegion lineRegion : lineRegionList) {
  128 + List<LineStationRouteDto> lineStationRouteDtoList = new ArrayList<>();
  129 + for (LsStationRoute lsStationRoute : lineRegion.getStationRoutes()) {
  130 + LineStationRouteDto lineStationRouteDto = LineStationRouteDto.getBuilder()
  131 + .setStationName(lsStationRoute.getStationName())
  132 + .setStationCode(lsStationRoute.getStationCode())
  133 + .build();
  134 + lineStationRouteDtoList.add(lineStationRouteDto);
  135 + }
  136 +
  137 + LineRegionDto lineRegionDto = LineRegionDto.getBuilder()
  138 + .setRegionId(lineRegion.getId())
  139 + .setRegionName(lineRegion.getRegionAlias())
  140 + .setLineId(lineRegion.getLine())
  141 + .setLineDir(lineRegion.getDirection())
  142 + .setLineStationRouteDtoList(lineStationRouteDtoList)
  143 + .build();
  144 + lineRegionDtoList.add(lineRegionDto);
  145 + }
  146 +
  147 + return lineRegionDtoList;
  148 + }
  149 +
  150 + @Override
124 151 public Long findMaxFcno(Integer xlid, Long ttinfoid) {
125 152 return ttInfoDetailRepository.findMaxFcno(xlid, ttinfoid);
126 153 }
... ...
src/main/resources/static/pages/scheduleApp/Gruntfile.js
... ... @@ -95,7 +95,8 @@ module.exports = function (grunt) {
95 95 'module/common/dts2/scheduleplan/saScpdate.js', // saScpdate指令(非通用指令,只在排班计划form中使用)
96 96 'module/common/dts2/scheduleplan/saSrule.js', // saSrule指令(非通用指令,只在排班计划form中使用)
97 97 'module/common/dts2/scheduleplan/saPlaninfoedit.js', // saPlaninfoedit指令(非通用指令,只在调度执勤日报中使用)
98   - 'module/common/dts2/scheduleplan/saPlaninfoedit2.js' // saPlaninfoedit2指令(非通用指令,只在调度执勤日报中使用)
  98 + 'module/common/dts2/scheduleplan/saPlaninfoedit2.js', // saPlaninfoedit2指令(非通用指令,只在调度执勤日报中使用)
  99 + 'module/common/dts2/ttinfotable/saLineRegion.js' // 预设线路区间指令(非通用指令,只在时刻表班次明细修改页面中使用)
99 100 ],
100 101 dest: 'module/common/prj-common-directive.js'
101 102 },
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saLineRegion.html 0 → 100644
  1 +<div name="{{ $saLineRegionCtrl.$name_attr }}" ng-model="$saLineRegionCtrl.$$internalFormValidateFlag">
  2 + <style>
  3 + .slr-select {
  4 + min-height: 180px;
  5 + border: 1px solid #ddd;
  6 + }
  7 + .slr-select .slr-select-title {
  8 + margin: 0px 5px 5px 5px;
  9 + padding-top: 7px;
  10 + padding-left: 0;
  11 + }
  12 + .slr-select .slr-select-content {
  13 + text-align: left;
  14 + min-height: 100px;
  15 + padding-right: 0px;
  16 + }
  17 + .slr-select .slr-select-body {
  18 + margin-top: 10px;
  19 + overflow: auto;
  20 + width: auto;
  21 + min-height: 100px;
  22 + }
  23 +
  24 + .slr-select .slr-select-body h3 {
  25 + margin: 7px 0 5px;
  26 + text-indent: 5px;
  27 + margin: 0;
  28 + height: 31px;
  29 + line-height: 31px;
  30 + color: #2765A7;
  31 +
  32 + text-overflow: ellipsis;
  33 + overflow: hidden;
  34 + white-space: nowrap;
  35 + }
  36 +
  37 + .slr-select .slr-select-body .increase-popover-width {
  38 + max-width: 450px;
  39 + }
  40 +
  41 +
  42 +
  43 + </style>
  44 +
  45 +
  46 + <div class="col-md-12 slr-select">
  47 + <div class="col-md-12 slr-select-title">
  48 + <div class="col-md-12">
  49 + 当前预设的区间,共{{ $saLineRegionCtrl.$$internalLineRegionList.length }}个
  50 + </div>
  51 + </div>
  52 + <div class="col-md-12 slr-select-content">
  53 + <div class="slr-select-body">
  54 +
  55 + <script type="text/ng-template" id="$saLineRegionCtrl_popover.html">
  56 + <div><span>预设区间站点路由列表:</span></div>
  57 + <div><span>{{ info.$$internal_route_strs }}</span></div>
  58 + </script>
  59 +
  60 + <div ng-repeat="info in $saLineRegionCtrl.$$internalLineRegionList track by $index">
  61 +
  62 + <div class="col-md-12" uib-popover-template="'$saLineRegionCtrl_popover.html'"
  63 + popover-class="increase-popover-width"
  64 + popover-trigger="mouseenter">
  65 + <h3 class="col-md-8">
  66 + <a href="javascript:void(0)" ng-click="$saLineRegionCtrl.$$internalSelectLineRegion(info)">
  67 + {{ info.regionName }}
  68 + </a>
  69 + </h3>
  70 + <span class="glyphicon glyphicon-ok" aria-hidden="true" ng-if="info == $saLineRegionCtrl.$$internalLineRegionSelected"></span>
  71 +
  72 + </div>
  73 + </div>
  74 + </div>
  75 + </div>
  76 + </div>
  77 +
  78 +
  79 +</div>
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saLineRegion.js 0 → 100644
  1 +/**
  2 + * 预设线路区间指令。
  3 + */
  4 +angular.module('ScheduleApp').directive(
  5 + 'saLineRegion',
  6 + [
  7 + 'TimeTableDetailManageService_g',
  8 + function(service) {
  9 + return {
  10 + restrict: 'E',
  11 + templateUrl: '/pages/scheduleApp/module/common/dts2/ttinfotable/saLineRegion.html',
  12 + scope: {
  13 + xlid: '=', // 线路Id
  14 + xlversion: '=', // 线路版本
  15 + xldir: '=', // 线路方向
  16 + xlrgid: '=', // 线路区间id(已经选中)
  17 + error: '=', // 错误输出(用于form验证输出)
  18 + lineRegionClickHandler: '&lrclick' // 线路区间点击
  19 + },
  20 + controllerAs: '$saLineRegionCtrl',
  21 + bindToController: true,
  22 + controller: function() {
  23 + var self = this;
  24 +
  25 + // 内部ng-model值,用于和required配对
  26 + // 用于外部表单包含指令时,指令内部的错误开关,错误输出到error绑定属性上
  27 + self.$$internalFormValidateFlag = undefined;
  28 +
  29 + //------------------ 组件内部业务数据(如下)-----------------//
  30 + // 预设区间列表(和后台TTInfoDetailController的findLineRegion返回的数据对应)
  31 + self.$$internalLineRegionList = [];
  32 + self.$$internalLineRegionSelected = undefined; // 被选中的具体预设区间
  33 + },
  34 +
  35 + compile: function(tElem, tAttrs) {
  36 + // 获取所有属性,并验证
  37 + var $name_attr = tAttrs['name']; // 控件的名字
  38 + if (!$name_attr) {
  39 + throw "saLineRegion使用时必须有name属性!";
  40 + }
  41 +
  42 + // controlAs名字
  43 + var ctrlAs = '$saLineRegionCtrl';
  44 +
  45 + var xl_id = undefined; // 线路Id
  46 + var xl_version = undefined; // 线路版本
  47 + var xl_dir = undefined; // 线路方向
  48 +
  49 + // 内部添加required验证,将所有的错误应用到required中
  50 + tElem.find('div').attr('required', "");
  51 +
  52 + return {
  53 + pre: function(scope, element, attr) {
  54 + scope[ctrlAs].error = "线路预设区间未选择!";
  55 +
  56 + //--------------- 内部业务方法(以下) ---------------//
  57 + // 选中预设区间
  58 + scope[ctrlAs].$$internalSelectLineRegion = function(lineRegion) {
  59 + if (lineRegion != scope[ctrlAs].$$internalLineRegionSelected) {
  60 + // 1、设定选中的线路区间,并检测数据
  61 + scope[ctrlAs].$$internalLineRegionSelected = lineRegion;
  62 + var lineStationRouteDtoList = lineRegion.lineStationRouteDtoList;
  63 + if (!lineStationRouteDtoList || lineStationRouteDtoList.length < 2) {
  64 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  65 + scope[ctrlAs].error = "预设区间路由至少需要2个站点!";
  66 + return;
  67 + }
  68 +
  69 + var regionId = lineRegion.regionId;
  70 + var startStationCode = lineStationRouteDtoList[0].stationCode;
  71 + var startStationName = lineStationRouteDtoList[0].stationName;
  72 + var endStationCode = lineStationRouteDtoList[lineStationRouteDtoList.length - 1].stationCode;
  73 + var endStationName = lineStationRouteDtoList[lineStationRouteDtoList.length - 1].stationName;
  74 +
  75 + if (!startStationCode) {
  76 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  77 + scope[ctrlAs].error = "线路预设区间路由起点站Code为空!";
  78 + return;
  79 + }
  80 + if (!endStationCode) {
  81 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  82 + scope[ctrlAs].error = "线路预设区间路由终点站Code为空!";
  83 + return;
  84 + }
  85 +
  86 + scope[ctrlAs].$$internalFormValidateFlag = "ok";
  87 +
  88 + // 2、调用回调函数
  89 + if (tAttrs["lrclick"]) {
  90 + scope[ctrlAs].lineRegionClickHandler()(
  91 + regionId,
  92 + startStationCode,
  93 + endStationCode,
  94 + startStationName,
  95 + endStationName
  96 + );
  97 + }
  98 + }
  99 + };
  100 +
  101 + // 刷新预设区间列表
  102 + scope[ctrlAs].$$internalLineRegionList_refresh = function () {
  103 + xl_id = scope[ctrlAs].xlid;
  104 + xl_version = scope[ctrlAs].xlversion;
  105 + xl_dir = scope[ctrlAs].xldir;
  106 +
  107 + if (xl_id === undefined) {
  108 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  109 + scope[ctrlAs].error = "线路Id为空!";
  110 + return;
  111 + }
  112 + if (xl_version === undefined) {
  113 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  114 + scope[ctrlAs].error = "线路版本为空!";
  115 + return;
  116 + }
  117 + if (xl_dir === undefined) {
  118 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  119 + scope[ctrlAs].error = "线路方向为空!";
  120 + return;
  121 + }
  122 +
  123 + service.lineregion.list(
  124 + {lineId: xl_id, lineVersion: xl_version, lineDir: xl_dir},
  125 + function(result) {
  126 + scope[ctrlAs].$$internalLineRegionList = result;
  127 +
  128 + // 将线路区间路由站点名用逗号连接成字符串,并赋于新属性
  129 + angular.forEach(result, function(value) {
  130 + var _str_ = [];
  131 + angular.forEach(value.lineStationRouteDtoList, function(value2) {
  132 + _str_.push(value2.stationName);
  133 + });
  134 + value.$$internal_route_strs = _str_.join(",");
  135 + });
  136 +
  137 +
  138 + // 如果之前保持过预设区间,则模拟点击选择
  139 + if (scope[ctrlAs].xlrgid) {
  140 + angular.forEach(result, function(value) {
  141 + if (value.regionId == scope[ctrlAs].xlrgid) {
  142 + scope[ctrlAs].$$internalSelectLineRegion(value);
  143 + } else {
  144 + return;
  145 + }
  146 + });
  147 + } else {
  148 + // 重置选择
  149 + scope[ctrlAs].$$internalLineRegionSelected = undefined;
  150 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  151 + scope[ctrlAs].error = "线路预设区间未选择!";
  152 + }
  153 + },
  154 + function() {
  155 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  156 + scope[ctrlAs].error = "获取线路预设区间失败!";
  157 + });
  158 +
  159 + };
  160 +
  161 +
  162 + },
  163 +
  164 + post: function(scope, element, attr) {
  165 + // 属性值
  166 + if ($name_attr) {
  167 + scope[ctrlAs]["$name_attr"] = $name_attr;
  168 + }
  169 +
  170 + scope[ctrlAs].$$internalLineRegionList_refresh();
  171 +
  172 + //-------------- 监控属性方法 -------------//
  173 + scope.$watch( // 监控线路Id值
  174 + function() {
  175 + return scope[ctrlAs].xlid;
  176 + },
  177 + function(newValue, oldValue) {
  178 + xl_id = newValue;
  179 + scope[ctrlAs].$$internalLineRegionList_refresh();
  180 + }
  181 + );
  182 + scope.$watch( // 监控线路版本值
  183 + function() {
  184 + return scope[ctrlAs].xlversion;
  185 + },
  186 + function(newValue, oldValue) {
  187 + xl_version = newValue;
  188 + scope[ctrlAs].$$internalLineRegionList_refresh();
  189 + }
  190 + );
  191 + scope.$watch(
  192 + function() {
  193 + return scope[ctrlAs].xldir;
  194 + },
  195 + function(newValue, oldValue) {
  196 + xl_dir = newValue;
  197 + scope[ctrlAs].$$internalLineRegionList_refresh();
  198 + }
  199 + );
  200 +
  201 + }
  202 + };
  203 + }
  204 +
  205 + };
  206 + }
  207 + ]
  208 +);
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -6598,4 +6598,212 @@ angular.module(&#39;ScheduleApp&#39;).directive(
6598 6598 };
6599 6599 }
6600 6600 ]
6601   -);
6602 6601 \ No newline at end of file
  6602 +);
  6603 +/**
  6604 + * 预设线路区间指令。
  6605 + */
  6606 +angular.module('ScheduleApp').directive(
  6607 + 'saLineRegion',
  6608 + [
  6609 + 'TimeTableDetailManageService_g',
  6610 + function(service) {
  6611 + return {
  6612 + restrict: 'E',
  6613 + templateUrl: '/pages/scheduleApp/module/common/dts2/ttinfotable/saLineRegion.html',
  6614 + scope: {
  6615 + xlid: '=', // 线路Id
  6616 + xlversion: '=', // 线路版本
  6617 + xldir: '=', // 线路方向
  6618 + xlrgid: '=', // 线路区间id(已经选中)
  6619 + error: '=', // 错误输出(用于form验证输出)
  6620 + lineRegionClickHandler: '&lrclick' // 线路区间点击
  6621 + },
  6622 + controllerAs: '$saLineRegionCtrl',
  6623 + bindToController: true,
  6624 + controller: function() {
  6625 + var self = this;
  6626 +
  6627 + // 内部ng-model值,用于和required配对
  6628 + // 用于外部表单包含指令时,指令内部的错误开关,错误输出到error绑定属性上
  6629 + self.$$internalFormValidateFlag = undefined;
  6630 +
  6631 + //------------------ 组件内部业务数据(如下)-----------------//
  6632 + // 预设区间列表(和后台TTInfoDetailController的findLineRegion返回的数据对应)
  6633 + self.$$internalLineRegionList = [];
  6634 + self.$$internalLineRegionSelected = undefined; // 被选中的具体预设区间
  6635 + },
  6636 +
  6637 + compile: function(tElem, tAttrs) {
  6638 + // 获取所有属性,并验证
  6639 + var $name_attr = tAttrs['name']; // 控件的名字
  6640 + if (!$name_attr) {
  6641 + throw "saLineRegion使用时必须有name属性!";
  6642 + }
  6643 +
  6644 + // controlAs名字
  6645 + var ctrlAs = '$saLineRegionCtrl';
  6646 +
  6647 + var xl_id = undefined; // 线路Id
  6648 + var xl_version = undefined; // 线路版本
  6649 + var xl_dir = undefined; // 线路方向
  6650 +
  6651 + // 内部添加required验证,将所有的错误应用到required中
  6652 + tElem.find('div').attr('required', "");
  6653 +
  6654 + return {
  6655 + pre: function(scope, element, attr) {
  6656 + scope[ctrlAs].error = "线路预设区间未选择!";
  6657 +
  6658 + //--------------- 内部业务方法(以下) ---------------//
  6659 + // 选中预设区间
  6660 + scope[ctrlAs].$$internalSelectLineRegion = function(lineRegion) {
  6661 + if (lineRegion != scope[ctrlAs].$$internalLineRegionSelected) {
  6662 + // 1、设定选中的线路区间,并检测数据
  6663 + scope[ctrlAs].$$internalLineRegionSelected = lineRegion;
  6664 + var lineStationRouteDtoList = lineRegion.lineStationRouteDtoList;
  6665 + if (!lineStationRouteDtoList || lineStationRouteDtoList.length < 2) {
  6666 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  6667 + scope[ctrlAs].error = "预设区间路由至少需要2个站点!";
  6668 + return;
  6669 + }
  6670 +
  6671 + var regionId = lineRegion.regionId;
  6672 + var startStationCode = lineStationRouteDtoList[0].stationCode;
  6673 + var startStationName = lineStationRouteDtoList[0].stationName;
  6674 + var endStationCode = lineStationRouteDtoList[lineStationRouteDtoList.length - 1].stationCode;
  6675 + var endStationName = lineStationRouteDtoList[lineStationRouteDtoList.length - 1].stationName;
  6676 +
  6677 + if (!startStationCode) {
  6678 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  6679 + scope[ctrlAs].error = "线路预设区间路由起点站Code为空!";
  6680 + return;
  6681 + }
  6682 + if (!endStationCode) {
  6683 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  6684 + scope[ctrlAs].error = "线路预设区间路由终点站Code为空!";
  6685 + return;
  6686 + }
  6687 +
  6688 + scope[ctrlAs].$$internalFormValidateFlag = "ok";
  6689 +
  6690 + // 2、调用回调函数
  6691 + if (tAttrs["lrclick"]) {
  6692 + scope[ctrlAs].lineRegionClickHandler()(
  6693 + regionId,
  6694 + startStationCode,
  6695 + endStationCode,
  6696 + startStationName,
  6697 + endStationName
  6698 + );
  6699 + }
  6700 + }
  6701 + };
  6702 +
  6703 + // 刷新预设区间列表
  6704 + scope[ctrlAs].$$internalLineRegionList_refresh = function () {
  6705 + xl_id = scope[ctrlAs].xlid;
  6706 + xl_version = scope[ctrlAs].xlversion;
  6707 + xl_dir = scope[ctrlAs].xldir;
  6708 +
  6709 + if (xl_id === undefined) {
  6710 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  6711 + scope[ctrlAs].error = "线路Id为空!";
  6712 + return;
  6713 + }
  6714 + if (xl_version === undefined) {
  6715 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  6716 + scope[ctrlAs].error = "线路版本为空!";
  6717 + return;
  6718 + }
  6719 + if (xl_dir === undefined) {
  6720 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  6721 + scope[ctrlAs].error = "线路方向为空!";
  6722 + return;
  6723 + }
  6724 +
  6725 + service.lineregion.list(
  6726 + {lineId: xl_id, lineVersion: xl_version, lineDir: xl_dir},
  6727 + function(result) {
  6728 + scope[ctrlAs].$$internalLineRegionList = result;
  6729 +
  6730 + // 将线路区间路由站点名用逗号连接成字符串,并赋于新属性
  6731 + angular.forEach(result, function(value) {
  6732 + var _str_ = [];
  6733 + angular.forEach(value.lineStationRouteDtoList, function(value2) {
  6734 + _str_.push(value2.stationName);
  6735 + });
  6736 + value.$$internal_route_strs = _str_.join(",");
  6737 + });
  6738 +
  6739 +
  6740 + // 如果之前保持过预设区间,则模拟点击选择
  6741 + if (scope[ctrlAs].xlrgid) {
  6742 + angular.forEach(result, function(value) {
  6743 + if (value.regionId == scope[ctrlAs].xlrgid) {
  6744 + scope[ctrlAs].$$internalSelectLineRegion(value);
  6745 + } else {
  6746 + return;
  6747 + }
  6748 + });
  6749 + } else {
  6750 + // 重置选择
  6751 + scope[ctrlAs].$$internalLineRegionSelected = undefined;
  6752 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  6753 + scope[ctrlAs].error = "线路预设区间未选择!";
  6754 + }
  6755 + },
  6756 + function() {
  6757 + scope[ctrlAs].$$internalFormValidateFlag = undefined;
  6758 + scope[ctrlAs].error = "获取线路预设区间失败!";
  6759 + });
  6760 +
  6761 + };
  6762 +
  6763 +
  6764 + },
  6765 +
  6766 + post: function(scope, element, attr) {
  6767 + // 属性值
  6768 + if ($name_attr) {
  6769 + scope[ctrlAs]["$name_attr"] = $name_attr;
  6770 + }
  6771 +
  6772 + scope[ctrlAs].$$internalLineRegionList_refresh();
  6773 +
  6774 + //-------------- 监控属性方法 -------------//
  6775 + scope.$watch( // 监控线路Id值
  6776 + function() {
  6777 + return scope[ctrlAs].xlid;
  6778 + },
  6779 + function(newValue, oldValue) {
  6780 + xl_id = newValue;
  6781 + scope[ctrlAs].$$internalLineRegionList_refresh();
  6782 + }
  6783 + );
  6784 + scope.$watch( // 监控线路版本值
  6785 + function() {
  6786 + return scope[ctrlAs].xlversion;
  6787 + },
  6788 + function(newValue, oldValue) {
  6789 + xl_version = newValue;
  6790 + scope[ctrlAs].$$internalLineRegionList_refresh();
  6791 + }
  6792 + );
  6793 + scope.$watch(
  6794 + function() {
  6795 + return scope[ctrlAs].xldir;
  6796 + },
  6797 + function(newValue, oldValue) {
  6798 + xl_dir = newValue;
  6799 + scope[ctrlAs].$$internalLineRegionList_refresh();
  6800 + }
  6801 + );
  6802 +
  6803 + }
  6804 + };
  6805 + }
  6806 +
  6807 + };
  6808 + }
  6809 + ]
  6810 +);
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -1075,6 +1075,16 @@ angular.module(&#39;ScheduleApp&#39;).factory(
1075 1075 }
1076 1076 }
1077 1077 ),
  1078 + lineregion: $resource(
  1079 + '/tidc/lineregion',
  1080 + {},
  1081 + {
  1082 + list: {
  1083 + method: 'GET',
  1084 + isArray: true
  1085 + }
  1086 + }
  1087 + ),
1078 1088 dataTools: $resource(
1079 1089 '/tidc/:type',
1080 1090 {},
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html
... ... @@ -230,6 +230,26 @@
230 230  
231 231 </div>
232 232  
  233 + <div class="form-group has-success has-feedback"
  234 + ng-if="ctrl.TimeTableDetailForSave.bcType == 'region' ">
  235 + <label class="col-md-2 control-label">预设区间*:</label>
  236 + <div class="col-md-6">
  237 + <sa-line-region name="sa_line_region"
  238 + xlid="ctrl.xlid"
  239 + xlversion="ctrl.lineversion"
  240 + xldir="ctrl.TimeTableDetailForSave.xlDir"
  241 + xlrgid="ctrl.TimeTableDetailForSave.lineRegion.id"
  242 + error="ctrl.saLineRegionError"
  243 + lrclick="ctrl.lrclick"
  244 + required>
  245 + </sa-line-region>
  246 + </div>
  247 + <!-- 隐藏块,显示验证信息 -->
  248 + <div class="alert alert-danger well-sm" ng-show="myForm.sa_line_region.$error.required">
  249 + {{ ctrl.saLineRegionError }}
  250 + </div>
  251 + </div>
  252 +
233 253 <div class="form-group has-success has-feedback">
234 254 <label class="col-md-2 control-label">开始分班:</label>
235 255 <div class="col-md-3">
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js
... ... @@ -859,6 +859,10 @@ angular.module(&#39;ScheduleApp&#39;).controller(
859 859 // 删除编码加名字组合字段
860 860 delete self.TimeTableDetailForSave["qcode_name"];
861 861 delete self.TimeTableDetailForSave["zcode_name"];
  862 + // lineRegion预处理
  863 + if (self.TimeTableDetailForSave.bcType != "region") {
  864 + delete self.TimeTableDetailForSave["lineRegion"];
  865 + }
862 866  
863 867 self.TimeTableDetailForSave.$save(function(value) {
864 868 // 修正内部edit的值
... ... @@ -893,6 +897,37 @@ angular.module(&#39;ScheduleApp&#39;).controller(
893 897  
894 898 };
895 899  
  900 +
  901 + //------------------ 预设区间组件相关属性 -----------------//
  902 + self.saLineRegionError = ""; // 组件对应的错误输出
  903 + /**
  904 + * 预设区间点击事件。
  905 + * @param regionId 预设区间Id
  906 + * @param startStationCode 线路预设区间路由起点站Code
  907 + * @param endStationCode 线路预设区间路由终点站Code
  908 + * @param startStationName 线路预设区间路由起点站名字
  909 + * @param endStationName 线路预设区间路由终点站名字
  910 + */
  911 + self.lrclick = function (regionId,
  912 + startStationCode, endStationCode,
  913 + startStationName, endStationName) {
  914 + // TODO:测试
  915 + // alert("regionId = " + regionId + " s = " + startStationCode + " e = " + endStationCode);
  916 +
  917 + console.log(self.TimeTableDetailForSave);
  918 + self.TimeTableDetailForSave["qdzCode"] = startStationCode;
  919 + self.TimeTableDetailForSave["zdzCode"] = endStationCode;
  920 +
  921 + // 添加编码加名字组合字段
  922 + self.TimeTableDetailForSave["qcode_name"] = startStationCode + "_" + startStationName;
  923 + self.TimeTableDetailForSave["zcode_name"] = endStationCode + "_" + endStationName;
  924 + // 添加lineRegion
  925 + self.TimeTableDetailForSave["lineRegion"] = { id : regionId };
  926 +
  927 + console.log(self.TimeTableDetailForSave);
  928 +
  929 + };
  930 +
896 931 }
897 932 ]
898 933 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/service.js
... ... @@ -315,6 +315,16 @@ angular.module(&#39;ScheduleApp&#39;).factory(
315 315 }
316 316 }
317 317 ),
  318 + lineregion: $resource(
  319 + '/tidc/lineregion',
  320 + {},
  321 + {
  322 + list: {
  323 + method: 'GET',
  324 + isArray: true
  325 + }
  326 + }
  327 + ),
318 328 dataTools: $resource(
319 329 '/tidc/:type',
320 330 {},
... ...