Commit f295dd747f77e98d90220d564a56b5c7da239aa0
1 parent
40e4352c
1.历史班次修正ID和CODE问题修复
Showing
2 changed files
with
682 additions
and
680 deletions
src/main/resources/static/pages/history_sch/edit/history_sch_maintain.html
| 1 | -<div class="uk-modal " id="history-sch-maintain-modal" style=""> | ||
| 2 | - <div class="uk-modal-dialog" style="width: 95%;margin: 20px auto;"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>历史路单维护</h2> | ||
| 6 | - </div> | ||
| 7 | - | ||
| 8 | - <div style="padding-left: 12px;margin: 20px 0"> | ||
| 9 | - <ul class="uk-subnav uk-subnav-pill h-s-time"> | ||
| 10 | - </ul> | ||
| 11 | - </div> | ||
| 12 | - | ||
| 13 | - <div class="uk-panel uk-panel-box uk-panel-box-primary"> | ||
| 14 | - <form class="uk-form search-form"> | ||
| 15 | - <fieldset data-uk-margin> | ||
| 16 | - <span class="horizontal-field">公司</span> | ||
| 17 | - <select name="companyId" style="width: 110px;"></select> | ||
| 18 | - <span class="horizontal-field">分公司</span> | ||
| 19 | - <select name="subCompanyId" style="width: 110px;"></select> | ||
| 20 | - <span class="horizontal-field">线路</span> | ||
| 21 | - <select name="xlBm_eq" style="width: 120px;"></select> | ||
| 22 | - <span class="horizontal-field">路牌</span> | ||
| 23 | - <select name="lpName_eq" style="width: 80px;"></select> | ||
| 24 | - <span class="horizontal-field">上下行</span> | ||
| 25 | - <select name="xlDir_eq"> | ||
| 26 | - <option value="">全部</option> | ||
| 27 | - <option value="0">上行</option> | ||
| 28 | - <option value="1">下行</option> | ||
| 29 | - </select> | ||
| 30 | - | ||
| 31 | - <span class="horizontal-field">车辆</span> | ||
| 32 | - <div class="uk-autocomplete uk-form autocomplete-cars"> | ||
| 33 | - <input type="text" name="clZbh_like" placeholder="自编号" style="width: 80px;"> | ||
| 34 | - </div> | ||
| 35 | - <span class="horizontal-field">驾驶员</span> | ||
| 36 | - <div class="uk-autocomplete uk-form autocomplete-jsy"> | ||
| 37 | - <input type="text" name="jGh_like" placeholder="驾驶员" style="width: 80px;"> | ||
| 38 | - </div> | ||
| 39 | - <button class="uk-button">检索</button> | ||
| 40 | - <a class="add_lp_link" title="先点击检索后再临加路牌"><i class="uk-icon-plus"></i> 临加路牌</a> | ||
| 41 | - <button id="reCountBtn" class="uk-button uk-button-danger uk-button-mini" style="position: absolute;right: 12px;bottom: 14px;"> | ||
| 42 | - 重新统计</button> | ||
| 43 | - </fieldset> | ||
| 44 | - </form> | ||
| 45 | - </div> | ||
| 46 | - | ||
| 47 | - <div class="ct_table_wrap ct_table_no_border history-sch-wrap" style="height: 510px;"> | ||
| 48 | - <div class="ct_table history-sch-table"> | ||
| 49 | - <div class="ct_table_head"> | ||
| 50 | - <dl> | ||
| 51 | - <dt>序号</dt> | ||
| 52 | - <dt>路牌</dt> | ||
| 53 | - <dt>车辆</dt> | ||
| 54 | - <dt>驾驶员</dt> | ||
| 55 | - <dt>起点</dt> | ||
| 56 | - <dt>终点</dt> | ||
| 57 | - <dt>计发</dt> | ||
| 58 | - <dt>待发</dt> | ||
| 59 | - <dt>实发</dt> | ||
| 60 | - <dt>终点实达</dt> | ||
| 61 | - <dt>备注</dt> | ||
| 62 | - </dl> | ||
| 63 | - </div> | ||
| 64 | - <div class="ct_table_body"> | ||
| 65 | - </div> | ||
| 66 | - </div> | ||
| 67 | - </div> | ||
| 68 | - | ||
| 69 | - <div class="load-panel"> | ||
| 70 | - <i class="uk-icon-spinner uk-icon-spin"></i> | ||
| 71 | - 正在加载数据 | ||
| 72 | - </div> | ||
| 73 | - </div> | ||
| 74 | - | ||
| 75 | - <script id="history-sch-maintain-table-temp" type="text/html"> | ||
| 76 | - {{each list as sch i}} | ||
| 77 | - <dl data-id="{{sch.id}}"> | ||
| 78 | - <dd>{{i + 1}}</dd> | ||
| 79 | - <dd>{{sch.lpName}}</dd> | ||
| 80 | - <dd>{{sch.clZbh}}</dd> | ||
| 81 | - <dd>{{sch.jGh}}/{{sch.jName}}</dd> | ||
| 82 | - <dd title="{{sch.qdzName}}">{{sch.qdzName}}</dd> | ||
| 83 | - <dd title="{{sch.zdzName}}">{{sch.zdzName}}</dd> | ||
| 84 | - <dd>{{sch.fcsj}} | ||
| 85 | - {{if sch.bcType == "out"}} | ||
| 86 | - <span class="uk-badge uk-badge-success">出场</span> | ||
| 87 | - {{else if sch.bcType == "in"}} | ||
| 88 | - <span class="uk-badge uk-badge-warning">进场</span> | ||
| 89 | - {{else if sch.bcType == "venting"}} | ||
| 90 | - <span class="uk-badge uk-badge-danger">直放</span> | ||
| 91 | - {{else if sch.bcType == "major"}} | ||
| 92 | - <span class="uk-badge uk-badge-danger">放站</span> | ||
| 93 | - {{else if sch.bcType == "region"}} | ||
| 94 | - <span class="uk-badge sch_region">区间</span> | ||
| 95 | - {{else if sch.bcType == "ldks"}} | ||
| 96 | - <span class="uk-badge sch_ldks">空驶</span> | ||
| 97 | - {{/if}} | ||
| 98 | - {{if sch.sflj}} | ||
| 99 | - <span class="uk-badge uk-badge-danger">临加</span> | ||
| 100 | - {{/if}} | ||
| 101 | - {{if sch.cTasks.length > 0}} | ||
| 102 | - <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span> | ||
| 103 | - {{/if}}</dd> | ||
| 104 | - <dd> | ||
| 105 | - {{sch.dfsj}} | ||
| 106 | - {{if sch.status==-1}} | ||
| 107 | - <span class="uk-badge uk-badge-danger">烂班</span> | ||
| 108 | - {{/if}} | ||
| 109 | - </dd> | ||
| 110 | - <dd>{{sch.fcsjActual}}<span class="fcsj-diff">{{sch.fcsj_diff}}</span></dd> | ||
| 111 | - <dd>{{sch.zdsjActual}}</dd> | ||
| 112 | - <dd title="{{sch.remarks}}">{{sch.remarks}}</dd> | ||
| 113 | - </dl> | ||
| 114 | - {{/each}} | ||
| 115 | - </script> | ||
| 116 | - | ||
| 117 | - <script> | ||
| 118 | - (function () { | ||
| 119 | - var modal = '#history-sch-maintain-modal'; | ||
| 120 | - | ||
| 121 | - //滚动条 | ||
| 122 | - $('.history-sch-wrap', modal).perfectScrollbar({suppressScrollX: true}); | ||
| 123 | - //history-sch-wrap | ||
| 124 | - $(modal).on('init', function (e, data) { | ||
| 125 | - e.stopPropagation(); | ||
| 126 | - $.get('/realSchedule/dateArray', function (rs) { | ||
| 127 | - //日期tab | ||
| 128 | - var tsStr = ''; | ||
| 129 | - $.each(rs, function (i) { | ||
| 130 | - tsStr += '<li ' + (i == 0 ? 'class="uk-active"' : '') + '><a>' + this + '</a></li>'; | ||
| 131 | - }); | ||
| 132 | - | ||
| 133 | - $('.h-s-time', modal).html(tsStr); | ||
| 134 | - clearLpSelect(); | ||
| 135 | - //reLoadLp=true; | ||
| 136 | - //jsQuery(); | ||
| 137 | - }); | ||
| 138 | - }); | ||
| 139 | - | ||
| 140 | - $(modal).on('refresh', function (e, data) { | ||
| 141 | - if(data){ | ||
| 142 | - var lpName = data.lpName; | ||
| 143 | - if(is_new_temp_lp(lpName)){ | ||
| 144 | - $('[name=lpName_eq]', modal).append('<option value="'+lpName+'" selected>'+lpName+'</option>'); | ||
| 145 | - } | ||
| 146 | - } | ||
| 147 | - jsQuery(); | ||
| 148 | - }); | ||
| 149 | - | ||
| 150 | - $(modal).on('click', '.h-s-time li,.h-s-line li', function () { | ||
| 151 | - if(loading) | ||
| 152 | - return; | ||
| 153 | - $(this).parent().find('li.uk-active').removeClass('uk-active'); | ||
| 154 | - $(this).addClass('uk-active'); | ||
| 155 | - clearLpSelect(); | ||
| 156 | - //检索之前将滚动条置顶 | ||
| 157 | - $('.history-sch-wrap', modal)[0].scrollTop = 0; | ||
| 158 | - jsQuery(); | ||
| 159 | - }); | ||
| 160 | - | ||
| 161 | - $('.search-form', modal).on('submit', function (e) { | ||
| 162 | - try { | ||
| 163 | - //检索之前将滚动条置顶 | ||
| 164 | - $('.history-sch-wrap', modal)[0].scrollTop = 0; | ||
| 165 | - jsQuery(); | ||
| 166 | - }catch(e){ | ||
| 167 | - console.log(e); | ||
| 168 | - } | ||
| 169 | - return false; | ||
| 170 | - }); | ||
| 171 | - | ||
| 172 | - var reLoadLp; | ||
| 173 | - var nbbmArray,jsyArray,lpArray,loading; | ||
| 174 | - var schArray;//主键映射 | ||
| 175 | - function jsQuery(cb) { | ||
| 176 | - var data = $('.search-form', modal).serializeJSON(); | ||
| 177 | - data.companyId=null; | ||
| 178 | - data.subCompanyId=null; | ||
| 179 | - var rq = $('.h-s-time li.uk-active', modal).text(); | ||
| 180 | - data.scheduleDateStr_eq = rq; | ||
| 181 | - if(!data.xlBm_eq) | ||
| 182 | - return notify_err('请选择线路...'); | ||
| 183 | - if(data.jGh_like.indexOf('/')!=-1){ | ||
| 184 | - var jsy=data.jGh_like.split('/'); | ||
| 185 | - data.jGh_like=jsy[0]; | ||
| 186 | - data.jName_like=jsy[1]; | ||
| 187 | - } | ||
| 188 | - | ||
| 189 | - $('.load-panel', modal).show(); | ||
| 190 | - loading=true; | ||
| 191 | - $.get('/realSchedule/all', data, function (rs) { | ||
| 192 | - rs.sort(schedule_sort); | ||
| 193 | - //可搜索的车辆自编号和驾驶员 | ||
| 194 | - nbbmArray=[]; | ||
| 195 | - jsyArray=[]; | ||
| 196 | - lpArray = []; | ||
| 197 | - schArray = {}; | ||
| 198 | - $.each(rs, function () { | ||
| 199 | - nbbmArray.push({value: this.clZbh}); | ||
| 200 | - jsyArray.push({value: this.jGh+'/'+this.jName, | ||
| 201 | - fullChars: pinyin.getFullChars(this.jName).toUpperCase(), | ||
| 202 | - camelChars: pinyin.getCamelChars(this.jName)}); | ||
| 203 | - lpArray.push({value: this.lpName}); | ||
| 204 | - calc_sch_real_shift(this); | ||
| 205 | - schArray[this.id] = this; | ||
| 206 | - }); | ||
| 207 | - | ||
| 208 | - var tbodyStr = template('history-sch-maintain-table-temp', {list: rs}); | ||
| 209 | - $('.history-sch-table .ct_table_body', modal).html(tbodyStr); | ||
| 210 | - //value | ||
| 211 | - nbbmArray=distinctByField(nbbmArray); | ||
| 212 | - jsyArray=distinctByField(jsyArray); | ||
| 213 | - lpArray=distinctByField(lpArray); | ||
| 214 | - | ||
| 215 | - if(reLoadLp){ | ||
| 216 | - //路牌下拉框 | ||
| 217 | - var ops = '<option value="">全部</option>'; | ||
| 218 | - $.each(lpArray, function () { | ||
| 219 | - ops += '<option value="'+this.value+'">'+this.value+'</option>'; | ||
| 220 | - }); | ||
| 221 | - $('[name=lpName_eq]', modal).html(ops); | ||
| 222 | - reLoadLp = false; | ||
| 223 | - } | ||
| 224 | - | ||
| 225 | - //lpName_eq | ||
| 226 | - $('.load-panel', modal).hide(); | ||
| 227 | - loading=false; | ||
| 228 | - | ||
| 229 | - //更新滚动条高度 | ||
| 230 | - $('.history-sch-wrap', modal).perfectScrollbar('update'); | ||
| 231 | - | ||
| 232 | - cb && cb(); | ||
| 233 | - | ||
| 234 | - //初始化依赖数据 | ||
| 235 | - gb_data_basic.initData(data.xlBm_eq); | ||
| 236 | - }); | ||
| 237 | - } | ||
| 238 | - | ||
| 239 | - function clearLpSelect() { | ||
| 240 | - $('[name=lpName_eq]', modal).val('').html(''); | ||
| 241 | - reLoadLp = true; | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - //nbbm autocomplete | ||
| 245 | - var carAutoCom=$('.autocomplete-cars', modal); | ||
| 246 | - UIkit.autocomplete(carAutoCom, { | ||
| 247 | - minLength: 1, | ||
| 248 | - delay: 50, | ||
| 249 | - source: function(release) { | ||
| 250 | - var q = $('input', carAutoCom).val().toUpperCase() | ||
| 251 | - ,rs = [], | ||
| 252 | - count = 0; | ||
| 253 | - $.each(nbbmArray, function () { | ||
| 254 | - if(this.value.indexOf(q) != -1){ | ||
| 255 | - rs.push(this); | ||
| 256 | - count++; | ||
| 257 | - } | ||
| 258 | - if (count >= 15) | ||
| 259 | - return false; | ||
| 260 | - }); | ||
| 261 | - release && release(rs); | ||
| 262 | - } | ||
| 263 | - }); | ||
| 264 | - | ||
| 265 | - //jsy autocomplete | ||
| 266 | - var jsyAutoCom=$('.autocomplete-jsy', modal); | ||
| 267 | - UIkit.autocomplete(jsyAutoCom, { | ||
| 268 | - minLength: 1, | ||
| 269 | - delay: 50, | ||
| 270 | - source: function(release) { | ||
| 271 | - var q = $('input', jsyAutoCom).val().toUpperCase() | ||
| 272 | - ,rs = [], | ||
| 273 | - count = 0; | ||
| 274 | - | ||
| 275 | - $.each(jsyArray, function() { | ||
| 276 | - if (this.value.indexOf(q) != -1 || this.fullChars.indexOf(q) != -1 || this.camelChars.indexOf(q) != -1){ | ||
| 277 | - rs.push(this); | ||
| 278 | - count++; | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | - if (count >= 10) | ||
| 282 | - return false; | ||
| 283 | - }); | ||
| 284 | - release && release(rs); | ||
| 285 | - } | ||
| 286 | - }); | ||
| 287 | - | ||
| 288 | - function schedule_sort(s1, s2) { | ||
| 289 | - return (s1.realExecDate+s1.fcsj).localeCompare(s2.realExecDate+s2.fcsj); | ||
| 290 | - } | ||
| 291 | - | ||
| 292 | - function distinctByField(arr, f){ | ||
| 293 | - if(!f) | ||
| 294 | - f = 'value'; | ||
| 295 | - var rs = {}; | ||
| 296 | - $.each(arr, function () { | ||
| 297 | - rs[this[f]]=this; | ||
| 298 | - }); | ||
| 299 | - return gb_common.get_vals(rs); | ||
| 300 | - } | ||
| 301 | - | ||
| 302 | - gb_ct_table.fixedHead($('.ct_table_wrap', modal)); | ||
| 303 | - | ||
| 304 | - //班次点击 | ||
| 305 | - $(modal).on('click contextmenu', '.history-sch-table .ct_table_body dl', function() { | ||
| 306 | - $(this).parent().find('.active').removeClass('active'); | ||
| 307 | - $(this).addClass('active'); | ||
| 308 | - }); | ||
| 309 | - | ||
| 310 | - var modal_opts = {center: false,bgclose: false, modal: false}; | ||
| 311 | - var folder = '/real_control_v2/fragments/north/nav/history_sch'; | ||
| 312 | - var callbackHandler={ | ||
| 313 | - edit: function(id){ | ||
| 314 | - open_modal(folder + '/editor.html', {id: id, parentModal: modal}, modal_opts); | ||
| 315 | - }, | ||
| 316 | - add: function (id) { | ||
| 317 | - open_modal(folder + '/h_add_temp_sch.html', { | ||
| 318 | - sch: schArray[id] | ||
| 319 | - }, modal_opts); | ||
| 320 | - }, | ||
| 321 | - delete: function (id) { | ||
| 322 | - var sch = schArray[id]; | ||
| 323 | - if (!sch || !sch.sflj) | ||
| 324 | - return notify_err('只能删除临加班次!'); | ||
| 325 | - var str = '<h3>确定要删除临加班次<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>?</h3><h5 style="color: #6c6c6c;font-size: 12px;">班次删除后,调度指令会保留</h5>'; | ||
| 326 | - alt_confirm(str, function () { | ||
| 327 | - gb_common.$del('/realSchedule/history/' + sch.id, function (rs) { | ||
| 328 | - if($('.history-sch-table .ct_table_body dl', modal).length == 1){ | ||
| 329 | - $('[name=lpName_eq]', modal).val(''); | ||
| 330 | - reLoadLp = true; | ||
| 331 | - } | ||
| 332 | - | ||
| 333 | - jsQuery(); | ||
| 334 | - }); | ||
| 335 | - }, '确定删除'); | ||
| 336 | - } | ||
| 337 | - }; | ||
| 338 | - | ||
| 339 | - //计算实发时间差值 | ||
| 340 | - var calc_sch_real_shift = function (sch) { | ||
| 341 | - if (sch.fcsjActualTime) { | ||
| 342 | - var diff = parseInt((sch.fcsjActualTime - sch.dfsjT) / 1000 / 60); | ||
| 343 | - if (diff > 0) | ||
| 344 | - sch.fcsj_diff = '( +' + diff + ' )'; | ||
| 345 | - else if (diff < 0) | ||
| 346 | - sch.fcsj_diff = '( ' + diff + ' )'; | ||
| 347 | - else | ||
| 348 | - sch.fcsj_diff = ''; | ||
| 349 | - } | ||
| 350 | - }; | ||
| 351 | - | ||
| 352 | - //右键菜单 | ||
| 353 | - $.contextMenu({ | ||
| 354 | - selector: modal+' .history-sch-table .ct_table_body dl', | ||
| 355 | - className: 'schedule-ct-menu', | ||
| 356 | - callback: function(key, options) { | ||
| 357 | - var id = $('.context-menu-active', modal).data('id'); | ||
| 358 | - callbackHandler[key] && callbackHandler[key](id); | ||
| 359 | - }, | ||
| 360 | - items: { | ||
| 361 | - 'edit': { | ||
| 362 | - name: '编辑' | ||
| 363 | - }, | ||
| 364 | - 'add': { | ||
| 365 | - name: '新增临加班次' | ||
| 366 | - }, | ||
| 367 | - 'delete':{ | ||
| 368 | - name: '删除' | ||
| 369 | - } | ||
| 370 | - } | ||
| 371 | - }); | ||
| 372 | - | ||
| 373 | - //临加路牌 | ||
| 374 | - $('.add_lp_link', modal).on('click', function () { | ||
| 375 | - var index = 0, max; | ||
| 376 | - $.each(lpArray, function (i, obj) { | ||
| 377 | - var lp = obj.value; | ||
| 378 | - if (lp.indexOf('临') != -1) { | ||
| 379 | - max = lp.substr(lp.indexOf('临') + 1); | ||
| 380 | - if (!isNaN(max)) | ||
| 381 | - index = parseInt(max); | ||
| 382 | - } | ||
| 383 | - }); | ||
| 384 | - | ||
| 385 | - var lpName = '临' + (index + 1); | ||
| 386 | - var lineSelect = $('[name=xlBm_eq]', modal); | ||
| 387 | - var rq = $('.h-s-time li.uk-active', modal).text(), | ||
| 388 | - lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | ||
| 389 | - lineCode = lineSelect.val(); | ||
| 390 | - | ||
| 391 | - var sch = { | ||
| 392 | - scheduleDateStr: rq, | ||
| 393 | - xlBm: lineCode, | ||
| 394 | - xlName: lineName, | ||
| 395 | - lpName: lpName | ||
| 396 | - }; | ||
| 397 | - | ||
| 398 | - open_modal(folder + '/h_add_temp_sch.html', { | ||
| 399 | - sch: sch | ||
| 400 | - }, modal_opts); | ||
| 401 | - }); | ||
| 402 | - | ||
| 403 | - /** | ||
| 404 | - * 是否是临加路牌 | ||
| 405 | - * @param lpName | ||
| 406 | - */ | ||
| 407 | - function is_new_temp_lp(lpName) { | ||
| 408 | - if(lpName.indexOf('临') ==-1) | ||
| 409 | - return false; | ||
| 410 | - | ||
| 411 | - for(var i=0,obj;obj=lpArray[i++];){ | ||
| 412 | - if(obj.value==lpName) | ||
| 413 | - return false; | ||
| 414 | - } | ||
| 415 | - | ||
| 416 | - return true; | ||
| 417 | - } | ||
| 418 | - | ||
| 419 | - | ||
| 420 | - var f = $('.search-form', modal); | ||
| 421 | - var ep = EventProxy.create('query_comps', 'query_lines', function () { | ||
| 422 | - $('[name=companyId]', f).trigger('change');//公司change | ||
| 423 | - }); | ||
| 424 | - var comps; | ||
| 425 | - //构建公司级联下拉框 | ||
| 426 | - $.get('/user/companyData', function (rs) { | ||
| 427 | - comps = rs; | ||
| 428 | - var opts = ''; | ||
| 429 | - for(var i=0,obj;obj=comps[i++];){ | ||
| 430 | - opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>'; | ||
| 431 | - } | ||
| 432 | - $('[name=companyId]', f).html(opts); | ||
| 433 | - ep.emit('query_comps'); | ||
| 434 | - }); | ||
| 435 | - var lineMapps; | ||
| 436 | - //加载线路信息 | ||
| 437 | - $.get('/line/all', {'destroy_eq': 0}, function (rs) { | ||
| 438 | - rs.sort(function (a, b) { | ||
| 439 | - return a.name.localeCompare(b.name); | ||
| 440 | - }); | ||
| 441 | - lineMapps={}; | ||
| 442 | - var k; | ||
| 443 | - $.each(rs, function () { | ||
| 444 | - k = this.company+'_'+this.brancheCompany; | ||
| 445 | - if(!lineMapps[k]) | ||
| 446 | - lineMapps[k]=[]; | ||
| 447 | - lineMapps[k].push(this); | ||
| 448 | - }); | ||
| 449 | - | ||
| 450 | - ep.emit('query_lines'); | ||
| 451 | - }); | ||
| 452 | - | ||
| 453 | - $('[name=companyId]', f).on('change', function () { | ||
| 454 | - var code = $(this).val(), subs=[]; | ||
| 455 | - $.each(comps, function () { | ||
| 456 | - if(this.companyCode==code) | ||
| 457 | - subs=this.children; | ||
| 458 | - }); | ||
| 459 | - | ||
| 460 | - var opts=''; | ||
| 461 | - $.each(subs, function () { | ||
| 462 | - opts += '<option value="'+this.code+'">'+this.name+'</option>'; | ||
| 463 | - }); | ||
| 464 | - $('[name=subCompanyId]', f).html(opts).trigger('change'); | ||
| 465 | - }); | ||
| 466 | - | ||
| 467 | - $('[name=subCompanyId]', f).on('change', function () { | ||
| 468 | - var k = $('[name=companyId]', f).val() + '_' + $(this).val(); | ||
| 469 | - var array = lineMapps[k]; | ||
| 470 | - var opts = ''; | ||
| 471 | - if(array){ | ||
| 472 | - $.each(array, function () { | ||
| 473 | - opts += '<option value="'+this.lineCode+'">'+this.name+'</option>'; | ||
| 474 | - }); | ||
| 475 | - } | ||
| 476 | - $('[name=xlBm_eq]', f).html(opts); | ||
| 477 | - }); | ||
| 478 | - | ||
| 479 | - $('[name=xlBm_eq]', f).on('change', clearLpSelect); | ||
| 480 | - //clearLpSelect | ||
| 481 | - | ||
| 482 | - | ||
| 483 | - /** | ||
| 484 | - * 重新统计 | ||
| 485 | - */ | ||
| 486 | - $('#reCountBtn', modal).on('click', function () { | ||
| 487 | - var lineSelect = $('[name=xlBm_eq]', modal); | ||
| 488 | - var rq = $('.h-s-time li.uk-active', modal).text(), | ||
| 489 | - lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | ||
| 490 | - lineCode = lineSelect.val(); | ||
| 491 | - | ||
| 492 | - var that = this; | ||
| 493 | - alt_confirm('确定要重新统计 ' + lineName + '('+rq+')的数据吗?',function () { | ||
| 494 | - $(that).attr('disabled', 'disabled'); | ||
| 495 | - $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | ||
| 496 | - | ||
| 497 | - | ||
| 498 | - var reCountEp = EventProxy.create('ylbUpdate', 'calcWaybill', 'scheduleDetail', function () { | ||
| 499 | - $('i.uk-icon-spin', that).remove(); | ||
| 500 | - $(that).removeAttr('disabled'); | ||
| 501 | - notify_succ('重新统计成功!'); | ||
| 502 | - }); | ||
| 503 | - | ||
| 504 | - //统计路单 -娄高峰 | ||
| 505 | - gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () { | ||
| 506 | - reCountEp.emitLater('calcWaybill'); | ||
| 507 | - }); | ||
| 508 | - | ||
| 509 | - //统计油 -廖磊 | ||
| 510 | - gb_common.$post('/ylb/updateHistory', {date:rq, line: lineCode}, function () { | ||
| 511 | - reCountEp.emitLater('ylbUpdate'); | ||
| 512 | - }); | ||
| 513 | - | ||
| 514 | - //重新统计班次明细 | ||
| 515 | - gb_common.$post('/sch/reCalc/scheduleDetail', {date:rq, line: lineCode}, function () { | ||
| 516 | - reCountEp.emitLater('scheduleDetail'); | ||
| 517 | - }); | ||
| 518 | - | ||
| 519 | - }, '我确定'); | ||
| 520 | - }); | ||
| 521 | - })(); | ||
| 522 | - </script> | 1 | +<div class="uk-modal " id="history-sch-maintain-modal" style=""> |
| 2 | + <div class="uk-modal-dialog" style="width: 95%;margin: 20px auto;"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>历史路单维护</h2> | ||
| 6 | + </div> | ||
| 7 | + | ||
| 8 | + <div style="padding-left: 12px;margin: 20px 0"> | ||
| 9 | + <ul class="uk-subnav uk-subnav-pill h-s-time"> | ||
| 10 | + </ul> | ||
| 11 | + </div> | ||
| 12 | + | ||
| 13 | + <div class="uk-panel uk-panel-box uk-panel-box-primary"> | ||
| 14 | + <form class="uk-form search-form"> | ||
| 15 | + <input type="hidden" name="lineId"/> | ||
| 16 | + <fieldset data-uk-margin> | ||
| 17 | + <span class="horizontal-field">公司</span> | ||
| 18 | + <select name="companyId" style="width: 110px;"></select> | ||
| 19 | + <span class="horizontal-field">分公司</span> | ||
| 20 | + <select name="subCompanyId" style="width: 110px;"></select> | ||
| 21 | + <span class="horizontal-field">线路</span> | ||
| 22 | + <select name="xlBm_eq" style="width: 120px;"></select> | ||
| 23 | + <span class="horizontal-field">路牌</span> | ||
| 24 | + <select name="lpName_eq" style="width: 80px;"></select> | ||
| 25 | + <span class="horizontal-field">上下行</span> | ||
| 26 | + <select name="xlDir_eq"> | ||
| 27 | + <option value="">全部</option> | ||
| 28 | + <option value="0">上行</option> | ||
| 29 | + <option value="1">下行</option> | ||
| 30 | + </select> | ||
| 31 | + | ||
| 32 | + <span class="horizontal-field">车辆</span> | ||
| 33 | + <div class="uk-autocomplete uk-form autocomplete-cars"> | ||
| 34 | + <input type="text" name="clZbh_like" placeholder="自编号" style="width: 80px;"> | ||
| 35 | + </div> | ||
| 36 | + <span class="horizontal-field">驾驶员</span> | ||
| 37 | + <div class="uk-autocomplete uk-form autocomplete-jsy"> | ||
| 38 | + <input type="text" name="jGh_like" placeholder="驾驶员" style="width: 80px;"> | ||
| 39 | + </div> | ||
| 40 | + <button class="uk-button">检索</button> | ||
| 41 | + <a class="add_lp_link" title="先点击检索后再临加路牌"><i class="uk-icon-plus"></i> 临加路牌</a> | ||
| 42 | + <button id="reCountBtn" class="uk-button uk-button-danger uk-button-mini" style="position: absolute;right: 12px;bottom: 14px;"> | ||
| 43 | + 重新统计</button> | ||
| 44 | + </fieldset> | ||
| 45 | + </form> | ||
| 46 | + </div> | ||
| 47 | + | ||
| 48 | + <div class="ct_table_wrap ct_table_no_border history-sch-wrap" style="height: 510px;"> | ||
| 49 | + <div class="ct_table history-sch-table"> | ||
| 50 | + <div class="ct_table_head"> | ||
| 51 | + <dl> | ||
| 52 | + <dt>序号</dt> | ||
| 53 | + <dt>路牌</dt> | ||
| 54 | + <dt>车辆</dt> | ||
| 55 | + <dt>驾驶员</dt> | ||
| 56 | + <dt>起点</dt> | ||
| 57 | + <dt>终点</dt> | ||
| 58 | + <dt>计发</dt> | ||
| 59 | + <dt>待发</dt> | ||
| 60 | + <dt>实发</dt> | ||
| 61 | + <dt>终点实达</dt> | ||
| 62 | + <dt>备注</dt> | ||
| 63 | + </dl> | ||
| 64 | + </div> | ||
| 65 | + <div class="ct_table_body"> | ||
| 66 | + </div> | ||
| 67 | + </div> | ||
| 68 | + </div> | ||
| 69 | + | ||
| 70 | + <div class="load-panel"> | ||
| 71 | + <i class="uk-icon-spinner uk-icon-spin"></i> | ||
| 72 | + 正在加载数据 | ||
| 73 | + </div> | ||
| 74 | + </div> | ||
| 75 | + | ||
| 76 | + <script id="history-sch-maintain-table-temp" type="text/html"> | ||
| 77 | + {{each list as sch i}} | ||
| 78 | + <dl data-id="{{sch.id}}"> | ||
| 79 | + <dd>{{i + 1}}</dd> | ||
| 80 | + <dd>{{sch.lpName}}</dd> | ||
| 81 | + <dd>{{sch.clZbh}}</dd> | ||
| 82 | + <dd>{{sch.jGh}}/{{sch.jName}}</dd> | ||
| 83 | + <dd title="{{sch.qdzName}}">{{sch.qdzName}}</dd> | ||
| 84 | + <dd title="{{sch.zdzName}}">{{sch.zdzName}}</dd> | ||
| 85 | + <dd>{{sch.fcsj}} | ||
| 86 | + {{if sch.bcType == "out"}} | ||
| 87 | + <span class="uk-badge uk-badge-success">出场</span> | ||
| 88 | + {{else if sch.bcType == "in"}} | ||
| 89 | + <span class="uk-badge uk-badge-warning">进场</span> | ||
| 90 | + {{else if sch.bcType == "venting"}} | ||
| 91 | + <span class="uk-badge uk-badge-danger">直放</span> | ||
| 92 | + {{else if sch.bcType == "major"}} | ||
| 93 | + <span class="uk-badge uk-badge-danger">放站</span> | ||
| 94 | + {{else if sch.bcType == "region"}} | ||
| 95 | + <span class="uk-badge sch_region">区间</span> | ||
| 96 | + {{else if sch.bcType == "ldks"}} | ||
| 97 | + <span class="uk-badge sch_ldks">空驶</span> | ||
| 98 | + {{/if}} | ||
| 99 | + {{if sch.sflj}} | ||
| 100 | + <span class="uk-badge uk-badge-danger">临加</span> | ||
| 101 | + {{/if}} | ||
| 102 | + {{if sch.cTasks.length > 0}} | ||
| 103 | + <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span> | ||
| 104 | + {{/if}}</dd> | ||
| 105 | + <dd> | ||
| 106 | + {{sch.dfsj}} | ||
| 107 | + {{if sch.status==-1}} | ||
| 108 | + <span class="uk-badge uk-badge-danger">烂班</span> | ||
| 109 | + {{/if}} | ||
| 110 | + </dd> | ||
| 111 | + <dd>{{sch.fcsjActual}}<span class="fcsj-diff">{{sch.fcsj_diff}}</span></dd> | ||
| 112 | + <dd>{{sch.zdsjActual}}</dd> | ||
| 113 | + <dd title="{{sch.remarks}}">{{sch.remarks}}</dd> | ||
| 114 | + </dl> | ||
| 115 | + {{/each}} | ||
| 116 | + </script> | ||
| 117 | + | ||
| 118 | + <script> | ||
| 119 | + (function () { | ||
| 120 | + var modal = '#history-sch-maintain-modal'; | ||
| 121 | + | ||
| 122 | + //滚动条 | ||
| 123 | + $('.history-sch-wrap', modal).perfectScrollbar({suppressScrollX: true}); | ||
| 124 | + //history-sch-wrap | ||
| 125 | + $(modal).on('init', function (e, data) { | ||
| 126 | + e.stopPropagation(); | ||
| 127 | + $.get('/realSchedule/dateArray', function (rs) { | ||
| 128 | + //日期tab | ||
| 129 | + var tsStr = ''; | ||
| 130 | + $.each(rs, function (i) { | ||
| 131 | + tsStr += '<li ' + (i == 0 ? 'class="uk-active"' : '') + '><a>' + this + '</a></li>'; | ||
| 132 | + }); | ||
| 133 | + | ||
| 134 | + $('.h-s-time', modal).html(tsStr); | ||
| 135 | + clearLpSelect(); | ||
| 136 | + //reLoadLp=true; | ||
| 137 | + //jsQuery(); | ||
| 138 | + }); | ||
| 139 | + }); | ||
| 140 | + | ||
| 141 | + $(modal).on('refresh', function (e, data) { | ||
| 142 | + if(data){ | ||
| 143 | + var lpName = data.lpName; | ||
| 144 | + if(is_new_temp_lp(lpName)){ | ||
| 145 | + $('[name=lpName_eq]', modal).append('<option value="'+lpName+'" selected>'+lpName+'</option>'); | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + jsQuery(); | ||
| 149 | + }); | ||
| 150 | + | ||
| 151 | + $(modal).on('click', '.h-s-time li,.h-s-line li', function () { | ||
| 152 | + if(loading) | ||
| 153 | + return; | ||
| 154 | + $(this).parent().find('li.uk-active').removeClass('uk-active'); | ||
| 155 | + $(this).addClass('uk-active'); | ||
| 156 | + clearLpSelect(); | ||
| 157 | + //检索之前将滚动条置顶 | ||
| 158 | + $('.history-sch-wrap', modal)[0].scrollTop = 0; | ||
| 159 | + jsQuery(); | ||
| 160 | + }); | ||
| 161 | + | ||
| 162 | + $('.search-form', modal).on('submit', function (e) { | ||
| 163 | + try { | ||
| 164 | + //检索之前将滚动条置顶 | ||
| 165 | + $('.history-sch-wrap', modal)[0].scrollTop = 0; | ||
| 166 | + jsQuery(); | ||
| 167 | + }catch(e){ | ||
| 168 | + console.log(e); | ||
| 169 | + } | ||
| 170 | + return false; | ||
| 171 | + }); | ||
| 172 | + | ||
| 173 | + var reLoadLp; | ||
| 174 | + var nbbmArray,jsyArray,lpArray,loading; | ||
| 175 | + var schArray;//主键映射 | ||
| 176 | + function jsQuery(cb) { | ||
| 177 | + var data = $('.search-form', modal).serializeJSON(); | ||
| 178 | + data.companyId=null; | ||
| 179 | + data.subCompanyId=null; | ||
| 180 | + var rq = $('.h-s-time li.uk-active', modal).text(); | ||
| 181 | + data.scheduleDateStr_eq = rq; | ||
| 182 | + if(!data.xlBm_eq) | ||
| 183 | + return notify_err('请选择线路...'); | ||
| 184 | + if(data.jGh_like.indexOf('/')!=-1){ | ||
| 185 | + var jsy=data.jGh_like.split('/'); | ||
| 186 | + data.jGh_like=jsy[0]; | ||
| 187 | + data.jName_like=jsy[1]; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + $('.load-panel', modal).show(); | ||
| 191 | + loading=true; | ||
| 192 | + $.get('/realSchedule/all', data, function (rs) { | ||
| 193 | + rs.sort(schedule_sort); | ||
| 194 | + //可搜索的车辆自编号和驾驶员 | ||
| 195 | + nbbmArray=[]; | ||
| 196 | + jsyArray=[]; | ||
| 197 | + lpArray = []; | ||
| 198 | + schArray = {}; | ||
| 199 | + $.each(rs, function () { | ||
| 200 | + nbbmArray.push({value: this.clZbh}); | ||
| 201 | + jsyArray.push({value: this.jGh+'/'+this.jName, | ||
| 202 | + fullChars: pinyin.getFullChars(this.jName).toUpperCase(), | ||
| 203 | + camelChars: pinyin.getCamelChars(this.jName)}); | ||
| 204 | + lpArray.push({value: this.lpName}); | ||
| 205 | + calc_sch_real_shift(this); | ||
| 206 | + schArray[this.id] = this; | ||
| 207 | + }); | ||
| 208 | + | ||
| 209 | + var tbodyStr = template('history-sch-maintain-table-temp', {list: rs}); | ||
| 210 | + $('.history-sch-table .ct_table_body', modal).html(tbodyStr); | ||
| 211 | + //value | ||
| 212 | + nbbmArray=distinctByField(nbbmArray); | ||
| 213 | + jsyArray=distinctByField(jsyArray); | ||
| 214 | + lpArray=distinctByField(lpArray); | ||
| 215 | + | ||
| 216 | + if(reLoadLp){ | ||
| 217 | + //路牌下拉框 | ||
| 218 | + var ops = '<option value="">全部</option>'; | ||
| 219 | + $.each(lpArray, function () { | ||
| 220 | + ops += '<option value="'+this.value+'">'+this.value+'</option>'; | ||
| 221 | + }); | ||
| 222 | + $('[name=lpName_eq]', modal).html(ops); | ||
| 223 | + reLoadLp = false; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + //lpName_eq | ||
| 227 | + $('.load-panel', modal).hide(); | ||
| 228 | + loading=false; | ||
| 229 | + | ||
| 230 | + //更新滚动条高度 | ||
| 231 | + $('.history-sch-wrap', modal).perfectScrollbar('update'); | ||
| 232 | + | ||
| 233 | + cb && cb(); | ||
| 234 | + | ||
| 235 | + //初始化依赖数据 | ||
| 236 | + gb_data_basic.initData(data.xlBm_eq, data.lineId); | ||
| 237 | + }); | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + function clearLpSelect() { | ||
| 241 | + $('[name=lpName_eq]', modal).val('').html(''); | ||
| 242 | + $('[name=lineId]', modal).val($(this).data('id')); | ||
| 243 | + reLoadLp = true; | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + //nbbm autocomplete | ||
| 247 | + var carAutoCom=$('.autocomplete-cars', modal); | ||
| 248 | + UIkit.autocomplete(carAutoCom, { | ||
| 249 | + minLength: 1, | ||
| 250 | + delay: 50, | ||
| 251 | + source: function(release) { | ||
| 252 | + var q = $('input', carAutoCom).val().toUpperCase() | ||
| 253 | + ,rs = [], | ||
| 254 | + count = 0; | ||
| 255 | + $.each(nbbmArray, function () { | ||
| 256 | + if(this.value.indexOf(q) != -1){ | ||
| 257 | + rs.push(this); | ||
| 258 | + count++; | ||
| 259 | + } | ||
| 260 | + if (count >= 15) | ||
| 261 | + return false; | ||
| 262 | + }); | ||
| 263 | + release && release(rs); | ||
| 264 | + } | ||
| 265 | + }); | ||
| 266 | + | ||
| 267 | + //jsy autocomplete | ||
| 268 | + var jsyAutoCom=$('.autocomplete-jsy', modal); | ||
| 269 | + UIkit.autocomplete(jsyAutoCom, { | ||
| 270 | + minLength: 1, | ||
| 271 | + delay: 50, | ||
| 272 | + source: function(release) { | ||
| 273 | + var q = $('input', jsyAutoCom).val().toUpperCase() | ||
| 274 | + ,rs = [], | ||
| 275 | + count = 0; | ||
| 276 | + | ||
| 277 | + $.each(jsyArray, function() { | ||
| 278 | + if (this.value.indexOf(q) != -1 || this.fullChars.indexOf(q) != -1 || this.camelChars.indexOf(q) != -1){ | ||
| 279 | + rs.push(this); | ||
| 280 | + count++; | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + if (count >= 10) | ||
| 284 | + return false; | ||
| 285 | + }); | ||
| 286 | + release && release(rs); | ||
| 287 | + } | ||
| 288 | + }); | ||
| 289 | + | ||
| 290 | + function schedule_sort(s1, s2) { | ||
| 291 | + return (s1.realExecDate+s1.fcsj).localeCompare(s2.realExecDate+s2.fcsj); | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + function distinctByField(arr, f){ | ||
| 295 | + if(!f) | ||
| 296 | + f = 'value'; | ||
| 297 | + var rs = {}; | ||
| 298 | + $.each(arr, function () { | ||
| 299 | + rs[this[f]]=this; | ||
| 300 | + }); | ||
| 301 | + return gb_common.get_vals(rs); | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + gb_ct_table.fixedHead($('.ct_table_wrap', modal)); | ||
| 305 | + | ||
| 306 | + //班次点击 | ||
| 307 | + $(modal).on('click contextmenu', '.history-sch-table .ct_table_body dl', function() { | ||
| 308 | + $(this).parent().find('.active').removeClass('active'); | ||
| 309 | + $(this).addClass('active'); | ||
| 310 | + }); | ||
| 311 | + | ||
| 312 | + var modal_opts = {center: false,bgclose: false, modal: false}; | ||
| 313 | + var folder = '/real_control_v2/fragments/north/nav/history_sch'; | ||
| 314 | + var callbackHandler={ | ||
| 315 | + edit: function(id){ | ||
| 316 | + open_modal(folder + '/editor.html', {id: id, parentModal: modal}, modal_opts); | ||
| 317 | + }, | ||
| 318 | + add: function (id) { | ||
| 319 | + open_modal(folder + '/h_add_temp_sch.html', { | ||
| 320 | + sch: schArray[id] | ||
| 321 | + }, modal_opts); | ||
| 322 | + }, | ||
| 323 | + delete: function (id) { | ||
| 324 | + var sch = schArray[id]; | ||
| 325 | + if (!sch || !sch.sflj) | ||
| 326 | + return notify_err('只能删除临加班次!'); | ||
| 327 | + var str = '<h3>确定要删除临加班次<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>?</h3><h5 style="color: #6c6c6c;font-size: 12px;">班次删除后,调度指令会保留</h5>'; | ||
| 328 | + alt_confirm(str, function () { | ||
| 329 | + gb_common.$del('/realSchedule/history/' + sch.id, function (rs) { | ||
| 330 | + if($('.history-sch-table .ct_table_body dl', modal).length == 1){ | ||
| 331 | + $('[name=lpName_eq]', modal).val(''); | ||
| 332 | + reLoadLp = true; | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + jsQuery(); | ||
| 336 | + }); | ||
| 337 | + }, '确定删除'); | ||
| 338 | + } | ||
| 339 | + }; | ||
| 340 | + | ||
| 341 | + //计算实发时间差值 | ||
| 342 | + var calc_sch_real_shift = function (sch) { | ||
| 343 | + if (sch.fcsjActualTime) { | ||
| 344 | + var diff = parseInt((sch.fcsjActualTime - sch.dfsjT) / 1000 / 60); | ||
| 345 | + if (diff > 0) | ||
| 346 | + sch.fcsj_diff = '( +' + diff + ' )'; | ||
| 347 | + else if (diff < 0) | ||
| 348 | + sch.fcsj_diff = '( ' + diff + ' )'; | ||
| 349 | + else | ||
| 350 | + sch.fcsj_diff = ''; | ||
| 351 | + } | ||
| 352 | + }; | ||
| 353 | + | ||
| 354 | + //右键菜单 | ||
| 355 | + $.contextMenu({ | ||
| 356 | + selector: modal+' .history-sch-table .ct_table_body dl', | ||
| 357 | + className: 'schedule-ct-menu', | ||
| 358 | + callback: function(key, options) { | ||
| 359 | + var id = $('.context-menu-active', modal).data('id'); | ||
| 360 | + callbackHandler[key] && callbackHandler[key](id); | ||
| 361 | + }, | ||
| 362 | + items: { | ||
| 363 | + 'edit': { | ||
| 364 | + name: '编辑' | ||
| 365 | + }, | ||
| 366 | + 'add': { | ||
| 367 | + name: '新增临加班次' | ||
| 368 | + }, | ||
| 369 | + 'delete':{ | ||
| 370 | + name: '删除' | ||
| 371 | + } | ||
| 372 | + } | ||
| 373 | + }); | ||
| 374 | + | ||
| 375 | + //临加路牌 | ||
| 376 | + $('.add_lp_link', modal).on('click', function () { | ||
| 377 | + var index = 0, max; | ||
| 378 | + $.each(lpArray, function (i, obj) { | ||
| 379 | + var lp = obj.value; | ||
| 380 | + if (lp.indexOf('临') != -1) { | ||
| 381 | + max = lp.substr(lp.indexOf('临') + 1); | ||
| 382 | + if (!isNaN(max)) | ||
| 383 | + index = parseInt(max); | ||
| 384 | + } | ||
| 385 | + }); | ||
| 386 | + | ||
| 387 | + var lpName = '临' + (index + 1); | ||
| 388 | + var lineSelect = $('[name=xlBm_eq]', modal); | ||
| 389 | + var rq = $('.h-s-time li.uk-active', modal).text(), | ||
| 390 | + lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | ||
| 391 | + lineCode = lineSelect.val(); | ||
| 392 | + | ||
| 393 | + var sch = { | ||
| 394 | + scheduleDateStr: rq, | ||
| 395 | + xlBm: lineCode, | ||
| 396 | + xlName: lineName, | ||
| 397 | + lpName: lpName | ||
| 398 | + }; | ||
| 399 | + | ||
| 400 | + open_modal(folder + '/h_add_temp_sch.html', { | ||
| 401 | + sch: sch | ||
| 402 | + }, modal_opts); | ||
| 403 | + }); | ||
| 404 | + | ||
| 405 | + /** | ||
| 406 | + * 是否是临加路牌 | ||
| 407 | + * @param lpName | ||
| 408 | + */ | ||
| 409 | + function is_new_temp_lp(lpName) { | ||
| 410 | + if(lpName.indexOf('临') ==-1) | ||
| 411 | + return false; | ||
| 412 | + | ||
| 413 | + for(var i=0,obj;obj=lpArray[i++];){ | ||
| 414 | + if(obj.value==lpName) | ||
| 415 | + return false; | ||
| 416 | + } | ||
| 417 | + | ||
| 418 | + return true; | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + | ||
| 422 | + var f = $('.search-form', modal); | ||
| 423 | + var ep = EventProxy.create('query_comps', 'query_lines', function () { | ||
| 424 | + $('[name=companyId]', f).trigger('change');//公司change | ||
| 425 | + }); | ||
| 426 | + var comps; | ||
| 427 | + //构建公司级联下拉框 | ||
| 428 | + $.get('/user/companyData', function (rs) { | ||
| 429 | + comps = rs; | ||
| 430 | + var opts = ''; | ||
| 431 | + for(var i=0,obj;obj=comps[i++];){ | ||
| 432 | + opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>'; | ||
| 433 | + } | ||
| 434 | + $('[name=companyId]', f).html(opts); | ||
| 435 | + ep.emit('query_comps'); | ||
| 436 | + }); | ||
| 437 | + var lineMapps; | ||
| 438 | + //加载线路信息 | ||
| 439 | + $.get('/line/all', {'destroy_eq': 0}, function (rs) { | ||
| 440 | + rs.sort(function (a, b) { | ||
| 441 | + return a.name.localeCompare(b.name); | ||
| 442 | + }); | ||
| 443 | + lineMapps={}; | ||
| 444 | + var k; | ||
| 445 | + $.each(rs, function () { | ||
| 446 | + k = this.company+'_'+this.brancheCompany; | ||
| 447 | + if(!lineMapps[k]) | ||
| 448 | + lineMapps[k]=[]; | ||
| 449 | + lineMapps[k].push(this); | ||
| 450 | + }); | ||
| 451 | + | ||
| 452 | + ep.emit('query_lines'); | ||
| 453 | + }); | ||
| 454 | + | ||
| 455 | + $('[name=companyId]', f).on('change', function () { | ||
| 456 | + var code = $(this).val(), subs=[]; | ||
| 457 | + $.each(comps, function () { | ||
| 458 | + if(this.companyCode==code) | ||
| 459 | + subs=this.children; | ||
| 460 | + }); | ||
| 461 | + | ||
| 462 | + var opts=''; | ||
| 463 | + $.each(subs, function () { | ||
| 464 | + opts += '<option value="'+this.code+'">'+this.name+'</option>'; | ||
| 465 | + }); | ||
| 466 | + $('[name=subCompanyId]', f).html(opts).trigger('change'); | ||
| 467 | + }); | ||
| 468 | + | ||
| 469 | + $('[name=subCompanyId]', f).on('change', function () { | ||
| 470 | + var k = $('[name=companyId]', f).val() + '_' + $(this).val(); | ||
| 471 | + var array = lineMapps[k]; | ||
| 472 | + var opts = ''; | ||
| 473 | + if(array){ | ||
| 474 | + $.each(array, function () { | ||
| 475 | + opts += '<option value="'+this.lineCode+'" data-id="' + this.id + '">'+this.name+'</option>'; | ||
| 476 | + }); | ||
| 477 | + } | ||
| 478 | + $('[name=xlBm_eq]', f).html(opts); | ||
| 479 | + }); | ||
| 480 | + | ||
| 481 | + $('[name=xlBm_eq]', f).on('change', clearLpSelect); | ||
| 482 | + //clearLpSelect | ||
| 483 | + | ||
| 484 | + | ||
| 485 | + /** | ||
| 486 | + * 重新统计 | ||
| 487 | + */ | ||
| 488 | + $('#reCountBtn', modal).on('click', function () { | ||
| 489 | + var lineSelect = $('[name=xlBm_eq]', modal); | ||
| 490 | + var rq = $('.h-s-time li.uk-active', modal).text(), | ||
| 491 | + lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | ||
| 492 | + lineCode = lineSelect.val(); | ||
| 493 | + | ||
| 494 | + var that = this; | ||
| 495 | + alt_confirm('确定要重新统计 ' + lineName + '('+rq+')的数据吗?',function () { | ||
| 496 | + $(that).attr('disabled', 'disabled'); | ||
| 497 | + $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | ||
| 498 | + | ||
| 499 | + | ||
| 500 | + var reCountEp = EventProxy.create('ylbUpdate', 'calcWaybill', 'scheduleDetail', function () { | ||
| 501 | + $('i.uk-icon-spin', that).remove(); | ||
| 502 | + $(that).removeAttr('disabled'); | ||
| 503 | + notify_succ('重新统计成功!'); | ||
| 504 | + }); | ||
| 505 | + | ||
| 506 | + //统计路单 -娄高峰 | ||
| 507 | + gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () { | ||
| 508 | + reCountEp.emitLater('calcWaybill'); | ||
| 509 | + }); | ||
| 510 | + | ||
| 511 | + //统计油 -廖磊 | ||
| 512 | + gb_common.$post('/ylb/updateHistory', {date:rq, line: lineCode}, function () { | ||
| 513 | + reCountEp.emitLater('ylbUpdate'); | ||
| 514 | + }); | ||
| 515 | + | ||
| 516 | + //重新统计班次明细 | ||
| 517 | + gb_common.$post('/sch/reCalc/scheduleDetail', {date:rq, line: lineCode}, function () { | ||
| 518 | + reCountEp.emitLater('scheduleDetail'); | ||
| 519 | + }); | ||
| 520 | + | ||
| 521 | + }, '我确定'); | ||
| 522 | + }); | ||
| 523 | + })(); | ||
| 524 | + </script> | ||
| 523 | </div> | 525 | </div> |
| 524 | \ No newline at end of file | 526 | \ No newline at end of file |
src/main/resources/static/pages/history_sch/edit/js/data_basic.js
| 1 | -/* 基础数据管理模块 */ | ||
| 2 | - | ||
| 3 | -var gb_data_basic = (function () { | ||
| 4 | - | ||
| 5 | - var allPersonnel; | ||
| 6 | - var stationRoutes, lineInformations, codeToLine={}; | ||
| 7 | - var ep = EventProxy.create("all_personnel" | ||
| 8 | - , function (all_personnel) { | ||
| 9 | - allPersonnel = all_personnel; | ||
| 10 | - //gb_main_ep.emitLater('data-basic'); | ||
| 11 | - }); | ||
| 12 | - | ||
| 13 | -/* //线路标准信息 | ||
| 14 | - gb_common.$get('/lineInformation/line/multi', {lineCodes: line_idx}, function (rs) { | ||
| 15 | - var informations = {}; | ||
| 16 | - $.each(rs, function () { | ||
| 17 | - informations[this.line.lineCode] = this; | ||
| 18 | - delete this['line']; | ||
| 19 | - }); | ||
| 20 | - ep.emit('lineInformations', informations); | ||
| 21 | - });*/ | ||
| 22 | - | ||
| 23 | - //人员信息 | ||
| 24 | - loadAllPersonnel(function (data) { | ||
| 25 | - ep.emit('all_personnel', data); | ||
| 26 | - }); | ||
| 27 | - function loadAllPersonnel(cb) { | ||
| 28 | - $.get('/personnel/all_py', function (rs) { | ||
| 29 | - //转换成自动补全组件需要的数据 | ||
| 30 | - var data = [], code; | ||
| 31 | - for(var i =0, p; p = rs[i++];){ | ||
| 32 | - code = p['workId'].indexOf('-')!=-1?p['workId'].split('-')[1]:p['workId']; | ||
| 33 | - data.push({ | ||
| 34 | - value: code + '/' + p.name, | ||
| 35 | - fullChars: p.fullChars.toUpperCase(), | ||
| 36 | - camelChars: p.camelChars.toUpperCase() | ||
| 37 | - }); | ||
| 38 | - } | ||
| 39 | - cb && cb(data); | ||
| 40 | - }); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - var carparks = {}; | ||
| 44 | - //停车场数据 | ||
| 45 | - gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) { | ||
| 46 | - rs.list.sort(function (a, b) { | ||
| 47 | - return a.parkName.localeCompare(b.parkName); | ||
| 48 | - }); | ||
| 49 | - $.each(rs.list, function () { | ||
| 50 | - carparks[this.parkCode] = this; | ||
| 51 | - }); | ||
| 52 | - }); | ||
| 53 | - | ||
| 54 | - //车辆数据 | ||
| 55 | - var carsArray; | ||
| 56 | - $.get('/basic/cars?t=' + Math.random(), function (rs) { | ||
| 57 | - carsArray = rs; | ||
| 58 | - }); | ||
| 59 | - | ||
| 60 | - var getCarparkByCode = function (code) { | ||
| 61 | - return carparks[code]; | ||
| 62 | - }; | ||
| 63 | - | ||
| 64 | - //line code to name | ||
| 65 | - $.get('/basic/lineCode2Name', function (rs) { | ||
| 66 | - ep.emit('lineCode2Name', rs); | ||
| 67 | - }); | ||
| 68 | - | ||
| 69 | - var getLineInformation = function (lineCode) { | ||
| 70 | - return lineInformations[lineCode]; | ||
| 71 | - }; | ||
| 72 | - | ||
| 73 | - var stationRouteSort = function (a, b) { | ||
| 74 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 75 | - }; | ||
| 76 | - | ||
| 77 | - function findLineByCodes(codeArr) { | ||
| 78 | - var rs = []; | ||
| 79 | - $.each(codeArr, function () { | ||
| 80 | - rs.push(codeToLine[this]); | ||
| 81 | - }); | ||
| 82 | - return rs; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - return { | ||
| 86 | - getLineInformation: getLineInformation, | ||
| 87 | - allInformations: function () { | ||
| 88 | - return {}; | ||
| 89 | - }, | ||
| 90 | - allPersonnel: function () { | ||
| 91 | - return allPersonnel; | ||
| 92 | - }, | ||
| 93 | - getSvgAttr: function (lineCode) { | ||
| 94 | - return svgAttrs[lineCode]; | ||
| 95 | - }, | ||
| 96 | - //刷新员工信息 | ||
| 97 | - refreshAllPersonnel: function (cb) { | ||
| 98 | - loadAllPersonnel(function (data) { | ||
| 99 | - allPersonnel = data; | ||
| 100 | - cb && cb(); | ||
| 101 | - }); | ||
| 102 | - }, | ||
| 103 | - carsArray: function () { | ||
| 104 | - return carsArray; | ||
| 105 | - }, | ||
| 106 | - simpleParksArray: function () { | ||
| 107 | - var map = {}; | ||
| 108 | - for(var code in carparks) | ||
| 109 | - map[code] = carparks[code].parkName; | ||
| 110 | - return map; | ||
| 111 | - }, | ||
| 112 | - getLineInformation: getLineInformation, | ||
| 113 | - allInformations: function () { | ||
| 114 | - return lineInformations; | ||
| 115 | - }, | ||
| 116 | - stationRoutes: function (lineCode) { | ||
| 117 | - return stationRoutes[lineCode] | ||
| 118 | - }, | ||
| 119 | - remarksMapps: function () { | ||
| 120 | - return ""; | ||
| 121 | - }, | ||
| 122 | - findLineByCodes: findLineByCodes, | ||
| 123 | - //初始化依赖数据 | ||
| 124 | - initData: function (lineCode) { | ||
| 125 | - var ep = EventProxy.create("stationRoutes", "lineInformations", "codeToLineMap", function (routes, informations, _codeToLine) { | ||
| 126 | - stationRoutes = routes; | ||
| 127 | - lineInformations = informations; | ||
| 128 | - codeToLine[_codeToLine.lineCode] = _codeToLine; | ||
| 129 | - }); | ||
| 130 | - | ||
| 131 | - //站点路由 | ||
| 132 | - gb_common.$get('/stationroute/multiLine', {lineIds: lineCode}, function (rs) { | ||
| 133 | - var list = rs.list; | ||
| 134 | - var routeData = gb_common.groupBy(list, 'lineCode'); | ||
| 135 | - //排序 | ||
| 136 | - for (var lineCode in routeData) { | ||
| 137 | - routeData[lineCode].sort(stationRouteSort); | ||
| 138 | - } | ||
| 139 | - ep.emitLater('stationRoutes', routeData); | ||
| 140 | - }); | ||
| 141 | - | ||
| 142 | - //线路标准信息 | ||
| 143 | - gb_common.$get('/lineInformation/line/multi', {lineCodes: lineCode}, function (rs) { | ||
| 144 | - var _informations = {}; | ||
| 145 | - $.each(rs, function () { | ||
| 146 | - _informations[this.line.lineCode] = this; | ||
| 147 | - delete this['line']; | ||
| 148 | - }); | ||
| 149 | - ep.emitLater('lineInformations', _informations); | ||
| 150 | - }); | ||
| 151 | - | ||
| 152 | - //线路基础信息 | ||
| 153 | - gb_common.$get('/line/' + lineCode, {}, function (rs) { | ||
| 154 | - ep.emitLater('codeToLineMap', rs); | ||
| 155 | - }); | ||
| 156 | - } | ||
| 157 | - }; | ||
| 158 | -})(); | 1 | +/* 基础数据管理模块 */ |
| 2 | + | ||
| 3 | +var gb_data_basic = (function () { | ||
| 4 | + | ||
| 5 | + var allPersonnel; | ||
| 6 | + var stationRoutes, lineInformations, codeToLine={}; | ||
| 7 | + var ep = EventProxy.create("all_personnel" | ||
| 8 | + , function (all_personnel) { | ||
| 9 | + allPersonnel = all_personnel; | ||
| 10 | + //gb_main_ep.emitLater('data-basic'); | ||
| 11 | + }); | ||
| 12 | + | ||
| 13 | +/* //线路标准信息 | ||
| 14 | + gb_common.$get('/lineInformation/line/multi', {lineCodes: line_idx}, function (rs) { | ||
| 15 | + var informations = {}; | ||
| 16 | + $.each(rs, function () { | ||
| 17 | + informations[this.line.lineCode] = this; | ||
| 18 | + delete this['line']; | ||
| 19 | + }); | ||
| 20 | + ep.emit('lineInformations', informations); | ||
| 21 | + });*/ | ||
| 22 | + | ||
| 23 | + //人员信息 | ||
| 24 | + loadAllPersonnel(function (data) { | ||
| 25 | + ep.emit('all_personnel', data); | ||
| 26 | + }); | ||
| 27 | + function loadAllPersonnel(cb) { | ||
| 28 | + $.get('/personnel/all_py', function (rs) { | ||
| 29 | + //转换成自动补全组件需要的数据 | ||
| 30 | + var data = [], code; | ||
| 31 | + for(var i =0, p; p = rs[i++];){ | ||
| 32 | + code = p['workId'].indexOf('-')!=-1?p['workId'].split('-')[1]:p['workId']; | ||
| 33 | + data.push({ | ||
| 34 | + value: code + '/' + p.name, | ||
| 35 | + fullChars: p.fullChars.toUpperCase(), | ||
| 36 | + camelChars: p.camelChars.toUpperCase() | ||
| 37 | + }); | ||
| 38 | + } | ||
| 39 | + cb && cb(data); | ||
| 40 | + }); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + var carparks = {}; | ||
| 44 | + //停车场数据 | ||
| 45 | + gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) { | ||
| 46 | + rs.list.sort(function (a, b) { | ||
| 47 | + return a.parkName.localeCompare(b.parkName); | ||
| 48 | + }); | ||
| 49 | + $.each(rs.list, function () { | ||
| 50 | + carparks[this.parkCode] = this; | ||
| 51 | + }); | ||
| 52 | + }); | ||
| 53 | + | ||
| 54 | + //车辆数据 | ||
| 55 | + var carsArray; | ||
| 56 | + $.get('/basic/cars?t=' + Math.random(), function (rs) { | ||
| 57 | + carsArray = rs; | ||
| 58 | + }); | ||
| 59 | + | ||
| 60 | + var getCarparkByCode = function (code) { | ||
| 61 | + return carparks[code]; | ||
| 62 | + }; | ||
| 63 | + | ||
| 64 | + //line code to name | ||
| 65 | + $.get('/basic/lineCode2Name', function (rs) { | ||
| 66 | + ep.emit('lineCode2Name', rs); | ||
| 67 | + }); | ||
| 68 | + | ||
| 69 | + var getLineInformation = function (lineCode) { | ||
| 70 | + return lineInformations[lineCode]; | ||
| 71 | + }; | ||
| 72 | + | ||
| 73 | + var stationRouteSort = function (a, b) { | ||
| 74 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 75 | + }; | ||
| 76 | + | ||
| 77 | + function findLineByCodes(codeArr) { | ||
| 78 | + var rs = []; | ||
| 79 | + $.each(codeArr, function () { | ||
| 80 | + rs.push(codeToLine[this]); | ||
| 81 | + }); | ||
| 82 | + return rs; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + return { | ||
| 86 | + getLineInformation: getLineInformation, | ||
| 87 | + allInformations: function () { | ||
| 88 | + return {}; | ||
| 89 | + }, | ||
| 90 | + allPersonnel: function () { | ||
| 91 | + return allPersonnel; | ||
| 92 | + }, | ||
| 93 | + getSvgAttr: function (lineCode) { | ||
| 94 | + return svgAttrs[lineCode]; | ||
| 95 | + }, | ||
| 96 | + //刷新员工信息 | ||
| 97 | + refreshAllPersonnel: function (cb) { | ||
| 98 | + loadAllPersonnel(function (data) { | ||
| 99 | + allPersonnel = data; | ||
| 100 | + cb && cb(); | ||
| 101 | + }); | ||
| 102 | + }, | ||
| 103 | + carsArray: function () { | ||
| 104 | + return carsArray; | ||
| 105 | + }, | ||
| 106 | + simpleParksArray: function () { | ||
| 107 | + var map = {}; | ||
| 108 | + for(var code in carparks) | ||
| 109 | + map[code] = carparks[code].parkName; | ||
| 110 | + return map; | ||
| 111 | + }, | ||
| 112 | + getLineInformation: getLineInformation, | ||
| 113 | + allInformations: function () { | ||
| 114 | + return lineInformations; | ||
| 115 | + }, | ||
| 116 | + stationRoutes: function (lineCode) { | ||
| 117 | + return stationRoutes[lineCode] | ||
| 118 | + }, | ||
| 119 | + remarksMapps: function () { | ||
| 120 | + return ""; | ||
| 121 | + }, | ||
| 122 | + findLineByCodes: findLineByCodes, | ||
| 123 | + //初始化依赖数据 | ||
| 124 | + initData: function (lineCode, lineId) { | ||
| 125 | + var ep = EventProxy.create("stationRoutes", "lineInformations", "codeToLineMap", function (routes, informations, _codeToLine) { | ||
| 126 | + stationRoutes = routes; | ||
| 127 | + lineInformations = informations; | ||
| 128 | + codeToLine[_codeToLine.lineCode] = _codeToLine; | ||
| 129 | + }); | ||
| 130 | + | ||
| 131 | + //站点路由 | ||
| 132 | + gb_common.$get('/stationroute/multiLine', {lineIds: lineCode}, function (rs) { | ||
| 133 | + var list = rs.list; | ||
| 134 | + var routeData = gb_common.groupBy(list, 'lineCode'); | ||
| 135 | + //排序 | ||
| 136 | + for (var lineCode in routeData) { | ||
| 137 | + routeData[lineCode].sort(stationRouteSort); | ||
| 138 | + } | ||
| 139 | + ep.emitLater('stationRoutes', routeData); | ||
| 140 | + }); | ||
| 141 | + | ||
| 142 | + //线路标准信息 | ||
| 143 | + gb_common.$get('/lineInformation/line/multi', {lineCodes: lineCode}, function (rs) { | ||
| 144 | + var _informations = {}; | ||
| 145 | + $.each(rs, function () { | ||
| 146 | + _informations[this.line.lineCode] = this; | ||
| 147 | + delete this['line']; | ||
| 148 | + }); | ||
| 149 | + ep.emitLater('lineInformations', _informations); | ||
| 150 | + }); | ||
| 151 | + | ||
| 152 | + //线路基础信息 | ||
| 153 | + gb_common.$get('/line/' + lineId, {}, function (rs) { | ||
| 154 | + ep.emitLater('codeToLineMap', rs); | ||
| 155 | + }); | ||
| 156 | + } | ||
| 157 | + }; | ||
| 158 | +})(); |