Commit 1377a11b364d19f9477ec76adcf71ab20472c1dc
1 parent
79d98b00
1、修改人员配置作废功能,将DELETE方法改成POST方法,具体看代码
Showing
4 changed files
with
63 additions
and
3 deletions
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
| ... | ... | @@ -228,4 +228,20 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo |
| 228 | 228 | } |
| 229 | 229 | return rtn; |
| 230 | 230 | } |
| 231 | + | |
| 232 | + // 新Delete操作,不使用DELETE使用Post | |
| 233 | + @RequestMapping(value = "/newDelete", method = RequestMethod.POST) | |
| 234 | + public Map<String, Object> newDelete(Long id) { | |
| 235 | + Map<String, Object> rtn = new HashMap<>(); | |
| 236 | + try { | |
| 237 | + // 由于种种原因,这里不保存用户和操作时间了 | |
| 238 | + employeeConfigInfoService.delete(id); | |
| 239 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 240 | + } catch (ScheduleException exp) { | |
| 241 | + rtn.put("status", ResponseCode.ERROR); | |
| 242 | + rtn.put("msg", exp.getMessage()); | |
| 243 | + } | |
| 244 | + | |
| 245 | + return rtn; | |
| 246 | + } | |
| 231 | 247 | } | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| ... | ... | @@ -358,9 +358,30 @@ angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', f |
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | + ), | |
| 362 | + | |
| 363 | + newDelete: $resource( | |
| 364 | + '/eci/newDelete', | |
| 365 | + {}, | |
| 366 | + { | |
| 367 | + do: { | |
| 368 | + method: 'POST', | |
| 369 | + headers: { | |
| 370 | + 'Content-Type': 'application/x-www-form-urlencoded' | |
| 371 | + }, | |
| 372 | + transformRequest: function(obj) { | |
| 373 | + var str = []; | |
| 374 | + for (var p in obj) { | |
| 375 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | |
| 376 | + } | |
| 377 | + return str.join("&"); | |
| 378 | + } | |
| 379 | + } | |
| 380 | + } | |
| 361 | 381 | ) |
| 362 | 382 | }; |
| 363 | -}]); | |
| 383 | +}]); | |
| 384 | + | |
| 364 | 385 | // 路牌管理service |
| 365 | 386 | angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) { |
| 366 | 387 | return { | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/module.js
| ... | ... | @@ -39,6 +39,9 @@ angular.module('ScheduleApp').factory( |
| 39 | 39 | var queryClass = service.rest; |
| 40 | 40 | |
| 41 | 41 | return { |
| 42 | + getDeleteClass: function() { | |
| 43 | + return service.newDelete; | |
| 44 | + }, | |
| 42 | 45 | getQueryClass: function() { |
| 43 | 46 | return queryClass; |
| 44 | 47 | }, |
| ... | ... | @@ -255,7 +258,7 @@ angular.module('ScheduleApp').controller( |
| 255 | 258 | }; |
| 256 | 259 | |
| 257 | 260 | self.toggleEmpConfig = function(id) { |
| 258 | - EmpConfig.delete({id: id}, function(result) { | |
| 261 | + service.getDeleteClass().do({id: id}, function(result) { | |
| 259 | 262 | if (result.msg) { // 暂时这样做,之后全局拦截 |
| 260 | 263 | alert("失败:" + result.msg); |
| 261 | 264 | } else { | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/service.js
| ... | ... | @@ -79,6 +79,26 @@ angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', f |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | + ), | |
| 83 | + | |
| 84 | + newDelete: $resource( | |
| 85 | + '/eci/newDelete', | |
| 86 | + {}, | |
| 87 | + { | |
| 88 | + do: { | |
| 89 | + method: 'POST', | |
| 90 | + headers: { | |
| 91 | + 'Content-Type': 'application/x-www-form-urlencoded' | |
| 92 | + }, | |
| 93 | + transformRequest: function(obj) { | |
| 94 | + var str = []; | |
| 95 | + for (var p in obj) { | |
| 96 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | |
| 97 | + } | |
| 98 | + return str.join("&"); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + } | |
| 82 | 102 | ) |
| 83 | 103 | }; |
| 84 | -}]); | |
| 85 | 104 | \ No newline at end of file |
| 105 | +}]); | ... | ... |