Commit e83e662f0c86168af6e7a77a1febbe15ca5403b4

Authored by 徐烜
1 parent 27a0a49e

update

src/main/java/com/bsth/controller/schedule/ScheduleRule1FlatController.java 0 → 100644
  1 +package com.bsth.controller.schedule;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  5 +import com.bsth.entity.schedule.GuideboardInfo;
  6 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  7 +import com.bsth.repository.ScheduleRule1FlatRepository;
  8 +import com.bsth.service.schedule.EmployeeConfigInfoService;
  9 +import com.bsth.service.schedule.GuideboardInfoService;
  10 +import org.apache.commons.lang3.StringUtils;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by xu on 16/7/4.
  19 + */
  20 +@RestController
  21 +@RequestMapping("sr1fc")
  22 +public class ScheduleRule1FlatController extends BaseController<ScheduleRule1Flat, Long> {
  23 +
  24 + @Autowired
  25 + private ScheduleRule1FlatRepository scheduleRule1FlatRepository;
  26 + @Autowired
  27 + private GuideboardInfoService guideboardInfoService;
  28 + @Autowired
  29 + private EmployeeConfigInfoService employeeConfigInfoService;
  30 +
  31 + @Override
  32 + public ScheduleRule1Flat findById(@PathVariable("id") Long aLong) {
  33 + return scheduleRule1FlatRepository.findOneExtend(aLong);
  34 + }
  35 +
  36 + /**
  37 + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
  38 + * @Title: save
  39 + * @Description: TODO(持久化对象)
  40 + * @param @param t
  41 + * @param @return 设定文件
  42 + * @return Map<String,Object> {status: 1(成功),-1(失败)}
  43 + * @throws
  44 + */
  45 + @RequestMapping(method = RequestMethod.POST)
  46 + public Map<String, Object> save(@RequestBody ScheduleRule1Flat t){
  47 + // TODO:根据编码查找id,不做错误检测,暂时这样做,以后前端直接传过来
  48 + // 1、查找路牌配置id
  49 + Map<String, Object> param1 = new HashMap<>();
  50 + param1.put("xl.id_eq", t.getXl().getId());
  51 + param1.put("lpName_eq", null);
  52 +
  53 + String[] lpNames = t.getLpNames().split(",");
  54 + String[] lpIds = new String[lpNames.length];
  55 + for (int i = 0; i < lpNames.length; i++) {
  56 + param1.put("lpName_eq", lpNames[i]);
  57 + Iterable<GuideboardInfo> guideboardInfos = guideboardInfoService.list(param1);
  58 + lpIds[i] = guideboardInfos.iterator().next().getId().toString();
  59 + }
  60 + t.setLpIds(StringUtils.join(lpIds, ","));
  61 +
  62 + // 2、查找人员配置id
  63 + Map<String, Object> param2 = new HashMap<>();
  64 + param2.put("xl.id_eq", t.getXl().getId());
  65 + param2.put("dbbm_eq", null);
  66 +
  67 + String[] ryDbbms = t.getRyDbbms().split(",");
  68 + String[] ryIds = new String[ryDbbms.length];
  69 + for (int j = 0; j < ryDbbms.length; j++) {
  70 + param2.put("dbbm_eq", ryDbbms[j]);
  71 + Iterable<EmployeeConfigInfo> employeeConfigInfos = employeeConfigInfoService.list(param2);
  72 + ryIds[j] = employeeConfigInfos.iterator().next().getId().toString();
  73 + }
  74 + t.setRyIds(StringUtils.join(ryIds, ","));
  75 +
  76 + return baseService.save(t);
  77 + }
  78 +
  79 +}
