Commit 2fbadc1edd6257ca3c0f78e99bf6f077154b2af7
Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing
3 changed files
with
24 additions
and
7 deletions
src/main/java/com/bsth/controller/oil/CwjyController.java
| ... | ... | @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | 13 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 14 | |
| 15 | +import com.bsth.common.ResponseCode; | |
| 15 | 16 | import com.bsth.controller.BaseController; |
| 16 | 17 | import com.bsth.data.BasicData; |
| 17 | 18 | import com.bsth.entity.Line; |
| ... | ... | @@ -35,7 +36,16 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ |
| 35 | 36 | t.setNbbm(t.getNbbm().trim().toUpperCase()); |
| 36 | 37 | Line line=BasicData.nbbm2LineMap.get(t.getNbbm()); |
| 37 | 38 | t.setLine(line == null?"" : line.getLineCode()); |
| 38 | - return service.save(t); | |
| 39 | + Map<String, Object> map = new HashMap<>(); | |
| 40 | + try { | |
| 41 | + map=service.save(t); | |
| 42 | + }catch (Exception e) { | |
| 43 | + // TODO: handle exception | |
| 44 | + if(e.getMessage().indexOf("PK_CWJYUK")>0){ | |
| 45 | + map.put("fage", "存在相同数据,数据已经过滤"); | |
| 46 | + } | |
| 47 | + } | |
| 48 | + return map; | |
| 39 | 49 | } |
| 40 | 50 | |
| 41 | 51 | @RequestMapping(value = "/checkNbbm",method = RequestMethod.GET) | ... | ... |
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
src/main/resources/static/pages/oil/jyszList.html
| ... | ... | @@ -115,7 +115,8 @@ |
| 115 | 115 | <td>{{obj.xgr}}</td> |
| 116 | 116 | <td>{{obj.createDate}}</td> |
| 117 | 117 | <td> |
| 118 | - <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>--> | |
| 118 | + <button type="button" class="btn btn-sm blue btn-jyszList" | |
| 119 | + data-id="{{obj.id}}">删除</button> | |
| 119 | 120 | </td> |
| 120 | 121 | </tr> |
| 121 | 122 | {{/each}} |
| ... | ... | @@ -241,9 +242,7 @@ $(function(){ |
| 241 | 242 | $.each(data.content, function(i, obj) { |
| 242 | 243 | obj.createDate = moment(obj.createDate).format("YYYY-MM-DD"); |
| 243 | 244 | }); |
| 244 | - console.log(data.content); | |
| 245 | 245 | var bodyHtm = template('jysz_list_temp', {list: data.content}); |
| 246 | - | |
| 247 | 246 | $('#datatable_jysz tbody').html(bodyHtm) |
| 248 | 247 | .find('.icheck').iCheck(icheckOptions) |
| 249 | 248 | .on('ifChanged', iCheckChange); |
| ... | ... | @@ -252,6 +251,7 @@ $(function(){ |
| 252 | 251 | initPagination = true; |
| 253 | 252 | showPagination(data); |
| 254 | 253 | } |
| 254 | + $('.btn-jyszList').on('click', remJysz); | |
| 255 | 255 | layer.close(i); |
| 256 | 256 | }); |
| 257 | 257 | } |
| ... | ... | @@ -302,9 +302,14 @@ $(function(){ |
| 302 | 302 | } |
| 303 | 303 | }); |
| 304 | 304 | } |
| 305 | - | |
| 306 | - | |
| 307 | 305 | //删除 |
| 306 | + function remJysz(){ | |
| 307 | + var id = $(this).data('id'); | |
| 308 | + removeConfirm('确定要删除选中的数据?', '/cwjy/' + id ,function(){ | |
| 309 | + $('tr.filter .filter-submit').click(); | |
| 310 | + }); | |
| 311 | + } | |
| 312 | + /* | |
| 308 | 313 | $('#removeButton').on('click', function(){ |
| 309 | 314 | if($(this).attr('disabled')) |
| 310 | 315 | return; |
| ... | ... | @@ -314,7 +319,7 @@ $(function(){ |
| 314 | 319 | removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ |
| 315 | 320 | $('tr.filter .filter-submit').click(); |
| 316 | 321 | }); |
| 317 | - }); | |
| 322 | + }); */ | |
| 318 | 323 | |
| 319 | 324 | |
| 320 | 325 | $('#addJysz').on('click', function(){ | ... | ... |