Commit 4260631618cf03e6ff3dbc2544f8fb5137707038
1 parent
5bcfe447
编码异常
Showing
1 changed file
with
393 additions
and
393 deletions
src/main/resources/static/pages/electricity/jdl/list.html
| ... | ... | @@ -2,401 +2,401 @@ |
| 2 | 2 | .blue{ |
| 3 | 3 | background-color: #87CEFF |
| 4 | 4 | } |
| 5 | -</style> | |
| 6 | -<div class="page-head"> | |
| 7 | - <div class="page-title"> | |
| 8 | - <h1>车辆充电量</h1> | |
| 9 | - </div> | |
| 10 | -</div> | |
| 11 | -<ul class="page-breadcrumb breadcrumb"> | |
| 12 | - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | |
| 13 | - <li><span class="active">用电管理</span> <i class="fa fa-circle"></i></li> | |
| 14 | - <li><span class="active">车辆充电管理</span></li> | |
| 15 | -</ul> | |
| 16 | - | |
| 17 | -<div class="row" id="ll_oil_list"> | |
| 18 | - <div class="col-md-12"> | |
| 19 | - <!-- Begin: life time stats --> | |
| 20 | - <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 21 | - <div class="portlet-title"> | |
| 22 | - <div class="caption"> | |
| 23 | - <i class="fa fa-fire-extinguisher"></i> <span | |
| 24 | - class="caption-subject font-dark sbold uppercase">车辆充电量</span> | |
| 25 | - </div> | |
| 26 | - <div class="actions"> | |
| 27 | - <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i> | |
| 28 | - 导入Excel | |
| 29 | - </button> | |
| 30 | - <button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i> | |
| 31 | - 导出Excel | |
| 32 | - </button> | |
| 33 | - </div> | |
| 34 | - </div> | |
| 35 | - <div class="portlet-body"> | |
| 36 | - <div class="table-container" style="margin-top: 0px"> | |
| 37 | - <table | |
| 38 | - class="table table-striped table-bordered table-hover table-checkable" | |
| 39 | - id="datatable_dlb"> | |
| 40 | - <thead> | |
| 41 | - <tr role="row" class="filter"> | |
| 42 | - <td>公司:</td> | |
| 43 | - <td> | |
| 44 | - <select class="form-control" id="gsbm" ></select> | |
| 45 | - </td> | |
| 46 | - <td>分公司:</td> | |
| 47 | - <td> | |
| 48 | - <select class="form-control" id="fgsbm" ></select> | |
| 49 | - </td> | |
| 50 | - <td>日期:</td> | |
| 51 | - <td width="86px"> | |
| 52 | - <input type="text" style="width: 80px" name="rq" id="rq"/> | |
| 53 | - </td> | |
| 54 | - <td>内部编码:</td> | |
| 55 | - <td> | |
| 56 | - <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;"></select> | |
| 5 | +</style> | |
| 6 | +<div class="page-head"> | |
| 7 | + <div class="page-title"> | |
| 8 | + <h1>车辆充电量</h1> | |
| 9 | + </div> | |
| 10 | +</div> | |
| 11 | +<ul class="page-breadcrumb breadcrumb"> | |
| 12 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | |
| 13 | + <li><span class="active">用电管理</span> <i class="fa fa-circle"></i></li> | |
| 14 | + <li><span class="active">车辆充电管理</span></li> | |
| 15 | +</ul> | |
| 16 | + | |
| 17 | +<div class="row" id="ll_oil_list"> | |
| 18 | + <div class="col-md-12"> | |
| 19 | + <!-- Begin: life time stats --> | |
| 20 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 21 | + <div class="portlet-title"> | |
| 22 | + <div class="caption"> | |
| 23 | + <i class="fa fa-fire-extinguisher"></i> <span | |
| 24 | + class="caption-subject font-dark sbold uppercase">车辆充电量</span> | |
| 25 | + </div> | |
| 26 | + <div class="actions"> | |
| 27 | + <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i> | |
| 28 | + 导入Excel | |
| 29 | + </button> | |
| 30 | + <button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i> | |
| 31 | + 导出Excel | |
| 32 | + </button> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | + <div class="portlet-body"> | |
| 36 | + <div class="table-container" style="margin-top: 0px"> | |
| 37 | + <table | |
| 38 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 39 | + id="datatable_dlb"> | |
| 40 | + <thead> | |
| 41 | + <tr role="row" class="filter"> | |
| 42 | + <td>公司:</td> | |
| 43 | + <td> | |
| 44 | + <select class="form-control" id="gsbm" ></select> | |
| 57 | 45 | </td> |
| 58 | - | |
| 59 | - <td width="20%"> | |
| 60 | - <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px"> | |
| 61 | - <i class="fa fa-search"></i> 搜索 | |
| 62 | - </button> | |
| 63 | - <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> | |
| 64 | - <i class="fa fa-times"></i> 重置 | |
| 65 | - </button> | |
| 66 | -<!-- <button class="btn btn-danger btn-sm red" id="del" style="margin-right:0px"> --> | |
| 67 | -<!-- <i class="fa fa-times"></i> 删除 --> | |
| 68 | -<!-- </button> --> | |
| 69 | - </td> | |
| 70 | - </tr> | |
| 71 | - <tr role="row" class="heading"> | |
| 72 | - <th>#</th> | |
| 73 | - <th>日期</th> | |
| 46 | + <td>分公司:</td> | |
| 47 | + <td> | |
| 48 | + <select class="form-control" id="fgsbm" ></select> | |
| 49 | + </td> | |
| 50 | + <td>日期:</td> | |
| 51 | + <td width="86px"> | |
| 52 | + <input type="text" style="width: 80px" name="rq" id="rq"/> | |
| 53 | + </td> | |
| 54 | + <td>内部编码:</td> | |
| 55 | + <td> | |
| 56 | + <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;"></select> | |
| 57 | + </td> | |
| 58 | + | |
| 59 | + <td width="20%"> | |
| 60 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px"> | |
| 61 | + <i class="fa fa-search"></i> 搜索 | |
| 62 | + </button> | |
| 63 | + <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> | |
| 64 | + <i class="fa fa-times"></i> 重置 | |
| 65 | + </button> | |
| 66 | +<!-- <button class="btn btn-danger btn-sm red" id="del" style="margin-right:0px"> --> | |
| 67 | +<!-- <i class="fa fa-times"></i> 删除 --> | |
| 68 | +<!-- </button> --> | |
| 69 | + </td> | |
| 70 | + </tr> | |
| 71 | + <tr role="row" class="heading"> | |
| 72 | + <th>#</th> | |
| 73 | + <th>日期</th> | |
| 74 | 74 | <th colspan="2">内部编码</th> |
| 75 | - <th colspan="2">充电量</th> | |
| 76 | - <th colspan="2">充电站</th> | |
| 77 | - <th colspan="2">备注</th> | |
| 78 | -<!-- <td>操作</td> --> | |
| 79 | - </tr> | |
| 80 | - </thead> | |
| 81 | - <tbody></tbody> | |
| 82 | - </table> | |
| 83 | - <div style="text-align: right;"> | |
| 84 | - <ul id="pagination" class="pagination"></ul> | |
| 85 | - </div> | |
| 86 | - </div> | |
| 87 | - </div> | |
| 88 | - <div class="portlet-body"> | |
| 89 | - <div id="modules_tree"></div> | |
| 90 | - </div> | |
| 91 | - </div> | |
| 92 | - </div> | |
| 93 | -</div> | |
| 94 | - | |
| 95 | - | |
| 96 | -<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script> | |
| 97 | -<script> | |
| 98 | - $(function () { | |
| 99 | - | |
| 100 | - // 关闭左侧栏 | |
| 101 | - if (!$('body').hasClass('page-sidebar-closed')) | |
| 102 | - $('.menu-toggler.sidebar-toggler').click(); | |
| 103 | - | |
| 104 | - $("#rq").datetimepicker({ | |
| 105 | - format: 'YYYY-MM-DD', | |
| 106 | - locale: 'zh-cn' | |
| 107 | - }); | |
| 108 | - | |
| 109 | - var page = 0, initPagination; | |
| 110 | - var icheckOptions = { | |
| 111 | - radioClass: 'iradio_square-blue icheck', | |
| 112 | - increaseArea: '20%' | |
| 113 | - } | |
| 114 | - | |
| 115 | - //重置 | |
| 116 | - $('tr.filter .filter-cancel').on('click', function () { | |
| 117 | - $('tr.filter input, select').val('').change(); | |
| 118 | - }); | |
| 119 | - | |
| 120 | - //提交 | |
| 75 | + <th colspan="2">充电量</th> | |
| 76 | + <th colspan="2">充电站</th> | |
| 77 | + <th colspan="2">备注</th> | |
| 78 | +<!-- <td>操作</td> --> | |
| 79 | + </tr> | |
| 80 | + </thead> | |
| 81 | + <tbody></tbody> | |
| 82 | + </table> | |
| 83 | + <div style="text-align: right;"> | |
| 84 | + <ul id="pagination" class="pagination"></ul> | |
| 85 | + </div> | |
| 86 | + </div> | |
| 87 | + </div> | |
| 88 | + <div class="portlet-body"> | |
| 89 | + <div id="modules_tree"></div> | |
| 90 | + </div> | |
| 91 | + </div> | |
| 92 | + </div> | |
| 93 | +</div> | |
| 94 | + | |
| 95 | + | |
| 96 | +<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script> | |
| 97 | +<script> | |
| 98 | + $(function () { | |
| 99 | + | |
| 100 | + // 关闭左侧栏 | |
| 101 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 102 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 103 | + | |
| 104 | + $("#rq").datetimepicker({ | |
| 105 | + format: 'YYYY-MM-DD', | |
| 106 | + locale: 'zh-cn' | |
| 107 | + }); | |
| 108 | + | |
| 109 | + var page = 0, initPagination; | |
| 110 | + var icheckOptions = { | |
| 111 | + radioClass: 'iradio_square-blue icheck', | |
| 112 | + increaseArea: '20%' | |
| 113 | + } | |
| 114 | + | |
| 115 | + //重置 | |
| 116 | + $('tr.filter .filter-cancel').on('click', function () { | |
| 117 | + $('tr.filter input, select').val('').change(); | |
| 118 | + }); | |
| 119 | + | |
| 120 | + //提交 | |
| 121 | 121 | $('tr.filter .filter-submit').on('click', function () { |
| 122 | - var gsbm = $('#gsbm').val(); | |
| 123 | - var fgsbm = $('#fgsbm').val(); | |
| 124 | - if ($("#rq").val() == "" || $("#rq").val() ==null){ | |
| 125 | - layer.msg('请选择日期.'); | |
| 126 | - }else if(gsbm=="" || gsbm==null || fgsbm=="" ||fgsbm==null){ | |
| 127 | - layer.msg('请选择公司和分公司.'); | |
| 128 | - }else { | |
| 129 | - | |
| 130 | - var params = getParams(); | |
| 131 | - | |
| 132 | - page = 0; | |
| 133 | - jsDoQuery(params, true); | |
| 134 | - } | |
| 135 | - }); | |
| 136 | - | |
| 137 | - | |
| 138 | - $.get('/user/companyData', function(result){ | |
| 139 | - obj = result; | |
| 140 | - var options=""; | |
| 141 | -// = '<option value="">请选择</option>'; | |
| 142 | - for(var i = 0; i < obj.length; i++){ | |
| 143 | - options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | |
| 144 | -// setFgsqx(obj[i].companyCode); | |
| 145 | - } | |
| 146 | - $('#gsbm').html(options); | |
| 147 | - updateCompany(); | |
| 148 | - }); | |
| 149 | - | |
| 150 | - $("#gsbm").on("change",updateCompany); | |
| 151 | - function updateCompany(){ | |
| 152 | - var company = $('#gsbm').val(); | |
| 153 | - var options =""; | |
| 154 | -// = '<option value="">请选择</option>'; | |
| 155 | - for(var i = 0; i < obj.length; i++){ | |
| 156 | - if(obj[i].companyCode == company){ | |
| 157 | - var children = obj[i].children; | |
| 158 | - for(var j = 0; j < children.length; j++){ | |
| 159 | - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 160 | - } | |
| 161 | - } | |
| 162 | - } | |
| 163 | - $('#fgsbm').html(options); | |
| 164 | - } | |
| 165 | - /* | |
| 166 | - * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 167 | - */ | |
| 168 | - function jsDoQuery(p, pagination) { | |
| 169 | - var params = {}; | |
| 170 | - if (p) | |
| 171 | - params = p; | |
| 172 | - params['order'] = 'nbbm'; | |
| 173 | - params['page'] = page; | |
| 174 | - params['rq'] = $("#rq").val(); | |
| 175 | - | |
| 176 | - var j = layer.load(2); | |
| 177 | - $get('/jdl/query', params, function (data) { | |
| 178 | - $.each(data.dataList, function (i, obj) { | |
| 179 | - obj.rq = moment(obj.rq).format("YYYY-MM-DD"); | |
| 180 | - }); | |
| 181 | - var bodyHtm = template('jdl_list', {list:data.dataList}); | |
| 182 | - | |
| 183 | - $('#datatable_dlb tbody').html(bodyHtm) | |
| 184 | - .find('.icheck').iCheck(icheckOptions) | |
| 185 | - .on('ifChanged', iCheckChange); | |
| 186 | - if (pagination && data.dataList.length > 0) { | |
| 187 | - //重新分页 | |
| 188 | - initPagination = true; | |
| 189 | - showPagination(data); | |
| 190 | - $('#pagination').show(); | |
| 191 | - } else if(data.dataList.length == 0){ | |
| 192 | - $('#pagination').hide(); | |
| 193 | - } | |
| 194 | - | |
| 195 | - layer.close(j); | |
| 196 | - | |
| 197 | - startOptJzylLink($('#ll_oil_list .in_carpark_jzyl')); | |
| 198 | - }); | |
| 199 | - } | |
| 200 | - | |
| 201 | - //改变状态 | |
| 202 | - function startOptJzylLink(es) { | |
| 203 | - es.editable({ | |
| 204 | - type: 'text', | |
| 205 | - placement: 'right', | |
| 206 | - width: 100, | |
| 207 | - display: false, | |
| 208 | - validate: function (value) { | |
| 209 | - if (!value) | |
| 210 | - return '值不能为空!'; | |
| 211 | - if (isNaN(value)) | |
| 212 | - return '只能为数字!'; | |
| 213 | - if (value < 0) | |
| 214 | - return '值不能小于0!'; | |
| 215 | - }, | |
| 216 | - inputclass: 'form-control input-medium input-edtable-sm' | |
| 217 | - }).on('save', function (e, params) { | |
| 218 | - $(this).text(params.newValue); | |
| 219 | - }); | |
| 220 | - } | |
| 221 | - | |
| 222 | - function iCheckChange() { | |
| 223 | - var tr = $(this).parents('tr'); | |
| 224 | - if (this.checked) | |
| 225 | - tr.addClass('row-active'); | |
| 226 | - else | |
| 227 | - tr.removeClass('row-active'); | |
| 228 | - | |
| 229 | - /* if($('#datatable_resource input.icheck:checked').length == 1) | |
| 230 | - $('#removeButton').removeAttr('disabled'); | |
| 231 | - else | |
| 232 | - $('#removeButton').attr('disabled', 'disabled'); */ | |
| 233 | - } | |
| 234 | - | |
| 235 | - function showPagination(data) { | |
| 236 | - //分页 | |
| 237 | - $('#pagination').jqPaginator({ | |
| 238 | - totalPages: data.totalPages, | |
| 239 | - visiblePages: 6, | |
| 240 | - currentPage: page + 1, | |
| 241 | - first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 242 | - prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 243 | - next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 244 | - last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 245 | - page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 246 | - onPageChange: function (num, type) { | |
| 247 | - if (initPagination) { | |
| 248 | - initPagination = false; | |
| 249 | - return; | |
| 250 | - } | |
| 251 | - | |
| 252 | - var params = getParams(); | |
| 253 | - | |
| 254 | - page = num - 1; | |
| 255 | - jsDoQuery(params, true); | |
| 256 | - } | |
| 257 | - }); | |
| 258 | - } | |
| 259 | - | |
| 260 | - | |
| 261 | - //删除 | |
| 262 | - $('#del').on('click', function () { | |
| 263 | - if ($(this).attr('disabled')) | |
| 264 | - return; | |
| 265 | - | |
| 266 | - var id = $('input.icheck:checked').data('id'); | |
| 267 | - removeConfirm('确定要删除选中的数据?', '/resource/' + id, function () { | |
| 268 | - $('tr.filter .filter-submit').click(); | |
| 269 | - }); | |
| 270 | - }); | |
| 271 | - | |
| 272 | - //搜索线路 | |
| 273 | - $.get('/basic/lineCode2Name',function(result){ | |
| 274 | - var data=[]; | |
| 275 | - | |
| 276 | - for(var code in result){ | |
| 277 | - data.push({id: code, text: result[code]}); | |
| 278 | - } | |
| 279 | - initPinYinSelect2('#xlbm',data,''); | |
| 280 | - | |
| 281 | - }); | |
| 282 | - | |
| 283 | - $('#nbbm').select2({ | |
| 284 | - placeholder: '搜索车辆...', | |
| 285 | - ajax: { | |
| 286 | - url: '/realSchedule/sreachVehic', | |
| 287 | - dataType: 'json', | |
| 288 | - delay: 150, | |
| 289 | - data: function (params) { | |
| 290 | - return {nbbm: params.term}; | |
| 291 | - }, | |
| 292 | - processResults: function (data) { | |
| 293 | - return { | |
| 294 | - results: data | |
| 295 | - }; | |
| 296 | - }, | |
| 297 | - cache: true | |
| 298 | - }, | |
| 299 | - templateResult: function (repo) { | |
| 300 | - if (repo.loading) return repo.text; | |
| 301 | - var h = '<span>' + repo.text + '</span>'; | |
| 302 | - h += (repo.lineName ? ' <span class="select2-desc">' + repo.lineName + '</span>' : ''); | |
| 303 | - return h; | |
| 304 | - }, | |
| 305 | - escapeMarkup: function (markup) { | |
| 306 | - return markup; | |
| 307 | - }, | |
| 308 | - minimumInputLength: 1, | |
| 309 | - templateSelection: function (repo) { | |
| 310 | - return repo.text; | |
| 311 | - }, | |
| 312 | - language: { | |
| 313 | - noResults: function () { | |
| 314 | - return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | |
| 315 | - }, | |
| 316 | - inputTooShort: function (e) { | |
| 317 | - return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | |
| 318 | - }, | |
| 319 | - searching: function () { | |
| 320 | - return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | |
| 321 | - } | |
| 322 | - } | |
| 323 | - }) | |
| 324 | - | |
| 325 | - //导入 | |
| 326 | - $("#upload").on("click", function(){ | |
| 327 | - $.get('upload.html', function(m){$(pjaxContainer).append(m);}); | |
| 328 | - }); | |
| 329 | - | |
| 330 | - //导出 | |
| 331 | - $("#export").on("click", function () { | |
| 332 | - if ($("#rq").val() != "") { | |
| 333 | - var gsbm=$("#gsbm").val(); | |
| 334 | - var fgsbm=$("#fgsbm").val(); | |
| 335 | - if(gsbm=="" || gsbm==null || fgsbm=="" ||fgsbm==null){ | |
| 336 | - layer.msg('请选择公司和分公司.'); | |
| 337 | - return; | |
| 338 | - } | |
| 339 | - var params = getParams(); | |
| 340 | - | |
| 341 | - params["type"] = "export"; | |
| 342 | - $get('/jdl/query', params, function (result) { | |
| 343 | - window.open("/downloadFile/download?fileName=车辆充电量" + moment($("#rq").val()).format("YYYYMMDD")); | |
| 344 | - }); | |
| 345 | - } else { | |
| 346 | - layer.msg('请选择日期.'); | |
| 347 | - } | |
| 348 | - }); | |
| 349 | - | |
| 350 | - function getParams(){ | |
| 351 | - var gsbm=$("#gsbm").val(); | |
| 352 | - var fgsbm=$("#fgsbm").val(); | |
| 353 | - var cells = $('tr.filter')[0].cells | |
| 354 | - , params = {} | |
| 355 | - , name; | |
| 356 | - params["gsbm"] = gsbm; | |
| 357 | - params["fgsbm"] = fgsbm; | |
| 358 | - $.each(cells, function (i, cell) { | |
| 359 | - var items = $('input,select', cell); | |
| 360 | - for (var j = 0, item; item = items[j++];) { | |
| 361 | - name = $(item).attr('name'); | |
| 362 | - if (name) { | |
| 363 | - params[name] = $(item).val(); | |
| 364 | - } | |
| 365 | - } | |
| 366 | - }); | |
| 367 | - return params; | |
| 368 | - }; | |
| 369 | - | |
| 370 | - }); | |
| 371 | - | |
| 372 | -</script> | |
| 373 | - | |
| 374 | -<script id="jdl_list" type="text/html"> | |
| 375 | - {{each list as obj i}} | |
| 376 | - <tr> | |
| 377 | - <td style="vertical-align: middle;"> | |
| 378 | - <!-- <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}"> --> | |
| 379 | - {{i + 1}} | |
| 380 | - </td> | |
| 381 | - <td>{{obj.rq}}</td> | |
| 122 | + var gsbm = $('#gsbm').val(); | |
| 123 | + var fgsbm = $('#fgsbm').val(); | |
| 124 | + if ($("#rq").val() == "" || $("#rq").val() ==null){ | |
| 125 | + layer.msg('请选择日期.'); | |
| 126 | + }else if(gsbm=="" || gsbm==null || fgsbm=="" ||fgsbm==null){ | |
| 127 | + layer.msg('请选择公司和分公司.'); | |
| 128 | + }else { | |
| 129 | + | |
| 130 | + var params = getParams(); | |
| 131 | + | |
| 132 | + page = 0; | |
| 133 | + jsDoQuery(params, true); | |
| 134 | + } | |
| 135 | + }); | |
| 136 | + | |
| 137 | + | |
| 138 | + $.get('/user/companyData', function(result){ | |
| 139 | + obj = result; | |
| 140 | + var options=""; | |
| 141 | +// = '<option value="">请选择</option>'; | |
| 142 | + for(var i = 0; i < obj.length; i++){ | |
| 143 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | |
| 144 | +// setFgsqx(obj[i].companyCode); | |
| 145 | + } | |
| 146 | + $('#gsbm').html(options); | |
| 147 | + updateCompany(); | |
| 148 | + }); | |
| 149 | + | |
| 150 | + $("#gsbm").on("change",updateCompany); | |
| 151 | + function updateCompany(){ | |
| 152 | + var company = $('#gsbm').val(); | |
| 153 | + var options =""; | |
| 154 | +// = '<option value="">请选择</option>'; | |
| 155 | + for(var i = 0; i < obj.length; i++){ | |
| 156 | + if(obj[i].companyCode == company){ | |
| 157 | + var children = obj[i].children; | |
| 158 | + for(var j = 0; j < children.length; j++){ | |
| 159 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 160 | + } | |
| 161 | + } | |
| 162 | + } | |
| 163 | + $('#fgsbm').html(options); | |
| 164 | + } | |
| 165 | + /* | |
| 166 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 167 | + */ | |
| 168 | + function jsDoQuery(p, pagination) { | |
| 169 | + var params = {}; | |
| 170 | + if (p) | |
| 171 | + params = p; | |
| 172 | + params['order'] = 'nbbm'; | |
| 173 | + params['page'] = page; | |
| 174 | + params['rq'] = $("#rq").val(); | |
| 175 | + | |
| 176 | + var j = layer.load(2); | |
| 177 | + $get('/jdl/query', params, function (data) { | |
| 178 | + $.each(data.dataList, function (i, obj) { | |
| 179 | + obj.rq = moment(obj.rq).format("YYYY-MM-DD"); | |
| 180 | + }); | |
| 181 | + var bodyHtm = template('jdl_list', {list:data.dataList}); | |
| 182 | + | |
| 183 | + $('#datatable_dlb tbody').html(bodyHtm) | |
| 184 | + .find('.icheck').iCheck(icheckOptions) | |
| 185 | + .on('ifChanged', iCheckChange); | |
| 186 | + if (pagination && data.dataList.length > 0) { | |
| 187 | + //重新分页 | |
| 188 | + initPagination = true; | |
| 189 | + showPagination(data); | |
| 190 | + $('#pagination').show(); | |
| 191 | + } else if(data.dataList.length == 0){ | |
| 192 | + $('#pagination').hide(); | |
| 193 | + } | |
| 194 | + | |
| 195 | + layer.close(j); | |
| 196 | + | |
| 197 | + startOptJzylLink($('#ll_oil_list .in_carpark_jzyl')); | |
| 198 | + }); | |
| 199 | + } | |
| 200 | + | |
| 201 | + //改变状态 | |
| 202 | + function startOptJzylLink(es) { | |
| 203 | + es.editable({ | |
| 204 | + type: 'text', | |
| 205 | + placement: 'right', | |
| 206 | + width: 100, | |
| 207 | + display: false, | |
| 208 | + validate: function (value) { | |
| 209 | + if (!value) | |
| 210 | + return '值不能为空!'; | |
| 211 | + if (isNaN(value)) | |
| 212 | + return '只能为数字!'; | |
| 213 | + if (value < 0) | |
| 214 | + return '值不能小于0!'; | |
| 215 | + }, | |
| 216 | + inputclass: 'form-control input-medium input-edtable-sm' | |
| 217 | + }).on('save', function (e, params) { | |
| 218 | + $(this).text(params.newValue); | |
| 219 | + }); | |
| 220 | + } | |
| 221 | + | |
| 222 | + function iCheckChange() { | |
| 223 | + var tr = $(this).parents('tr'); | |
| 224 | + if (this.checked) | |
| 225 | + tr.addClass('row-active'); | |
| 226 | + else | |
| 227 | + tr.removeClass('row-active'); | |
| 228 | + | |
| 229 | + /* if($('#datatable_resource input.icheck:checked').length == 1) | |
| 230 | + $('#removeButton').removeAttr('disabled'); | |
| 231 | + else | |
| 232 | + $('#removeButton').attr('disabled', 'disabled'); */ | |
| 233 | + } | |
| 234 | + | |
| 235 | + function showPagination(data) { | |
| 236 | + //分页 | |
| 237 | + $('#pagination').jqPaginator({ | |
| 238 | + totalPages: data.totalPages, | |
| 239 | + visiblePages: 6, | |
| 240 | + currentPage: page + 1, | |
| 241 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 242 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 243 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 244 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 245 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 246 | + onPageChange: function (num, type) { | |
| 247 | + if (initPagination) { | |
| 248 | + initPagination = false; | |
| 249 | + return; | |
| 250 | + } | |
| 251 | + | |
| 252 | + var params = getParams(); | |
| 253 | + | |
| 254 | + page = num - 1; | |
| 255 | + jsDoQuery(params, true); | |
| 256 | + } | |
| 257 | + }); | |
| 258 | + } | |
| 259 | + | |
| 260 | + | |
| 261 | + //删除 | |
| 262 | + $('#del').on('click', function () { | |
| 263 | + if ($(this).attr('disabled')) | |
| 264 | + return; | |
| 265 | + | |
| 266 | + var id = $('input.icheck:checked').data('id'); | |
| 267 | + removeConfirm('确定要删除选中的数据?', '/resource/' + id, function () { | |
| 268 | + $('tr.filter .filter-submit').click(); | |
| 269 | + }); | |
| 270 | + }); | |
| 271 | + | |
| 272 | + //搜索线路 | |
| 273 | + $.get('/basic/lineCode2Name',function(result){ | |
| 274 | + var data=[]; | |
| 275 | + | |
| 276 | + for(var code in result){ | |
| 277 | + data.push({id: code, text: result[code]}); | |
| 278 | + } | |
| 279 | + initPinYinSelect2('#xlbm',data,''); | |
| 280 | + | |
| 281 | + }); | |
| 282 | + | |
| 283 | + $('#nbbm').select2({ | |
| 284 | + placeholder: '搜索车辆...', | |
| 285 | + ajax: { | |
| 286 | + url: '/realSchedule/sreachVehic', | |
| 287 | + dataType: 'json', | |
| 288 | + delay: 150, | |
| 289 | + data: function (params) { | |
| 290 | + return {nbbm: params.term}; | |
| 291 | + }, | |
| 292 | + processResults: function (data) { | |
| 293 | + return { | |
| 294 | + results: data | |
| 295 | + }; | |
| 296 | + }, | |
| 297 | + cache: true | |
| 298 | + }, | |
| 299 | + templateResult: function (repo) { | |
| 300 | + if (repo.loading) return repo.text; | |
| 301 | + var h = '<span>' + repo.text + '</span>'; | |
| 302 | + h += (repo.lineName ? ' <span class="select2-desc">' + repo.lineName + '</span>' : ''); | |
| 303 | + return h; | |
| 304 | + }, | |
| 305 | + escapeMarkup: function (markup) { | |
| 306 | + return markup; | |
| 307 | + }, | |
| 308 | + minimumInputLength: 1, | |
| 309 | + templateSelection: function (repo) { | |
| 310 | + return repo.text; | |
| 311 | + }, | |
| 312 | + language: { | |
| 313 | + noResults: function () { | |
| 314 | + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | |
| 315 | + }, | |
| 316 | + inputTooShort: function (e) { | |
| 317 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | |
| 318 | + }, | |
| 319 | + searching: function () { | |
| 320 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | |
| 321 | + } | |
| 322 | + } | |
| 323 | + }) | |
| 324 | + | |
| 325 | + //导入 | |
| 326 | + $("#upload").on("click", function(){ | |
| 327 | + $.get('upload.html', function(m){$(pjaxContainer).append(m);}); | |
| 328 | + }); | |
| 329 | + | |
| 330 | + //导出 | |
| 331 | + $("#export").on("click", function () { | |
| 332 | + if ($("#rq").val() != "") { | |
| 333 | + var gsbm=$("#gsbm").val(); | |
| 334 | + var fgsbm=$("#fgsbm").val(); | |
| 335 | + if(gsbm=="" || gsbm==null || fgsbm=="" ||fgsbm==null){ | |
| 336 | + layer.msg('请选择公司和分公司.'); | |
| 337 | + return; | |
| 338 | + } | |
| 339 | + var params = getParams(); | |
| 340 | + | |
| 341 | + params["type"] = "export"; | |
| 342 | + $get('/jdl/query', params, function (result) { | |
| 343 | + window.open("/downloadFile/download?fileName=车辆充电量" + moment($("#rq").val()).format("YYYYMMDD")); | |
| 344 | + }); | |
| 345 | + } else { | |
| 346 | + layer.msg('请选择日期.'); | |
| 347 | + } | |
| 348 | + }); | |
| 349 | + | |
| 350 | + function getParams(){ | |
| 351 | + var gsbm=$("#gsbm").val(); | |
| 352 | + var fgsbm=$("#fgsbm").val(); | |
| 353 | + var cells = $('tr.filter')[0].cells | |
| 354 | + , params = {} | |
| 355 | + , name; | |
| 356 | + params["gsbm"] = gsbm; | |
| 357 | + params["fgsbm"] = fgsbm; | |
| 358 | + $.each(cells, function (i, cell) { | |
| 359 | + var items = $('input,select', cell); | |
| 360 | + for (var j = 0, item; item = items[j++];) { | |
| 361 | + name = $(item).attr('name'); | |
| 362 | + if (name) { | |
| 363 | + params[name] = $(item).val(); | |
| 364 | + } | |
| 365 | + } | |
| 366 | + }); | |
| 367 | + return params; | |
| 368 | + }; | |
| 369 | + | |
| 370 | + }); | |
| 371 | + | |
| 372 | +</script> | |
| 373 | + | |
| 374 | +<script id="jdl_list" type="text/html"> | |
| 375 | + {{each list as obj i}} | |
| 376 | + <tr> | |
| 377 | + <td style="vertical-align: middle;"> | |
| 378 | + <!-- <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}"> --> | |
| 379 | + {{i + 1}} | |
| 380 | + </td> | |
| 381 | + <td>{{obj.rq}}</td> | |
| 382 | 382 | <td colspan="2">{{obj.nbbm}}</td> |
| 383 | - | |
| 384 | - <td colspan="2">{{obj.jdl}}</td> | |
| 385 | - <td colspan="2">{{obj.jdz}}</td> | |
| 386 | - <td>{{obj.remarks}}</td> | |
| 387 | - <!-- <td> | |
| 388 | - <button class="btn btn-info btn-sm"> | |
| 389 | - <i class="fa fa-search"></i> 修改 | |
| 390 | - </button> | |
| 391 | - <button class="btn btn-danger btn-sm"> | |
| 392 | - <i class="fa fa-trash-o"></i> 删除 | |
| 393 | - </button> | |
| 394 | - </td> --> | |
| 395 | - </tr> | |
| 396 | - {{/each}} | |
| 397 | - {{if list.length == 0}} | |
| 398 | - <tr> | |
| 399 | - <td colspan=9><h6 class="muted">没有找到相关数据</h6></td> | |
| 400 | - </tr> | |
| 401 | - {{/if}} | |
| 383 | + | |
| 384 | + <td colspan="2">{{obj.jdl}}</td> | |
| 385 | + <td colspan="2">{{obj.jdz}}</td> | |
| 386 | + <td>{{obj.remarks}}</td> | |
| 387 | + <!-- <td> | |
| 388 | + <button class="btn btn-info btn-sm"> | |
| 389 | + <i class="fa fa-search"></i> 修改 | |
| 390 | + </button> | |
| 391 | + <button class="btn btn-danger btn-sm"> | |
| 392 | + <i class="fa fa-trash-o"></i> 删除 | |
| 393 | + </button> | |
| 394 | + </td> --> | |
| 395 | + </tr> | |
| 396 | + {{/each}} | |
| 397 | + {{if list.length == 0}} | |
| 398 | + <tr> | |
| 399 | + <td colspan=9><h6 class="muted">没有找到相关数据</h6></td> | |
| 400 | + </tr> | |
| 401 | + {{/if}} | |
| 402 | 402 | </script> |
| 403 | 403 | \ No newline at end of file | ... | ... |