Commit 4a28ac01d0042aff94a8a0fa6ccb64020d872a94
1 parent
03f3aa94
加油历史记录
Showing
4 changed files
with
321 additions
and
0 deletions
src/main/java/com/bsth/controller/oil/YlxxbController.java
| ... | ... | @@ -65,4 +65,16 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ |
| 65 | 65 | return list; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | + @RequestMapping(value="/saveYlxxb",method = RequestMethod.POST) | |
| 69 | + public Map<String, Object> savejzl(@RequestParam Map<String, Object> map){ | |
| 70 | + Map<String, Object> maps=new HashMap<>(); | |
| 71 | + try { | |
| 72 | + maps = service.saveYlxxb(map); | |
| 73 | + } catch (Exception e) { | |
| 74 | + // TODO Auto-generated catch block | |
| 75 | + e.printStackTrace(); | |
| 76 | + } | |
| 77 | + return maps; | |
| 78 | + } | |
| 79 | + | |
| 68 | 80 | } | ... | ... |
src/main/java/com/bsth/service/oil/YlxxbService.java
| ... | ... | @@ -14,5 +14,7 @@ public interface YlxxbService extends BaseService<Ylxxb, Integer>{ |
| 14 | 14 | |
| 15 | 15 | Map<String, Object> checkJsy(Map<String, Object> map) throws Exception; |
| 16 | 16 | Map<String, Object> checkNbbm(Map<String, Object> map) throws Exception; |
| 17 | + | |
| 18 | + Map<String, Object> saveYlxxb(Map<String, Object> map); | |
| 17 | 19 | |
| 18 | 20 | } | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
| ... | ... | @@ -268,4 +268,23 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 268 | 268 | } |
| 269 | 269 | return newMap; |
| 270 | 270 | } |
| 271 | + @Override | |
| 272 | + public Map<String, Object> saveYlxxb(Map<String, Object> map) { | |
| 273 | + // TODO Auto-generated method stub | |
| 274 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 275 | + try{ | |
| 276 | + Integer id=Integer.parseInt(map.get("id").toString()); | |
| 277 | + Ylxxb t=repository.findOne(id); | |
| 278 | + t.setJzl(Double.parseDouble(map.get("jzl").toString().trim())); | |
| 279 | + t.setNbbm(map.get("nbbm").toString().trim()); | |
| 280 | + t.setJsy(map.get("jsy").toString().trim()); | |
| 281 | + repository.save(t); | |
| 282 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 283 | + }catch(Exception e){ | |
| 284 | + newMap.put("status", ResponseCode.ERROR); | |
| 285 | + logger.error("save erro.", e); | |
| 286 | + throw e; | |
| 287 | + } | |
| 288 | + return newMap; | |
| 289 | + } | |
| 271 | 290 | } | ... | ... |
src/main/resources/static/pages/oil/oillist/list.html
0 → 100644
| 1 | +<div class="page-head"> | |
| 2 | + <div class="page-title"> | |
| 3 | + <h1>进出场存油量</h1> | |
| 4 | + </div> | |
| 5 | +</div> | |
| 6 | + | |
| 7 | +<ul class="page-breadcrumb breadcrumb"> | |
| 8 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | |
| 9 | + <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li> | |
| 10 | + <li><span class="active">进出场存油量</span></li> | |
| 11 | +</ul> | |
| 12 | + | |
| 13 | +<div class="row" id="ll_oil_list"> | |
| 14 | + <div class="col-md-12"> | |
| 15 | + <!-- Begin: life time stats --> | |
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 17 | + <div class="portlet-title"> | |
| 18 | + <div class="caption"> | |
| 19 | + <i class="fa fa-fire-extinguisher"></i> <span | |
| 20 | + class="caption-subject font-dark sbold uppercase">进出场存油量表</span> | |
| 21 | + </div> | |
| 22 | + <div class="actions"> | |
| 23 | + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a> | |
| 24 | + <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> | |
| 25 | +<!-- <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i> --> | |
| 26 | +<!-- 拆分/保存 --> | |
| 27 | +<!-- </button> --> | |
| 28 | + <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> --> | |
| 29 | + <div class="btn-group"> | |
| 30 | + <a class="btn red btn-outline btn-circle" href="javascript:;" | |
| 31 | + data-toggle="dropdown"> <i class="fa fa-share"></i> <span | |
| 32 | + class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i> | |
| 33 | + </a> | |
| 34 | + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools"> | |
| 35 | + <li><a href="javascript:;" data-action="0" | |
| 36 | + class="tool-action" id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息 | |
| 37 | + </a></li> | |
| 38 | + <li><a href="javascript:;" data-action="1" | |
| 39 | + class="tool-action" id="outAndIn"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场) | |
| 40 | + </a></li> | |
| 41 | + <li><a href="javascript:;" id="checkYl" data-action="3" | |
| 42 | + class="tool-action"> <i class="fa fa-gg-circle"></i> | |
| 43 | + 核对加注量(有加油无里程) | |
| 44 | + </a></li> | |
| 45 | + <li class="divider"></li> | |
| 46 | + <li><a href="javascript:;" data-action="3" | |
| 47 | + class="tool-action" id="export"> <i class="fa fa-file-excel-o"></i> | |
| 48 | + 导出Excel | |
| 49 | + </a></li> | |
| 50 | + </ul> | |
| 51 | + </div> | |
| 52 | + </div> | |
| 53 | + </div> | |
| 54 | + <div class="portlet-body"> | |
| 55 | + <div class="table-container" style="margin-top: 10px"> | |
| 56 | + <table | |
| 57 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 58 | + id="datatable_ylxxb"> | |
| 59 | + <thead> | |
| 60 | + <tr role="row" class="filter"> | |
| 61 | + | |
| 62 | + <td> | |
| 63 | + 日期: | |
| 64 | + </td> | |
| 65 | + <td> | |
| 66 | + <input type="text" style="width: 80px" name="yyrq_eq" id="yyrq"/> | |
| 67 | + </td> | |
| 68 | + | |
| 69 | + <td > | |
| 70 | + 内部编码: | |
| 71 | + </td> | |
| 72 | + <td colspan="3"> | |
| 73 | + <input type="text" class="form-control" name="nbbm_like" id="nbbm" style="width: 120px;"></input> | |
| 74 | + </td> | |
| 75 | + <td colspan="4"> | |
| 76 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px"> | |
| 77 | + <i class="fa fa-search"></i> 搜索 | |
| 78 | + </button> | |
| 79 | + | |
| 80 | + <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> | |
| 81 | + <i class="fa fa-times"></i> 重置 | |
| 82 | + </button> | |
| 83 | + | |
| 84 | + </td> | |
| 85 | + </tr> | |
| 86 | + <tr role="row" class="heading"> | |
| 87 | + <th >#</th> | |
| 88 | + <th >日期</th> | |
| 89 | + <th >自编号</th> | |
| 90 | + <th >加油量</th> | |
| 91 | + <th >驾驶员</th> | |
| 92 | + <th >加油类型</th> | |
| 93 | + <!-- <th width="5%">操作</th> --> | |
| 94 | + </tr> | |
| 95 | + </thead> | |
| 96 | + <tbody></tbody> | |
| 97 | + </table> | |
| 98 | + <div style="text-align: right;"> | |
| 99 | + <ul id="pagination" class="pagination"></ul> | |
| 100 | + </div> | |
| 101 | + </div> | |
| 102 | + </div> | |
| 103 | + </div> | |
| 104 | + </div> | |
| 105 | +</div> | |
| 106 | + | |
| 107 | +<script id="ylxxb_list_temp" type="text/html"> | |
| 108 | + {{each list as obj i}} | |
| 109 | + <tr> | |
| 110 | + <td style="vertical-align: middle;"> | |
| 111 | + <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}"> | |
| 112 | + </td> | |
| 113 | + | |
| 114 | + <td> | |
| 115 | + {{obj.yyrq}} | |
| 116 | + </td> | |
| 117 | + <td> | |
| 118 | + <input type="text" data-id="{{obj.id}}" class="in_ylxx_nbbm" value="{{obj.nbbm}}"> | |
| 119 | + </td> | |
| 120 | + <td> | |
| 121 | + <input type="text" data-id="{{obj.id}}" class="in_ylxx_jzl" value="{{obj.jzl}}"> | |
| 122 | + </td> | |
| 123 | + <td> | |
| 124 | + <input type="text" data-id="{{obj.id}}" class="in_ylxx_jsy" value="{{obj.jsy}}"> | |
| 125 | + </td> | |
| 126 | + <td> | |
| 127 | + {{obj.jylx}} | |
| 128 | + </td> | |
| 129 | + <td> | |
| 130 | + | |
| 131 | +<button type="button" class="btn btn-sm blue btn-ylxxbList" | |
| 132 | + data-id="{{obj.id}}">保存</button> </td> | |
| 133 | + </tr> | |
| 134 | + {{/each}} | |
| 135 | + {{if list.length == 0}} | |
| 136 | + <tr> | |
| 137 | + <td colspan=20><h6 class="muted">没有找到相关数据</h6></td> | |
| 138 | + </tr> | |
| 139 | + {{/if}} | |
| 140 | +</script> | |
| 141 | + | |
| 142 | +<script> | |
| 143 | + $(function () { | |
| 144 | + $("#yyrq").datetimepicker({ | |
| 145 | + format: 'YYYY-MM-DD', | |
| 146 | + locale: 'zh-cn' | |
| 147 | + }); | |
| 148 | + | |
| 149 | + var page = 0, initPagination; | |
| 150 | + var icheckOptions = { | |
| 151 | + radioClass: 'iradio_square-blue icheck', | |
| 152 | + increaseArea: '20%' | |
| 153 | + } | |
| 154 | + | |
| 155 | + //重置 | |
| 156 | + $('tr.filter .filter-cancel').on('click', function () { | |
| 157 | + $('tr.filter input, select').val('').change(); | |
| 158 | + }); | |
| 159 | + | |
| 160 | + //提交 | |
| 161 | + $('tr.filter .filter-submit').on('click', function () { | |
| 162 | + if ($("#yyrq").val() == "" || $("#yyrq").val() ==null){ | |
| 163 | + layer.msg('请选择日期.'); | |
| 164 | + }else { | |
| 165 | + var cells = $('tr.filter')[0].cells | |
| 166 | + , params = {} | |
| 167 | + , name; | |
| 168 | + $.each(cells, function (i, cell) { | |
| 169 | + var items = $('input,select', cell); | |
| 170 | + for (var j = 0, item; item = items[j++];) { | |
| 171 | + name = $(item).attr('name'); | |
| 172 | + if (name) { | |
| 173 | + params[name] = $(item).val(); | |
| 174 | + } | |
| 175 | + } | |
| 176 | + }); | |
| 177 | + page = 0; | |
| 178 | + jsDoQuery(params, true); | |
| 179 | + } | |
| 180 | + }); | |
| 181 | + | |
| 182 | + /* | |
| 183 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 184 | + */ | |
| 185 | + function jsDoQuery(p, pagination) { | |
| 186 | + var params = {}; | |
| 187 | + if (p) | |
| 188 | + params = p; | |
| 189 | + //更新时间排序 | |
| 190 | + params['order'] = 'nbbm'; | |
| 191 | + params['page'] = page; | |
| 192 | + params['rq'] = $("#rq").val(); | |
| 193 | + | |
| 194 | + var i = layer.load(2); | |
| 195 | + $get('/ylxxb', params, function (data) { | |
| 196 | + $.each(data.content, function (i, obj) { | |
| 197 | + obj.yyrq = moment(obj.yyrq).format("YYYY-MM-DD"); | |
| 198 | + }); | |
| 199 | + var bodyHtm = template('ylxxb_list_temp', {list: data.content}); | |
| 200 | + | |
| 201 | + $('#datatable_ylxxb tbody').html(bodyHtm) | |
| 202 | + .find('.icheck').iCheck(icheckOptions) | |
| 203 | + .on('ifChanged', iCheckChange); | |
| 204 | + if (pagination && data.content.length > 0) { | |
| 205 | + //重新分页 | |
| 206 | + initPagination = true; | |
| 207 | + showPagination(data); | |
| 208 | + } | |
| 209 | + $('.btn-ylxxbList').on('click', saveYlxxbList); | |
| 210 | + layer.close(i); | |
| 211 | + | |
| 212 | + }); | |
| 213 | + } | |
| 214 | + function showPagination(data) { | |
| 215 | + //分页 | |
| 216 | + $('#pagination').jqPaginator({ | |
| 217 | + totalPages: data.totalPages, | |
| 218 | + visiblePages: 6, | |
| 219 | + currentPage: page + 1, | |
| 220 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 221 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 222 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 223 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 224 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 225 | + onPageChange: function (num, type) { | |
| 226 | + if (initPagination) { | |
| 227 | + initPagination = false; | |
| 228 | + return; | |
| 229 | + } | |
| 230 | + | |
| 231 | + var cells = $('tr.filter')[0].cells | |
| 232 | + , params = {} | |
| 233 | + , name; | |
| 234 | + $.each(cells, function (i, cell) { | |
| 235 | + var items = $('input,select', cell); | |
| 236 | + for (var j = 0, item; item = items[j++];) { | |
| 237 | + name = $(item).attr('name'); | |
| 238 | + if (name) { | |
| 239 | + params[name] = $(item).val(); | |
| 240 | + } | |
| 241 | + } | |
| 242 | + }); | |
| 243 | + page = num - 1; | |
| 244 | + jsDoQuery(params, true); | |
| 245 | + } | |
| 246 | + }); | |
| 247 | + } | |
| 248 | + | |
| 249 | + function saveYlxxbList(){ | |
| 250 | + var id = $(this).data('id'); | |
| 251 | + var jsy=$('.in_ylxx_jsy[data-id='+id+']', '#datatable_ylxxb').val(); | |
| 252 | + var nbbm=$('.in_ylxx_nbbm[data-id='+id+']', '#datatable_ylxxb').val(); | |
| 253 | + var jzl=$('.in_ylxx_jzl[data-id='+id+']', '#datatable_ylxxb').val(); | |
| 254 | + var i = layer.load(2); | |
| 255 | + $post('/ylxxb/saveYlxxb', {id:id,nbbm:nbbm,jsy:jsy,jzl:jzl}, function () { | |
| 256 | + layer.close(i); | |
| 257 | + $('tr.filter .filter-submit').click(); | |
| 258 | + }); | |
| 259 | + } | |
| 260 | + function iCheckChange() { | |
| 261 | + var tr = $(this).parents('tr'); | |
| 262 | + if (this.checked) | |
| 263 | + tr.addClass('row-active'); | |
| 264 | + else | |
| 265 | + tr.removeClass('row-active'); | |
| 266 | + | |
| 267 | + /* if($('#datatable_resource input.icheck:checked').length == 1) | |
| 268 | + $('#removeButton').removeAttr('disabled'); | |
| 269 | + else | |
| 270 | + $('#removeButton').attr('disabled', 'disabled'); */ | |
| 271 | + } | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + //删除 | |
| 276 | + $('#removeButton').on('click', function () { | |
| 277 | + if ($(this).attr('disabled')) | |
| 278 | + return; | |
| 279 | + | |
| 280 | + var id = $('input.icheck:checked').data('id'); | |
| 281 | + removeConfirm('确定要删除选中的数据?', '/ylxxb/' + id, function () { | |
| 282 | + $('tr.filter .filter-submit').click(); | |
| 283 | + }); | |
| 284 | + }); | |
| 285 | + | |
| 286 | + | |
| 287 | + }); | |
| 288 | +</script> | |
| 0 | 289 | \ No newline at end of file | ... | ... |