Commit f363ab2260bf77d06139e9a9167deaabe1db8873
1 parent
48fec9d4
1.线调本地缓存清理
Showing
2 changed files
with
608 additions
and
597 deletions
src/main/resources/application-cloud.properties
| ... | ... | @@ -57,7 +57,7 @@ admin.mail= 3090342880@qq.com |
| 57 | 57 | ## enabled |
| 58 | 58 | enabled.whiteip= true |
| 59 | 59 | |
| 60 | -sso.enabled= true | |
| 60 | +sso.enabled= false | |
| 61 | 61 | sso.systemcode = SYS0019 |
| 62 | 62 | sso.http.url.login= http://180.169.154.251:28090/portal/index.html#/login |
| 63 | 63 | sso.http.url.logout= http://180.169.154.251:18080/information/api/v1/logout | ... | ... |
src/main/resources/static/pages/control/lineallot_v2/main.html
| 1 | -<!DOCTYPE html> | |
| 2 | -<html lang="zh-cn"> | |
| 3 | - | |
| 4 | -<head> | |
| 5 | - <meta charset="UTF-8"> | |
| 6 | - <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/> | |
| 7 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css"/> | |
| 8 | - <!-- flatpickr --> | |
| 9 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css"> | |
| 10 | - <style> | |
| 11 | - html, body { | |
| 12 | - height: 100%; | |
| 13 | - } | |
| 14 | - | |
| 15 | - .ct_page { | |
| 16 | - padding: 25px 15px; | |
| 17 | - height: 100%; | |
| 18 | - height: calc(100% - 65px); | |
| 19 | - } | |
| 20 | - | |
| 21 | - .ct_cont { | |
| 22 | - height: calc(100% - 41px); | |
| 23 | - } | |
| 24 | - | |
| 25 | - .ct_cont > div > div.uk-card { | |
| 26 | - height: 99%; | |
| 27 | - } | |
| 28 | - | |
| 29 | - .loading { | |
| 30 | - height: 100%; | |
| 31 | - text-align: center; | |
| 32 | - } | |
| 33 | - | |
| 34 | - .loading .uk-spinner { | |
| 35 | - margin-top: 200px; | |
| 36 | - } | |
| 37 | - | |
| 38 | - .loading circle { | |
| 39 | - stroke: red; | |
| 40 | - } | |
| 41 | - | |
| 42 | - .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail { | |
| 43 | - opacity: 0.6 !important; | |
| 44 | - padding: 0 !important; | |
| 45 | - } | |
| 46 | - | |
| 47 | - .line_list_all_wrap { | |
| 48 | - height: 200px; | |
| 49 | - overflow: auto; | |
| 50 | - position: relative; | |
| 51 | - -webkit-user-select:none; | |
| 52 | - -moz-user-select:none; | |
| 53 | - -ms-user-select:none; | |
| 54 | - user-select:none; | |
| 55 | - } | |
| 56 | - | |
| 57 | - .line_list_all_wrap > .item { | |
| 58 | - background: #fff; | |
| 59 | - color: #666; | |
| 60 | - box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.08); | |
| 61 | - padding: 7px 12px; | |
| 62 | - border: 1px solid #ececec; | |
| 63 | - display: inline-block; | |
| 64 | - margin: 5px; | |
| 65 | - min-width: 70px; | |
| 66 | - text-align: center; | |
| 67 | - cursor: default; | |
| 68 | - } | |
| 69 | - | |
| 70 | - .line_list_all_wrap > .item.active{ | |
| 71 | - background: #ffe9a5; | |
| 72 | - } | |
| 73 | - | |
| 74 | - .checked_list { | |
| 75 | - padding-left: 4px; | |
| 76 | - -webkit-user-select:none; | |
| 77 | - -moz-user-select:none; | |
| 78 | - -ms-user-select:none; | |
| 79 | - user-select:none; | |
| 80 | - } | |
| 81 | - | |
| 82 | - .checked_list > .item { | |
| 83 | - color: #fbfbfb; | |
| 84 | - box-shadow: 0px 3px 12px rgba(50, 197, 210, 0.3); | |
| 85 | - padding: 7px 12px; | |
| 86 | - border: 1px solid #ececec; | |
| 87 | - display: inline-block; | |
| 88 | - margin: 5px 2px; | |
| 89 | - min-width: 70px; | |
| 90 | - text-align: center; | |
| 91 | - background: #32C5D2; | |
| 92 | - cursor: move; | |
| 93 | - } | |
| 94 | - | |
| 95 | - .company_search_wrap { | |
| 96 | - width: 610px; | |
| 97 | - margin-left: 6px; | |
| 98 | - } | |
| 99 | - | |
| 100 | - .company_search_wrap select { | |
| 101 | - display: inline-block; | |
| 102 | - width: 128px; | |
| 103 | - margin-right: 12px; | |
| 104 | - } | |
| 105 | - | |
| 106 | - .uk-card { | |
| 107 | - border: 1px solid #eeeeee; | |
| 108 | - } | |
| 109 | - | |
| 110 | - .footer_tools_card { | |
| 111 | - margin-top: 20px; | |
| 112 | - padding: 20px 40px; | |
| 113 | - } | |
| 114 | - | |
| 115 | - .footer_tools_card label { | |
| 116 | - vertical-align: bottom; | |
| 117 | - display: inline-block; | |
| 118 | - font-size: 13px; | |
| 119 | - margin-left: 13px; | |
| 120 | - margin-bottom: 3px !important; | |
| 121 | - } | |
| 122 | - | |
| 123 | - .uk-button-default{ | |
| 124 | - background: #e0e0e0 !important; | |
| 125 | - } | |
| 126 | - | |
| 127 | - .line_list_all_wrap > .item.destroy{ | |
| 128 | - color: #f64242; | |
| 129 | - } | |
| 130 | - | |
| 131 | - .checked_list > .item.destroy{ | |
| 132 | - background: #ff5c5c; | |
| 133 | - } | |
| 134 | - </style> | |
| 135 | -</head> | |
| 136 | - | |
| 137 | -<body> | |
| 138 | -<div class="loading"> | |
| 139 | - <div uk-spinner></div> | |
| 140 | -</div> | |
| 141 | -<div class="ct_page" style="display: none;"> | |
| 142 | - <h2 class="uk-heading-line uk-heading-bullet"><span>线调 <h5 style="display: inline-block;">-选择线路</h5></span></h2> | |
| 143 | - <div class="ct_cont"> | |
| 144 | - <div class="allot_wrap uk-flex-center" uk-grid> | |
| 145 | - <div class="uk-card uk-card-hover uk-card-body uk-width-2-3@m" | |
| 146 | - style="padding-top: 20px;padding-bottom: 20px;"> | |
| 147 | - <div class="company_search_wrap"> | |
| 148 | - <select class="uk-select company_search_select"></select> | |
| 149 | - <select class="uk-select fgs_search_select" disabled> | |
| 150 | - <option value="">分公司搜索</option> | |
| 151 | - </select> | |
| 152 | - <div class="uk-inline"> | |
| 153 | - <span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span> | |
| 154 | - <input class="uk-input line_search_input" style="width: 310px;" placeholder="搜索线路"> | |
| 155 | - </div> | |
| 156 | - </div> | |
| 157 | - <hr> | |
| 158 | - <div class="line_list_all_wrap"></div> | |
| 159 | - <hr> | |
| 160 | - <div class="checked_list" uk-sortable> </div> | |
| 161 | - </div> | |
| 162 | - | |
| 163 | - <div class="uk-card uk-card-hover uk-card-body uk-width-2-3@m footer_tools_card"> | |
| 164 | - <button class="uk-button uk-button-default uk-button-large" style="font-size: 16px" id="go_to_real_system_btn"><i | |
| 165 | - uk-icon=" icon: sign-in" style="margin-right: 5px;" ></i>进入线路调度 | |
| 166 | - </button> | |
| 167 | - <label class="pattern_type_label"><input class="uk-checkbox" type="checkbox" > 主调模式登录</label> | |
| 168 | - <label class="new_window_open_label" title="可能会被浏览器阻止新建窗口" uk-tooltip><input class="uk-checkbox" type="checkbox"> 新窗口打开</label> | |
| 169 | - </div> | |
| 170 | - | |
| 171 | - <div class="uk-alert-warning uk-width-2-3@m " uk-alert> | |
| 172 | - <p>注意!!! 相关“设备调试人员”和“测试人员”不要以主调模式进入线调。</p> | |
| 173 | - </div> | |
| 174 | - </div> | |
| 175 | - </div> | |
| 176 | -</div> | |
| 177 | - | |
| 178 | -<script id="line_list_items_temp" type="text/html"> | |
| 179 | - {{each list as obj i}} | |
| 180 | - <span class="item {{obj.destroy==1?'destroy':''}}" data-id="{{obj.lineCode}}" data-gsbm="{{obj.company}}_{{obj.brancheCompany}}">{{obj.name}}</span> | |
| 181 | - {{/each}} | |
| 182 | -</script> | |
| 183 | - | |
| 184 | -<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script> | |
| 185 | -<script src="/assets/plugins/uk3.0/uikit.min.js"></script> | |
| 186 | -<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script> | |
| 187 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js"></script> | |
| 188 | -<!-- EventProxy --> | |
| 189 | -<script src="/assets/js/eventproxy.js"></script> | |
| 190 | -<!-- art-template 模版引擎 --> | |
| 191 | -<script src="/assets/plugins/template.js"></script> | |
| 192 | -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 193 | -<script src="/assets/plugins/pinyin.js"></script> | |
| 194 | -<script> | |
| 195 | - var allMapps = {};//线路搜索映射 | |
| 196 | - var companyData = {}; | |
| 197 | - var codeMapps={}; //线路编码映射 | |
| 198 | - //滚动条 | |
| 199 | - $('.line_list_all_wrap').perfectScrollbar(); | |
| 200 | - | |
| 201 | - var ep = EventProxy.create('all_lines', 'user_author', 'company_data', function (allLines, userAuthor, company_data) { | |
| 202 | - //按用户权限过滤线路 | |
| 203 | - var authArray = userAuthor.lineCodeStr.split(','), | |
| 204 | - newArray = []; | |
| 205 | - $.each(allLines, function () { | |
| 206 | - if (this.lineCode && authArray.indexOf(this.lineCode) != -1) { | |
| 207 | - newArray.push(this); | |
| 208 | - codeMapps[this.lineCode] = this; | |
| 209 | - } | |
| 210 | - }); | |
| 211 | - //排序 | |
| 212 | - newArray.sort(function (a, b) { | |
| 213 | - return a.name.localeCompare(b.name); | |
| 214 | - }); | |
| 215 | - //创建线路搜索映射 | |
| 216 | - createLineSearchMapps(newArray); | |
| 217 | - | |
| 218 | - var htmlStr = template('line_list_items_temp', {list: newArray}); | |
| 219 | - $('.line_list_all_wrap').html(htmlStr); | |
| 220 | - | |
| 221 | - //过滤公司编码数据 | |
| 222 | - filter_company_data.filter(newArray, convert_buss_data(company_data)); | |
| 223 | - initCompanySelect(); | |
| 224 | - //更新滚动条高度 | |
| 225 | - setTimeout(function () { | |
| 226 | - $('.line_list_all_wrap').perfectScrollbar('update'); | |
| 227 | - }, 1000); | |
| 228 | - | |
| 229 | - //登录模式 | |
| 230 | - changePattern(userAuthor.pattern); | |
| 231 | - if(!userAuthor.pattern) | |
| 232 | - $('.pattern_type_label').hide().find('input')[0].checked=false; | |
| 233 | - else | |
| 234 | - $('input','.pattern_type_label')[0].checked=true; | |
| 235 | - | |
| 236 | - $('.loading').remove(); | |
| 237 | - $('.ct_page').show(); | |
| 238 | - | |
| 239 | - //默认选中上次记录 | |
| 240 | - var lineControlItems = window.localStorage.getItem('lineControlItems'); | |
| 241 | - if (lineControlItems) { | |
| 242 | - var array = JSON.parse(lineControlItems); | |
| 243 | - $.each(array, function (i, line) { | |
| 244 | - $('.item[data-id='+line.lineCode+']','.line_list_all_wrap').trigger('click'); | |
| 245 | - }); | |
| 246 | - } | |
| 247 | - }); | |
| 248 | - | |
| 249 | - $('.pattern_type_label').on('click', function () { | |
| 250 | - var checked = $('input',this)[0].checked; | |
| 251 | - changePattern(checked); | |
| 252 | - }); | |
| 253 | - | |
| 254 | - function changePattern(status) { | |
| 255 | - var btn = $('#go_to_real_system_btn'), | |
| 256 | - def='uk-button-default', | |
| 257 | - prim='uk-button-primary'; | |
| 258 | - if(status){ | |
| 259 | - btn.removeClass(def).addClass(prim); | |
| 260 | - } | |
| 261 | - else{ | |
| 262 | - btn.removeClass(prim).addClass(def); | |
| 263 | - } | |
| 264 | - } | |
| 265 | - | |
| 266 | - /** | |
| 267 | - * 查询所有线路 | |
| 268 | - */ | |
| 269 | - $.get('/line/all', {remove_ne: 1}, function (list) { | |
| 270 | - ep.emit('all_lines', list); | |
| 271 | - }); | |
| 272 | - | |
| 273 | - /**用户分配的线路*/ | |
| 274 | - $.get('/realControAuthority/findByCurrentUser', function (t) { | |
| 275 | - ep.emit('user_author', t); | |
| 276 | - }); | |
| 277 | - | |
| 278 | - /** 查询公司编码 */ | |
| 279 | - $.get('/business/all', function (rs) { | |
| 280 | - ep.emit('company_data', rs); | |
| 281 | - }); | |
| 282 | - | |
| 283 | - //点击选择线路 | |
| 284 | - $('.line_list_all_wrap').on('click', 'span.item', function () { | |
| 285 | - var lineCode = $(this).data('id'), | |
| 286 | - name = $(this).text(); | |
| 287 | - if ($(this).hasClass('active')) { | |
| 288 | - $(this).removeClass('active'); | |
| 289 | - | |
| 290 | - $('.item[data-id='+lineCode+']','.checked_list').remove(); | |
| 291 | - } | |
| 292 | - else { | |
| 293 | - $(this).addClass('active'); | |
| 294 | - var span = $('<span data-id="'+lineCode+'" class="item uk-card uk-card-default uk-animation-slide-bottom '+($(this).hasClass('destroy')?"destroy":"")+'">'+name+'</span>') | |
| 295 | - .one('webkitAnimationEnd', function () { | |
| 296 | - $(this).removeClass('uk-animation-slide-bottom'); | |
| 297 | - }); | |
| 298 | - $('.checked_list').append(span); | |
| 299 | - } | |
| 300 | - }); | |
| 301 | - | |
| 302 | - $('.checked_list').on('click', '.item', function () { | |
| 303 | - var lineCode = $(this).data('id'); | |
| 304 | - $('.item[data-id='+lineCode+']','.line_list_all_wrap').removeClass('active'); | |
| 305 | - $(this).remove(); | |
| 306 | - }); | |
| 307 | - | |
| 308 | - /** | |
| 309 | - * 搜索线路 | |
| 310 | - */ | |
| 311 | - function search_line_list() { | |
| 312 | - var comp = $('select.company_search_select').val(), | |
| 313 | - fgs = $('select.fgs_search_select').val(), | |
| 314 | - gsbm = comp + '_' + fgs; | |
| 315 | - | |
| 316 | - if(gsbm=='_') | |
| 317 | - gsbm=null; | |
| 318 | - var allDoms = $('.line_list_all_wrap span.item'); | |
| 319 | - //线路 | |
| 320 | - var lineCodeArray = []; | |
| 321 | - var t = $('.line_search_input').val(); | |
| 322 | - if(t){ | |
| 323 | - t = t.toUpperCase(); | |
| 324 | - for(var m in allMapps){ | |
| 325 | - if(m.indexOf(t)!=-1) | |
| 326 | - lineCodeArray.push(allMapps[m]); | |
| 327 | - } | |
| 328 | - } | |
| 329 | - | |
| 330 | - //搜索 | |
| 331 | - var show_elems = []; | |
| 332 | - for (var i=0, dom; dom = allDoms[i++];) { | |
| 333 | - if(gsbm && $(dom).data('gsbm').indexOf(gsbm)==-1) | |
| 334 | - continue; | |
| 335 | - | |
| 336 | - if(t && lineCodeArray.indexOf($(dom).data('id')+'') == -1) | |
| 337 | - continue; | |
| 338 | - | |
| 339 | - show_elems.push($(dom)); | |
| 340 | - } | |
| 341 | - | |
| 342 | - //show | |
| 343 | - allDoms.hide(); | |
| 344 | - for(var j=0,$dom;$dom=show_elems[j++];) | |
| 345 | - $dom.show(); | |
| 346 | - } | |
| 347 | - | |
| 348 | - function createLineSearchMapps(list) { | |
| 349 | - allMapps = {}; | |
| 350 | - var name, code; | |
| 351 | - for (var i = 0, line; line = list[i++];) { | |
| 352 | - name = line.name; | |
| 353 | - code = line.lineCode; | |
| 354 | - //拼音映射 | |
| 355 | - allMapps[pinyin.getCamelChars(name)] = code; | |
| 356 | - allMapps[pinyin.getFullChars(name).toUpperCase()] = code; | |
| 357 | - //中文映射 | |
| 358 | - allMapps[name] = code; | |
| 359 | - } | |
| 360 | - } | |
| 361 | - | |
| 362 | - | |
| 363 | - //构建公司级联下拉框 | |
| 364 | - function initCompanySelect() { | |
| 365 | - var opts = '<option value="">公司搜索</option>'; | |
| 366 | - for (var k in companyData) { | |
| 367 | - opts += '<option value="' + k + '">' + companyData[k].name + '</option>'; | |
| 368 | - } | |
| 369 | - $('select.company_search_select').html(opts); | |
| 370 | - } | |
| 371 | - | |
| 372 | - //公司切换 | |
| 373 | - $('select.company_search_select').on('change', function () { | |
| 374 | - var opts = '<option value="">分公司搜索</option>', | |
| 375 | - t = $(this).val(), | |
| 376 | - fgsSelect = $('select.fgs_search_select'); | |
| 377 | - if (!t) { | |
| 378 | - fgsSelect.html(opts).attr('disabled', 'disabled'); | |
| 379 | - } | |
| 380 | - else{ | |
| 381 | - var array = companyData[t].childs; | |
| 382 | - for (var i = 0, fgs; fgs = array[i++];) { | |
| 383 | - opts += '<option value="' + fgs.businessCode + '">' + fgs.businessName + '</option>'; | |
| 384 | - } | |
| 385 | - | |
| 386 | - fgsSelect.html(opts).removeAttr('disabled'); | |
| 387 | - } | |
| 388 | - search_line_list(); | |
| 389 | - }); | |
| 390 | - | |
| 391 | - //分公司切换 | |
| 392 | - $('select.fgs_search_select').on('change', search_line_list); | |
| 393 | - | |
| 394 | - //线路文本框输入 | |
| 395 | - var flag; | |
| 396 | - $('.line_search_input').on('input', function () { | |
| 397 | - if(flag) | |
| 398 | - return; | |
| 399 | - flag = true; | |
| 400 | - setTimeout(function () { | |
| 401 | - //延迟 | |
| 402 | - search_line_list(); | |
| 403 | - flag = false; | |
| 404 | - }, 200); | |
| 405 | - }); | |
| 406 | - | |
| 407 | - function convert_buss_data(rs) { | |
| 408 | - var baseCode; | |
| 409 | - //找到跟节点 | |
| 410 | - $.each(rs, function () { | |
| 411 | - if (this.upCode == 0) { | |
| 412 | - baseCode = this.businessCode; | |
| 413 | - return false; | |
| 414 | - } | |
| 415 | - }); | |
| 416 | - if (!baseCode)return; | |
| 417 | - //提取二级节点 | |
| 418 | - var secondMap = {}; | |
| 419 | - $.each(rs, function () { | |
| 420 | - if (this.upCode == baseCode) | |
| 421 | - secondMap[this.businessCode] = {name: this.businessName, childs: []}; | |
| 422 | - }); | |
| 423 | - //分公司节点 | |
| 424 | - $.each(rs, function () { | |
| 425 | - if (secondMap[this.upCode]) | |
| 426 | - secondMap[this.upCode].childs.push(this); | |
| 427 | - }); | |
| 428 | - //排序 | |
| 429 | - for (var sid in secondMap) | |
| 430 | - secondMap[sid].childs.sort(naturalSort); | |
| 431 | - return secondMap; | |
| 432 | - } | |
| 433 | - | |
| 434 | - var naturalSort = function (a, b) { | |
| 435 | - return a.businessName.localeCompare(b.businessName); | |
| 436 | - }; | |
| 437 | - | |
| 438 | - /** | |
| 439 | - * 根据用户线路权限过滤公司编码数据 | |
| 440 | - */ | |
| 441 | - var filter_company_data = (function () { | |
| 442 | - var filter = function (lineArray, data) { | |
| 443 | - companyData = {}; | |
| 444 | - var com, fCom; | |
| 445 | - $.each(lineArray, function () { | |
| 446 | - com = this.company; | |
| 447 | - fCom = this.brancheCompany; | |
| 448 | - if (!companyData[com]) { | |
| 449 | - companyData[com] = {name: data[com].name, childs: []}; | |
| 450 | - } | |
| 451 | - | |
| 452 | - if (!get(fCom, companyData[com].childs)) { | |
| 453 | - companyData[com].childs.push(get(fCom, data[com].childs)); | |
| 454 | - } | |
| 455 | - }); | |
| 456 | - }; | |
| 457 | - | |
| 458 | - function get(fgsCode, fgsArray) { | |
| 459 | - for (var i = 0, fgs; fgs = fgsArray[i++];) { | |
| 460 | - if (fgs.businessCode == fgsCode) | |
| 461 | - return fgs; | |
| 462 | - } | |
| 463 | - return null; | |
| 464 | - } | |
| 465 | - | |
| 466 | - return { | |
| 467 | - filter: filter | |
| 468 | - } | |
| 469 | - })(); | |
| 470 | - var storage = window.localStorage; | |
| 471 | - $('#go_to_real_system_btn').on('click', go_to_xd_sys); | |
| 472 | - /** | |
| 473 | - * 进入线调 | |
| 474 | - */ | |
| 475 | - function go_to_xd_sys() { | |
| 476 | - var items = $('.checked_list .item'); | |
| 477 | - if(items.length==0) | |
| 478 | - return UIkit.notification({message: '你还没有选择线路!', pos: 'bottom-center', status: 'danger'}); | |
| 479 | - $(this).attr('disabled', 'disabled'); | |
| 480 | - | |
| 481 | - show_btn_load(this, '更新缓存数据...'); | |
| 482 | - (function () { | |
| 483 | - var ls_line_data = []; | |
| 484 | - $.each(items, function () { | |
| 485 | - ls_line_data.push(codeMapps[$(this).data('id')]); | |
| 486 | - }); | |
| 487 | - //监控模式还是主调模式 | |
| 488 | - storage.setItem('operationMode', $('.pattern_type_label>input')[0].checked?1:0); | |
| 489 | - | |
| 490 | - //进入线调 | |
| 491 | - var eq = EventProxy.create('cache_line_level', 'cache_mv_route', 'cache_route', 'check_line_config', function (lineLevel) { | |
| 492 | - debugger; | |
| 493 | - var newWinOpen = $('input','.new_window_open_label')[0].checked; | |
| 494 | - if(!newWinOpen) | |
| 495 | - top.window.location.href = "/real_control/v2"; | |
| 496 | - else{ | |
| 497 | - window.open("/real_control/v2"); | |
| 498 | - $('#go_to_real_system_btn').html('已经尝试打开新窗口,如看不到,可能被浏览器阻止了'); | |
| 499 | - } | |
| 500 | - | |
| 501 | - // 将线路级别赋值 | |
| 502 | - $.each(ls_line_data, function () { | |
| 503 | - this.lineLevel = lineLevel[this.lineCode]; | |
| 504 | - }); | |
| 505 | - // 将线路基础信息写入localStorage | |
| 506 | - storage.setItem('lineControlItems', JSON.stringify(ls_line_data)); | |
| 507 | - }); | |
| 508 | - | |
| 509 | - //拼接线路编码 | |
| 510 | - var idx=''; | |
| 511 | - $.each(ls_line_data, function () { | |
| 512 | - idx+=(this.lineCode + ','); | |
| 513 | - }); | |
| 514 | - //缓存路由 | |
| 515 | - idx=idx.substr(0, idx.length - 1); | |
| 516 | - | |
| 517 | - $.get('/realSchedule/lineLevel', {idx: idx}, function (rs) { | |
| 518 | - if (rs) { | |
| 519 | - eq.emit('cache_line_level', rs); | |
| 520 | - } | |
| 521 | - }); | |
| 522 | - | |
| 523 | - $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) { | |
| 524 | - if (rs) { | |
| 525 | - for(var lineCode in rs) | |
| 526 | - storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode])); | |
| 527 | - eq.emit('cache_mv_route'); | |
| 528 | - } | |
| 529 | - }); | |
| 530 | - | |
| 531 | - $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) { | |
| 532 | - if (rs) { | |
| 533 | - for(var lineCode in rs) | |
| 534 | - storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode])); | |
| 535 | - | |
| 536 | - eq.emit('cache_route'); | |
| 537 | - } | |
| 538 | - }); | |
| 539 | - | |
| 540 | - | |
| 541 | - //检查线路配置 | |
| 542 | - checkLineConfig(ls_line_data, function (rs) { | |
| 543 | - if (rs.status == 0) | |
| 544 | - eq.emit('check_line_config'); | |
| 545 | - else if (rs.status == 1){ | |
| 546 | - initLineConfig(rs.not, function () { | |
| 547 | - eq.emit('check_line_config'); | |
| 548 | - }); | |
| 549 | - } | |
| 550 | - }) | |
| 551 | - })(); | |
| 552 | - } | |
| 553 | - | |
| 554 | - function checkLineConfig(lsData, cb) { | |
| 555 | - var lineCodeArray = []; | |
| 556 | - $.each(lsData, function () { | |
| 557 | - lineCodeArray.push(this.lineCode); | |
| 558 | - }); | |
| 559 | - | |
| 560 | - $.ajax({ | |
| 561 | - url: '/lineConfig/check', | |
| 562 | - traditional: true, | |
| 563 | - data: {codeArray: lineCodeArray}, | |
| 564 | - method: 'POST', | |
| 565 | - success: cb | |
| 566 | - }); | |
| 567 | - } | |
| 568 | - | |
| 569 | - function initLineConfig(arr, cb) { | |
| 570 | - var i = 0; | |
| 571 | - (function () { | |
| 572 | - if (i >= arr.length) { | |
| 573 | - cb && cb(); | |
| 574 | - return; | |
| 575 | - } | |
| 576 | - var f = arguments.callee | |
| 577 | - , lineCode = arr[i]; | |
| 578 | - | |
| 579 | - //showLoad('初始化' + lineIds[lineCode] + '配置信息...'); | |
| 580 | - $.post('/lineConfig/init/' + lineCode, function (rs) { | |
| 581 | - if (rs == 1) { | |
| 582 | - i++; | |
| 583 | - f(); | |
| 584 | - } | |
| 585 | - }); | |
| 586 | - })(); | |
| 587 | - } | |
| 588 | - | |
| 589 | - /** | |
| 590 | - * 按钮转菊花 | |
| 591 | - */ | |
| 592 | - function show_btn_load(btn, msg) { | |
| 593 | - $(btn).html('<div uk-spinner></div> ' + msg); | |
| 594 | - } | |
| 595 | -</script> | |
| 596 | -</body> | |
| 1 | +<!DOCTYPE html> | |
| 2 | +<html lang="zh-cn"> | |
| 3 | + | |
| 4 | +<head> | |
| 5 | + <meta charset="UTF-8"> | |
| 6 | + <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/> | |
| 7 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css"/> | |
| 8 | + <!-- flatpickr --> | |
| 9 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css"> | |
| 10 | + <style> | |
| 11 | + html, body { | |
| 12 | + height: 100%; | |
| 13 | + } | |
| 14 | + | |
| 15 | + .ct_page { | |
| 16 | + padding: 25px 15px; | |
| 17 | + height: 100%; | |
| 18 | + height: calc(100% - 65px); | |
| 19 | + } | |
| 20 | + | |
| 21 | + .ct_cont { | |
| 22 | + height: calc(100% - 41px); | |
| 23 | + } | |
| 24 | + | |
| 25 | + .ct_cont > div > div.uk-card { | |
| 26 | + height: 99%; | |
| 27 | + } | |
| 28 | + | |
| 29 | + .loading { | |
| 30 | + height: 100%; | |
| 31 | + text-align: center; | |
| 32 | + } | |
| 33 | + | |
| 34 | + .loading .uk-spinner { | |
| 35 | + margin-top: 200px; | |
| 36 | + } | |
| 37 | + | |
| 38 | + .loading circle { | |
| 39 | + stroke: red; | |
| 40 | + } | |
| 41 | + | |
| 42 | + .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail { | |
| 43 | + opacity: 0.6 !important; | |
| 44 | + padding: 0 !important; | |
| 45 | + } | |
| 46 | + | |
| 47 | + .line_list_all_wrap { | |
| 48 | + height: 200px; | |
| 49 | + overflow: auto; | |
| 50 | + position: relative; | |
| 51 | + -webkit-user-select:none; | |
| 52 | + -moz-user-select:none; | |
| 53 | + -ms-user-select:none; | |
| 54 | + user-select:none; | |
| 55 | + } | |
| 56 | + | |
| 57 | + .line_list_all_wrap > .item { | |
| 58 | + background: #fff; | |
| 59 | + color: #666; | |
| 60 | + box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.08); | |
| 61 | + padding: 7px 12px; | |
| 62 | + border: 1px solid #ececec; | |
| 63 | + display: inline-block; | |
| 64 | + margin: 5px; | |
| 65 | + min-width: 70px; | |
| 66 | + text-align: center; | |
| 67 | + cursor: default; | |
| 68 | + } | |
| 69 | + | |
| 70 | + .line_list_all_wrap > .item.active{ | |
| 71 | + background: #ffe9a5; | |
| 72 | + } | |
| 73 | + | |
| 74 | + .checked_list { | |
| 75 | + padding-left: 4px; | |
| 76 | + -webkit-user-select:none; | |
| 77 | + -moz-user-select:none; | |
| 78 | + -ms-user-select:none; | |
| 79 | + user-select:none; | |
| 80 | + } | |
| 81 | + | |
| 82 | + .checked_list > .item { | |
| 83 | + color: #fbfbfb; | |
| 84 | + box-shadow: 0px 3px 12px rgba(50, 197, 210, 0.3); | |
| 85 | + padding: 7px 12px; | |
| 86 | + border: 1px solid #ececec; | |
| 87 | + display: inline-block; | |
| 88 | + margin: 5px 2px; | |
| 89 | + min-width: 70px; | |
| 90 | + text-align: center; | |
| 91 | + background: #32C5D2; | |
| 92 | + cursor: move; | |
| 93 | + } | |
| 94 | + | |
| 95 | + .company_search_wrap { | |
| 96 | + width: 610px; | |
| 97 | + margin-left: 6px; | |
| 98 | + } | |
| 99 | + | |
| 100 | + .company_search_wrap select { | |
| 101 | + display: inline-block; | |
| 102 | + width: 128px; | |
| 103 | + margin-right: 12px; | |
| 104 | + } | |
| 105 | + | |
| 106 | + .uk-card { | |
| 107 | + border: 1px solid #eeeeee; | |
| 108 | + } | |
| 109 | + | |
| 110 | + .footer_tools_card { | |
| 111 | + margin-top: 20px; | |
| 112 | + padding: 20px 40px; | |
| 113 | + } | |
| 114 | + | |
| 115 | + .footer_tools_card label { | |
| 116 | + vertical-align: bottom; | |
| 117 | + display: inline-block; | |
| 118 | + font-size: 13px; | |
| 119 | + margin-left: 13px; | |
| 120 | + margin-bottom: 3px !important; | |
| 121 | + } | |
| 122 | + | |
| 123 | + .uk-button-default{ | |
| 124 | + background: #e0e0e0 !important; | |
| 125 | + } | |
| 126 | + | |
| 127 | + .line_list_all_wrap > .item.destroy{ | |
| 128 | + color: #f64242; | |
| 129 | + } | |
| 130 | + | |
| 131 | + .checked_list > .item.destroy{ | |
| 132 | + background: #ff5c5c; | |
| 133 | + } | |
| 134 | + </style> | |
| 135 | +</head> | |
| 136 | + | |
| 137 | +<body> | |
| 138 | +<div class="loading"> | |
| 139 | + <div uk-spinner></div> | |
| 140 | +</div> | |
| 141 | +<div class="ct_page" style="display: none;"> | |
| 142 | + <h2 class="uk-heading-line uk-heading-bullet"><span>线调 <h5 style="display: inline-block;">-选择线路</h5></span></h2> | |
| 143 | + <div class="ct_cont"> | |
| 144 | + <div class="allot_wrap uk-flex-center" uk-grid> | |
| 145 | + <div class="uk-card uk-card-hover uk-card-body uk-width-2-3@m" | |
| 146 | + style="padding-top: 20px;padding-bottom: 20px;"> | |
| 147 | + <div class="company_search_wrap"> | |
| 148 | + <select class="uk-select company_search_select"></select> | |
| 149 | + <select class="uk-select fgs_search_select" disabled> | |
| 150 | + <option value="">分公司搜索</option> | |
| 151 | + </select> | |
| 152 | + <div class="uk-inline"> | |
| 153 | + <span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span> | |
| 154 | + <input class="uk-input line_search_input" style="width: 310px;" placeholder="搜索线路"> | |
| 155 | + </div> | |
| 156 | + </div> | |
| 157 | + <hr> | |
| 158 | + <div class="line_list_all_wrap"></div> | |
| 159 | + <hr> | |
| 160 | + <div class="checked_list" uk-sortable> </div> | |
| 161 | + </div> | |
| 162 | + | |
| 163 | + <div class="uk-card uk-card-hover uk-card-body uk-width-2-3@m footer_tools_card"> | |
| 164 | + <button class="uk-button uk-button-default uk-button-large" style="font-size: 16px" id="go_to_real_system_btn"><i | |
| 165 | + uk-icon=" icon: sign-in" style="margin-right: 5px;" ></i>进入线路调度 | |
| 166 | + </button> | |
| 167 | + <label class="pattern_type_label"><input class="uk-checkbox" type="checkbox" > 主调模式登录</label> | |
| 168 | + <label class="new_window_open_label" title="可能会被浏览器阻止新建窗口" uk-tooltip><input class="uk-checkbox" type="checkbox"> 新窗口打开</label> | |
| 169 | + </div> | |
| 170 | + | |
| 171 | + <div class="uk-alert-warning uk-width-2-3@m " uk-alert> | |
| 172 | + <p>注意!!! 相关“设备调试人员”和“测试人员”不要以主调模式进入线调。</p> | |
| 173 | + </div> | |
| 174 | + </div> | |
| 175 | + </div> | |
| 176 | +</div> | |
| 177 | + | |
| 178 | +<script id="line_list_items_temp" type="text/html"> | |
| 179 | + {{each list as obj i}} | |
| 180 | + <span class="item {{obj.destroy==1?'destroy':''}}" data-id="{{obj.lineCode}}" data-gsbm="{{obj.company}}_{{obj.brancheCompany}}">{{obj.name}}</span> | |
| 181 | + {{/each}} | |
| 182 | +</script> | |
| 183 | + | |
| 184 | +<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script> | |
| 185 | +<script src="/assets/plugins/uk3.0/uikit.min.js"></script> | |
| 186 | +<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script> | |
| 187 | +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js"></script> | |
| 188 | +<!-- EventProxy --> | |
| 189 | +<script src="/assets/js/eventproxy.js"></script> | |
| 190 | +<!-- art-template 模版引擎 --> | |
| 191 | +<script src="/assets/plugins/template.js"></script> | |
| 192 | +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 193 | +<script src="/assets/plugins/pinyin.js"></script> | |
| 194 | +<script> | |
| 195 | + var allMapps = {};//线路搜索映射 | |
| 196 | + var companyData = {}; | |
| 197 | + var codeMapps={}; //线路编码映射 | |
| 198 | + //滚动条 | |
| 199 | + $('.line_list_all_wrap').perfectScrollbar(); | |
| 200 | + | |
| 201 | + var ep = EventProxy.create('all_lines', 'user_author', 'company_data', function (allLines, userAuthor, company_data) { | |
| 202 | + //按用户权限过滤线路 | |
| 203 | + var authArray = userAuthor.lineCodeStr.split(','), | |
| 204 | + newArray = []; | |
| 205 | + $.each(allLines, function () { | |
| 206 | + if (this.lineCode && authArray.indexOf(this.lineCode) != -1) { | |
| 207 | + newArray.push(this); | |
| 208 | + codeMapps[this.lineCode] = this; | |
| 209 | + } | |
| 210 | + }); | |
| 211 | + //排序 | |
| 212 | + newArray.sort(function (a, b) { | |
| 213 | + return a.name.localeCompare(b.name); | |
| 214 | + }); | |
| 215 | + //创建线路搜索映射 | |
| 216 | + createLineSearchMapps(newArray); | |
| 217 | + | |
| 218 | + var htmlStr = template('line_list_items_temp', {list: newArray}); | |
| 219 | + $('.line_list_all_wrap').html(htmlStr); | |
| 220 | + | |
| 221 | + //过滤公司编码数据 | |
| 222 | + filter_company_data.filter(newArray, convert_buss_data(company_data)); | |
| 223 | + initCompanySelect(); | |
| 224 | + //更新滚动条高度 | |
| 225 | + setTimeout(function () { | |
| 226 | + $('.line_list_all_wrap').perfectScrollbar('update'); | |
| 227 | + }, 1000); | |
| 228 | + | |
| 229 | + //登录模式 | |
| 230 | + changePattern(userAuthor.pattern); | |
| 231 | + if(!userAuthor.pattern) | |
| 232 | + $('.pattern_type_label').hide().find('input')[0].checked=false; | |
| 233 | + else | |
| 234 | + $('input','.pattern_type_label')[0].checked=true; | |
| 235 | + | |
| 236 | + $('.loading').remove(); | |
| 237 | + $('.ct_page').show(); | |
| 238 | + | |
| 239 | + //默认选中上次记录 | |
| 240 | + var lineControlItems = window.localStorage.getItem('lineControlItems'); | |
| 241 | + if (lineControlItems) { | |
| 242 | + var array = JSON.parse(lineControlItems); | |
| 243 | + $.each(array, function (i, line) { | |
| 244 | + $('.item[data-id='+line.lineCode+']','.line_list_all_wrap').trigger('click'); | |
| 245 | + }); | |
| 246 | + } | |
| 247 | + | |
| 248 | + var storage = window.localStorage, keys = new Array(); | |
| 249 | + for (var i = 0;i < storage.length;i++) { | |
| 250 | + var key=storage.key(i); | |
| 251 | + if (key.indexOf('_route') > 0) { | |
| 252 | + keys.push(key); | |
| 253 | + } | |
| 254 | + } | |
| 255 | + for (var i = 0;i < keys.length;i++) { | |
| 256 | + storage.removeItem(keys[i]); | |
| 257 | + } | |
| 258 | + }); | |
| 259 | + | |
| 260 | + $('.pattern_type_label').on('click', function () { | |
| 261 | + var checked = $('input',this)[0].checked; | |
| 262 | + changePattern(checked); | |
| 263 | + }); | |
| 264 | + | |
| 265 | + function changePattern(status) { | |
| 266 | + var btn = $('#go_to_real_system_btn'), | |
| 267 | + def='uk-button-default', | |
| 268 | + prim='uk-button-primary'; | |
| 269 | + if(status){ | |
| 270 | + btn.removeClass(def).addClass(prim); | |
| 271 | + } | |
| 272 | + else{ | |
| 273 | + btn.removeClass(prim).addClass(def); | |
| 274 | + } | |
| 275 | + } | |
| 276 | + | |
| 277 | + /** | |
| 278 | + * 查询所有线路 | |
| 279 | + */ | |
| 280 | + $.get('/line/all', {remove_ne: 1}, function (list) { | |
| 281 | + ep.emit('all_lines', list); | |
| 282 | + }); | |
| 283 | + | |
| 284 | + /**用户分配的线路*/ | |
| 285 | + $.get('/realControAuthority/findByCurrentUser', function (t) { | |
| 286 | + ep.emit('user_author', t); | |
| 287 | + }); | |
| 288 | + | |
| 289 | + /** 查询公司编码 */ | |
| 290 | + $.get('/business/all', function (rs) { | |
| 291 | + ep.emit('company_data', rs); | |
| 292 | + }); | |
| 293 | + | |
| 294 | + //点击选择线路 | |
| 295 | + $('.line_list_all_wrap').on('click', 'span.item', function () { | |
| 296 | + var lineCode = $(this).data('id'), | |
| 297 | + name = $(this).text(); | |
| 298 | + if ($(this).hasClass('active')) { | |
| 299 | + $(this).removeClass('active'); | |
| 300 | + | |
| 301 | + $('.item[data-id='+lineCode+']','.checked_list').remove(); | |
| 302 | + } | |
| 303 | + else { | |
| 304 | + $(this).addClass('active'); | |
| 305 | + var span = $('<span data-id="'+lineCode+'" class="item uk-card uk-card-default uk-animation-slide-bottom '+($(this).hasClass('destroy')?"destroy":"")+'">'+name+'</span>') | |
| 306 | + .one('webkitAnimationEnd', function () { | |
| 307 | + $(this).removeClass('uk-animation-slide-bottom'); | |
| 308 | + }); | |
| 309 | + $('.checked_list').append(span); | |
| 310 | + } | |
| 311 | + }); | |
| 312 | + | |
| 313 | + $('.checked_list').on('click', '.item', function () { | |
| 314 | + var lineCode = $(this).data('id'); | |
| 315 | + $('.item[data-id='+lineCode+']','.line_list_all_wrap').removeClass('active'); | |
| 316 | + $(this).remove(); | |
| 317 | + }); | |
| 318 | + | |
| 319 | + /** | |
| 320 | + * 搜索线路 | |
| 321 | + */ | |
| 322 | + function search_line_list() { | |
| 323 | + var comp = $('select.company_search_select').val(), | |
| 324 | + fgs = $('select.fgs_search_select').val(), | |
| 325 | + gsbm = comp + '_' + fgs; | |
| 326 | + | |
| 327 | + if(gsbm=='_') | |
| 328 | + gsbm=null; | |
| 329 | + var allDoms = $('.line_list_all_wrap span.item'); | |
| 330 | + //线路 | |
| 331 | + var lineCodeArray = []; | |
| 332 | + var t = $('.line_search_input').val(); | |
| 333 | + if(t){ | |
| 334 | + t = t.toUpperCase(); | |
| 335 | + for(var m in allMapps){ | |
| 336 | + if(m.indexOf(t)!=-1) | |
| 337 | + lineCodeArray.push(allMapps[m]); | |
| 338 | + } | |
| 339 | + } | |
| 340 | + | |
| 341 | + //搜索 | |
| 342 | + var show_elems = []; | |
| 343 | + for (var i=0, dom; dom = allDoms[i++];) { | |
| 344 | + if(gsbm && $(dom).data('gsbm').indexOf(gsbm)==-1) | |
| 345 | + continue; | |
| 346 | + | |
| 347 | + if(t && lineCodeArray.indexOf($(dom).data('id')+'') == -1) | |
| 348 | + continue; | |
| 349 | + | |
| 350 | + show_elems.push($(dom)); | |
| 351 | + } | |
| 352 | + | |
| 353 | + //show | |
| 354 | + allDoms.hide(); | |
| 355 | + for(var j=0,$dom;$dom=show_elems[j++];) | |
| 356 | + $dom.show(); | |
| 357 | + } | |
| 358 | + | |
| 359 | + function createLineSearchMapps(list) { | |
| 360 | + allMapps = {}; | |
| 361 | + var name, code; | |
| 362 | + for (var i = 0, line; line = list[i++];) { | |
| 363 | + name = line.name; | |
| 364 | + code = line.lineCode; | |
| 365 | + //拼音映射 | |
| 366 | + allMapps[pinyin.getCamelChars(name)] = code; | |
| 367 | + allMapps[pinyin.getFullChars(name).toUpperCase()] = code; | |
| 368 | + //中文映射 | |
| 369 | + allMapps[name] = code; | |
| 370 | + } | |
| 371 | + } | |
| 372 | + | |
| 373 | + | |
| 374 | + //构建公司级联下拉框 | |
| 375 | + function initCompanySelect() { | |
| 376 | + var opts = '<option value="">公司搜索</option>'; | |
| 377 | + for (var k in companyData) { | |
| 378 | + opts += '<option value="' + k + '">' + companyData[k].name + '</option>'; | |
| 379 | + } | |
| 380 | + $('select.company_search_select').html(opts); | |
| 381 | + } | |
| 382 | + | |
| 383 | + //公司切换 | |
| 384 | + $('select.company_search_select').on('change', function () { | |
| 385 | + var opts = '<option value="">分公司搜索</option>', | |
| 386 | + t = $(this).val(), | |
| 387 | + fgsSelect = $('select.fgs_search_select'); | |
| 388 | + if (!t) { | |
| 389 | + fgsSelect.html(opts).attr('disabled', 'disabled'); | |
| 390 | + } | |
| 391 | + else{ | |
| 392 | + var array = companyData[t].childs; | |
| 393 | + for (var i = 0, fgs; fgs = array[i++];) { | |
| 394 | + opts += '<option value="' + fgs.businessCode + '">' + fgs.businessName + '</option>'; | |
| 395 | + } | |
| 396 | + | |
| 397 | + fgsSelect.html(opts).removeAttr('disabled'); | |
| 398 | + } | |
| 399 | + search_line_list(); | |
| 400 | + }); | |
| 401 | + | |
| 402 | + //分公司切换 | |
| 403 | + $('select.fgs_search_select').on('change', search_line_list); | |
| 404 | + | |
| 405 | + //线路文本框输入 | |
| 406 | + var flag; | |
| 407 | + $('.line_search_input').on('input', function () { | |
| 408 | + if(flag) | |
| 409 | + return; | |
| 410 | + flag = true; | |
| 411 | + setTimeout(function () { | |
| 412 | + //延迟 | |
| 413 | + search_line_list(); | |
| 414 | + flag = false; | |
| 415 | + }, 200); | |
| 416 | + }); | |
| 417 | + | |
| 418 | + function convert_buss_data(rs) { | |
| 419 | + var baseCode; | |
| 420 | + //找到跟节点 | |
| 421 | + $.each(rs, function () { | |
| 422 | + if (this.upCode == 0) { | |
| 423 | + baseCode = this.businessCode; | |
| 424 | + return false; | |
| 425 | + } | |
| 426 | + }); | |
| 427 | + if (!baseCode)return; | |
| 428 | + //提取二级节点 | |
| 429 | + var secondMap = {}; | |
| 430 | + $.each(rs, function () { | |
| 431 | + if (this.upCode == baseCode) | |
| 432 | + secondMap[this.businessCode] = {name: this.businessName, childs: []}; | |
| 433 | + }); | |
| 434 | + //分公司节点 | |
| 435 | + $.each(rs, function () { | |
| 436 | + if (secondMap[this.upCode]) | |
| 437 | + secondMap[this.upCode].childs.push(this); | |
| 438 | + }); | |
| 439 | + //排序 | |
| 440 | + for (var sid in secondMap) | |
| 441 | + secondMap[sid].childs.sort(naturalSort); | |
| 442 | + return secondMap; | |
| 443 | + } | |
| 444 | + | |
| 445 | + var naturalSort = function (a, b) { | |
| 446 | + return a.businessName.localeCompare(b.businessName); | |
| 447 | + }; | |
| 448 | + | |
| 449 | + /** | |
| 450 | + * 根据用户线路权限过滤公司编码数据 | |
| 451 | + */ | |
| 452 | + var filter_company_data = (function () { | |
| 453 | + var filter = function (lineArray, data) { | |
| 454 | + companyData = {}; | |
| 455 | + var com, fCom; | |
| 456 | + $.each(lineArray, function () { | |
| 457 | + com = this.company; | |
| 458 | + fCom = this.brancheCompany; | |
| 459 | + if (!companyData[com]) { | |
| 460 | + companyData[com] = {name: data[com].name, childs: []}; | |
| 461 | + } | |
| 462 | + | |
| 463 | + if (!get(fCom, companyData[com].childs)) { | |
| 464 | + companyData[com].childs.push(get(fCom, data[com].childs)); | |
| 465 | + } | |
| 466 | + }); | |
| 467 | + }; | |
| 468 | + | |
| 469 | + function get(fgsCode, fgsArray) { | |
| 470 | + for (var i = 0, fgs; fgs = fgsArray[i++];) { | |
| 471 | + if (fgs.businessCode == fgsCode) | |
| 472 | + return fgs; | |
| 473 | + } | |
| 474 | + return null; | |
| 475 | + } | |
| 476 | + | |
| 477 | + return { | |
| 478 | + filter: filter | |
| 479 | + } | |
| 480 | + })(); | |
| 481 | + var storage = window.localStorage; | |
| 482 | + $('#go_to_real_system_btn').on('click', go_to_xd_sys); | |
| 483 | + /** | |
| 484 | + * 进入线调 | |
| 485 | + */ | |
| 486 | + function go_to_xd_sys() { | |
| 487 | + var items = $('.checked_list .item'); | |
| 488 | + if(items.length==0) | |
| 489 | + return UIkit.notification({message: '你还没有选择线路!', pos: 'bottom-center', status: 'danger'}); | |
| 490 | + $(this).attr('disabled', 'disabled'); | |
| 491 | + | |
| 492 | + show_btn_load(this, '更新缓存数据...'); | |
| 493 | + (function () { | |
| 494 | + var ls_line_data = []; | |
| 495 | + $.each(items, function () { | |
| 496 | + ls_line_data.push(codeMapps[$(this).data('id')]); | |
| 497 | + }); | |
| 498 | + //监控模式还是主调模式 | |
| 499 | + storage.setItem('operationMode', $('.pattern_type_label>input')[0].checked?1:0); | |
| 500 | + | |
| 501 | + //进入线调 | |
| 502 | + var eq = EventProxy.create('cache_line_level', 'cache_mv_route', 'cache_route', 'check_line_config', function (lineLevel) { | |
| 503 | + debugger; | |
| 504 | + var newWinOpen = $('input','.new_window_open_label')[0].checked; | |
| 505 | + if(!newWinOpen) | |
| 506 | + top.window.location.href = "/real_control/v2"; | |
| 507 | + else{ | |
| 508 | + window.open("/real_control/v2"); | |
| 509 | + $('#go_to_real_system_btn').html('已经尝试打开新窗口,如看不到,可能被浏览器阻止了'); | |
| 510 | + } | |
| 511 | + | |
| 512 | + // 将线路级别赋值 | |
| 513 | + $.each(ls_line_data, function () { | |
| 514 | + this.lineLevel = lineLevel[this.lineCode]; | |
| 515 | + }); | |
| 516 | + // 将线路基础信息写入localStorage | |
| 517 | + storage.setItem('lineControlItems', JSON.stringify(ls_line_data)); | |
| 518 | + }); | |
| 519 | + | |
| 520 | + //拼接线路编码 | |
| 521 | + var idx=''; | |
| 522 | + $.each(ls_line_data, function () { | |
| 523 | + idx+=(this.lineCode + ','); | |
| 524 | + }); | |
| 525 | + //缓存路由 | |
| 526 | + idx=idx.substr(0, idx.length - 1); | |
| 527 | + | |
| 528 | + $.get('/realSchedule/lineLevel', {idx: idx}, function (rs) { | |
| 529 | + if (rs) { | |
| 530 | + eq.emit('cache_line_level', rs); | |
| 531 | + } | |
| 532 | + }); | |
| 533 | + | |
| 534 | + $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) { | |
| 535 | + if (rs) { | |
| 536 | + for(var lineCode in rs) | |
| 537 | + storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode])); | |
| 538 | + eq.emit('cache_mv_route'); | |
| 539 | + } | |
| 540 | + }); | |
| 541 | + | |
| 542 | + $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) { | |
| 543 | + if (rs) { | |
| 544 | + for(var lineCode in rs) | |
| 545 | + storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode])); | |
| 546 | + | |
| 547 | + eq.emit('cache_route'); | |
| 548 | + } | |
| 549 | + }); | |
| 550 | + | |
| 551 | + | |
| 552 | + //检查线路配置 | |
| 553 | + checkLineConfig(ls_line_data, function (rs) { | |
| 554 | + if (rs.status == 0) | |
| 555 | + eq.emit('check_line_config'); | |
| 556 | + else if (rs.status == 1){ | |
| 557 | + initLineConfig(rs.not, function () { | |
| 558 | + eq.emit('check_line_config'); | |
| 559 | + }); | |
| 560 | + } | |
| 561 | + }) | |
| 562 | + })(); | |
| 563 | + } | |
| 564 | + | |
| 565 | + function checkLineConfig(lsData, cb) { | |
| 566 | + var lineCodeArray = []; | |
| 567 | + $.each(lsData, function () { | |
| 568 | + lineCodeArray.push(this.lineCode); | |
| 569 | + }); | |
| 570 | + | |
| 571 | + $.ajax({ | |
| 572 | + url: '/lineConfig/check', | |
| 573 | + traditional: true, | |
| 574 | + data: {codeArray: lineCodeArray}, | |
| 575 | + method: 'POST', | |
| 576 | + success: cb | |
| 577 | + }); | |
| 578 | + } | |
| 579 | + | |
| 580 | + function initLineConfig(arr, cb) { | |
| 581 | + var i = 0; | |
| 582 | + (function () { | |
| 583 | + if (i >= arr.length) { | |
| 584 | + cb && cb(); | |
| 585 | + return; | |
| 586 | + } | |
| 587 | + var f = arguments.callee | |
| 588 | + , lineCode = arr[i]; | |
| 589 | + | |
| 590 | + //showLoad('初始化' + lineIds[lineCode] + '配置信息...'); | |
| 591 | + $.post('/lineConfig/init/' + lineCode, function (rs) { | |
| 592 | + if (rs == 1) { | |
| 593 | + i++; | |
| 594 | + f(); | |
| 595 | + } | |
| 596 | + }); | |
| 597 | + })(); | |
| 598 | + } | |
| 599 | + | |
| 600 | + /** | |
| 601 | + * 按钮转菊花 | |
| 602 | + */ | |
| 603 | + function show_btn_load(btn, msg) { | |
| 604 | + $(btn).html('<div uk-spinner></div> ' + msg); | |
| 605 | + } | |
| 606 | +</script> | |
| 607 | +</body> | |
| 597 | 608 | </html> |
| 598 | 609 | \ No newline at end of file | ... | ... |