Commit 3b3e10cd392a23a9ed26a2ddcd96ceabbf4d2043
1 parent
4ce1c757
update
Showing
12 changed files
with
476 additions
and
64 deletions
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
| ... | ... | @@ -2,7 +2,9 @@ package com.bsth.controller.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.controller.BaseController; |
| 5 | +import com.bsth.entity.CarPark; | |
| 5 | 6 | import com.bsth.entity.schedule.TTInfoDetail; |
| 7 | +import com.bsth.service.CarParkService; | |
| 6 | 8 | import com.bsth.service.schedule.TTInfoDetailServiceImpl; |
| 7 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 10 | import org.springframework.web.bind.annotation.PathVariable; |
| ... | ... | @@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; |
| 12 | 14 | import org.springframework.web.multipart.MultipartFile; |
| 13 | 15 | |
| 14 | 16 | import java.util.HashMap; |
| 17 | +import java.util.Iterator; | |
| 15 | 18 | import java.util.Map; |
| 16 | 19 | |
| 17 | 20 | /** |
| ... | ... | @@ -22,16 +25,29 @@ import java.util.Map; |
| 22 | 25 | public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { |
| 23 | 26 | @Autowired |
| 24 | 27 | private TTInfoDetailServiceImpl ttInfoDetailService; |
| 28 | + @Autowired | |
| 29 | + private CarParkService carParkService; | |
| 25 | 30 | |
| 26 | 31 | @RequestMapping(value = "/dataImportExtend", method = RequestMethod.POST) |
| 27 | 32 | public Map<String, Object> uploadDataAndImport( |
| 28 | - MultipartFile file, String xlmc, String ttinfoname, String tccname) throws Exception { | |
| 33 | + MultipartFile file, String xlmc, String ttinfoname, String tcccode) throws Exception { | |
| 29 | 34 | Map<String, Object> resultMap = new HashMap<>(); |
| 30 | 35 | |
| 31 | 36 | try { |
| 32 | - ttInfoDetailService.fileDataImport(file, xlmc, ttinfoname, tccname); | |
| 33 | - resultMap.put("status", ResponseCode.SUCCESS); | |
| 34 | - resultMap.put("msg", "导入成功"); | |
| 37 | + // 查看停车场是否存在,不存在报错 | |
| 38 | + Map<String, Object> param = new HashMap<>(); | |
| 39 | + param.put("parkCode_eq", tcccode); | |
| 40 | + Iterator<CarPark> carParkIterator = carParkService.list(param).iterator(); | |
| 41 | + if (!carParkIterator.hasNext()) { | |
| 42 | + // 没有停车场,报错 | |
| 43 | + resultMap.put("status", ResponseCode.ERROR); | |
| 44 | + resultMap.put("msg", "没有停车场数据,停车场代码=" + tcccode); | |
| 45 | + } else { | |
| 46 | + CarPark carPark = carParkIterator.next(); | |
| 47 | + ttInfoDetailService.fileDataImport(file, xlmc, ttinfoname, carPark.getParkName()); | |
| 48 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 49 | + resultMap.put("msg", "导入成功"); | |
| 50 | + } | |
| 35 | 51 | } catch (Exception exp) { |
| 36 | 52 | exp.printStackTrace(); |
| 37 | 53 | throw exp; | ... | ... |
src/main/resources/static/index.html
| ... | ... | @@ -195,6 +195,14 @@ tr.row-active td { |
| 195 | 195 | <div id="route-container"> |
| 196 | 196 | <div ng-app="ScheduleApp"> |
| 197 | 197 | <div ng-controller="ScheduleAppController"> |
| 198 | + | |
| 199 | + <!-- loading widget --> | |
| 200 | + <div id="loadingWidget" class="flyover mask" loading-widget> | |
| 201 | + <div class="alert alert-info"> | |
| 202 | + <strong>载入中......</strong> | |
| 203 | + </div> | |
| 204 | + </div> | |
| 205 | + | |
| 198 | 206 | <div ui-view class="fade-in-up"> </div> |
| 199 | 207 | </div> |
| 200 | 208 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/main.css
| ... | ... | @@ -55,3 +55,21 @@ form input.ng-valid.ng-dirty.ng-valid-required { |
| 55 | 55 | overflow: hidden; |
| 56 | 56 | text-overflow: ellipsis; |
| 57 | 57 | } |
| 58 | + | |
| 59 | +.flyover .alert { | |
| 60 | + left: 50%; | |
| 61 | + top: 50%; | |
| 62 | + position: fixed; | |
| 63 | + z-index: 1050; | |
| 64 | +} | |
| 65 | + | |
| 66 | +.flyover.mask { | |
| 67 | + top: 0; | |
| 68 | + left: 0; | |
| 69 | + position: fixed; | |
| 70 | + width: 100%; | |
| 71 | + height: 100%; | |
| 72 | + opacity: 0.5; | |
| 73 | + background: black; | |
| 74 | + z-index: 1049; | |
| 75 | +} | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/main.js
| ... | ... | @@ -8,8 +8,86 @@ var ScheduleApp = angular.module('ScheduleApp', [ |
| 8 | 8 | 'ngResource' // resource服务 |
| 9 | 9 | ]); |
| 10 | 10 | |
| 11 | +/** | |
| 12 | + * 用于请求通知。 | |
| 13 | + */ | |
| 14 | +ScheduleApp.factory('requestNotificationChannel', ['$rootScope', function($rootScope) { | |
| 15 | + // 通知消息常量 | |
| 16 | + var _START_REQUEST_ = '_START_REQUEST_'; // 开始请求通知message | |
| 17 | + var _END_REQUEST_ = '_END_REQUEST_'; // 请求结束通知message | |
| 18 | + | |
| 19 | + // 计数器 | |
| 20 | + var activeCalls = 0; | |
| 21 | + | |
| 22 | + // 发布开始请求通知 | |
| 23 | + var requestStarted = function() { | |
| 24 | + activeCalls += 1; | |
| 25 | + console.log("activeCalls=" + activeCalls); | |
| 26 | + $rootScope.$broadcast(_START_REQUEST_); | |
| 27 | + }; | |
| 28 | + // 发布请求结束通知 | |
| 29 | + var requestEnded = function() { | |
| 30 | + activeCalls -= 1; | |
| 31 | + console.log("activeCalls=" + activeCalls); | |
| 32 | + $rootScope.$broadcast(_END_REQUEST_); | |
| 33 | + }; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 订阅开始请求通知。 | |
| 37 | + * @param $scope 作用域 | |
| 38 | + * @param handler 通知处理器函数 | |
| 39 | + */ | |
| 40 | + var onRequestStarted = function($scope, handler) { | |
| 41 | + $scope.$on(_START_REQUEST_, function(event) { | |
| 42 | + handler(); | |
| 43 | + }); | |
| 44 | + }; | |
| 45 | + /** | |
| 46 | + * 订阅请求结束通知。 | |
| 47 | + * @param $scope 作用域 | |
| 48 | + * @param handler 通知处理器函数 | |
| 49 | + */ | |
| 50 | + var onRequestEnded = function($scope, handler) { | |
| 51 | + $scope.$on(_END_REQUEST_, function(event) { | |
| 52 | + handler(); | |
| 53 | + }); | |
| 54 | + }; | |
| 55 | + | |
| 56 | + return { | |
| 57 | + requestStarted : requestStarted, | |
| 58 | + requestEnded : requestEnded, | |
| 59 | + onRequestStarted : onRequestStarted, | |
| 60 | + onRequestEnded : onRequestEnded | |
| 61 | + }; | |
| 62 | + | |
| 63 | +}]); | |
| 64 | + | |
| 65 | +// http 拦截器 | |
| 66 | +ScheduleApp.factory('myInterceptor', ['requestNotificationChannel', function(requestNotificationChannel) { | |
| 67 | + return { | |
| 68 | + request: function(config) { | |
| 69 | + requestNotificationChannel.requestStarted(); | |
| 70 | + return config; | |
| 71 | + }, | |
| 72 | + requestError: function(rejection) { | |
| 73 | + requestNotificationChannel.requestEnded(); | |
| 74 | + return rejection; | |
| 75 | + }, | |
| 76 | + response: function(response) { | |
| 77 | + requestNotificationChannel.requestEnded(); | |
| 78 | + return response; | |
| 79 | + }, | |
| 80 | + responseError: function(rejection) { | |
| 81 | + requestNotificationChannel.requestEnded(); | |
| 82 | + return rejection; | |
| 83 | + } | |
| 84 | + }; | |
| 85 | + | |
| 86 | +}]); | |
| 87 | + | |
| 11 | 88 | ScheduleApp.config(['$httpProvider', function($httpProvider) { |
| 12 | 89 | $httpProvider.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; |
| 90 | + $httpProvider.interceptors.push('myInterceptor'); | |
| 13 | 91 | }]); |
| 14 | 92 | |
| 15 | 93 | /** ocLazyLoader 配置 */ | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
| 1 | 1 | // 自定义指令,指令模版在dt目录下 |
| 2 | 2 | |
| 3 | + | |
| 4 | +angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) { | |
| 5 | + return { | |
| 6 | + restrict: 'A', | |
| 7 | + link: function(scope, element) { | |
| 8 | + // 初始隐藏loading界面 | |
| 9 | + element.hide(); | |
| 10 | + | |
| 11 | + // 开始请求通知处理 | |
| 12 | + requestNotificationChannel.onRequestStarted(scope, function() { | |
| 13 | + element.show(); | |
| 14 | + }); | |
| 15 | + // 请求结束通知处理 | |
| 16 | + requestNotificationChannel.onRequestEnded(scope, function() { | |
| 17 | + element.hide(); | |
| 18 | + }); | |
| 19 | + } | |
| 20 | + }; | |
| 21 | +}]); | |
| 22 | + | |
| 3 | 23 | angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) { |
| 4 | 24 | return { |
| 5 | 25 | restrict: 'E', | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
| ... | ... | @@ -545,7 +545,7 @@ ScheduleApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvi |
| 545 | 545 | } |
| 546 | 546 | }) |
| 547 | 547 | .state("timeTableDetailInfoManage", { |
| 548 | - url: '/timeTableDetailInfoManage/:xlid/:ttid', | |
| 548 | + url: '/timeTableDetailInfoManage/:xlid/:ttid/:xlname/:ttname', | |
| 549 | 549 | views: { |
| 550 | 550 | "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail_info.html'} |
| 551 | 551 | }, | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/detail_info.html
| ... | ... | @@ -18,17 +18,24 @@ |
| 18 | 18 | <i class="fa fa-circle"></i> |
| 19 | 19 | </li> |
| 20 | 20 | <li> |
| 21 | - <span class="active">待测试时刻表明细</span> | |
| 21 | + <span class="active">编辑时刻表明细信息</span> | |
| 22 | 22 | </li> |
| 23 | 23 | </ul> |
| 24 | 24 | |
| 25 | -<div class="row" id="timeTableDetail" > | |
| 25 | +<!--<!– loading widget –>--> | |
| 26 | +<!--<div id="loadingWidget" class="flyover mask" loading-widget>--> | |
| 27 | + <!--<div class="alert alert-info">--> | |
| 28 | + <!--<strong>载入中......</strong>--> | |
| 29 | + <!--</div>--> | |
| 30 | +<!--</div>--> | |
| 31 | + | |
| 32 | +<div class="row" id="timeTableDetail" ng-controller="TimeTableDetailManageCtrl as ctrl"> | |
| 26 | 33 | <div class="col-md-12"> |
| 27 | 34 | <div class="portlet light bordered"> |
| 28 | 35 | <div class="portlet-title"> |
| 29 | 36 | <div class="caption font-dark"> |
| 30 | 37 | <i class="fa fa-database font-dark"></i> |
| 31 | - <span class="caption-subject bold uppercase">待测试时刻表明细</span> | |
| 38 | + <span class="caption-subject bold uppercase" ng-bind="ctrl.title"></span> | |
| 32 | 39 | </div> |
| 33 | 40 | <div class="actions"> |
| 34 | 41 | <a href="javascirpt:" class="btn btn-circle blue"> |
| ... | ... | @@ -86,24 +93,55 @@ |
| 86 | 93 | |
| 87 | 94 | <div class="portlet-body"> |
| 88 | 95 | <!--<div ng-view></div>--> |
| 89 | - <table class="table table-striped table-bordered table-hover table-checkable order-column" ng-controller="TimeTableDetailManageCtrl as ctrl"> | |
| 90 | - <thead> | |
| 91 | - <tr> | |
| 92 | - <th ng-repeat="head in ctrl.detailHeads track by $index"> | |
| 93 | - <span ng-bind="head"></span> | |
| 94 | - </th> | |
| 96 | + <div class="fixDiv"> | |
| 97 | + <table style="width: 2000px" class="table table-striped table-bordered table-hover table-checkable order-column"> | |
| 98 | + <thead> | |
| 99 | + <tr> | |
| 100 | + <th ng-repeat="head in ctrl.detailHeads track by $index"> | |
| 101 | + <span ng-bind="head"></span> | |
| 102 | + </th> | |
| 103 | + | |
| 104 | + </tr> | |
| 105 | + </thead> | |
| 106 | + <tbody> | |
| 107 | + <tr ng-repeat="info in ctrl.detailInfos"> | |
| 108 | + <td ng-repeat="cell in info track by $index"> | |
| 109 | + | |
| 110 | + <!--<span ng-bind="cell.fcsj"></span>--> | |
| 111 | + <span ng-if="!cell.ttdid" ng-bind="cell.fcsj"></span> | |
| 112 | + | |
| 113 | + <div ng-if="cell.ttdid" class="btn-group"> | |
| 114 | + <a href="javascript:" class="btn blue btn-outline btn-circle" data-toggle="dropdown"> | |
| 115 | + <i class="fa fa-share"></i> | |
| 116 | + <span ng-bind="cell.fcsj"></span> | |
| 117 | + <i class="fa fa-angle-down"></i> | |
| 118 | + </a> | |
| 119 | + <ul class="dropdown-menu pull-left"> | |
| 120 | + <li> | |
| 121 | + <a href="javascript:" class="tool-action" ng-click="ctrl.editBcInfo(cell)"> | |
| 122 | + <i class="fa fa-file-excel-o"></i> | |
| 123 | + 修改 | |
| 124 | + </a> | |
| 125 | + </li> | |
| 126 | + <li class="divider"></li> | |
| 127 | + <li> | |
| 128 | + <a href="javascript:" class="tool-action"> | |
| 129 | + <i class="fa fa-refresh"></i> | |
| 130 | + 删除 | |
| 131 | + </a> | |
| 132 | + </li> | |
| 133 | + </ul> | |
| 134 | + </div> | |
| 95 | 135 | |
| 96 | - </tr> | |
| 97 | - </thead> | |
| 98 | - <tbody> | |
| 99 | - <tr ng-repeat="info in ctrl.detailInfos"> | |
| 100 | - <td ng-repeat="cell in info track by $index"> | |
| 101 | - <span ng-bind="cell.fcsj"></span> | |
| 102 | - </td> | |
| 103 | - </tr> | |
| 104 | 136 | |
| 105 | - </tbody> | |
| 106 | - </table> | |
| 137 | + | |
| 138 | + </td> | |
| 139 | + </tr> | |
| 140 | + | |
| 141 | + </tbody> | |
| 142 | + </table> | |
| 143 | + </div> | |
| 144 | + | |
| 107 | 145 | |
| 108 | 146 | </div> |
| 109 | 147 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/detail_info_form.html
0 → 100644
| 1 | +<div class="modal-header"> | |
| 2 | + <h3 class="modal-title">班次详细信息</h3> | |
| 3 | +</div> | |
| 4 | + | |
| 5 | +<div class="modal-body"> | |
| 6 | + | |
| 7 | + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm"> | |
| 8 | + <div class="form-body"> | |
| 9 | + <div class="form-group has-success has-feedback"> | |
| 10 | + <label class="col-md-2 control-label">线路*:</label> | |
| 11 | + <div class="col-md-3"> | |
| 12 | + <input type="text" class="form-control" | |
| 13 | + ng-model="ctrl.TimeTableDetailForSave.xl.name" | |
| 14 | + readonly/> | |
| 15 | + </div> | |
| 16 | + | |
| 17 | + </div> | |
| 18 | + <div class="form-group has-success has-feedback"> | |
| 19 | + <label class="col-md-2 control-label">时刻表名称*:</label> | |
| 20 | + <div class="col-md-3"> | |
| 21 | + <input type="text" class="form-control" | |
| 22 | + ng-model="ctrl.TimeTableDetailForSave.ttinfo.name" | |
| 23 | + readonly/> | |
| 24 | + </div> | |
| 25 | + </div> | |
| 26 | + <div class="form-group has-success has-feedback"> | |
| 27 | + <label class="col-md-2 control-label">路牌*:</label> | |
| 28 | + <div class="col-md-3"> | |
| 29 | + <input type="text" class="form-control" | |
| 30 | + ng-model="ctrl.TimeTableDetailForSave.lp.lpName" | |
| 31 | + readonly/> | |
| 32 | + </div> | |
| 33 | + | |
| 34 | + </div> | |
| 35 | + <div class="form-group has-success has-feedback"> | |
| 36 | + <label class="col-md-2 control-label">发车顺序号*:</label> | |
| 37 | + <div class="col-md-3"> | |
| 38 | + <input type="text" class="form-control" | |
| 39 | + ng-model="ctrl.TimeTableDetailForSave.lp.fcno" | |
| 40 | + readonly/> | |
| 41 | + </div> | |
| 42 | + | |
| 43 | + </div> | |
| 44 | + <div class="form-group has-success has-feedback"> | |
| 45 | + <label class="col-md-2 control-label">方向*:</label> | |
| 46 | + <div class="col-md-3"> | |
| 47 | + <input type="text" class="form-control" | |
| 48 | + ng-model="ctrl.TimeTableDetailForSave.xlDir" | |
| 49 | + readonly/> | |
| 50 | + </div> | |
| 51 | + | |
| 52 | + </div> | |
| 53 | + <div class="form-group has-success has-feedback"> | |
| 54 | + <label class="col-md-2 control-label">起点站*:</label> | |
| 55 | + <div class="col-md-3"> | |
| 56 | + <input type="text" class="form-control" | |
| 57 | + ng-model="ctrl.TimeTableDetailForSave.qdz.stationName" | |
| 58 | + readonly/> | |
| 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 | + <input type="text" class="form-control" | |
| 65 | + ng-model="ctrl.TimeTableDetailForSave.zdz.stationName" | |
| 66 | + readonly/> | |
| 67 | + </div> | |
| 68 | + | |
| 69 | + </div> | |
| 70 | + <div class="form-group has-success has-feedback"> | |
| 71 | + <label class="col-md-2 control-label">发车时间*:</label> | |
| 72 | + <div class="col-md-3"> | |
| 73 | + <input type="text" class="form-control" | |
| 74 | + ng-model="ctrl.TimeTableDetailForSave.fcsj" | |
| 75 | + readonly/> | |
| 76 | + </div> | |
| 77 | + | |
| 78 | + </div> | |
| 79 | + <div class="form-group"> | |
| 80 | + <label class="col-md-2 control-label">对应班次数:</label> | |
| 81 | + <div class="col-md-3"> | |
| 82 | + <input type="text" class="form-control" | |
| 83 | + ng-model="ctrl.TimeTableDetailForSave.bcs" | |
| 84 | + readonly/> | |
| 85 | + </div> | |
| 86 | + | |
| 87 | + </div> | |
| 88 | + <div class="form-group"> | |
| 89 | + <label class="col-md-2 control-label">计划里程:</label> | |
| 90 | + <div class="col-md-3"> | |
| 91 | + <input type="text" class="form-control" | |
| 92 | + ng-model="ctrl.TimeTableDetailForSave.jhlc" | |
| 93 | + readonly/> | |
| 94 | + </div> | |
| 95 | + | |
| 96 | + </div> | |
| 97 | + <div class="form-group"> | |
| 98 | + <label class="col-md-2 control-label">班次历时:</label> | |
| 99 | + <div class="col-md-3"> | |
| 100 | + <input type="text" class="form-control" | |
| 101 | + ng-model="ctrl.TimeTableDetailForSave.bcsj" | |
| 102 | + readonly/> | |
| 103 | + </div> | |
| 104 | + | |
| 105 | + </div> | |
| 106 | + <div class="form-group has-success has-feedback"> | |
| 107 | + <label class="col-md-2 control-label">班次类型:</label> | |
| 108 | + <div class="col-md-3"> | |
| 109 | + <input type="text" class="form-control" | |
| 110 | + ng-model="ctrl.TimeTableDetailForSave.bcType" | |
| 111 | + readonly/> | |
| 112 | + </div> | |
| 113 | + | |
| 114 | + </div> | |
| 115 | + <div class="form-group"> | |
| 116 | + <label class="col-md-2 control-label">备注:</label> | |
| 117 | + <div class="col-md-3"> | |
| 118 | + <textarea class="form-control" | |
| 119 | + ng-model="ctrl.TimeTableDetailForSave.remark" | |
| 120 | + readonly/> | |
| 121 | + </div> | |
| 122 | + | |
| 123 | + </div> | |
| 124 | + | |
| 125 | + </div> | |
| 126 | + | |
| 127 | + <div class="form-actions"> | |
| 128 | + <div class="row"> | |
| 129 | + <div class="col-md-offset-3 col-md-4"> | |
| 130 | + <button type="submit" class="btn green" | |
| 131 | + ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button> | |
| 132 | + <a type="button" class="btn default" ng-click="ctrl.close()" ><i class="fa fa-times"></i> 取消</a> | |
| 133 | + </div> | |
| 134 | + </div> | |
| 135 | + </div> | |
| 136 | + </form> | |
| 137 | + | |
| 138 | +</div> | |
| 139 | + | |
| 140 | +<div class="modal-footer"> | |
| 141 | + <!--<button class="btn btn-primary" ng-click="ctrl.close()">关闭</button>--> | |
| 142 | +</div> | |
| 0 | 143 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/list.html
| ... | ... | @@ -66,7 +66,7 @@ |
| 66 | 66 | <span ng-bind="info.qyrq | date: 'yyyy-MM-dd'"></span> |
| 67 | 67 | </td> |
| 68 | 68 | <td> |
| 69 | - <a ui-sref="timeTableDetailInfoManage({xlid: info.xl.id, ttid : info.id})" | |
| 69 | + <a ui-sref="timeTableDetailInfoManage({xlid: info.xl.id, ttid : info.id, xlname: info.xl.name, ttname : info.name})" | |
| 70 | 70 | class="btn default blue-stripe btn-sm"> 编辑 </a> |
| 71 | 71 | <a ng-click="ctrl.importData($index)" class="btn default blue-stripe btn-sm"> 导入 </a> |
| 72 | 72 | <a href="javascript:" class="btn default blue-stripe btn-sm"> 导出 </a> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/timeTableDetailManage.js
| ... | ... | @@ -31,10 +31,14 @@ angular.module('ScheduleApp').factory('TimeTableDetailManageService', ['TimeTabl |
| 31 | 31 | |
| 32 | 32 | }]); |
| 33 | 33 | |
| 34 | -angular.module('ScheduleApp').controller('TimeTableDetailManageCtrl', ['TimeTableDetailManageService', '$stateParams', function(timeTableDetailManageService, $stateParams) { | |
| 34 | +angular.module('ScheduleApp').controller('TimeTableDetailManageCtrl', ['TimeTableDetailManageService', '$stateParams', '$uibModal', function(timeTableDetailManageService, $stateParams, $uibModal) { | |
| 35 | 35 | var self = this; |
| 36 | - var xlid = $stateParams.xlid; // 湖区传过来的线路id | |
| 36 | + var xlid = $stateParams.xlid; // 获取传过来的线路id | |
| 37 | 37 | var ttid = $stateParams.ttid; // 获取传过来的时刻表id |
| 38 | + var xlname = $stateParams.xlname; // 获取传过来的线路名字 | |
| 39 | + var ttname = $stateParams.ttname; // 获取传过来的时刻表名字 | |
| 40 | + | |
| 41 | + this.title = xlname + "(" + ttname + ")" + "时刻表明细信息"; | |
| 38 | 42 | |
| 39 | 43 | // 载入待编辑的时刻表明细数据 |
| 40 | 44 | timeTableDetailManageService.getEditInfo(xlid, ttid).then( |
| ... | ... | @@ -48,47 +52,52 @@ angular.module('ScheduleApp').controller('TimeTableDetailManageCtrl', ['TimeTabl |
| 48 | 52 | } |
| 49 | 53 | ); |
| 50 | 54 | |
| 55 | + // 修改班次信息 | |
| 56 | + self.editBcInfo = function(bcinfo) { | |
| 57 | + // 班次信息id | |
| 58 | + var ttdid = bcinfo["ttdid"]; | |
| 59 | + | |
| 60 | + console.log("ttdid=" + ttdid); | |
| 61 | + | |
| 62 | + // large方式弹出模态对话框 | |
| 63 | + var modalInstance = $uibModal.open({ | |
| 64 | + templateUrl: '/pages/scheduleApp/module/core/timeTableManage/detail_info_form.html', | |
| 65 | + size: "lg", | |
| 66 | + animation: true, | |
| 67 | + backdrop: 'static', | |
| 68 | + resolve: { | |
| 69 | + // 传递给controller | |
| 70 | + r_ttdid: function() {return ttdid} | |
| 71 | + }, | |
| 72 | + windowClass: 'center-modal', | |
| 73 | + controller: 'TimeTableDetailManageFormCtrl', | |
| 74 | + controllerAs: 'ctrl', | |
| 75 | + bindToController: true | |
| 76 | + }); | |
| 77 | + | |
| 78 | + modalInstance.result.then( | |
| 79 | + function() { | |
| 80 | + console.log("detail_info_form.html打开"); | |
| 81 | + }, | |
| 82 | + function() { | |
| 83 | + console.log("detail_info_form.html消失") | |
| 84 | + } | |
| 85 | + ); | |
| 51 | 86 | |
| 52 | - | |
| 53 | - | |
| 54 | - | |
| 55 | - | |
| 56 | - | |
| 57 | - | |
| 58 | - | |
| 59 | - | |
| 60 | - | |
| 61 | - | |
| 62 | - | |
| 63 | - | |
| 64 | - | |
| 65 | - | |
| 66 | - | |
| 67 | - | |
| 68 | - | |
| 69 | - | |
| 70 | - | |
| 71 | - | |
| 72 | - | |
| 73 | - | |
| 74 | - | |
| 75 | - | |
| 76 | - | |
| 77 | - | |
| 78 | - | |
| 87 | + }; | |
| 79 | 88 | |
| 80 | 89 | |
| 81 | 90 | |
| 82 | 91 | }]); |
| 83 | 92 | |
| 84 | -angular.module('ScheduleApp').controller('TimeTableDetailManageFormCtrl', ['TimeTableDetailManageService', '$stateParams', '$state', function(timeTableDetailManageService, $stateParams, $state) { | |
| 93 | +angular.module('ScheduleApp').controller('TimeTableDetailManageFormCtrl', ['TimeTableDetailManageService', '$modalInstance', 'r_ttdid', function(timeTableDetailManageService, $modalInstance, r_ttdid) { | |
| 85 | 94 | var self = this; |
| 86 | 95 | |
| 87 | 96 | // 欲保存的busInfo信息,绑定 |
| 88 | 97 | self.TimeTableDetailForSave = {}; |
| 89 | 98 | |
| 90 | 99 | // 获取传过来的id,有的话就是修改,获取一遍数据 |
| 91 | - var id = $stateParams.id; | |
| 100 | + var id = r_ttdid; | |
| 92 | 101 | if (id) { |
| 93 | 102 | self.TimeTableDetailForSave.id = id; |
| 94 | 103 | timeTableDetailManageService.getDetail(id).then( |
| ... | ... | @@ -115,7 +124,7 @@ angular.module('ScheduleApp').controller('TimeTableDetailManageFormCtrl', ['Time |
| 115 | 124 | // TODO:弹出框方式以后改 |
| 116 | 125 | if (result.status == 'SUCCESS') { |
| 117 | 126 | alert("保存成功!"); |
| 118 | - //$state.go("busInfoManage"); | |
| 127 | + $modalInstance.dismiss("cancel"); | |
| 119 | 128 | } else { |
| 120 | 129 | alert("保存异常!"); |
| 121 | 130 | } |
| ... | ... | @@ -127,4 +136,9 @@ angular.module('ScheduleApp').controller('TimeTableDetailManageFormCtrl', ['Time |
| 127 | 136 | ); |
| 128 | 137 | }; |
| 129 | 138 | |
| 139 | + // 关闭窗口 | |
| 140 | + self.close = function() { | |
| 141 | + $modalInstance.dismiss("cancel"); | |
| 142 | + }; | |
| 143 | + | |
| 130 | 144 | }]); |
| 131 | 145 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/timeTableManage.js
| ... | ... | @@ -188,8 +188,8 @@ angular.module('ScheduleApp').controller('TimeTableManageListCtrl', ['TimeTableM |
| 188 | 188 | var xlmc = self.pageInfo.infos[$index]["xl"]["name"]; |
| 189 | 189 | // 时刻表名称 |
| 190 | 190 | var ttinfoname = self.pageInfo.infos[$index]["name"]; |
| 191 | - // 停车场名称(TODO:暂时写死) | |
| 192 | - var tccname = "东川路地铁站停车场"; | |
| 191 | + // 停车场代码 | |
| 192 | + var tcccode = self.pageInfo.infos[$index]["xl"]["carParkCode"]; | |
| 193 | 193 | |
| 194 | 194 | // large方式弹出模态对话框 |
| 195 | 195 | var modalInstance = $uibModal.open({ |
| ... | ... | @@ -201,7 +201,7 @@ angular.module('ScheduleApp').controller('TimeTableManageListCtrl', ['TimeTableM |
| 201 | 201 | // 可以传值给controller |
| 202 | 202 | r_xlmc : function() {return xlmc}, |
| 203 | 203 | r_ttinfoname : function() {return ttinfoname;}, |
| 204 | - r_tccname : function() {return tccname;} | |
| 204 | + r_tcccode : function() {return tcccode;} | |
| 205 | 205 | }, |
| 206 | 206 | windowClass: 'center-modal', |
| 207 | 207 | controller: "TimeTableDetailManageToolsCtrl", |
| ... | ... | @@ -220,12 +220,12 @@ angular.module('ScheduleApp').controller('TimeTableManageListCtrl', ['TimeTableM |
| 220 | 220 | |
| 221 | 221 | }]); |
| 222 | 222 | |
| 223 | -angular.module('ScheduleApp').controller('TimeTableDetailManageToolsCtrl', ['$modalInstance', 'FileUploader', 'r_xlmc', 'r_ttinfoname', 'r_tccname', function($modalInstance, FileUploader, r_xlmc, r_ttinfoname, r_tccname) { | |
| 223 | +angular.module('ScheduleApp').controller('TimeTableDetailManageToolsCtrl', ['$modalInstance', 'FileUploader', 'r_xlmc', 'r_ttinfoname', 'r_tcccode', function($modalInstance, FileUploader, r_xlmc, r_ttinfoname, r_tcccode) { | |
| 224 | 224 | var self = this; |
| 225 | 225 | |
| 226 | 226 | self.xlmc = r_xlmc; |
| 227 | 227 | self.ttinfoname = r_ttinfoname; |
| 228 | - self.tccname = r_tccname; | |
| 228 | + self.tcccode = r_tcccode; | |
| 229 | 229 | |
| 230 | 230 | // 关闭窗口 |
| 231 | 231 | self.close = function() { |
| ... | ... | @@ -240,7 +240,7 @@ angular.module('ScheduleApp').controller('TimeTableDetailManageToolsCtrl', ['$mo |
| 240 | 240 | self.uploader = new FileUploader({ |
| 241 | 241 | url: "/tidc/dataImportExtend", |
| 242 | 242 | filters: [], // 用于过滤文件,比如只允许导入excel, |
| 243 | - formData: [{xlmc: self.xlmc, ttinfoname: self.ttinfoname, tccname: self.tccname}] | |
| 243 | + formData: [{xlmc: self.xlmc, ttinfoname: self.ttinfoname, tcccode: self.tcccode}] | |
| 244 | 244 | }); |
| 245 | 245 | self.uploader.onAfterAddingFile = function(fileItem) |
| 246 | 246 | { | ... | ... |
src/main/resources/static/pages/scheduleApp/module/main.js
| ... | ... | @@ -8,8 +8,86 @@ var ScheduleApp = angular.module('ScheduleApp', [ |
| 8 | 8 | 'ngResource' // resource服务 |
| 9 | 9 | ]); |
| 10 | 10 | |
| 11 | -ScheduleApp.config(['$httpProvider', function($httpProvider) { | |
| 11 | +/** | |
| 12 | + * 用于请求通知。 | |
| 13 | + */ | |
| 14 | +ScheduleApp.factory('requestNotificationChannel', ['$rootScope', function($rootScope) { | |
| 15 | + // 通知消息常量 | |
| 16 | + var _START_REQUEST_ = '_START_REQUEST_'; // 开始请求通知message | |
| 17 | + var _END_REQUEST_ = '_END_REQUEST_'; // 请求结束通知message | |
| 18 | + | |
| 19 | + // 计数器 | |
| 20 | + var activeCalls = 0; | |
| 21 | + | |
| 22 | + // 发布开始请求通知 | |
| 23 | + var requestStarted = function() { | |
| 24 | + activeCalls += 1; | |
| 25 | + console.log("activeCalls=" + activeCalls); | |
| 26 | + $rootScope.$broadcast(_START_REQUEST_); | |
| 27 | + }; | |
| 28 | + // 发布请求结束通知 | |
| 29 | + var requestEnded = function() { | |
| 30 | + activeCalls -= 1; | |
| 31 | + console.log("activeCalls=" + activeCalls); | |
| 32 | + $rootScope.$broadcast(_END_REQUEST_); | |
| 33 | + }; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 订阅开始请求通知。 | |
| 37 | + * @param $scope 作用域 | |
| 38 | + * @param handler 通知处理器函数 | |
| 39 | + */ | |
| 40 | + var onRequestStarted = function($scope, handler) { | |
| 41 | + $scope.$on(_START_REQUEST_, function(event) { | |
| 42 | + handler(); | |
| 43 | + }); | |
| 44 | + }; | |
| 45 | + /** | |
| 46 | + * 订阅请求结束通知。 | |
| 47 | + * @param $scope 作用域 | |
| 48 | + * @param handler 通知处理器函数 | |
| 49 | + */ | |
| 50 | + var onRequestEnded = function($scope, handler) { | |
| 51 | + $scope.$on(_END_REQUEST_, function(event) { | |
| 52 | + handler(); | |
| 53 | + }); | |
| 54 | + }; | |
| 55 | + | |
| 56 | + return { | |
| 57 | + requestStarted : requestStarted, | |
| 58 | + requestEnded : requestEnded, | |
| 59 | + onRequestStarted : onRequestStarted, | |
| 60 | + onRequestEnded : onRequestEnded | |
| 61 | + }; | |
| 62 | + | |
| 63 | +}]); | |
| 64 | + | |
| 65 | +// http 拦截器 | |
| 66 | +ScheduleApp.factory('myInterceptor', ['requestNotificationChannel', function(requestNotificationChannel) { | |
| 67 | + return { | |
| 68 | + request: function(config) { | |
| 69 | + requestNotificationChannel.requestStarted(); | |
| 70 | + return config; | |
| 71 | + }, | |
| 72 | + requestError: function(rejection) { | |
| 73 | + requestNotificationChannel.requestEnded(); | |
| 74 | + return rejection; | |
| 75 | + }, | |
| 76 | + response: function(response) { | |
| 77 | + requestNotificationChannel.requestEnded(); | |
| 78 | + return response; | |
| 79 | + }, | |
| 80 | + responseError: function(rejection) { | |
| 81 | + requestNotificationChannel.requestEnded(); | |
| 82 | + return rejection; | |
| 83 | + } | |
| 84 | + }; | |
| 85 | + | |
| 86 | +}]); | |
| 87 | + | |
| 88 | +ScheduleApp.config(['$httpProvider', 'myInterceptor', function($httpProvider, myInterceptor) { | |
| 12 | 89 | $httpProvider.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; |
| 90 | + $httpProvider.interceptors.push(myInterceptor); | |
| 13 | 91 | }]); |
| 14 | 92 | |
| 15 | 93 | /** ocLazyLoader 配置 */ | ... | ... |