Commit 2bdbde5b44ec636fb5cee7ef84a3a805bf46621d

Authored by 潘钊
1 parent 9ab7bacf

修改浦东配置文件

src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_venting.html
... ... @@ -28,65 +28,106 @@
28 28 <div class="uk-form-row ct-stacked">
29 29 <label class="uk-form-label" for="form-s-t"><i class="uk-icon-bullhorn"></i>&nbsp; 指令内容</label>
30 30 <div class="uk-form-controls">
31   - <textarea style="color: #e53636;" id="form-s-t" cols="30" placeholder="指令内容" rows="5" name="directiveStr" data-fv-stringlength="true" data-fv-stringlength-max="50" ></textarea>
  31 + <textarea style="color: #e53636;" id="form-s-t" cols="30" placeholder="指令内容" rows="5"
  32 + name="directiveStr" data-fv-stringlength="true"
  33 + data-fv-stringlength-max="50"></textarea>
32 34 </div>
33 35 </div>
34 36 </div>
35 37 </div>
36 38 <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
37 39 <button type="button" class="uk-button uk-modal-close">取消</button>
38   - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-send"></i> &nbsp;确认调整并下发指令</button>
  40 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-send"></i> &nbsp;确认调整并下发指令
  41 + </button>
39 42 </div>
40 43 </form>
41 44 </div>
42 45  
43 46 <script>
44   - (function() {
  47 + (function () {
45 48 var modal = '#bctype-venting-modal'
46   - ,sch,stationRoutes;
47   - $(modal).on('init', function(e, data) {
48   - sch=data.sch;
  49 + , sch, stationRoutes;
  50 +
  51 + $('[name=startStation],[name=endStation]', modal).on('change', refreshDirectiveStr);
  52 +
  53 +
  54 + function refreshDirectiveStr() {
  55 + //指令内容
  56 + var qdzName = $('[name=startStation]').find("option:selected").text()
  57 + , zdzName = $('[name=endStation]').find("option:selected").text();
  58 + $('[name=directiveStr]', modal).text('班次:'+sch.dfsj+' 由 ' + qdzName + ' 直放至 ' + zdzName);
  59 + }
  60 +
  61 + $('[name=startStation]', modal).on('change', function () {
  62 + var ops = $('[name=endStation]', modal).find('option');
  63 +
  64 + var flag, code = $(this).val();
  65 + $.each(ops, function () {
  66 + if (!flag)
  67 + $(this).attr('disabled', 'disabled');
  68 + else
  69 + $(this).removeAttr('disabled');
  70 + if (this.value == code)
  71 + flag = true;
  72 + });
  73 + });
  74 +
  75 + $('[name=endStation]', modal).on('change', function () {
  76 + var ops = $('[name=startStation]', modal).find('option');
  77 +
  78 + var flag, code = $(this).val();
  79 + $.each(ops, function () {
  80 + if (this.value == code)
  81 + flag = true;
  82 +
  83 + if (flag)
  84 + $(this).attr('disabled', 'disabled');
  85 + else
  86 + $(this).removeAttr('disabled');
  87 + });
  88 + });
  89 + $(modal).on('init', function (e, data) {
  90 + sch = data.sch;
49 91  
50 92 //站点路由
51   - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function(a, b){
52   - return a.stationRouteCode-b.stationRouteCode;
  93 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  94 + return a.stationRouteCode - b.stationRouteCode;
53 95 }), 'directions');
54 96  
55   - var opts='';
56   - $.each(stationRoutes[sch.xlDir], function(){
57   - opts+='<option value="'+this.stationCode+'">'+this.stationName+'</option>';
  97 + var opts = '';
  98 + $.each(stationRoutes[sch.xlDir], function () {
  99 + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>';
58 100 });
59   - $('[name=startStation]',modal).html(opts).val(sch.qdzCode);
60   - $('[name=endStation]',modal).html(opts).val(sch.zdzCode);
61   - //指令内容
62   - $('[name=directiveStr]',modal).text('从 ' + sch.qdzName + ' 直放至 ' + sch.zdzName);
  101 + $('[name=startStation]', modal).html(opts).val(sch.qdzCode);
  102 + $('[name=endStation]', modal).html(opts).val(sch.zdzCode);
  103 + $('[name=startStation]', modal).trigger('change');
  104 + $('[name=endStation]', modal).trigger('change');
63 105  
64 106 //submit
65 107 var f = $('form', modal).formValidation(gb_form_validation_opts);
66   - f.on('success.form.fv', function(e) {
  108 + f.on('success.form.fv', function (e) {
67 109 e.preventDefault();
68 110 var data = $(this).serializeJSON();
69   - console.log(data);
70   - });
71   -
72   - $('[name=startStation],[name=endStation]',modal).on('change', refreshDirectiveStr);
73   -
  111 + notify_wait('准备下发指令')
  112 + //下发指令
  113 + $.post('/directive/phrase', {nbbm: sch.clZbh, text: data.directiveStr}, function (rs) {
  114 + if (rs == 0) {
  115 + notify_succ('指令下发成功');
74 116  
75   - function refreshDirectiveStr(){
76   - //指令内容
77   - var qdzName=$('[name=startStation]').find("option:selected").text()
78   - ,zdzName=$('[name=endStation]').find("option:selected").text();
79   - $('[name=directiveStr]',modal).text('从 ' + qdzName + ' 直放至 ' + zdzName);
80   - }
81   -
82   - $('[name=startStation]',modal).on('change', function () {
83   - var ops=$('[name=endStation]', modal).find('option');
84   -
85   - var flag=0, code=$(this).val();
86   - $.each(ops, function () {
87   - if(this.stationCode==code)
  117 +
  118 + }
  119 + else
  120 + notify_err('指令下发失败');
88 121 });
89 122 });
  123 +
  124 + function changeBcType() {
  125 + //将班次类型调整为直放
  126 + gb_common.$post('/realSchedule/changeBcType', {bcType: 'venting'}, function(rs){
  127 + gb_schedule_table.updateSchedule(rs.t);
  128 + //触发父容器刷新事件
  129 + });
  130 + }
90 131 });
91 132 })();
92 133 </script>
... ...