Commit 79d98b00b7abbe3a9aa0ff49bb42f3083f2e59f9
1 parent
7b78b869
1、修改车辆配置作废功能,将DELETE方法改成POST方法,具体看代码
Showing
4 changed files
with
65 additions
and
3 deletions
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
| @@ -142,4 +142,20 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { | @@ -142,4 +142,20 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { | ||
| 142 | 142 | ||
| 143 | return rtn; | 143 | return rtn; |
| 144 | } | 144 | } |
| 145 | + | ||
| 146 | + // 新Delete操作,不使用DELETE使用Post | ||
| 147 | + @RequestMapping(value = "/newDelete", method = RequestMethod.POST) | ||
| 148 | + public Map<String, Object> newDelete(Long id) { | ||
| 149 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 150 | + try { | ||
| 151 | + // 由于种种原因,这里不保存用户和操作时间了 | ||
| 152 | + carConfigInfoService.delete(id); | ||
| 153 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 154 | + } catch (ScheduleException exp) { | ||
| 155 | + rtn.put("status", ResponseCode.ERROR); | ||
| 156 | + rtn.put("msg", exp.getMessage()); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + return rtn; | ||
| 160 | + } | ||
| 145 | } | 161 | } |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| @@ -236,9 +236,31 @@ angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', 'UserP | @@ -236,9 +236,31 @@ angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', 'UserP | ||
| 236 | } | 236 | } |
| 237 | } | 237 | } |
| 238 | } | 238 | } |
| 239 | + ), | ||
| 240 | + | ||
| 241 | + newDelete: $resource( | ||
| 242 | + '/cci/newDelete', | ||
| 243 | + {}, | ||
| 244 | + { | ||
| 245 | + do: { | ||
| 246 | + method: 'POST', | ||
| 247 | + headers: { | ||
| 248 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 249 | + }, | ||
| 250 | + transformRequest: function(obj) { | ||
| 251 | + var str = []; | ||
| 252 | + for (var p in obj) { | ||
| 253 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 254 | + } | ||
| 255 | + return str.join("&"); | ||
| 256 | + } | ||
| 257 | + } | ||
| 258 | + } | ||
| 239 | ) | 259 | ) |
| 260 | + | ||
| 240 | }; | 261 | }; |
| 241 | -}]); | 262 | +}]); |
| 263 | + | ||
| 242 | // 线路运营统计service | 264 | // 线路运营统计service |
| 243 | angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) { | 265 | angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) { |
| 244 | return $resource( | 266 | return $resource( |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/module.js
| @@ -39,6 +39,9 @@ angular.module('ScheduleApp').factory( | @@ -39,6 +39,9 @@ angular.module('ScheduleApp').factory( | ||
| 39 | var queryClass = service.rest; | 39 | var queryClass = service.rest; |
| 40 | 40 | ||
| 41 | return { | 41 | return { |
| 42 | + getDeleteClass: function() { | ||
| 43 | + return service.newDelete; | ||
| 44 | + }, | ||
| 42 | getQueryClass: function() { | 45 | getQueryClass: function() { |
| 43 | return queryClass; | 46 | return queryClass; |
| 44 | }, | 47 | }, |
| @@ -249,7 +252,7 @@ angular.module('ScheduleApp').controller( | @@ -249,7 +252,7 @@ angular.module('ScheduleApp').controller( | ||
| 249 | }); | 252 | }); |
| 250 | }; | 253 | }; |
| 251 | self.toggleBusConfig = function(id) { | 254 | self.toggleBusConfig = function(id) { |
| 252 | - BusConfig.delete({id: id}, function(result) { | 255 | + service.getDeleteClass().do({id: id}, function(result) { |
| 253 | if (result.msg) { // 暂时这样做,之后全局拦截 | 256 | if (result.msg) { // 暂时这样做,之后全局拦截 |
| 254 | alert("失败:" + result.msg); | 257 | alert("失败:" + result.msg); |
| 255 | } else { | 258 | } else { |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/service.js
| @@ -50,6 +50,27 @@ angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', 'UserP | @@ -50,6 +50,27 @@ angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', 'UserP | ||
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | + ), | ||
| 54 | + | ||
| 55 | + newDelete: $resource( | ||
| 56 | + '/cci/newDelete', | ||
| 57 | + {}, | ||
| 58 | + { | ||
| 59 | + do: { | ||
| 60 | + method: 'POST', | ||
| 61 | + headers: { | ||
| 62 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 63 | + }, | ||
| 64 | + transformRequest: function(obj) { | ||
| 65 | + var str = []; | ||
| 66 | + for (var p in obj) { | ||
| 67 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 68 | + } | ||
| 69 | + return str.join("&"); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + } | ||
| 53 | ) | 73 | ) |
| 74 | + | ||
| 54 | }; | 75 | }; |
| 55 | -}]); | ||
| 56 | \ No newline at end of file | 76 | \ No newline at end of file |
| 77 | +}]); |