src/main/java/com/bsth/entity/schedule/rule/ScheduleRule1Flat.java 0 → 100644
  1 +package com.bsth.entity.schedule.rule;
  2 +
  3 +import com.bsth.entity.Cars;
  4 +import com.bsth.entity.Line;
  5 +import com.bsth.entity.sys.SysUser;
  6 +
  7 +import javax.persistence.*;
  8 +import javax.validation.constraints.NotNull;
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + * 排班规则1(flat,路牌,人员都不关联表,全部保存相关id),
  13 + * 基于老系统的规则设定实体,
  14 + * 有所谓的路牌范围,就是关联多个路牌
  15 + * 有所谓的人员返回,就是关联多个人(可能带早晚班)
  16 + * 有起始路牌,起始人员,翻班格式
  17 + */
  18 +@Entity
  19 +@Table(name = "bsth_c_s_sr1_flat")
  20 +@NamedEntityGraphs({
  21 + @NamedEntityGraph(name = "scheduleRule1Flat_xl_cl", attributeNodes = {
  22 + @NamedAttributeNode("xl"),
  23 + @NamedAttributeNode("cl")
  24 + })
  25 +})
  26 +public class ScheduleRule1Flat {
  27 + /** 主键Id */
  28 + @Id
  29 + @GeneratedValue
  30 + private Long id;
  31 +
  32 + /** 关联线路 */
  33 + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
  34 + private Line xl;
  35 + /** 关联车辆 */
  36 + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
  37 + private Cars cl;
  38 + /** 启用日期 */
  39 + @NotNull
  40 + private Date qyrq;
  41 +
  42 + /** 路牌名称s(用逗号隔开) */
  43 + @NotNull
  44 + private String lpNames;
  45 + /** 对应的路牌ids(用逗号隔开) */
  46 + @NotNull
  47 + private String lpIds;
  48 + /** 起始路牌(从0开始) */
  49 + @NotNull
  50 + private Integer lpStart;
  51 + /** 人员搭班编码s(用逗号隔开) */
  52 + @NotNull
  53 + private String ryDbbms;
  54 + /** 对应的人员配置ids(用逗号隔开) */
  55 + @NotNull
  56 + private String ryIds;
  57 + /** 起始人员(从0开始) */
  58 + @NotNull
  59 + private Integer ryStart;
  60 +
  61 + /** 翻班格式(TODO:这个用在车子上的,暂时不管)*/
  62 + private String fbgs;
  63 +
  64 + /** 创建人 */
  65 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  66 + private SysUser createBy;
  67 + /** 修改人 */
  68 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  69 + private SysUser updateBy;
  70 + /** 创建日期 */
  71 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  72 + private Date createDate;
  73 + /** 修改日期 */
  74 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  75 + private Date updateDate;
  76 +
  77 + public Long getId() {
  78 + return id;
  79 + }
  80 +
  81 + public void setId(Long id) {
  82 + this.id = id;
  83 + }
  84 +
  85 + public Line getXl() {
  86 + return xl;
  87 + }
  88 +
  89 + public void setXl(Line xl) {
  90 + this.xl = xl;
  91 + }
  92 +
  93 + public Cars getCl() {
  94 + return cl;
  95 + }
  96 +
  97 + public void setCl(Cars cl) {
  98 + this.cl = cl;
  99 + }
  100 +
  101 + public Date getQyrq() {
  102 + return qyrq;
  103 + }
  104 +
  105 + public void setQyrq(Date qyrq) {
  106 + this.qyrq = qyrq;
  107 + }
  108 +
  109 + public String getLpNames() {
  110 + return lpNames;
  111 + }
  112 +
  113 + public void setLpNames(String lpNames) {
  114 + this.lpNames = lpNames;
  115 + }
  116 +
  117 + public String getLpIds() {
  118 + return lpIds;
  119 + }
  120 +
  121 + public void setLpIds(String lpIds) {
  122 + this.lpIds = lpIds;
  123 + }
  124 +
  125 + public Integer getLpStart() {
  126 + return lpStart;
  127 + }
  128 +
  129 + public void setLpStart(Integer lpStart) {
  130 + this.lpStart = lpStart;
  131 + }
  132 +
  133 + public String getRyDbbms() {
  134 + return ryDbbms;
  135 + }
  136 +
  137 + public void setRyDbbms(String ryDbbms) {
  138 + this.ryDbbms = ryDbbms;
  139 + }
  140 +
  141 + public String getRyIds() {
  142 + return ryIds;
  143 + }
  144 +
  145 + public void setRyIds(String ryIds) {
  146 + this.ryIds = ryIds;
  147 + }
  148 +
  149 + public Integer getRyStart() {
  150 + return ryStart;
  151 + }
  152 +
  153 + public void setRyStart(Integer ryStart) {
  154 + this.ryStart = ryStart;
  155 + }
  156 +
  157 + public String getFbgs() {
  158 + return fbgs;
  159 + }
  160 +
  161 + public void setFbgs(String fbgs) {
  162 + this.fbgs = fbgs;
  163 + }
  164 +
  165 + public SysUser getCreateBy() {
  166 + return createBy;
  167 + }
  168 +
  169 + public void setCreateBy(SysUser createBy) {
  170 + this.createBy = createBy;
  171 + }
  172 +
  173 + public SysUser getUpdateBy() {
  174 + return updateBy;
  175 + }
  176 +
  177 + public void setUpdateBy(SysUser updateBy) {
  178 + this.updateBy = updateBy;
  179 + }
  180 +
  181 + public Date getCreateDate() {
  182 + return createDate;
  183 + }
  184 +
  185 + public void setCreateDate(Date createDate) {
  186 + this.createDate = createDate;
  187 + }
  188 +
  189 + public Date getUpdateDate() {
  190 + return updateDate;
  191 + }
  192 +
  193 + public void setUpdateDate(Date updateDate) {
  194 + this.updateDate = updateDate;
  195 + }
  196 +}
