Commit 5b8a3bd40202036496f78b3a66f30cd4f7866ef5
1 parent
9a65026d
Update
Showing
10 changed files
with
216 additions
and
283 deletions
src/main/java/com/bsth/controller/schedule/BController.java
| @@ -40,9 +40,12 @@ public class BController<T, ID extends Serializable> { | @@ -40,9 +40,12 @@ public class BController<T, ID extends Serializable> { | ||
| 40 | SysUser sysUser = sysUserService.findByUserName(userName); | 40 | SysUser sysUser = sysUserService.findByUserName(userName); |
| 41 | BEntity t_b = null; | 41 | BEntity t_b = null; |
| 42 | if (t instanceof BEntity) { | 42 | if (t instanceof BEntity) { |
| 43 | + Date cdate = new Date(); | ||
| 43 | t_b = (BEntity) t; | 44 | t_b = (BEntity) t; |
| 44 | t_b.setCreateBy(sysUser); | 45 | t_b.setCreateBy(sysUser); |
| 45 | - t_b.setCreateDate(new Date()); | 46 | + t_b.setCreateDate(cdate); |
| 47 | + t_b.setUpdateBy(sysUser); | ||
| 48 | + t_b.setUpdateDate(cdate); | ||
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | T t_saved = bService.save(t_b == null ? t : (T) t_b); | 51 | T t_saved = bService.save(t_b == null ? t : (T) t_b); |
src/main/java/com/bsth/controller/schedule/SchedulePlanController.java renamed to src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
| 1 | -package com.bsth.controller.schedule; | 1 | +package com.bsth.controller.schedule.core; |
| 2 | 2 | ||
| 3 | -import com.bsth.controller.BaseController; | 3 | +import com.bsth.controller.schedule.BController; |
| 4 | import com.bsth.entity.schedule.SchedulePlan; | 4 | import com.bsth.entity.schedule.SchedulePlan; |
| 5 | import com.bsth.service.schedule.SchedulePlanService; | 5 | import com.bsth.service.schedule.SchedulePlanService; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 8 | import org.springframework.web.bind.annotation.RequestMapping; | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | import org.springframework.web.bind.annotation.RequestMethod; | 8 | import org.springframework.web.bind.annotation.RequestMethod; |
| 10 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| 11 | 10 | ||
| 12 | -import java.util.Map; | ||
| 13 | - | ||
| 14 | /** | 11 | /** |
| 15 | * Created by xu on 16/6/16. | 12 | * Created by xu on 16/6/16. |
| 16 | */ | 13 | */ |
| 17 | @RestController | 14 | @RestController |
| 18 | @RequestMapping("spc") | 15 | @RequestMapping("spc") |
| 19 | -public class SchedulePlanController extends BaseController<SchedulePlan, Long> { | 16 | +public class SchedulePlanController extends BController<SchedulePlan, Long> { |
| 20 | @Autowired | 17 | @Autowired |
| 21 | private SchedulePlanService schedulePlanService; | 18 | private SchedulePlanService schedulePlanService; |
| 22 | 19 | ||
| 23 | /** | 20 | /** |
| 24 | - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | ||
| 25 | - * @Title: save | ||
| 26 | - * @Description: TODO(持久化对象) | ||
| 27 | - * @param @param t | ||
| 28 | - * @param @return 设定文件 | ||
| 29 | - * @return Map<String,Object> {status: 1(成功),-1(失败)} | ||
| 30 | - * @throws | ||
| 31 | - */ | ||
| 32 | - @RequestMapping(method = RequestMethod.POST) | ||
| 33 | - public Map<String, Object> save(@RequestBody SchedulePlan t){ | ||
| 34 | - | ||
| 35 | - return baseService.save(t); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | * 获取明天的一歌排班计划。 | 21 | * 获取明天的一歌排班计划。 |
| 40 | * @return | 22 | * @return |
| 41 | * @throws Exception | 23 | * @throws Exception |
src/main/java/com/bsth/entity/schedule/SchedulePlan.java
| @@ -2,7 +2,6 @@ package com.bsth.entity.schedule; | @@ -2,7 +2,6 @@ package com.bsth.entity.schedule; | ||
| 2 | 2 | ||
| 3 | import com.bsth.entity.Line; | 3 | import com.bsth.entity.Line; |
| 4 | import com.bsth.entity.schedule.rule.ScheduleRule1; | 4 | import com.bsth.entity.schedule.rule.ScheduleRule1; |
| 5 | -import com.bsth.entity.sys.SysUser; | ||
| 6 | import com.fasterxml.jackson.annotation.JsonIgnore; | 5 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 7 | 6 | ||
| 8 | import javax.persistence.*; | 7 | import javax.persistence.*; |
| @@ -21,7 +20,7 @@ import java.util.List; | @@ -21,7 +20,7 @@ import java.util.List; | ||
| 21 | @NamedAttributeNode("ttInfo") | 20 | @NamedAttributeNode("ttInfo") |
| 22 | }) | 21 | }) |
| 23 | }) | 22 | }) |
| 24 | -public class SchedulePlan { | 23 | +public class SchedulePlan extends BEntity { |
| 25 | 24 | ||
| 26 | /** 主键Id */ | 25 | /** 主键Id */ |
| 27 | @Id | 26 | @Id |
| @@ -60,19 +59,6 @@ public class SchedulePlan { | @@ -60,19 +59,6 @@ public class SchedulePlan { | ||
| 60 | @OneToMany(mappedBy = "schedulePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | 59 | @OneToMany(mappedBy = "schedulePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY) |
| 61 | private List<SchedulePlanInfo> schedulePlanInfoList = new ArrayList<>(); | 60 | private List<SchedulePlanInfo> schedulePlanInfoList = new ArrayList<>(); |
| 62 | 61 | ||
| 63 | - /** 创建人 */ | ||
| 64 | - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | ||
| 65 | - private SysUser createBy; | ||
| 66 | - /** 修改人 */ | ||
| 67 | - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | ||
| 68 | - private SysUser updateBy; | ||
| 69 | - /** 创建日期 */ | ||
| 70 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 71 | - private Date createDate; | ||
| 72 | - /** 修改日期 */ | ||
| 73 | - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 74 | - private Date updateDate; | ||
| 75 | - | ||
| 76 | public Long getId() { | 62 | public Long getId() { |
| 77 | return id; | 63 | return id; |
| 78 | } | 64 | } |
| @@ -129,38 +115,6 @@ public class SchedulePlan { | @@ -129,38 +115,6 @@ public class SchedulePlan { | ||
| 129 | this.schedulePlanInfoList = schedulePlanInfoList; | 115 | this.schedulePlanInfoList = schedulePlanInfoList; |
| 130 | } | 116 | } |
| 131 | 117 | ||
| 132 | - public SysUser getCreateBy() { | ||
| 133 | - return createBy; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - public void setCreateBy(SysUser createBy) { | ||
| 137 | - this.createBy = createBy; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - public SysUser getUpdateBy() { | ||
| 141 | - return updateBy; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - public void setUpdateBy(SysUser updateBy) { | ||
| 145 | - this.updateBy = updateBy; | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - public Date getCreateDate() { | ||
| 149 | - return createDate; | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - public void setCreateDate(Date createDate) { | ||
| 153 | - this.createDate = createDate; | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - public Date getUpdateDate() { | ||
| 157 | - return updateDate; | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - public void setUpdateDate(Date updateDate) { | ||
| 161 | - this.updateDate = updateDate; | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | public String getTtInfoNames() { | 118 | public String getTtInfoNames() { |
| 165 | return ttInfoNames; | 119 | return ttInfoNames; |
| 166 | } | 120 | } |
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | -import com.bsth.service.BaseService; | ||
| 5 | 4 | ||
| 6 | /** | 5 | /** |
| 7 | * Created by xu on 16/6/16. | 6 | * Created by xu on 16/6/16. |
| 8 | */ | 7 | */ |
| 9 | -public interface SchedulePlanService extends BaseService<SchedulePlan, Long> { | 8 | +public interface SchedulePlanService extends BService<SchedulePlan, Long> { |
| 10 | /** | 9 | /** |
| 11 | * 获取有明日排班的计划。 | 10 | * 获取有明日排班的计划。 |
| 12 | * @return | 11 | * @return |
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java renamed to src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| 1 | -package com.bsth.service.schedule; | 1 | +package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.Line; | 3 | import com.bsth.entity.Line; |
| 4 | import com.bsth.entity.schedule.*; | 4 | import com.bsth.entity.schedule.*; |
| 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | import com.bsth.repository.schedule.SchedulePlanInfoRepository; | 6 | import com.bsth.repository.schedule.SchedulePlanInfoRepository; |
| 7 | import com.bsth.repository.schedule.SchedulePlanRepository; | 7 | import com.bsth.repository.schedule.SchedulePlanRepository; |
| 8 | -import com.bsth.service.impl.BaseServiceImpl; | 8 | +import com.bsth.service.schedule.SchedulePlanService; |
| 9 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | 9 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 10 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | 10 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 11 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | 11 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| @@ -28,7 +28,7 @@ import java.util.*; | @@ -28,7 +28,7 @@ import java.util.*; | ||
| 28 | * Created by xu on 16/6/16. | 28 | * Created by xu on 16/6/16. |
| 29 | */ | 29 | */ |
| 30 | @Service | 30 | @Service |
| 31 | -public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> implements SchedulePlanService { | 31 | +public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService { |
| 32 | @Autowired | 32 | @Autowired |
| 33 | private KieBase kieBase; | 33 | private KieBase kieBase; |
| 34 | @Autowired | 34 | @Autowired |
| @@ -40,7 +40,7 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> | @@ -40,7 +40,7 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> | ||
| 40 | 40 | ||
| 41 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | 41 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 42 | @Override | 42 | @Override |
| 43 | - public Map<String, Object> save(SchedulePlan schedulePlan) { | 43 | + public SchedulePlan save(SchedulePlan schedulePlan) { |
| 44 | // 1-1、查找线路具体信息 | 44 | // 1-1、查找线路具体信息 |
| 45 | Line xl = strategy.getLine(schedulePlan.getXl().getId()); | 45 | Line xl = strategy.getLine(schedulePlan.getXl().getId()); |
| 46 | // 1-2、查出指定线路的所有规则 | 46 | // 1-2、查出指定线路的所有规则 |
| @@ -126,7 +126,9 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> | @@ -126,7 +126,9 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> | ||
| 126 | 126 | ||
| 127 | // 3-2、保存生成的排班和明细 | 127 | // 3-2、保存生成的排班和明细 |
| 128 | schedulePlan.getSchedulePlanInfoList().addAll(schedulePlanInfos); // 关联的排班明细信息 | 128 | schedulePlan.getSchedulePlanInfoList().addAll(schedulePlanInfos); // 关联的排班明细信息 |
| 129 | - return super.save(schedulePlan); | 129 | + super.save(schedulePlan); |
| 130 | + | ||
| 131 | + return new SchedulePlan(); | ||
| 130 | } | 132 | } |
| 131 | 133 | ||
| 132 | @Override | 134 | @Override |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| @@ -425,16 +425,32 @@ angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource | @@ -425,16 +425,32 @@ angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource | ||
| 425 | return { | 425 | return { |
| 426 | rest : $resource( | 426 | rest : $resource( |
| 427 | '/spc/:id', | 427 | '/spc/:id', |
| 428 | - {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'}, | 428 | + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id'}, |
| 429 | { | 429 | { |
| 430 | list: { | 430 | list: { |
| 431 | method: 'GET', | 431 | method: 'GET', |
| 432 | params: { | 432 | params: { |
| 433 | page: 0 | 433 | page: 0 |
| 434 | + }, | ||
| 435 | + transformResponse: function(rs) { | ||
| 436 | + var dst = angular.fromJson(rs); | ||
| 437 | + if (dst.status == 'SUCCESS') { | ||
| 438 | + return dst.data; | ||
| 439 | + } else { | ||
| 440 | + return dst; // 业务错误留给控制器处理 | ||
| 441 | + } | ||
| 434 | } | 442 | } |
| 435 | }, | 443 | }, |
| 436 | get: { | 444 | get: { |
| 437 | - method: 'GET' | 445 | + method: 'GET', |
| 446 | + transformResponse: function(rs) { | ||
| 447 | + var dst = angular.fromJson(rs); | ||
| 448 | + if (dst.status == 'SUCCESS') { | ||
| 449 | + return dst.data; | ||
| 450 | + } else { | ||
| 451 | + return dst; | ||
| 452 | + } | ||
| 453 | + } | ||
| 438 | }, | 454 | }, |
| 439 | save: { | 455 | save: { |
| 440 | method: 'POST' | 456 | method: 'POST' |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | <th style="width: 100%;">关联时刻表</th> | 9 | <th style="width: 100%;">关联时刻表</th> |
| 10 | <th style="width: 150px;">排班开始日期</th> | 10 | <th style="width: 150px;">排班开始日期</th> |
| 11 | <th style="width: 150px;">排班结束日期</th> | 11 | <th style="width: 150px;">排班结束日期</th> |
| 12 | - <th style="width: 180px;">排班操作时间</th> | 12 | + <th style="width: 250px;">排班人/操作时间</th> |
| 13 | <th style="width: 180px;">操作</th> | 13 | <th style="width: 180px;">操作</th> |
| 14 | </tr> | 14 | </tr> |
| 15 | <tr role="row" class="filter"> | 15 | <tr role="row" class="filter"> |
| @@ -59,18 +59,18 @@ | @@ -59,18 +59,18 @@ | ||
| 59 | <td></td> | 59 | <td></td> |
| 60 | <td> | 60 | <td> |
| 61 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" | 61 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 62 | - ng-click="ctrl.pageChanaged()"> | 62 | + ng-click="ctrl.doPage()"> |
| 63 | <i class="fa fa-search"></i> 搜索</button> | 63 | <i class="fa fa-search"></i> 搜索</button> |
| 64 | 64 | ||
| 65 | <button class="btn btn-sm red btn-outline filter-cancel" | 65 | <button class="btn btn-sm red btn-outline filter-cancel" |
| 66 | - ng-click="ctrl.resetSearchCondition()"> | 66 | + ng-click="ctrl.reset()"> |
| 67 | <i class="fa fa-times"></i> 重置</button> | 67 | <i class="fa fa-times"></i> 重置</button> |
| 68 | </td> | 68 | </td> |
| 69 | 69 | ||
| 70 | </tr> | 70 | </tr> |
| 71 | </thead> | 71 | </thead> |
| 72 | <tbody> | 72 | <tbody> |
| 73 | - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX"> | 73 | + <tr ng-repeat="info in ctrl.page()['content']" class="odd gradeX"> |
| 74 | <td> | 74 | <td> |
| 75 | <span ng-bind="$index + 1"></span> | 75 | <span ng-bind="$index + 1"></span> |
| 76 | </td> | 76 | </td> |
| @@ -87,6 +87,8 @@ | @@ -87,6 +87,8 @@ | ||
| 87 | <span ng-bind="info.scheduleToTime | date: 'yyyy-MM-dd '"></span> | 87 | <span ng-bind="info.scheduleToTime | date: 'yyyy-MM-dd '"></span> |
| 88 | </td> | 88 | </td> |
| 89 | <td> | 89 | <td> |
| 90 | + <span ng-bind="info.updateBy.name"></span> | ||
| 91 | + / | ||
| 90 | <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span> | 92 | <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span> |
| 91 | </td> | 93 | </td> |
| 92 | <td> | 94 | <td> |
| @@ -95,6 +97,7 @@ | @@ -95,6 +97,7 @@ | ||
| 95 | <a ui-sref="schedulePlanInfoManage({spid : info.id, xlname : info.xl.name, ttname : info.ttInfoNames, stime : info.scheduleFromTime, etime : info.scheduleToTime})" | 97 | <a ui-sref="schedulePlanInfoManage({spid : info.id, xlname : info.xl.name, ttname : info.ttInfoNames, stime : info.scheduleFromTime, etime : info.scheduleToTime})" |
| 96 | class="btn btn-info btn-sm"> 明细 </a> | 98 | class="btn btn-info btn-sm"> 明细 </a> |
| 97 | <a ng-click="ctrl.deletePlan(info.id)" | 99 | <a ng-click="ctrl.deletePlan(info.id)" |
| 100 | + uib-popover="删除当前排班计划,请慎重处理!" popover-trigger="mouseenter" | ||
| 98 | class="btn btn-danger btn-sm"> 删除 </a> | 101 | class="btn btn-danger btn-sm"> 删除 </a> |
| 99 | </td> | 102 | </td> |
| 100 | </tr> | 103 | </tr> |
| @@ -104,9 +107,9 @@ | @@ -104,9 +107,9 @@ | ||
| 104 | 107 | ||
| 105 | 108 | ||
| 106 | <div style="text-align: right;"> | 109 | <div style="text-align: right;"> |
| 107 | - <uib-pagination total-items="ctrl.pageInfo.totalItems" | ||
| 108 | - ng-model="ctrl.pageInfo.currentPage" | ||
| 109 | - ng-change="ctrl.pageChanaged()" | 110 | + <uib-pagination total-items="ctrl.page()['totalElements']" |
| 111 | + ng-model="ctrl.page()['uiNumber']" | ||
| 112 | + ng-change="ctrl.doPage()" | ||
| 110 | rotate="false" | 113 | rotate="false" |
| 111 | max-size="10" | 114 | max-size="10" |
| 112 | boundary-links="true" | 115 | boundary-links="true" |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/module.js
| 1 | // 车辆配置管理 service controller 等写在一起 | 1 | // 车辆配置管理 service controller 等写在一起 |
| 2 | -angular.module('ScheduleApp').factory('SchedulePlanManageService', ['SchedulePlanManageService_g', function(service) { | ||
| 3 | - /** 当前的查询条件信息 */ | ||
| 4 | - var currentSearchCondition = {}; | ||
| 5 | - | ||
| 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] = undefined; | ||
| 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 obj 车辆详细信息 | ||
| 46 | - * @return 返回一个 promise | ||
| 47 | - */ | ||
| 48 | - saveDetail: function(obj) { | ||
| 49 | - return service.rest.save(obj).$promise; | ||
| 50 | - }, | ||
| 51 | - /** | ||
| 52 | - * 删除信息。 | ||
| 53 | - * @param id 主键id | ||
| 54 | - * @returns {*|Function|promise|n} | ||
| 55 | - */ | ||
| 56 | - deleteDetail: function(id) { | ||
| 57 | - return service.rest.delete({id: id}).$promise; | ||
| 58 | - } | 2 | +angular.module('ScheduleApp').factory( |
| 3 | + 'SchedulePlanManageService', | ||
| 4 | + [ | ||
| 5 | + 'SchedulePlanManageService_g', | ||
| 6 | + function(service) { | ||
| 7 | + /** 当前的查询条件信息 */ | ||
| 8 | + var currentSearchCondition = {}; | ||
| 9 | + | ||
| 10 | + // 当前查询返回的信息 | ||
| 11 | + var currentPage = { // 后台spring data返回的格式 | ||
| 12 | + totalElements: 0, | ||
| 13 | + number: 0, // 后台返回的页码,spring返回从0开始 | ||
| 14 | + content: [], | ||
| 15 | + | ||
| 16 | + uiNumber: 1 // 页面绑定的页码 | ||
| 17 | + }; | ||
| 18 | + | ||
| 19 | + // 查询对象 | ||
| 20 | + var queryClass = service.rest; | ||
| 21 | + | ||
| 22 | + return { | ||
| 23 | + getQueryClass: function() { | ||
| 24 | + return queryClass; | ||
| 25 | + }, | ||
| 26 | + getSearchCondition: function() { | ||
| 27 | + currentSearchCondition.page = currentPage.uiNumber - 1; | ||
| 28 | + return currentSearchCondition; | ||
| 29 | + }, | ||
| 30 | + getPage: function(page) { | ||
| 31 | + if (page) { | ||
| 32 | + currentPage.totalElements = page.totalElements; | ||
| 33 | + currentPage.number = page.number; | ||
| 34 | + currentPage.content = page.content; | ||
| 35 | + } | ||
| 36 | + return currentPage; | ||
| 37 | + }, | ||
| 38 | + resetStatus: function() { | ||
| 39 | + currentSearchCondition = {page: 0}; | ||
| 40 | + currentPage = { | ||
| 41 | + totalElements: 0, | ||
| 42 | + number: 0, | ||
| 43 | + content: [], | ||
| 44 | + uiNumber: 1 | ||
| 45 | + }; | ||
| 46 | + } | ||
| 59 | 47 | ||
| 60 | - }; | 48 | + }; |
| 61 | 49 | ||
| 62 | }]); | 50 | }]); |
| 63 | 51 | ||
| 64 | -angular.module('ScheduleApp').controller('SchedulePlanManageCtrl', ['SchedulePlanManageService', '$state', function(schedulePlanManageService, $state) { | ||
| 65 | - var self = this; | 52 | +// index.html控制器 |
| 53 | +angular.module('ScheduleApp').controller( | ||
| 54 | + 'SchedulePlanManageCtrl', | ||
| 55 | + [ | ||
| 56 | + 'SchedulePlanManageService', | ||
| 57 | + '$state', | ||
| 58 | + function(service, $state) { | ||
| 59 | + var self = this; | ||
| 66 | 60 | ||
| 67 | - // 切换到form状态 | ||
| 68 | - self.goForm = function() { | ||
| 69 | - $state.go("schedulePlanManage_form"); | ||
| 70 | - } | ||
| 71 | -}]); | 61 | + // 切换到form状态 |
| 62 | + self.goForm = function() { | ||
| 63 | + $state.go("schedulePlanManage_form"); | ||
| 64 | + }; | ||
| 72 | 65 | ||
| 73 | -angular.module('ScheduleApp').controller('SchedulePlanManageListCtrl', ['SchedulePlanManageService', function(schedulePlanManageService) { | ||
| 74 | - var self = this; | ||
| 75 | - self.pageInfo = { | ||
| 76 | - totalItems : 0, | ||
| 77 | - currentPage : 1, | ||
| 78 | - infos: [] | ||
| 79 | - }; | ||
| 80 | - | ||
| 81 | - // 日期 日期控件开关 | ||
| 82 | - self.scheduleFromTime = false; | ||
| 83 | - self.scheduleFromTime_open = function() { | ||
| 84 | - self.scheduleFromTime = true; | ||
| 85 | - }; | ||
| 86 | - self.scheduleToTime = false; | ||
| 87 | - self.scheduleToTime_open = function() { | ||
| 88 | - self.scheduleToTime = true; | ||
| 89 | - }; | ||
| 90 | - | ||
| 91 | - // 初始创建的时候,获取一次列表数据 | ||
| 92 | - schedulePlanManageService.getPage().then( | ||
| 93 | - function(result) { | ||
| 94 | - self.pageInfo.totalItems = result.totalElements; | ||
| 95 | - self.pageInfo.currentPage = result.number + 1; | ||
| 96 | - self.pageInfo.infos = result.content; | ||
| 97 | - schedulePlanManageService.setCurrentPageNo(result.number + 1); | ||
| 98 | - }, | ||
| 99 | - function(result) { | ||
| 100 | - alert("出错啦!"); | ||
| 101 | } | 66 | } |
| 102 | - ); | ||
| 103 | - | ||
| 104 | - //$scope.$watch("ctrl.pageInfo.currentPage", function() { | ||
| 105 | - // alert("dfdfdf"); | ||
| 106 | - //}); | ||
| 107 | - | ||
| 108 | - // 翻页的时候调用 | ||
| 109 | - self.pageChanaged = function() { | ||
| 110 | - schedulePlanManageService.setCurrentPageNo(self.pageInfo.currentPage); | ||
| 111 | - schedulePlanManageService.getPage().then( | ||
| 112 | - function(result) { | ||
| 113 | - self.pageInfo.totalItems = result.totalElements; | ||
| 114 | - self.pageInfo.currentPage = result.number + 1; | ||
| 115 | - self.pageInfo.infos = result.content; | ||
| 116 | - schedulePlanManageService.setCurrentPageNo(result.number + 1); | ||
| 117 | - }, | ||
| 118 | - function(result) { | ||
| 119 | - alert("出错啦!"); | ||
| 120 | - } | ||
| 121 | - ); | ||
| 122 | - }; | ||
| 123 | - // 获取查询条件数据 | ||
| 124 | - self.searchCondition = function() { | ||
| 125 | - return schedulePlanManageService.getSearchCondition(); | ||
| 126 | - }; | ||
| 127 | - // 重置查询条件 | ||
| 128 | - self.resetSearchCondition = function() { | ||
| 129 | - schedulePlanManageService.resetSearchCondition(); | ||
| 130 | - self.pageInfo.currentPage = 1; | ||
| 131 | - self.pageChanaged(); | ||
| 132 | - }; | ||
| 133 | - | ||
| 134 | - // 删除排班(整个删除) | ||
| 135 | - self.deletePlan = function(id) { | ||
| 136 | - schedulePlanManageService.deleteDetail(id).then( | ||
| 137 | - function(result) { | ||
| 138 | - alert("删除成功!"); | ||
| 139 | - | ||
| 140 | - schedulePlanManageService.getPage().then( | ||
| 141 | - function(result) { | ||
| 142 | - self.pageInfo.totalItems = result.totalElements; | ||
| 143 | - self.pageInfo.currentPage = result.number + 1; | ||
| 144 | - self.pageInfo.infos = result.content; | ||
| 145 | - schedulePlanManageService.setCurrentPageNo(result.number + 1); | ||
| 146 | - }, | ||
| 147 | - function(result) { | ||
| 148 | - alert("出错啦!"); | ||
| 149 | - } | ||
| 150 | - ); | ||
| 151 | - }, | ||
| 152 | - function(result) { | ||
| 153 | - alert("出错啦!"); | ||
| 154 | - } | ||
| 155 | - ); | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | -}]); | ||
| 159 | - | ||
| 160 | - | ||
| 161 | -angular.module('ScheduleApp').controller('SchedulePlanManageFormCtrl', ['SchedulePlanManageService', '$stateParams', '$state', '$scope', function(schedulePlanManageService, $stateParams, $state, $scope) { | ||
| 162 | - var self = this; | ||
| 163 | - | ||
| 164 | - // 开始日期 日期控件开关 | ||
| 165 | - self.scheduleFromTimeOpen = false; | ||
| 166 | - self.scheduleFromTime_open = function() { | ||
| 167 | - self.scheduleFromTimeOpen = true; | ||
| 168 | - }; | ||
| 169 | - | ||
| 170 | - // 结束日期 日期控件开关 | ||
| 171 | - self.scheduleToTimeOpen = false; | ||
| 172 | - self.scheduleToTime_open = function() { | ||
| 173 | - self.scheduleToTimeOpen = true; | ||
| 174 | - }; | ||
| 175 | - | ||
| 176 | - // 欲保存的busInfo信息,绑定 | ||
| 177 | - self.schedulePlanManageForSave = {xl: {}}; | ||
| 178 | - | ||
| 179 | - // 提交方法 | ||
| 180 | - self.submit = function() { | ||
| 181 | - console.log(self.schedulePlanManageForSave); | ||
| 182 | - | ||
| 183 | - schedulePlanManageService.saveDetail(self.schedulePlanManageForSave).then( | ||
| 184 | - function(result) { | ||
| 185 | - // TODO:弹出框方式以后改 | ||
| 186 | - if (result.status == 'SUCCESS') { | ||
| 187 | - alert("保存成功!"); | 67 | + ] |
| 68 | +); | ||
| 69 | + | ||
| 70 | +// list.html控制器 | ||
| 71 | +angular.module('ScheduleApp').controller( | ||
| 72 | + 'SchedulePlanManageListCtrl', | ||
| 73 | + [ | ||
| 74 | + 'SchedulePlanManageService', | ||
| 75 | + function(service) { | ||
| 76 | + var self = this; | ||
| 77 | + // 日期 日期控件开关 | ||
| 78 | + self.scheduleFromTime = false; | ||
| 79 | + self.scheduleFromTime_open = function() { | ||
| 80 | + self.scheduleFromTime = true; | ||
| 81 | + }; | ||
| 82 | + self.scheduleToTime = false; | ||
| 83 | + self.scheduleToTime_open = function() { | ||
| 84 | + self.scheduleToTime = true; | ||
| 85 | + }; | ||
| 86 | + | ||
| 87 | + var SPlan = service.getQueryClass(); | ||
| 88 | + self.page = function() { | ||
| 89 | + return service.getPage(); | ||
| 90 | + }; | ||
| 91 | + | ||
| 92 | + self.searchCondition = function() { | ||
| 93 | + return service.getSearchCondition(); | ||
| 94 | + }; | ||
| 95 | + | ||
| 96 | + self.doPage = function() { | ||
| 97 | + var page = SPlan.list(self.searchCondition(), function() { | ||
| 98 | + service.getPage(page); | ||
| 99 | + }); | ||
| 100 | + }; | ||
| 101 | + self.reset = function() { | ||
| 102 | + service.resetStatus(); | ||
| 103 | + var page = SPlan.list(self.searchCondition(), function() { | ||
| 104 | + service.getPage(page); | ||
| 105 | + }); | ||
| 106 | + }; | ||
| 107 | + | ||
| 108 | + // 删除排班(整个删除) | ||
| 109 | + self.deletePlan = function(id) { | ||
| 110 | + SPlan.delete({id: id}, function() { | ||
| 111 | + self.doPage(); | ||
| 112 | + }); | ||
| 113 | + }; | ||
| 114 | + | ||
| 115 | + self.doPage(); | ||
| 116 | + } | ||
| 117 | + ] | ||
| 118 | +); | ||
| 119 | + | ||
| 120 | +// form.html控制器 | ||
| 121 | +angular.module('ScheduleApp').controller( | ||
| 122 | + 'SchedulePlanManageFormCtrl', | ||
| 123 | + [ | ||
| 124 | + 'SchedulePlanManageService', | ||
| 125 | + '$stateParams', | ||
| 126 | + '$state', | ||
| 127 | + '$scope', | ||
| 128 | + function(service, $stateParams, $state, $scope) { | ||
| 129 | + var self = this; | ||
| 130 | + | ||
| 131 | + var SPlan = service.getQueryClass(); | ||
| 132 | + | ||
| 133 | + // 开始日期 日期控件开关 | ||
| 134 | + self.scheduleFromTimeOpen = false; | ||
| 135 | + self.scheduleFromTime_open = function() { | ||
| 136 | + self.scheduleFromTimeOpen = true; | ||
| 137 | + }; | ||
| 138 | + | ||
| 139 | + // 结束日期 日期控件开关 | ||
| 140 | + self.scheduleToTimeOpen = false; | ||
| 141 | + self.scheduleToTime_open = function() { | ||
| 142 | + self.scheduleToTimeOpen = true; | ||
| 143 | + }; | ||
| 144 | + | ||
| 145 | + // 欲保存的busInfo信息,绑定 | ||
| 146 | + self.schedulePlanManageForSave = new SPlan; | ||
| 147 | + self.schedulePlanManageForSave.xl = {}; | ||
| 148 | + | ||
| 149 | + // 提交方法 | ||
| 150 | + self.submit = function() { | ||
| 151 | + console.log(self.schedulePlanManageForSave); | ||
| 152 | + | ||
| 153 | + self.schedulePlanManageForSave.$save(function() { | ||
| 188 | $state.go("schedulePlanManage"); | 154 | $state.go("schedulePlanManage"); |
| 189 | - } else { | ||
| 190 | - alert("保存异常!"); | ||
| 191 | - } | ||
| 192 | - }, | ||
| 193 | - function(result) { | ||
| 194 | - // TODO:弹出框方式以后改 | ||
| 195 | - alert("出错啦!"); | ||
| 196 | - } | ||
| 197 | - ); | ||
| 198 | - }; | ||
| 199 | -}]); | 155 | + }); |
| 156 | + }; | ||
| 157 | + | ||
| 158 | + } | ||
| 159 | + ] | ||
| 160 | +); | ||
| 200 | 161 |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/service.js
| @@ -3,16 +3,32 @@ angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource | @@ -3,16 +3,32 @@ angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource | ||
| 3 | return { | 3 | return { |
| 4 | rest : $resource( | 4 | rest : $resource( |
| 5 | '/spc/:id', | 5 | '/spc/:id', |
| 6 | - {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'}, | 6 | + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id'}, |
| 7 | { | 7 | { |
| 8 | list: { | 8 | list: { |
| 9 | method: 'GET', | 9 | method: 'GET', |
| 10 | params: { | 10 | params: { |
| 11 | page: 0 | 11 | page: 0 |
| 12 | + }, | ||
| 13 | + transformResponse: function(rs) { | ||
| 14 | + var dst = angular.fromJson(rs); | ||
| 15 | + if (dst.status == 'SUCCESS') { | ||
| 16 | + return dst.data; | ||
| 17 | + } else { | ||
| 18 | + return dst; // 业务错误留给控制器处理 | ||
| 19 | + } | ||
| 12 | } | 20 | } |
| 13 | }, | 21 | }, |
| 14 | get: { | 22 | get: { |
| 15 | - method: 'GET' | 23 | + method: 'GET', |
| 24 | + transformResponse: function(rs) { | ||
| 25 | + var dst = angular.fromJson(rs); | ||
| 26 | + if (dst.status == 'SUCCESS') { | ||
| 27 | + return dst.data; | ||
| 28 | + } else { | ||
| 29 | + return dst; | ||
| 30 | + } | ||
| 31 | + } | ||
| 16 | }, | 32 | }, |
| 17 | save: { | 33 | save: { |
| 18 | method: 'POST' | 34 | method: 'POST' |
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/list.html
| @@ -5,10 +5,9 @@ | @@ -5,10 +5,9 @@ | ||
| 5 | <tr role="row" class="heading"> | 5 | <tr role="row" class="heading"> |
| 6 | <th style="width: 5%;">序号</th> | 6 | <th style="width: 5%;">序号</th> |
| 7 | <th style="width: 15%;">线路</th> | 7 | <th style="width: 15%;">线路</th> |
| 8 | - <th style="width: 15%;">修改时间</th> | 8 | + <th style="width: 15%;">修改人/修改时间</th> |
| 9 | <th style="width: 10%;">启用日期</th> | 9 | <th style="width: 10%;">启用日期</th> |
| 10 | <th style="width: 10%;">车辆</th> | 10 | <th style="width: 10%;">车辆</th> |
| 11 | - <th>翻版模式</th> | ||
| 12 | <th>起始路牌</th> | 11 | <th>起始路牌</th> |
| 13 | <th>路牌范围</th> | 12 | <th>路牌范围</th> |
| 14 | <th>起始人员</th> | 13 | <th>起始人员</th> |
| @@ -38,7 +37,6 @@ | @@ -38,7 +37,6 @@ | ||
| 38 | <td></td> | 37 | <td></td> |
| 39 | <td></td> | 38 | <td></td> |
| 40 | <td></td> | 39 | <td></td> |
| 41 | - <td></td> | ||
| 42 | <td> | 40 | <td> |
| 43 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" | 41 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 44 | ng-click="ctrl.doPage()"> | 42 | ng-click="ctrl.doPage()"> |
| @@ -60,6 +58,8 @@ | @@ -60,6 +58,8 @@ | ||
| 60 | <span ng-bind="info.xl.name"></span> | 58 | <span ng-bind="info.xl.name"></span> |
| 61 | </td> | 59 | </td> |
| 62 | <td> | 60 | <td> |
| 61 | + <span ng-bind="info.updateBy.name"></span> | ||
| 62 | + / | ||
| 63 | <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span> | 63 | <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span> |
| 64 | </td> | 64 | </td> |
| 65 | <td> | 65 | <td> |
| @@ -69,9 +69,6 @@ | @@ -69,9 +69,6 @@ | ||
| 69 | <span ng-bind="info.carConfigInfo.cl.insideCode"></span> | 69 | <span ng-bind="info.carConfigInfo.cl.insideCode"></span> |
| 70 | </td> | 70 | </td> |
| 71 | <td> | 71 | <td> |
| 72 | - <span ng-bind="info.fbgs"></span> | ||
| 73 | - </td> | ||
| 74 | - <td> | ||
| 75 | <span ng-bind="info.lpStart"></span> | 72 | <span ng-bind="info.lpStart"></span> |
| 76 | </td> | 73 | </td> |
| 77 | <td> | 74 | <td> |