Commit 6a3b9d785fc1c7776d008e154c9218f646cf57b1
1 parent
4756d5b0
update
Showing
7 changed files
with
136 additions
and
142 deletions
src/main/java/com/bsth/controller/CarsController.java
| 1 | package com.bsth.controller; | 1 | package com.bsth.controller; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.Cars; | 3 | import com.bsth.entity.Cars; |
| 4 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 5 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 6 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 7 | -import org.springframework.web.bind.annotation.RestController; | 4 | +import com.bsth.service.CarsService; |
| 5 | +import org.springframework.web.bind.annotation.*; | ||
| 8 | 6 | ||
| 9 | import java.util.Map; | 7 | import java.util.Map; |
| 10 | 8 | ||
| @@ -29,4 +27,14 @@ public class CarsController extends BaseController<Cars, Integer> { | @@ -29,4 +27,14 @@ public class CarsController extends BaseController<Cars, Integer> { | ||
| 29 | public Map<String, Object> save(@RequestBody Cars t){ | 27 | public Map<String, Object> save(@RequestBody Cars t){ |
| 30 | return baseService.save(t); | 28 | return baseService.save(t); |
| 31 | } | 29 | } |
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 验证。 | ||
| 33 | + * @param map | ||
| 34 | + * @return | ||
| 35 | + */ | ||
| 36 | + @RequestMapping(value = "/validate/equale", method = RequestMethod.GET) | ||
| 37 | + public Map<String, Object> validateData(@RequestParam Map<String, Object> map) { | ||
| 38 | + return ((CarsService) baseService).validateEquale(map); | ||
| 39 | + } | ||
| 32 | } | 40 | } |
src/main/java/com/bsth/service/CarsService.java
| @@ -2,8 +2,16 @@ package com.bsth.service; | @@ -2,8 +2,16 @@ package com.bsth.service; | ||
| 2 | 2 | ||
| 3 | import com.bsth.entity.Cars; | 3 | import com.bsth.entity.Cars; |
| 4 | 4 | ||
| 5 | +import java.util.Map; | ||
| 6 | + | ||
| 5 | /** | 7 | /** |
| 6 | * Created by xu on 16/5/31. | 8 | * Created by xu on 16/5/31. |
| 7 | */ | 9 | */ |
| 8 | public interface CarsService extends BaseService<Cars, Integer> { | 10 | public interface CarsService extends BaseService<Cars, Integer> { |
| 11 | + /** | ||
| 12 | + * 后端验证查询数据是否重复。 | ||
| 13 | + * @param params 查询条件 | ||
| 14 | + * @return {status:状态编码,msg:错误描述},状态编码 @see com.bsth.common.ResponseCode | ||
| 15 | + */ | ||
| 16 | + Map<String, Object> validateEquale(Map<String, Object> params); | ||
| 9 | } | 17 | } |
src/main/java/com/bsth/service/impl/CarsServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 3 | import com.bsth.entity.Cars; | 4 | import com.bsth.entity.Cars; |
| 4 | import com.bsth.service.CarsService; | 5 | import com.bsth.service.CarsService; |
| 5 | import org.springframework.stereotype.Service; | 6 | import org.springframework.stereotype.Service; |
| 6 | 7 | ||
| 8 | +import java.util.HashMap; | ||
| 9 | +import java.util.Map; | ||
| 10 | + | ||
| 7 | /** | 11 | /** |
| 8 | * Created by xu on 16/5/31. | 12 | * Created by xu on 16/5/31. |
| 9 | */ | 13 | */ |
| 10 | @Service | 14 | @Service |
| 11 | public class CarsServiceImpl extends BaseServiceImpl<Cars, Integer> implements CarsService { | 15 | public class CarsServiceImpl extends BaseServiceImpl<Cars, Integer> implements CarsService { |
| 16 | + @Override | ||
| 17 | + public Map<String, Object> validateEquale(Map<String, Object> params) { | ||
| 18 | + Map<String, Object> returnMap = new HashMap<>(); | ||
| 19 | + | ||
| 20 | + try { | ||
| 21 | + if (params == null || params.size() == 0) { | ||
| 22 | + returnMap.put("status", ResponseCode.SUCCESS); | ||
| 23 | + returnMap.put("msg", "此时没有重复"); | ||
| 24 | + } else { | ||
| 25 | + Iterable<Cars> iterable = this.list(params); | ||
| 26 | + if (iterable.iterator().hasNext()) { | ||
| 27 | + returnMap.put("status", ResponseCode.ERROR); | ||
| 28 | + returnMap.put("msg", "自编号重复"); | ||
| 29 | + } else { | ||
| 30 | + returnMap.put("status", ResponseCode.SUCCESS); | ||
| 31 | + returnMap.put("msg", "此时没有重复"); | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + } catch (Exception exp) { | ||
| 35 | + logger.error("validateZbh error", exp); | ||
| 36 | + returnMap.put("status", ResponseCode.ERROR); | ||
| 37 | + returnMap.put("msg", exp.getLocalizedMessage()); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + return returnMap; | ||
| 41 | + } | ||
| 12 | } | 42 | } |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js
| @@ -100,6 +100,7 @@ angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageSer | @@ -100,6 +100,7 @@ angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageSer | ||
| 100 | for (key in currentSearchCondition) { | 100 | for (key in currentSearchCondition) { |
| 101 | currentSearchCondition[key] = ""; | 101 | currentSearchCondition[key] = ""; |
| 102 | } | 102 | } |
| 103 | + currentPageNo = 1; | ||
| 103 | }, | 104 | }, |
| 104 | /** | 105 | /** |
| 105 | * 设置当前页码。 | 106 | * 设置当前页码。 |
| @@ -116,7 +117,7 @@ angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageSer | @@ -116,7 +117,7 @@ angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageSer | ||
| 116 | getPage: function() { | 117 | getPage: function() { |
| 117 | var params = currentSearchCondition; // 查询条件 | 118 | var params = currentSearchCondition; // 查询条件 |
| 118 | params.page = currentPageNo - 1; // 服务端页码从0开始 | 119 | params.page = currentPageNo - 1; // 服务端页码从0开始 |
| 119 | - return service.list(params).$promise; | 120 | + return service.rest.list(params).$promise; |
| 120 | }, | 121 | }, |
| 121 | /** | 122 | /** |
| 122 | * 获取明细信息。 | 123 | * 获取明细信息。 |
| @@ -125,7 +126,7 @@ angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageSer | @@ -125,7 +126,7 @@ angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageSer | ||
| 125 | */ | 126 | */ |
| 126 | getDetail: function(id) { | 127 | getDetail: function(id) { |
| 127 | var params = {id: id}; | 128 | var params = {id: id}; |
| 128 | - return service.get(params).$promise; | 129 | + return service.rest.get(params).$promise; |
| 129 | }, | 130 | }, |
| 130 | /** | 131 | /** |
| 131 | * 保存信息。 | 132 | * 保存信息。 |
| @@ -133,7 +134,7 @@ angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageSer | @@ -133,7 +134,7 @@ angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageSer | ||
| 133 | * @return 返回一个 promise | 134 | * @return 返回一个 promise |
| 134 | */ | 135 | */ |
| 135 | saveDetail: function(obj) { | 136 | saveDetail: function(obj) { |
| 136 | - return service.save(obj).$promise; | 137 | + return service.rest.save(obj).$promise; |
| 137 | } | 138 | } |
| 138 | }; | 139 | }; |
| 139 | }]); | 140 | }]); |
| @@ -196,7 +197,9 @@ angular.module('ScheduleApp').controller('BusInfoManageListCtrl', ['BusInfoManag | @@ -196,7 +197,9 @@ angular.module('ScheduleApp').controller('BusInfoManageListCtrl', ['BusInfoManag | ||
| 196 | }; | 197 | }; |
| 197 | // 重置查询条件 | 198 | // 重置查询条件 |
| 198 | self.resetSearchCondition = function() { | 199 | self.resetSearchCondition = function() { |
| 199 | - return busInfoManageService.resetSearchCondition(); | 200 | + busInfoManageService.resetSearchCondition(); |
| 201 | + self.pageInfo.currentPage = 1; | ||
| 202 | + self.pageChanaged(); | ||
| 200 | }; | 203 | }; |
| 201 | }]); | 204 | }]); |
| 202 | 205 |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
| @@ -45,7 +45,8 @@ | @@ -45,7 +45,8 @@ | ||
| 45 | <div class="col-md-3"> | 45 | <div class="col-md-3"> |
| 46 | <input type="text" class="form-control" | 46 | <input type="text" class="form-control" |
| 47 | name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" | 47 | name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" |
| 48 | - required ng-maxlength="8" placeholder="请输入车辆内部编码"/> | 48 | + required ng-maxlength="8" remote-Validaton rvtype="insideCode" |
| 49 | + placeholder="请输入车辆内部编码"/> | ||
| 49 | </div> | 50 | </div> |
| 50 | <!-- 隐藏块,显示验证信息 --> | 51 | <!-- 隐藏块,显示验证信息 --> |
| 51 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.required"> | 52 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.required"> |
| @@ -54,6 +55,9 @@ | @@ -54,6 +55,9 @@ | ||
| 54 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength"> | 55 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength"> |
| 55 | 内部编号长度不能超过8位 | 56 | 内部编号长度不能超过8位 |
| 56 | </div> | 57 | </div> |
| 58 | + <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.remote"> | ||
| 59 | + 内部编号不能重复 | ||
| 60 | + </div> | ||
| 57 | </div> | 61 | </div> |
| 58 | 62 | ||
| 59 | <div class="form-group has-success has-feedback"> | 63 | <div class="form-group has-success has-feedback"> |
| @@ -348,63 +352,24 @@ | @@ -348,63 +352,24 @@ | ||
| 348 | <div class="form-group"> | 352 | <div class="form-group"> |
| 349 | <label class="col-md-2 control-label">车辆类型:</label> | 353 | <label class="col-md-2 control-label">车辆类型:</label> |
| 350 | <div class="col-md-3"> | 354 | <div class="col-md-3"> |
| 351 | - <div class="input-group"> | ||
| 352 | - <ui-select ng-model="ctrl.busInfoForSave.carType_selected" | ||
| 353 | - on-select="ctrl.carType_selected_change($item, $model)" | ||
| 354 | - theme="bootstrap" name="carType"> | ||
| 355 | - <ui-select-match placeholder="请选择车辆类型...">{{$select.selected.type}}</ui-select-match> | ||
| 356 | - <ui-select-choices repeat="item in ctrl.carTypes"> | ||
| 357 | - <span ng-bind="item.type"></span> | ||
| 358 | - </ui-select-choices> | ||
| 359 | - </ui-select> | ||
| 360 | - <span class="input-group-btn"> | ||
| 361 | - <button type="button" ng-click="ctrl.carType_selected_remove()" class="btn btn-default"> | ||
| 362 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 363 | - </button> | ||
| 364 | - </span> | ||
| 365 | - </div> | 355 | + <input type="text" class="form-control" |
| 356 | + name="carType" ng-model="ctrl.busInfoForSave.carType" readonly/> | ||
| 366 | </div> | 357 | </div> |
| 367 | </div> | 358 | </div> |
| 368 | 359 | ||
| 369 | <div class="form-group"> | 360 | <div class="form-group"> |
| 370 | <label class="col-md-2 control-label">是否机动车:</label> | 361 | <label class="col-md-2 control-label">是否机动车:</label> |
| 371 | <div class="col-md-3"> | 362 | <div class="col-md-3"> |
| 372 | - <div class="input-group"> | ||
| 373 | - <ui-select ng-model="ctrl.busInfoForSave.vehicleStats_selected" | ||
| 374 | - on-select="ctrl.vehicleStats_selected_change($item, $model)" | ||
| 375 | - theme="bootstrap" name="vehicleStats"> | ||
| 376 | - <ui-select-match placeholder="请选择机动车类型...">{{$select.selected.type}}</ui-select-match> | ||
| 377 | - <ui-select-choices repeat="item in ctrl.vehicleStates"> | ||
| 378 | - <span ng-bind="item.type"></span> | ||
| 379 | - </ui-select-choices> | ||
| 380 | - </ui-select> | ||
| 381 | - <span class="input-group-btn"> | ||
| 382 | - <button type="button" ng-click="ctrl.vehicleStats_selected_remove()" class="btn btn-default"> | ||
| 383 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 384 | - </button> | ||
| 385 | - </span> | ||
| 386 | - </div> | 363 | + <input type="text" class="form-control" |
| 364 | + name="vehicleStats" ng-model="ctrl.busInfoForSave.vehicleStats" readonly/> | ||
| 387 | </div> | 365 | </div> |
| 388 | </div> | 366 | </div> |
| 389 | 367 | ||
| 390 | <div class="form-group"> | 368 | <div class="form-group"> |
| 391 | <label class="col-md-2 control-label">营运状态:</label> | 369 | <label class="col-md-2 control-label">营运状态:</label> |
| 392 | <div class="col-md-3"> | 370 | <div class="col-md-3"> |
| 393 | - <div class="input-group"> | ||
| 394 | - <ui-select ng-model="ctrl.busInfoForSave.operatorsState_selected" | ||
| 395 | - on-select="ctrl.operatorsState_selected_change($item, $model)" | ||
| 396 | - theme="bootstrap" name="operatorsState"> | ||
| 397 | - <ui-select-match placeholder="请选择营运状态...">{{$select.selected.type}}</ui-select-match> | ||
| 398 | - <ui-select-choices repeat="item in ctrl.operatorsStates"> | ||
| 399 | - <span ng-bind="item.type"></span> | ||
| 400 | - </ui-select-choices> | ||
| 401 | - </ui-select> | ||
| 402 | - <span class="input-group-btn"> | ||
| 403 | - <button type="button" ng-click="ctrl.operatorsState_selected_remove()" class="btn btn-default"> | ||
| 404 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 405 | - </button> | ||
| 406 | - </span> | ||
| 407 | - </div> | 371 | + <input type="text" class="form-control" |
| 372 | + name="operatorsState" ng-model="ctrl.busInfoForSave.operatorsState" readonly/> | ||
| 408 | </div> | 373 | </div> |
| 409 | </div> | 374 | </div> |
| 410 | 375 |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
| @@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
| 45 | <div class="col-md-3"> | 45 | <div class="col-md-3"> |
| 46 | <input type="text" class="form-control" | 46 | <input type="text" class="form-control" |
| 47 | name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" | 47 | name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" |
| 48 | - required ng-maxlength="8" remote-Validaton rvtype="zbh" | 48 | + required ng-maxlength="8" remote-Validaton rvtype="insideCode" |
| 49 | placeholder="请输入车辆内部编码"/> | 49 | placeholder="请输入车辆内部编码"/> |
| 50 | </div> | 50 | </div> |
| 51 | <!-- 隐藏块,显示验证信息 --> | 51 | <!-- 隐藏块,显示验证信息 --> |
| @@ -324,133 +324,59 @@ | @@ -324,133 +324,59 @@ | ||
| 324 | <div class="form-group"> | 324 | <div class="form-group"> |
| 325 | <label class="col-md-2 control-label">是否空调车:</label> | 325 | <label class="col-md-2 control-label">是否空调车:</label> |
| 326 | <div class="col-md-3"> | 326 | <div class="col-md-3"> |
| 327 | - <label class="radio-inline"> | ||
| 328 | - <input type="radio" name="hvacCar" | ||
| 329 | - ng-value="true" ng-model="ctrl.busInfoForSave.hvacCar"/>是 | ||
| 330 | - </label> | ||
| 331 | - <label class="radio-inline"> | ||
| 332 | - <input type="radio" name="hvacCar" | ||
| 333 | - ng-value="false" ng-model="ctrl.busInfoForSave.hvacCar"/>否 | ||
| 334 | - </label> | 327 | + <truefalse-Dic model="ctrl.busInfoForSave.hvacCar" disabled="true" dicgroup="truefalseType" name="hvacCar"></truefalse-Dic> |
| 335 | </div> | 328 | </div> |
| 336 | </div> | 329 | </div> |
| 337 | 330 | ||
| 338 | <div class="form-group"> | 331 | <div class="form-group"> |
| 339 | <label class="col-md-2 control-label">有无人售票:</label> | 332 | <label class="col-md-2 control-label">有无人售票:</label> |
| 340 | <div class="col-md-3"> | 333 | <div class="col-md-3"> |
| 341 | - <label class="radio-inline"> | ||
| 342 | - <input type="radio" name="ticketType" | ||
| 343 | - ng-value="true" ng-model="ctrl.busInfoForSave.ticketType"/>是 | ||
| 344 | - </label> | ||
| 345 | - <label class="radio-inline"> | ||
| 346 | - <input type="radio" name="ticketType" | ||
| 347 | - ng-value="false" ng-model="ctrl.busInfoForSave.ticketType"/>否 | ||
| 348 | - </label> | 334 | + <truefalse-Dic model="ctrl.busInfoForSave.ticketType" disabled="true" dicgroup="truefalseType" name="ticketType"></truefalse-Dic> |
| 349 | </div> | 335 | </div> |
| 350 | </div> | 336 | </div> |
| 351 | 337 | ||
| 352 | <div class="form-group"> | 338 | <div class="form-group"> |
| 353 | <label class="col-md-2 control-label">是否有LED服务屏:</label> | 339 | <label class="col-md-2 control-label">是否有LED服务屏:</label> |
| 354 | <div class="col-md-3"> | 340 | <div class="col-md-3"> |
| 355 | - <label class="radio-inline"> | ||
| 356 | - <input type="radio" name="ledScreen" | ||
| 357 | - ng-value="true" ng-model="ctrl.busInfoForSave.ledScreen"/>是 | ||
| 358 | - </label> | ||
| 359 | - <label class="radio-inline"> | ||
| 360 | - <input type="radio" name="ledScreen" | ||
| 361 | - ng-value="false" ng-model="ctrl.busInfoForSave.ledScreen"/>否 | ||
| 362 | - </label> | 341 | + <truefalse-Dic model="ctrl.busInfoForSave.ledScreen" disabled="true" dicgroup="truefalseType" name="ledScreen"></truefalse-Dic> |
| 363 | </div> | 342 | </div> |
| 364 | </div> | 343 | </div> |
| 365 | 344 | ||
| 366 | <div class="form-group"> | 345 | <div class="form-group"> |
| 367 | <label class="col-md-2 control-label">是否有TV视屏:</label> | 346 | <label class="col-md-2 control-label">是否有TV视屏:</label> |
| 368 | <div class="col-md-3"> | 347 | <div class="col-md-3"> |
| 369 | - <label class="radio-inline"> | ||
| 370 | - <input type="radio" name="tvVideoType" | ||
| 371 | - ng-value="true" ng-model="ctrl.busInfoForSave.tvVideoType"/>是 | ||
| 372 | - </label> | ||
| 373 | - <label class="radio-inline"> | ||
| 374 | - <input type="radio" name="tvVideoType" | ||
| 375 | - ng-value="false" ng-model="ctrl.busInfoForSave.tvVideoType"/>否 | ||
| 376 | - </label> | 348 | + <truefalse-Dic model="ctrl.busInfoForSave.tvVideoType" disabled="true" dicgroup="truefalseType" name="tvVideoType"></truefalse-Dic> |
| 377 | </div> | 349 | </div> |
| 378 | </div> | 350 | </div> |
| 379 | 351 | ||
| 380 | <div class="form-group"> | 352 | <div class="form-group"> |
| 381 | <label class="col-md-2 control-label">车辆类型:</label> | 353 | <label class="col-md-2 control-label">车辆类型:</label> |
| 382 | <div class="col-md-3"> | 354 | <div class="col-md-3"> |
| 383 | - <div class="input-group"> | ||
| 384 | - <ui-select ng-model="ctrl.busInfoForSave.carType_selected" | ||
| 385 | - on-select="ctrl.carType_selected_change($item, $model)" | ||
| 386 | - theme="bootstrap" name="carType"> | ||
| 387 | - <ui-select-match placeholder="请选择车辆类型...">{{$select.selected.type}}</ui-select-match> | ||
| 388 | - <ui-select-choices repeat="item in ctrl.carTypes"> | ||
| 389 | - <span ng-bind="item.type"></span> | ||
| 390 | - </ui-select-choices> | ||
| 391 | - </ui-select> | ||
| 392 | - <span class="input-group-btn"> | ||
| 393 | - <button type="button" ng-click="ctrl.carType_selected_remove()" class="btn btn-default"> | ||
| 394 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 395 | - </button> | ||
| 396 | - </span> | ||
| 397 | - </div> | 355 | + <input type="text" class="form-control" |
| 356 | + name="carType" ng-model="ctrl.busInfoForSave.carType" readonly/> | ||
| 398 | </div> | 357 | </div> |
| 399 | </div> | 358 | </div> |
| 400 | 359 | ||
| 401 | <div class="form-group"> | 360 | <div class="form-group"> |
| 402 | <label class="col-md-2 control-label">是否机动车:</label> | 361 | <label class="col-md-2 control-label">是否机动车:</label> |
| 403 | <div class="col-md-3"> | 362 | <div class="col-md-3"> |
| 404 | - <div class="input-group"> | ||
| 405 | - <ui-select ng-model="ctrl.busInfoForSave.vehicleStats_Selected" | ||
| 406 | - on-select="ctrl.vehicleStats_selected_change($item, $model)" | ||
| 407 | - theme="bootstrap" name="vehicleStats"> | ||
| 408 | - <ui-select-match placeholder="请选择机动车类型...">{{$select.selected.type}}</ui-select-match> | ||
| 409 | - <ui-select-choices repeat="item in ctrl.vehicleStates"> | ||
| 410 | - <span ng-bind="item.type"></span> | ||
| 411 | - </ui-select-choices> | ||
| 412 | - </ui-select> | ||
| 413 | - <span class="input-group-btn"> | ||
| 414 | - <button type="button" ng-click="ctrl.vehicleStats_selected_remove()" class="btn btn-default"> | ||
| 415 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 416 | - </button> | ||
| 417 | - </span> | ||
| 418 | - </div> | 363 | + <input type="text" class="form-control" |
| 364 | + name="vehicleStats" ng-model="ctrl.busInfoForSave.vehicleStats" readonly/> | ||
| 419 | </div> | 365 | </div> |
| 420 | </div> | 366 | </div> |
| 421 | 367 | ||
| 422 | <div class="form-group"> | 368 | <div class="form-group"> |
| 423 | <label class="col-md-2 control-label">营运状态:</label> | 369 | <label class="col-md-2 control-label">营运状态:</label> |
| 424 | <div class="col-md-3"> | 370 | <div class="col-md-3"> |
| 425 | - <div class="input-group"> | ||
| 426 | - <ui-select ng-model="ctrl.busInfoForSave.operatorsState_Selected" | ||
| 427 | - on-select="ctrl.operatorsState_selected_change($item, $model)" | ||
| 428 | - theme="bootstrap" name="operatorsState"> | ||
| 429 | - <ui-select-match placeholder="请选择营运状态...">{{$select.selected.type}}</ui-select-match> | ||
| 430 | - <ui-select-choices repeat="item in ctrl.operatorsStates"> | ||
| 431 | - <span ng-bind="item.type"></span> | ||
| 432 | - </ui-select-choices> | ||
| 433 | - </ui-select> | ||
| 434 | - <span class="input-group-btn"> | ||
| 435 | - <button type="button" ng-click="ctrl.operatorsState_selected_remove()" class="btn btn-default"> | ||
| 436 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 437 | - </button> | ||
| 438 | - </span> | ||
| 439 | - </div> | 371 | + <input type="text" class="form-control" |
| 372 | + name="operatorsState" ng-model="ctrl.busInfoForSave.operatorsState" readonly/> | ||
| 440 | </div> | 373 | </div> |
| 441 | </div> | 374 | </div> |
| 442 | 375 | ||
| 443 | <div class="form-group"> | 376 | <div class="form-group"> |
| 444 | <label class="col-md-2 control-label">是否电车:</label> | 377 | <label class="col-md-2 control-label">是否电车:</label> |
| 445 | <div class="col-md-3"> | 378 | <div class="col-md-3"> |
| 446 | - <label class="radio-inline"> | ||
| 447 | - <input type="radio" name="sfdc" | ||
| 448 | - ng-value="true" ng-model="ctrl.busInfoForSave.sfdc"/>是 | ||
| 449 | - </label> | ||
| 450 | - <label class="radio-inline"> | ||
| 451 | - <input type="radio" name="sfdc" | ||
| 452 | - ng-value="false" ng-model="ctrl.busInfoForSave.sfdc"/>否 | ||
| 453 | - </label> | 379 | + <truefalse-Dic model="ctrl.busInfoForSave.sfdc" disabled="true" dicgroup="truefalseType" name="sfdc"></truefalse-Dic> |
| 454 | </div> | 380 | </div> |
| 455 | </div> | 381 | </div> |
| 456 | 382 |
src/main/resources/static/pages/scheduleApp/module/main.js
| @@ -666,6 +666,38 @@ ScheduleApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvi | @@ -666,6 +666,38 @@ ScheduleApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvi | ||
| 666 | 666 | ||
| 667 | // 车辆信息service | 667 | // 车辆信息service |
| 668 | angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) { | 668 | angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) { |
| 669 | + return { | ||
| 670 | + rest: $resource( | ||
| 671 | + '/cars/:id', | ||
| 672 | + {order: 'carCode', direction: 'ASC', id: '@id_route'}, | ||
| 673 | + { | ||
| 674 | + list: { | ||
| 675 | + method: 'GET', | ||
| 676 | + params: { | ||
| 677 | + page: 0 | ||
| 678 | + } | ||
| 679 | + }, | ||
| 680 | + get: { | ||
| 681 | + method: 'GET' | ||
| 682 | + }, | ||
| 683 | + save: { | ||
| 684 | + method: 'POST' | ||
| 685 | + } | ||
| 686 | + } | ||
| 687 | + ), | ||
| 688 | + validate: $resource( | ||
| 689 | + '/cars/validate/:type', | ||
| 690 | + {}, | ||
| 691 | + { | ||
| 692 | + insideCode: { | ||
| 693 | + method: 'GET' | ||
| 694 | + } | ||
| 695 | + } | ||
| 696 | + ) | ||
| 697 | + }; | ||
| 698 | + | ||
| 699 | + | ||
| 700 | + | ||
| 669 | return $resource( | 701 | return $resource( |
| 670 | '/cars/:id', | 702 | '/cars/:id', |
| 671 | {order: 'carCode', direction: 'ASC', id: '@id_route'}, | 703 | {order: 'carCode', direction: 'ASC', id: '@id_route'}, |
| @@ -938,7 +970,11 @@ angular.module('ScheduleApp').directive("truefalseDic", [function() { | @@ -938,7 +970,11 @@ angular.module('ScheduleApp').directive("truefalseDic", [function() { | ||
| 938 | }; | 970 | }; |
| 939 | }]); | 971 | }]); |
| 940 | 972 | ||
| 941 | -angular.module('ScheduleApp').directive("remoteValidaton", [function() { | 973 | +angular.module('ScheduleApp').directive("remoteValidaton", [ |
| 974 | + 'BusInfoManageService_g', | ||
| 975 | + function( | ||
| 976 | + busInfoManageService_g | ||
| 977 | + ) { | ||
| 942 | /** | 978 | /** |
| 943 | * 远端验证指令,依赖于ngModel | 979 | * 远端验证指令,依赖于ngModel |
| 944 | * 指令名称 remote-Validation | 980 | * 指令名称 remote-Validation |
| @@ -949,10 +985,28 @@ angular.module('ScheduleApp').directive("remoteValidaton", [function() { | @@ -949,10 +985,28 @@ angular.module('ScheduleApp').directive("remoteValidaton", [function() { | ||
| 949 | require: "ngModel", | 985 | require: "ngModel", |
| 950 | link: function(scope, element, attr, ngModelCtrl) { | 986 | link: function(scope, element, attr, ngModelCtrl) { |
| 951 | element.bind("keyup", function() { | 987 | element.bind("keyup", function() { |
| 988 | + var modelValue = ngModelCtrl.$modelValue; | ||
| 952 | if (attr["rvtype"]) { | 989 | if (attr["rvtype"]) { |
| 990 | + | ||
| 953 | // 根据rvtype的值,确定使用那个远端验证的url, | 991 | // 根据rvtype的值,确定使用那个远端验证的url, |
| 954 | // 这个貌似没法通用,根据业务变换 | 992 | // 这个貌似没法通用,根据业务变换 |
| 955 | - console.log(attr['rvtype']); | 993 | + if (attr["rvtype"] == "insideCode") { |
| 994 | + busInfoManageService_g.validate.insideCode( | ||
| 995 | + {"insideCode_eq": modelValue, type: "equale"}, | ||
| 996 | + function(result) { | ||
| 997 | + //console.log(result); | ||
| 998 | + if (result.status == "SUCCESS") { | ||
| 999 | + ngModelCtrl.$setValidity('remote', true); | ||
| 1000 | + } else { | ||
| 1001 | + ngModelCtrl.$setValidity('remote', false); | ||
| 1002 | + } | ||
| 1003 | + }, | ||
| 1004 | + function(result) { | ||
| 1005 | + //console.log(result); | ||
| 1006 | + ngModelCtrl.$setValidity('remote', true); | ||
| 1007 | + } | ||
| 1008 | + ); | ||
| 1009 | + } | ||
| 956 | } else { | 1010 | } else { |
| 957 | // 没有rvtype,就不用远端验证了 | 1011 | // 没有rvtype,就不用远端验证了 |
| 958 | ngModelCtrl.$setValidity('remote', true); | 1012 | ngModelCtrl.$setValidity('remote', true); |