Commit a49d79df45c5882d75c6a58e5c0bdf3ff716e958

Authored by 王通
1 parent 84d96890

1.嘉定调整人车要求驾驶员默认不调换

src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/tzrc.html
1   -<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-tzrc-modal">
2   - <div class="uk-modal-dialog" style="width: 680px;">
3   - <a href="" class="uk-modal-close uk-close"></a>
4   - <div class="uk-modal-header">
5   - <h2>调整人车</h2></div>
6   - <div class="uk-panel ct_search_panel">
7   - <form class="uk-form uk-form-horizontal search-form">
8   - <div class="uk-grid">
9   - <div class="uk-width-1-3">
10   - <div class="uk-form-row">
11   - <label class="uk-form-label" style="width: 50px;">线路</label>
12   - <div class="uk-form-controls" style="margin-left: 51px;">
13   - <select name="lineSelect"></select>
14   - </div>
15   - </div>
16   - </div>
17   - <div class="uk-width-1-3">
18   - <div class="uk-form-row">
19   - <label class="uk-form-label" style="width: 50px;">路牌</label>
20   - <div class="uk-form-controls" style="margin-left: 51px;">
21   - <select name="lpName"></select>
22   - </div>
23   - </div>
24   - </div>
25   - </div>
26   - </form>
27   - </div>
28   -
29   - <form class="uk-form">
30   - <div class="ct_table_wrap ct_table_no_border tzrc-table-wrap" style="height: 340px;">
31   - <div class="ct_table sch-tzrc-table">
32   - <div class="ct_table_head">
33   - <dl>
34   - <dt><input type="checkbox" id="globalCheckBox" class="i-cbox" >时间</dt>
35   - <dt>车辆</dt>
36   - <dt>驾驶员</dt>
37   - <dt>售票员</dt>
38   - <dt>状态</dt>
39   - </dl>
40   - </div>
41   - <div class="ct_table_body"></div>
42   - </div>
43   - </div>
44   - </form>
45   - <form class="uk-form uk-form-horizontal tzrc_form">
46   - <div class="uk-grid">
47   - <div class="uk-width-1-2">
48   - <div class="uk-form-row">
49   - <label class="uk-form-label">车辆</label>
50   - <div class="uk-form-controls" >
51   - <div class="uk-autocomplete uk-form car-autocom" style="width: 77%;">
52   - <input type="text" value="" name="clZbh" required>
53   - </div>
54   - <label class="blue_checkbox cl_enable_key_label">
55   - <input type="checkbox" checked>
56   - </label>
57   - </div>
58   - </div>
59   - </div>
60   - <div class="uk-width-1-2">
61   - <div class="uk-form-row">
62   - <label class="uk-form-label">驾驶员 </label>
63   - <div class="uk-form-controls">
64   - <div class="uk-autocomplete uk-form jsy-autocom" style="width: 77%;">
65   - <input type="text" value="" name="jsy" required>
66   - </div>
67   - <label class="blue_checkbox jsy_enable_key_label">
68   - <input type="checkbox" checked>
69   - </label>
70   - </div>
71   - </div>
72   - </div>
73   - </div>
74   - <div class="uk-grid">
75   - <div class="uk-width-1-2">
76   - <div class="uk-form-row">
77   - <label class="uk-form-label">售票员</label>
78   - <div class="uk-form-controls">
79   - <div class="uk-autocomplete uk-form spy-autocom">
80   - <input type="text" value="" name="spy">
81   - </div>
82   - </div>
83   - </div>
84   - </div>
85   - </div>
86   - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;position: relative;">
87   - <button type="button" class="uk-button uk-modal-close">取消</button>
88   - <button type="submit" class="uk-button uk-button-primary" ><i class="uk-icon-check"></i> &nbsp;保存
89   - </button>
90   - </div>
91   - </form>
92   - </div>
93   -
94   - <script id="schedule-tzrc-table-temp" type="text/html">
95   - {{each list as sch i}}
96   - <dl data-id="{{sch.id}}" {{if sch.status==0}}class="no_exec_sch_row"{{/if}}>
97   - <dd>
98   - <input type="checkbox" value=1 name="schCBox" class="i-cbox" >
99   - {{sch.dfsj}}
100   - {{if sch.bcType == "out"}}
101   - <span class="uk-badge uk-badge-success">出场</span>
102   - {{else if sch.bcType == "in"}}
103   - <span class="uk-badge uk-badge-warning">进场</span>
104   - {{else if sch.bcType == "venting"}}
105   - <span class="uk-badge uk-badge-danger">直放</span>
106   - {{else if sch.bcType == "major"}}
107   - <span class="uk-badge uk-badge-danger">放站</span>
108   - {{/if}}
109   - {{if sch.sflj}}
110   - <span class="uk-badge uk-badge-danger">临加</span>
111   - {{/if}}
112   - {{if sch.cTasks.length > 0}}
113   - <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span>
114   - {{/if}}
115   - </dd>
116   - <dd data-old="{{sch.clZbh}}">{{sch.clZbh}}</dd>
117   - <dd data-old="{{sch.jGh}}/{{sch.jName}}">{{sch.jGh}}/{{sch.jName}}</dd>
118   - <dd data-old="{{sch.sGh}}/{{sch.sName}}">{{sch.sGh}}/{{sch.sName}}</dd>
119   - <dd>
120   - {{if sch.status==2}}
121   - <span class="ct_zt_yzx">已执行</span>
122   - {{else if sch.status==1}}
123   - <span class="ct_zt_zzzx">正在执行</span>
124   - {{else if sch.status==-1}}
125   - <span class="ct_zt_lb">烂班</span>
126   - {{/if}}
127   - </dd>
128   - </dl>
129   - {{/each}}
130   - </script>
131   - <script>
132   - (function () {
133   - var modal = '#schedule-tzrc-modal',
134   - sch, schList, lp2SchMap;
135   - $(modal).on('init', function (e, data) {
136   - e.stopPropagation();
137   - sch = data.sch;
138   -
139   - //滚动条
140   - $('.tzrc-table-wrap', modal).perfectScrollbar();
141   - //线路下拉框
142   - var opts = '';
143   - $.each(gb_data_basic.activeLines, function () {
144   - opts += '<option value="' + this.lineCode + '">' + this.name + '</option>';
145   - });
146   - $('[name=lineSelect]', modal).html(opts)
147   - .on('change', function () {
148   - var lineCode = $(this).val();
149   - schList = gb_schedule_table.findScheduleByLine(lineCode);
150   - lp2SchMap = gb_common.groupBy(schList, 'lpName');
151   -
152   - var opts = '';
153   - for (var lpName in lp2SchMap)
154   - opts += '<option value="' + lpName + '">' + lpName + '</option>';
155   - $('[name=lpName]', modal).html(opts).trigger('change');
156   - });
157   -
158   - //路牌下拉框
159   - $('[name=lpName]', modal).on('change', function () {
160   - var list = lp2SchMap[$(this).val()].sort(gb_schedule_table.schedule_sort),
161   - htmlBody = template('schedule-tzrc-table-temp', {
162   - list: list
163   - });
164   - $('.sch-tzrc-table .ct_table_body', modal).html(htmlBody);
165   - //更新滚动条高度
166   - $('.tzrc-table-wrap', modal).perfectScrollbar('update');
167   - });
168   -
169   -
170   - writeSch2Form(sch);
171   - $(modal).on('click', '.sch-tzrc-table .ct_table_body dl', function () {
172   - var cbox = $('input[type=checkbox]',this)[0];
173   - //var active = $();
174   - if(!$(this).hasClass('active')){
175   - $(this).addClass('active');
176   - cbox.checked = true;
177   - renderCell();
178   - }
179   - else{
180   - $(this).removeClass('active');
181   - cbox.checked = false;
182   - //$(this).find('dd[data-old]').text()
183   - var $jsyCell = $($($(this).find('dd')[2]));
184   - var $spyCell = $($($(this).find('dd')[3]));
185   - var $clCell = $($($(this).find('dd')[1]));
186   - $jsyCell.text($jsyCell.data('old'));
187   - $spyCell.text($spyCell.data('old'));
188   - $clCell.text($clCell.data('old'));
189   - }
190   - });
191   -
192   - //默认选中项
193   - $('[name=lineSelect]', modal).val(sch.xlBm).trigger('change');
194   - $('[name=lpName]', modal).val(sch.lpName).trigger('change');
195   - var dl = $('.sch-tzrc-table', modal).find('dl[data-id=' + sch.id + ']');
196   - $('input[type=checkbox]', dl).trigger('click');
197   -
198   - //滚动到可视区域
199   - var cont = $('.tzrc-table-wrap', modal);
200   - cont.animate({
201   - scrollTop: dl.offset().top - cont.offset().top + cont.scrollTop() - 38
202   - }, 500);
203   -
204   - gb_ct_table.fixedHead($('.ct_table_wrap', modal));
205   -
206   - //----------- Autocomplete --------------
207   - $.get('/basic/cars', function (rs) {
208   - //车辆
209   - gb_common.carAutocomplete($('.car-autocom', modal), rs);
210   - });
211   - //$.get('/basic/all_personnel', function(rs) {
212   - //驾驶员
213   - gb_common.personAutocomplete($('.jsy-autocom', modal));
214   - //售票员
215   - gb_common.personAutocomplete($('.spy-autocom', modal));
216   - //});
217   -
218   - //submit
219   - var f = $('form.tzrc_form', modal);
220   - f.on('submit', function (e) {
221   - e.stopPropagation();
222   - $('[type=submit]', f).attr('disabled', 'disabled');
223   -
224   - var checkeds = $('.sch-tzrc-table .ct_table_body input[type=checkbox]:checked', modal);
225   - if (checkeds.length == 0)
226   - return notify_err('请选中要调整的班次');
227   -
228   - var param = $(this).serializeJSON();
229   - var data = [];
230   - var schId;
231   - $.each(checkeds, function () {
232   - schId = $(this).parents('dl').data('id');
233   - data.push({
234   - schId: schId,
235   - jsy: param.jsy,
236   - spy: param.spy,
237   - clZbh: param.clZbh
238   - });
239   - });
240   -
241   - //提交之前做一次公司校验
242   - check_fgs_ascription(data[0], function () {
243   - gb_common.$post('/realSchedule/multi_tzrc', {
244   - cpcsJson: JSON.stringify(data)
245   - }, function (rs) {
246   - if (rs.ts && rs.ts.length > 0) {
247   - gb_schedule_table.updateSchedule(rs.ts);
248   - UIkit.modal(modal).hide();
249   - notify_succ('调整人车成功');
250   - }
251   - });
252   - });
253   - return false;
254   - });
255   -
256   - /**
257   - * 驾驶员/售票员文本框改变事件
258   - */
259   - var renderRunFlag;
260   - $('input[name=jsy],input[name=spy],input[name=clZbh]', modal).on('input change', function () {
261   - if(renderRunFlag)
262   - return;
263   - renderRunFlag = true;
264   - setTimeout(function () {
265   - renderCell();
266   - renderRunFlag = false;
267   - }, 200);
268   - });
269   -
270   - $('.jsy_enable_key_label', modal).on('click', function () {
271   - var checked = $('input[type=checkbox]', this)[0].checked;
272   - if(checked)
273   - enableJsy();
274   - else
275   - disabledJsy();
276   - });
277   -
278   - $('.cl_enable_key_label', modal).on('click', function () {
279   - var checked = $('input[type=checkbox]', this)[0].checked;
280   - if(checked)
281   - enableCl();
282   - else
283   - disabledCl();
284   - });
285   - });
286   -
287   - function check_fgs_ascription(data, cb) {
288   - var jGh,sGh,nbbm = data.clZbh;
289   - if(data.spy)
290   - sGh = data.spy.split('/')[0];
291   - if(data.jsy)
292   - jGh = data.jsy.split('/')[0];
293   -
294   - gb_common.$post('/realSchedule/check_fgs_ascription',{
295   - schId: data.schId,
296   - jGh: jGh,
297   - sGh: sGh,
298   - nbbm: nbbm
299   - }
300   - , function (rs) {
301   - //$('form.tzrc_form [type=submit]', modal).removeAttr('disabled');
302   - if(rs['checkStatus']==1)
303   - cb && cb();
304   - else if (rs['checkStatus']==-2){
305   - UIkit.modal.alert('<p style="color: #ff4141;font-size: 15px;">'+rs.msg+'</p>', {labels: {Ok: '确定'}});
306   - return;
307   - }
308   - else if (rs['checkStatus']==-1){
309   - //二次确认
310   - alt_confirm('<p style="font-weight: 600;font-size: 15px;">'+rs.msg+'</p>', cb, '我确定要操作!', true);
311   - }
312   - });
313   - }
314   -
315   - function renderCell() {
316   - var jsy = $('input[name=jsy]:enabled', modal).val();
317   - var spy = $('input[name=spy]', modal).val();
318   - var nbbm = $('input[name=clZbh]:enabled', modal).val();
319   - $('.sch-tzrc-table .ct_table_body>dl.active').each(function () {
320   - var jsyCell = $(this).find('dd')[2];
321   - var spyCell = $(this).find('dd')[3];
322   - var clCell = $(this).find('dd')[1];
323   -
324   - if(jsy)
325   - $(jsyCell).text(jsy);
326   - if(nbbm)
327   - $(clCell).text(nbbm);
328   - $(spyCell).text(spy);
329   - });
330   - }
331   -
332   - function writeSch2Form(sch) {
333   - var f = $('.tzrc_form', modal);
334   - $('input[name=clZbh]', f).val(sch.clZbh).trigger('input');
335   - $('input[name=jsy]', f).val(sch.jGh + '/' + sch.jName).trigger('input');
336   - if (sch.sGh)
337   - $('input[name=spy]', f).val(sch.sGh + '/' + sch.sName);
338   - }
339   -
340   - //全选
341   - $('#globalCheckBox', modal).on('click', function () {
342   - clearCheckAll();
343   - var status = this.checked;
344   - if(status){
345   - var id;
346   - $('.no_exec_sch_row', modal).each(function () {
347   - $(this).addClass('active');
348   - $('input[type=checkbox]',this)[0].checked = true;
349   - id = $(this).data('id');
350   - });
351   -
352   - var lineCode = $('[name=lineSelect]', modal).val();
353   - var sch = gb_schedule_table.findScheduleByLine(lineCode)[id];
354   - writeSch2Form(sch);
355   - }
356   - });
357   -
358   - function clearCheckAll() {
359   - $('.sch-tzrc-table .ct_table_body>dl', modal).each(function () {
360   - $(this).removeClass('active');
361   - $('input[type=checkbox]',this)[0].checked = false;
362   -
363   - $.each($('dd', this), function () {
364   - if($(this).data('old'))
365   - $(this).text($(this).data('old'));
366   - });
367   - });
368   - }
369   -
370   - function disabledJsy() {
371   - $('[name=jsy]',modal).attr('disabled', 'disabled');
372   - $('.sch-tzrc-table .ct_table_body>dl').each(function () {
373   - var jsyCell = $(this).find('dd')[2];
374   - $(jsyCell).addClass('disabled').text($(jsyCell).data('old'));
375   - });
376   - }
377   -
378   - function enableJsy() {
379   - $('[name=jsy]',modal).removeAttr('disabled');
380   - $('.sch-tzrc-table .ct_table_body>dl').each(function () {
381   - var jsyCell = $(this).find('dd')[2];
382   - $(jsyCell).removeClass('disabled').text($(jsyCell).data('old'));
383   - });
384   - }
385   -
386   - function disabledCl() {
387   - $('[name=clZbh]',modal).attr('disabled', 'disabled');
388   - $('.sch-tzrc-table .ct_table_body>dl').each(function () {
389   - var clCell = $(this).find('dd')[1];
390   - $(clCell).addClass('disabled').text($(clCell).data('old'));
391   - });
392   - }
393   -
394   - function enableCl() {
395   - $('[name=clZbh]',modal).removeAttr('disabled');
396   - $('.sch-tzrc-table .ct_table_body>dl').each(function () {
397   - var clCell = $(this).find('dd')[1];
398   - $(clCell).removeClass('disabled').text($(clCell).data('old'));
399   - });
400   - }
401   - })();
402   - </script>
403   -</div>
  1 +<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-tzrc-modal">
  2 + <div class="uk-modal-dialog" style="width: 680px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>调整人车</h2></div>
  6 + <div class="uk-panel ct_search_panel">
  7 + <form class="uk-form uk-form-horizontal search-form">
  8 + <div class="uk-grid">
  9 + <div class="uk-width-1-3">
  10 + <div class="uk-form-row">
  11 + <label class="uk-form-label" style="width: 50px;">线路</label>
  12 + <div class="uk-form-controls" style="margin-left: 51px;">
  13 + <select name="lineSelect"></select>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="uk-width-1-3">
  18 + <div class="uk-form-row">
  19 + <label class="uk-form-label" style="width: 50px;">路牌</label>
  20 + <div class="uk-form-controls" style="margin-left: 51px;">
  21 + <select name="lpName"></select>
  22 + </div>
  23 + </div>
  24 + </div>
  25 + </div>
  26 + </form>
  27 + </div>
  28 +
  29 + <form class="uk-form">
  30 + <div class="ct_table_wrap ct_table_no_border tzrc-table-wrap" style="height: 340px;">
  31 + <div class="ct_table sch-tzrc-table">
  32 + <div class="ct_table_head">
  33 + <dl>
  34 + <dt><input type="checkbox" id="globalCheckBox" class="i-cbox" >时间</dt>
  35 + <dt>车辆</dt>
  36 + <dt>驾驶员</dt>
  37 + <dt>售票员</dt>
  38 + <dt>状态</dt>
  39 + </dl>
  40 + </div>
  41 + <div class="ct_table_body"></div>
  42 + </div>
  43 + </div>
  44 + </form>
  45 + <form class="uk-form uk-form-horizontal tzrc_form">
  46 + <div class="uk-grid">
  47 + <div class="uk-width-1-2">
  48 + <div class="uk-form-row">
  49 + <label class="uk-form-label">车辆</label>
  50 + <div class="uk-form-controls" >
  51 + <div class="uk-autocomplete uk-form car-autocom" style="width: 77%;">
  52 + <input type="text" value="" name="clZbh" required>
  53 + </div>
  54 + <label class="blue_checkbox cl_enable_key_label">
  55 + <input type="checkbox" checked>
  56 + </label>
  57 + </div>
  58 + </div>
  59 + </div>
  60 + <div class="uk-width-1-2">
  61 + <div class="uk-form-row">
  62 + <label class="uk-form-label">驾驶员 </label>
  63 + <div class="uk-form-controls">
  64 + <div class="uk-autocomplete uk-form jsy-autocom" style="width: 77%;">
  65 + <input type="text" value="" name="jsy" required>
  66 + </div>
  67 + <label class="blue_checkbox jsy_enable_key_label">
  68 + <input type="checkbox">
  69 + </label>
  70 + </div>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + <div class="uk-grid">
  75 + <div class="uk-width-1-2">
  76 + <div class="uk-form-row">
  77 + <label class="uk-form-label">售票员</label>
  78 + <div class="uk-form-controls">
  79 + <div class="uk-autocomplete uk-form spy-autocom">
  80 + <input type="text" value="" name="spy">
  81 + </div>
  82 + </div>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;position: relative;">
  87 + <button type="button" class="uk-button uk-modal-close">取消</button>
  88 + <button type="submit" class="uk-button uk-button-primary" ><i class="uk-icon-check"></i> &nbsp;保存
  89 + </button>
  90 + </div>
  91 + </form>
  92 + </div>
  93 +
  94 + <script id="schedule-tzrc-table-temp" type="text/html">
  95 + {{each list as sch i}}
  96 + <dl data-id="{{sch.id}}" {{if sch.status==0}}class="no_exec_sch_row"{{/if}}>
  97 + <dd>
  98 + <input type="checkbox" value=1 name="schCBox" class="i-cbox" >
  99 + {{sch.dfsj}}
  100 + {{if sch.bcType == "out"}}
  101 + <span class="uk-badge uk-badge-success">出场</span>
  102 + {{else if sch.bcType == "in"}}
  103 + <span class="uk-badge uk-badge-warning">进场</span>
  104 + {{else if sch.bcType == "venting"}}
  105 + <span class="uk-badge uk-badge-danger">直放</span>
  106 + {{else if sch.bcType == "major"}}
  107 + <span class="uk-badge uk-badge-danger">放站</span>
  108 + {{/if}}
  109 + {{if sch.sflj}}
  110 + <span class="uk-badge uk-badge-danger">临加</span>
  111 + {{/if}}
  112 + {{if sch.cTasks.length > 0}}
  113 + <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span>
  114 + {{/if}}
  115 + </dd>
  116 + <dd data-old="{{sch.clZbh}}">{{sch.clZbh}}</dd>
  117 + <dd data-old="{{sch.jGh}}/{{sch.jName}}">{{sch.jGh}}/{{sch.jName}}</dd>
  118 + <dd data-old="{{sch.sGh}}/{{sch.sName}}">{{sch.sGh}}/{{sch.sName}}</dd>
  119 + <dd>
  120 + {{if sch.status==2}}
  121 + <span class="ct_zt_yzx">已执行</span>
  122 + {{else if sch.status==1}}
  123 + <span class="ct_zt_zzzx">正在执行</span>
  124 + {{else if sch.status==-1}}
  125 + <span class="ct_zt_lb">烂班</span>
  126 + {{/if}}
  127 + </dd>
  128 + </dl>
  129 + {{/each}}
  130 + </script>
  131 + <script>
  132 + (function () {
  133 + var modal = '#schedule-tzrc-modal',
  134 + sch, schList, lp2SchMap;
  135 + $(modal).on('init', function (e, data) {
  136 + e.stopPropagation();
  137 + sch = data.sch;
  138 +
  139 + //滚动条
  140 + $('.tzrc-table-wrap', modal).perfectScrollbar();
  141 + //线路下拉框
  142 + var opts = '';
  143 + $.each(gb_data_basic.activeLines, function () {
  144 + opts += '<option value="' + this.lineCode + '">' + this.name + '</option>';
  145 + });
  146 + $('[name=lineSelect]', modal).html(opts)
  147 + .on('change', function () {
  148 + var lineCode = $(this).val();
  149 + schList = gb_schedule_table.findScheduleByLine(lineCode);
  150 + lp2SchMap = gb_common.groupBy(schList, 'lpName');
  151 +
  152 + var opts = '';
  153 + for (var lpName in lp2SchMap)
  154 + opts += '<option value="' + lpName + '">' + lpName + '</option>';
  155 + $('[name=lpName]', modal).html(opts).trigger('change');
  156 + });
  157 +
  158 + //路牌下拉框
  159 + $('[name=lpName]', modal).on('change', function () {
  160 + var list = lp2SchMap[$(this).val()].sort(gb_schedule_table.schedule_sort),
  161 + htmlBody = template('schedule-tzrc-table-temp', {
  162 + list: list
  163 + });
  164 + $('.sch-tzrc-table .ct_table_body', modal).html(htmlBody);
  165 + //更新滚动条高度
  166 + $('.tzrc-table-wrap', modal).perfectScrollbar('update');
  167 + });
  168 +
  169 +
  170 + writeSch2Form(sch);
  171 + $(modal).on('click', '.sch-tzrc-table .ct_table_body dl', function () {
  172 + var cbox = $('input[type=checkbox]',this)[0];
  173 + //var active = $();
  174 + if(!$(this).hasClass('active')){
  175 + $(this).addClass('active');
  176 + cbox.checked = true;
  177 + renderCell();
  178 + }
  179 + else{
  180 + $(this).removeClass('active');
  181 + cbox.checked = false;
  182 + //$(this).find('dd[data-old]').text()
  183 + var $jsyCell = $($($(this).find('dd')[2]));
  184 + var $spyCell = $($($(this).find('dd')[3]));
  185 + var $clCell = $($($(this).find('dd')[1]));
  186 + $jsyCell.text($jsyCell.data('old'));
  187 + $spyCell.text($spyCell.data('old'));
  188 + $clCell.text($clCell.data('old'));
  189 + }
  190 + });
  191 +
  192 + //默认选中项
  193 + $('[name=lineSelect]', modal).val(sch.xlBm).trigger('change');
  194 + $('[name=lpName]', modal).val(sch.lpName).trigger('change');
  195 + var dl = $('.sch-tzrc-table', modal).find('dl[data-id=' + sch.id + ']');
  196 + $('input[type=checkbox]', dl).trigger('click');
  197 +
  198 + //滚动到可视区域
  199 + var cont = $('.tzrc-table-wrap', modal);
  200 + cont.animate({
  201 + scrollTop: dl.offset().top - cont.offset().top + cont.scrollTop() - 38
  202 + }, 500);
  203 +
  204 + gb_ct_table.fixedHead($('.ct_table_wrap', modal));
  205 +
  206 + //----------- Autocomplete --------------
  207 + $.get('/basic/cars', function (rs) {
  208 + //车辆
  209 + gb_common.carAutocomplete($('.car-autocom', modal), rs);
  210 + });
  211 + //$.get('/basic/all_personnel', function(rs) {
  212 + //驾驶员
  213 + gb_common.personAutocomplete($('.jsy-autocom', modal));
  214 + //售票员
  215 + gb_common.personAutocomplete($('.spy-autocom', modal));
  216 + //});
  217 +
  218 + //submit
  219 + var f = $('form.tzrc_form', modal);
  220 + f.on('submit', function (e) {
  221 + e.stopPropagation();
  222 + $('[type=submit]', f).attr('disabled', 'disabled');
  223 +
  224 + var checkeds = $('.sch-tzrc-table .ct_table_body input[type=checkbox]:checked', modal);
  225 + if (checkeds.length == 0)
  226 + return notify_err('请选中要调整的班次');
  227 +
  228 + var param = $(this).serializeJSON();
  229 + var data = [];
  230 + var schId;
  231 + $.each(checkeds, function () {
  232 + schId = $(this).parents('dl').data('id');
  233 + data.push({
  234 + schId: schId,
  235 + jsy: param.jsy,
  236 + spy: param.spy,
  237 + clZbh: param.clZbh
  238 + });
  239 + });
  240 +
  241 + //提交之前做一次公司校验
  242 + check_fgs_ascription(data[0], function () {
  243 + gb_common.$post('/realSchedule/multi_tzrc', {
  244 + cpcsJson: JSON.stringify(data)
  245 + }, function (rs) {
  246 + if (rs.ts && rs.ts.length > 0) {
  247 + gb_schedule_table.updateSchedule(rs.ts);
  248 + UIkit.modal(modal).hide();
  249 + notify_succ('调整人车成功');
  250 + }
  251 + });
  252 + });
  253 + return false;
  254 + });
  255 +
  256 + /**
  257 + * 驾驶员/售票员文本框改变事件
  258 + */
  259 + var renderRunFlag;
  260 + $('input[name=jsy],input[name=spy],input[name=clZbh]', modal).on('input change', function () {
  261 + if(renderRunFlag)
  262 + return;
  263 + renderRunFlag = true;
  264 + setTimeout(function () {
  265 + renderCell();
  266 + renderRunFlag = false;
  267 + }, 200);
  268 + });
  269 +
  270 + $('.jsy_enable_key_label', modal).on('click', function () {
  271 + var checked = $('input[type=checkbox]', this)[0].checked;
  272 + if(checked)
  273 + enableJsy();
  274 + else
  275 + disabledJsy();
  276 + });
  277 +
  278 + $('.cl_enable_key_label', modal).on('click', function () {
  279 + var checked = $('input[type=checkbox]', this)[0].checked;
  280 + if(checked)
  281 + enableCl();
  282 + else
  283 + disabledCl();
  284 + });
  285 + });
  286 +
  287 + function check_fgs_ascription(data, cb) {
  288 + var jGh,sGh,nbbm = data.clZbh;
  289 + if(data.spy)
  290 + sGh = data.spy.split('/')[0];
  291 + if(data.jsy)
  292 + jGh = data.jsy.split('/')[0];
  293 +
  294 + gb_common.$post('/realSchedule/check_fgs_ascription',{
  295 + schId: data.schId,
  296 + jGh: jGh,
  297 + sGh: sGh,
  298 + nbbm: nbbm
  299 + }
  300 + , function (rs) {
  301 + //$('form.tzrc_form [type=submit]', modal).removeAttr('disabled');
  302 + if(rs['checkStatus']==1)
  303 + cb && cb();
  304 + else if (rs['checkStatus']==-2){
  305 + UIkit.modal.alert('<p style="color: #ff4141;font-size: 15px;">'+rs.msg+'</p>', {labels: {Ok: '确定'}});
  306 + return;
  307 + }
  308 + else if (rs['checkStatus']==-1){
  309 + //二次确认
  310 + alt_confirm('<p style="font-weight: 600;font-size: 15px;">'+rs.msg+'</p>', cb, '我确定要操作!', true);
  311 + }
  312 + });
  313 + }
  314 +
  315 + function renderCell() {
  316 + var jsy = $('input[name=jsy]:enabled', modal).val();
  317 + var spy = $('input[name=spy]', modal).val();
  318 + var nbbm = $('input[name=clZbh]:enabled', modal).val();
  319 + $('.sch-tzrc-table .ct_table_body>dl.active').each(function () {
  320 + var jsyCell = $(this).find('dd')[2];
  321 + var spyCell = $(this).find('dd')[3];
  322 + var clCell = $(this).find('dd')[1];
  323 +
  324 + if(jsy)
  325 + $(jsyCell).text(jsy);
  326 + if(nbbm)
  327 + $(clCell).text(nbbm);
  328 + $(spyCell).text(spy);
  329 + });
  330 + }
  331 +
  332 + function writeSch2Form(sch) {
  333 + var f = $('.tzrc_form', modal);
  334 + $('input[name=clZbh]', f).val(sch.clZbh).trigger('input');
  335 + $('input[name=jsy]', f).val(sch.jGh + '/' + sch.jName).trigger('input');
  336 + if (sch.sGh)
  337 + $('input[name=spy]', f).val(sch.sGh + '/' + sch.sName);
  338 + }
  339 +
  340 + //全选
  341 + $('#globalCheckBox', modal).on('click', function () {
  342 + clearCheckAll();
  343 + var status = this.checked;
  344 + if(status){
  345 + var id;
  346 + $('.no_exec_sch_row', modal).each(function () {
  347 + $(this).addClass('active');
  348 + $('input[type=checkbox]',this)[0].checked = true;
  349 + id = $(this).data('id');
  350 + });
  351 +
  352 + var lineCode = $('[name=lineSelect]', modal).val();
  353 + var sch = gb_schedule_table.findScheduleByLine(lineCode)[id];
  354 + writeSch2Form(sch);
  355 + }
  356 + });
  357 +
  358 + function clearCheckAll() {
  359 + $('.sch-tzrc-table .ct_table_body>dl', modal).each(function () {
  360 + $(this).removeClass('active');
  361 + $('input[type=checkbox]',this)[0].checked = false;
  362 +
  363 + $.each($('dd', this), function () {
  364 + if($(this).data('old'))
  365 + $(this).text($(this).data('old'));
  366 + });
  367 + });
  368 + }
  369 +
  370 + function disabledJsy() {
  371 + $('[name=jsy]',modal).attr('disabled', 'disabled');
  372 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  373 + var jsyCell = $(this).find('dd')[2];
  374 + $(jsyCell).addClass('disabled').text($(jsyCell).data('old'));
  375 + });
  376 + }
  377 +
  378 + function enableJsy() {
  379 + $('[name=jsy]',modal).removeAttr('disabled');
  380 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  381 + var jsyCell = $(this).find('dd')[2];
  382 + $(jsyCell).removeClass('disabled').text($(jsyCell).data('old'));
  383 + });
  384 + }
  385 +
  386 + function disabledCl() {
  387 + $('[name=clZbh]',modal).attr('disabled', 'disabled');
  388 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  389 + var clCell = $(this).find('dd')[1];
  390 + $(clCell).addClass('disabled').text($(clCell).data('old'));
  391 + });
  392 + }
  393 +
  394 + function enableCl() {
  395 + $('[name=clZbh]',modal).removeAttr('disabled');
  396 + $('.sch-tzrc-table .ct_table_body>dl').each(function () {
  397 + var clCell = $(this).find('dd')[1];
  398 + $(clCell).removeClass('disabled').text($(clCell).data('old'));
  399 + });
  400 + }
  401 + })();
  402 + </script>
  403 +</div>
... ...