Commit 138121b24e91d9d09649d30c5e3970d59cae7541

Authored by 王通
1 parent a7a2fbf0

1.添加77_1公司归属

src/main/resources/static/pages/permission/authorize_all/user_auth.html
1   -<!-- 用户线调授权页面 -->
2   -<div id="user_authorize_wrap" style="height: 100%;">
3   - <div class="top_title"></div>
4   -
5   - <div class="xd_line_list">
6   - </div>
7   - <div class="top_tools">
8   - <form class="ct_pattern_form">
9   - <div class="uk-margin">
10   - <div uk-form-custom="target: > * > span:first" style="display: none">
11   - <select id="pattern_select">
12   - <option value="0">监控模式</option>
13   - <option value="1">主调模式</option>
14   - <option value="2">作废模式</option>
15   - </select>
16   - <button class="uk-button uk-button-default" type="button" tabindex="-1">
17   - <span></span>
18   - <span uk-icon="icon: chevron-down"></span>
19   - </button>
20   - </div>
21   - </div>
22   - </form>
23   - <div class="add_line_icon" uk-toggle="target: #select_line_modal">
24   - <i uk-icon="icon: plus"></i> 添加线路
25   - </div>
26   - &nbsp;&nbsp;
27   - <button class="uk-button uk-button-primary uk-button-small" id="global_save_btn">保存哇!</button>
28   - </div>
29   -
30   - <div class="uk-child-width-expand uk-grid-small xd_menu_grid" uk-grid style="display: none;">
31   -
32   - <div>
33   - <h4>数据&统计</h4>
34   - <ul class="uk-list uk-list-large uk-list-divider">
35   - <li><label><input class="uk-checkbox" type="checkbox" data-event="curr_date_schedule"> 当日计划排班</label></li>
36   - <li><label><input class="uk-checkbox" type="checkbox" data-event="cache_data_manage"> 缓存数据管理</label></li>
37   - <li><label><input class="uk-checkbox" type="checkbox" data-event="history_sch_maintain"> 历史路单维护</label></li>
38   - <li><label><input class="uk-checkbox" type="checkbox" data-event="sch_edit_info"> 班次修正日志</label></li>
39   - </ul>
40   - </div>
41   -
42   - <div>
43   - <h4>报表管理</h4>
44   - <ul class="uk-list uk-list-large uk-list-divider">
45   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_waybill"> 行车路单</label></li>
46   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_history_message"> 调度历史消息</label></li>
47   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_account"> 驾驶员请求台账</label></li>
48   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_correctForm"> 修正报表</label></li>
49   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_statisticsDaily"> 统计日报</label></li>
50   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleDaily"> 调度日报</label></li>
51   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_jobSummary"> 工作汇总</label></li>
52   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_daily"> 班次日报表</label></li>
53   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_inoutstation"> 班次到离站</label></li>
54   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_oilListMonth"> 月存油报表</label></li>
55   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleAnaly"> 时刻表分析</label></li>
56   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_message"> 调度消息分析</label></li>
57   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_changetochange"> 换人换车情况统计表</label></li>
58   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_repairReport"> 维修上报记录</label></li>
59   - </ul>
60   - </div>
61   -
62   - <div>
63   - <h4>车载设备</h4>
64   - <ul class="uk-list uk-list-large uk-list-divider">
65   - <li><label><input class="uk-checkbox" type="checkbox" data-event="all_devices"> 设备管理</label></li>
66   - <li><label><input class="uk-checkbox" type="checkbox" data-event="directive_history"> 指令下发记录</label></li>
67   - <li><label><input class="uk-checkbox" type="checkbox" data-event="device_report"> 设备上报记录</label></li>
68   - <li><label><input class="uk-checkbox" type="checkbox" data-event="gps_play_back"> 轨迹回放</label></li>
69   - <li><label><input class="uk-checkbox" type="checkbox" data-event="safe_driving"> 安全驾驶(图像)</label></li>
70   - </ul>
71   - </div>
72   -
73   - <div>
74   - <h4>系统设置</h4>
75   - <ul class="uk-list uk-list-large uk-list-divider">
76   - <li><label><input class="uk-checkbox" type="checkbox" data-event="line_config"> 线路配置</label></li>
77   - <li><label><input class="uk-checkbox" type="checkbox" data-event="fbzdzx_config"> 翻班与自动执行</label></li>
78   - <li><label><input class="uk-checkbox" type="checkbox" data-event="tts_config"> TTS</label></li>
79   - <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li>
80   - </ul>
81   - </div>
82   - <div>
83   - <h4>服务热线系统</h4>
84   - <ul class="uk-list uk-list-large uk-list-divider">
85   - <li><label><input class="uk-checkbox" type="checkbox" data-event="report_register"> 报备登记</label></li>
86   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_report_register"> 报备登记报表</label></li>
87   - </ul>
88   - </div>
89   -
90   - </div>
91   -
92   - <!-- This is the modal -->
93   - <div id="select_line_modal" class="uk-modal-container" uk-modal="bg-close:false;">
94   - <div class="uk-modal-dialog uk-modal-body">
95   - <button class="uk-modal-close-outside" type="button" uk-close></button>
96   - <h2 class="uk-modal-title">添加线路权限</h2>
97   - <div>
98   - <form>
99   - <div class="ct_field" style="width: 140px;">
100   - <label>状态</label>
101   - <select class="uk-select" id="modal_type_select" style="width: 94px;">
102   - <option value="-1">全部</option>
103   - <option value="0">营运</option>
104   - <option value="1">撤销</option>
105   - </select>
106   - </div>
107   - <div class="ct_field">
108   - <label>公司</label>
109   - <select class="uk-select" id="modal_company_select"></select>
110   - </div>
111   - <div class="ct_field">
112   - <label>分公司</label>
113   - <select class="uk-select" id="modal_sub_company_select" disabled></select>
114   - </div>
115   - <div class="ct_field">
116   - <label>线路</label>
117   - <input class="uk-input" id="modal_line_input" placeholder="没做拼音映射!!"/>
118   - </div>
119   - <label><input class="uk-checkbox" type="checkbox" id="globalCheckbox"> 全选</label>
120   - </form>
121   - <div class="uk-modal-body line_checkbox_list" style="padding: 0 !important;" uk-overflow-auto>
122   - </div>
123   - </div>
124   - <p class="uk-text-right">
125   - <button class="uk-button uk-button-default uk-modal-close" type="button">取消</button>
126   - <button class="uk-button uk-button-primary" id="confirmBtn" type="button">确定</button>
127   - </p>
128   - </div>
129   - </div>
130   -
131   - <script id="authorize-user-auth-lines-temp" type="text/html">
132   - {{each list as t i}}
133   - <h5>{{t.fgsName}}</h5>
134   - <div class="sub_lines">
135   - {{each t.list as obj j}}
136   - <span title="{{obj.lineCode}}" class="line_btn {{obj.destroy==1?'destroy':''}}">{{obj.name}}</span>
137   - {{/each}}
138   - </div>
139   - {{/each}}
140   - </script>
141   - <script id="authorize-user-auth-title-temp" type="text/html">
142   - <div style="font-weight: 600;">{{name}}({{userName}})
143   - </div>
144   - <!--<div class="desc">最近登录 {{lastLoginDateStr}}</div>-->
145   - <div class="desc">...</div>
146   - </script>
147   -
148   - <script id="authorize-modal-lines-temp" type="text/html">
149   - {{each list as obj i}}
150   - <label class="btn {{obj.destroy==1?'destroy':''}}" data-gs="{{obj.company}}" data-fgs="{{obj.brancheCompany}}"
151   - title="{{obj.name}}" data-code="{{obj.lineCode}}">
152   - <input class="uk-checkbox" type="checkbox">{{obj.name}}
153   - </label>
154   - {{/each}}
155   - </script>
156   - <script>
157   - (function () {
158   - var wrap = '#user_authorize_wrap', user, xd_auth, all_lines, companyData;
159   - //分公司名称映射(只用于分组展示,就写死)
160   -
161   - var fgs_name_mapp = {
162   - '55_3': '上南公司(六分公司)',
163   - '55_1': '上南公司(二分公司)',
164   - '55_2': '上南公司(三分公司)',
165   - '55_4': '上南公司(一分公司)',
166   - '55_5': '上南公司(培训部)',
167   - '22_2': '金高公司(二分公司)',
168   - '22_1': '金高公司(四分公司)',
169   - '22_3': '金高公司(三分公司)',
170   - '22_5': '金高公司(一分公司)',
171   - '26_3': '南汇公司(三分公司)',
172   - '26_2': '南汇公司(南汇二分)',
173   - '26_1': '南汇公司(南汇一分)',
174   - '26_4': '南汇公司(南汇维修公司)',
175   - '26_5': '南汇公司(南汇公司)',
176   - '26_6': '南汇公司(南汇六分)',
177   - '05_5': '杨高公司(杨高分公司)',
178   - '05_6': '杨高公司(周浦分公司)',
179   - '05_3': '杨高公司(芦潮港分公司)',
180   - '05_1': '杨高公司(川沙分公司)',
181   - '05_2': '杨高公司(金桥分公司)',
182   - '77_78': '闵行公司',
183   - '300_301': '金球公交',
184   - '99_100': '青浦公交',
185   - '24_1': '一车队',
186   - '24_2': '二车队',
187   - '24_3': '三车队'
188   -
189   - };
190   -
191   - var defauleConfig;
192   - var patSelect;
193   - $(wrap).on('init', function (e, data) {
194   - e.stopPropagation();
195   - user = data.user;
196   - all_lines = data.lineArray;
197   - companyData = data.companyData;
198   -
199   - all_lines.sort(function (a, b) {
200   - return a.name.localeCompare(b.name);
201   - });
202   - //top title
203   - var htmlStr = template('authorize-user-auth-title-temp', user);
204   - $('.top_title', wrap).html(htmlStr);
205   -
206   - //用户线调权限
207   - defauleConfig = {userId: user.id, pattern: 0, excludeMenus: 'history_sch_maintain'};
208   - $.get('/realControAuthority/findByUserId', {userId: user.id}, function (rs) {
209   - //console.log('rsrs',rs);
210   - xd_auth = rs;
211   - if (!xd_auth)
212   - xd_auth = defauleConfig;
213   - //渲染线路权限
214   - render_auth_lines();
215   - //渲染菜单权限
216   - render_auth_menus();
217   - //渲染线路选择modal
218   - //render_line_select_modal();
219   - patSelect = rs.pattern;
220   - $('#pattern_select', wrap).val(xd_auth.pattern).trigger('change').parent().show();
221   - });
222   - });
223   - $('#pattern_select').change(function () {
224   - if ($('#pattern_select', wrap).val() == 2 && $('#pattern_select', wrap).val() != patSelect) {
225   - // UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function(){
226   - //
227   - // });
228   - UIkit.modal.alert("选择作废模式后该用户将失去所有线路和权限!");
229   - }
230   -
231   - })
232   -
233   - function render_auth_lines() {
234   - var data = [], codeArray = [];
235   - if (xd_auth && xd_auth.lineCodeStr)
236   - codeArray = xd_auth.lineCodeStr.split(',');
237   -
238   - $.each(all_lines, function () {
239   - if (codeArray.indexOf(this.lineCode) != -1)
240   - data.push(this);
241   - });
242   -
243   - data.sort(function (a, b) {
244   - return a.name.localeCompare(b.name);
245   - });
246   - //按分公司分组
247   - var gd = groupBy(data, 'cgsbm');
248   - data = [];
249   - for (var code in gd) {
250   - data.push({
251   - code: code,
252   - fgsName: fgs_name_mapp[code],
253   - list: gd[code]
254   - });
255   - if (!fgs_name_mapp[code]) {
256   - alert('出现异常的公司归属 :' + code);
257   - }
258   - }
259   -
260   - data.sort(function (a, b) {
261   - return a.fgsName.localeCompare(b.fgsName);
262   - });
263   -
264   - var htmlStr = template('authorize-user-auth-lines-temp', {list: data});
265   - $('.xd_line_list', wrap).html(htmlStr);
266   -
267   - //滚动条
268   - $('.xd_line_list', wrap).perfectScrollbar({suppressScrollX: true});
269   - }
270   -
271   - function render_auth_menus() {
272   - var excludeArray = [], event;
273   - if (xd_auth && xd_auth.excludeMenus)
274   - excludeArray = xd_auth.excludeMenus.split(',');
275   -
276   - $('.xd_menu_grid li>label>input').each(function () {
277   - event = $(this).data('event');
278   - if (excludeArray.indexOf(event) == -1)
279   - this.checked = true;
280   - });
281   - $('.xd_menu_grid').show();
282   - $('.xd_menu_grid .uk-list', wrap).perfectScrollbar('update');
283   - }
284   -
285   - $('.xd_menu_grid .uk-list', wrap).perfectScrollbar({suppressScrollX: true});
286   -
287   - /**
288   - * 线路选择modal
289   - */
290   - var compSelectData, modal = '#select_line_modal', modalRender;
291   - $(modal).on('show', function () {
292   - if (!modalRender) {
293   - render_line_select_modal();
294   - modalRender = true;
295   - }
296   - $('#modal_line_input', modal).focus();
297   - });
298   -
299   - function render_line_select_modal() {
300   - var htmlStr = template('authorize-modal-lines-temp', {
301   - list: all_lines,
302   - destroy: $('.modal_type_select', modal).val()
303   - });
304   - $('.line_checkbox_list').html(htmlStr);
305   - //选中线路
306   - var codeArray = [];
307   - if (xd_auth && xd_auth.lineCodeStr)
308   - codeArray = xd_auth.lineCodeStr.split(',');
309   -
310   - $('.line_checkbox_list>label.btn').each(function () {
311   - if (codeArray.indexOf($(this).data('code') + '') != -1) {
312   - $(this).addClass('active').find('>input')[0].checked = true;
313   - }
314   - });
315   -
316   - //构建公司级联下拉框
317   - compSelectData = convert_buss_data(companyData);
318   - var companyStr = '<option value="">请选择...</option>';
319   - for (var code in compSelectData) {
320   - companyStr += '<option value="' + code + '">' + compSelectData[code].name + '</option>';
321   - }
322   - $('#modal_company_select', modal).html(companyStr).on('change', function () {
323   - var code = $(this).val(), subSelect = $('#modal_sub_company_select', modal);
324   - if (!code)
325   - subSelect.empty().attr('disabled', 'disabled');
326   - else {
327   - var subCompStr = '<option value="">请选择...</option>';
328   - $.each(compSelectData[code].childs, function () {
329   - subCompStr += '<option value="' + this.businessCode + '">' + this.businessName + '</option>';
330   - });
331   - subSelect.html(subCompStr).removeAttr('disabled');
332   - }
333   - //过滤线路
334   - filter_modal_lines();
335   - });
336   - $('#modal_sub_company_select', modal).on('change', filter_modal_lines);
337   - $('#modal_type_select', modal).on('change', filter_modal_lines);
338   - }
339   -
340   - $('#modal_line_input', modal).on('input', function () {
341   - var t = $(this).val() + '';
342   - if (!t) {
343   - filter_modal_lines();
344   - return;
345   - }
346   - var codes = [];
347   - $.each(all_lines, function () {
348   - if (this.name.indexOf(t) != -1)
349   - codes.push(this.lineCode);
350   - });
351   -
352   - var array = $('.line_checkbox_list>label.btn').css('display', 'none');
353   - array.each(function () {
354   - if (codes.indexOf($(this).data('code') + '') != -1)
355   - $(this).css('display', 'inline-block');
356   - });
357   - });
358   -
359   - function filter_modal_lines() {
360   - console.log('filter_modal_lines');
361   - var company = $('#modal_company_select', modal).val(),//公司代码
362   - sub_company = $('#modal_sub_company_select', modal).val(),//分公司代码
363   - type = $('#modal_type_select', modal).val();//线路状态
364   -
365   - var array = $('.line_checkbox_list>label.btn').css('display', 'none'), s_dom = [];
366   -
367   - if (!company && !sub_company && type == -1) {
368   - array.css('display', 'inline-block');
369   - return;
370   - }
371   -
372   - var status;
373   - array.each(function () {
374   - if (company && $(this).data('gs') != company)
375   - return true;
376   - if (sub_company && $(this).data('fgs') != sub_company)
377   - return true;
378   -
379   - status = $(this).hasClass('destroy') ? 1 : 0;
380   - if (type != -1 && type != status)
381   - return true;
382   -
383   - s_dom.push(this);
384   - });
385   - for (var i = 0, dom; dom = s_dom[i++];)
386   - $(dom).css('display', 'inline-block');
387   - }
388   -
389   - $('.line_checkbox_list').on('click', 'label.btn', function () {
390   - if ($('input', this)[0].checked)
391   - $(this).addClass('active');
392   - else
393   - $(this).removeClass('active');
394   - });
395   -
396   - //全选
397   - $('#globalCheckbox', modal).on('click', function () {
398   - var state = this.checked;
399   - $('.line_checkbox_list>label.btn:visible>input').each(function () {
400   - this.checked = state;
401   - });
402   -
403   - $('.line_checkbox_list>label.btn:visible').each(function () {
404   - if (state)
405   - $(this).addClass('active');
406   - else
407   - $(this).removeClass('active');
408   - });
409   - });
410   -
411   - //确定
412   - $('#confirmBtn', modal).on('click', function () {
413   - var lines = '';
414   - $('.line_checkbox_list>label.btn.active').each(function () {
415   - lines += ($(this).data('code') + ',');
416   - });
417   - xd_auth.lineCodeStr = lines;
418   - render_auth_lines();
419   - UIkit.modal(modal).hide();
420   - });
421   -
422   -
423   - //保存
424   - $('#global_save_btn', wrap).on('click', function () {
425   - $(this).attr('disabled', 'disabled');
426   - //调度模式
427   - xd_auth.pattern = $('#pattern_select', wrap).val();
428   - //要排除的线调菜单
429   - var excludeMenus = '';
430   - $('.xd_menu_grid ul input[type=checkbox]').each(function () {
431   - if (!this.checked)
432   - excludeMenus += $(this).data('event') + ',';
433   - });
434   - xd_auth.excludeMenus = excludeMenus;
435   - if (xd_auth.pattern == 2) {
436   - //UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function () {
437   - xd_auth.lineCodeStr = '';
438   - var excludeMenusAll = '';
439   - $('.xd_menu_grid ul input[type=checkbox]').each(function () {
440   - excludeMenusAll += $(this).data('event') + ',';
441   - });
442   - xd_auth.excludeMenus = excludeMenusAll;
443   - //});
444   -
445   - }
446   - $.post('/realControAuthority', xd_auth, function (rs) {
447   - UIkit.notification('保存成功!', 'primary');
448   - $('.authorize_right_cont').trigger('refresh-user');
449   - });
450   - });
451   - })();
452   - </script>
  1 +<!-- 用户线调授权页面 -->
  2 +<div id="user_authorize_wrap" style="height: 100%;">
  3 + <div class="top_title"></div>
  4 +
  5 + <div class="xd_line_list">
  6 + </div>
  7 + <div class="top_tools">
  8 + <form class="ct_pattern_form">
  9 + <div class="uk-margin">
  10 + <div uk-form-custom="target: > * > span:first" style="display: none">
  11 + <select id="pattern_select">
  12 + <option value="0">监控模式</option>
  13 + <option value="1">主调模式</option>
  14 + <option value="2">作废模式</option>
  15 + </select>
  16 + <button class="uk-button uk-button-default" type="button" tabindex="-1">
  17 + <span></span>
  18 + <span uk-icon="icon: chevron-down"></span>
  19 + </button>
  20 + </div>
  21 + </div>
  22 + </form>
  23 + <div class="add_line_icon" uk-toggle="target: #select_line_modal">
  24 + <i uk-icon="icon: plus"></i> 添加线路
  25 + </div>
  26 + &nbsp;&nbsp;
  27 + <button class="uk-button uk-button-primary uk-button-small" id="global_save_btn">保存哇!</button>
  28 + </div>
  29 +
  30 + <div class="uk-child-width-expand uk-grid-small xd_menu_grid" uk-grid style="display: none;">
  31 +
  32 + <div>
  33 + <h4>数据&统计</h4>
  34 + <ul class="uk-list uk-list-large uk-list-divider">
  35 + <li><label><input class="uk-checkbox" type="checkbox" data-event="curr_date_schedule"> 当日计划排班</label></li>
  36 + <li><label><input class="uk-checkbox" type="checkbox" data-event="cache_data_manage"> 缓存数据管理</label></li>
  37 + <li><label><input class="uk-checkbox" type="checkbox" data-event="history_sch_maintain"> 历史路单维护</label></li>
  38 + <li><label><input class="uk-checkbox" type="checkbox" data-event="sch_edit_info"> 班次修正日志</label></li>
  39 + </ul>
  40 + </div>
  41 +
  42 + <div>
  43 + <h4>报表管理</h4>
  44 + <ul class="uk-list uk-list-large uk-list-divider">
  45 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_waybill"> 行车路单</label></li>
  46 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_history_message"> 调度历史消息</label></li>
  47 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_account"> 驾驶员请求台账</label></li>
  48 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_correctForm"> 修正报表</label></li>
  49 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_statisticsDaily"> 统计日报</label></li>
  50 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleDaily"> 调度日报</label></li>
  51 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_jobSummary"> 工作汇总</label></li>
  52 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_daily"> 班次日报表</label></li>
  53 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_inoutstation"> 班次到离站</label></li>
  54 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_oilListMonth"> 月存油报表</label></li>
  55 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleAnaly"> 时刻表分析</label></li>
  56 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_message"> 调度消息分析</label></li>
  57 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_changetochange"> 换人换车情况统计表</label></li>
  58 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_repairReport"> 维修上报记录</label></li>
  59 + </ul>
  60 + </div>
  61 +
  62 + <div>
  63 + <h4>车载设备</h4>
  64 + <ul class="uk-list uk-list-large uk-list-divider">
  65 + <li><label><input class="uk-checkbox" type="checkbox" data-event="all_devices"> 设备管理</label></li>
  66 + <li><label><input class="uk-checkbox" type="checkbox" data-event="directive_history"> 指令下发记录</label></li>
  67 + <li><label><input class="uk-checkbox" type="checkbox" data-event="device_report"> 设备上报记录</label></li>
  68 + <li><label><input class="uk-checkbox" type="checkbox" data-event="gps_play_back"> 轨迹回放</label></li>
  69 + <li><label><input class="uk-checkbox" type="checkbox" data-event="safe_driving"> 安全驾驶(图像)</label></li>
  70 + </ul>
  71 + </div>
  72 +
  73 + <div>
  74 + <h4>系统设置</h4>
  75 + <ul class="uk-list uk-list-large uk-list-divider">
  76 + <li><label><input class="uk-checkbox" type="checkbox" data-event="line_config"> 线路配置</label></li>
  77 + <li><label><input class="uk-checkbox" type="checkbox" data-event="fbzdzx_config"> 翻班与自动执行</label></li>
  78 + <li><label><input class="uk-checkbox" type="checkbox" data-event="tts_config"> TTS</label></li>
  79 + <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li>
  80 + </ul>
  81 + </div>
  82 + <div>
  83 + <h4>服务热线系统</h4>
  84 + <ul class="uk-list uk-list-large uk-list-divider">
  85 + <li><label><input class="uk-checkbox" type="checkbox" data-event="report_register"> 报备登记</label></li>
  86 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_report_register"> 报备登记报表</label></li>
  87 + </ul>
  88 + </div>
  89 +
  90 + </div>
  91 +
  92 + <!-- This is the modal -->
  93 + <div id="select_line_modal" class="uk-modal-container" uk-modal="bg-close:false;">
  94 + <div class="uk-modal-dialog uk-modal-body">
  95 + <button class="uk-modal-close-outside" type="button" uk-close></button>
  96 + <h2 class="uk-modal-title">添加线路权限</h2>
  97 + <div>
  98 + <form>
  99 + <div class="ct_field" style="width: 140px;">
  100 + <label>状态</label>
  101 + <select class="uk-select" id="modal_type_select" style="width: 94px;">
  102 + <option value="-1">全部</option>
  103 + <option value="0">营运</option>
  104 + <option value="1">撤销</option>
  105 + </select>
  106 + </div>
  107 + <div class="ct_field">
  108 + <label>公司</label>
  109 + <select class="uk-select" id="modal_company_select"></select>
  110 + </div>
  111 + <div class="ct_field">
  112 + <label>分公司</label>
  113 + <select class="uk-select" id="modal_sub_company_select" disabled></select>
  114 + </div>
  115 + <div class="ct_field">
  116 + <label>线路</label>
  117 + <input class="uk-input" id="modal_line_input" placeholder="没做拼音映射!!"/>
  118 + </div>
  119 + <label><input class="uk-checkbox" type="checkbox" id="globalCheckbox"> 全选</label>
  120 + </form>
  121 + <div class="uk-modal-body line_checkbox_list" style="padding: 0 !important;" uk-overflow-auto>
  122 + </div>
  123 + </div>
  124 + <p class="uk-text-right">
  125 + <button class="uk-button uk-button-default uk-modal-close" type="button">取消</button>
  126 + <button class="uk-button uk-button-primary" id="confirmBtn" type="button">确定</button>
  127 + </p>
  128 + </div>
  129 + </div>
  130 +
  131 + <script id="authorize-user-auth-lines-temp" type="text/html">
  132 + {{each list as t i}}
  133 + <h5>{{t.fgsName}}</h5>
  134 + <div class="sub_lines">
  135 + {{each t.list as obj j}}
  136 + <span title="{{obj.lineCode}}" class="line_btn {{obj.destroy==1?'destroy':''}}">{{obj.name}}</span>
  137 + {{/each}}
  138 + </div>
  139 + {{/each}}
  140 + </script>
  141 + <script id="authorize-user-auth-title-temp" type="text/html">
  142 + <div style="font-weight: 600;">{{name}}({{userName}})
  143 + </div>
  144 + <!--<div class="desc">最近登录 {{lastLoginDateStr}}</div>-->
  145 + <div class="desc">...</div>
  146 + </script>
  147 +
  148 + <script id="authorize-modal-lines-temp" type="text/html">
  149 + {{each list as obj i}}
  150 + <label class="btn {{obj.destroy==1?'destroy':''}}" data-gs="{{obj.company}}" data-fgs="{{obj.brancheCompany}}"
  151 + title="{{obj.name}}" data-code="{{obj.lineCode}}">
  152 + <input class="uk-checkbox" type="checkbox">{{obj.name}}
  153 + </label>
  154 + {{/each}}
  155 + </script>
  156 + <script>
  157 + (function () {
  158 + var wrap = '#user_authorize_wrap', user, xd_auth, all_lines, companyData;
  159 + //分公司名称映射(只用于分组展示,就写死)
  160 +
  161 + var fgs_name_mapp = {
  162 + '55_3': '上南公司(六分公司)',
  163 + '55_1': '上南公司(二分公司)',
  164 + '55_2': '上南公司(三分公司)',
  165 + '55_4': '上南公司(一分公司)',
  166 + '55_5': '上南公司(培训部)',
  167 + '22_2': '金高公司(二分公司)',
  168 + '22_1': '金高公司(四分公司)',
  169 + '22_3': '金高公司(三分公司)',
  170 + '22_5': '金高公司(一分公司)',
  171 + '26_3': '南汇公司(三分公司)',
  172 + '26_2': '南汇公司(南汇二分)',
  173 + '26_1': '南汇公司(南汇一分)',
  174 + '26_4': '南汇公司(南汇维修公司)',
  175 + '26_5': '南汇公司(南汇公司)',
  176 + '26_6': '南汇公司(南汇六分)',
  177 + '05_5': '杨高公司(杨高分公司)',
  178 + '05_6': '杨高公司(周浦分公司)',
  179 + '05_3': '杨高公司(芦潮港分公司)',
  180 + '05_1': '杨高公司(川沙分公司)',
  181 + '05_2': '杨高公司(金桥分公司)',
  182 + '77_78': '闵行公司',
  183 + '300_301': '金球公交',
  184 + '99_100': '青浦公交',
  185 + '24_1': '一车队',
  186 + '24_2': '二车队',
  187 + '24_3': '三车队',
  188 + '77_1': '临港公交'
  189 + };
  190 +
  191 + var defauleConfig;
  192 + var patSelect;
  193 + $(wrap).on('init', function (e, data) {
  194 + e.stopPropagation();
  195 + user = data.user;
  196 + all_lines = data.lineArray;
  197 + companyData = data.companyData;
  198 +
  199 + all_lines.sort(function (a, b) {
  200 + return a.name.localeCompare(b.name);
  201 + });
  202 + //top title
  203 + var htmlStr = template('authorize-user-auth-title-temp', user);
  204 + $('.top_title', wrap).html(htmlStr);
  205 +
  206 + //用户线调权限
  207 + defauleConfig = {userId: user.id, pattern: 0, excludeMenus: 'history_sch_maintain'};
  208 + $.get('/realControAuthority/findByUserId', {userId: user.id}, function (rs) {
  209 + //console.log('rsrs',rs);
  210 + xd_auth = rs;
  211 + if (!xd_auth)
  212 + xd_auth = defauleConfig;
  213 + //渲染线路权限
  214 + render_auth_lines();
  215 + //渲染菜单权限
  216 + render_auth_menus();
  217 + //渲染线路选择modal
  218 + //render_line_select_modal();
  219 + patSelect = rs.pattern;
  220 + $('#pattern_select', wrap).val(xd_auth.pattern).trigger('change').parent().show();
  221 + });
  222 + });
  223 + $('#pattern_select').change(function () {
  224 + if ($('#pattern_select', wrap).val() == 2 && $('#pattern_select', wrap).val() != patSelect) {
  225 + // UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function(){
  226 + //
  227 + // });
  228 + UIkit.modal.alert("选择作废模式后该用户将失去所有线路和权限!");
  229 + }
  230 +
  231 + })
  232 +
  233 + function render_auth_lines() {
  234 + var data = [], codeArray = [];
  235 + if (xd_auth && xd_auth.lineCodeStr)
  236 + codeArray = xd_auth.lineCodeStr.split(',');
  237 +
  238 + $.each(all_lines, function () {
  239 + if (codeArray.indexOf(this.lineCode) != -1)
  240 + data.push(this);
  241 + });
  242 +
  243 + data.sort(function (a, b) {
  244 + return a.name.localeCompare(b.name);
  245 + });
  246 + //按分公司分组
  247 + var gd = groupBy(data, 'cgsbm');
  248 + data = [];
  249 + for (var code in gd) {
  250 + data.push({
  251 + code: code,
  252 + fgsName: fgs_name_mapp[code],
  253 + list: gd[code]
  254 + });
  255 + if (!fgs_name_mapp[code]) {
  256 + alert('出现异常的公司归属 :' + code);
  257 + }
  258 + }
  259 +
  260 + data.sort(function (a, b) {
  261 + return a.fgsName.localeCompare(b.fgsName);
  262 + });
  263 +
  264 + var htmlStr = template('authorize-user-auth-lines-temp', {list: data});
  265 + $('.xd_line_list', wrap).html(htmlStr);
  266 +
  267 + //滚动条
  268 + $('.xd_line_list', wrap).perfectScrollbar({suppressScrollX: true});
  269 + }
  270 +
  271 + function render_auth_menus() {
  272 + var excludeArray = [], event;
  273 + if (xd_auth && xd_auth.excludeMenus)
  274 + excludeArray = xd_auth.excludeMenus.split(',');
  275 +
  276 + $('.xd_menu_grid li>label>input').each(function () {
  277 + event = $(this).data('event');
  278 + if (excludeArray.indexOf(event) == -1)
  279 + this.checked = true;
  280 + });
  281 + $('.xd_menu_grid').show();
  282 + $('.xd_menu_grid .uk-list', wrap).perfectScrollbar('update');
  283 + }
  284 +
  285 + $('.xd_menu_grid .uk-list', wrap).perfectScrollbar({suppressScrollX: true});
  286 +
  287 + /**
  288 + * 线路选择modal
  289 + */
  290 + var compSelectData, modal = '#select_line_modal', modalRender;
  291 + $(modal).on('show', function () {
  292 + if (!modalRender) {
  293 + render_line_select_modal();
  294 + modalRender = true;
  295 + }
  296 + $('#modal_line_input', modal).focus();
  297 + });
  298 +
  299 + function render_line_select_modal() {
  300 + var htmlStr = template('authorize-modal-lines-temp', {
  301 + list: all_lines,
  302 + destroy: $('.modal_type_select', modal).val()
  303 + });
  304 + $('.line_checkbox_list').html(htmlStr);
  305 + //选中线路
  306 + var codeArray = [];
  307 + if (xd_auth && xd_auth.lineCodeStr)
  308 + codeArray = xd_auth.lineCodeStr.split(',');
  309 +
  310 + $('.line_checkbox_list>label.btn').each(function () {
  311 + if (codeArray.indexOf($(this).data('code') + '') != -1) {
  312 + $(this).addClass('active').find('>input')[0].checked = true;
  313 + }
  314 + });
  315 +
  316 + //构建公司级联下拉框
  317 + compSelectData = convert_buss_data(companyData);
  318 + var companyStr = '<option value="">请选择...</option>';
  319 + for (var code in compSelectData) {
  320 + companyStr += '<option value="' + code + '">' + compSelectData[code].name + '</option>';
  321 + }
  322 + $('#modal_company_select', modal).html(companyStr).on('change', function () {
  323 + var code = $(this).val(), subSelect = $('#modal_sub_company_select', modal);
  324 + if (!code)
  325 + subSelect.empty().attr('disabled', 'disabled');
  326 + else {
  327 + var subCompStr = '<option value="">请选择...</option>';
  328 + $.each(compSelectData[code].childs, function () {
  329 + subCompStr += '<option value="' + this.businessCode + '">' + this.businessName + '</option>';
  330 + });
  331 + subSelect.html(subCompStr).removeAttr('disabled');
  332 + }
  333 + //过滤线路
  334 + filter_modal_lines();
  335 + });
  336 + $('#modal_sub_company_select', modal).on('change', filter_modal_lines);
  337 + $('#modal_type_select', modal).on('change', filter_modal_lines);
  338 + }
  339 +
  340 + $('#modal_line_input', modal).on('input', function () {
  341 + var t = $(this).val() + '';
  342 + if (!t) {
  343 + filter_modal_lines();
  344 + return;
  345 + }
  346 + var codes = [];
  347 + $.each(all_lines, function () {
  348 + if (this.name.indexOf(t) != -1)
  349 + codes.push(this.lineCode);
  350 + });
  351 +
  352 + var array = $('.line_checkbox_list>label.btn').css('display', 'none');
  353 + array.each(function () {
  354 + if (codes.indexOf($(this).data('code') + '') != -1)
  355 + $(this).css('display', 'inline-block');
  356 + });
  357 + });
  358 +
  359 + function filter_modal_lines() {
  360 + console.log('filter_modal_lines');
  361 + var company = $('#modal_company_select', modal).val(),//公司代码
  362 + sub_company = $('#modal_sub_company_select', modal).val(),//分公司代码
  363 + type = $('#modal_type_select', modal).val();//线路状态
  364 +
  365 + var array = $('.line_checkbox_list>label.btn').css('display', 'none'), s_dom = [];
  366 +
  367 + if (!company && !sub_company && type == -1) {
  368 + array.css('display', 'inline-block');
  369 + return;
  370 + }
  371 +
  372 + var status;
  373 + array.each(function () {
  374 + if (company && $(this).data('gs') != company)
  375 + return true;
  376 + if (sub_company && $(this).data('fgs') != sub_company)
  377 + return true;
  378 +
  379 + status = $(this).hasClass('destroy') ? 1 : 0;
  380 + if (type != -1 && type != status)
  381 + return true;
  382 +
  383 + s_dom.push(this);
  384 + });
  385 + for (var i = 0, dom; dom = s_dom[i++];)
  386 + $(dom).css('display', 'inline-block');
  387 + }
  388 +
  389 + $('.line_checkbox_list').on('click', 'label.btn', function () {
  390 + if ($('input', this)[0].checked)
  391 + $(this).addClass('active');
  392 + else
  393 + $(this).removeClass('active');
  394 + });
  395 +
  396 + //全选
  397 + $('#globalCheckbox', modal).on('click', function () {
  398 + var state = this.checked;
  399 + $('.line_checkbox_list>label.btn:visible>input').each(function () {
  400 + this.checked = state;
  401 + });
  402 +
  403 + $('.line_checkbox_list>label.btn:visible').each(function () {
  404 + if (state)
  405 + $(this).addClass('active');
  406 + else
  407 + $(this).removeClass('active');
  408 + });
  409 + });
  410 +
  411 + //确定
  412 + $('#confirmBtn', modal).on('click', function () {
  413 + var lines = '';
  414 + $('.line_checkbox_list>label.btn.active').each(function () {
  415 + lines += ($(this).data('code') + ',');
  416 + });
  417 + xd_auth.lineCodeStr = lines;
  418 + render_auth_lines();
  419 + UIkit.modal(modal).hide();
  420 + });
  421 +
  422 +
  423 + //保存
  424 + $('#global_save_btn', wrap).on('click', function () {
  425 + $(this).attr('disabled', 'disabled');
  426 + //调度模式
  427 + xd_auth.pattern = $('#pattern_select', wrap).val();
  428 + //要排除的线调菜单
  429 + var excludeMenus = '';
  430 + $('.xd_menu_grid ul input[type=checkbox]').each(function () {
  431 + if (!this.checked)
  432 + excludeMenus += $(this).data('event') + ',';
  433 + });
  434 + xd_auth.excludeMenus = excludeMenus;
  435 + if (xd_auth.pattern == 2) {
  436 + //UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function () {
  437 + xd_auth.lineCodeStr = '';
  438 + var excludeMenusAll = '';
  439 + $('.xd_menu_grid ul input[type=checkbox]').each(function () {
  440 + excludeMenusAll += $(this).data('event') + ',';
  441 + });
  442 + xd_auth.excludeMenus = excludeMenusAll;
  443 + //});
  444 +
  445 + }
  446 + $.post('/realControAuthority', xd_auth, function (rs) {
  447 + UIkit.notification('保存成功!', 'primary');
  448 + $('.authorize_right_cont').trigger('refresh-user');
  449 + });
  450 + });
  451 + })();
  452 + </script>
453 453 </div>
454 454 \ No newline at end of file
... ...