Commit 7b78b869c96b35b254ff063aff0157c36770357a

Authored by 徐烜
1 parent ab67ae74

1、修改时刻表编辑中,明细删除功能呢,将DELETE方法改成POST方法,具体看代码

src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
... ... @@ -6,6 +6,7 @@ import com.bsth.entity.schedule.TTInfoDetail;
6 6 import com.bsth.service.schedule.TTInfoDetailService;
7 7 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
8 8 import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
  9 +import com.bsth.service.schedule.exception.ScheduleException;
9 10 import com.bsth.service.schedule.utils.DataToolsFile;
10 11 import com.bsth.service.schedule.utils.DataToolsFileType;
11 12 import com.bsth.service.schedule.utils.TimetableExcelData;
... ... @@ -163,4 +164,20 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> {
163 164 bos.close();
164 165 is.close();
165 166 }
  167 +
  168 + // 新Delete操作,不使用DELETE使用Post
  169 + @RequestMapping(value = "/newDelete", method = RequestMethod.POST)
  170 + public Map<String, Object> newDelete(Long id) {
  171 + Map<String, Object> rtn = new HashMap<>();
  172 + try {
  173 + // 由于种种原因,这里不保存用户和操作时间了
  174 + ttInfoDetailService.delete(id);
  175 + rtn.put("status", ResponseCode.SUCCESS);
  176 + } catch (ScheduleException exp) {
  177 + rtn.put("status", ResponseCode.ERROR);
  178 + rtn.put("msg", exp.getMessage());
  179 + }
  180 +
  181 + return rtn;
  182 + }
166 183 }
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -890,6 +890,25 @@ angular.module(&#39;ScheduleApp&#39;).factory(
890 890 }
891 891 }
892 892 }
  893 + ),
  894 + newDelete: $resource(
  895 + '/tidc/newDelete',
  896 + {},
  897 + {
  898 + do: {
  899 + method: 'POST',
  900 + headers: {
  901 + 'Content-Type': 'application/x-www-form-urlencoded'
  902 + },
  903 + transformRequest: function(obj) {
  904 + var str = [];
  905 + for (var p in obj) {
  906 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  907 + }
  908 + return str.join("&");
  909 + }
  910 + }
  911 + }
893 912 )
894 913  
895 914 // TODO:导入数据
... ... @@ -898,7 +917,8 @@ angular.module(&#39;ScheduleApp&#39;).factory(
898 917 }
899 918  
900 919 ]
901   -);
  920 +);
  921 +
902 922 // 用户登录日志service
903 923 angular.module('ScheduleApp').factory(
904 924 "UserSignManageService_g",
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js
... ... @@ -11,6 +11,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
11 11  
12 12 // 查询对象类
13 13 var queryClass = service.rest;
  14 + var deleteClass = service.newDelete;
14 15  
15 16 // 时刻表信息(编辑视图使用)
16 17 var editInfo = {
... ... @@ -140,7 +141,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
140 141 var error_counts = 0; // 失败数
141 142 for (var n = 0; n < ttinfodetailIds.length; n++) {
142 143 (function(index) {
143   - queryClass.delete({id: ttinfodetailIds[index].ttdid}, function(value) {
  144 + deleteClass.do({id: ttinfodetailIds[index].ttdid}, function(value) {
144 145 if (value.status == 'ERROR') {
145 146 error_counts ++;
146 147 if (success_counts + error_counts == ttinfodetailIds.length) {
... ... @@ -148,6 +149,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
148 149 }
149 150 } else {
150 151 // 赋值(上下行,发车时间,班次类型,起点站,终点站,停车场)
  152 + ttinfodetailIds[index].ttdid = undefined;
151 153 ttinfodetailIds[index].fcsj = undefined;
152 154 ttinfodetailIds[index].xldir = undefined;
153 155 ttinfodetailIds[index].bc_type = undefined;
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/service.js
... ... @@ -207,6 +207,25 @@ angular.module(&#39;ScheduleApp&#39;).factory(
207 207 }
208 208 }
209 209 }
  210 + ),
  211 + newDelete: $resource(
  212 + '/tidc/newDelete',
  213 + {},
  214 + {
  215 + do: {
  216 + method: 'POST',
  217 + headers: {
  218 + 'Content-Type': 'application/x-www-form-urlencoded'
  219 + },
  220 + transformRequest: function(obj) {
  221 + var str = [];
  222 + for (var p in obj) {
  223 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  224 + }
  225 + return str.join("&");
  226 + }
  227 + }
  228 + }
210 229 )
211 230  
212 231 // TODO:导入数据
... ... @@ -215,4 +234,4 @@ angular.module(&#39;ScheduleApp&#39;).factory(
215 234 }
216 235  
217 236 ]
218   -);
219 237 \ No newline at end of file
  238 +);
... ...