src/main/java/com/bsth/repository/ScheduleRule1FlatRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  4 +import org.springframework.data.domain.Page;
  5 +import org.springframework.data.domain.Pageable;
  6 +import org.springframework.data.jpa.domain.Specification;
  7 +import org.springframework.data.jpa.repository.EntityGraph;
  8 +import org.springframework.data.jpa.repository.Query;
  9 +import org.springframework.stereotype.Repository;
  10 +
  11 +/**
  12 + * Created by xu on 16/7/4.
  13 + */
  14 +@Repository
  15 +public interface ScheduleRule1FlatRepository extends BaseRepository<ScheduleRule1Flat, Long> {
  16 +
  17 + @EntityGraph(value = "scheduleRule1Flat_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
  18 + @Override
  19 + Page<ScheduleRule1Flat> findAll(Specification<ScheduleRule1Flat> spec, Pageable pageable);
  20 +
  21 + @EntityGraph(value = "scheduleRule1Flat_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
  22 + @Query("select cc from ScheduleRule1Flat cc where cc.id=?1")
  23 + ScheduleRule1Flat findOneExtend(Long aLong);
  24 +}
src/main/java/com/bsth/service/schedule/ScheduleRule1FlatService.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by xu on 16/7/4.
  8 + */
  9 +public interface ScheduleRule1FlatService extends BaseService<ScheduleRule1Flat, Long> {
  10 +}
src/main/java/com/bsth/service/schedule/ScheduleRule1FlatServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  4 +import com.bsth.service.impl.BaseServiceImpl;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +/**
  8 + * Created by xu on 16/7/4.
  9 + */
  10 +@Service
  11 +public class ScheduleRule1FlatServiceImpl extends BaseServiceImpl<ScheduleRule1Flat, Long> implements ScheduleRule1FlatService {
  12 +}
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/detail.html 0 → 100644
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/edit.html 0 → 100644
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/form.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>排班规则管理</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">运营计划管理</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="scheduleRuleManage">排班规则管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">添加排班规则信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="ScheduleRuleManageFormCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  30 + </div>
  31 + </div>
  32 +
  33 + <div class="portlet-body form">
  34 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  35 + <!--<div class="alert alert-danger display-hide">-->
  36 + <!--<button class="close" data-close="alert"></button>-->
  37 + <!--您的输入有误,请检查下面的输入项-->
  38 + <!--</div>-->
  39 +
  40 +
  41 + <!-- 其他信息放置在这里 -->
  42 + <div class="form-body">
  43 + <div class="form-group has-success has-feedback">
  44 + <label class="col-md-2 control-label">线路*:</label>
  45 + <div class="col-md-3">
  46 + <sa-Select2 model="ctrl.scheduleRuleManageForSave"
  47 + name="xl"
  48 + required="true"
  49 + type="xl"
  50 + modelcolname1="xl_id"
  51 + datacolname1="id"
  52 + showcolname="name"
  53 + placeholder="请输拼音...">
  54 + </sa-Select2>
  55 + </div>
  56 + <!-- 隐藏块,显示验证信息 -->
  57 + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
  58 + 线路必须选择
  59 + </div>
  60 + </div>
  61 + <div class="form-group has-success has-feedback">
  62 + <label class="col-md-2 control-label">车辆*:</label>
  63 + <div class="col-md-3">
  64 + <sa-Select2 model="ctrl.scheduleRuleManageForSave"
  65 + name="cl"
  66 + required="true"
  67 + type="cl"
  68 + modelcolname1="cl_id"
  69 + datacolname1="id"
  70 + showcolname="insideCode"
  71 + placeholder="请输拼音...">
  72 + </sa-Select2>
  73 + </div>
  74 + <!-- 隐藏块,显示验证信息 -->
  75 + <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
  76 + 车辆必须选择
  77 + </div>
  78 + </div>
  79 +
  80 + <div class="form-group">
  81 + <label class="col-md-2 control-label">启用日期:</label>
  82 + <div class="col-md-3">
  83 + <div class="input-group">
  84 + <input type="text" class="form-control"
  85 + name="qyrq" placeholder="请选择启用日期..."
  86 + uib-datepicker-popup="yyyy年MM月dd日"
  87 + is-open="ctrl.qyrqOpen" required
  88 + ng-model="ctrl.scheduleRuleManageForSave.qyrq"/>
  89 + <span class="input-group-btn">
  90 + <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
  91 + <i class="glyphicon glyphicon-calendar"></i>
  92 + </button>
  93 + </span>
  94 + </div>
  95 + </div>
  96 + <!-- 隐藏块,显示验证信息 -->
  97 + <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required">
  98 + 启用日期必须选择
  99 + </div>
  100 + </div>
  101 +
  102 + <div class="form-group">
  103 + <label class="col-md-2 control-label">路牌范围*:</label>
  104 + <div class="col-md-3">
  105 + <input type="text" class="form-control" name="lpNames" ng-model="ctrl.scheduleRuleManageForSave.lpNames" required
  106 + placeholder="由路牌名称组成,逗号分隔"/>
  107 + </div>
  108 + <!-- 隐藏块,显示验证信息 -->
  109 + <div class="alert alert-danger well-sm" ng-show="myForm.lpNames.$error.required">
  110 + 路牌范围必须填写
  111 + </div>
  112 + </div>
  113 +
  114 + <div class="form-group">
  115 + <label class="col-md-2 control-label">起始路牌*:</label>
  116 + <div class="col-md-3">
  117 + <input type="text" class="form-control" name="lpStart" ng-model="ctrl.scheduleRuleManageForSave.lpStart" required
  118 + placeholder="起始路牌,从0开始"/>
  119 + </div>
  120 + <!-- 隐藏块,显示验证信息 -->
  121 + <div class="alert alert-danger well-sm" ng-show="myForm.lpStart.$error.required">
  122 + 起始路牌必须填写
  123 + </div>
  124 + </div>
  125 +
  126 + <div class="form-group">
  127 + <label class="col-md-2 control-label">人员范围*:</label>
  128 + <div class="col-md-3">
  129 + <input type="text" class="form-control" name="ryDbbms" ng-model="ctrl.scheduleRuleManageForSave.ryDbbms" required
  130 + placeholder="由人员配置的搭班编码组成,逗号分隔"/>
  131 + </div>
  132 + <!-- 隐藏块,显示验证信息 -->
  133 + <div class="alert alert-danger well-sm" ng-show="myForm.ryDbbms.$error.required">
  134 + 人员范围必须填写
  135 + </div>
  136 + </div>
  137 +
  138 + <div class="form-group">
  139 + <label class="col-md-2 control-label">起始人员*:</label>
  140 + <div class="col-md-3">
  141 + <input type="text" class="form-control" name="ryStart" ng-model="ctrl.scheduleRuleManageForSave.ryStart" required
  142 + placeholder="起始路牌,从0开始"/>
  143 + </div>
  144 + <!-- 隐藏块,显示验证信息 -->
  145 + <div class="alert alert-danger well-sm" ng-show="myForm.ryStart.$error.required">
  146 + 起始路牌必须填写
  147 + </div>
  148 + </div>
  149 +
  150 + <div class="form-group">
  151 + <label class="col-md-2 control-label">翻班格式:</label>
  152 + <div class="col-md-3">
  153 + <input type="text" class="form-control" name="fbgs" ng-model="ctrl.scheduleRuleManageForSave.fbgs"
  154 + placeholder="车辆翻班格式"/>
  155 + </div>
  156 + </div>
  157 +
  158 +
  159 + <!-- 其他form-group -->
  160 +
  161 + </div>
  162 +
  163 + <!-- TODO:!myForm.$valid 在这里有点问题,改用以下方法验证 -->
  164 + <div class="form-actions">
  165 + <div class="row">
  166 + <div class="col-md-offset-3 col-md-4">
  167 + <button type="submit" class="btn green"
  168 + ng-disabled="myForm.xl.$error.required ||
  169 + myForm.cl.$error.required ||
  170 + myForm.qyrq.$error.required ||
  171 + myForm.lpNames.$error.required ||
  172 + myForm.lpStart.$error.required ||
  173 + myForm.ryDbbms.$error.required ||
  174 + myForm.ryStart.$error.required"
  175 + ><i class="fa fa-check"></i> 提交</button>
  176 + <a type="button" class="btn default" ui-sref="scheduleRuleManage" ><i class="fa fa-times"></i> 取消</a>
  177 + </div>
  178 + </div>
  179 + </div>
  180 +
  181 + </form>
  182 +
  183 + </div>
  184 +
  185 +
  186 +</div>
0 \ No newline at end of file 187 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/list.html
@@ -5,8 +5,7 @@ @@ -5,8 +5,7 @@
5 <th>序号</th> 5 <th>序号</th>
6 <th>线路</th> 6 <th>线路</th>
7 <th>修改时间</th> 7 <th>修改时间</th>
8 - <th>启用时间</th>  
9 - <th>规则类型</th> 8 + <th>启用日期</th>
10 <th>车辆</th> 9 <th>车辆</th>
11 <th>翻版模式</th> 10 <th>翻版模式</th>
12 <th>起始路牌</th> 11 <th>起始路牌</th>
@@ -17,11 +16,30 @@ @@ -17,11 +16,30 @@
17 </tr> 16 </tr>
18 <tr role="row" class="filter"> 17 <tr role="row" class="filter">
19 <td></td> 18 <td></td>
  19 + <td>
  20 + <div style="width: 150px">
  21 + <sa-Select2 model="ctrl.searchCondition()"
  22 + type="xl"
  23 + modelcolname1="xl.id_eq"
  24 + datacolname1="id"
  25 + showcolname="name"
  26 + placeholder="请输拼音...">
  27 + </sa-Select2>
  28 + </div>
  29 + </td>
20 <td></td> 30 <td></td>
21 <td></td> 31 <td></td>
22 - <td></td>  
23 - <td></td>  
24 - <td></td> 32 + <td>
  33 + <div style="width: 150px">
  34 + <sa-Select2 model="ctrl.searchCondition()"
  35 + type="cl"
  36 + modelcolname1="cl.id_eq"
  37 + datacolname1="id"
  38 + showcolname="insideCode"
  39 + placeholder="请输拼音...">
  40 + </sa-Select2>
  41 + </div>
  42 + </td>
25 <td></td> 43 <td></td>
26 <td></td> 44 <td></td>
27 <td></td> 45 <td></td>
@@ -45,7 +63,7 @@ @@ -45,7 +63,7 @@
45 <span ng-bind="$index + 1"></span> 63 <span ng-bind="$index + 1"></span>
46 </td> 64 </td>
47 <td> 65 <td>
48 - <span ng-bind="info.xl"></span> 66 + <span ng-bind="info.xl.name"></span>
49 </td> 67 </td>
50 <td> 68 <td>
51 <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span> 69 <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span>
@@ -54,29 +72,27 @@ @@ -54,29 +72,27 @@
54 <span ng-bind="info.qyrq | date: 'yyyy-MM-dd '"></span> 72 <span ng-bind="info.qyrq | date: 'yyyy-MM-dd '"></span>
55 </td> 73 </td>
56 <td> 74 <td>
57 - <span>周期循环类型</span>  
58 - </td>  
59 - <td>  
60 - <span ng-bind="info.cl"></span> 75 + <span ng-bind="info.cl.insideCode"></span>
61 </td> 76 </td>
62 <td> 77 <td>
63 - <span ng-bind="info.fbms"></span> 78 + <span ng-bind="info.fbgs"></span>
64 </td> 79 </td>
65 <td> 80 <td>
66 - <span ng-bind="info.qslp"></span> 81 + <span ng-bind="info.lpStart"></span>
67 </td> 82 </td>
68 <td> 83 <td>
69 - <span ng-bind="info.lpfw"></span> 84 + <span ng-bind="info.lpNames"></span>
70 </td> 85 </td>
71 <td> 86 <td>
72 - <span ng-bind="info.qsry"></span> 87 + <span ng-bind="info.ryStart"></span>
73 </td> 88 </td>
74 <td> 89 <td>
75 - <span ng-bind="info.ryfw"></span> 90 + <span ng-bind="info.ryDbbms"></span>
76 </td> 91 </td>
77 <td> 92 <td>
78 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> 93 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
79 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> 94 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
  95 + <a ui-sref="#" class="btn default blue-stripe btn-sm"> 详细 </a>
80 <a ui-sref="#" class="btn default blue-stripe btn-sm"> 修改 </a> 96 <a ui-sref="#" class="btn default blue-stripe btn-sm"> 修改 </a>
81 </td> 97 </td>
82 </tr> 98 </tr>
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.html deleted 100644 → 0
1 -排班规则管理  
2 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js
1 -// 车辆配置管理 service controller 等写在一起  
2 -// TODO 1 +// 规则配置管理 service controller 等写在一起
  2 +angular.module('ScheduleApp').factory('ScheduleRuleManageService', ['ScheduleRuleManageService_g', function(service) {
  3 + /** 当前的查询条件信息 */
  4 + var currentSearchCondition = {};
3 5
4 -angular.module('ScheduleApp').controller('ScheduleRuleManageCtrl', ['$state', function($state) { 6 + /** 当前第几页 */
  7 + var currentPageNo = 1;
  8 +
  9 + return {
  10 + /**
  11 + * 获取查询条件信息,
  12 + * 用于给controller用来和页面数据绑定。
  13 + */
  14 + getSearchCondition: function() {
  15 + return currentSearchCondition;
  16 + },
  17 + /**
  18 + * 重置查询条件信息。
  19 + */
  20 + resetSearchCondition: function() {
  21 + var key;
  22 + for (key in currentSearchCondition) {
  23 + currentSearchCondition[key] = null;
  24 + }
  25 + },
  26 + /**
  27 + * 设置当前页码。
  28 + * @param cpn 从1开始,后台是从0开始的
  29 + */
  30 + setCurrentPageNo: function(cpn) {
  31 + currentPageNo = cpn;
  32 + },
  33 + /**
  34 + * 组装查询参数,返回一个promise查询结果。
  35 + * @param params 查询参数
  36 + * @return 返回一个 promise
  37 + */
  38 + getPage: function() {
  39 + var params = currentSearchCondition; // 查询条件
  40 + params.page = currentPageNo - 1; // 服务端页码从0开始
  41 + return service.rest.list(params).$promise;
  42 + },
  43 + /**
  44 + * 获取明细信息。
  45 + * @param id 车辆id
  46 + * @return 返回一个 promise
  47 + */
  48 + getDetail: function(id) {
  49 + var params = {id: id};
  50 + return service.rest.get(params).$promise;
  51 + },
  52 + /**
  53 + * 保存信息。
  54 + * @param obj 车辆详细信息
  55 + * @return 返回一个 promise
  56 + */
  57 + saveDetail: function(obj) {
  58 + return service.rest.save(obj).$promise;
  59 + }
  60 + };
  61 +
  62 +}]);
  63 +
  64 +angular.module('ScheduleApp').controller('ScheduleRuleManageCtrl', ['ScheduleRuleManageService', '$state', function(busConfigService, $state) {
5 var self = this; 65 var self = this;
6 66
7 // 切换到form状态 67 // 切换到form状态
8 self.goForm = function() { 68 self.goForm = function() {
9 - alert("生成"); 69 + //alert("切换");
  70 + $state.go("scheduleRuleManage_form");
  71 + };
10 72
11 - }  
12 }]); 73 }]);
13 74
14 -angular.module('ScheduleApp').controller('ScheduleRuleManageListCtrl', [function() { 75 +angular.module('ScheduleApp').controller('ScheduleRuleManageListCtrl', ['ScheduleRuleManageService', function(scheduleRuleManageService) {
15 var self = this; 76 var self = this;
16 self.pageInfo = { 77 self.pageInfo = {
17 totalItems : 0, 78 totalItems : 0,
@@ -20,16 +81,17 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;ScheduleRuleManageListCtrl&#39;, [function @@ -20,16 +81,17 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;ScheduleRuleManageListCtrl&#39;, [function
20 }; 81 };
21 82
22 // 初始创建的时候,获取一次列表数据 83 // 初始创建的时候,获取一次列表数据
23 - // TODO:假数据  
24 - self.pageInfo.infos.push({  
25 - xl: "85路",  
26 - cl: "Q4A-001",  
27 - fbms: "0111110",  
28 - qslp: "1",  
29 - lpfw: "+1,+2,+3,+4,+5",  
30 - qsry: "1",  
31 - ryfw: "36"  
32 - }); 84 + scheduleRuleManageService.getPage().then(
  85 + function(result) {
  86 + self.pageInfo.totalItems = result.totalElements;
  87 + self.pageInfo.currentPage = result.number + 1;
  88 + self.pageInfo.infos = result.content;
  89 + scheduleRuleManageService.setCurrentPageNo(result.number + 1);
  90 + },
  91 + function(result) {
  92 + alert("出错啦!");
  93 + }
  94 + );
33 95
34 //$scope.$watch("ctrl.pageInfo.currentPage", function() { 96 //$scope.$watch("ctrl.pageInfo.currentPage", function() {
35 // alert("dfdfdf"); 97 // alert("dfdfdf");
@@ -37,16 +99,119 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;ScheduleRuleManageListCtrl&#39;, [function @@ -37,16 +99,119 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;ScheduleRuleManageListCtrl&#39;, [function
37 99
38 // 翻页的时候调用 100 // 翻页的时候调用
39 self.pageChanaged = function() { 101 self.pageChanaged = function() {
  102 + scheduleRuleManageService.setCurrentPageNo(self.pageInfo.currentPage);
  103 + scheduleRuleManageService.getPage().then(
  104 + function(result) {
  105 + self.pageInfo.totalItems = result.totalElements;
  106 + self.pageInfo.currentPage = result.number + 1;
  107 + self.pageInfo.infos = result.content;
  108 + scheduleRuleManageService.setCurrentPageNo(result.number + 1);
  109 + },
  110 + function(result) {
  111 + alert("出错啦!");
  112 + }
  113 + );
40 }; 114 };
41 // 获取查询条件数据 115 // 获取查询条件数据
42 self.searchCondition = function() { 116 self.searchCondition = function() {
  117 + return scheduleRuleManageService.getSearchCondition();
43 }; 118 };
44 // 重置查询条件 119 // 重置查询条件
45 self.resetSearchCondition = function() { 120 self.resetSearchCondition = function() {
  121 + scheduleRuleManageService.resetSearchCondition();
  122 + self.pageInfo.currentPage = 1;
  123 + self.pageChanaged();
46 }; 124 };
47 125
48 }]); 126 }]);
49 127
  128 +angular.module('ScheduleApp').controller('ScheduleRuleManageFormCtrl', ['ScheduleRuleManageService', '$stateParams', '$state', '$scope', function(scheduleRuleManageService, $stateParams, $state, $scope) {
  129 + var self = this;
  130 +
  131 + // 启用日期 日期控件开关
  132 + self.qyrqOpen = false;
  133 + self.qyrq_open = function() {
  134 + self.qyrqOpen = true;
  135 + };
  136 +
  137 + // 欲保存的busInfo信息,绑定
  138 + self.scheduleRuleManageForSave = {};
  139 +
  140 + // 获取传过来的id,有的话就是修改,获取一遍数据
  141 + var id = $stateParams.id;
  142 + if (id) {
  143 + self.scheduleRuleManageForSave.id = id;
  144 + scheduleRuleManageService.getDetail(id).then(
  145 + function(result) {
  146 + var key;
  147 + for (key in result) {
  148 + self.scheduleRuleManageForSave[key] = result[key];
  149 + }
  150 +
  151 + // 添加xl_id,cl_id
  152 + self.scheduleRuleManageForSave["xl_id"] = self.scheduleRuleManageForSave.xl.id;
  153 + self.scheduleRuleManageForSave["cl_id"] = self.scheduleRuleManageForSave.cl.id;
  154 + },
  155 + function(result) {
  156 + alert("出错啦!");
  157 + }
  158 + );
  159 + }
  160 +
  161 + // 提交方法
  162 + self.submit = function() {
  163 + console.log(self.scheduleRuleManageForSave);
  164 +
  165 + var mf = $scope.myForm;
  166 +
  167 + // xl_id,cl_id要组织成对象,然后删除
  168 + self.scheduleRuleManageForSave["xl"] = {};
  169 + self.scheduleRuleManageForSave.xl["id"] = self.scheduleRuleManageForSave["xl_id"];
  170 + delete self.scheduleRuleManageForSave["xl_id"];
  171 + self.scheduleRuleManageForSave["cl"] = {};
  172 + self.scheduleRuleManageForSave.cl["id"] = self.scheduleRuleManageForSave["cl_id"];
  173 + delete self.scheduleRuleManageForSave["cl_id"];
  174 +
  175 + scheduleRuleManageService.saveDetail(self.scheduleRuleManageForSave).then(
  176 + function(result) {
  177 + // TODO:弹出框方式以后改
  178 + if (result.status == 'SUCCESS') {
  179 + alert("保存成功!");
  180 + $state.go("scheduleRuleManage");
  181 + } else {
  182 + alert("保存异常!");
  183 + }
  184 + },
  185 + function(result) {
  186 + // TODO:弹出框方式以后改
  187 + alert("出错啦!");
  188 + }
  189 + );
  190 + };
  191 +}]);
  192 +
  193 +angular.module('ScheduleApp').controller('ScheduleRuleManageDetailCtrl', ['ScheduleRuleManageService', '$stateParams', function(scheduleRuleManageService, $stateParams) {
  194 + var self = this;
  195 + self.title = "";
  196 + self.scheduleRuleManageForDetail = {};
  197 + self.scheduleRuleManageForDetail.id = $stateParams.id;
  198 +
  199 + // 当转向到此页面时,就获取明细信息并绑定
  200 + scheduleRuleManageService.getDetail($stateParams.id).then(
  201 + function(result) {
  202 + var key;
  203 + for (key in result) {
  204 + self.scheduleRuleManageForDetail[key] = result[key];
  205 + }
  206 +
  207 + self.title = "规则配置详细信息";
  208 + },
  209 + function(result) {
  210 + // TODO:弹出框方式以后改
  211 + alert("出错啦!");
  212 + }
  213 + );
  214 +}]);
50 215
51 216
52 217
src/main/resources/static/pages/scheduleApp/module/main.js
@@ -618,6 +618,63 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi @@ -618,6 +618,63 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
618 name: 'scheduleRuleManage_module', 618 name: 'scheduleRuleManage_module',
619 insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 619 insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
620 files: [ 620 files: [
  621 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  622 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  623 + "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js"
  624 + ]
  625 + });
  626 + }]
  627 + }
  628 + })
  629 + .state("scheduleRuleManage_form", {
  630 + url: '/scheduleRuleManage_form',
  631 + views: {
  632 + "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/form.html'}
  633 + },
  634 + resolve: {
  635 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  636 + return $ocLazyLoad.load({
  637 + name: 'scheduleRuleManage_form_module',
  638 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  639 + files: [
  640 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  641 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  642 + "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js"
  643 + ]
  644 + });
  645 + }]
  646 + }
  647 + })
  648 + .state("scheduleRuleManage_edit", {
  649 + url: '/scheduleRuleManage_edit/:id',
  650 + views: {
  651 + "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/edit.html'}
  652 + },
  653 + resolve: {
  654 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  655 + return $ocLazyLoad.load({
  656 + name: 'scheduleRuleManage_edit_module',
  657 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  658 + files: [
  659 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  660 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  661 + "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js"
  662 + ]
  663 + });
  664 + }]
  665 + }
  666 + })
  667 + .state("scheduleRuleManage_detail", {
  668 + url: '/scheduleRuleManage_detail/:id',
  669 + views: {
  670 + "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/detail.html'}
  671 + },
  672 + resolve: {
  673 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  674 + return $ocLazyLoad.load({
  675 + name: 'scheduleRuleManage_detail_module',
  676 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  677 + files: [
621 "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js" 678 "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js"
622 ] 679 ]
623 }); 680 });
@@ -881,6 +938,30 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;GuideboardManageService_g&#39;, [&#39;$resource&#39;, @@ -881,6 +938,30 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;GuideboardManageService_g&#39;, [&#39;$resource&#39;,
881 }; 938 };
882 }]); 939 }]);
883 940
  941 +// 排班管理service
  942 +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
  943 + return {
  944 + rest: $resource(
  945 + '/sr1fc/:id',
  946 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  947 + {
  948 + list: {
  949 + method: 'GET',
  950 + params: {
  951 + page: 0
  952 + }
  953 + },
  954 + get: {
  955 + method: 'GET'
  956 + },
  957 + save: {
  958 + method: 'POST'
  959 + }
  960 + }
  961 + )
  962 + };
  963 +}]);
  964 +
884 // 时刻表管理service 965 // 时刻表管理service
885 angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) { 966 angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
886 // TODO:之后返回两个$resource,包含 时刻表和时刻表明细 967 // TODO:之后返回两个$resource,包含 时刻表和时刻表明细