Commit 51aaebc0f5d0f411d899d1368f4ca54306a13db4
1 parent
69d4efef
1.烂班原因调整
Showing
9 changed files
with
3690 additions
and
3690 deletions
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
| 1 | -<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-fcxxwt-modal"> | ||
| 2 | - <div class="uk-modal-dialog"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>发车信息微调</h2></div> | ||
| 6 | - <form class="uk-form uk-form-horizontal"> | ||
| 7 | - </form> | ||
| 8 | - </div> | ||
| 9 | - | ||
| 10 | - <script id="schedule-fcxxwt-form-temp" type="text/html"> | ||
| 11 | - <input type="hidden" name="id" value="{{sch.id}}"/> | ||
| 12 | - | ||
| 13 | - <div class="uk-grid"> | ||
| 14 | - <div class="uk-width-1-2"> | ||
| 15 | - <div class="uk-form-row"> | ||
| 16 | - <label class="uk-form-label" >发车站点</label> | ||
| 17 | - <div class="uk-form-controls"> | ||
| 18 | - <input type="text" value="{{sch.qdzName}}" disabled> | ||
| 19 | - </div> | ||
| 20 | - </div> | ||
| 21 | - </div> | ||
| 22 | - <div class="uk-width-1-2"> | ||
| 23 | - <div class="uk-form-row"> | ||
| 24 | - <label class="uk-form-label" >结束站点</label> | ||
| 25 | - <div class="uk-form-controls"> | ||
| 26 | - <input type="text" value="{{sch.zdzName}}" disabled> | ||
| 27 | - </div> | ||
| 28 | - </div> | ||
| 29 | - </div> | ||
| 30 | - </div> | ||
| 31 | - <div class="uk-grid"> | ||
| 32 | - <div class="uk-width-1-2"> | ||
| 33 | - <div class="uk-form-row"> | ||
| 34 | - <label class="uk-form-label" >车辆编码</label> | ||
| 35 | - <div class="uk-form-controls"> | ||
| 36 | - <div class="uk-autocomplete uk-form car-autocom"> | ||
| 37 | - <input type="text" value="{{sch.clZbh}}" name="clZbh" required> | ||
| 38 | - </div> | ||
| 39 | - </div> | ||
| 40 | - </div> | ||
| 41 | - </div> | ||
| 42 | - <div class="uk-width-1-2"> | ||
| 43 | - <div class="uk-form-row"> | ||
| 44 | - <label class="uk-form-label" >路 牌</label> | ||
| 45 | - <div class="uk-form-controls"> | ||
| 46 | - <input type="text" value="{{sch.lpName}}" disabled> | ||
| 47 | - </div> | ||
| 48 | - </div> | ||
| 49 | - </div> | ||
| 50 | - </div> | ||
| 51 | - | ||
| 52 | - <div class="uk-grid"> | ||
| 53 | - <div class="uk-width-1-2"> | ||
| 54 | - <div class="uk-form-row"> | ||
| 55 | - <label class="uk-form-label" >驾驶员</label> | ||
| 56 | - <div class="uk-form-controls"> | ||
| 57 | - <div class="uk-autocomplete uk-form jsy-autocom"> | ||
| 58 | - <input type="text" value="{{sch.jGh}}/{{sch.jName}}" name="jsy" required> | ||
| 59 | - </div> | ||
| 60 | - </div> | ||
| 61 | - </div> | ||
| 62 | - </div> | ||
| 63 | - <div class="uk-width-1-2"> | ||
| 64 | - <div class="uk-form-row"> | ||
| 65 | - <label class="uk-form-label" >售票员</label> | ||
| 66 | - <div class="uk-form-controls"> | ||
| 67 | - <div class="uk-autocomplete uk-form spy-autocom"> | ||
| 68 | - <input type="text" value="{{sch.sGh}}/{{sch.sName}}" name="spy"> | ||
| 69 | - </div> | ||
| 70 | - </div> | ||
| 71 | - </div> | ||
| 72 | - </div> | ||
| 73 | - </div> | ||
| 74 | - | ||
| 75 | - <div class="uk-grid"> | ||
| 76 | - <div class="uk-width-1-2"> | ||
| 77 | - <div class="uk-form-row"> | ||
| 78 | - <label class="uk-form-label" >计发时刻</label> | ||
| 79 | - <div class="uk-form-controls"> | ||
| 80 | - <input type="text" value="{{sch.fcsj}}" disabled> | ||
| 81 | - </div> | ||
| 82 | - </div> | ||
| 83 | - </div> | ||
| 84 | - <div class="uk-width-1-2"> | ||
| 85 | - <div class="uk-form-row"> | ||
| 86 | - <label class="uk-form-label" >实际时刻</label> | ||
| 87 | - <div class="uk-form-controls"> | ||
| 88 | - <input type="time" value="{{sch.fcsjActual}}" name="fcsjActual" {{if sch.status==0}}autofocus{{/if}}> | ||
| 89 | - </div> | ||
| 90 | - </div> | ||
| 91 | - </div> | ||
| 92 | - </div> | ||
| 93 | - | ||
| 94 | - <div class="uk-grid"> | ||
| 95 | - <div class="uk-width-1-2"> | ||
| 96 | - <div class="uk-form-row"> | ||
| 97 | - <label class="uk-form-label" >到达时刻</label> | ||
| 98 | - <div class="uk-form-controls"> | ||
| 99 | - <input type="time" value="{{sch.zdsjActual}}" name="zdsjActual" {{if sch.status==1}}autofocus{{/if}}> | ||
| 100 | - </div> | ||
| 101 | - </div> | ||
| 102 | - </div> | ||
| 103 | - <div class="uk-width-1-2"> | ||
| 104 | - <div class="uk-form-row"> | ||
| 105 | - <label class="uk-form-label" >班次类型</label> | ||
| 106 | - <div class="uk-form-controls"> | ||
| 107 | - <select class="form-control nt-dictionary" data-code="{{sch.bcType}}" name="bcType" data-group=ScheduleType></select> | ||
| 108 | - </div> | ||
| 109 | - </div> | ||
| 110 | - </div> | ||
| 111 | - </div> | ||
| 112 | - | ||
| 113 | - <div class="uk-grid"> | ||
| 114 | - <div class="uk-width-1-1"> | ||
| 115 | - <div class="uk-form-row"> | ||
| 116 | - <label class="uk-form-label" >调整说明</label> | ||
| 117 | - <div class="uk-form-controls"> | ||
| 118 | - <select name="adjustExps"> | ||
| 119 | - <option value="">请选择..</option> | ||
| 120 | - {{each adjustExps as exp i}} | ||
| 121 | - <option value="{{exp}}">{{exp}}</option> | ||
| 122 | - {{/each}} | ||
| 123 | - </select> | ||
| 124 | - </div> | ||
| 125 | - </div> | ||
| 126 | - </div> | ||
| 127 | - </div> | ||
| 128 | - <div class="uk-grid"> | ||
| 129 | - <div class="uk-width-1-1"> | ||
| 130 | - <div class="uk-form-row ct-stacked"> | ||
| 131 | - <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 132 | - <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="50" placeholder="备注,不超过50个字符">{{sch.remarks}}</textarea> | ||
| 133 | - </div> | ||
| 134 | - </div> | ||
| 135 | - </div> | ||
| 136 | - </div> | ||
| 137 | - | ||
| 138 | - <hr class="modal-dotted-hr"> | ||
| 139 | - <div class="uk-grid"> | ||
| 140 | - <div class="uk-width-1-2"> | ||
| 141 | - <div class="uk-form-row"> | ||
| 142 | - <label class="uk-form-label" >里程</label> | ||
| 143 | - <div class="uk-form-controls"> | ||
| 144 | - <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" required> | ||
| 145 | - </div> | ||
| 146 | - </div> | ||
| 147 | - </div> | ||
| 148 | - <div class="uk-width-1-2"> | ||
| 149 | - <div class="uk-form-row"> | ||
| 150 | - <div class="uk-form-controls" style="margin-left: 0;margin-top: 9px;"> | ||
| 151 | - <label> | ||
| 152 | - <input class="i-cbox destroy-box" type="checkbox" name="status" value="-1" {{if sch.status==-1}}checked disabled{{/if}}> | ||
| 153 | - 是否烂班 | ||
| 154 | - </label> | ||
| 155 | - </div> | ||
| 156 | - </div> | ||
| 157 | - </div> | ||
| 158 | - </div> | ||
| 159 | - | ||
| 160 | - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | ||
| 161 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 162 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 163 | - </div> | ||
| 164 | - </script> | ||
| 165 | - | ||
| 166 | - <script> | ||
| 167 | - (function() { | ||
| 168 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 169 | - var modal = '#schedule-fcxxwt-modal' | ||
| 170 | - ,sch; | ||
| 171 | - $(modal).on('init', function(e, data) { | ||
| 172 | - e.stopPropagation(); | ||
| 173 | - sch=data.sch; | ||
| 174 | - var formHtml = template('schedule-fcxxwt-form-temp', {sch: sch, adjustExps:adjustExps}); | ||
| 175 | - $('form', modal).html(formHtml); | ||
| 176 | - //字典转换 | ||
| 177 | - dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 178 | - | ||
| 179 | - //车辆自动补全 | ||
| 180 | - $.get('/basic/cars', function (rs) { | ||
| 181 | - gb_common.carAutocomplete($('.car-autocom', modal), rs); | ||
| 182 | - }); | ||
| 183 | - //驾驶员自动补全 | ||
| 184 | - gb_common.personAutocomplete($('.jsy-autocom', modal)); | ||
| 185 | - //售票员 | ||
| 186 | - gb_common.personAutocomplete($('.spy-autocom', modal)); | ||
| 187 | - | ||
| 188 | - //submit | ||
| 189 | - var f = $('form', modal).formValidation(gb_form_validation_opts); | ||
| 190 | - f.on('success.form.fv', function(e) { | ||
| 191 | - e.preventDefault(); | ||
| 192 | - var data = $(this).serializeJSON(); | ||
| 193 | - | ||
| 194 | - //校验实发实达时间 | ||
| 195 | - if(!validation_s_e_Time(data)){ | ||
| 196 | - notify_err("实发时间不能晚于实达时间!"); | ||
| 197 | - return; | ||
| 198 | - } | ||
| 199 | - | ||
| 200 | - //正常班次里程修改为0 | ||
| 201 | - var normalDestory = data.jhlc==0 && sch.bcType != 'in' && sch.bcType != 'out'; | ||
| 202 | - //修改里程 | ||
| 203 | - var editJhlc = data.jhlc != sch.jhlc && data.jhlc != 0; | ||
| 204 | - if(!data.adjustExps && (data.status==-1 || normalDestory || editJhlc)){ | ||
| 205 | - notify_err("当前操作需要选择调整原因!"); | ||
| 206 | - return; | ||
| 207 | - } | ||
| 208 | - postData(data); | ||
| 209 | - }); | ||
| 210 | - | ||
| 211 | - var postData = function (data) { | ||
| 212 | - gb_common.$post('/realSchedule/schInfoFineTune', data, function(rs){ | ||
| 213 | - gb_schedule_table.updateSchedule(rs.ts); | ||
| 214 | - UIkit.modal(modal).hide(); | ||
| 215 | - notify_succ('操作成功!'); | ||
| 216 | - //计算应发未发 | ||
| 217 | - gb_schedule_table.calc_yfwf_num(sch.xlBm); | ||
| 218 | - //更新路牌公里统计面板 | ||
| 219 | - gb_schedule_table.showLpMileageTipBySch(sch); | ||
| 220 | - }); | ||
| 221 | - }; | ||
| 222 | - | ||
| 223 | - //班次类型 | ||
| 224 | - $('select[name=bcType] option', f).each(function(){ | ||
| 225 | - var whiteList=['venting', 'major', 'normal', sch.bcType]; | ||
| 226 | - if(whiteList.indexOf($(this).val()) == -1) | ||
| 227 | - $(this).remove(); | ||
| 228 | - }); | ||
| 229 | - if(sch.bcType == 'out' || sch.bcType == 'in'){ | ||
| 230 | - $('[name=bcType]', f).attr('disabled', 'disabled'); | ||
| 231 | - } | ||
| 232 | - | ||
| 233 | - //是否烂班 | ||
| 234 | - $('.destroy-box', f).on('click', function () { | ||
| 235 | - if($(this)[0].checked) | ||
| 236 | - $('input[name=jhlc]', f).val(0); | ||
| 237 | - else | ||
| 238 | - $('input[name=jhlc]', f).val(sch.jhlc); | ||
| 239 | - }); | ||
| 240 | - | ||
| 241 | - $('[name=adjustExps]', f).on('change', function(){ | ||
| 242 | - var rem=$('[name=remarks]', f); | ||
| 243 | - rem.val(rem.val() + $(this).val() + ',').trigger('input'); | ||
| 244 | - }); | ||
| 245 | - | ||
| 246 | - | ||
| 247 | - $('select[name=bcType]', modal).on('change', function(){ | ||
| 248 | - var type = $(this).val(); | ||
| 249 | - if(sch.bcType == 'in' || sch.bcType == 'out') | ||
| 250 | - return; | ||
| 251 | - | ||
| 252 | - var url, detailModal; | ||
| 253 | - if(type=='venting'){ | ||
| 254 | - url='/real_control_v2/fragments/line_schedule/context_menu/bc_type_venting.html'; | ||
| 255 | - detailModal='#bctype-venting-modal'; | ||
| 256 | - } | ||
| 257 | - else if(type=='major'){ | ||
| 258 | - detailModal='#bctype-major-modal'; | ||
| 259 | - url='/real_control_v2/fragments/line_schedule/context_menu/bc_type_major.html'; | ||
| 260 | - } | ||
| 261 | - else return; | ||
| 262 | - | ||
| 263 | - //重置类型,等待调整界面触发刷新事件 | ||
| 264 | - $(this).val(sch.bcType); | ||
| 265 | - | ||
| 266 | - $.get(url, function(htmlStr){ | ||
| 267 | - $(document.body).append(htmlStr); | ||
| 268 | - | ||
| 269 | - UIkit.modal(detailModal, {bgclose: true,modal:false}).show(); | ||
| 270 | - $(detailModal).trigger('init', {sch: sch, parentModal: modal}); | ||
| 271 | - }) | ||
| 272 | - }); | ||
| 273 | - | ||
| 274 | - /** | ||
| 275 | - * 相同选项 也触发 onchange | ||
| 276 | - */ | ||
| 277 | - $('select[name=bcType]', modal).mousedown(function () { | ||
| 278 | - this.sindex = $(this)[0].selectedIndex; | ||
| 279 | - $(this)[0].selectedIndex = -1; | ||
| 280 | - }).mouseout(function () { | ||
| 281 | - if ($(this)[0].selectedIndex === -1) { | ||
| 282 | - $(this)[0].selectedIndex = this.sindex; | ||
| 283 | - } | ||
| 284 | - }); | ||
| 285 | - }); | ||
| 286 | - | ||
| 287 | - function validation_s_e_Time(data) { | ||
| 288 | - var config = gb_data_line_config.get(sch.xlBm); | ||
| 289 | - var st = get_time(sch.scheduleDateStr, data.fcsjActual, config); | ||
| 290 | - var et = get_time(sch.scheduleDateStr, data.zdsjActual, config); | ||
| 291 | - if(st && et && st > et) | ||
| 292 | - return false; | ||
| 293 | - return true; | ||
| 294 | - } | ||
| 295 | - | ||
| 296 | - var DAY_TIME = 1000 * 60 * 60 * 24; | ||
| 297 | - function get_time(rq, timeStr, config) { | ||
| 298 | - var t = null; | ||
| 299 | - if(timeStr){ | ||
| 300 | - t = moment(rq + timeStr, 'YYYY-MM-DDHH:mm'); | ||
| 301 | - if(timeStr.localeCompare(config.startOpt) < 0) | ||
| 302 | - return t + DAY_TIME; | ||
| 303 | - } | ||
| 304 | - | ||
| 305 | - return t; | ||
| 306 | - } | ||
| 307 | - })(); | ||
| 308 | - </script> | ||
| 309 | -</div> | 1 | +<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-fcxxwt-modal"> |
| 2 | + <div class="uk-modal-dialog"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>发车信息微调</h2></div> | ||
| 6 | + <form class="uk-form uk-form-horizontal"> | ||
| 7 | + </form> | ||
| 8 | + </div> | ||
| 9 | + | ||
| 10 | + <script id="schedule-fcxxwt-form-temp" type="text/html"> | ||
| 11 | + <input type="hidden" name="id" value="{{sch.id}}"/> | ||
| 12 | + | ||
| 13 | + <div class="uk-grid"> | ||
| 14 | + <div class="uk-width-1-2"> | ||
| 15 | + <div class="uk-form-row"> | ||
| 16 | + <label class="uk-form-label" >发车站点</label> | ||
| 17 | + <div class="uk-form-controls"> | ||
| 18 | + <input type="text" value="{{sch.qdzName}}" disabled> | ||
| 19 | + </div> | ||
| 20 | + </div> | ||
| 21 | + </div> | ||
| 22 | + <div class="uk-width-1-2"> | ||
| 23 | + <div class="uk-form-row"> | ||
| 24 | + <label class="uk-form-label" >结束站点</label> | ||
| 25 | + <div class="uk-form-controls"> | ||
| 26 | + <input type="text" value="{{sch.zdzName}}" disabled> | ||
| 27 | + </div> | ||
| 28 | + </div> | ||
| 29 | + </div> | ||
| 30 | + </div> | ||
| 31 | + <div class="uk-grid"> | ||
| 32 | + <div class="uk-width-1-2"> | ||
| 33 | + <div class="uk-form-row"> | ||
| 34 | + <label class="uk-form-label" >车辆编码</label> | ||
| 35 | + <div class="uk-form-controls"> | ||
| 36 | + <div class="uk-autocomplete uk-form car-autocom"> | ||
| 37 | + <input type="text" value="{{sch.clZbh}}" name="clZbh" required> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + <div class="uk-width-1-2"> | ||
| 43 | + <div class="uk-form-row"> | ||
| 44 | + <label class="uk-form-label" >路 牌</label> | ||
| 45 | + <div class="uk-form-controls"> | ||
| 46 | + <input type="text" value="{{sch.lpName}}" disabled> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + | ||
| 52 | + <div class="uk-grid"> | ||
| 53 | + <div class="uk-width-1-2"> | ||
| 54 | + <div class="uk-form-row"> | ||
| 55 | + <label class="uk-form-label" >驾驶员</label> | ||
| 56 | + <div class="uk-form-controls"> | ||
| 57 | + <div class="uk-autocomplete uk-form jsy-autocom"> | ||
| 58 | + <input type="text" value="{{sch.jGh}}/{{sch.jName}}" name="jsy" required> | ||
| 59 | + </div> | ||
| 60 | + </div> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + <div class="uk-width-1-2"> | ||
| 64 | + <div class="uk-form-row"> | ||
| 65 | + <label class="uk-form-label" >售票员</label> | ||
| 66 | + <div class="uk-form-controls"> | ||
| 67 | + <div class="uk-autocomplete uk-form spy-autocom"> | ||
| 68 | + <input type="text" value="{{sch.sGh}}/{{sch.sName}}" name="spy"> | ||
| 69 | + </div> | ||
| 70 | + </div> | ||
| 71 | + </div> | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | + | ||
| 75 | + <div class="uk-grid"> | ||
| 76 | + <div class="uk-width-1-2"> | ||
| 77 | + <div class="uk-form-row"> | ||
| 78 | + <label class="uk-form-label" >计发时刻</label> | ||
| 79 | + <div class="uk-form-controls"> | ||
| 80 | + <input type="text" value="{{sch.fcsj}}" disabled> | ||
| 81 | + </div> | ||
| 82 | + </div> | ||
| 83 | + </div> | ||
| 84 | + <div class="uk-width-1-2"> | ||
| 85 | + <div class="uk-form-row"> | ||
| 86 | + <label class="uk-form-label" >实际时刻</label> | ||
| 87 | + <div class="uk-form-controls"> | ||
| 88 | + <input type="time" value="{{sch.fcsjActual}}" name="fcsjActual" {{if sch.status==0}}autofocus{{/if}}> | ||
| 89 | + </div> | ||
| 90 | + </div> | ||
| 91 | + </div> | ||
| 92 | + </div> | ||
| 93 | + | ||
| 94 | + <div class="uk-grid"> | ||
| 95 | + <div class="uk-width-1-2"> | ||
| 96 | + <div class="uk-form-row"> | ||
| 97 | + <label class="uk-form-label" >到达时刻</label> | ||
| 98 | + <div class="uk-form-controls"> | ||
| 99 | + <input type="time" value="{{sch.zdsjActual}}" name="zdsjActual" {{if sch.status==1}}autofocus{{/if}}> | ||
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | + </div> | ||
| 103 | + <div class="uk-width-1-2"> | ||
| 104 | + <div class="uk-form-row"> | ||
| 105 | + <label class="uk-form-label" >班次类型</label> | ||
| 106 | + <div class="uk-form-controls"> | ||
| 107 | + <select class="form-control nt-dictionary" data-code="{{sch.bcType}}" name="bcType" data-group=ScheduleType></select> | ||
| 108 | + </div> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | + | ||
| 113 | + <div class="uk-grid"> | ||
| 114 | + <div class="uk-width-1-1"> | ||
| 115 | + <div class="uk-form-row"> | ||
| 116 | + <label class="uk-form-label" >调整说明</label> | ||
| 117 | + <div class="uk-form-controls"> | ||
| 118 | + <select name="adjustExps"> | ||
| 119 | + <option value="">请选择..</option> | ||
| 120 | + {{each adjustExps as exp i}} | ||
| 121 | + <option value="{{exp}}">{{exp}}</option> | ||
| 122 | + {{/each}} | ||
| 123 | + </select> | ||
| 124 | + </div> | ||
| 125 | + </div> | ||
| 126 | + </div> | ||
| 127 | + </div> | ||
| 128 | + <div class="uk-grid"> | ||
| 129 | + <div class="uk-width-1-1"> | ||
| 130 | + <div class="uk-form-row ct-stacked"> | ||
| 131 | + <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 132 | + <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="50" placeholder="备注,不超过50个字符">{{sch.remarks}}</textarea> | ||
| 133 | + </div> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + </div> | ||
| 137 | + | ||
| 138 | + <hr class="modal-dotted-hr"> | ||
| 139 | + <div class="uk-grid"> | ||
| 140 | + <div class="uk-width-1-2"> | ||
| 141 | + <div class="uk-form-row"> | ||
| 142 | + <label class="uk-form-label" >里程</label> | ||
| 143 | + <div class="uk-form-controls"> | ||
| 144 | + <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" required> | ||
| 145 | + </div> | ||
| 146 | + </div> | ||
| 147 | + </div> | ||
| 148 | + <div class="uk-width-1-2"> | ||
| 149 | + <div class="uk-form-row"> | ||
| 150 | + <div class="uk-form-controls" style="margin-left: 0;margin-top: 9px;"> | ||
| 151 | + <label> | ||
| 152 | + <input class="i-cbox destroy-box" type="checkbox" name="status" value="-1" {{if sch.status==-1}}checked disabled{{/if}}> | ||
| 153 | + 是否烂班 | ||
| 154 | + </label> | ||
| 155 | + </div> | ||
| 156 | + </div> | ||
| 157 | + </div> | ||
| 158 | + </div> | ||
| 159 | + | ||
| 160 | + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | ||
| 161 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 162 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 163 | + </div> | ||
| 164 | + </script> | ||
| 165 | + | ||
| 166 | + <script> | ||
| 167 | + (function() { | ||
| 168 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 169 | + var modal = '#schedule-fcxxwt-modal' | ||
| 170 | + ,sch; | ||
| 171 | + $(modal).on('init', function(e, data) { | ||
| 172 | + e.stopPropagation(); | ||
| 173 | + sch=data.sch; | ||
| 174 | + var formHtml = template('schedule-fcxxwt-form-temp', {sch: sch, adjustExps:adjustExps}); | ||
| 175 | + $('form', modal).html(formHtml); | ||
| 176 | + //字典转换 | ||
| 177 | + dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 178 | + | ||
| 179 | + //车辆自动补全 | ||
| 180 | + $.get('/basic/cars', function (rs) { | ||
| 181 | + gb_common.carAutocomplete($('.car-autocom', modal), rs); | ||
| 182 | + }); | ||
| 183 | + //驾驶员自动补全 | ||
| 184 | + gb_common.personAutocomplete($('.jsy-autocom', modal)); | ||
| 185 | + //售票员 | ||
| 186 | + gb_common.personAutocomplete($('.spy-autocom', modal)); | ||
| 187 | + | ||
| 188 | + //submit | ||
| 189 | + var f = $('form', modal).formValidation(gb_form_validation_opts); | ||
| 190 | + f.on('success.form.fv', function(e) { | ||
| 191 | + e.preventDefault(); | ||
| 192 | + var data = $(this).serializeJSON(); | ||
| 193 | + | ||
| 194 | + //校验实发实达时间 | ||
| 195 | + if(!validation_s_e_Time(data)){ | ||
| 196 | + notify_err("实发时间不能晚于实达时间!"); | ||
| 197 | + return; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + //正常班次里程修改为0 | ||
| 201 | + var normalDestory = data.jhlc==0 && sch.bcType != 'in' && sch.bcType != 'out'; | ||
| 202 | + //修改里程 | ||
| 203 | + var editJhlc = data.jhlc != sch.jhlc && data.jhlc != 0; | ||
| 204 | + if(!data.adjustExps && (data.status==-1 || normalDestory || editJhlc)){ | ||
| 205 | + notify_err("当前操作需要选择调整原因!"); | ||
| 206 | + return; | ||
| 207 | + } | ||
| 208 | + postData(data); | ||
| 209 | + }); | ||
| 210 | + | ||
| 211 | + var postData = function (data) { | ||
| 212 | + gb_common.$post('/realSchedule/schInfoFineTune', data, function(rs){ | ||
| 213 | + gb_schedule_table.updateSchedule(rs.ts); | ||
| 214 | + UIkit.modal(modal).hide(); | ||
| 215 | + notify_succ('操作成功!'); | ||
| 216 | + //计算应发未发 | ||
| 217 | + gb_schedule_table.calc_yfwf_num(sch.xlBm); | ||
| 218 | + //更新路牌公里统计面板 | ||
| 219 | + gb_schedule_table.showLpMileageTipBySch(sch); | ||
| 220 | + }); | ||
| 221 | + }; | ||
| 222 | + | ||
| 223 | + //班次类型 | ||
| 224 | + $('select[name=bcType] option', f).each(function(){ | ||
| 225 | + var whiteList=['venting', 'major', 'normal', sch.bcType]; | ||
| 226 | + if(whiteList.indexOf($(this).val()) == -1) | ||
| 227 | + $(this).remove(); | ||
| 228 | + }); | ||
| 229 | + if(sch.bcType == 'out' || sch.bcType == 'in'){ | ||
| 230 | + $('[name=bcType]', f).attr('disabled', 'disabled'); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + //是否烂班 | ||
| 234 | + $('.destroy-box', f).on('click', function () { | ||
| 235 | + if($(this)[0].checked) | ||
| 236 | + $('input[name=jhlc]', f).val(0); | ||
| 237 | + else | ||
| 238 | + $('input[name=jhlc]', f).val(sch.jhlc); | ||
| 239 | + }); | ||
| 240 | + | ||
| 241 | + $('[name=adjustExps]', f).on('change', function(){ | ||
| 242 | + var rem=$('[name=remarks]', f); | ||
| 243 | + rem.val(rem.val() + $(this).val() + ',').trigger('input'); | ||
| 244 | + }); | ||
| 245 | + | ||
| 246 | + | ||
| 247 | + $('select[name=bcType]', modal).on('change', function(){ | ||
| 248 | + var type = $(this).val(); | ||
| 249 | + if(sch.bcType == 'in' || sch.bcType == 'out') | ||
| 250 | + return; | ||
| 251 | + | ||
| 252 | + var url, detailModal; | ||
| 253 | + if(type=='venting'){ | ||
| 254 | + url='/real_control_v2/fragments/line_schedule/context_menu/bc_type_venting.html'; | ||
| 255 | + detailModal='#bctype-venting-modal'; | ||
| 256 | + } | ||
| 257 | + else if(type=='major'){ | ||
| 258 | + detailModal='#bctype-major-modal'; | ||
| 259 | + url='/real_control_v2/fragments/line_schedule/context_menu/bc_type_major.html'; | ||
| 260 | + } | ||
| 261 | + else return; | ||
| 262 | + | ||
| 263 | + //重置类型,等待调整界面触发刷新事件 | ||
| 264 | + $(this).val(sch.bcType); | ||
| 265 | + | ||
| 266 | + $.get(url, function(htmlStr){ | ||
| 267 | + $(document.body).append(htmlStr); | ||
| 268 | + | ||
| 269 | + UIkit.modal(detailModal, {bgclose: true,modal:false}).show(); | ||
| 270 | + $(detailModal).trigger('init', {sch: sch, parentModal: modal}); | ||
| 271 | + }) | ||
| 272 | + }); | ||
| 273 | + | ||
| 274 | + /** | ||
| 275 | + * 相同选项 也触发 onchange | ||
| 276 | + */ | ||
| 277 | + $('select[name=bcType]', modal).mousedown(function () { | ||
| 278 | + this.sindex = $(this)[0].selectedIndex; | ||
| 279 | + $(this)[0].selectedIndex = -1; | ||
| 280 | + }).mouseout(function () { | ||
| 281 | + if ($(this)[0].selectedIndex === -1) { | ||
| 282 | + $(this)[0].selectedIndex = this.sindex; | ||
| 283 | + } | ||
| 284 | + }); | ||
| 285 | + }); | ||
| 286 | + | ||
| 287 | + function validation_s_e_Time(data) { | ||
| 288 | + var config = gb_data_line_config.get(sch.xlBm); | ||
| 289 | + var st = get_time(sch.scheduleDateStr, data.fcsjActual, config); | ||
| 290 | + var et = get_time(sch.scheduleDateStr, data.zdsjActual, config); | ||
| 291 | + if(st && et && st > et) | ||
| 292 | + return false; | ||
| 293 | + return true; | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + var DAY_TIME = 1000 * 60 * 60 * 24; | ||
| 297 | + function get_time(rq, timeStr, config) { | ||
| 298 | + var t = null; | ||
| 299 | + if(timeStr){ | ||
| 300 | + t = moment(rq + timeStr, 'YYYY-MM-DDHH:mm'); | ||
| 301 | + if(timeStr.localeCompare(config.startOpt) < 0) | ||
| 302 | + return t + DAY_TIME; | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + return t; | ||
| 306 | + } | ||
| 307 | + })(); | ||
| 308 | + </script> | ||
| 309 | +</div> |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/jhlb.html
| 1 | -<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-jhlb-modal"> | ||
| 2 | - <div class="uk-modal-dialog" style="width: 370px;"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>计划烂班</h2></div> | ||
| 6 | - <form class="uk-form uk-form-horizontal"> | ||
| 7 | - </form> | ||
| 8 | - </div> | ||
| 9 | - | ||
| 10 | - <script id="schedule-jhlb-form-temp" type="text/html"> | ||
| 11 | - <div class="uk-grid"> | ||
| 12 | - <div class="uk-width-1-1"> | ||
| 13 | - <div class="uk-form-row"> | ||
| 14 | - <label class="uk-form-label" >内部编码</label> | ||
| 15 | - <div class="uk-form-controls"> | ||
| 16 | - <input value="{{sch.clZbh}}" disabled/> | ||
| 17 | - </div> | ||
| 18 | - </div> | ||
| 19 | - </div> | ||
| 20 | - </div> | ||
| 21 | - | ||
| 22 | - <div class="uk-grid"> | ||
| 23 | - <div class="uk-width-1-1"> | ||
| 24 | - <div class="uk-form-row"> | ||
| 25 | - <label class="uk-form-label" >路牌</label> | ||
| 26 | - <div class="uk-form-controls"> | ||
| 27 | - <select name="lpName"> | ||
| 28 | - {{if lps.length > 1}} | ||
| 29 | - <option value="-100">全部</option> | ||
| 30 | - {{/if}} | ||
| 31 | - {{each lps as lpName i}} | ||
| 32 | - <option value="{{lpName}}">{{lpName}}</option> | ||
| 33 | - {{/each}} | ||
| 34 | - </select> | ||
| 35 | - </div> | ||
| 36 | - </div> | ||
| 37 | - </div> | ||
| 38 | - </div> | ||
| 39 | - | ||
| 40 | - <div class="uk-grid"> | ||
| 41 | - <div class="uk-width-1-1"> | ||
| 42 | - <div class="uk-form-row"> | ||
| 43 | - <label class="uk-form-label" >班次 | ||
| 44 | - <hr> | ||
| 45 | - <label>全选 | ||
| 46 | - <input class="i-cbox" name="allCheck" type="checkbox" > | ||
| 47 | - </label> | ||
| 48 | - </label> | ||
| 49 | - <div class="uk-form-controls sch-time-checkbox-list"> | ||
| 50 | - {{each list as sch i}} | ||
| 51 | - <label data-lp="{{sch.lpName}}" {{if sch.destroy}}class="destroy-sch"{{/if}}> | ||
| 52 | - <input class="i-cbox" name="ids[]" value="{{sch.id}}" type="checkbox" {{if sch.destroy}}disabled{{/if}}> | ||
| 53 | - {{sch.dfsj}} | ||
| 54 | - | ||
| 55 | - {{if sch.bcType == "out"}} | ||
| 56 | - <span class="uk-badge uk-badge-success">出场</span> | ||
| 57 | - {{else if sch.bcType == "in"}} | ||
| 58 | - <span class="uk-badge uk-badge-warning">进场</span> | ||
| 59 | - {{else if sch.bcType == "venting"}} | ||
| 60 | - <span class="uk-badge uk-badge-danger">直放</span> | ||
| 61 | - {{else if sch.bcType == "major"}} | ||
| 62 | - <span class="uk-badge uk-badge-danger">放站</span> | ||
| 63 | - {{/if}} | ||
| 64 | - {{if sch.sflj}} | ||
| 65 | - <span class="uk-badge uk-badge-danger">临加</span> | ||
| 66 | - {{/if}} | ||
| 67 | - {{if sch.destroy}} | ||
| 68 | - <small>已烂班</small> | ||
| 69 | - {{/if}} | ||
| 70 | - </label> | ||
| 71 | - {{/each}} | ||
| 72 | - </div> | ||
| 73 | - </div> | ||
| 74 | - </div> | ||
| 75 | - </div> | ||
| 76 | - <div class="uk-grid"> | ||
| 77 | - <div class="uk-width-1-1"> | ||
| 78 | - <div class="uk-form-row"> | ||
| 79 | - <label class="uk-form-label" >调整说明</label> | ||
| 80 | - <div class="uk-form-controls"> | ||
| 81 | - <select name="adjustExps" required> | ||
| 82 | - <option value="">请选择..</option> | ||
| 83 | - {{each adjustExps as exp i}} | ||
| 84 | - <option value="{{exp}}">{{exp}}</option> | ||
| 85 | - {{/each}} | ||
| 86 | - </select> | ||
| 87 | - </div> | ||
| 88 | - </div> | ||
| 89 | - </div> | ||
| 90 | - </div> | ||
| 91 | - <div class="uk-grid"> | ||
| 92 | - <div class="uk-width-1-1"> | ||
| 93 | - <div class="uk-form-row ct-stacked"> | ||
| 94 | - <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 95 | - <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="20" placeholder="烂班说明,不超过20个字符"></textarea> | ||
| 96 | - </div> | ||
| 97 | - </div> | ||
| 98 | - </div> | ||
| 99 | - </div> | ||
| 100 | - | ||
| 101 | - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | ||
| 102 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 103 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 104 | - </div> | ||
| 105 | - </script> | ||
| 106 | - | ||
| 107 | - <script> | ||
| 108 | - (function() { | ||
| 109 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 110 | - var modal = '#schedule-jhlb-modal', | ||
| 111 | - sch; | ||
| 112 | - $(modal).on('init', function(e, data) { | ||
| 113 | - e.stopPropagation(); | ||
| 114 | - sch = data.sch; | ||
| 115 | - //获取车辆所有班次 | ||
| 116 | - var schArr = gb_common.get_vals(gb_schedule_table.findScheduleByLine(sch.xlBm)).filter(function(item) { | ||
| 117 | - return item.clZbh == sch.clZbh; | ||
| 118 | - }).sort(gb_schedule_table.schedule_sort); | ||
| 119 | - | ||
| 120 | - //获取路牌 | ||
| 121 | - var lps = {}; | ||
| 122 | - $.each(schArr, function () { | ||
| 123 | - lps[this.lpName]=1; | ||
| 124 | - }); | ||
| 125 | - | ||
| 126 | - var formHtml = template('schedule-jhlb-form-temp', { | ||
| 127 | - sch: sch, | ||
| 128 | - list: schArr, | ||
| 129 | - adjustExps:adjustExps, | ||
| 130 | - lps: gb_common.get_keys(lps) | ||
| 131 | - }); | ||
| 132 | - $('form', modal).html(formHtml); | ||
| 133 | - | ||
| 134 | - if(!sch.destroy){ | ||
| 135 | - //选中班次 | ||
| 136 | - var ckbox=$('input[type=checkbox][value='+sch.id+']', f).attr('checked', 'checked'); | ||
| 137 | - //滚动到可视区域 | ||
| 138 | - var cont=$('.sch-time-checkbox-list', f); | ||
| 139 | - cont.animate({ | ||
| 140 | - scrollTop: ckbox.offset().top - cont.offset().top + cont.scrollTop() - 10 | ||
| 141 | - }, 500); | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - //submit | ||
| 145 | - var f = $('form', modal).formValidation(gb_form_validation_opts); | ||
| 146 | - f.on('success.form.fv', function(e) { | ||
| 147 | - e.preventDefault(); | ||
| 148 | - var data = $(this).serializeJSON(); | ||
| 149 | - if(!data.ids || data.ids.length==0){ | ||
| 150 | - UIkit.modal(modal).hide(); | ||
| 151 | - return; | ||
| 152 | - } | ||
| 153 | - var idsStr=''; | ||
| 154 | - $.each(data.ids, function(){idsStr+=(','+this)}); | ||
| 155 | - data.idsStr=idsStr.substr(1); | ||
| 156 | - //提交 | ||
| 157 | - gb_common.$post('/realSchedule/destroy', data, function(rs){ | ||
| 158 | - gb_schedule_table.updateSchedule(rs.ts); | ||
| 159 | - UIkit.modal(modal).hide(); | ||
| 160 | - notify_succ('烂班操作成功!'); | ||
| 161 | - //calc 应发未发 | ||
| 162 | - gb_schedule_table.calc_yfwf_num(sch.xlBm); | ||
| 163 | - }); | ||
| 164 | - }); | ||
| 165 | - | ||
| 166 | - $('[name=adjustExps]', f).on('change', function(){ | ||
| 167 | - var rem=$('[name=remarks]', f); | ||
| 168 | - rem.val(rem.val() + $(this).val() + ',').trigger('input'); | ||
| 169 | - }); | ||
| 170 | - | ||
| 171 | - //路牌切换事件 | ||
| 172 | - $('[name=lpName]', f).on('change', function () { | ||
| 173 | - var v = $(this).val(); | ||
| 174 | - var lbs = $('.sch-time-checkbox-list label', modal); | ||
| 175 | - if(v=='-100'){ | ||
| 176 | - //显示全部 | ||
| 177 | - lbs.show(); | ||
| 178 | - } | ||
| 179 | - else { | ||
| 180 | - lbs.hide().each(function () { | ||
| 181 | - if($(this).data('lp')==v) | ||
| 182 | - $(this).show(); | ||
| 183 | - else{ | ||
| 184 | - //将隐藏的checkbox取消选中 | ||
| 185 | - $(this).find('input[type=checkbox]')[0].checked=false; | ||
| 186 | - } | ||
| 187 | - }); | ||
| 188 | - } | ||
| 189 | - }); | ||
| 190 | - | ||
| 191 | - //全选 | ||
| 192 | - $('[name=allCheck]', f).on('click', function () { | ||
| 193 | - var cbs = $('.sch-time-checkbox-list label input[type=checkbox]:visible:enabled', modal); | ||
| 194 | - var status = this.checked; | ||
| 195 | - cbs.each(function () { | ||
| 196 | - this.checked = status; | ||
| 197 | - }); | ||
| 198 | - }); | ||
| 199 | - }); | ||
| 200 | - })(); | ||
| 201 | - </script> | ||
| 202 | -</div> | 1 | +<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-jhlb-modal"> |
| 2 | + <div class="uk-modal-dialog" style="width: 370px;"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>计划烂班</h2></div> | ||
| 6 | + <form class="uk-form uk-form-horizontal"> | ||
| 7 | + </form> | ||
| 8 | + </div> | ||
| 9 | + | ||
| 10 | + <script id="schedule-jhlb-form-temp" type="text/html"> | ||
| 11 | + <div class="uk-grid"> | ||
| 12 | + <div class="uk-width-1-1"> | ||
| 13 | + <div class="uk-form-row"> | ||
| 14 | + <label class="uk-form-label" >内部编码</label> | ||
| 15 | + <div class="uk-form-controls"> | ||
| 16 | + <input value="{{sch.clZbh}}" disabled/> | ||
| 17 | + </div> | ||
| 18 | + </div> | ||
| 19 | + </div> | ||
| 20 | + </div> | ||
| 21 | + | ||
| 22 | + <div class="uk-grid"> | ||
| 23 | + <div class="uk-width-1-1"> | ||
| 24 | + <div class="uk-form-row"> | ||
| 25 | + <label class="uk-form-label" >路牌</label> | ||
| 26 | + <div class="uk-form-controls"> | ||
| 27 | + <select name="lpName"> | ||
| 28 | + {{if lps.length > 1}} | ||
| 29 | + <option value="-100">全部</option> | ||
| 30 | + {{/if}} | ||
| 31 | + {{each lps as lpName i}} | ||
| 32 | + <option value="{{lpName}}">{{lpName}}</option> | ||
| 33 | + {{/each}} | ||
| 34 | + </select> | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + | ||
| 40 | + <div class="uk-grid"> | ||
| 41 | + <div class="uk-width-1-1"> | ||
| 42 | + <div class="uk-form-row"> | ||
| 43 | + <label class="uk-form-label" >班次 | ||
| 44 | + <hr> | ||
| 45 | + <label>全选 | ||
| 46 | + <input class="i-cbox" name="allCheck" type="checkbox" > | ||
| 47 | + </label> | ||
| 48 | + </label> | ||
| 49 | + <div class="uk-form-controls sch-time-checkbox-list"> | ||
| 50 | + {{each list as sch i}} | ||
| 51 | + <label data-lp="{{sch.lpName}}" {{if sch.destroy}}class="destroy-sch"{{/if}}> | ||
| 52 | + <input class="i-cbox" name="ids[]" value="{{sch.id}}" type="checkbox" {{if sch.destroy}}disabled{{/if}}> | ||
| 53 | + {{sch.dfsj}} | ||
| 54 | + | ||
| 55 | + {{if sch.bcType == "out"}} | ||
| 56 | + <span class="uk-badge uk-badge-success">出场</span> | ||
| 57 | + {{else if sch.bcType == "in"}} | ||
| 58 | + <span class="uk-badge uk-badge-warning">进场</span> | ||
| 59 | + {{else if sch.bcType == "venting"}} | ||
| 60 | + <span class="uk-badge uk-badge-danger">直放</span> | ||
| 61 | + {{else if sch.bcType == "major"}} | ||
| 62 | + <span class="uk-badge uk-badge-danger">放站</span> | ||
| 63 | + {{/if}} | ||
| 64 | + {{if sch.sflj}} | ||
| 65 | + <span class="uk-badge uk-badge-danger">临加</span> | ||
| 66 | + {{/if}} | ||
| 67 | + {{if sch.destroy}} | ||
| 68 | + <small>已烂班</small> | ||
| 69 | + {{/if}} | ||
| 70 | + </label> | ||
| 71 | + {{/each}} | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | + </div> | ||
| 75 | + </div> | ||
| 76 | + <div class="uk-grid"> | ||
| 77 | + <div class="uk-width-1-1"> | ||
| 78 | + <div class="uk-form-row"> | ||
| 79 | + <label class="uk-form-label" >调整说明</label> | ||
| 80 | + <div class="uk-form-controls"> | ||
| 81 | + <select name="adjustExps" required> | ||
| 82 | + <option value="">请选择..</option> | ||
| 83 | + {{each adjustExps as exp i}} | ||
| 84 | + <option value="{{exp}}">{{exp}}</option> | ||
| 85 | + {{/each}} | ||
| 86 | + </select> | ||
| 87 | + </div> | ||
| 88 | + </div> | ||
| 89 | + </div> | ||
| 90 | + </div> | ||
| 91 | + <div class="uk-grid"> | ||
| 92 | + <div class="uk-width-1-1"> | ||
| 93 | + <div class="uk-form-row ct-stacked"> | ||
| 94 | + <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 95 | + <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="20" placeholder="烂班说明,不超过20个字符"></textarea> | ||
| 96 | + </div> | ||
| 97 | + </div> | ||
| 98 | + </div> | ||
| 99 | + </div> | ||
| 100 | + | ||
| 101 | + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | ||
| 102 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 103 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 104 | + </div> | ||
| 105 | + </script> | ||
| 106 | + | ||
| 107 | + <script> | ||
| 108 | + (function() { | ||
| 109 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 110 | + var modal = '#schedule-jhlb-modal', | ||
| 111 | + sch; | ||
| 112 | + $(modal).on('init', function(e, data) { | ||
| 113 | + e.stopPropagation(); | ||
| 114 | + sch = data.sch; | ||
| 115 | + //获取车辆所有班次 | ||
| 116 | + var schArr = gb_common.get_vals(gb_schedule_table.findScheduleByLine(sch.xlBm)).filter(function(item) { | ||
| 117 | + return item.clZbh == sch.clZbh; | ||
| 118 | + }).sort(gb_schedule_table.schedule_sort); | ||
| 119 | + | ||
| 120 | + //获取路牌 | ||
| 121 | + var lps = {}; | ||
| 122 | + $.each(schArr, function () { | ||
| 123 | + lps[this.lpName]=1; | ||
| 124 | + }); | ||
| 125 | + | ||
| 126 | + var formHtml = template('schedule-jhlb-form-temp', { | ||
| 127 | + sch: sch, | ||
| 128 | + list: schArr, | ||
| 129 | + adjustExps:adjustExps, | ||
| 130 | + lps: gb_common.get_keys(lps) | ||
| 131 | + }); | ||
| 132 | + $('form', modal).html(formHtml); | ||
| 133 | + | ||
| 134 | + if(!sch.destroy){ | ||
| 135 | + //选中班次 | ||
| 136 | + var ckbox=$('input[type=checkbox][value='+sch.id+']', f).attr('checked', 'checked'); | ||
| 137 | + //滚动到可视区域 | ||
| 138 | + var cont=$('.sch-time-checkbox-list', f); | ||
| 139 | + cont.animate({ | ||
| 140 | + scrollTop: ckbox.offset().top - cont.offset().top + cont.scrollTop() - 10 | ||
| 141 | + }, 500); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + //submit | ||
| 145 | + var f = $('form', modal).formValidation(gb_form_validation_opts); | ||
| 146 | + f.on('success.form.fv', function(e) { | ||
| 147 | + e.preventDefault(); | ||
| 148 | + var data = $(this).serializeJSON(); | ||
| 149 | + if(!data.ids || data.ids.length==0){ | ||
| 150 | + UIkit.modal(modal).hide(); | ||
| 151 | + return; | ||
| 152 | + } | ||
| 153 | + var idsStr=''; | ||
| 154 | + $.each(data.ids, function(){idsStr+=(','+this)}); | ||
| 155 | + data.idsStr=idsStr.substr(1); | ||
| 156 | + //提交 | ||
| 157 | + gb_common.$post('/realSchedule/destroy', data, function(rs){ | ||
| 158 | + gb_schedule_table.updateSchedule(rs.ts); | ||
| 159 | + UIkit.modal(modal).hide(); | ||
| 160 | + notify_succ('烂班操作成功!'); | ||
| 161 | + //calc 应发未发 | ||
| 162 | + gb_schedule_table.calc_yfwf_num(sch.xlBm); | ||
| 163 | + }); | ||
| 164 | + }); | ||
| 165 | + | ||
| 166 | + $('[name=adjustExps]', f).on('change', function(){ | ||
| 167 | + var rem=$('[name=remarks]', f); | ||
| 168 | + rem.val(rem.val() + $(this).val() + ',').trigger('input'); | ||
| 169 | + }); | ||
| 170 | + | ||
| 171 | + //路牌切换事件 | ||
| 172 | + $('[name=lpName]', f).on('change', function () { | ||
| 173 | + var v = $(this).val(); | ||
| 174 | + var lbs = $('.sch-time-checkbox-list label', modal); | ||
| 175 | + if(v=='-100'){ | ||
| 176 | + //显示全部 | ||
| 177 | + lbs.show(); | ||
| 178 | + } | ||
| 179 | + else { | ||
| 180 | + lbs.hide().each(function () { | ||
| 181 | + if($(this).data('lp')==v) | ||
| 182 | + $(this).show(); | ||
| 183 | + else{ | ||
| 184 | + //将隐藏的checkbox取消选中 | ||
| 185 | + $(this).find('input[type=checkbox]')[0].checked=false; | ||
| 186 | + } | ||
| 187 | + }); | ||
| 188 | + } | ||
| 189 | + }); | ||
| 190 | + | ||
| 191 | + //全选 | ||
| 192 | + $('[name=allCheck]', f).on('click', function () { | ||
| 193 | + var cbs = $('.sch-time-checkbox-list label input[type=checkbox]:visible:enabled', modal); | ||
| 194 | + var status = this.checked; | ||
| 195 | + cbs.each(function () { | ||
| 196 | + this.checked = status; | ||
| 197 | + }); | ||
| 198 | + }); | ||
| 199 | + }); | ||
| 200 | + })(); | ||
| 201 | + </script> | ||
| 202 | +</div> |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_inpark.html
| 1 | -<div class="uk-modal ct_move_modal" id="add-sub-task-inpark-modal"> | ||
| 2 | - <div class="uk-modal-dialog"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>回场子任务</h2></div> | ||
| 6 | - | ||
| 7 | - <div style="width: 100%;padding-left: 1%;"> | ||
| 8 | - <div class="sub-task-card"> | ||
| 9 | - <div class="uk-panel uk-panel-box uk-panel-box-primary twins_task_panel"> | ||
| 10 | - <div class="uk-panel-badge uk-badge">营运</div> | ||
| 11 | - <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 12 | - <form class="uk-form uk-form-horizontal inpark_form" service_form> | ||
| 13 | - <input type="hidden" name="type2" value="1"> | ||
| 14 | - <input type="hidden" name="mileageType" value="service"> | ||
| 15 | - <div class="uk-grid"> | ||
| 16 | - <div class="uk-width-3-10"> | ||
| 17 | - <div class="uk-form-row"> | ||
| 18 | - <label class="uk-form-label">班次类型 </label> | ||
| 19 | - </div> | ||
| 20 | - </div> | ||
| 21 | - <div class="uk-width-7-10 pl5"> | ||
| 22 | - <select name="type1" class="ct_focus" disabled> | ||
| 23 | - <option value="正常">正常</option> | ||
| 24 | - <option value="临加">临加</option> | ||
| 25 | - </select> | ||
| 26 | - </div> | ||
| 27 | - </div> | ||
| 28 | - <div class="uk-grid"> | ||
| 29 | - <div class="uk-width-3-10"> | ||
| 30 | - <div class="uk-form-row"> | ||
| 31 | - <label class="uk-form-label">起点 </label> | ||
| 32 | - </div> | ||
| 33 | - </div> | ||
| 34 | - <div class="uk-width-7-10 pl5"> | ||
| 35 | - <select name="startStation" disabled></select> | ||
| 36 | - </div> | ||
| 37 | - </div> | ||
| 38 | - <div class="uk-grid"> | ||
| 39 | - <div class="uk-width-3-10"> | ||
| 40 | - <div class="uk-form-row"> | ||
| 41 | - <label class="uk-form-label">终点 </label> | ||
| 42 | - </div> | ||
| 43 | - </div> | ||
| 44 | - <div class="uk-width-7-10 pl5"> | ||
| 45 | - <select name="endStation" class="ct_focus"></select> | ||
| 46 | - </div> | ||
| 47 | - </div> | ||
| 48 | - <div class="uk-grid"> | ||
| 49 | - <div class="uk-width-3-10"> | ||
| 50 | - <div class="uk-form-row"> | ||
| 51 | - <label class="uk-form-label">营运里程</label> | ||
| 52 | - </div> | ||
| 53 | - </div> | ||
| 54 | - <div class="uk-width-7-10 pl5"> | ||
| 55 | - <input type="number" step="0.01" name="mileage" required> | ||
| 56 | - </div> | ||
| 57 | - </div> | ||
| 58 | - <div class="uk-grid"> | ||
| 59 | - <div class="uk-width-3-10"> | ||
| 60 | - <div class="uk-form-row"> | ||
| 61 | - <label class="uk-form-label">开始时间</label> | ||
| 62 | - </div> | ||
| 63 | - </div> | ||
| 64 | - <div class="uk-width-7-10 pl5"> | ||
| 65 | - <input type="time" name="startDate" required> | ||
| 66 | - </div> | ||
| 67 | - </div> | ||
| 68 | - <div class="uk-grid"> | ||
| 69 | - <div class="uk-width-3-10"> | ||
| 70 | - <div class="uk-form-row"> | ||
| 71 | - <label class="uk-form-label">结束时间</label> | ||
| 72 | - </div> | ||
| 73 | - </div> | ||
| 74 | - <div class="uk-width-7-10 pl5"> | ||
| 75 | - <input type="time" name="endDate" required> | ||
| 76 | - </div> | ||
| 77 | - </div> | ||
| 78 | - </form> | ||
| 79 | - </div> | ||
| 80 | - </div> | ||
| 81 | - <div class="sub-task-card"> | ||
| 82 | - <div class="uk-panel uk-panel-box uk-panel-box-secondary"> | ||
| 83 | - <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div> | ||
| 84 | - <h3 class="uk-panel-title">进场</h3> | ||
| 85 | - <form class="uk-form uk-form-horizontal inpark_form" empty_form> | ||
| 86 | - <input type="hidden" name="type2" value="2"> | ||
| 87 | - <input type="hidden" name="mileageType" value="empty"> | ||
| 88 | - <div class="uk-grid"> | ||
| 89 | - <div class="uk-width-3-10"> | ||
| 90 | - <div class="uk-form-row"> | ||
| 91 | - <label class="uk-form-label">班次类型 </label> | ||
| 92 | - </div> | ||
| 93 | - </div> | ||
| 94 | - <div class="uk-width-7-10 pl5"> | ||
| 95 | - <select name="type1" class="ct_focus"> | ||
| 96 | - <option value="正常">正常</option> | ||
| 97 | - <option value="临加">临加</option> | ||
| 98 | - </select> | ||
| 99 | - </div> | ||
| 100 | - </div> | ||
| 101 | - <div class="uk-grid"> | ||
| 102 | - <div class="uk-width-3-10"> | ||
| 103 | - <div class="uk-form-row"> | ||
| 104 | - <label class="uk-form-label">起点 </label> | ||
| 105 | - </div> | ||
| 106 | - </div> | ||
| 107 | - <div class="uk-width-7-10 pl5"> | ||
| 108 | - <select name="startStation" ></select> | ||
| 109 | - </div> | ||
| 110 | - </div> | ||
| 111 | - <div class="uk-grid"> | ||
| 112 | - <div class="uk-width-3-10"> | ||
| 113 | - <div class="uk-form-row"> | ||
| 114 | - <label class="uk-form-label">终点 </label> | ||
| 115 | - </div> | ||
| 116 | - </div> | ||
| 117 | - <div class="uk-width-7-10 pl5"> | ||
| 118 | - <select name="endStation" class="ct_focus"></select> | ||
| 119 | - </div> | ||
| 120 | - </div> | ||
| 121 | - <div class="uk-grid"> | ||
| 122 | - <div class="uk-width-3-10"> | ||
| 123 | - <div class="uk-form-row"> | ||
| 124 | - <label class="uk-form-label">空驶里程</label> | ||
| 125 | - </div> | ||
| 126 | - </div> | ||
| 127 | - <div class="uk-width-7-10 pl5"> | ||
| 128 | - <input type="number" step="0.01" name="mileage" required style="width: calc(100% - 62px);"> | ||
| 129 | - <a style="font-size: 12px;color: grey;cursor: default;" data-uk-tooltip title="可选择回场路径,设置途径点位。暂不开放" id="inpark_paths_link">路径(<span>0</span>)</a> | ||
| 130 | - </div> | ||
| 131 | - </div> | ||
| 132 | - <div class="uk-grid"> | ||
| 133 | - <div class="uk-width-3-10"> | ||
| 134 | - <div class="uk-form-row"> | ||
| 135 | - <label class="uk-form-label">开始时间</label> | ||
| 136 | - </div> | ||
| 137 | - </div> | ||
| 138 | - <div class="uk-width-7-10 pl5"> | ||
| 139 | - <input type="time" name="startDate" required> | ||
| 140 | - </div> | ||
| 141 | - </div> | ||
| 142 | - <div class="uk-grid"> | ||
| 143 | - <div class="uk-width-3-10"> | ||
| 144 | - <div class="uk-form-row"> | ||
| 145 | - <label class="uk-form-label">结束时间</label> | ||
| 146 | - </div> | ||
| 147 | - </div> | ||
| 148 | - <div class="uk-width-7-10 pl5"> | ||
| 149 | - <input type="time" name="endDate" required> | ||
| 150 | - </div> | ||
| 151 | - </div> | ||
| 152 | - </form> | ||
| 153 | - </div> | ||
| 154 | - </div> | ||
| 155 | - <div class="sub-task-card destroy-card uk-animation-scale"> | ||
| 156 | - <div class="uk-panel uk-panel-box uk-panel-box-danger"> | ||
| 157 | - <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 158 | - <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 159 | - <form class="uk-form uk-form-horizontal inpark_form" destroy_form> | ||
| 160 | - <input type="hidden" value="正常" name="type1"> | ||
| 161 | - <input type="hidden" value="1" name="type2"> | ||
| 162 | - <input type="hidden" name="mileageType" value="service"> | ||
| 163 | - <input type="hidden" name="destroy" value="true"> | ||
| 164 | - <div class="uk-grid" style="height: 30px;"> | ||
| 165 | - </div> | ||
| 166 | - <div class="uk-grid"> | ||
| 167 | - <div class="uk-width-3-10"> | ||
| 168 | - <div class="uk-form-row"> | ||
| 169 | - <label class="uk-form-label">起点 </label> | ||
| 170 | - </div> | ||
| 171 | - </div> | ||
| 172 | - <div class="uk-width-7-10 pl5"> | ||
| 173 | - <select name="startStation" disabled></select> | ||
| 174 | - </div> | ||
| 175 | - </div> | ||
| 176 | - <div class="uk-grid"> | ||
| 177 | - <div class="uk-width-3-10"> | ||
| 178 | - <div class="uk-form-row"> | ||
| 179 | - <label class="uk-form-label">终点 </label> | ||
| 180 | - </div> | ||
| 181 | - </div> | ||
| 182 | - <div class="uk-width-7-10 pl5"> | ||
| 183 | - <select name="endStation" class="ct_focus" disabled></select> | ||
| 184 | - </div> | ||
| 185 | - </div> | ||
| 186 | - <div class="uk-grid"> | ||
| 187 | - <div class="uk-width-3-10"> | ||
| 188 | - <div class="uk-form-row"> | ||
| 189 | - <label class="uk-form-label">烂班里程</label> | ||
| 190 | - </div> | ||
| 191 | - </div> | ||
| 192 | - <div class="uk-width-7-10 pl5"> | ||
| 193 | - <input type="number" step="0.01" name="mileage" required> | ||
| 194 | - </div> | ||
| 195 | - </div> | ||
| 196 | - <div class="uk-grid"> | ||
| 197 | - <div class="uk-width-3-10"> | ||
| 198 | - <div class="uk-form-row"> | ||
| 199 | - <label class="uk-form-label">开始时间</label> | ||
| 200 | - </div> | ||
| 201 | - </div> | ||
| 202 | - <div class="uk-width-7-10 pl5"> | ||
| 203 | - <input type="time" name="startDate" required> | ||
| 204 | - </div> | ||
| 205 | - </div> | ||
| 206 | - <div class="uk-grid"> | ||
| 207 | - <div class="uk-width-3-10"> | ||
| 208 | - <div class="uk-form-row"> | ||
| 209 | - <label class="uk-form-label">烂班原因</label> | ||
| 210 | - </div> | ||
| 211 | - </div> | ||
| 212 | - <div class="uk-width-7-10 pl5"> | ||
| 213 | - <select name="destroyReason" required></select> | ||
| 214 | - </div> | ||
| 215 | - </div> | ||
| 216 | - </form> | ||
| 217 | - </div> | ||
| 218 | - </div> | ||
| 219 | - | ||
| 220 | - <form class="uk-form" style="margin-top: 15px; padding: 0 10px 0 0;"> | ||
| 221 | - <textarea placeholder="备注" style="width: 100%;height: 70px;" id="globalRemarks"></textarea> | ||
| 222 | - </form> | ||
| 223 | - </div> | ||
| 224 | - | ||
| 225 | - <div class="uk-modal-footer uk-text-right"> | ||
| 226 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 227 | - <button type="button" class="uk-button uk-button-primary" id="submitChildTaskBtn">提交子任务</button> | ||
| 228 | - | ||
| 229 | - <div class="ct-footer-left"> | ||
| 230 | - <a id="betweenStationRangeCalc" data-drawer-id="station_route_spacing_chart_drawer">站点间公里不准?</a> | ||
| 231 | - </div> | ||
| 232 | - </div> | ||
| 233 | - </div> | ||
| 234 | - | ||
| 235 | - <div class="ct-bottom-drawer"> | ||
| 236 | - <div class="ct-bottom-drawer-body"></div> | ||
| 237 | - </div> | ||
| 238 | - | ||
| 239 | - <script id="sub-task-inpark-form-temp" type="text/html"> | ||
| 240 | - </script> | ||
| 241 | - | ||
| 242 | - <script> | ||
| 243 | - (function () { | ||
| 244 | - var modal = '#add-sub-task-inpark-modal', | ||
| 245 | - serviceForm = $('form[service_form]', modal), | ||
| 246 | - emptyForm = $('form[empty_form]', modal), | ||
| 247 | - destroyForm = $('form[destroy_form]', modal), | ||
| 248 | - sch, stationRoutes, parks, information, esCode, timeLocStations; | ||
| 249 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 250 | - $(modal).on('init', function (e, data) { | ||
| 251 | - e.stopPropagation(); | ||
| 252 | - sch = data.sch; | ||
| 253 | - | ||
| 254 | - //站点路由 | ||
| 255 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 256 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 257 | - }), 'directions')[sch.xlDir]; | ||
| 258 | - //空驶终点(停车场) | ||
| 259 | - //切换进场终点 | ||
| 260 | - $('select[name=endStation]', emptyForm).on('change', inparkNavigation); | ||
| 261 | - $.get('/basic/parks', function (rs) { | ||
| 262 | - parks = rs; | ||
| 263 | - var opts = ''; | ||
| 264 | - for (var code in parks) { | ||
| 265 | - opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 266 | - } | ||
| 267 | - $('select[name=endStation]', emptyForm).html(opts).val(information.carPark).trigger('change'); | ||
| 268 | - }); | ||
| 269 | - //线路标准 | ||
| 270 | - information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 271 | - //本地存储的站点耗时 | ||
| 272 | - getLocStationsSpace(); | ||
| 273 | - | ||
| 274 | - //设置默认值 | ||
| 275 | - setDefaultVal(); | ||
| 276 | - | ||
| 277 | - //切换营运终点 | ||
| 278 | - $('select[name=endStation]', serviceForm).val(esCode).on('change', function () { | ||
| 279 | - var val = $(this).val(); | ||
| 280 | - if (val == esCode) { | ||
| 281 | - $('.uk-modal-dialog', modal).removeClass('three-children'); | ||
| 282 | - $('.sub-task-card.destroy-card').css("display", "none"); | ||
| 283 | - } | ||
| 284 | - else { | ||
| 285 | - $('.uk-modal-dialog', modal).addClass('three-children'); | ||
| 286 | - $('.sub-task-card.destroy-card').css("display", "inline-block"); | ||
| 287 | - } | ||
| 288 | - | ||
| 289 | - reClac(); | ||
| 290 | - }).trigger('change'); | ||
| 291 | - | ||
| 292 | - | ||
| 293 | - var dataArray = []; | ||
| 294 | - var fs = $('form.inpark_form', modal).formValidation({ | ||
| 295 | - framework: 'uikit', | ||
| 296 | - locale: 'zh_CN' | ||
| 297 | - }); | ||
| 298 | - fs.on('success.form.fv', function(e) { | ||
| 299 | - e.preventDefault(); | ||
| 300 | - if($(this).is(':hidden')) | ||
| 301 | - return; | ||
| 302 | - dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this) | ||
| 303 | - , {remarks: $('#globalRemarks',modal).val(), 'schedule.id': sch.id})); | ||
| 304 | - $(this).data('valid', true); | ||
| 305 | - | ||
| 306 | - if(allValidSuccess()){ | ||
| 307 | - var i = 0, rst; | ||
| 308 | - (function () { | ||
| 309 | - var f = arguments.callee; | ||
| 310 | - if(i >= dataArray.length){ | ||
| 311 | - //完成后更新前端数据 | ||
| 312 | - gb_schedule_table.updateSchedule(rst); | ||
| 313 | - UIkit.modal(modal).hide(); | ||
| 314 | - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | ||
| 315 | - return; | ||
| 316 | - } | ||
| 317 | - var data = dataArray[i]; | ||
| 318 | - //里程为0的不保存 | ||
| 319 | - if(data.mileage==0){ | ||
| 320 | - i++; | ||
| 321 | - f(); | ||
| 322 | - } | ||
| 323 | - else{ | ||
| 324 | - //营运子任务不写备注 | ||
| 325 | - if(data.mileageType == 'service' && !data.destroy) | ||
| 326 | - data.remarks = ''; | ||
| 327 | - gb_common.$post('/childTask', data, function (rs) { | ||
| 328 | - notify_succ('子任务添加成功'); | ||
| 329 | - rst = rs.t; | ||
| 330 | - i++; | ||
| 331 | - f(); | ||
| 332 | - }); | ||
| 333 | - } | ||
| 334 | - })(); | ||
| 335 | - } | ||
| 336 | - }); | ||
| 337 | - | ||
| 338 | - //校验不过 | ||
| 339 | - fs.on('err.field.fv', function () { | ||
| 340 | - $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled'); | ||
| 341 | - }); | ||
| 342 | - | ||
| 343 | - //submit | ||
| 344 | - $('#submitChildTaskBtn', modal).on('click', function () { | ||
| 345 | - $(this).addClass('disabled').attr('disabled','disabled'); | ||
| 346 | - dataArray = []; | ||
| 347 | - fs.data('valid', false); | ||
| 348 | - fs.formValidation('validate'); | ||
| 349 | - //fs.submit(); | ||
| 350 | - }); | ||
| 351 | - | ||
| 352 | - //选择烂班原因 | ||
| 353 | - $('select[name=destroyReason]', destroyForm).on('change', function () { | ||
| 354 | - var e =$('#globalRemarks', modal); | ||
| 355 | - e.val(e.val() + $(this).val() + ','); | ||
| 356 | - }); | ||
| 357 | - | ||
| 358 | - //根据主任务状态,复子任务 | ||
| 359 | - updateTwinsTaskBySch(sch); | ||
| 360 | - }); | ||
| 361 | - | ||
| 362 | - function allValidSuccess() { | ||
| 363 | - var flag = true; | ||
| 364 | - $('form.inpark_form:visible', modal).each(function (i, f) { | ||
| 365 | - if(!$(f).data('valid')){ | ||
| 366 | - flag = false; | ||
| 367 | - return false; | ||
| 368 | - } | ||
| 369 | - }); | ||
| 370 | - return flag; | ||
| 371 | - } | ||
| 372 | - | ||
| 373 | - //获取表单disabled 项的值 | ||
| 374 | - function getDisabledVal(f) { | ||
| 375 | - var rs = {}; | ||
| 376 | - $('input,select', f).each(function () { | ||
| 377 | - if($(this).attr('disabled')){ | ||
| 378 | - rs[$(this).attr('name')]=$(this).val(); | ||
| 379 | - } | ||
| 380 | - }); | ||
| 381 | - return rs; | ||
| 382 | - } | ||
| 383 | - | ||
| 384 | - function setDefaultVal() { | ||
| 385 | - var routeOpts = ''; | ||
| 386 | - $.each(stationRoutes, function () { | ||
| 387 | - routeOpts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'; | ||
| 388 | - }); | ||
| 389 | - esCode = stationRoutes[stationRoutes.length - 1].stationCode; | ||
| 390 | - | ||
| 391 | - //营运起终点 | ||
| 392 | - $('select[name=startStation],select[name=endStation]', serviceForm).html(routeOpts); | ||
| 393 | - //空驶起点 | ||
| 394 | - $('select[name=startStation]', emptyForm).html(routeOpts).val(esCode); | ||
| 395 | - //烂班起终点 | ||
| 396 | - $('select[name=startStation],select[name=endStation]', destroyForm).html(routeOpts).val(esCode); | ||
| 397 | - | ||
| 398 | - //烂班原因 | ||
| 399 | - var adjustExpsOpts = '<option value="">请选择...</option>'; | ||
| 400 | - $.each(adjustExps, function (i, str) { | ||
| 401 | - adjustExpsOpts += '<option value="' + str + '">' + str + '</option>'; | ||
| 402 | - }); | ||
| 403 | - $('select[name=destroyReason]', destroyForm).html(adjustExpsOpts); | ||
| 404 | - | ||
| 405 | - //营运开始时间 | ||
| 406 | - $('input[name=startDate]', serviceForm).val(sch.fcsjActual?sch.fcsjActual:sch.dfsj); | ||
| 407 | - | ||
| 408 | - //营运班次类型 | ||
| 409 | - $('select[name=type1]', serviceForm).val(sch['sflj']?'临加':'正常'); | ||
| 410 | - } | ||
| 411 | - | ||
| 412 | - //点击 路径 | ||
| 413 | - $('#inpark_paths_link', modal).on('click', function () { | ||
| 414 | - | ||
| 415 | - }); | ||
| 416 | - | ||
| 417 | - //进场导航 | ||
| 418 | - var drivingRouteResult; | ||
| 419 | - function inparkNavigation() { | ||
| 420 | - var start = $('select[name=startStation]', emptyForm).val() | ||
| 421 | - ,end = $('select[name=endStation]', emptyForm).val(); | ||
| 422 | - | ||
| 423 | - if(!end) return; | ||
| 424 | - | ||
| 425 | - var station = getStationByCode(start).station | ||
| 426 | - ,park = gb_data_basic.getCarparkByCode(end); | ||
| 427 | - | ||
| 428 | - if(!park){ | ||
| 429 | - notify_err('无法找到停车场的坐标对照!!!'); | ||
| 430 | - return; | ||
| 431 | - } | ||
| 432 | - var tArray = park['gCenterPoint'].split(' '); | ||
| 433 | - var sCoord = TransGPS.wgsToBD(station['gLaty'], station['gLonx']) | ||
| 434 | - ,eCoord = TransGPS.wgsToBD(parseFloat(tArray[1]), parseFloat(tArray[0])); | ||
| 435 | - | ||
| 436 | - var sp = new BMap.Point(sCoord.lng,sCoord.lat); | ||
| 437 | - var ep = new BMap.Point(eCoord.lng,eCoord.lat); | ||
| 438 | - | ||
| 439 | - var driving = new BMap.DrivingRoute('上海', { | ||
| 440 | - onSearchComplete: function (rs) { | ||
| 441 | - drivingRouteResult = rs; | ||
| 442 | - calcInparkMileage(0); | ||
| 443 | - } | ||
| 444 | - }); | ||
| 445 | - driving.search(sp,ep); | ||
| 446 | - } | ||
| 447 | - | ||
| 448 | - function calcInparkMileage(index) { | ||
| 449 | - var count = drivingRouteResult.getNumPlans(); | ||
| 450 | - | ||
| 451 | - //选择方案 | ||
| 452 | - var routePlan = drivingRouteResult.getPlan(index); | ||
| 453 | - //里程 | ||
| 454 | - var mileage = routePlan.getDistance(false); | ||
| 455 | - $('input[name=mileage]', emptyForm).val(mileage / 1000); | ||
| 456 | - //结束时间 | ||
| 457 | - var duratio = routePlan.getDuration(false); | ||
| 458 | - var st = $('input[name=startDate]', emptyForm).val(); | ||
| 459 | - var ets = moment(st, 'HH:mm').add(duratio, 'seconds').format('HH:mm'); | ||
| 460 | - $('input[name=endDate]', emptyForm).val(ets); | ||
| 461 | - | ||
| 462 | - | ||
| 463 | - $('#inpark_paths_link span', modal).text(count); | ||
| 464 | - } | ||
| 465 | - | ||
| 466 | - function getStationByCode(code) { | ||
| 467 | - for(var i = 0; i < stationRoutes.length; i++){ | ||
| 468 | - if(stationRoutes[i]['stationCode']==code) | ||
| 469 | - return stationRoutes[i]; | ||
| 470 | - } | ||
| 471 | - return null; | ||
| 472 | - } | ||
| 473 | - | ||
| 474 | - function reClac() { | ||
| 475 | - var serviceEnd = $('select[name=endStation]', serviceForm).val(); | ||
| 476 | - //空驶起点 == 营运终点 | ||
| 477 | - $('select[name=startStation]', emptyForm).val(serviceEnd); | ||
| 478 | - | ||
| 479 | - //计算营运里程 | ||
| 480 | - var s = $('select[name=startStation]', serviceForm).val(), | ||
| 481 | - e = $('select[name=endStation]', serviceForm).val(); | ||
| 482 | - var sMileage = calcMileage(s, e); | ||
| 483 | - if(sMileage >= 0) | ||
| 484 | - $('input[name=mileage]', serviceForm).val(sMileage); | ||
| 485 | - | ||
| 486 | - //营运结束时间 | ||
| 487 | - var et = sch.dfsjT + (parseInt(sMileage / sch.jhlcOrig * sch.bcsj) * 60 * 1000) | ||
| 488 | - ,ets = et > sch.zdsjT?sch.zdsj:moment(et).format('HH:mm'); | ||
| 489 | - $('input[name=endDate]', serviceForm).val(ets); | ||
| 490 | - | ||
| 491 | - //有烂班 | ||
| 492 | - if (serviceEnd != esCode) { | ||
| 493 | - //烂班起点 == 营运终点 | ||
| 494 | - $('select[name=startStation]', destroyForm).val(serviceEnd); | ||
| 495 | - //计算烂班公里 | ||
| 496 | - s = $('select[name=startStation]', destroyForm).val(); | ||
| 497 | - e = $('select[name=endStation]', destroyForm).val(); | ||
| 498 | - var dMileage = calcMileage(s, e); | ||
| 499 | - $('input[name=mileage]', destroyForm).val(dMileage); | ||
| 500 | - //烂班开始时间 | ||
| 501 | - $('input[name=startDate]', destroyForm).val(ets); | ||
| 502 | - } | ||
| 503 | - | ||
| 504 | - //进场开始时间 | ||
| 505 | - $('input[name=startDate]', emptyForm).val(ets); | ||
| 506 | - | ||
| 507 | - //重新导航 | ||
| 508 | - inparkNavigation(); | ||
| 509 | - } | ||
| 510 | - | ||
| 511 | - function calcMileage(s, e) { | ||
| 512 | - var mileage = 0, flag, code; | ||
| 513 | - if (timeLocStations) { | ||
| 514 | - //空间坐标计算的站距 | ||
| 515 | - $.each(timeLocStations, function () { | ||
| 516 | - code = this.station['STATION_CODE']; | ||
| 517 | - if (flag) | ||
| 518 | - mileage = gb_common.accAdd(mileage, this.toDistanceGl); | ||
| 519 | - if (code == s) | ||
| 520 | - flag = true; | ||
| 521 | - if (code == e) | ||
| 522 | - return false; | ||
| 523 | - }); | ||
| 524 | - } | ||
| 525 | - else{ | ||
| 526 | - //从原始站点路由字段里取值 | ||
| 527 | - $.each(stationRoutes, function () { | ||
| 528 | - code = this['stationCode']; | ||
| 529 | - if (flag) | ||
| 530 | - mileage = gb_common.accAdd(mileage, this.distances); | ||
| 531 | - if (code == s) | ||
| 532 | - flag = true; | ||
| 533 | - if (code == e) | ||
| 534 | - return false; | ||
| 535 | - }); | ||
| 536 | - } | ||
| 537 | - return mileage; | ||
| 538 | - } | ||
| 539 | - | ||
| 540 | - //从本地localStorage获取站间距数据 | ||
| 541 | - function getLocStationsSpace() { | ||
| 542 | - try { | ||
| 543 | - timeLocStations = window.localStorage.getItem('control_route_distance_' + sch.xlBm); | ||
| 544 | - if (timeLocStations) | ||
| 545 | - timeLocStations = JSON.parse(timeLocStations).stations[sch.xlDir == 0 ? 'up' : 'down']; | ||
| 546 | - } catch (e) { | ||
| 547 | - console.log(e); | ||
| 548 | - } | ||
| 549 | - } | ||
| 550 | - | ||
| 551 | - //站间距计算后刷新 | ||
| 552 | - $(modal).on('refresh_station_space', function () { | ||
| 553 | - getLocStationsSpace(); | ||
| 554 | - reClac(); | ||
| 555 | - }); | ||
| 556 | - | ||
| 557 | - //------ 下抽屉 ------ | ||
| 558 | - $('#betweenStationRangeCalc', modal).on('click', function () { | ||
| 559 | - var id = $(this).data('drawer-id'); | ||
| 560 | - switchBtmDrawer(id, '/real_control_v2/fragments/line_schedule/context_menu/sub_task/station_route_spacing_chart.html'); | ||
| 561 | - }); | ||
| 562 | - | ||
| 563 | - var btmDrawer = $('.ct-bottom-drawer', modal); | ||
| 564 | - //打开事件 | ||
| 565 | - btmDrawer.on('drawer_show', function () { | ||
| 566 | - var url = $(this).data('url'); | ||
| 567 | - if (!url) { | ||
| 568 | - alert('无效的地址'); | ||
| 569 | - } | ||
| 570 | - | ||
| 571 | - var drawerPanel = $(this).data('name'); | ||
| 572 | - $('.ct-bottom-drawer-body', btmDrawer).load(url, function () { | ||
| 573 | - $('#' + drawerPanel).trigger('drawer-init', {sch: sch}); | ||
| 574 | - }); | ||
| 575 | - }); | ||
| 576 | - | ||
| 577 | - function switchBtmDrawer(id, url) { | ||
| 578 | - if (btmDrawer.hasClass('open') && btmDrawer.data('name') == id) { | ||
| 579 | - btmDrawer.removeClass('open'); | ||
| 580 | - btmDrawer.removeData('name').removeData('url'); | ||
| 581 | - } | ||
| 582 | - else { | ||
| 583 | - btmDrawer.addClass('open'); | ||
| 584 | - btmDrawer.data('name', id).data('url', url).trigger('drawer_show'); | ||
| 585 | - } | ||
| 586 | - } | ||
| 587 | - | ||
| 588 | - | ||
| 589 | - function updateTwinsTaskBySch(sch) { | ||
| 590 | - //主任务是烂班 | ||
| 591 | - if(sch.destroy){ | ||
| 592 | - serviceForm.prepend('<input type="hidden" name="destroy" value="true">'); | ||
| 593 | - $('[name=mileage]', serviceForm).val(sch.jhlcOrig).attr('disabled', 'disabled'); | ||
| 594 | - $('.twins_task_panel .uk-badge', modal).addClass('uk-badge-danger').text('烂班'); | ||
| 595 | - //终点禁选 | ||
| 596 | - $('select[name=endStation]', serviceForm).attr('disabled', 'disabled'); | ||
| 597 | - //开始结束时间禁选 | ||
| 598 | - | ||
| 599 | - //空驶起点 | ||
| 600 | - $('select[name=startStation]', emptyForm).val(sch.qdzCode); | ||
| 601 | - } | ||
| 602 | - } | ||
| 603 | - })(); | ||
| 604 | - </script> | 1 | +<div class="uk-modal ct_move_modal" id="add-sub-task-inpark-modal"> |
| 2 | + <div class="uk-modal-dialog"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>回场子任务</h2></div> | ||
| 6 | + | ||
| 7 | + <div style="width: 100%;padding-left: 1%;"> | ||
| 8 | + <div class="sub-task-card"> | ||
| 9 | + <div class="uk-panel uk-panel-box uk-panel-box-primary twins_task_panel"> | ||
| 10 | + <div class="uk-panel-badge uk-badge">营运</div> | ||
| 11 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 12 | + <form class="uk-form uk-form-horizontal inpark_form" service_form> | ||
| 13 | + <input type="hidden" name="type2" value="1"> | ||
| 14 | + <input type="hidden" name="mileageType" value="service"> | ||
| 15 | + <div class="uk-grid"> | ||
| 16 | + <div class="uk-width-3-10"> | ||
| 17 | + <div class="uk-form-row"> | ||
| 18 | + <label class="uk-form-label">班次类型 </label> | ||
| 19 | + </div> | ||
| 20 | + </div> | ||
| 21 | + <div class="uk-width-7-10 pl5"> | ||
| 22 | + <select name="type1" class="ct_focus" disabled> | ||
| 23 | + <option value="正常">正常</option> | ||
| 24 | + <option value="临加">临加</option> | ||
| 25 | + </select> | ||
| 26 | + </div> | ||
| 27 | + </div> | ||
| 28 | + <div class="uk-grid"> | ||
| 29 | + <div class="uk-width-3-10"> | ||
| 30 | + <div class="uk-form-row"> | ||
| 31 | + <label class="uk-form-label">起点 </label> | ||
| 32 | + </div> | ||
| 33 | + </div> | ||
| 34 | + <div class="uk-width-7-10 pl5"> | ||
| 35 | + <select name="startStation" disabled></select> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + <div class="uk-grid"> | ||
| 39 | + <div class="uk-width-3-10"> | ||
| 40 | + <div class="uk-form-row"> | ||
| 41 | + <label class="uk-form-label">终点 </label> | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 44 | + <div class="uk-width-7-10 pl5"> | ||
| 45 | + <select name="endStation" class="ct_focus"></select> | ||
| 46 | + </div> | ||
| 47 | + </div> | ||
| 48 | + <div class="uk-grid"> | ||
| 49 | + <div class="uk-width-3-10"> | ||
| 50 | + <div class="uk-form-row"> | ||
| 51 | + <label class="uk-form-label">营运里程</label> | ||
| 52 | + </div> | ||
| 53 | + </div> | ||
| 54 | + <div class="uk-width-7-10 pl5"> | ||
| 55 | + <input type="number" step="0.01" name="mileage" required> | ||
| 56 | + </div> | ||
| 57 | + </div> | ||
| 58 | + <div class="uk-grid"> | ||
| 59 | + <div class="uk-width-3-10"> | ||
| 60 | + <div class="uk-form-row"> | ||
| 61 | + <label class="uk-form-label">开始时间</label> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + <div class="uk-width-7-10 pl5"> | ||
| 65 | + <input type="time" name="startDate" required> | ||
| 66 | + </div> | ||
| 67 | + </div> | ||
| 68 | + <div class="uk-grid"> | ||
| 69 | + <div class="uk-width-3-10"> | ||
| 70 | + <div class="uk-form-row"> | ||
| 71 | + <label class="uk-form-label">结束时间</label> | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | + <div class="uk-width-7-10 pl5"> | ||
| 75 | + <input type="time" name="endDate" required> | ||
| 76 | + </div> | ||
| 77 | + </div> | ||
| 78 | + </form> | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + <div class="sub-task-card"> | ||
| 82 | + <div class="uk-panel uk-panel-box uk-panel-box-secondary"> | ||
| 83 | + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div> | ||
| 84 | + <h3 class="uk-panel-title">进场</h3> | ||
| 85 | + <form class="uk-form uk-form-horizontal inpark_form" empty_form> | ||
| 86 | + <input type="hidden" name="type2" value="2"> | ||
| 87 | + <input type="hidden" name="mileageType" value="empty"> | ||
| 88 | + <div class="uk-grid"> | ||
| 89 | + <div class="uk-width-3-10"> | ||
| 90 | + <div class="uk-form-row"> | ||
| 91 | + <label class="uk-form-label">班次类型 </label> | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | + <div class="uk-width-7-10 pl5"> | ||
| 95 | + <select name="type1" class="ct_focus"> | ||
| 96 | + <option value="正常">正常</option> | ||
| 97 | + <option value="临加">临加</option> | ||
| 98 | + </select> | ||
| 99 | + </div> | ||
| 100 | + </div> | ||
| 101 | + <div class="uk-grid"> | ||
| 102 | + <div class="uk-width-3-10"> | ||
| 103 | + <div class="uk-form-row"> | ||
| 104 | + <label class="uk-form-label">起点 </label> | ||
| 105 | + </div> | ||
| 106 | + </div> | ||
| 107 | + <div class="uk-width-7-10 pl5"> | ||
| 108 | + <select name="startStation" ></select> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + <div class="uk-grid"> | ||
| 112 | + <div class="uk-width-3-10"> | ||
| 113 | + <div class="uk-form-row"> | ||
| 114 | + <label class="uk-form-label">终点 </label> | ||
| 115 | + </div> | ||
| 116 | + </div> | ||
| 117 | + <div class="uk-width-7-10 pl5"> | ||
| 118 | + <select name="endStation" class="ct_focus"></select> | ||
| 119 | + </div> | ||
| 120 | + </div> | ||
| 121 | + <div class="uk-grid"> | ||
| 122 | + <div class="uk-width-3-10"> | ||
| 123 | + <div class="uk-form-row"> | ||
| 124 | + <label class="uk-form-label">空驶里程</label> | ||
| 125 | + </div> | ||
| 126 | + </div> | ||
| 127 | + <div class="uk-width-7-10 pl5"> | ||
| 128 | + <input type="number" step="0.01" name="mileage" required style="width: calc(100% - 62px);"> | ||
| 129 | + <a style="font-size: 12px;color: grey;cursor: default;" data-uk-tooltip title="可选择回场路径,设置途径点位。暂不开放" id="inpark_paths_link">路径(<span>0</span>)</a> | ||
| 130 | + </div> | ||
| 131 | + </div> | ||
| 132 | + <div class="uk-grid"> | ||
| 133 | + <div class="uk-width-3-10"> | ||
| 134 | + <div class="uk-form-row"> | ||
| 135 | + <label class="uk-form-label">开始时间</label> | ||
| 136 | + </div> | ||
| 137 | + </div> | ||
| 138 | + <div class="uk-width-7-10 pl5"> | ||
| 139 | + <input type="time" name="startDate" required> | ||
| 140 | + </div> | ||
| 141 | + </div> | ||
| 142 | + <div class="uk-grid"> | ||
| 143 | + <div class="uk-width-3-10"> | ||
| 144 | + <div class="uk-form-row"> | ||
| 145 | + <label class="uk-form-label">结束时间</label> | ||
| 146 | + </div> | ||
| 147 | + </div> | ||
| 148 | + <div class="uk-width-7-10 pl5"> | ||
| 149 | + <input type="time" name="endDate" required> | ||
| 150 | + </div> | ||
| 151 | + </div> | ||
| 152 | + </form> | ||
| 153 | + </div> | ||
| 154 | + </div> | ||
| 155 | + <div class="sub-task-card destroy-card uk-animation-scale"> | ||
| 156 | + <div class="uk-panel uk-panel-box uk-panel-box-danger"> | ||
| 157 | + <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 158 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 159 | + <form class="uk-form uk-form-horizontal inpark_form" destroy_form> | ||
| 160 | + <input type="hidden" value="正常" name="type1"> | ||
| 161 | + <input type="hidden" value="1" name="type2"> | ||
| 162 | + <input type="hidden" name="mileageType" value="service"> | ||
| 163 | + <input type="hidden" name="destroy" value="true"> | ||
| 164 | + <div class="uk-grid" style="height: 30px;"> | ||
| 165 | + </div> | ||
| 166 | + <div class="uk-grid"> | ||
| 167 | + <div class="uk-width-3-10"> | ||
| 168 | + <div class="uk-form-row"> | ||
| 169 | + <label class="uk-form-label">起点 </label> | ||
| 170 | + </div> | ||
| 171 | + </div> | ||
| 172 | + <div class="uk-width-7-10 pl5"> | ||
| 173 | + <select name="startStation" disabled></select> | ||
| 174 | + </div> | ||
| 175 | + </div> | ||
| 176 | + <div class="uk-grid"> | ||
| 177 | + <div class="uk-width-3-10"> | ||
| 178 | + <div class="uk-form-row"> | ||
| 179 | + <label class="uk-form-label">终点 </label> | ||
| 180 | + </div> | ||
| 181 | + </div> | ||
| 182 | + <div class="uk-width-7-10 pl5"> | ||
| 183 | + <select name="endStation" class="ct_focus" disabled></select> | ||
| 184 | + </div> | ||
| 185 | + </div> | ||
| 186 | + <div class="uk-grid"> | ||
| 187 | + <div class="uk-width-3-10"> | ||
| 188 | + <div class="uk-form-row"> | ||
| 189 | + <label class="uk-form-label">烂班里程</label> | ||
| 190 | + </div> | ||
| 191 | + </div> | ||
| 192 | + <div class="uk-width-7-10 pl5"> | ||
| 193 | + <input type="number" step="0.01" name="mileage" required> | ||
| 194 | + </div> | ||
| 195 | + </div> | ||
| 196 | + <div class="uk-grid"> | ||
| 197 | + <div class="uk-width-3-10"> | ||
| 198 | + <div class="uk-form-row"> | ||
| 199 | + <label class="uk-form-label">开始时间</label> | ||
| 200 | + </div> | ||
| 201 | + </div> | ||
| 202 | + <div class="uk-width-7-10 pl5"> | ||
| 203 | + <input type="time" name="startDate" required> | ||
| 204 | + </div> | ||
| 205 | + </div> | ||
| 206 | + <div class="uk-grid"> | ||
| 207 | + <div class="uk-width-3-10"> | ||
| 208 | + <div class="uk-form-row"> | ||
| 209 | + <label class="uk-form-label">烂班原因</label> | ||
| 210 | + </div> | ||
| 211 | + </div> | ||
| 212 | + <div class="uk-width-7-10 pl5"> | ||
| 213 | + <select name="destroyReason" required></select> | ||
| 214 | + </div> | ||
| 215 | + </div> | ||
| 216 | + </form> | ||
| 217 | + </div> | ||
| 218 | + </div> | ||
| 219 | + | ||
| 220 | + <form class="uk-form" style="margin-top: 15px; padding: 0 10px 0 0;"> | ||
| 221 | + <textarea placeholder="备注" style="width: 100%;height: 70px;" id="globalRemarks"></textarea> | ||
| 222 | + </form> | ||
| 223 | + </div> | ||
| 224 | + | ||
| 225 | + <div class="uk-modal-footer uk-text-right"> | ||
| 226 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 227 | + <button type="button" class="uk-button uk-button-primary" id="submitChildTaskBtn">提交子任务</button> | ||
| 228 | + | ||
| 229 | + <div class="ct-footer-left"> | ||
| 230 | + <a id="betweenStationRangeCalc" data-drawer-id="station_route_spacing_chart_drawer">站点间公里不准?</a> | ||
| 231 | + </div> | ||
| 232 | + </div> | ||
| 233 | + </div> | ||
| 234 | + | ||
| 235 | + <div class="ct-bottom-drawer"> | ||
| 236 | + <div class="ct-bottom-drawer-body"></div> | ||
| 237 | + </div> | ||
| 238 | + | ||
| 239 | + <script id="sub-task-inpark-form-temp" type="text/html"> | ||
| 240 | + </script> | ||
| 241 | + | ||
| 242 | + <script> | ||
| 243 | + (function () { | ||
| 244 | + var modal = '#add-sub-task-inpark-modal', | ||
| 245 | + serviceForm = $('form[service_form]', modal), | ||
| 246 | + emptyForm = $('form[empty_form]', modal), | ||
| 247 | + destroyForm = $('form[destroy_form]', modal), | ||
| 248 | + sch, stationRoutes, parks, information, esCode, timeLocStations; | ||
| 249 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 250 | + $(modal).on('init', function (e, data) { | ||
| 251 | + e.stopPropagation(); | ||
| 252 | + sch = data.sch; | ||
| 253 | + | ||
| 254 | + //站点路由 | ||
| 255 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 256 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 257 | + }), 'directions')[sch.xlDir]; | ||
| 258 | + //空驶终点(停车场) | ||
| 259 | + //切换进场终点 | ||
| 260 | + $('select[name=endStation]', emptyForm).on('change', inparkNavigation); | ||
| 261 | + $.get('/basic/parks', function (rs) { | ||
| 262 | + parks = rs; | ||
| 263 | + var opts = ''; | ||
| 264 | + for (var code in parks) { | ||
| 265 | + opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 266 | + } | ||
| 267 | + $('select[name=endStation]', emptyForm).html(opts).val(information.carPark).trigger('change'); | ||
| 268 | + }); | ||
| 269 | + //线路标准 | ||
| 270 | + information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 271 | + //本地存储的站点耗时 | ||
| 272 | + getLocStationsSpace(); | ||
| 273 | + | ||
| 274 | + //设置默认值 | ||
| 275 | + setDefaultVal(); | ||
| 276 | + | ||
| 277 | + //切换营运终点 | ||
| 278 | + $('select[name=endStation]', serviceForm).val(esCode).on('change', function () { | ||
| 279 | + var val = $(this).val(); | ||
| 280 | + if (val == esCode) { | ||
| 281 | + $('.uk-modal-dialog', modal).removeClass('three-children'); | ||
| 282 | + $('.sub-task-card.destroy-card').css("display", "none"); | ||
| 283 | + } | ||
| 284 | + else { | ||
| 285 | + $('.uk-modal-dialog', modal).addClass('three-children'); | ||
| 286 | + $('.sub-task-card.destroy-card').css("display", "inline-block"); | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + reClac(); | ||
| 290 | + }).trigger('change'); | ||
| 291 | + | ||
| 292 | + | ||
| 293 | + var dataArray = []; | ||
| 294 | + var fs = $('form.inpark_form', modal).formValidation({ | ||
| 295 | + framework: 'uikit', | ||
| 296 | + locale: 'zh_CN' | ||
| 297 | + }); | ||
| 298 | + fs.on('success.form.fv', function(e) { | ||
| 299 | + e.preventDefault(); | ||
| 300 | + if($(this).is(':hidden')) | ||
| 301 | + return; | ||
| 302 | + dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this) | ||
| 303 | + , {remarks: $('#globalRemarks',modal).val(), 'schedule.id': sch.id})); | ||
| 304 | + $(this).data('valid', true); | ||
| 305 | + | ||
| 306 | + if(allValidSuccess()){ | ||
| 307 | + var i = 0, rst; | ||
| 308 | + (function () { | ||
| 309 | + var f = arguments.callee; | ||
| 310 | + if(i >= dataArray.length){ | ||
| 311 | + //完成后更新前端数据 | ||
| 312 | + gb_schedule_table.updateSchedule(rst); | ||
| 313 | + UIkit.modal(modal).hide(); | ||
| 314 | + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | ||
| 315 | + return; | ||
| 316 | + } | ||
| 317 | + var data = dataArray[i]; | ||
| 318 | + //里程为0的不保存 | ||
| 319 | + if(data.mileage==0){ | ||
| 320 | + i++; | ||
| 321 | + f(); | ||
| 322 | + } | ||
| 323 | + else{ | ||
| 324 | + //营运子任务不写备注 | ||
| 325 | + if(data.mileageType == 'service' && !data.destroy) | ||
| 326 | + data.remarks = ''; | ||
| 327 | + gb_common.$post('/childTask', data, function (rs) { | ||
| 328 | + notify_succ('子任务添加成功'); | ||
| 329 | + rst = rs.t; | ||
| 330 | + i++; | ||
| 331 | + f(); | ||
| 332 | + }); | ||
| 333 | + } | ||
| 334 | + })(); | ||
| 335 | + } | ||
| 336 | + }); | ||
| 337 | + | ||
| 338 | + //校验不过 | ||
| 339 | + fs.on('err.field.fv', function () { | ||
| 340 | + $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled'); | ||
| 341 | + }); | ||
| 342 | + | ||
| 343 | + //submit | ||
| 344 | + $('#submitChildTaskBtn', modal).on('click', function () { | ||
| 345 | + $(this).addClass('disabled').attr('disabled','disabled'); | ||
| 346 | + dataArray = []; | ||
| 347 | + fs.data('valid', false); | ||
| 348 | + fs.formValidation('validate'); | ||
| 349 | + //fs.submit(); | ||
| 350 | + }); | ||
| 351 | + | ||
| 352 | + //选择烂班原因 | ||
| 353 | + $('select[name=destroyReason]', destroyForm).on('change', function () { | ||
| 354 | + var e =$('#globalRemarks', modal); | ||
| 355 | + e.val(e.val() + $(this).val() + ','); | ||
| 356 | + }); | ||
| 357 | + | ||
| 358 | + //根据主任务状态,复子任务 | ||
| 359 | + updateTwinsTaskBySch(sch); | ||
| 360 | + }); | ||
| 361 | + | ||
| 362 | + function allValidSuccess() { | ||
| 363 | + var flag = true; | ||
| 364 | + $('form.inpark_form:visible', modal).each(function (i, f) { | ||
| 365 | + if(!$(f).data('valid')){ | ||
| 366 | + flag = false; | ||
| 367 | + return false; | ||
| 368 | + } | ||
| 369 | + }); | ||
| 370 | + return flag; | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + //获取表单disabled 项的值 | ||
| 374 | + function getDisabledVal(f) { | ||
| 375 | + var rs = {}; | ||
| 376 | + $('input,select', f).each(function () { | ||
| 377 | + if($(this).attr('disabled')){ | ||
| 378 | + rs[$(this).attr('name')]=$(this).val(); | ||
| 379 | + } | ||
| 380 | + }); | ||
| 381 | + return rs; | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + function setDefaultVal() { | ||
| 385 | + var routeOpts = ''; | ||
| 386 | + $.each(stationRoutes, function () { | ||
| 387 | + routeOpts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'; | ||
| 388 | + }); | ||
| 389 | + esCode = stationRoutes[stationRoutes.length - 1].stationCode; | ||
| 390 | + | ||
| 391 | + //营运起终点 | ||
| 392 | + $('select[name=startStation],select[name=endStation]', serviceForm).html(routeOpts); | ||
| 393 | + //空驶起点 | ||
| 394 | + $('select[name=startStation]', emptyForm).html(routeOpts).val(esCode); | ||
| 395 | + //烂班起终点 | ||
| 396 | + $('select[name=startStation],select[name=endStation]', destroyForm).html(routeOpts).val(esCode); | ||
| 397 | + | ||
| 398 | + //烂班原因 | ||
| 399 | + var adjustExpsOpts = '<option value="">请选择...</option>'; | ||
| 400 | + $.each(adjustExps, function (i, str) { | ||
| 401 | + adjustExpsOpts += '<option value="' + str + '">' + str + '</option>'; | ||
| 402 | + }); | ||
| 403 | + $('select[name=destroyReason]', destroyForm).html(adjustExpsOpts); | ||
| 404 | + | ||
| 405 | + //营运开始时间 | ||
| 406 | + $('input[name=startDate]', serviceForm).val(sch.fcsjActual?sch.fcsjActual:sch.dfsj); | ||
| 407 | + | ||
| 408 | + //营运班次类型 | ||
| 409 | + $('select[name=type1]', serviceForm).val(sch['sflj']?'临加':'正常'); | ||
| 410 | + } | ||
| 411 | + | ||
| 412 | + //点击 路径 | ||
| 413 | + $('#inpark_paths_link', modal).on('click', function () { | ||
| 414 | + | ||
| 415 | + }); | ||
| 416 | + | ||
| 417 | + //进场导航 | ||
| 418 | + var drivingRouteResult; | ||
| 419 | + function inparkNavigation() { | ||
| 420 | + var start = $('select[name=startStation]', emptyForm).val() | ||
| 421 | + ,end = $('select[name=endStation]', emptyForm).val(); | ||
| 422 | + | ||
| 423 | + if(!end) return; | ||
| 424 | + | ||
| 425 | + var station = getStationByCode(start).station | ||
| 426 | + ,park = gb_data_basic.getCarparkByCode(end); | ||
| 427 | + | ||
| 428 | + if(!park){ | ||
| 429 | + notify_err('无法找到停车场的坐标对照!!!'); | ||
| 430 | + return; | ||
| 431 | + } | ||
| 432 | + var tArray = park['gCenterPoint'].split(' '); | ||
| 433 | + var sCoord = TransGPS.wgsToBD(station['gLaty'], station['gLonx']) | ||
| 434 | + ,eCoord = TransGPS.wgsToBD(parseFloat(tArray[1]), parseFloat(tArray[0])); | ||
| 435 | + | ||
| 436 | + var sp = new BMap.Point(sCoord.lng,sCoord.lat); | ||
| 437 | + var ep = new BMap.Point(eCoord.lng,eCoord.lat); | ||
| 438 | + | ||
| 439 | + var driving = new BMap.DrivingRoute('上海', { | ||
| 440 | + onSearchComplete: function (rs) { | ||
| 441 | + drivingRouteResult = rs; | ||
| 442 | + calcInparkMileage(0); | ||
| 443 | + } | ||
| 444 | + }); | ||
| 445 | + driving.search(sp,ep); | ||
| 446 | + } | ||
| 447 | + | ||
| 448 | + function calcInparkMileage(index) { | ||
| 449 | + var count = drivingRouteResult.getNumPlans(); | ||
| 450 | + | ||
| 451 | + //选择方案 | ||
| 452 | + var routePlan = drivingRouteResult.getPlan(index); | ||
| 453 | + //里程 | ||
| 454 | + var mileage = routePlan.getDistance(false); | ||
| 455 | + $('input[name=mileage]', emptyForm).val(mileage / 1000); | ||
| 456 | + //结束时间 | ||
| 457 | + var duratio = routePlan.getDuration(false); | ||
| 458 | + var st = $('input[name=startDate]', emptyForm).val(); | ||
| 459 | + var ets = moment(st, 'HH:mm').add(duratio, 'seconds').format('HH:mm'); | ||
| 460 | + $('input[name=endDate]', emptyForm).val(ets); | ||
| 461 | + | ||
| 462 | + | ||
| 463 | + $('#inpark_paths_link span', modal).text(count); | ||
| 464 | + } | ||
| 465 | + | ||
| 466 | + function getStationByCode(code) { | ||
| 467 | + for(var i = 0; i < stationRoutes.length; i++){ | ||
| 468 | + if(stationRoutes[i]['stationCode']==code) | ||
| 469 | + return stationRoutes[i]; | ||
| 470 | + } | ||
| 471 | + return null; | ||
| 472 | + } | ||
| 473 | + | ||
| 474 | + function reClac() { | ||
| 475 | + var serviceEnd = $('select[name=endStation]', serviceForm).val(); | ||
| 476 | + //空驶起点 == 营运终点 | ||
| 477 | + $('select[name=startStation]', emptyForm).val(serviceEnd); | ||
| 478 | + | ||
| 479 | + //计算营运里程 | ||
| 480 | + var s = $('select[name=startStation]', serviceForm).val(), | ||
| 481 | + e = $('select[name=endStation]', serviceForm).val(); | ||
| 482 | + var sMileage = calcMileage(s, e); | ||
| 483 | + if(sMileage >= 0) | ||
| 484 | + $('input[name=mileage]', serviceForm).val(sMileage); | ||
| 485 | + | ||
| 486 | + //营运结束时间 | ||
| 487 | + var et = sch.dfsjT + (parseInt(sMileage / sch.jhlcOrig * sch.bcsj) * 60 * 1000) | ||
| 488 | + ,ets = et > sch.zdsjT?sch.zdsj:moment(et).format('HH:mm'); | ||
| 489 | + $('input[name=endDate]', serviceForm).val(ets); | ||
| 490 | + | ||
| 491 | + //有烂班 | ||
| 492 | + if (serviceEnd != esCode) { | ||
| 493 | + //烂班起点 == 营运终点 | ||
| 494 | + $('select[name=startStation]', destroyForm).val(serviceEnd); | ||
| 495 | + //计算烂班公里 | ||
| 496 | + s = $('select[name=startStation]', destroyForm).val(); | ||
| 497 | + e = $('select[name=endStation]', destroyForm).val(); | ||
| 498 | + var dMileage = calcMileage(s, e); | ||
| 499 | + $('input[name=mileage]', destroyForm).val(dMileage); | ||
| 500 | + //烂班开始时间 | ||
| 501 | + $('input[name=startDate]', destroyForm).val(ets); | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + //进场开始时间 | ||
| 505 | + $('input[name=startDate]', emptyForm).val(ets); | ||
| 506 | + | ||
| 507 | + //重新导航 | ||
| 508 | + inparkNavigation(); | ||
| 509 | + } | ||
| 510 | + | ||
| 511 | + function calcMileage(s, e) { | ||
| 512 | + var mileage = 0, flag, code; | ||
| 513 | + if (timeLocStations) { | ||
| 514 | + //空间坐标计算的站距 | ||
| 515 | + $.each(timeLocStations, function () { | ||
| 516 | + code = this.station['STATION_CODE']; | ||
| 517 | + if (flag) | ||
| 518 | + mileage = gb_common.accAdd(mileage, this.toDistanceGl); | ||
| 519 | + if (code == s) | ||
| 520 | + flag = true; | ||
| 521 | + if (code == e) | ||
| 522 | + return false; | ||
| 523 | + }); | ||
| 524 | + } | ||
| 525 | + else{ | ||
| 526 | + //从原始站点路由字段里取值 | ||
| 527 | + $.each(stationRoutes, function () { | ||
| 528 | + code = this['stationCode']; | ||
| 529 | + if (flag) | ||
| 530 | + mileage = gb_common.accAdd(mileage, this.distances); | ||
| 531 | + if (code == s) | ||
| 532 | + flag = true; | ||
| 533 | + if (code == e) | ||
| 534 | + return false; | ||
| 535 | + }); | ||
| 536 | + } | ||
| 537 | + return mileage; | ||
| 538 | + } | ||
| 539 | + | ||
| 540 | + //从本地localStorage获取站间距数据 | ||
| 541 | + function getLocStationsSpace() { | ||
| 542 | + try { | ||
| 543 | + timeLocStations = window.localStorage.getItem('control_route_distance_' + sch.xlBm); | ||
| 544 | + if (timeLocStations) | ||
| 545 | + timeLocStations = JSON.parse(timeLocStations).stations[sch.xlDir == 0 ? 'up' : 'down']; | ||
| 546 | + } catch (e) { | ||
| 547 | + console.log(e); | ||
| 548 | + } | ||
| 549 | + } | ||
| 550 | + | ||
| 551 | + //站间距计算后刷新 | ||
| 552 | + $(modal).on('refresh_station_space', function () { | ||
| 553 | + getLocStationsSpace(); | ||
| 554 | + reClac(); | ||
| 555 | + }); | ||
| 556 | + | ||
| 557 | + //------ 下抽屉 ------ | ||
| 558 | + $('#betweenStationRangeCalc', modal).on('click', function () { | ||
| 559 | + var id = $(this).data('drawer-id'); | ||
| 560 | + switchBtmDrawer(id, '/real_control_v2/fragments/line_schedule/context_menu/sub_task/station_route_spacing_chart.html'); | ||
| 561 | + }); | ||
| 562 | + | ||
| 563 | + var btmDrawer = $('.ct-bottom-drawer', modal); | ||
| 564 | + //打开事件 | ||
| 565 | + btmDrawer.on('drawer_show', function () { | ||
| 566 | + var url = $(this).data('url'); | ||
| 567 | + if (!url) { | ||
| 568 | + alert('无效的地址'); | ||
| 569 | + } | ||
| 570 | + | ||
| 571 | + var drawerPanel = $(this).data('name'); | ||
| 572 | + $('.ct-bottom-drawer-body', btmDrawer).load(url, function () { | ||
| 573 | + $('#' + drawerPanel).trigger('drawer-init', {sch: sch}); | ||
| 574 | + }); | ||
| 575 | + }); | ||
| 576 | + | ||
| 577 | + function switchBtmDrawer(id, url) { | ||
| 578 | + if (btmDrawer.hasClass('open') && btmDrawer.data('name') == id) { | ||
| 579 | + btmDrawer.removeClass('open'); | ||
| 580 | + btmDrawer.removeData('name').removeData('url'); | ||
| 581 | + } | ||
| 582 | + else { | ||
| 583 | + btmDrawer.addClass('open'); | ||
| 584 | + btmDrawer.data('name', id).data('url', url).trigger('drawer_show'); | ||
| 585 | + } | ||
| 586 | + } | ||
| 587 | + | ||
| 588 | + | ||
| 589 | + function updateTwinsTaskBySch(sch) { | ||
| 590 | + //主任务是烂班 | ||
| 591 | + if(sch.destroy){ | ||
| 592 | + serviceForm.prepend('<input type="hidden" name="destroy" value="true">'); | ||
| 593 | + $('[name=mileage]', serviceForm).val(sch.jhlcOrig).attr('disabled', 'disabled'); | ||
| 594 | + $('.twins_task_panel .uk-badge', modal).addClass('uk-badge-danger').text('烂班'); | ||
| 595 | + //终点禁选 | ||
| 596 | + $('select[name=endStation]', serviceForm).attr('disabled', 'disabled'); | ||
| 597 | + //开始结束时间禁选 | ||
| 598 | + | ||
| 599 | + //空驶起点 | ||
| 600 | + $('select[name=startStation]', emptyForm).val(sch.qdzCode); | ||
| 601 | + } | ||
| 602 | + } | ||
| 603 | + })(); | ||
| 604 | + </script> | ||
| 605 | </div> | 605 | </div> |
| 606 | \ No newline at end of file | 606 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_other.html
| 1 | -<div class="uk-modal ct-form-modal ct_move_modal" id="add-sub-task-other-modal"> | ||
| 2 | - <div class="uk-modal-dialog" style="width: 635px;"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>自定义子任务</h2></div> | ||
| 6 | - <form class="uk-form uk-form-horizontal"> | ||
| 7 | - </form> | ||
| 8 | - </div> | ||
| 9 | - | ||
| 10 | - <script id="sub-task-other-form-temp" type="text/html"> | ||
| 11 | - <input type="hidden" value="{{sch.id}}" name="schedule.id"> | ||
| 12 | - <div class="uk-grid"> | ||
| 13 | - <div class="uk-width-1-1"> | ||
| 14 | - <div class="uk-form-row"> | ||
| 15 | - <label class="uk-form-label">班次类型</label> | ||
| 16 | - <div class="uk-form-controls"> | ||
| 17 | - <select class="form-control" name="type1" style="width: 65px;"> | ||
| 18 | - <option>正常</option> | ||
| 19 | - <option>临加</option> | ||
| 20 | - </select> | ||
| 21 | - <select class="form-control nt-dictionary" name="type2" data-group=ChildTaskType | ||
| 22 | - style="width: 126px;;"></select> | ||
| 23 | - </div> | ||
| 24 | - </div> | ||
| 25 | - </div> | ||
| 26 | - </div> | ||
| 27 | - <div class="uk-grid"> | ||
| 28 | - <div class="uk-width-1-2"> | ||
| 29 | - <div class="uk-form-row"> | ||
| 30 | - <label class="uk-form-label">起点 </label> | ||
| 31 | - <div class="uk-form-controls"> | ||
| 32 | - <select name="startStation" required></select> | ||
| 33 | - </div> | ||
| 34 | - </div> | ||
| 35 | - </div> | ||
| 36 | - <div class="uk-width-1-2"> | ||
| 37 | - <div class="uk-form-row"> | ||
| 38 | - <label class="uk-form-label">终点</label> | ||
| 39 | - <div class="uk-form-controls"> | ||
| 40 | - <select name="endStation" required></select> | ||
| 41 | - </div> | ||
| 42 | - </div> | ||
| 43 | - </div> | ||
| 44 | - </div> | ||
| 45 | - | ||
| 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 | - <select class="form-control nt-dictionary" required name="mileageType" | ||
| 52 | - data-group="MileageType"></select> | ||
| 53 | - </div> | ||
| 54 | - </div> | ||
| 55 | - </div> | ||
| 56 | - <div class="uk-width-1-2"> | ||
| 57 | - <div class="uk-form-row"> | ||
| 58 | - <label class="uk-form-label">公里数</label> | ||
| 59 | - <div class="uk-form-controls"> | ||
| 60 | - <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false" required> | ||
| 61 | - </div> | ||
| 62 | - </div> | ||
| 63 | - </div> | ||
| 64 | - </div> | ||
| 65 | - | ||
| 66 | - <div class="uk-grid"> | ||
| 67 | - <div class="uk-width-1-2"> | ||
| 68 | - <div class="uk-form-row"> | ||
| 69 | - <label class="uk-form-label">开始时间</label> | ||
| 70 | - <div class="uk-form-controls"> | ||
| 71 | - <input name="startDate" value="{{sch.fcsj}}" type="time" required> | ||
| 72 | - </div> | ||
| 73 | - </div> | ||
| 74 | - </div> | ||
| 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 | - <input name="endDate" value="{{sch.zdsj}}" type="time" required> | ||
| 80 | - </div> | ||
| 81 | - </div> | ||
| 82 | - </div> | ||
| 83 | - </div> | ||
| 84 | - | ||
| 85 | - <div class="uk-grid"> | ||
| 86 | - <div class="uk-width-1-2"> | ||
| 87 | - <div class="uk-form-row" style="padding-top: 5px;"> | ||
| 88 | - <label class="uk-form-label"></label> | ||
| 89 | - <div class="uk-form-controls"> | ||
| 90 | - <label> | ||
| 91 | - <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班 | ||
| 92 | - </label> | ||
| 93 | - </div> | ||
| 94 | - </div> | ||
| 95 | - </div> | ||
| 96 | - <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;"> | ||
| 97 | - <div class="uk-form-row"> | ||
| 98 | - <label class="uk-form-label">烂班原因</label> | ||
| 99 | - <div class="uk-form-controls"> | ||
| 100 | - <select class="form-control" name="destroyReason" required> | ||
| 101 | - <option value="">请选择...</option> | ||
| 102 | - {{each adjustExps as exp i}} | ||
| 103 | - <option value="{{exp}}">{{exp}}</option> | ||
| 104 | - {{/each}} | ||
| 105 | - </select> | ||
| 106 | - </div> | ||
| 107 | - </div> | ||
| 108 | - </div> | ||
| 109 | - </div> | ||
| 110 | - | ||
| 111 | - <div class="uk-grid"> | ||
| 112 | - <div class="uk-width-1-1"> | ||
| 113 | - <div class="uk-form-row ct-stacked"> | ||
| 114 | - <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 115 | - <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" | ||
| 116 | - data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 117 | - </div> | ||
| 118 | - </div> | ||
| 119 | - </div> | ||
| 120 | - </div> | ||
| 121 | - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | ||
| 122 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 123 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 124 | - </div> | ||
| 125 | - </script> | ||
| 126 | - | ||
| 127 | - <script> | ||
| 128 | - (function () { | ||
| 129 | - var modal = '#add-sub-task-other-modal', | ||
| 130 | - sch, stationRoutes, parks, information; | ||
| 131 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 132 | - $(modal).on('init', function (e, data) { | ||
| 133 | - e.stopPropagation(); | ||
| 134 | - sch = data.sch; | ||
| 135 | - var formHtml = template('sub-task-other-form-temp', {sch: sch, adjustExps: adjustExps}); | ||
| 136 | - $('form', modal).html(formHtml); | ||
| 137 | - //字典转换 | ||
| 138 | - dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 139 | - | ||
| 140 | - //站点路由 | ||
| 141 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 142 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 143 | - }), 'directions'); | ||
| 144 | - //停车场 | ||
| 145 | - $.get('/basic/parks', function (rs) { | ||
| 146 | - parks = rs; | ||
| 147 | - }); | ||
| 148 | - //线路标准 | ||
| 149 | - information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 150 | - | ||
| 151 | - //submit | ||
| 152 | - var f = $('form', modal).formValidation(gb_form_validation_opts); | ||
| 153 | - f.on('success.form.fv', function (e) { | ||
| 154 | - disabled_submit_btn(this); | ||
| 155 | - e.preventDefault(); | ||
| 156 | - var data = $(this).serializeJSON(); | ||
| 157 | - | ||
| 158 | - gb_common.$post('/childTask', data, function (rs) { | ||
| 159 | - notify_succ('子任务添加成功'); | ||
| 160 | - gb_schedule_table.updateSchedule(rs.t); | ||
| 161 | - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t}); | ||
| 162 | - UIkit.modal(modal).hide(); | ||
| 163 | - }); | ||
| 164 | - }); | ||
| 165 | - | ||
| 166 | - //班次类型 | ||
| 167 | - $('[name=type2]', f).on('change', function () { | ||
| 168 | - var routes = stationRoutes[sch.xlDir] | ||
| 169 | - , lastCode = routes[routes.length - 1].stationCode | ||
| 170 | - , opts = '', park_opts = ''; | ||
| 171 | - //station options | ||
| 172 | - $.each(routes, function () { | ||
| 173 | - opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 174 | - }); | ||
| 175 | - //park options | ||
| 176 | - for (var code in parks) | ||
| 177 | - park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 178 | - | ||
| 179 | - var qdz = $('[name=startStation]', f), zdz = $('[name=endStation]', f), mType = $('[name=mileageType]', f); | ||
| 180 | - switch ($(this).val()) { | ||
| 181 | - case '3'://出场 | ||
| 182 | - qdz.html(park_opts).val(information.carPark); | ||
| 183 | - zdz.html(opts); | ||
| 184 | - mType.val('empty'); | ||
| 185 | - break; | ||
| 186 | - case '2'://进场 | ||
| 187 | - qdz.html(opts); | ||
| 188 | - zdz.html(park_opts).val(information.carPark); | ||
| 189 | - mType.val('empty'); | ||
| 190 | - break; | ||
| 191 | - default: | ||
| 192 | - qdz.html(opts); | ||
| 193 | - zdz.html(opts).val(lastCode); | ||
| 194 | - mType.val('service'); | ||
| 195 | - | ||
| 196 | - } | ||
| 197 | - }); | ||
| 198 | - | ||
| 199 | - //是否烂班 | ||
| 200 | - $('[name=destroy]', f).on('click', function () { | ||
| 201 | - if (this.checked) { | ||
| 202 | - $('.destroy_reason_wrap', modal).show();//.find('[name=destroyReason]').attr('required', 'required'); | ||
| 203 | - } | ||
| 204 | - else { | ||
| 205 | - $('.destroy_reason_wrap', modal).hide();//.find('[name=destroyReason]').removeAttr('required'); | ||
| 206 | - } | ||
| 207 | - }); | ||
| 208 | - | ||
| 209 | - $('[name=destroyReason]', f).on('change', function () { | ||
| 210 | - var rem = $('[name=remarks]', f); | ||
| 211 | - rem.val(rem.val() + $(this).val() + ','); | ||
| 212 | - }); | ||
| 213 | - }); | ||
| 214 | - })(); | ||
| 215 | - </script> | ||
| 216 | -</div> | 1 | +<div class="uk-modal ct-form-modal ct_move_modal" id="add-sub-task-other-modal"> |
| 2 | + <div class="uk-modal-dialog" style="width: 635px;"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>自定义子任务</h2></div> | ||
| 6 | + <form class="uk-form uk-form-horizontal"> | ||
| 7 | + </form> | ||
| 8 | + </div> | ||
| 9 | + | ||
| 10 | + <script id="sub-task-other-form-temp" type="text/html"> | ||
| 11 | + <input type="hidden" value="{{sch.id}}" name="schedule.id"> | ||
| 12 | + <div class="uk-grid"> | ||
| 13 | + <div class="uk-width-1-1"> | ||
| 14 | + <div class="uk-form-row"> | ||
| 15 | + <label class="uk-form-label">班次类型</label> | ||
| 16 | + <div class="uk-form-controls"> | ||
| 17 | + <select class="form-control" name="type1" style="width: 65px;"> | ||
| 18 | + <option>正常</option> | ||
| 19 | + <option>临加</option> | ||
| 20 | + </select> | ||
| 21 | + <select class="form-control nt-dictionary" name="type2" data-group=ChildTaskType | ||
| 22 | + style="width: 126px;;"></select> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 25 | + </div> | ||
| 26 | + </div> | ||
| 27 | + <div class="uk-grid"> | ||
| 28 | + <div class="uk-width-1-2"> | ||
| 29 | + <div class="uk-form-row"> | ||
| 30 | + <label class="uk-form-label">起点 </label> | ||
| 31 | + <div class="uk-form-controls"> | ||
| 32 | + <select name="startStation" required></select> | ||
| 33 | + </div> | ||
| 34 | + </div> | ||
| 35 | + </div> | ||
| 36 | + <div class="uk-width-1-2"> | ||
| 37 | + <div class="uk-form-row"> | ||
| 38 | + <label class="uk-form-label">终点</label> | ||
| 39 | + <div class="uk-form-controls"> | ||
| 40 | + <select name="endStation" required></select> | ||
| 41 | + </div> | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 44 | + </div> | ||
| 45 | + | ||
| 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 | + <select class="form-control nt-dictionary" required name="mileageType" | ||
| 52 | + data-group="MileageType"></select> | ||
| 53 | + </div> | ||
| 54 | + </div> | ||
| 55 | + </div> | ||
| 56 | + <div class="uk-width-1-2"> | ||
| 57 | + <div class="uk-form-row"> | ||
| 58 | + <label class="uk-form-label">公里数</label> | ||
| 59 | + <div class="uk-form-controls"> | ||
| 60 | + <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false" required> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + </div> | ||
| 65 | + | ||
| 66 | + <div class="uk-grid"> | ||
| 67 | + <div class="uk-width-1-2"> | ||
| 68 | + <div class="uk-form-row"> | ||
| 69 | + <label class="uk-form-label">开始时间</label> | ||
| 70 | + <div class="uk-form-controls"> | ||
| 71 | + <input name="startDate" value="{{sch.fcsj}}" type="time" required> | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | + </div> | ||
| 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 | + <input name="endDate" value="{{sch.zdsj}}" type="time" required> | ||
| 80 | + </div> | ||
| 81 | + </div> | ||
| 82 | + </div> | ||
| 83 | + </div> | ||
| 84 | + | ||
| 85 | + <div class="uk-grid"> | ||
| 86 | + <div class="uk-width-1-2"> | ||
| 87 | + <div class="uk-form-row" style="padding-top: 5px;"> | ||
| 88 | + <label class="uk-form-label"></label> | ||
| 89 | + <div class="uk-form-controls"> | ||
| 90 | + <label> | ||
| 91 | + <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班 | ||
| 92 | + </label> | ||
| 93 | + </div> | ||
| 94 | + </div> | ||
| 95 | + </div> | ||
| 96 | + <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;"> | ||
| 97 | + <div class="uk-form-row"> | ||
| 98 | + <label class="uk-form-label">烂班原因</label> | ||
| 99 | + <div class="uk-form-controls"> | ||
| 100 | + <select class="form-control" name="destroyReason" required> | ||
| 101 | + <option value="">请选择...</option> | ||
| 102 | + {{each adjustExps as exp i}} | ||
| 103 | + <option value="{{exp}}">{{exp}}</option> | ||
| 104 | + {{/each}} | ||
| 105 | + </select> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + </div> | ||
| 109 | + </div> | ||
| 110 | + | ||
| 111 | + <div class="uk-grid"> | ||
| 112 | + <div class="uk-width-1-1"> | ||
| 113 | + <div class="uk-form-row ct-stacked"> | ||
| 114 | + <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 115 | + <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" | ||
| 116 | + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 117 | + </div> | ||
| 118 | + </div> | ||
| 119 | + </div> | ||
| 120 | + </div> | ||
| 121 | + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | ||
| 122 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 123 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 124 | + </div> | ||
| 125 | + </script> | ||
| 126 | + | ||
| 127 | + <script> | ||
| 128 | + (function () { | ||
| 129 | + var modal = '#add-sub-task-other-modal', | ||
| 130 | + sch, stationRoutes, parks, information; | ||
| 131 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 132 | + $(modal).on('init', function (e, data) { | ||
| 133 | + e.stopPropagation(); | ||
| 134 | + sch = data.sch; | ||
| 135 | + var formHtml = template('sub-task-other-form-temp', {sch: sch, adjustExps: adjustExps}); | ||
| 136 | + $('form', modal).html(formHtml); | ||
| 137 | + //字典转换 | ||
| 138 | + dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 139 | + | ||
| 140 | + //站点路由 | ||
| 141 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 142 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 143 | + }), 'directions'); | ||
| 144 | + //停车场 | ||
| 145 | + $.get('/basic/parks', function (rs) { | ||
| 146 | + parks = rs; | ||
| 147 | + }); | ||
| 148 | + //线路标准 | ||
| 149 | + information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 150 | + | ||
| 151 | + //submit | ||
| 152 | + var f = $('form', modal).formValidation(gb_form_validation_opts); | ||
| 153 | + f.on('success.form.fv', function (e) { | ||
| 154 | + disabled_submit_btn(this); | ||
| 155 | + e.preventDefault(); | ||
| 156 | + var data = $(this).serializeJSON(); | ||
| 157 | + | ||
| 158 | + gb_common.$post('/childTask', data, function (rs) { | ||
| 159 | + notify_succ('子任务添加成功'); | ||
| 160 | + gb_schedule_table.updateSchedule(rs.t); | ||
| 161 | + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t}); | ||
| 162 | + UIkit.modal(modal).hide(); | ||
| 163 | + }); | ||
| 164 | + }); | ||
| 165 | + | ||
| 166 | + //班次类型 | ||
| 167 | + $('[name=type2]', f).on('change', function () { | ||
| 168 | + var routes = stationRoutes[sch.xlDir] | ||
| 169 | + , lastCode = routes[routes.length - 1].stationCode | ||
| 170 | + , opts = '', park_opts = ''; | ||
| 171 | + //station options | ||
| 172 | + $.each(routes, function () { | ||
| 173 | + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 174 | + }); | ||
| 175 | + //park options | ||
| 176 | + for (var code in parks) | ||
| 177 | + park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 178 | + | ||
| 179 | + var qdz = $('[name=startStation]', f), zdz = $('[name=endStation]', f), mType = $('[name=mileageType]', f); | ||
| 180 | + switch ($(this).val()) { | ||
| 181 | + case '3'://出场 | ||
| 182 | + qdz.html(park_opts).val(information.carPark); | ||
| 183 | + zdz.html(opts); | ||
| 184 | + mType.val('empty'); | ||
| 185 | + break; | ||
| 186 | + case '2'://进场 | ||
| 187 | + qdz.html(opts); | ||
| 188 | + zdz.html(park_opts).val(information.carPark); | ||
| 189 | + mType.val('empty'); | ||
| 190 | + break; | ||
| 191 | + default: | ||
| 192 | + qdz.html(opts); | ||
| 193 | + zdz.html(opts).val(lastCode); | ||
| 194 | + mType.val('service'); | ||
| 195 | + | ||
| 196 | + } | ||
| 197 | + }); | ||
| 198 | + | ||
| 199 | + //是否烂班 | ||
| 200 | + $('[name=destroy]', f).on('click', function () { | ||
| 201 | + if (this.checked) { | ||
| 202 | + $('.destroy_reason_wrap', modal).show();//.find('[name=destroyReason]').attr('required', 'required'); | ||
| 203 | + } | ||
| 204 | + else { | ||
| 205 | + $('.destroy_reason_wrap', modal).hide();//.find('[name=destroyReason]').removeAttr('required'); | ||
| 206 | + } | ||
| 207 | + }); | ||
| 208 | + | ||
| 209 | + $('[name=destroyReason]', f).on('change', function () { | ||
| 210 | + var rem = $('[name=remarks]', f); | ||
| 211 | + rem.val(rem.val() + $(this).val() + ','); | ||
| 212 | + }); | ||
| 213 | + }); | ||
| 214 | + })(); | ||
| 215 | + </script> | ||
| 216 | +</div> |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_range_turn.html
| 1 | -<div class="uk-modal ct-form-modal ct_move_modal" id="add-sub-task-range_turn-modal"> | ||
| 2 | - <div class="uk-modal-dialog" style="width: 1200px;"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>区间调头子任务</h2></div> | ||
| 6 | - | ||
| 7 | - <div style="width: 100%;padding-left: 1%;"> | ||
| 8 | - <form class="uk-form uk-form-horizontal"> | ||
| 9 | - <div class="uk-grid"> | ||
| 10 | - <div class="uk-width-1-4"> | ||
| 11 | - <div class="uk-form-row" style="margin-top: 20px;"> | ||
| 12 | - <label class="uk-form-label">调头站点</label> | ||
| 13 | - <div class="uk-form-controls"> | ||
| 14 | - <select id="turnStationSelect"> | ||
| 15 | - <option value="">请选择...</option> | ||
| 16 | - </select> | ||
| 17 | - </div> | ||
| 18 | - </div> | ||
| 19 | - </div> | ||
| 20 | - <div class="uk-width-1-4"> | ||
| 21 | - <div class="uk-form-row" style="margin-top: 20px;"> | ||
| 22 | - <label class="uk-form-label">调头原因</label> | ||
| 23 | - <div class="uk-form-controls"> | ||
| 24 | - <select id="turnReason" style="width: calc(100% - 9px);"> | ||
| 25 | - <option value="">请选择...</option> | ||
| 26 | - </select> | ||
| 27 | - </div> | ||
| 28 | - </div> | ||
| 29 | - </div> | ||
| 30 | - <div class="uk-width-2-4" style="padding: 20px 0 0 28px;"> | ||
| 31 | - <label> | ||
| 32 | - <input type="checkbox" id="emptyTurnCbox"> 调头后空驶回起点 | ||
| 33 | - </label> | ||
| 34 | - <h6 style="color: #a7a5a5;margin-top: 0;"><i class="uk-icon-question-circle"> </i> | ||
| 35 | - 如果“调头站点”在另一个走向不存在,你需要手动选择第二个营运起点</h6> | ||
| 36 | - </div> | ||
| 37 | - </div> | ||
| 38 | - </form> | ||
| 39 | - </div> | ||
| 40 | - <hr class="modal-dotted-hr"> | ||
| 41 | - <div class="uk-grid"> | ||
| 42 | - <div class="uk-width-1-2"> | ||
| 43 | - <div class="main-sch-panel curr"></div> | ||
| 44 | - | ||
| 45 | - <div style="margin-top: 5px;"> | ||
| 46 | - <div class="sub-task-card" style="margin: 0 0 0 7px;"> | ||
| 47 | - <div class="uk-panel uk-panel-box uk-panel-box-primary" style="padding-bottom: 32px;"> | ||
| 48 | - <div class="uk-panel-badge uk-badge">营运</div> | ||
| 49 | - <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 50 | - | ||
| 51 | - <form class="uk-form uk-form-horizontal" curr_service_form> | ||
| 52 | - </form> | ||
| 53 | - </div> | ||
| 54 | - </div> | ||
| 55 | - <div class="sub-task-card " style="margin: 0;"> | ||
| 56 | - <div class="uk-panel uk-panel-box" style="padding-bottom: 32px;"> | ||
| 57 | - <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 58 | - <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 59 | - <form class="uk-form uk-form-horizontal " curr_destroy_form> | ||
| 60 | - </form> | ||
| 61 | - </div> | ||
| 62 | - </div> | ||
| 63 | - </div> | ||
| 64 | - </div> | ||
| 65 | - <div class="uk-width-1-2"> | ||
| 66 | - <div class="main-sch-panel next"></div> | ||
| 67 | - | ||
| 68 | - <div style="margin: 5px;"> | ||
| 69 | - <div class="sub-task-card " style="margin: 0 0 0 7px;"> | ||
| 70 | - <div class="uk-panel uk-panel-box" style="padding-bottom: 32px;"> | ||
| 71 | - <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 72 | - <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 73 | - <form class="uk-form uk-form-horizontal " next_destroy_form></form> | ||
| 74 | - </div> | ||
| 75 | - </div> | ||
| 76 | - <div class="sub-task-card" style="margin: 0;"> | ||
| 77 | - <div class="uk-panel uk-panel-box uk-panel-box-primary" style="padding-bottom: 32px;"> | ||
| 78 | - <div class="uk-panel-badge uk-badge">营运</div> | ||
| 79 | - <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 80 | - | ||
| 81 | - <form class="uk-form uk-form-horizontal" next_service_form> | ||
| 82 | - </form> | ||
| 83 | - </div> | ||
| 84 | - </div> | ||
| 85 | - </div> | ||
| 86 | - </div> | ||
| 87 | - </div> | ||
| 88 | - | ||
| 89 | - | ||
| 90 | - <div class="uk-modal-footer uk-text-right"> | ||
| 91 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 92 | - <button type="button" class="uk-button uk-button-primary" id="submitChildTaskBtn">提交子任务</button> | ||
| 93 | - | ||
| 94 | - <div class="ct-footer-left"> | ||
| 95 | - <a id="betweenStationRangeCalc" data-drawer-id="station_route_spacing_chart_drawer">站点间公里不准?</a> | ||
| 96 | - </div> | ||
| 97 | - </div> | ||
| 98 | - </div> | ||
| 99 | - <!-- 主任务信息 --> | ||
| 100 | - <script id="range_turn_main_sch-temp" type="text/html"> | ||
| 101 | - <div class="ct_row"> | ||
| 102 | - <div class="ct_cell c_1_3"> | ||
| 103 | - <label>待发</label> | ||
| 104 | - <span>{{dfsj}}</span> | ||
| 105 | - </div> | ||
| 106 | - <div class="ct_cell c_1_3"> | ||
| 107 | - <label>计达</label> | ||
| 108 | - <span>{{zdsj}}</span> | ||
| 109 | - </div> | ||
| 110 | - <div class="ct_cell c_1_3"> | ||
| 111 | - <label>车辆</label> | ||
| 112 | - <span>{{clZbh}}</span> | ||
| 113 | - </div> | ||
| 114 | - </div> | ||
| 115 | - <div class="ct_row"> | ||
| 116 | - <div class="ct_cell c_1_3"> | ||
| 117 | - <label>起点</label> | ||
| 118 | - <span>{{qdzName}}</span> | ||
| 119 | - </div> | ||
| 120 | - <div class="ct_cell c_1_3"> | ||
| 121 | - <label>终点</label> | ||
| 122 | - <span>{{zdzName}}</span> | ||
| 123 | - </div> | ||
| 124 | - <div class="ct_cell c_1_3"> | ||
| 125 | - <label>里程</label> | ||
| 126 | - <span>{{jhlc}}</span> | ||
| 127 | - </div> | ||
| 128 | - </div> | ||
| 129 | - </script> | ||
| 130 | - | ||
| 131 | - <!-- 子任务营运表单 --> | ||
| 132 | - <script id="range_turn_child_service-temp" type="text/html"> | ||
| 133 | - <input type="hidden" name="schedule.id" value="{{sch.id}}"> | ||
| 134 | - <input type="hidden" name="type2" value="1"> | ||
| 135 | - <input type="hidden" value="正常" name="type1"> | ||
| 136 | - <input type="hidden" name="mileageType" value="service"> | ||
| 137 | - <div class="uk-grid"> | ||
| 138 | - <div class="uk-width-3-10"> | ||
| 139 | - <div class="uk-form-row"> | ||
| 140 | - <label class="uk-form-label">起点 </label> | ||
| 141 | - </div> | ||
| 142 | - </div> | ||
| 143 | - <div class="uk-width-7-10 pl5"> | ||
| 144 | - <select name="startStation"> | ||
| 145 | - {{each routes as r i}} | ||
| 146 | - <option value="{{r.stationCode}}">{{r.stationName}}</option> | ||
| 147 | - {{/each}} | ||
| 148 | - </select> | ||
| 149 | - </div> | ||
| 150 | - </div> | ||
| 151 | - <div class="uk-grid"> | ||
| 152 | - <div class="uk-width-3-10"> | ||
| 153 | - <div class="uk-form-row"> | ||
| 154 | - <label class="uk-form-label">终点 </label> | ||
| 155 | - </div> | ||
| 156 | - </div> | ||
| 157 | - <div class="uk-width-7-10 pl5"> | ||
| 158 | - <select name="endStation" class="ct_focus" disabled> | ||
| 159 | - {{each routes as r i}} | ||
| 160 | - <option value="{{r.stationCode}}" {{if r.stationCode==sch.zdzCode}}selected{{/if}}> | ||
| 161 | - {{r.stationName}} | ||
| 162 | - </option> | ||
| 163 | - {{/each}} | ||
| 164 | - </select> | ||
| 165 | - </div> | ||
| 166 | - </div> | ||
| 167 | - <div class="uk-grid"> | ||
| 168 | - <div class="uk-width-3-10"> | ||
| 169 | - <div class="uk-form-row"> | ||
| 170 | - <label class="uk-form-label mileage_label">营运里程</label> | ||
| 171 | - </div> | ||
| 172 | - </div> | ||
| 173 | - <div class="uk-width-7-10 pl5"> | ||
| 174 | - <input type="number" step="0.01" name="mileage" value="{{sch.jhlc}}" required> | ||
| 175 | - </div> | ||
| 176 | - </div> | ||
| 177 | - <div class="uk-grid"> | ||
| 178 | - <div class="uk-width-3-10"> | ||
| 179 | - <div class="uk-form-row"> | ||
| 180 | - <label class="uk-form-label">开始时间</label> | ||
| 181 | - </div> | ||
| 182 | - </div> | ||
| 183 | - <div class="uk-width-7-10 pl5"> | ||
| 184 | - <input type="time" name="startDate" value="{{sch.dfsj}}" required > | ||
| 185 | - </div> | ||
| 186 | - </div> | ||
| 187 | - <div class="uk-grid"> | ||
| 188 | - <div class="uk-width-3-10"> | ||
| 189 | - <div class="uk-form-row"> | ||
| 190 | - <label class="uk-form-label">结束时间</label> | ||
| 191 | - </div> | ||
| 192 | - </div> | ||
| 193 | - <div class="uk-width-7-10 pl5"> | ||
| 194 | - <input type="time" name="endDate" value="{{sch.zdsj}}" > | ||
| 195 | - </div> | ||
| 196 | - </div> | ||
| 197 | - </script> | ||
| 198 | - | ||
| 199 | - <!-- 子任务烂班表单 --> | ||
| 200 | - <script id="range_turn_child_destroy-temp" type="text/html"> | ||
| 201 | - <input type="hidden" name="schedule.id" value="{{sch.id}}"> | ||
| 202 | - <input type="hidden" value="正常" name="type1"> | ||
| 203 | - <input type="hidden" value="1" name="type2"> | ||
| 204 | - <input type="hidden" name="mileageType" value="service"> | ||
| 205 | - <input type="hidden" name="destroy" value="true"> | ||
| 206 | - <div class="uk-grid"> | ||
| 207 | - <div class="uk-width-3-10"> | ||
| 208 | - <div class="uk-form-row"> | ||
| 209 | - <label class="uk-form-label">起点 </label> | ||
| 210 | - </div> | ||
| 211 | - </div> | ||
| 212 | - <div class="uk-width-7-10 pl5"> | ||
| 213 | - <select name="startStation" required disabled> | ||
| 214 | - {{each routes as r i}} | ||
| 215 | - <option value="{{r.stationCode}}">{{r.stationName}}</option> | ||
| 216 | - {{/each}} | ||
| 217 | - </select> | ||
| 218 | - </div> | ||
| 219 | - </div> | ||
| 220 | - <div class="uk-grid"> | ||
| 221 | - <div class="uk-width-3-10"> | ||
| 222 | - <div class="uk-form-row"> | ||
| 223 | - <label class="uk-form-label">终点 </label> | ||
| 224 | - </div> | ||
| 225 | - </div> | ||
| 226 | - <div class="uk-width-7-10 pl5"> | ||
| 227 | - <select name="endStation" required class="ct_focus"> | ||
| 228 | - {{each routes as r i}} | ||
| 229 | - <option value="{{r.stationCode}}" {{if r.stationCode==sch.zdzCode}}selected{{/if}}> | ||
| 230 | - {{r.stationName}} | ||
| 231 | - </option> | ||
| 232 | - {{/each}} | ||
| 233 | - </select> | ||
| 234 | - </div> | ||
| 235 | - </div> | ||
| 236 | - <div class="uk-grid"> | ||
| 237 | - <div class="uk-width-3-10"> | ||
| 238 | - <div class="uk-form-row"> | ||
| 239 | - <label class="uk-form-label">烂班里程</label> | ||
| 240 | - </div> | ||
| 241 | - </div> | ||
| 242 | - <div class="uk-width-7-10 pl5"> | ||
| 243 | - <input type="number" step="0.01" name="mileage" required> | ||
| 244 | - </div> | ||
| 245 | - </div> | ||
| 246 | - <div class="uk-grid"> | ||
| 247 | - <div class="uk-width-3-10"> | ||
| 248 | - <div class="uk-form-row"> | ||
| 249 | - <label class="uk-form-label">开始时间</label> | ||
| 250 | - </div> | ||
| 251 | - </div> | ||
| 252 | - <div class="uk-width-7-10 pl5"> | ||
| 253 | - <input type="time" name="startDate" required disabled> | ||
| 254 | - </div> | ||
| 255 | - </div> | ||
| 256 | - <div class="uk-grid" style="height: 30px;"> | ||
| 257 | - </div> | ||
| 258 | - </script> | ||
| 259 | - | ||
| 260 | - <div class="ct-bottom-drawer"> | ||
| 261 | - <div class="ct-bottom-drawer-body"></div> | ||
| 262 | - </div> | ||
| 263 | - | ||
| 264 | - <script> | ||
| 265 | - (function () { | ||
| 266 | - var modal = '#add-sub-task-range_turn-modal', | ||
| 267 | - sch, nextSch, stationRoutes, information, timeLocStations; | ||
| 268 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 269 | - | ||
| 270 | - var csf = $('form[curr_service_form]', modal); | ||
| 271 | - var nsf = $('form[next_service_form]', modal); | ||
| 272 | - var cdf = $('form[curr_destroy_form]', modal); | ||
| 273 | - var ndf = $('form[next_destroy_form]', modal); | ||
| 274 | - | ||
| 275 | - //掉头站点 | ||
| 276 | - var turnStation, turnStationName; | ||
| 277 | - $(modal).on('init', function (e, data) { | ||
| 278 | - e.stopPropagation(); | ||
| 279 | - sch = data.sch; | ||
| 280 | - nextSch = gb_schedule_table.getNextSch(sch); | ||
| 281 | - | ||
| 282 | - //主任务信息 | ||
| 283 | - $('.main-sch-panel.curr', modal).html(template('range_turn_main_sch-temp', sch)); | ||
| 284 | - $('.main-sch-panel.next', modal).html(template('range_turn_main_sch-temp', nextSch)); | ||
| 285 | - | ||
| 286 | - //站点路由 | ||
| 287 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 288 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 289 | - }), 'directions'); | ||
| 290 | - | ||
| 291 | - var currData = {sch: sch, routes: stationRoutes[sch.xlDir]} | ||
| 292 | - , nextData = {sch: nextSch, routes: stationRoutes[nextSch.xlDir]}; | ||
| 293 | - //营运1 | ||
| 294 | - csf.html(template('range_turn_child_service-temp', currData)); | ||
| 295 | - disabledField(csf, 'startStation'); | ||
| 296 | - //营运结束时间 | ||
| 297 | - $('[name=endDate]', csf).on('input', synchroDate); | ||
| 298 | - | ||
| 299 | - //营运2 | ||
| 300 | - nsf.html(template('range_turn_child_service-temp', nextData)); | ||
| 301 | - disabledField(nsf, 'startDate'); | ||
| 302 | - //烂班1 | ||
| 303 | - cdf.html(template('range_turn_child_destroy-temp', currData)); | ||
| 304 | - disabledField(cdf, 'endStation'); | ||
| 305 | - //烂班2 | ||
| 306 | - ndf.html(template('range_turn_child_destroy-temp', nextData)); | ||
| 307 | - $('[name=startStation]', ndf).val(nextSch.qdzCode); | ||
| 308 | - //烂班2终点改变 | ||
| 309 | - $('[name=endStation]', ndf).on('change', reCalcSecond); | ||
| 310 | - //营运2起点改变 | ||
| 311 | - $('[name=startStation]', nsf).on('change', reCalcSecond); | ||
| 312 | - | ||
| 313 | - //掉头站点 | ||
| 314 | - var opts = ''; | ||
| 315 | - $.each(currData.routes, function () { | ||
| 316 | - opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'; | ||
| 317 | - }); | ||
| 318 | - $('#turnStationSelect', modal).append(opts); | ||
| 319 | - opts = ''; | ||
| 320 | - $.each(adjustExps, function () { | ||
| 321 | - opts += '<option value="' + this + '">' + this + '</option>'; | ||
| 322 | - }); | ||
| 323 | - //掉头原因 | ||
| 324 | - $('#turnReason', modal).append(opts); | ||
| 325 | - | ||
| 326 | - //线路标准 | ||
| 327 | - information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 328 | - //本地存储的站点耗时 | ||
| 329 | - getLocStationsSpace(); | ||
| 330 | - | ||
| 331 | - var dataArray = []; | ||
| 332 | - var fs = $('.sub-task-card form', modal).formValidation({ | ||
| 333 | - framework: 'uikit', | ||
| 334 | - locale: 'zh_CN' | ||
| 335 | - }); | ||
| 336 | - fs.on('success.form.fv', function (e) { | ||
| 337 | - e.preventDefault(); | ||
| 338 | - dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this), | ||
| 339 | - {remarks: $('#turnReason', modal).val(), destroyReason: $('#turnReason', modal).val()})); | ||
| 340 | - $(this).data('valid', true); | ||
| 341 | - | ||
| 342 | - if (allValidSuccess()) { | ||
| 343 | - var i = 0; | ||
| 344 | - (function () { | ||
| 345 | - var f = arguments.callee; | ||
| 346 | - if (i >= dataArray.length) { | ||
| 347 | - /** | ||
| 348 | - * 为班次添加备注 | ||
| 349 | - */ | ||
| 350 | - var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $.trim($('#turnReason', modal).val()) + '在' + $('[name=endStation] option:selected', csf).text() + '调头'; | ||
| 351 | - gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g')); | ||
| 352 | - UIkit.modal(modal).hide(); | ||
| 353 | - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | ||
| 354 | - return; | ||
| 355 | - } | ||
| 356 | - var data = dataArray[i]; | ||
| 357 | - //营运子任务不写备注 | ||
| 358 | - if(data.mileageType == 'service' && !data.destroy) | ||
| 359 | - data.remarks = ''; | ||
| 360 | - gb_common.$post('/childTask', data, function (rs) { | ||
| 361 | - notify_succ('子任务添加成功'); | ||
| 362 | - gb_schedule_table.updateSchedule(rs.t); | ||
| 363 | - i++; | ||
| 364 | - f(); | ||
| 365 | - }); | ||
| 366 | - })(); | ||
| 367 | - } | ||
| 368 | - }); | ||
| 369 | - | ||
| 370 | - //校验不过 | ||
| 371 | - fs.on('err.field.fv', function () { | ||
| 372 | - $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled'); | ||
| 373 | - }); | ||
| 374 | - | ||
| 375 | - //submit | ||
| 376 | - $('#submitChildTaskBtn', modal).on('click', function () { | ||
| 377 | - if ($('#turnReason', modal).val() == '') { | ||
| 378 | - return notify_err('你必须选择调头原因!'); | ||
| 379 | - } | ||
| 380 | - | ||
| 381 | - $(this).addClass('disabled').attr('disabled', 'disabled'); | ||
| 382 | - dataArray = []; | ||
| 383 | - fs.data('valid', false); | ||
| 384 | - fs.formValidation('validate'); | ||
| 385 | - }); | ||
| 386 | - | ||
| 387 | - //调头站切换 | ||
| 388 | - $('#turnStationSelect', modal).on('change', function () { | ||
| 389 | - turnStation = $(this).val(); | ||
| 390 | - turnStationName = $('option:selected', this).text(); | ||
| 391 | - reClac(); | ||
| 392 | - }); | ||
| 393 | - }); | ||
| 394 | - | ||
| 395 | - function disabledField(f, itemName) { | ||
| 396 | - $('[name=' + itemName + ']', f).attr('disabled', 'disabled'); | ||
| 397 | - } | ||
| 398 | - | ||
| 399 | - function allValidSuccess() { | ||
| 400 | - var flag = true; | ||
| 401 | - $('.sub-task-card form:visible', modal).each(function (i, f) { | ||
| 402 | - if (!$(f).data('valid')) { | ||
| 403 | - flag = false; | ||
| 404 | - return false; | ||
| 405 | - } | ||
| 406 | - }); | ||
| 407 | - return flag; | ||
| 408 | - } | ||
| 409 | - | ||
| 410 | - //获取表单disabled 项的值 | ||
| 411 | - function getDisabledVal(f) { | ||
| 412 | - var rs = {}; | ||
| 413 | - $('input,select', f).each(function () { | ||
| 414 | - if ($(this).attr('disabled')) { | ||
| 415 | - rs[$(this).attr('name')] = $(this).val(); | ||
| 416 | - } | ||
| 417 | - }); | ||
| 418 | - return rs; | ||
| 419 | - } | ||
| 420 | - | ||
| 421 | - function reClac() { | ||
| 422 | - if (!turnStation || turnStation == '') | ||
| 423 | - return; | ||
| 424 | - | ||
| 425 | - var mileage, et, ets; | ||
| 426 | - | ||
| 427 | - $('#turnStationSelect', modal).val(turnStation); | ||
| 428 | - //营运1终点 | ||
| 429 | - $('[name=endStation]', csf).val(turnStation); | ||
| 430 | - calcFormMileage(csf, sch.xlDir);//里程 | ||
| 431 | - //结束时间 | ||
| 432 | - ets = calcFirstEndDate(); | ||
| 433 | - | ||
| 434 | - //烂班1起点 | ||
| 435 | - $('[name=startStation]', cdf).val(turnStation); | ||
| 436 | - calcFormMileage(cdf, sch.xlDir); | ||
| 437 | - //开始时间 | ||
| 438 | - $('[name=startDate]', cdf).val(ets); | ||
| 439 | - //烂班2终点 | ||
| 440 | - try { | ||
| 441 | - if(!$('#emptyTurnCbox', modal)[0].checked){ | ||
| 442 | - $('[name=endStation]', ndf).val(searchParallelStation()); | ||
| 443 | - calcFormMileage(ndf, nextSch.xlDir); | ||
| 444 | - } | ||
| 445 | - } catch (e) { | ||
| 446 | - } | ||
| 447 | - //开始时间 | ||
| 448 | - $('[name=startDate]', ndf).val(ets); | ||
| 449 | - | ||
| 450 | - //营运2起点 | ||
| 451 | - try { | ||
| 452 | - $('[name=startStation]', nsf).val(searchParallelStation()); | ||
| 453 | - calcFormMileage(nsf, nextSch.xlDir); | ||
| 454 | - } catch (e) { | ||
| 455 | - } | ||
| 456 | - //开始时间 | ||
| 457 | - $('[name=startDate]', nsf).val(ets); | ||
| 458 | - //结束时间 | ||
| 459 | - calcSecondEndDate(); | ||
| 460 | - } | ||
| 461 | - | ||
| 462 | - function calcFirstEndDate() { | ||
| 463 | - var mileage = parseInt($('[name=mileage]', csf).val()); | ||
| 464 | - var et = sch.dfsjT + (mileage / sch.jhlc * sch.bcsj * 60 * 1000); | ||
| 465 | - var ets = et > sch.zdsjT ? sch.zdsj : moment(et).format('HH:mm'); | ||
| 466 | - $('[name=endDate]', csf).val(ets); | ||
| 467 | - return ets; | ||
| 468 | - } | ||
| 469 | - | ||
| 470 | - function calcSecondEndDate() { | ||
| 471 | - var mileage = parseInt($('[name=mileage]', nsf).val()); | ||
| 472 | - var ets = moment($('[name=startDate]', nsf).val(), 'HH:mm') | ||
| 473 | - .add(mileage / nextSch.jhlc * nextSch.bcsj * 60, 'seconds') | ||
| 474 | - .format('HH:mm'); | ||
| 475 | - $('[name=endDate]', nsf).val(ets); | ||
| 476 | - return ets; | ||
| 477 | - } | ||
| 478 | - | ||
| 479 | - //返回另一个走向对应的站点 | ||
| 480 | - function searchParallelStation() { | ||
| 481 | - var routes = stationRoutes[nextSch.xlDir] | ||
| 482 | - , len = routes.length; | ||
| 483 | - | ||
| 484 | - for (var i = 0; i < len; i++) { | ||
| 485 | - if (routes[i].stationName == turnStationName) | ||
| 486 | - return routes[i].stationCode; | ||
| 487 | - } | ||
| 488 | - } | ||
| 489 | - | ||
| 490 | - //计算第二个班次 | ||
| 491 | - function reCalcSecond() { | ||
| 492 | - var code = $(this).val() | ||
| 493 | - , updown = nextSch.xlDir; | ||
| 494 | - | ||
| 495 | - $('[name=endStation]', ndf).val(code); | ||
| 496 | - calcFormMileage(ndf, updown); | ||
| 497 | - | ||
| 498 | - $('[name=startStation]', nsf).val(code); | ||
| 499 | - calcFormMileage(nsf, updown); | ||
| 500 | - //结束时间 | ||
| 501 | - calcSecondEndDate(); | ||
| 502 | - } | ||
| 503 | - | ||
| 504 | - //同步时间 | ||
| 505 | - function synchroDate() { | ||
| 506 | - var date = $(this).val(); | ||
| 507 | - $('[name=startDate]', cdf).val(date); | ||
| 508 | - $('[name=startDate]', ndf).val(date); | ||
| 509 | - $('[name=startDate]', nsf).val(date); | ||
| 510 | - calcSecondEndDate(); | ||
| 511 | - } | ||
| 512 | - | ||
| 513 | - function calcFormMileage(f, updown) { | ||
| 514 | - var s = $('[name=startStation]', f).val() | ||
| 515 | - , e = $('[name=endStation]', f).val(); | ||
| 516 | - | ||
| 517 | - $('[name=mileage]', f).val(calcMileage(s, e, updown)); | ||
| 518 | - } | ||
| 519 | - | ||
| 520 | - function calcMileage(s, e, updown) { | ||
| 521 | - var mileage = 0, flag, code; | ||
| 522 | - if (timeLocStations) { | ||
| 523 | - //空间坐标计算的站距 | ||
| 524 | - $.each(timeLocStations[updown == 0 ? 'up' : 'down'], function () { | ||
| 525 | - code = this.station['STATION_CODE']; | ||
| 526 | - if (flag) | ||
| 527 | - mileage = gb_common.accAdd(mileage, this.toDistanceGl); | ||
| 528 | - if (code == s) | ||
| 529 | - flag = true; | ||
| 530 | - if (code == e) | ||
| 531 | - return false; | ||
| 532 | - }); | ||
| 533 | - } | ||
| 534 | - else { | ||
| 535 | - //从原始站点路由字段里取值 | ||
| 536 | - $.each(stationRoutes[updown], function () { | ||
| 537 | - code = this['stationCode']; | ||
| 538 | - if (flag) | ||
| 539 | - mileage = gb_common.accAdd(mileage, this.distances); | ||
| 540 | - if (code == s) | ||
| 541 | - flag = true; | ||
| 542 | - if (code == e) | ||
| 543 | - return false; | ||
| 544 | - }); | ||
| 545 | - } | ||
| 546 | - return mileage; | ||
| 547 | - } | ||
| 548 | - | ||
| 549 | - //从本地localStorage获取站间距数据 | ||
| 550 | - function getLocStationsSpace() { | ||
| 551 | - try { | ||
| 552 | - timeLocStations = window.localStorage.getItem('control_route_distance_' + sch.xlBm); | ||
| 553 | - if (timeLocStations) | ||
| 554 | - timeLocStations = JSON.parse(timeLocStations).stations; | ||
| 555 | - } catch (e) { | ||
| 556 | - console.log(e); | ||
| 557 | - } | ||
| 558 | - } | ||
| 559 | - | ||
| 560 | - //站间距计算后刷新 | ||
| 561 | - $(modal).on('refresh_station_space', function () { | ||
| 562 | - getLocStationsSpace(); | ||
| 563 | - reClac(); | ||
| 564 | - }); | ||
| 565 | - | ||
| 566 | - //------ 下抽屉 ------ | ||
| 567 | - $('#betweenStationRangeCalc', modal).on('click', function () { | ||
| 568 | - var id = $(this).data('drawer-id'); | ||
| 569 | - switchBtmDrawer(id, '/real_control_v2/fragments/line_schedule/context_menu/sub_task/station_route_spacing_chart.html'); | ||
| 570 | - }); | ||
| 571 | - | ||
| 572 | - var btmDrawer = $('.ct-bottom-drawer', modal); | ||
| 573 | - //打开事件 | ||
| 574 | - btmDrawer.on('drawer_show', function () { | ||
| 575 | - var url = $(this).data('url'); | ||
| 576 | - if (!url) { | ||
| 577 | - alert('无效的地址'); | ||
| 578 | - } | ||
| 579 | - | ||
| 580 | - var drawerPanel = $(this).data('name'); | ||
| 581 | - $('.ct-bottom-drawer-body', btmDrawer).load(url, function () { | ||
| 582 | - $('#' + drawerPanel).trigger('drawer-init', {sch: sch}); | ||
| 583 | - }); | ||
| 584 | - }); | ||
| 585 | - | ||
| 586 | - function switchBtmDrawer(id, url) { | ||
| 587 | - if (btmDrawer.hasClass('open') && btmDrawer.data('name') == id) { | ||
| 588 | - btmDrawer.removeClass('open'); | ||
| 589 | - btmDrawer.removeData('name').removeData('url'); | ||
| 590 | - } | ||
| 591 | - else { | ||
| 592 | - btmDrawer.addClass('open'); | ||
| 593 | - btmDrawer.data('name', id).data('url', url).trigger('drawer_show'); | ||
| 594 | - } | ||
| 595 | - } | ||
| 596 | - | ||
| 597 | - /** | ||
| 598 | - * 选择空驶调头 | ||
| 599 | - */ | ||
| 600 | - $('#emptyTurnCbox', modal).on('click', function () { | ||
| 601 | - if(this.checked){ | ||
| 602 | - //全程烂班 | ||
| 603 | - $('[name=endStation]', ndf).val(nextSch.zdzCode).attr('disabled', 'disabled'); | ||
| 604 | - $('[name=mileage]', ndf).val(nextSch.jhlc).attr('disabled', 'disabled'); | ||
| 605 | - //空驶回起点,营运变空驶 | ||
| 606 | - var $panel = nsf.parents('.uk-panel').removeClass('uk-panel-box-primary') | ||
| 607 | - .addClass('uk-panel-box-secondary'); | ||
| 608 | - $panel.find('.uk-panel-badge').addClass('uk-badge-default').text('空驶'); | ||
| 609 | - $panel.find('.mileage_label').text('空驶里程'); | ||
| 610 | - | ||
| 611 | - $('[name=mileageType]', nsf).val('empty'); | ||
| 612 | - } | ||
| 613 | - else{ | ||
| 614 | - //恢复 | ||
| 615 | - $('[name=endStation]', ndf).removeAttr('disabled'); | ||
| 616 | - $('[name=mileage]', ndf).removeAttr('disabled'); | ||
| 617 | - | ||
| 618 | - //空驶变营运 | ||
| 619 | - var $panel = nsf.parents('.uk-panel').removeClass('uk-panel-box-secondary') | ||
| 620 | - .addClass('uk-panel-box-primary'); | ||
| 621 | - $panel.find('.uk-panel-badge').removeClass('uk-badge-default').text('营运'); | ||
| 622 | - $panel.find('.mileage_label').text('营运里程'); | ||
| 623 | - | ||
| 624 | - reClac(); | ||
| 625 | - } | ||
| 626 | - }); | ||
| 627 | - })(); | ||
| 628 | - </script> | 1 | +<div class="uk-modal ct-form-modal ct_move_modal" id="add-sub-task-range_turn-modal"> |
| 2 | + <div class="uk-modal-dialog" style="width: 1200px;"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>区间调头子任务</h2></div> | ||
| 6 | + | ||
| 7 | + <div style="width: 100%;padding-left: 1%;"> | ||
| 8 | + <form class="uk-form uk-form-horizontal"> | ||
| 9 | + <div class="uk-grid"> | ||
| 10 | + <div class="uk-width-1-4"> | ||
| 11 | + <div class="uk-form-row" style="margin-top: 20px;"> | ||
| 12 | + <label class="uk-form-label">调头站点</label> | ||
| 13 | + <div class="uk-form-controls"> | ||
| 14 | + <select id="turnStationSelect"> | ||
| 15 | + <option value="">请选择...</option> | ||
| 16 | + </select> | ||
| 17 | + </div> | ||
| 18 | + </div> | ||
| 19 | + </div> | ||
| 20 | + <div class="uk-width-1-4"> | ||
| 21 | + <div class="uk-form-row" style="margin-top: 20px;"> | ||
| 22 | + <label class="uk-form-label">调头原因</label> | ||
| 23 | + <div class="uk-form-controls"> | ||
| 24 | + <select id="turnReason" style="width: calc(100% - 9px);"> | ||
| 25 | + <option value="">请选择...</option> | ||
| 26 | + </select> | ||
| 27 | + </div> | ||
| 28 | + </div> | ||
| 29 | + </div> | ||
| 30 | + <div class="uk-width-2-4" style="padding: 20px 0 0 28px;"> | ||
| 31 | + <label> | ||
| 32 | + <input type="checkbox" id="emptyTurnCbox"> 调头后空驶回起点 | ||
| 33 | + </label> | ||
| 34 | + <h6 style="color: #a7a5a5;margin-top: 0;"><i class="uk-icon-question-circle"> </i> | ||
| 35 | + 如果“调头站点”在另一个走向不存在,你需要手动选择第二个营运起点</h6> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + </form> | ||
| 39 | + </div> | ||
| 40 | + <hr class="modal-dotted-hr"> | ||
| 41 | + <div class="uk-grid"> | ||
| 42 | + <div class="uk-width-1-2"> | ||
| 43 | + <div class="main-sch-panel curr"></div> | ||
| 44 | + | ||
| 45 | + <div style="margin-top: 5px;"> | ||
| 46 | + <div class="sub-task-card" style="margin: 0 0 0 7px;"> | ||
| 47 | + <div class="uk-panel uk-panel-box uk-panel-box-primary" style="padding-bottom: 32px;"> | ||
| 48 | + <div class="uk-panel-badge uk-badge">营运</div> | ||
| 49 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 50 | + | ||
| 51 | + <form class="uk-form uk-form-horizontal" curr_service_form> | ||
| 52 | + </form> | ||
| 53 | + </div> | ||
| 54 | + </div> | ||
| 55 | + <div class="sub-task-card " style="margin: 0;"> | ||
| 56 | + <div class="uk-panel uk-panel-box" style="padding-bottom: 32px;"> | ||
| 57 | + <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 58 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 59 | + <form class="uk-form uk-form-horizontal " curr_destroy_form> | ||
| 60 | + </form> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + </div> | ||
| 65 | + <div class="uk-width-1-2"> | ||
| 66 | + <div class="main-sch-panel next"></div> | ||
| 67 | + | ||
| 68 | + <div style="margin: 5px;"> | ||
| 69 | + <div class="sub-task-card " style="margin: 0 0 0 7px;"> | ||
| 70 | + <div class="uk-panel uk-panel-box" style="padding-bottom: 32px;"> | ||
| 71 | + <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 72 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 73 | + <form class="uk-form uk-form-horizontal " next_destroy_form></form> | ||
| 74 | + </div> | ||
| 75 | + </div> | ||
| 76 | + <div class="sub-task-card" style="margin: 0;"> | ||
| 77 | + <div class="uk-panel uk-panel-box uk-panel-box-primary" style="padding-bottom: 32px;"> | ||
| 78 | + <div class="uk-panel-badge uk-badge">营运</div> | ||
| 79 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 80 | + | ||
| 81 | + <form class="uk-form uk-form-horizontal" next_service_form> | ||
| 82 | + </form> | ||
| 83 | + </div> | ||
| 84 | + </div> | ||
| 85 | + </div> | ||
| 86 | + </div> | ||
| 87 | + </div> | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + <div class="uk-modal-footer uk-text-right"> | ||
| 91 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 92 | + <button type="button" class="uk-button uk-button-primary" id="submitChildTaskBtn">提交子任务</button> | ||
| 93 | + | ||
| 94 | + <div class="ct-footer-left"> | ||
| 95 | + <a id="betweenStationRangeCalc" data-drawer-id="station_route_spacing_chart_drawer">站点间公里不准?</a> | ||
| 96 | + </div> | ||
| 97 | + </div> | ||
| 98 | + </div> | ||
| 99 | + <!-- 主任务信息 --> | ||
| 100 | + <script id="range_turn_main_sch-temp" type="text/html"> | ||
| 101 | + <div class="ct_row"> | ||
| 102 | + <div class="ct_cell c_1_3"> | ||
| 103 | + <label>待发</label> | ||
| 104 | + <span>{{dfsj}}</span> | ||
| 105 | + </div> | ||
| 106 | + <div class="ct_cell c_1_3"> | ||
| 107 | + <label>计达</label> | ||
| 108 | + <span>{{zdsj}}</span> | ||
| 109 | + </div> | ||
| 110 | + <div class="ct_cell c_1_3"> | ||
| 111 | + <label>车辆</label> | ||
| 112 | + <span>{{clZbh}}</span> | ||
| 113 | + </div> | ||
| 114 | + </div> | ||
| 115 | + <div class="ct_row"> | ||
| 116 | + <div class="ct_cell c_1_3"> | ||
| 117 | + <label>起点</label> | ||
| 118 | + <span>{{qdzName}}</span> | ||
| 119 | + </div> | ||
| 120 | + <div class="ct_cell c_1_3"> | ||
| 121 | + <label>终点</label> | ||
| 122 | + <span>{{zdzName}}</span> | ||
| 123 | + </div> | ||
| 124 | + <div class="ct_cell c_1_3"> | ||
| 125 | + <label>里程</label> | ||
| 126 | + <span>{{jhlc}}</span> | ||
| 127 | + </div> | ||
| 128 | + </div> | ||
| 129 | + </script> | ||
| 130 | + | ||
| 131 | + <!-- 子任务营运表单 --> | ||
| 132 | + <script id="range_turn_child_service-temp" type="text/html"> | ||
| 133 | + <input type="hidden" name="schedule.id" value="{{sch.id}}"> | ||
| 134 | + <input type="hidden" name="type2" value="1"> | ||
| 135 | + <input type="hidden" value="正常" name="type1"> | ||
| 136 | + <input type="hidden" name="mileageType" value="service"> | ||
| 137 | + <div class="uk-grid"> | ||
| 138 | + <div class="uk-width-3-10"> | ||
| 139 | + <div class="uk-form-row"> | ||
| 140 | + <label class="uk-form-label">起点 </label> | ||
| 141 | + </div> | ||
| 142 | + </div> | ||
| 143 | + <div class="uk-width-7-10 pl5"> | ||
| 144 | + <select name="startStation"> | ||
| 145 | + {{each routes as r i}} | ||
| 146 | + <option value="{{r.stationCode}}">{{r.stationName}}</option> | ||
| 147 | + {{/each}} | ||
| 148 | + </select> | ||
| 149 | + </div> | ||
| 150 | + </div> | ||
| 151 | + <div class="uk-grid"> | ||
| 152 | + <div class="uk-width-3-10"> | ||
| 153 | + <div class="uk-form-row"> | ||
| 154 | + <label class="uk-form-label">终点 </label> | ||
| 155 | + </div> | ||
| 156 | + </div> | ||
| 157 | + <div class="uk-width-7-10 pl5"> | ||
| 158 | + <select name="endStation" class="ct_focus" disabled> | ||
| 159 | + {{each routes as r i}} | ||
| 160 | + <option value="{{r.stationCode}}" {{if r.stationCode==sch.zdzCode}}selected{{/if}}> | ||
| 161 | + {{r.stationName}} | ||
| 162 | + </option> | ||
| 163 | + {{/each}} | ||
| 164 | + </select> | ||
| 165 | + </div> | ||
| 166 | + </div> | ||
| 167 | + <div class="uk-grid"> | ||
| 168 | + <div class="uk-width-3-10"> | ||
| 169 | + <div class="uk-form-row"> | ||
| 170 | + <label class="uk-form-label mileage_label">营运里程</label> | ||
| 171 | + </div> | ||
| 172 | + </div> | ||
| 173 | + <div class="uk-width-7-10 pl5"> | ||
| 174 | + <input type="number" step="0.01" name="mileage" value="{{sch.jhlc}}" required> | ||
| 175 | + </div> | ||
| 176 | + </div> | ||
| 177 | + <div class="uk-grid"> | ||
| 178 | + <div class="uk-width-3-10"> | ||
| 179 | + <div class="uk-form-row"> | ||
| 180 | + <label class="uk-form-label">开始时间</label> | ||
| 181 | + </div> | ||
| 182 | + </div> | ||
| 183 | + <div class="uk-width-7-10 pl5"> | ||
| 184 | + <input type="time" name="startDate" value="{{sch.dfsj}}" required > | ||
| 185 | + </div> | ||
| 186 | + </div> | ||
| 187 | + <div class="uk-grid"> | ||
| 188 | + <div class="uk-width-3-10"> | ||
| 189 | + <div class="uk-form-row"> | ||
| 190 | + <label class="uk-form-label">结束时间</label> | ||
| 191 | + </div> | ||
| 192 | + </div> | ||
| 193 | + <div class="uk-width-7-10 pl5"> | ||
| 194 | + <input type="time" name="endDate" value="{{sch.zdsj}}" > | ||
| 195 | + </div> | ||
| 196 | + </div> | ||
| 197 | + </script> | ||
| 198 | + | ||
| 199 | + <!-- 子任务烂班表单 --> | ||
| 200 | + <script id="range_turn_child_destroy-temp" type="text/html"> | ||
| 201 | + <input type="hidden" name="schedule.id" value="{{sch.id}}"> | ||
| 202 | + <input type="hidden" value="正常" name="type1"> | ||
| 203 | + <input type="hidden" value="1" name="type2"> | ||
| 204 | + <input type="hidden" name="mileageType" value="service"> | ||
| 205 | + <input type="hidden" name="destroy" value="true"> | ||
| 206 | + <div class="uk-grid"> | ||
| 207 | + <div class="uk-width-3-10"> | ||
| 208 | + <div class="uk-form-row"> | ||
| 209 | + <label class="uk-form-label">起点 </label> | ||
| 210 | + </div> | ||
| 211 | + </div> | ||
| 212 | + <div class="uk-width-7-10 pl5"> | ||
| 213 | + <select name="startStation" required disabled> | ||
| 214 | + {{each routes as r i}} | ||
| 215 | + <option value="{{r.stationCode}}">{{r.stationName}}</option> | ||
| 216 | + {{/each}} | ||
| 217 | + </select> | ||
| 218 | + </div> | ||
| 219 | + </div> | ||
| 220 | + <div class="uk-grid"> | ||
| 221 | + <div class="uk-width-3-10"> | ||
| 222 | + <div class="uk-form-row"> | ||
| 223 | + <label class="uk-form-label">终点 </label> | ||
| 224 | + </div> | ||
| 225 | + </div> | ||
| 226 | + <div class="uk-width-7-10 pl5"> | ||
| 227 | + <select name="endStation" required class="ct_focus"> | ||
| 228 | + {{each routes as r i}} | ||
| 229 | + <option value="{{r.stationCode}}" {{if r.stationCode==sch.zdzCode}}selected{{/if}}> | ||
| 230 | + {{r.stationName}} | ||
| 231 | + </option> | ||
| 232 | + {{/each}} | ||
| 233 | + </select> | ||
| 234 | + </div> | ||
| 235 | + </div> | ||
| 236 | + <div class="uk-grid"> | ||
| 237 | + <div class="uk-width-3-10"> | ||
| 238 | + <div class="uk-form-row"> | ||
| 239 | + <label class="uk-form-label">烂班里程</label> | ||
| 240 | + </div> | ||
| 241 | + </div> | ||
| 242 | + <div class="uk-width-7-10 pl5"> | ||
| 243 | + <input type="number" step="0.01" name="mileage" required> | ||
| 244 | + </div> | ||
| 245 | + </div> | ||
| 246 | + <div class="uk-grid"> | ||
| 247 | + <div class="uk-width-3-10"> | ||
| 248 | + <div class="uk-form-row"> | ||
| 249 | + <label class="uk-form-label">开始时间</label> | ||
| 250 | + </div> | ||
| 251 | + </div> | ||
| 252 | + <div class="uk-width-7-10 pl5"> | ||
| 253 | + <input type="time" name="startDate" required disabled> | ||
| 254 | + </div> | ||
| 255 | + </div> | ||
| 256 | + <div class="uk-grid" style="height: 30px;"> | ||
| 257 | + </div> | ||
| 258 | + </script> | ||
| 259 | + | ||
| 260 | + <div class="ct-bottom-drawer"> | ||
| 261 | + <div class="ct-bottom-drawer-body"></div> | ||
| 262 | + </div> | ||
| 263 | + | ||
| 264 | + <script> | ||
| 265 | + (function () { | ||
| 266 | + var modal = '#add-sub-task-range_turn-modal', | ||
| 267 | + sch, nextSch, stationRoutes, information, timeLocStations; | ||
| 268 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 269 | + | ||
| 270 | + var csf = $('form[curr_service_form]', modal); | ||
| 271 | + var nsf = $('form[next_service_form]', modal); | ||
| 272 | + var cdf = $('form[curr_destroy_form]', modal); | ||
| 273 | + var ndf = $('form[next_destroy_form]', modal); | ||
| 274 | + | ||
| 275 | + //掉头站点 | ||
| 276 | + var turnStation, turnStationName; | ||
| 277 | + $(modal).on('init', function (e, data) { | ||
| 278 | + e.stopPropagation(); | ||
| 279 | + sch = data.sch; | ||
| 280 | + nextSch = gb_schedule_table.getNextSch(sch); | ||
| 281 | + | ||
| 282 | + //主任务信息 | ||
| 283 | + $('.main-sch-panel.curr', modal).html(template('range_turn_main_sch-temp', sch)); | ||
| 284 | + $('.main-sch-panel.next', modal).html(template('range_turn_main_sch-temp', nextSch)); | ||
| 285 | + | ||
| 286 | + //站点路由 | ||
| 287 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 288 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 289 | + }), 'directions'); | ||
| 290 | + | ||
| 291 | + var currData = {sch: sch, routes: stationRoutes[sch.xlDir]} | ||
| 292 | + , nextData = {sch: nextSch, routes: stationRoutes[nextSch.xlDir]}; | ||
| 293 | + //营运1 | ||
| 294 | + csf.html(template('range_turn_child_service-temp', currData)); | ||
| 295 | + disabledField(csf, 'startStation'); | ||
| 296 | + //营运结束时间 | ||
| 297 | + $('[name=endDate]', csf).on('input', synchroDate); | ||
| 298 | + | ||
| 299 | + //营运2 | ||
| 300 | + nsf.html(template('range_turn_child_service-temp', nextData)); | ||
| 301 | + disabledField(nsf, 'startDate'); | ||
| 302 | + //烂班1 | ||
| 303 | + cdf.html(template('range_turn_child_destroy-temp', currData)); | ||
| 304 | + disabledField(cdf, 'endStation'); | ||
| 305 | + //烂班2 | ||
| 306 | + ndf.html(template('range_turn_child_destroy-temp', nextData)); | ||
| 307 | + $('[name=startStation]', ndf).val(nextSch.qdzCode); | ||
| 308 | + //烂班2终点改变 | ||
| 309 | + $('[name=endStation]', ndf).on('change', reCalcSecond); | ||
| 310 | + //营运2起点改变 | ||
| 311 | + $('[name=startStation]', nsf).on('change', reCalcSecond); | ||
| 312 | + | ||
| 313 | + //掉头站点 | ||
| 314 | + var opts = ''; | ||
| 315 | + $.each(currData.routes, function () { | ||
| 316 | + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'; | ||
| 317 | + }); | ||
| 318 | + $('#turnStationSelect', modal).append(opts); | ||
| 319 | + opts = ''; | ||
| 320 | + $.each(adjustExps, function () { | ||
| 321 | + opts += '<option value="' + this + '">' + this + '</option>'; | ||
| 322 | + }); | ||
| 323 | + //掉头原因 | ||
| 324 | + $('#turnReason', modal).append(opts); | ||
| 325 | + | ||
| 326 | + //线路标准 | ||
| 327 | + information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 328 | + //本地存储的站点耗时 | ||
| 329 | + getLocStationsSpace(); | ||
| 330 | + | ||
| 331 | + var dataArray = []; | ||
| 332 | + var fs = $('.sub-task-card form', modal).formValidation({ | ||
| 333 | + framework: 'uikit', | ||
| 334 | + locale: 'zh_CN' | ||
| 335 | + }); | ||
| 336 | + fs.on('success.form.fv', function (e) { | ||
| 337 | + e.preventDefault(); | ||
| 338 | + dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this), | ||
| 339 | + {remarks: $('#turnReason', modal).val(), destroyReason: $('#turnReason', modal).val()})); | ||
| 340 | + $(this).data('valid', true); | ||
| 341 | + | ||
| 342 | + if (allValidSuccess()) { | ||
| 343 | + var i = 0; | ||
| 344 | + (function () { | ||
| 345 | + var f = arguments.callee; | ||
| 346 | + if (i >= dataArray.length) { | ||
| 347 | + /** | ||
| 348 | + * 为班次添加备注 | ||
| 349 | + */ | ||
| 350 | + var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $.trim($('#turnReason', modal).val()) + '在' + $('[name=endStation] option:selected', csf).text() + '调头'; | ||
| 351 | + gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g')); | ||
| 352 | + UIkit.modal(modal).hide(); | ||
| 353 | + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | ||
| 354 | + return; | ||
| 355 | + } | ||
| 356 | + var data = dataArray[i]; | ||
| 357 | + //营运子任务不写备注 | ||
| 358 | + if(data.mileageType == 'service' && !data.destroy) | ||
| 359 | + data.remarks = ''; | ||
| 360 | + gb_common.$post('/childTask', data, function (rs) { | ||
| 361 | + notify_succ('子任务添加成功'); | ||
| 362 | + gb_schedule_table.updateSchedule(rs.t); | ||
| 363 | + i++; | ||
| 364 | + f(); | ||
| 365 | + }); | ||
| 366 | + })(); | ||
| 367 | + } | ||
| 368 | + }); | ||
| 369 | + | ||
| 370 | + //校验不过 | ||
| 371 | + fs.on('err.field.fv', function () { | ||
| 372 | + $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled'); | ||
| 373 | + }); | ||
| 374 | + | ||
| 375 | + //submit | ||
| 376 | + $('#submitChildTaskBtn', modal).on('click', function () { | ||
| 377 | + if ($('#turnReason', modal).val() == '') { | ||
| 378 | + return notify_err('你必须选择调头原因!'); | ||
| 379 | + } | ||
| 380 | + | ||
| 381 | + $(this).addClass('disabled').attr('disabled', 'disabled'); | ||
| 382 | + dataArray = []; | ||
| 383 | + fs.data('valid', false); | ||
| 384 | + fs.formValidation('validate'); | ||
| 385 | + }); | ||
| 386 | + | ||
| 387 | + //调头站切换 | ||
| 388 | + $('#turnStationSelect', modal).on('change', function () { | ||
| 389 | + turnStation = $(this).val(); | ||
| 390 | + turnStationName = $('option:selected', this).text(); | ||
| 391 | + reClac(); | ||
| 392 | + }); | ||
| 393 | + }); | ||
| 394 | + | ||
| 395 | + function disabledField(f, itemName) { | ||
| 396 | + $('[name=' + itemName + ']', f).attr('disabled', 'disabled'); | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + function allValidSuccess() { | ||
| 400 | + var flag = true; | ||
| 401 | + $('.sub-task-card form:visible', modal).each(function (i, f) { | ||
| 402 | + if (!$(f).data('valid')) { | ||
| 403 | + flag = false; | ||
| 404 | + return false; | ||
| 405 | + } | ||
| 406 | + }); | ||
| 407 | + return flag; | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + //获取表单disabled 项的值 | ||
| 411 | + function getDisabledVal(f) { | ||
| 412 | + var rs = {}; | ||
| 413 | + $('input,select', f).each(function () { | ||
| 414 | + if ($(this).attr('disabled')) { | ||
| 415 | + rs[$(this).attr('name')] = $(this).val(); | ||
| 416 | + } | ||
| 417 | + }); | ||
| 418 | + return rs; | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + function reClac() { | ||
| 422 | + if (!turnStation || turnStation == '') | ||
| 423 | + return; | ||
| 424 | + | ||
| 425 | + var mileage, et, ets; | ||
| 426 | + | ||
| 427 | + $('#turnStationSelect', modal).val(turnStation); | ||
| 428 | + //营运1终点 | ||
| 429 | + $('[name=endStation]', csf).val(turnStation); | ||
| 430 | + calcFormMileage(csf, sch.xlDir);//里程 | ||
| 431 | + //结束时间 | ||
| 432 | + ets = calcFirstEndDate(); | ||
| 433 | + | ||
| 434 | + //烂班1起点 | ||
| 435 | + $('[name=startStation]', cdf).val(turnStation); | ||
| 436 | + calcFormMileage(cdf, sch.xlDir); | ||
| 437 | + //开始时间 | ||
| 438 | + $('[name=startDate]', cdf).val(ets); | ||
| 439 | + //烂班2终点 | ||
| 440 | + try { | ||
| 441 | + if(!$('#emptyTurnCbox', modal)[0].checked){ | ||
| 442 | + $('[name=endStation]', ndf).val(searchParallelStation()); | ||
| 443 | + calcFormMileage(ndf, nextSch.xlDir); | ||
| 444 | + } | ||
| 445 | + } catch (e) { | ||
| 446 | + } | ||
| 447 | + //开始时间 | ||
| 448 | + $('[name=startDate]', ndf).val(ets); | ||
| 449 | + | ||
| 450 | + //营运2起点 | ||
| 451 | + try { | ||
| 452 | + $('[name=startStation]', nsf).val(searchParallelStation()); | ||
| 453 | + calcFormMileage(nsf, nextSch.xlDir); | ||
| 454 | + } catch (e) { | ||
| 455 | + } | ||
| 456 | + //开始时间 | ||
| 457 | + $('[name=startDate]', nsf).val(ets); | ||
| 458 | + //结束时间 | ||
| 459 | + calcSecondEndDate(); | ||
| 460 | + } | ||
| 461 | + | ||
| 462 | + function calcFirstEndDate() { | ||
| 463 | + var mileage = parseInt($('[name=mileage]', csf).val()); | ||
| 464 | + var et = sch.dfsjT + (mileage / sch.jhlc * sch.bcsj * 60 * 1000); | ||
| 465 | + var ets = et > sch.zdsjT ? sch.zdsj : moment(et).format('HH:mm'); | ||
| 466 | + $('[name=endDate]', csf).val(ets); | ||
| 467 | + return ets; | ||
| 468 | + } | ||
| 469 | + | ||
| 470 | + function calcSecondEndDate() { | ||
| 471 | + var mileage = parseInt($('[name=mileage]', nsf).val()); | ||
| 472 | + var ets = moment($('[name=startDate]', nsf).val(), 'HH:mm') | ||
| 473 | + .add(mileage / nextSch.jhlc * nextSch.bcsj * 60, 'seconds') | ||
| 474 | + .format('HH:mm'); | ||
| 475 | + $('[name=endDate]', nsf).val(ets); | ||
| 476 | + return ets; | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + //返回另一个走向对应的站点 | ||
| 480 | + function searchParallelStation() { | ||
| 481 | + var routes = stationRoutes[nextSch.xlDir] | ||
| 482 | + , len = routes.length; | ||
| 483 | + | ||
| 484 | + for (var i = 0; i < len; i++) { | ||
| 485 | + if (routes[i].stationName == turnStationName) | ||
| 486 | + return routes[i].stationCode; | ||
| 487 | + } | ||
| 488 | + } | ||
| 489 | + | ||
| 490 | + //计算第二个班次 | ||
| 491 | + function reCalcSecond() { | ||
| 492 | + var code = $(this).val() | ||
| 493 | + , updown = nextSch.xlDir; | ||
| 494 | + | ||
| 495 | + $('[name=endStation]', ndf).val(code); | ||
| 496 | + calcFormMileage(ndf, updown); | ||
| 497 | + | ||
| 498 | + $('[name=startStation]', nsf).val(code); | ||
| 499 | + calcFormMileage(nsf, updown); | ||
| 500 | + //结束时间 | ||
| 501 | + calcSecondEndDate(); | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + //同步时间 | ||
| 505 | + function synchroDate() { | ||
| 506 | + var date = $(this).val(); | ||
| 507 | + $('[name=startDate]', cdf).val(date); | ||
| 508 | + $('[name=startDate]', ndf).val(date); | ||
| 509 | + $('[name=startDate]', nsf).val(date); | ||
| 510 | + calcSecondEndDate(); | ||
| 511 | + } | ||
| 512 | + | ||
| 513 | + function calcFormMileage(f, updown) { | ||
| 514 | + var s = $('[name=startStation]', f).val() | ||
| 515 | + , e = $('[name=endStation]', f).val(); | ||
| 516 | + | ||
| 517 | + $('[name=mileage]', f).val(calcMileage(s, e, updown)); | ||
| 518 | + } | ||
| 519 | + | ||
| 520 | + function calcMileage(s, e, updown) { | ||
| 521 | + var mileage = 0, flag, code; | ||
| 522 | + if (timeLocStations) { | ||
| 523 | + //空间坐标计算的站距 | ||
| 524 | + $.each(timeLocStations[updown == 0 ? 'up' : 'down'], function () { | ||
| 525 | + code = this.station['STATION_CODE']; | ||
| 526 | + if (flag) | ||
| 527 | + mileage = gb_common.accAdd(mileage, this.toDistanceGl); | ||
| 528 | + if (code == s) | ||
| 529 | + flag = true; | ||
| 530 | + if (code == e) | ||
| 531 | + return false; | ||
| 532 | + }); | ||
| 533 | + } | ||
| 534 | + else { | ||
| 535 | + //从原始站点路由字段里取值 | ||
| 536 | + $.each(stationRoutes[updown], function () { | ||
| 537 | + code = this['stationCode']; | ||
| 538 | + if (flag) | ||
| 539 | + mileage = gb_common.accAdd(mileage, this.distances); | ||
| 540 | + if (code == s) | ||
| 541 | + flag = true; | ||
| 542 | + if (code == e) | ||
| 543 | + return false; | ||
| 544 | + }); | ||
| 545 | + } | ||
| 546 | + return mileage; | ||
| 547 | + } | ||
| 548 | + | ||
| 549 | + //从本地localStorage获取站间距数据 | ||
| 550 | + function getLocStationsSpace() { | ||
| 551 | + try { | ||
| 552 | + timeLocStations = window.localStorage.getItem('control_route_distance_' + sch.xlBm); | ||
| 553 | + if (timeLocStations) | ||
| 554 | + timeLocStations = JSON.parse(timeLocStations).stations; | ||
| 555 | + } catch (e) { | ||
| 556 | + console.log(e); | ||
| 557 | + } | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + //站间距计算后刷新 | ||
| 561 | + $(modal).on('refresh_station_space', function () { | ||
| 562 | + getLocStationsSpace(); | ||
| 563 | + reClac(); | ||
| 564 | + }); | ||
| 565 | + | ||
| 566 | + //------ 下抽屉 ------ | ||
| 567 | + $('#betweenStationRangeCalc', modal).on('click', function () { | ||
| 568 | + var id = $(this).data('drawer-id'); | ||
| 569 | + switchBtmDrawer(id, '/real_control_v2/fragments/line_schedule/context_menu/sub_task/station_route_spacing_chart.html'); | ||
| 570 | + }); | ||
| 571 | + | ||
| 572 | + var btmDrawer = $('.ct-bottom-drawer', modal); | ||
| 573 | + //打开事件 | ||
| 574 | + btmDrawer.on('drawer_show', function () { | ||
| 575 | + var url = $(this).data('url'); | ||
| 576 | + if (!url) { | ||
| 577 | + alert('无效的地址'); | ||
| 578 | + } | ||
| 579 | + | ||
| 580 | + var drawerPanel = $(this).data('name'); | ||
| 581 | + $('.ct-bottom-drawer-body', btmDrawer).load(url, function () { | ||
| 582 | + $('#' + drawerPanel).trigger('drawer-init', {sch: sch}); | ||
| 583 | + }); | ||
| 584 | + }); | ||
| 585 | + | ||
| 586 | + function switchBtmDrawer(id, url) { | ||
| 587 | + if (btmDrawer.hasClass('open') && btmDrawer.data('name') == id) { | ||
| 588 | + btmDrawer.removeClass('open'); | ||
| 589 | + btmDrawer.removeData('name').removeData('url'); | ||
| 590 | + } | ||
| 591 | + else { | ||
| 592 | + btmDrawer.addClass('open'); | ||
| 593 | + btmDrawer.data('name', id).data('url', url).trigger('drawer_show'); | ||
| 594 | + } | ||
| 595 | + } | ||
| 596 | + | ||
| 597 | + /** | ||
| 598 | + * 选择空驶调头 | ||
| 599 | + */ | ||
| 600 | + $('#emptyTurnCbox', modal).on('click', function () { | ||
| 601 | + if(this.checked){ | ||
| 602 | + //全程烂班 | ||
| 603 | + $('[name=endStation]', ndf).val(nextSch.zdzCode).attr('disabled', 'disabled'); | ||
| 604 | + $('[name=mileage]', ndf).val(nextSch.jhlc).attr('disabled', 'disabled'); | ||
| 605 | + //空驶回起点,营运变空驶 | ||
| 606 | + var $panel = nsf.parents('.uk-panel').removeClass('uk-panel-box-primary') | ||
| 607 | + .addClass('uk-panel-box-secondary'); | ||
| 608 | + $panel.find('.uk-panel-badge').addClass('uk-badge-default').text('空驶'); | ||
| 609 | + $panel.find('.mileage_label').text('空驶里程'); | ||
| 610 | + | ||
| 611 | + $('[name=mileageType]', nsf).val('empty'); | ||
| 612 | + } | ||
| 613 | + else{ | ||
| 614 | + //恢复 | ||
| 615 | + $('[name=endStation]', ndf).removeAttr('disabled'); | ||
| 616 | + $('[name=mileage]', ndf).removeAttr('disabled'); | ||
| 617 | + | ||
| 618 | + //空驶变营运 | ||
| 619 | + var $panel = nsf.parents('.uk-panel').removeClass('uk-panel-box-secondary') | ||
| 620 | + .addClass('uk-panel-box-primary'); | ||
| 621 | + $panel.find('.uk-panel-badge').removeClass('uk-badge-default').text('营运'); | ||
| 622 | + $panel.find('.mileage_label').text('营运里程'); | ||
| 623 | + | ||
| 624 | + reClac(); | ||
| 625 | + } | ||
| 626 | + }); | ||
| 627 | + })(); | ||
| 628 | + </script> | ||
| 629 | </div> | 629 | </div> |
| 630 | \ No newline at end of file | 630 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch/editor.html
| 1 | -<div class="uk-modal ct-form-modal ct_move_modal" id="history-sch-edit-modal"> | ||
| 2 | - <div class="uk-modal-dialog" style="width: 900px;"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>历史路单编辑</h2></div> | ||
| 6 | - <form class="uk-form uk-form-horizontal sch_form"> | ||
| 7 | - </form> | ||
| 8 | - | ||
| 9 | - <div class="uk-panel uk-panel-box uk-panel-box-secondary" style="padding-bottom: 0;"> | ||
| 10 | - <h3 class="uk-panel-title" id="childTaskTitle"> | ||
| 11 | - 子任务列表 | ||
| 12 | - <a id="addChildTaskBtn" data-uk-tooltip title="添加子任务"><i | ||
| 13 | - class="uk-icon-plus"></i> </a> | ||
| 14 | - </h3> | ||
| 15 | - <div class="ct_table_wrap ct_table_no_border sub_task_table_wrap" style="height: 142px;"> | ||
| 16 | - <div class="ct_table sub-task-table"> | ||
| 17 | - <div class="ct_table_head"> | ||
| 18 | - <dl> | ||
| 19 | - <dt>序号</dt> | ||
| 20 | - <dt>类型</dt> | ||
| 21 | - <dt>起点</dt> | ||
| 22 | - <dt>终点</dt> | ||
| 23 | - <dt>开始时间</dt> | ||
| 24 | - <dt>结束时间</dt> | ||
| 25 | - <dt>里程</dt> | ||
| 26 | - <dt>备注</dt> | ||
| 27 | - </dl> | ||
| 28 | - </div> | ||
| 29 | - <div class="ct_table_body"> | ||
| 30 | - </div> | ||
| 31 | - </div> | ||
| 32 | - </div> | ||
| 33 | - </div> | ||
| 34 | - </div> | ||
| 35 | - | ||
| 36 | - <script id="history-sch-edit-form-temp" type="text/html"> | ||
| 37 | - <input type="hidden" name="id" value="{{sch.id}}"/> | ||
| 38 | - | ||
| 39 | - <div class="uk-grid"> | ||
| 40 | - <div class="uk-width-1-3"> | ||
| 41 | - <div class="uk-form-row"> | ||
| 42 | - <label class="uk-form-label" >班次类型</label> | ||
| 43 | - <div class="uk-form-controls"> | ||
| 44 | - <select class="form-control nt-dictionary" data-code="{{sch.bcType}}" name="bcType" data-group=ScheduleType></select> | ||
| 45 | - </div> | ||
| 46 | - </div> | ||
| 47 | - </div> | ||
| 48 | - <div class="uk-width-1-3"> | ||
| 49 | - <div class="uk-form-row"> | ||
| 50 | - <label class="uk-form-label" >起点</label> | ||
| 51 | - <div class="uk-form-controls"> | ||
| 52 | - <select type="text" name="qdzCode" ></select> | ||
| 53 | - </div> | ||
| 54 | - </div> | ||
| 55 | - </div> | ||
| 56 | - <div class="uk-width-1-3"> | ||
| 57 | - <div class="uk-form-row"> | ||
| 58 | - <label class="uk-form-label" >终点</label> | ||
| 59 | - <div class="uk-form-controls"> | ||
| 60 | - <select type="text" name="zdzCode" ></select> | ||
| 61 | - </div> | ||
| 62 | - </div> | ||
| 63 | - </div> | ||
| 64 | - </div> | ||
| 65 | - | ||
| 66 | - <div class="uk-grid"> | ||
| 67 | - <div class="uk-width-1-3"> | ||
| 68 | - <div class="uk-form-row"> | ||
| 69 | - <label class="uk-form-label" >车辆</label> | ||
| 70 | - <div class="uk-form-controls"> | ||
| 71 | - <div class="uk-autocomplete uk-form car-autocom"> | ||
| 72 | - <input type="text" value="{{sch.clZbh}}" name="clZbh" required> | ||
| 73 | - </div> | ||
| 74 | - </div> | ||
| 75 | - </div> | ||
| 76 | - </div> | ||
| 77 | - <div class="uk-width-1-3"> | ||
| 78 | - <div class="uk-form-row"> | ||
| 79 | - <label class="uk-form-label" >驾驶员</label> | ||
| 80 | - <div class="uk-form-controls"> | ||
| 81 | - <div class="uk-autocomplete uk-form jsy-autocom"> | ||
| 82 | - <input type="text" value="{{sch.jGh}}/{{sch.jName}}" name="jsy" required> | ||
| 83 | - </div> | ||
| 84 | - </div> | ||
| 85 | - </div> | ||
| 86 | - </div> | ||
| 87 | - <div class="uk-width-1-3"> | ||
| 88 | - <div class="uk-form-row"> | ||
| 89 | - <label class="uk-form-label" >售票员</label> | ||
| 90 | - <div class="uk-form-controls"> | ||
| 91 | - <div class="uk-autocomplete uk-form spy-autocom"> | ||
| 92 | - <input type="text" name="spy" value="{{sch.sGh}}/{{sch.sName}}" name="spy"> | ||
| 93 | - </div> | ||
| 94 | - </div> | ||
| 95 | - </div> | ||
| 96 | - </div> | ||
| 97 | - </div> | ||
| 98 | - | ||
| 99 | - <div class="uk-grid"> | ||
| 100 | - <div class="uk-width-1-3"> | ||
| 101 | - <div class="uk-form-row"> | ||
| 102 | - <label class="uk-form-label" >计发</label> | ||
| 103 | - <div class="uk-form-controls"> | ||
| 104 | - <input type="time" value="{{sch.fcsj}}" disabled> | ||
| 105 | - </div> | ||
| 106 | - </div> | ||
| 107 | - </div> | ||
| 108 | - <div class="uk-width-1-3"> | ||
| 109 | - <div class="uk-form-row"> | ||
| 110 | - <label class="uk-form-label" >待发</label> | ||
| 111 | - <div class="uk-form-controls"> | ||
| 112 | - <input type="time" name="dfsj" value="{{sch.dfsj}}" required> | ||
| 113 | - </div> | ||
| 114 | - </div> | ||
| 115 | - </div> | ||
| 116 | - <div class="uk-width-1-3"> | ||
| 117 | - <div class="uk-form-row"> | ||
| 118 | - <label class="uk-form-label" >实发</label> | ||
| 119 | - <div class="uk-form-controls"> | ||
| 120 | - <input type="time" name="fcsjActual" value="{{sch.fcsjActual}}" > | ||
| 121 | - </div> | ||
| 122 | - </div> | ||
| 123 | - </div> | ||
| 124 | - </div> | ||
| 125 | - | ||
| 126 | - <div class="uk-grid"> | ||
| 127 | - <div class="uk-width-1-3"> | ||
| 128 | - <div class="uk-form-row"> | ||
| 129 | - <label class="uk-form-label" >里程</label> | ||
| 130 | - <div class="uk-form-controls"> | ||
| 131 | - <input type="text" name="jhlc" value="{{sch.jhlc}}" max=222 data-fv-lessthan-inclusive="false" | ||
| 132 | - required> | ||
| 133 | - </div> | ||
| 134 | - </div> | ||
| 135 | - </div> | ||
| 136 | - <div class="uk-width-1-3"> | ||
| 137 | - <div class="uk-form-row"> | ||
| 138 | - <label class="uk-form-label" >计达</label> | ||
| 139 | - <div class="uk-form-controls"> | ||
| 140 | - <input type="time" value="{{sch.zdsj}}" disabled> | ||
| 141 | - </div> | ||
| 142 | - </div> | ||
| 143 | - </div> | ||
| 144 | - <div class="uk-width-1-3"> | ||
| 145 | - <div class="uk-form-row"> | ||
| 146 | - <label class="uk-form-label" >实达</label> | ||
| 147 | - <div class="uk-form-controls"> | ||
| 148 | - <input type="time" name="zdsjActual" value="{{sch.zdsjActual}}" > | ||
| 149 | - </div> | ||
| 150 | - </div> | ||
| 151 | - </div> | ||
| 152 | - </div> | ||
| 153 | - <div class="uk-grid"> | ||
| 154 | - <div class="uk-width-1-3"> | ||
| 155 | - <div class="uk-form-row"> | ||
| 156 | - <label class="uk-form-label" ></label> | ||
| 157 | - <label> | ||
| 158 | - <input class="i-cbox destroy-box" type="checkbox" name="status" value="-1" {{if sch.status==-1}}checked{{/if}}> | ||
| 159 | - 是否烂班 | ||
| 160 | - </label> | ||
| 161 | - </div> | ||
| 162 | - | ||
| 163 | - <div class="uk-form-row adjust_exps_select_wrap {{if sch.status!=-1}}display_hide{{/if}}" > | ||
| 164 | - <label class="uk-form-label" >烂班原因</label> | ||
| 165 | - <div class="uk-form-controls"> | ||
| 166 | - <select name="adjustExps"> | ||
| 167 | - {{each adjustExps as exp i}} | ||
| 168 | - <option value="{{exp}}" {{if sch.adjustExps==exp}}selected{{/if}}>{{exp}}</option> | ||
| 169 | - {{/each}} | ||
| 170 | - </select> | ||
| 171 | - </div> | ||
| 172 | - </div> | ||
| 173 | - </div> | ||
| 174 | - | ||
| 175 | - <div class="uk-width-2-3"> | ||
| 176 | - <div class="uk-form-row ct-stacked"> | ||
| 177 | - <label class="uk-form-label" >备注</label> | ||
| 178 | - <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 179 | - <textarea id="form-s-t" cols="20" rows="3" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="100" placeholder="备注">{{sch.remarks}}</textarea> | ||
| 180 | - </div> | ||
| 181 | - </div> | ||
| 182 | - </div> | ||
| 183 | - </div> | ||
| 184 | - <div class="uk-modal-footer uk-text-right" style="margin-bottom: 20px;"> | ||
| 185 | - <div class="uk-button-dropdown" data-uk-dropdown> | ||
| 186 | - <a class="uk-button uk-button-success"><i class="uk-icon-pencil-square-o"></i> 添加子任务 <i class="uk-icon-caret-down"></i></a> | ||
| 187 | - <div class="uk-dropdown" style="text-align: left;"> | ||
| 188 | - <ul class="uk-nav uk-nav-dropdown child_task_list"> | ||
| 189 | - <!--<li data-method="add_oil"><a>空驶进出场</a></li> | ||
| 190 | - <li data-method="in_park"><a>进场</a></li> | ||
| 191 | - <li data-method="out_park"><a>出场</a></li>--> | ||
| 192 | - <li data-method="other"><a>自定义</a></li> | ||
| 193 | - </ul> | ||
| 194 | - </div> | ||
| 195 | - </div> | ||
| 196 | - | ||
| 197 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存主任务信息</button> | ||
| 198 | - </div> | ||
| 199 | - </script> | ||
| 200 | - | ||
| 201 | - <script id="h-sub_task-table-temp" type="text/html"> | ||
| 202 | - {{each list as task i}} | ||
| 203 | - <dl data-id="{{task.id}}"> | ||
| 204 | - <dd>{{i+1}}</dd> | ||
| 205 | - <dd><span class="nt-dictionary" data-group="ChildTaskType">{{task.type2}}</span></dd> | ||
| 206 | - <dd>{{task.startStationName}}</dd> | ||
| 207 | - <dd>{{task.endStationName}}</dd> | ||
| 208 | - <dd>{{task.startDate}}</dd> | ||
| 209 | - <dd>{{task.endDate}}</dd> | ||
| 210 | - <dd> | ||
| 211 | - {{task.mileage}} | ||
| 212 | - (<span class="nt-dictionary" data-group="MileageType">{{task.mileageType}}</span> | ||
| 213 | - {{if task.destroy}} | ||
| 214 | - <small style="color:red;">烂班</small> | ||
| 215 | - {{/if}} | ||
| 216 | - ) | ||
| 217 | - </dd> | ||
| 218 | - <dd title="{{task.remarks}}">{{task.remarks}}</dd> | ||
| 219 | - </dl> | ||
| 220 | - {{/each}} | ||
| 221 | - </script> | ||
| 222 | - | ||
| 223 | - <script> | ||
| 224 | - (function() { | ||
| 225 | - var modal = '#history-sch-edit-modal' | ||
| 226 | - ,gb_sch,parentModal; | ||
| 227 | - var stationRoutes, parks, information; | ||
| 228 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 229 | - $(modal).on('init', function(e, data) { | ||
| 230 | - e.stopPropagation(); | ||
| 231 | - var id = data.id; | ||
| 232 | - parentModal=data.parentModal; | ||
| 233 | - | ||
| 234 | - $.get('/realSchedule/'+id, function (sch) { | ||
| 235 | - gb_sch = sch; | ||
| 236 | - | ||
| 237 | - var htmlStr = template('history-sch-edit-form-temp', {sch: sch, adjustExps: adjustExps}); | ||
| 238 | - $('form.sch_form', modal).html(htmlStr); | ||
| 239 | - //子任务列表 | ||
| 240 | - sch.cTasks.sort(sub_task_sort); | ||
| 241 | - htmlStr = template('h-sub_task-table-temp', {list: sch.cTasks}); | ||
| 242 | - $('.sub-task-table .ct_table_body', modal).html(htmlStr); | ||
| 243 | - | ||
| 244 | - //字典转换 | ||
| 245 | - dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 246 | - //渲染表格,自动补全和下拉框等 | ||
| 247 | - renderForm(); | ||
| 248 | - | ||
| 249 | - //submit | ||
| 250 | - var f = $('form.sch_form', modal).formValidation(gb_form_validation_opts); | ||
| 251 | - //是否烂班 | ||
| 252 | - $('[name=status]', f).on('click', function () { | ||
| 253 | - if(this.checked){ | ||
| 254 | - $('[name=jhlc]', f).val(0); | ||
| 255 | - $('.adjust_exps_select_wrap', f).show(); | ||
| 256 | - } | ||
| 257 | - else{ | ||
| 258 | - $('[name=jhlc]', f).val(gb_sch.jhlcOrig); | ||
| 259 | - $('.adjust_exps_select_wrap', f).hide(); | ||
| 260 | - } | ||
| 261 | - }); | ||
| 262 | - f.on('success.form.fv', function(e) { | ||
| 263 | - e.preventDefault(); | ||
| 264 | - var data = $(this).serializeJSON(); | ||
| 265 | - | ||
| 266 | - //拆分驾驶员工号和姓名 | ||
| 267 | - data.jGh = data.jsy.split('/')[0]; | ||
| 268 | - data.jName = data.jsy.split('/')[1]; | ||
| 269 | - delete data.jsy; | ||
| 270 | - //拆分售票员工号和姓名 | ||
| 271 | - if(data.spy != null){ | ||
| 272 | - data.sGh = data.spy.split('/')[0]; | ||
| 273 | - data.sName = data.spy.split('/')[1]; | ||
| 274 | - delete data.spy; | ||
| 275 | - } | ||
| 276 | - | ||
| 277 | - gb_common.$post('/realSchedule/history', data, function (rs) { | ||
| 278 | - //console.log(rs); | ||
| 279 | - UIkit.modal(modal).hide(); | ||
| 280 | - $(parentModal).trigger('refresh'); | ||
| 281 | - }); | ||
| 282 | - }); | ||
| 283 | - }); | ||
| 284 | - }); | ||
| 285 | - | ||
| 286 | - /** | ||
| 287 | - * 添加子任务 | ||
| 288 | - */ | ||
| 289 | - $(modal).on('click','.child_task_list>li', function () { | ||
| 290 | - var method = $(this).data('method'); | ||
| 291 | - addChildTaskObj[method](); | ||
| 292 | - }); | ||
| 293 | - var modal_opts = {center: false, bgclose: false, modal: false} | ||
| 294 | - ,folder = '/real_control_v2/fragments/north/nav/history_sch'; | ||
| 295 | - var addChildTaskObj = { | ||
| 296 | - add_oil: function () { | ||
| 297 | - open_modal(folder + '/h_add_sub_task_oil.html', { | ||
| 298 | - sch: gb_sch | ||
| 299 | - }, modal_opts); | ||
| 300 | - }, | ||
| 301 | - in_park: function () { | ||
| 302 | - open_modal(folder + '/h_add_sub_task_inpark.html', { | ||
| 303 | - sch: gb_sch | ||
| 304 | - }, modal_opts); | ||
| 305 | - }, | ||
| 306 | - out_park: function () { | ||
| 307 | - open_modal(folder + '/h_add_sub_task_outpark.html', { | ||
| 308 | - sch: gb_sch | ||
| 309 | - }, modal_opts); | ||
| 310 | - }, | ||
| 311 | - other: function () { | ||
| 312 | - open_modal(folder + '/h_add_sub_task_other.html', { | ||
| 313 | - sch: gb_sch | ||
| 314 | - }, modal_opts); | ||
| 315 | - } | ||
| 316 | - }; | ||
| 317 | - | ||
| 318 | - $('#addChildTaskBtn', modal).on('click', addChildTaskObj.other); | ||
| 319 | - | ||
| 320 | - | ||
| 321 | - var callbackHandler = { | ||
| 322 | - remove_sub_task: function () { | ||
| 323 | - var activeDl = $('.sub-task-table .ct_table_body', modal).find('dl.context-menu-active'); | ||
| 324 | - if (activeDl.length == 0) | ||
| 325 | - return; | ||
| 326 | - var dds = activeDl.find('dd'); | ||
| 327 | - var id = activeDl.data('id') | ||
| 328 | - , str = '<h3>确定要删除子任务<span style="color:red;margin: 0 5px;">' + $(dds[4]).text() + ',' + $(dds[6]).text() + ' </span>?</h3>'; | ||
| 329 | - alt_confirm(str, function () { | ||
| 330 | - gb_common.$del('/childTask/history/' + id, function (rs) { | ||
| 331 | - notify_succ('删除子任务成功!'); | ||
| 332 | - //刷新界面数据 | ||
| 333 | - $(modal).trigger('init', {id: gb_sch.id}); | ||
| 334 | - }); | ||
| 335 | - }, '确定删除'); | ||
| 336 | - } | ||
| 337 | - }; | ||
| 338 | - //右键菜单 | ||
| 339 | - $.contextMenu({ | ||
| 340 | - selector: modal + ' .sub-task-table .ct_table_body dl', | ||
| 341 | - className: 'schedule-ct-menu', | ||
| 342 | - callback: function (key, options) { | ||
| 343 | - callbackHandler[key] && callbackHandler[key](); | ||
| 344 | - }, | ||
| 345 | - items: { | ||
| 346 | - "remove_sub_task": { | ||
| 347 | - name: "删除子任务" | ||
| 348 | - , icon: "delete" | ||
| 349 | - } | ||
| 350 | - } | ||
| 351 | - }); | ||
| 352 | - | ||
| 353 | - function renderForm() { | ||
| 354 | - //站点路由 | ||
| 355 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(gb_sch.xlBm).sort(function (a, b) { | ||
| 356 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 357 | - }), 'directions'); | ||
| 358 | - //停车场 | ||
| 359 | - parks = gb_data_basic.simpleParksArray(); | ||
| 360 | - //线路标准 | ||
| 361 | - information = gb_data_basic.getLineInformation(gb_sch.xlBm); | ||
| 362 | - | ||
| 363 | - //----------- Autocomplete -------------- | ||
| 364 | - //车辆 | ||
| 365 | - gb_common.carAutocomplete($('.car-autocom', modal), gb_data_basic.carsArray()); | ||
| 366 | - //驾驶员 | ||
| 367 | - gb_common.personAutocomplete($('.jsy-autocom', modal)); | ||
| 368 | - //售票员 | ||
| 369 | - gb_common.personAutocomplete($('.spy-autocom', modal)); | ||
| 370 | - | ||
| 371 | - //班次类型切换 | ||
| 372 | - var f = $('form.sch_form', modal); | ||
| 373 | - initScheduleTypeChange(f); | ||
| 374 | - $('[name=bcType]', f).trigger('change'); | ||
| 375 | - } | ||
| 376 | - | ||
| 377 | - | ||
| 378 | - function initScheduleTypeChange(f, cb) { | ||
| 379 | - (function (f, cb) { | ||
| 380 | - $('[name=bcType]', f).on('change', function () { | ||
| 381 | - var bcType_e = $('[name=bcType]', f) | ||
| 382 | - , updown = gb_sch.xlDir; | ||
| 383 | - | ||
| 384 | - var routes = stationRoutes[updown] | ||
| 385 | - , lastCode = routes[routes.length - 1].stationCode | ||
| 386 | - , opts = '', park_opts = ''; | ||
| 387 | - //station options | ||
| 388 | - $.each(routes, function () { | ||
| 389 | - opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 390 | - }); | ||
| 391 | - //park options | ||
| 392 | - for (var code in parks) | ||
| 393 | - park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 394 | - | ||
| 395 | - var qdz = $('[name=qdzCode]', f), zdz = $('[name=zdzCode]', f); | ||
| 396 | - var time, mileage; | ||
| 397 | - switch (bcType_e.val()) { | ||
| 398 | - case 'out': | ||
| 399 | - qdz.html(park_opts).val(information.carPark); | ||
| 400 | - zdz.html(opts); | ||
| 401 | - //出场结束时间 | ||
| 402 | - time = updown == 0 ? information.upOutTimer : information.downOutTimer; | ||
| 403 | - mileage = updown == 0 ? information.upOutMileage : information.downOutMileage; | ||
| 404 | - break; | ||
| 405 | - case 'in': | ||
| 406 | - qdz.html(opts); | ||
| 407 | - zdz.html(park_opts).val(information.carPark); | ||
| 408 | - //进场结束时间 | ||
| 409 | - time = updown == 0 ? information.upInTimer : information.downInTimer; | ||
| 410 | - mileage = updown == 0 ? information.upInMileage : information.downInMileage; | ||
| 411 | - break; | ||
| 412 | - default: | ||
| 413 | - qdz.html(opts); | ||
| 414 | - zdz.html(opts).val(lastCode); | ||
| 415 | - time = updown == 0?information.upTravelTime:information.downTravelTime; | ||
| 416 | - mileage = updown == 0?information.upMileage:information.downMileage; | ||
| 417 | - } | ||
| 418 | - | ||
| 419 | - cb && cb(); | ||
| 420 | - }).trigger('change'); | ||
| 421 | - })(f, cb); | ||
| 422 | - } | ||
| 423 | - | ||
| 424 | - function sub_task_sort(a, b) { | ||
| 425 | - return a.id - b.id; | ||
| 426 | - } | ||
| 427 | - })(); | ||
| 428 | - </script> | ||
| 429 | -</div> | 1 | +<div class="uk-modal ct-form-modal ct_move_modal" id="history-sch-edit-modal"> |
| 2 | + <div class="uk-modal-dialog" style="width: 900px;"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>历史路单编辑</h2></div> | ||
| 6 | + <form class="uk-form uk-form-horizontal sch_form"> | ||
| 7 | + </form> | ||
| 8 | + | ||
| 9 | + <div class="uk-panel uk-panel-box uk-panel-box-secondary" style="padding-bottom: 0;"> | ||
| 10 | + <h3 class="uk-panel-title" id="childTaskTitle"> | ||
| 11 | + 子任务列表 | ||
| 12 | + <a id="addChildTaskBtn" data-uk-tooltip title="添加子任务"><i | ||
| 13 | + class="uk-icon-plus"></i> </a> | ||
| 14 | + </h3> | ||
| 15 | + <div class="ct_table_wrap ct_table_no_border sub_task_table_wrap" style="height: 142px;"> | ||
| 16 | + <div class="ct_table sub-task-table"> | ||
| 17 | + <div class="ct_table_head"> | ||
| 18 | + <dl> | ||
| 19 | + <dt>序号</dt> | ||
| 20 | + <dt>类型</dt> | ||
| 21 | + <dt>起点</dt> | ||
| 22 | + <dt>终点</dt> | ||
| 23 | + <dt>开始时间</dt> | ||
| 24 | + <dt>结束时间</dt> | ||
| 25 | + <dt>里程</dt> | ||
| 26 | + <dt>备注</dt> | ||
| 27 | + </dl> | ||
| 28 | + </div> | ||
| 29 | + <div class="ct_table_body"> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + </div> | ||
| 33 | + </div> | ||
| 34 | + </div> | ||
| 35 | + | ||
| 36 | + <script id="history-sch-edit-form-temp" type="text/html"> | ||
| 37 | + <input type="hidden" name="id" value="{{sch.id}}"/> | ||
| 38 | + | ||
| 39 | + <div class="uk-grid"> | ||
| 40 | + <div class="uk-width-1-3"> | ||
| 41 | + <div class="uk-form-row"> | ||
| 42 | + <label class="uk-form-label" >班次类型</label> | ||
| 43 | + <div class="uk-form-controls"> | ||
| 44 | + <select class="form-control nt-dictionary" data-code="{{sch.bcType}}" name="bcType" data-group=ScheduleType></select> | ||
| 45 | + </div> | ||
| 46 | + </div> | ||
| 47 | + </div> | ||
| 48 | + <div class="uk-width-1-3"> | ||
| 49 | + <div class="uk-form-row"> | ||
| 50 | + <label class="uk-form-label" >起点</label> | ||
| 51 | + <div class="uk-form-controls"> | ||
| 52 | + <select type="text" name="qdzCode" ></select> | ||
| 53 | + </div> | ||
| 54 | + </div> | ||
| 55 | + </div> | ||
| 56 | + <div class="uk-width-1-3"> | ||
| 57 | + <div class="uk-form-row"> | ||
| 58 | + <label class="uk-form-label" >终点</label> | ||
| 59 | + <div class="uk-form-controls"> | ||
| 60 | + <select type="text" name="zdzCode" ></select> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + </div> | ||
| 65 | + | ||
| 66 | + <div class="uk-grid"> | ||
| 67 | + <div class="uk-width-1-3"> | ||
| 68 | + <div class="uk-form-row"> | ||
| 69 | + <label class="uk-form-label" >车辆</label> | ||
| 70 | + <div class="uk-form-controls"> | ||
| 71 | + <div class="uk-autocomplete uk-form car-autocom"> | ||
| 72 | + <input type="text" value="{{sch.clZbh}}" name="clZbh" required> | ||
| 73 | + </div> | ||
| 74 | + </div> | ||
| 75 | + </div> | ||
| 76 | + </div> | ||
| 77 | + <div class="uk-width-1-3"> | ||
| 78 | + <div class="uk-form-row"> | ||
| 79 | + <label class="uk-form-label" >驾驶员</label> | ||
| 80 | + <div class="uk-form-controls"> | ||
| 81 | + <div class="uk-autocomplete uk-form jsy-autocom"> | ||
| 82 | + <input type="text" value="{{sch.jGh}}/{{sch.jName}}" name="jsy" required> | ||
| 83 | + </div> | ||
| 84 | + </div> | ||
| 85 | + </div> | ||
| 86 | + </div> | ||
| 87 | + <div class="uk-width-1-3"> | ||
| 88 | + <div class="uk-form-row"> | ||
| 89 | + <label class="uk-form-label" >售票员</label> | ||
| 90 | + <div class="uk-form-controls"> | ||
| 91 | + <div class="uk-autocomplete uk-form spy-autocom"> | ||
| 92 | + <input type="text" name="spy" value="{{sch.sGh}}/{{sch.sName}}" name="spy"> | ||
| 93 | + </div> | ||
| 94 | + </div> | ||
| 95 | + </div> | ||
| 96 | + </div> | ||
| 97 | + </div> | ||
| 98 | + | ||
| 99 | + <div class="uk-grid"> | ||
| 100 | + <div class="uk-width-1-3"> | ||
| 101 | + <div class="uk-form-row"> | ||
| 102 | + <label class="uk-form-label" >计发</label> | ||
| 103 | + <div class="uk-form-controls"> | ||
| 104 | + <input type="time" value="{{sch.fcsj}}" disabled> | ||
| 105 | + </div> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + <div class="uk-width-1-3"> | ||
| 109 | + <div class="uk-form-row"> | ||
| 110 | + <label class="uk-form-label" >待发</label> | ||
| 111 | + <div class="uk-form-controls"> | ||
| 112 | + <input type="time" name="dfsj" value="{{sch.dfsj}}" required> | ||
| 113 | + </div> | ||
| 114 | + </div> | ||
| 115 | + </div> | ||
| 116 | + <div class="uk-width-1-3"> | ||
| 117 | + <div class="uk-form-row"> | ||
| 118 | + <label class="uk-form-label" >实发</label> | ||
| 119 | + <div class="uk-form-controls"> | ||
| 120 | + <input type="time" name="fcsjActual" value="{{sch.fcsjActual}}" > | ||
| 121 | + </div> | ||
| 122 | + </div> | ||
| 123 | + </div> | ||
| 124 | + </div> | ||
| 125 | + | ||
| 126 | + <div class="uk-grid"> | ||
| 127 | + <div class="uk-width-1-3"> | ||
| 128 | + <div class="uk-form-row"> | ||
| 129 | + <label class="uk-form-label" >里程</label> | ||
| 130 | + <div class="uk-form-controls"> | ||
| 131 | + <input type="text" name="jhlc" value="{{sch.jhlc}}" max=222 data-fv-lessthan-inclusive="false" | ||
| 132 | + required> | ||
| 133 | + </div> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + <div class="uk-width-1-3"> | ||
| 137 | + <div class="uk-form-row"> | ||
| 138 | + <label class="uk-form-label" >计达</label> | ||
| 139 | + <div class="uk-form-controls"> | ||
| 140 | + <input type="time" value="{{sch.zdsj}}" disabled> | ||
| 141 | + </div> | ||
| 142 | + </div> | ||
| 143 | + </div> | ||
| 144 | + <div class="uk-width-1-3"> | ||
| 145 | + <div class="uk-form-row"> | ||
| 146 | + <label class="uk-form-label" >实达</label> | ||
| 147 | + <div class="uk-form-controls"> | ||
| 148 | + <input type="time" name="zdsjActual" value="{{sch.zdsjActual}}" > | ||
| 149 | + </div> | ||
| 150 | + </div> | ||
| 151 | + </div> | ||
| 152 | + </div> | ||
| 153 | + <div class="uk-grid"> | ||
| 154 | + <div class="uk-width-1-3"> | ||
| 155 | + <div class="uk-form-row"> | ||
| 156 | + <label class="uk-form-label" ></label> | ||
| 157 | + <label> | ||
| 158 | + <input class="i-cbox destroy-box" type="checkbox" name="status" value="-1" {{if sch.status==-1}}checked{{/if}}> | ||
| 159 | + 是否烂班 | ||
| 160 | + </label> | ||
| 161 | + </div> | ||
| 162 | + | ||
| 163 | + <div class="uk-form-row adjust_exps_select_wrap {{if sch.status!=-1}}display_hide{{/if}}" > | ||
| 164 | + <label class="uk-form-label" >烂班原因</label> | ||
| 165 | + <div class="uk-form-controls"> | ||
| 166 | + <select name="adjustExps"> | ||
| 167 | + {{each adjustExps as exp i}} | ||
| 168 | + <option value="{{exp}}" {{if sch.adjustExps==exp}}selected{{/if}}>{{exp}}</option> | ||
| 169 | + {{/each}} | ||
| 170 | + </select> | ||
| 171 | + </div> | ||
| 172 | + </div> | ||
| 173 | + </div> | ||
| 174 | + | ||
| 175 | + <div class="uk-width-2-3"> | ||
| 176 | + <div class="uk-form-row ct-stacked"> | ||
| 177 | + <label class="uk-form-label" >备注</label> | ||
| 178 | + <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 179 | + <textarea id="form-s-t" cols="20" rows="3" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="100" placeholder="备注">{{sch.remarks}}</textarea> | ||
| 180 | + </div> | ||
| 181 | + </div> | ||
| 182 | + </div> | ||
| 183 | + </div> | ||
| 184 | + <div class="uk-modal-footer uk-text-right" style="margin-bottom: 20px;"> | ||
| 185 | + <div class="uk-button-dropdown" data-uk-dropdown> | ||
| 186 | + <a class="uk-button uk-button-success"><i class="uk-icon-pencil-square-o"></i> 添加子任务 <i class="uk-icon-caret-down"></i></a> | ||
| 187 | + <div class="uk-dropdown" style="text-align: left;"> | ||
| 188 | + <ul class="uk-nav uk-nav-dropdown child_task_list"> | ||
| 189 | + <!--<li data-method="add_oil"><a>空驶进出场</a></li> | ||
| 190 | + <li data-method="in_park"><a>进场</a></li> | ||
| 191 | + <li data-method="out_park"><a>出场</a></li>--> | ||
| 192 | + <li data-method="other"><a>自定义</a></li> | ||
| 193 | + </ul> | ||
| 194 | + </div> | ||
| 195 | + </div> | ||
| 196 | + | ||
| 197 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存主任务信息</button> | ||
| 198 | + </div> | ||
| 199 | + </script> | ||
| 200 | + | ||
| 201 | + <script id="h-sub_task-table-temp" type="text/html"> | ||
| 202 | + {{each list as task i}} | ||
| 203 | + <dl data-id="{{task.id}}"> | ||
| 204 | + <dd>{{i+1}}</dd> | ||
| 205 | + <dd><span class="nt-dictionary" data-group="ChildTaskType">{{task.type2}}</span></dd> | ||
| 206 | + <dd>{{task.startStationName}}</dd> | ||
| 207 | + <dd>{{task.endStationName}}</dd> | ||
| 208 | + <dd>{{task.startDate}}</dd> | ||
| 209 | + <dd>{{task.endDate}}</dd> | ||
| 210 | + <dd> | ||
| 211 | + {{task.mileage}} | ||
| 212 | + (<span class="nt-dictionary" data-group="MileageType">{{task.mileageType}}</span> | ||
| 213 | + {{if task.destroy}} | ||
| 214 | + <small style="color:red;">烂班</small> | ||
| 215 | + {{/if}} | ||
| 216 | + ) | ||
| 217 | + </dd> | ||
| 218 | + <dd title="{{task.remarks}}">{{task.remarks}}</dd> | ||
| 219 | + </dl> | ||
| 220 | + {{/each}} | ||
| 221 | + </script> | ||
| 222 | + | ||
| 223 | + <script> | ||
| 224 | + (function() { | ||
| 225 | + var modal = '#history-sch-edit-modal' | ||
| 226 | + ,gb_sch,parentModal; | ||
| 227 | + var stationRoutes, parks, information; | ||
| 228 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 229 | + $(modal).on('init', function(e, data) { | ||
| 230 | + e.stopPropagation(); | ||
| 231 | + var id = data.id; | ||
| 232 | + parentModal=data.parentModal; | ||
| 233 | + | ||
| 234 | + $.get('/realSchedule/'+id, function (sch) { | ||
| 235 | + gb_sch = sch; | ||
| 236 | + | ||
| 237 | + var htmlStr = template('history-sch-edit-form-temp', {sch: sch, adjustExps: adjustExps}); | ||
| 238 | + $('form.sch_form', modal).html(htmlStr); | ||
| 239 | + //子任务列表 | ||
| 240 | + sch.cTasks.sort(sub_task_sort); | ||
| 241 | + htmlStr = template('h-sub_task-table-temp', {list: sch.cTasks}); | ||
| 242 | + $('.sub-task-table .ct_table_body', modal).html(htmlStr); | ||
| 243 | + | ||
| 244 | + //字典转换 | ||
| 245 | + dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 246 | + //渲染表格,自动补全和下拉框等 | ||
| 247 | + renderForm(); | ||
| 248 | + | ||
| 249 | + //submit | ||
| 250 | + var f = $('form.sch_form', modal).formValidation(gb_form_validation_opts); | ||
| 251 | + //是否烂班 | ||
| 252 | + $('[name=status]', f).on('click', function () { | ||
| 253 | + if(this.checked){ | ||
| 254 | + $('[name=jhlc]', f).val(0); | ||
| 255 | + $('.adjust_exps_select_wrap', f).show(); | ||
| 256 | + } | ||
| 257 | + else{ | ||
| 258 | + $('[name=jhlc]', f).val(gb_sch.jhlcOrig); | ||
| 259 | + $('.adjust_exps_select_wrap', f).hide(); | ||
| 260 | + } | ||
| 261 | + }); | ||
| 262 | + f.on('success.form.fv', function(e) { | ||
| 263 | + e.preventDefault(); | ||
| 264 | + var data = $(this).serializeJSON(); | ||
| 265 | + | ||
| 266 | + //拆分驾驶员工号和姓名 | ||
| 267 | + data.jGh = data.jsy.split('/')[0]; | ||
| 268 | + data.jName = data.jsy.split('/')[1]; | ||
| 269 | + delete data.jsy; | ||
| 270 | + //拆分售票员工号和姓名 | ||
| 271 | + if(data.spy != null){ | ||
| 272 | + data.sGh = data.spy.split('/')[0]; | ||
| 273 | + data.sName = data.spy.split('/')[1]; | ||
| 274 | + delete data.spy; | ||
| 275 | + } | ||
| 276 | + | ||
| 277 | + gb_common.$post('/realSchedule/history', data, function (rs) { | ||
| 278 | + //console.log(rs); | ||
| 279 | + UIkit.modal(modal).hide(); | ||
| 280 | + $(parentModal).trigger('refresh'); | ||
| 281 | + }); | ||
| 282 | + }); | ||
| 283 | + }); | ||
| 284 | + }); | ||
| 285 | + | ||
| 286 | + /** | ||
| 287 | + * 添加子任务 | ||
| 288 | + */ | ||
| 289 | + $(modal).on('click','.child_task_list>li', function () { | ||
| 290 | + var method = $(this).data('method'); | ||
| 291 | + addChildTaskObj[method](); | ||
| 292 | + }); | ||
| 293 | + var modal_opts = {center: false, bgclose: false, modal: false} | ||
| 294 | + ,folder = '/real_control_v2/fragments/north/nav/history_sch'; | ||
| 295 | + var addChildTaskObj = { | ||
| 296 | + add_oil: function () { | ||
| 297 | + open_modal(folder + '/h_add_sub_task_oil.html', { | ||
| 298 | + sch: gb_sch | ||
| 299 | + }, modal_opts); | ||
| 300 | + }, | ||
| 301 | + in_park: function () { | ||
| 302 | + open_modal(folder + '/h_add_sub_task_inpark.html', { | ||
| 303 | + sch: gb_sch | ||
| 304 | + }, modal_opts); | ||
| 305 | + }, | ||
| 306 | + out_park: function () { | ||
| 307 | + open_modal(folder + '/h_add_sub_task_outpark.html', { | ||
| 308 | + sch: gb_sch | ||
| 309 | + }, modal_opts); | ||
| 310 | + }, | ||
| 311 | + other: function () { | ||
| 312 | + open_modal(folder + '/h_add_sub_task_other.html', { | ||
| 313 | + sch: gb_sch | ||
| 314 | + }, modal_opts); | ||
| 315 | + } | ||
| 316 | + }; | ||
| 317 | + | ||
| 318 | + $('#addChildTaskBtn', modal).on('click', addChildTaskObj.other); | ||
| 319 | + | ||
| 320 | + | ||
| 321 | + var callbackHandler = { | ||
| 322 | + remove_sub_task: function () { | ||
| 323 | + var activeDl = $('.sub-task-table .ct_table_body', modal).find('dl.context-menu-active'); | ||
| 324 | + if (activeDl.length == 0) | ||
| 325 | + return; | ||
| 326 | + var dds = activeDl.find('dd'); | ||
| 327 | + var id = activeDl.data('id') | ||
| 328 | + , str = '<h3>确定要删除子任务<span style="color:red;margin: 0 5px;">' + $(dds[4]).text() + ',' + $(dds[6]).text() + ' </span>?</h3>'; | ||
| 329 | + alt_confirm(str, function () { | ||
| 330 | + gb_common.$del('/childTask/history/' + id, function (rs) { | ||
| 331 | + notify_succ('删除子任务成功!'); | ||
| 332 | + //刷新界面数据 | ||
| 333 | + $(modal).trigger('init', {id: gb_sch.id}); | ||
| 334 | + }); | ||
| 335 | + }, '确定删除'); | ||
| 336 | + } | ||
| 337 | + }; | ||
| 338 | + //右键菜单 | ||
| 339 | + $.contextMenu({ | ||
| 340 | + selector: modal + ' .sub-task-table .ct_table_body dl', | ||
| 341 | + className: 'schedule-ct-menu', | ||
| 342 | + callback: function (key, options) { | ||
| 343 | + callbackHandler[key] && callbackHandler[key](); | ||
| 344 | + }, | ||
| 345 | + items: { | ||
| 346 | + "remove_sub_task": { | ||
| 347 | + name: "删除子任务" | ||
| 348 | + , icon: "delete" | ||
| 349 | + } | ||
| 350 | + } | ||
| 351 | + }); | ||
| 352 | + | ||
| 353 | + function renderForm() { | ||
| 354 | + //站点路由 | ||
| 355 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(gb_sch.xlBm).sort(function (a, b) { | ||
| 356 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 357 | + }), 'directions'); | ||
| 358 | + //停车场 | ||
| 359 | + parks = gb_data_basic.simpleParksArray(); | ||
| 360 | + //线路标准 | ||
| 361 | + information = gb_data_basic.getLineInformation(gb_sch.xlBm); | ||
| 362 | + | ||
| 363 | + //----------- Autocomplete -------------- | ||
| 364 | + //车辆 | ||
| 365 | + gb_common.carAutocomplete($('.car-autocom', modal), gb_data_basic.carsArray()); | ||
| 366 | + //驾驶员 | ||
| 367 | + gb_common.personAutocomplete($('.jsy-autocom', modal)); | ||
| 368 | + //售票员 | ||
| 369 | + gb_common.personAutocomplete($('.spy-autocom', modal)); | ||
| 370 | + | ||
| 371 | + //班次类型切换 | ||
| 372 | + var f = $('form.sch_form', modal); | ||
| 373 | + initScheduleTypeChange(f); | ||
| 374 | + $('[name=bcType]', f).trigger('change'); | ||
| 375 | + } | ||
| 376 | + | ||
| 377 | + | ||
| 378 | + function initScheduleTypeChange(f, cb) { | ||
| 379 | + (function (f, cb) { | ||
| 380 | + $('[name=bcType]', f).on('change', function () { | ||
| 381 | + var bcType_e = $('[name=bcType]', f) | ||
| 382 | + , updown = gb_sch.xlDir; | ||
| 383 | + | ||
| 384 | + var routes = stationRoutes[updown] | ||
| 385 | + , lastCode = routes[routes.length - 1].stationCode | ||
| 386 | + , opts = '', park_opts = ''; | ||
| 387 | + //station options | ||
| 388 | + $.each(routes, function () { | ||
| 389 | + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 390 | + }); | ||
| 391 | + //park options | ||
| 392 | + for (var code in parks) | ||
| 393 | + park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 394 | + | ||
| 395 | + var qdz = $('[name=qdzCode]', f), zdz = $('[name=zdzCode]', f); | ||
| 396 | + var time, mileage; | ||
| 397 | + switch (bcType_e.val()) { | ||
| 398 | + case 'out': | ||
| 399 | + qdz.html(park_opts).val(information.carPark); | ||
| 400 | + zdz.html(opts); | ||
| 401 | + //出场结束时间 | ||
| 402 | + time = updown == 0 ? information.upOutTimer : information.downOutTimer; | ||
| 403 | + mileage = updown == 0 ? information.upOutMileage : information.downOutMileage; | ||
| 404 | + break; | ||
| 405 | + case 'in': | ||
| 406 | + qdz.html(opts); | ||
| 407 | + zdz.html(park_opts).val(information.carPark); | ||
| 408 | + //进场结束时间 | ||
| 409 | + time = updown == 0 ? information.upInTimer : information.downInTimer; | ||
| 410 | + mileage = updown == 0 ? information.upInMileage : information.downInMileage; | ||
| 411 | + break; | ||
| 412 | + default: | ||
| 413 | + qdz.html(opts); | ||
| 414 | + zdz.html(opts).val(lastCode); | ||
| 415 | + time = updown == 0?information.upTravelTime:information.downTravelTime; | ||
| 416 | + mileage = updown == 0?information.upMileage:information.downMileage; | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + cb && cb(); | ||
| 420 | + }).trigger('change'); | ||
| 421 | + })(f, cb); | ||
| 422 | + } | ||
| 423 | + | ||
| 424 | + function sub_task_sort(a, b) { | ||
| 425 | + return a.id - b.id; | ||
| 426 | + } | ||
| 427 | + })(); | ||
| 428 | + </script> | ||
| 429 | +</div> |
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch/h_add_sub_task_inpark.html
| 1 | -<div class="uk-modal ct_move_modal" id="add-sub-task-inpark-modal"> | ||
| 2 | - <div class="uk-modal-dialog"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>回场子任务</h2></div> | ||
| 6 | - | ||
| 7 | - <div style="width: 100%;padding-left: 1%;"> | ||
| 8 | - <div class="sub-task-card"> | ||
| 9 | - <div class="uk-panel uk-panel-box uk-panel-box-primary twins_task_panel"> | ||
| 10 | - <div class="uk-panel-badge uk-badge">营运</div> | ||
| 11 | - <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 12 | - <form class="uk-form uk-form-horizontal inpark_form" service_form> | ||
| 13 | - <input type="hidden" name="type2" value="1"> | ||
| 14 | - <input type="hidden" name="mileageType" value="service"> | ||
| 15 | - <div class="uk-grid"> | ||
| 16 | - <div class="uk-width-3-10"> | ||
| 17 | - <div class="uk-form-row"> | ||
| 18 | - <label class="uk-form-label">班次类型 </label> | ||
| 19 | - </div> | ||
| 20 | - </div> | ||
| 21 | - <div class="uk-width-7-10 pl5"> | ||
| 22 | - <select name="type1" class="ct_focus" disabled> | ||
| 23 | - <option value="正常">正常</option> | ||
| 24 | - <option value="临加">临加</option> | ||
| 25 | - </select> | ||
| 26 | - </div> | ||
| 27 | - </div> | ||
| 28 | - <div class="uk-grid"> | ||
| 29 | - <div class="uk-width-3-10"> | ||
| 30 | - <div class="uk-form-row"> | ||
| 31 | - <label class="uk-form-label">起点 </label> | ||
| 32 | - </div> | ||
| 33 | - </div> | ||
| 34 | - <div class="uk-width-7-10 pl5"> | ||
| 35 | - <select name="startStation" disabled></select> | ||
| 36 | - </div> | ||
| 37 | - </div> | ||
| 38 | - <div class="uk-grid"> | ||
| 39 | - <div class="uk-width-3-10"> | ||
| 40 | - <div class="uk-form-row"> | ||
| 41 | - <label class="uk-form-label">终点 </label> | ||
| 42 | - </div> | ||
| 43 | - </div> | ||
| 44 | - <div class="uk-width-7-10 pl5"> | ||
| 45 | - <select name="endStation" class="ct_focus"></select> | ||
| 46 | - </div> | ||
| 47 | - </div> | ||
| 48 | - <div class="uk-grid"> | ||
| 49 | - <div class="uk-width-3-10"> | ||
| 50 | - <div class="uk-form-row"> | ||
| 51 | - <label class="uk-form-label">营运里程</label> | ||
| 52 | - </div> | ||
| 53 | - </div> | ||
| 54 | - <div class="uk-width-7-10 pl5"> | ||
| 55 | - <input type="number" step="0.01" name="mileage" required> | ||
| 56 | - </div> | ||
| 57 | - </div> | ||
| 58 | - <div class="uk-grid"> | ||
| 59 | - <div class="uk-width-3-10"> | ||
| 60 | - <div class="uk-form-row"> | ||
| 61 | - <label class="uk-form-label">开始时间</label> | ||
| 62 | - </div> | ||
| 63 | - </div> | ||
| 64 | - <div class="uk-width-7-10 pl5"> | ||
| 65 | - <input type="time" name="startDate" required> | ||
| 66 | - </div> | ||
| 67 | - </div> | ||
| 68 | - <div class="uk-grid"> | ||
| 69 | - <div class="uk-width-3-10"> | ||
| 70 | - <div class="uk-form-row"> | ||
| 71 | - <label class="uk-form-label">结束时间</label> | ||
| 72 | - </div> | ||
| 73 | - </div> | ||
| 74 | - <div class="uk-width-7-10 pl5"> | ||
| 75 | - <input type="time" name="endDate" required> | ||
| 76 | - </div> | ||
| 77 | - </div> | ||
| 78 | - </form> | ||
| 79 | - </div> | ||
| 80 | - </div> | ||
| 81 | - <div class="sub-task-card"> | ||
| 82 | - <div class="uk-panel uk-panel-box uk-panel-box-secondary"> | ||
| 83 | - <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div> | ||
| 84 | - <h3 class="uk-panel-title">进场</h3> | ||
| 85 | - <form class="uk-form uk-form-horizontal inpark_form" empty_form> | ||
| 86 | - <input type="hidden" name="type2" value="2"> | ||
| 87 | - <input type="hidden" name="mileageType" value="empty"> | ||
| 88 | - <div class="uk-grid"> | ||
| 89 | - <div class="uk-width-3-10"> | ||
| 90 | - <div class="uk-form-row"> | ||
| 91 | - <label class="uk-form-label">班次类型 </label> | ||
| 92 | - </div> | ||
| 93 | - </div> | ||
| 94 | - <div class="uk-width-7-10 pl5"> | ||
| 95 | - <select name="type1" class="ct_focus"> | ||
| 96 | - <option value="正常">正常</option> | ||
| 97 | - <option value="临加">临加</option> | ||
| 98 | - </select> | ||
| 99 | - </div> | ||
| 100 | - </div> | ||
| 101 | - <div class="uk-grid"> | ||
| 102 | - <div class="uk-width-3-10"> | ||
| 103 | - <div class="uk-form-row"> | ||
| 104 | - <label class="uk-form-label">起点 </label> | ||
| 105 | - </div> | ||
| 106 | - </div> | ||
| 107 | - <div class="uk-width-7-10 pl5"> | ||
| 108 | - <select name="startStation" ></select> | ||
| 109 | - </div> | ||
| 110 | - </div> | ||
| 111 | - <div class="uk-grid"> | ||
| 112 | - <div class="uk-width-3-10"> | ||
| 113 | - <div class="uk-form-row"> | ||
| 114 | - <label class="uk-form-label">终点 </label> | ||
| 115 | - </div> | ||
| 116 | - </div> | ||
| 117 | - <div class="uk-width-7-10 pl5"> | ||
| 118 | - <select name="endStation" class="ct_focus"></select> | ||
| 119 | - </div> | ||
| 120 | - </div> | ||
| 121 | - <div class="uk-grid"> | ||
| 122 | - <div class="uk-width-3-10"> | ||
| 123 | - <div class="uk-form-row"> | ||
| 124 | - <label class="uk-form-label">空驶里程</label> | ||
| 125 | - </div> | ||
| 126 | - </div> | ||
| 127 | - <div class="uk-width-7-10 pl5"> | ||
| 128 | - <input type="number" step="0.01" name="mileage" required style="width: calc(100% - 62px);"> | ||
| 129 | - <a style="font-size: 12px;color: grey;cursor: default;" data-uk-tooltip title="可选择回场路径,设置途径点位。暂不开放" id="inpark_paths_link">路径(<span>0</span>)</a> | ||
| 130 | - </div> | ||
| 131 | - </div> | ||
| 132 | - <div class="uk-grid"> | ||
| 133 | - <div class="uk-width-3-10"> | ||
| 134 | - <div class="uk-form-row"> | ||
| 135 | - <label class="uk-form-label">开始时间</label> | ||
| 136 | - </div> | ||
| 137 | - </div> | ||
| 138 | - <div class="uk-width-7-10 pl5"> | ||
| 139 | - <input type="time" name="startDate" required> | ||
| 140 | - </div> | ||
| 141 | - </div> | ||
| 142 | - <div class="uk-grid"> | ||
| 143 | - <div class="uk-width-3-10"> | ||
| 144 | - <div class="uk-form-row"> | ||
| 145 | - <label class="uk-form-label">结束时间</label> | ||
| 146 | - </div> | ||
| 147 | - </div> | ||
| 148 | - <div class="uk-width-7-10 pl5"> | ||
| 149 | - <input type="time" name="endDate" required> | ||
| 150 | - </div> | ||
| 151 | - </div> | ||
| 152 | - </form> | ||
| 153 | - </div> | ||
| 154 | - </div> | ||
| 155 | - <div class="sub-task-card destroy-card uk-animation-scale"> | ||
| 156 | - <div class="uk-panel uk-panel-box uk-panel-box-danger"> | ||
| 157 | - <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 158 | - <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 159 | - <form class="uk-form uk-form-horizontal inpark_form" destroy_form> | ||
| 160 | - <input type="hidden" value="正常" name="type1"> | ||
| 161 | - <input type="hidden" value="1" name="type2"> | ||
| 162 | - <input type="hidden" name="mileageType" value="service"> | ||
| 163 | - <input type="hidden" name="destroy" value="true"> | ||
| 164 | - <div class="uk-grid" style="height: 30px;"> | ||
| 165 | - </div> | ||
| 166 | - <div class="uk-grid"> | ||
| 167 | - <div class="uk-width-3-10"> | ||
| 168 | - <div class="uk-form-row"> | ||
| 169 | - <label class="uk-form-label">起点 </label> | ||
| 170 | - </div> | ||
| 171 | - </div> | ||
| 172 | - <div class="uk-width-7-10 pl5"> | ||
| 173 | - <select name="startStation" disabled></select> | ||
| 174 | - </div> | ||
| 175 | - </div> | ||
| 176 | - <div class="uk-grid"> | ||
| 177 | - <div class="uk-width-3-10"> | ||
| 178 | - <div class="uk-form-row"> | ||
| 179 | - <label class="uk-form-label">终点 </label> | ||
| 180 | - </div> | ||
| 181 | - </div> | ||
| 182 | - <div class="uk-width-7-10 pl5"> | ||
| 183 | - <select name="endStation" class="ct_focus" disabled></select> | ||
| 184 | - </div> | ||
| 185 | - </div> | ||
| 186 | - <div class="uk-grid"> | ||
| 187 | - <div class="uk-width-3-10"> | ||
| 188 | - <div class="uk-form-row"> | ||
| 189 | - <label class="uk-form-label">烂班里程</label> | ||
| 190 | - </div> | ||
| 191 | - </div> | ||
| 192 | - <div class="uk-width-7-10 pl5"> | ||
| 193 | - <input type="number" step="0.01" name="mileage" required> | ||
| 194 | - </div> | ||
| 195 | - </div> | ||
| 196 | - <div class="uk-grid"> | ||
| 197 | - <div class="uk-width-3-10"> | ||
| 198 | - <div class="uk-form-row"> | ||
| 199 | - <label class="uk-form-label">开始时间</label> | ||
| 200 | - </div> | ||
| 201 | - </div> | ||
| 202 | - <div class="uk-width-7-10 pl5"> | ||
| 203 | - <input type="time" name="startDate" required> | ||
| 204 | - </div> | ||
| 205 | - </div> | ||
| 206 | - <div class="uk-grid"> | ||
| 207 | - <div class="uk-width-3-10"> | ||
| 208 | - <div class="uk-form-row"> | ||
| 209 | - <label class="uk-form-label">烂班原因</label> | ||
| 210 | - </div> | ||
| 211 | - </div> | ||
| 212 | - <div class="uk-width-7-10 pl5"> | ||
| 213 | - <select name="destroyReason" required></select> | ||
| 214 | - </div> | ||
| 215 | - </div> | ||
| 216 | - </form> | ||
| 217 | - </div> | ||
| 218 | - </div> | ||
| 219 | - | ||
| 220 | - <form class="uk-form" style="margin-top: 15px; padding: 0 10px 0 0;"> | ||
| 221 | - <textarea placeholder="备注" style="width: 100%;height: 70px;" id="globalRemarks"></textarea> | ||
| 222 | - </form> | ||
| 223 | - </div> | ||
| 224 | - | ||
| 225 | - <div class="uk-modal-footer uk-text-right"> | ||
| 226 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 227 | - <button type="button" class="uk-button uk-button-primary" id="submitChildTaskBtn">提交子任务</button> | ||
| 228 | - | ||
| 229 | - <div class="ct-footer-left"> | ||
| 230 | - <a id="betweenStationRangeCalc" data-drawer-id="station_route_spacing_chart_drawer">站点间公里不准?</a> | ||
| 231 | - </div> | ||
| 232 | - </div> | ||
| 233 | - </div> | ||
| 234 | - | ||
| 235 | - <div class="ct-bottom-drawer"> | ||
| 236 | - <div class="ct-bottom-drawer-body"></div> | ||
| 237 | - </div> | ||
| 238 | - | ||
| 239 | - <script id="sub-task-inpark-form-temp" type="text/html"> | ||
| 240 | - </script> | ||
| 241 | - | ||
| 242 | - <script> | ||
| 243 | - (function () { | ||
| 244 | - var modal = '#add-sub-task-inpark-modal', | ||
| 245 | - serviceForm = $('form[service_form]', modal), | ||
| 246 | - emptyForm = $('form[empty_form]', modal), | ||
| 247 | - destroyForm = $('form[destroy_form]', modal), | ||
| 248 | - sch, stationRoutes, parks, information, esCode, timeLocStations; | ||
| 249 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 250 | - $(modal).on('init', function (e, data) { | ||
| 251 | - e.stopPropagation(); | ||
| 252 | - sch = data.sch; | ||
| 253 | - | ||
| 254 | - //站点路由 | ||
| 255 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 256 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 257 | - }), 'directions')[sch.xlDir]; | ||
| 258 | - //空驶终点(停车场) | ||
| 259 | - //切换进场终点 | ||
| 260 | - $('select[name=endStation]', emptyForm).on('change', inparkNavigation); | ||
| 261 | - $.get('/basic/parks', function (rs) { | ||
| 262 | - parks = rs; | ||
| 263 | - var opts = ''; | ||
| 264 | - for (var code in parks) { | ||
| 265 | - opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 266 | - } | ||
| 267 | - $('select[name=endStation]', emptyForm).html(opts).val(information.carPark).trigger('change'); | ||
| 268 | - }); | ||
| 269 | - //线路标准 | ||
| 270 | - information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 271 | - //本地存储的站点耗时 | ||
| 272 | - getLocStationsSpace(); | ||
| 273 | - | ||
| 274 | - //设置默认值 | ||
| 275 | - setDefaultVal(); | ||
| 276 | - | ||
| 277 | - //切换营运终点 | ||
| 278 | - $('select[name=endStation]', serviceForm).val(esCode).on('change', function () { | ||
| 279 | - var val = $(this).val(); | ||
| 280 | - if (val == esCode) { | ||
| 281 | - $('.uk-modal-dialog', modal).removeClass('three-children'); | ||
| 282 | - $('.sub-task-card.destroy-card').css("display", "none"); | ||
| 283 | - } | ||
| 284 | - else { | ||
| 285 | - $('.uk-modal-dialog', modal).addClass('three-children'); | ||
| 286 | - $('.sub-task-card.destroy-card').css("display", "inline-block"); | ||
| 287 | - } | ||
| 288 | - | ||
| 289 | - reClac(); | ||
| 290 | - }).trigger('change'); | ||
| 291 | - | ||
| 292 | - | ||
| 293 | - var dataArray = []; | ||
| 294 | - var fs = $('form.inpark_form', modal).formValidation({ | ||
| 295 | - framework: 'uikit', | ||
| 296 | - locale: 'zh_CN' | ||
| 297 | - }); | ||
| 298 | - fs.on('success.form.fv', function(e) { | ||
| 299 | - e.preventDefault(); | ||
| 300 | - if($(this).is(':hidden')) | ||
| 301 | - return; | ||
| 302 | - dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this) | ||
| 303 | - , {remarks: $('#globalRemarks',modal).val(), 'schedule.id': sch.id})); | ||
| 304 | - $(this).data('valid', true); | ||
| 305 | - | ||
| 306 | - if(allValidSuccess()){ | ||
| 307 | - var i = 0, rst; | ||
| 308 | - (function () { | ||
| 309 | - var f = arguments.callee; | ||
| 310 | - if(i >= dataArray.length){ | ||
| 311 | - UIkit.modal(modal).hide(); | ||
| 312 | - $('#history-sch-edit-modal').trigger('init', {id: sch.id}); | ||
| 313 | - return; | ||
| 314 | - } | ||
| 315 | - var data = dataArray[i]; | ||
| 316 | - //里程为0的不保存 | ||
| 317 | - if(data.mileage==0){ | ||
| 318 | - i++; | ||
| 319 | - f(); | ||
| 320 | - } | ||
| 321 | - else{ | ||
| 322 | - //营运子任务不写备注 | ||
| 323 | - if(data.mileageType == 'service' && !data.destroy) | ||
| 324 | - data.remarks = ''; | ||
| 325 | - //需要关联的部分主任务属性 | ||
| 326 | - data['schedule.xlBm'] = sch.xlBm; | ||
| 327 | - data['schedule.xlDir'] = sch.xlDir; | ||
| 328 | - gb_common.$post('/childTask/history', data, function (rs) { | ||
| 329 | - notify_succ('子任务添加成功'); | ||
| 330 | - rst = rs.t; | ||
| 331 | - i++; | ||
| 332 | - f(); | ||
| 333 | - }); | ||
| 334 | - } | ||
| 335 | - })(); | ||
| 336 | - } | ||
| 337 | - }); | ||
| 338 | - | ||
| 339 | - //校验不过 | ||
| 340 | - fs.on('err.field.fv', function () { | ||
| 341 | - $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled'); | ||
| 342 | - }); | ||
| 343 | - | ||
| 344 | - //submit | ||
| 345 | - $('#submitChildTaskBtn', modal).on('click', function () { | ||
| 346 | - $(this).addClass('disabled').attr('disabled','disabled'); | ||
| 347 | - dataArray = []; | ||
| 348 | - fs.data('valid', false); | ||
| 349 | - fs.formValidation('validate'); | ||
| 350 | - //fs.submit(); | ||
| 351 | - }); | ||
| 352 | - | ||
| 353 | - //选择烂班原因 | ||
| 354 | - $('select[name=destroyReason]', destroyForm).on('change', function () { | ||
| 355 | - var e =$('#globalRemarks', modal); | ||
| 356 | - e.val(e.val() + $(this).val() + ','); | ||
| 357 | - }); | ||
| 358 | - | ||
| 359 | - //根据主任务状态,复子任务 | ||
| 360 | - updateTwinsTaskBySch(sch); | ||
| 361 | - }); | ||
| 362 | - | ||
| 363 | - function allValidSuccess() { | ||
| 364 | - var flag = true; | ||
| 365 | - $('form.inpark_form:visible', modal).each(function (i, f) { | ||
| 366 | - if(!$(f).data('valid')){ | ||
| 367 | - flag = false; | ||
| 368 | - return false; | ||
| 369 | - } | ||
| 370 | - }); | ||
| 371 | - return flag; | ||
| 372 | - } | ||
| 373 | - | ||
| 374 | - //获取表单disabled 项的值 | ||
| 375 | - function getDisabledVal(f) { | ||
| 376 | - var rs = {}; | ||
| 377 | - $('input,select', f).each(function () { | ||
| 378 | - if($(this).attr('disabled')){ | ||
| 379 | - rs[$(this).attr('name')]=$(this).val(); | ||
| 380 | - } | ||
| 381 | - }); | ||
| 382 | - return rs; | ||
| 383 | - } | ||
| 384 | - | ||
| 385 | - function setDefaultVal() { | ||
| 386 | - var routeOpts = ''; | ||
| 387 | - $.each(stationRoutes, function () { | ||
| 388 | - routeOpts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'; | ||
| 389 | - }); | ||
| 390 | - esCode = stationRoutes[stationRoutes.length - 1].stationCode; | ||
| 391 | - | ||
| 392 | - //营运起终点 | ||
| 393 | - $('select[name=startStation],select[name=endStation]', serviceForm).html(routeOpts); | ||
| 394 | - //空驶起点 | ||
| 395 | - $('select[name=startStation]', emptyForm).html(routeOpts).val(esCode); | ||
| 396 | - //烂班起终点 | ||
| 397 | - $('select[name=startStation],select[name=endStation]', destroyForm).html(routeOpts).val(esCode); | ||
| 398 | - | ||
| 399 | - //烂班原因 | ||
| 400 | - var adjustExpsOpts = '<option value="">请选择...</option>'; | ||
| 401 | - $.each(adjustExps, function (i, str) { | ||
| 402 | - adjustExpsOpts += '<option value="' + str + '">' + str + '</option>'; | ||
| 403 | - }); | ||
| 404 | - $('select[name=destroyReason]', destroyForm).html(adjustExpsOpts); | ||
| 405 | - | ||
| 406 | - //营运开始时间 | ||
| 407 | - $('input[name=startDate]', serviceForm).val(sch.fcsjActual?sch.fcsjActual:sch.dfsj); | ||
| 408 | - | ||
| 409 | - //营运班次类型 | ||
| 410 | - $('select[name=type1]', serviceForm).val(sch['sflj']?'临加':'正常'); | ||
| 411 | - } | ||
| 412 | - | ||
| 413 | - //点击 路径 | ||
| 414 | - $('#inpark_paths_link', modal).on('click', function () { | ||
| 415 | - | ||
| 416 | - }); | ||
| 417 | - | ||
| 418 | - //进场导航 | ||
| 419 | - var drivingRouteResult; | ||
| 420 | - function inparkNavigation() { | ||
| 421 | - var start = $('select[name=startStation]', emptyForm).val() | ||
| 422 | - ,end = $('select[name=endStation]', emptyForm).val(); | ||
| 423 | - | ||
| 424 | - if(!end) return; | ||
| 425 | - | ||
| 426 | - var station = getStationByCode(start).station | ||
| 427 | - ,park = gb_data_basic.getCarparkByCode(end); | ||
| 428 | - | ||
| 429 | - if(!park){ | ||
| 430 | - notify_err('无法找到停车场的坐标对照!!!'); | ||
| 431 | - return; | ||
| 432 | - } | ||
| 433 | - var tArray = park['gCenterPoint'].split(' '); | ||
| 434 | - var sCoord = TransGPS.wgsToBD(station['gLaty'], station['gLonx']) | ||
| 435 | - ,eCoord = TransGPS.wgsToBD(parseFloat(tArray[1]), parseFloat(tArray[0])); | ||
| 436 | - | ||
| 437 | - var sp = new BMap.Point(sCoord.lng,sCoord.lat); | ||
| 438 | - var ep = new BMap.Point(eCoord.lng,eCoord.lat); | ||
| 439 | - | ||
| 440 | - var driving = new BMap.DrivingRoute('上海', { | ||
| 441 | - onSearchComplete: function (rs) { | ||
| 442 | - drivingRouteResult = rs; | ||
| 443 | - calcInparkMileage(0); | ||
| 444 | - } | ||
| 445 | - }); | ||
| 446 | - driving.search(sp,ep); | ||
| 447 | - } | ||
| 448 | - | ||
| 449 | - function calcInparkMileage(index) { | ||
| 450 | - var count = drivingRouteResult.getNumPlans(); | ||
| 451 | - | ||
| 452 | - //选择方案 | ||
| 453 | - var routePlan = drivingRouteResult.getPlan(index); | ||
| 454 | - //里程 | ||
| 455 | - var mileage = routePlan.getDistance(false); | ||
| 456 | - $('input[name=mileage]', emptyForm).val(mileage / 1000); | ||
| 457 | - //结束时间 | ||
| 458 | - var duratio = routePlan.getDuration(false); | ||
| 459 | - var st = $('input[name=startDate]', emptyForm).val(); | ||
| 460 | - var ets = moment(st, 'HH:mm').add(duratio, 'seconds').format('HH:mm'); | ||
| 461 | - $('input[name=endDate]', emptyForm).val(ets); | ||
| 462 | - | ||
| 463 | - | ||
| 464 | - $('#inpark_paths_link span', modal).text(count); | ||
| 465 | - } | ||
| 466 | - | ||
| 467 | - function getStationByCode(code) { | ||
| 468 | - for(var i = 0; i < stationRoutes.length; i++){ | ||
| 469 | - if(stationRoutes[i]['stationCode']==code) | ||
| 470 | - return stationRoutes[i]; | ||
| 471 | - } | ||
| 472 | - return null; | ||
| 473 | - } | ||
| 474 | - | ||
| 475 | - function reClac() { | ||
| 476 | - var serviceEnd = $('select[name=endStation]', serviceForm).val(); | ||
| 477 | - //空驶起点 == 营运终点 | ||
| 478 | - $('select[name=startStation]', emptyForm).val(serviceEnd); | ||
| 479 | - | ||
| 480 | - //计算营运里程 | ||
| 481 | - var s = $('select[name=startStation]', serviceForm).val(), | ||
| 482 | - e = $('select[name=endStation]', serviceForm).val(); | ||
| 483 | - var sMileage = calcMileage(s, e); | ||
| 484 | - if(sMileage >= 0) | ||
| 485 | - $('input[name=mileage]', serviceForm).val(sMileage); | ||
| 486 | - | ||
| 487 | - //营运结束时间 | ||
| 488 | - var et = sch.dfsjT + (parseInt(sMileage / sch.jhlcOrig * sch.bcsj) * 60 * 1000) | ||
| 489 | - ,ets = et > sch.zdsjT?sch.zdsj:moment(et).format('HH:mm'); | ||
| 490 | - $('input[name=endDate]', serviceForm).val(ets); | ||
| 491 | - | ||
| 492 | - //有烂班 | ||
| 493 | - if (serviceEnd != esCode) { | ||
| 494 | - //烂班起点 == 营运终点 | ||
| 495 | - $('select[name=startStation]', destroyForm).val(serviceEnd); | ||
| 496 | - //计算烂班公里 | ||
| 497 | - s = $('select[name=startStation]', destroyForm).val(); | ||
| 498 | - e = $('select[name=endStation]', destroyForm).val(); | ||
| 499 | - var dMileage = calcMileage(s, e); | ||
| 500 | - $('input[name=mileage]', destroyForm).val(dMileage); | ||
| 501 | - //烂班开始时间 | ||
| 502 | - $('input[name=startDate]', destroyForm).val(ets); | ||
| 503 | - } | ||
| 504 | - | ||
| 505 | - //进场开始时间 | ||
| 506 | - $('input[name=startDate]', emptyForm).val(ets); | ||
| 507 | - | ||
| 508 | - //重新导航 | ||
| 509 | - inparkNavigation(); | ||
| 510 | - } | ||
| 511 | - | ||
| 512 | - function calcMileage(s, e) { | ||
| 513 | - var mileage = 0, flag, code; | ||
| 514 | - if (timeLocStations) { | ||
| 515 | - //空间坐标计算的站距 | ||
| 516 | - $.each(timeLocStations, function () { | ||
| 517 | - code = this.station['STATION_CODE']; | ||
| 518 | - if (flag) | ||
| 519 | - mileage = gb_common.accAdd(mileage, this.toDistanceGl); | ||
| 520 | - if (code == s) | ||
| 521 | - flag = true; | ||
| 522 | - if (code == e) | ||
| 523 | - return false; | ||
| 524 | - }); | ||
| 525 | - } | ||
| 526 | - else{ | ||
| 527 | - //从原始站点路由字段里取值 | ||
| 528 | - $.each(stationRoutes, function () { | ||
| 529 | - code = this['stationCode']; | ||
| 530 | - if (flag) | ||
| 531 | - mileage = gb_common.accAdd(mileage, this.distances); | ||
| 532 | - if (code == s) | ||
| 533 | - flag = true; | ||
| 534 | - if (code == e) | ||
| 535 | - return false; | ||
| 536 | - }); | ||
| 537 | - } | ||
| 538 | - return mileage; | ||
| 539 | - } | ||
| 540 | - | ||
| 541 | - //从本地localStorage获取站间距数据 | ||
| 542 | - function getLocStationsSpace() { | ||
| 543 | - try { | ||
| 544 | - timeLocStations = window.localStorage.getItem('control_route_distance_' + sch.xlBm); | ||
| 545 | - if (timeLocStations) | ||
| 546 | - timeLocStations = JSON.parse(timeLocStations).stations[sch.xlDir == 0 ? 'up' : 'down']; | ||
| 547 | - } catch (e) { | ||
| 548 | - console.log(e); | ||
| 549 | - } | ||
| 550 | - } | ||
| 551 | - | ||
| 552 | - //站间距计算后刷新 | ||
| 553 | - $(modal).on('refresh_station_space', function () { | ||
| 554 | - getLocStationsSpace(); | ||
| 555 | - reClac(); | ||
| 556 | - }); | ||
| 557 | - | ||
| 558 | - //------ 下抽屉 ------ | ||
| 559 | - $('#betweenStationRangeCalc', modal).on('click', function () { | ||
| 560 | - var id = $(this).data('drawer-id'); | ||
| 561 | - switchBtmDrawer(id, '/real_control_v2/fragments/line_schedule/context_menu/sub_task/station_route_spacing_chart.html'); | ||
| 562 | - }); | ||
| 563 | - | ||
| 564 | - var btmDrawer = $('.ct-bottom-drawer', modal); | ||
| 565 | - //打开事件 | ||
| 566 | - btmDrawer.on('drawer_show', function () { | ||
| 567 | - var url = $(this).data('url'); | ||
| 568 | - if (!url) { | ||
| 569 | - alert('无效的地址'); | ||
| 570 | - } | ||
| 571 | - | ||
| 572 | - var drawerPanel = $(this).data('name'); | ||
| 573 | - $('.ct-bottom-drawer-body', btmDrawer).load(url, function () { | ||
| 574 | - $('#' + drawerPanel).trigger('drawer-init', {sch: sch}); | ||
| 575 | - }); | ||
| 576 | - }); | ||
| 577 | - | ||
| 578 | - function switchBtmDrawer(id, url) { | ||
| 579 | - if (btmDrawer.hasClass('open') && btmDrawer.data('name') == id) { | ||
| 580 | - btmDrawer.removeClass('open'); | ||
| 581 | - btmDrawer.removeData('name').removeData('url'); | ||
| 582 | - } | ||
| 583 | - else { | ||
| 584 | - btmDrawer.addClass('open'); | ||
| 585 | - btmDrawer.data('name', id).data('url', url).trigger('drawer_show'); | ||
| 586 | - } | ||
| 587 | - } | ||
| 588 | - | ||
| 589 | - | ||
| 590 | - function updateTwinsTaskBySch(sch) { | ||
| 591 | - //主任务是烂班 | ||
| 592 | - if(sch.destroy){ | ||
| 593 | - serviceForm.prepend('<input type="hidden" name="destroy" value="true">'); | ||
| 594 | - $('[name=mileage]', serviceForm).val(sch.jhlcOrig).attr('disabled', 'disabled'); | ||
| 595 | - $('.twins_task_panel .uk-badge', modal).addClass('uk-badge-danger').text('烂班'); | ||
| 596 | - //终点禁选 | ||
| 597 | - $('select[name=endStation]', serviceForm).attr('disabled', 'disabled'); | ||
| 598 | - //开始结束时间禁选 | ||
| 599 | - | ||
| 600 | - //空驶起点 | ||
| 601 | - $('select[name=startStation]', emptyForm).val(sch.qdzCode); | ||
| 602 | - } | ||
| 603 | - } | ||
| 604 | - })(); | ||
| 605 | - </script> | 1 | +<div class="uk-modal ct_move_modal" id="add-sub-task-inpark-modal"> |
| 2 | + <div class="uk-modal-dialog"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>回场子任务</h2></div> | ||
| 6 | + | ||
| 7 | + <div style="width: 100%;padding-left: 1%;"> | ||
| 8 | + <div class="sub-task-card"> | ||
| 9 | + <div class="uk-panel uk-panel-box uk-panel-box-primary twins_task_panel"> | ||
| 10 | + <div class="uk-panel-badge uk-badge">营运</div> | ||
| 11 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 12 | + <form class="uk-form uk-form-horizontal inpark_form" service_form> | ||
| 13 | + <input type="hidden" name="type2" value="1"> | ||
| 14 | + <input type="hidden" name="mileageType" value="service"> | ||
| 15 | + <div class="uk-grid"> | ||
| 16 | + <div class="uk-width-3-10"> | ||
| 17 | + <div class="uk-form-row"> | ||
| 18 | + <label class="uk-form-label">班次类型 </label> | ||
| 19 | + </div> | ||
| 20 | + </div> | ||
| 21 | + <div class="uk-width-7-10 pl5"> | ||
| 22 | + <select name="type1" class="ct_focus" disabled> | ||
| 23 | + <option value="正常">正常</option> | ||
| 24 | + <option value="临加">临加</option> | ||
| 25 | + </select> | ||
| 26 | + </div> | ||
| 27 | + </div> | ||
| 28 | + <div class="uk-grid"> | ||
| 29 | + <div class="uk-width-3-10"> | ||
| 30 | + <div class="uk-form-row"> | ||
| 31 | + <label class="uk-form-label">起点 </label> | ||
| 32 | + </div> | ||
| 33 | + </div> | ||
| 34 | + <div class="uk-width-7-10 pl5"> | ||
| 35 | + <select name="startStation" disabled></select> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + <div class="uk-grid"> | ||
| 39 | + <div class="uk-width-3-10"> | ||
| 40 | + <div class="uk-form-row"> | ||
| 41 | + <label class="uk-form-label">终点 </label> | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 44 | + <div class="uk-width-7-10 pl5"> | ||
| 45 | + <select name="endStation" class="ct_focus"></select> | ||
| 46 | + </div> | ||
| 47 | + </div> | ||
| 48 | + <div class="uk-grid"> | ||
| 49 | + <div class="uk-width-3-10"> | ||
| 50 | + <div class="uk-form-row"> | ||
| 51 | + <label class="uk-form-label">营运里程</label> | ||
| 52 | + </div> | ||
| 53 | + </div> | ||
| 54 | + <div class="uk-width-7-10 pl5"> | ||
| 55 | + <input type="number" step="0.01" name="mileage" required> | ||
| 56 | + </div> | ||
| 57 | + </div> | ||
| 58 | + <div class="uk-grid"> | ||
| 59 | + <div class="uk-width-3-10"> | ||
| 60 | + <div class="uk-form-row"> | ||
| 61 | + <label class="uk-form-label">开始时间</label> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + <div class="uk-width-7-10 pl5"> | ||
| 65 | + <input type="time" name="startDate" required> | ||
| 66 | + </div> | ||
| 67 | + </div> | ||
| 68 | + <div class="uk-grid"> | ||
| 69 | + <div class="uk-width-3-10"> | ||
| 70 | + <div class="uk-form-row"> | ||
| 71 | + <label class="uk-form-label">结束时间</label> | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | + <div class="uk-width-7-10 pl5"> | ||
| 75 | + <input type="time" name="endDate" required> | ||
| 76 | + </div> | ||
| 77 | + </div> | ||
| 78 | + </form> | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + <div class="sub-task-card"> | ||
| 82 | + <div class="uk-panel uk-panel-box uk-panel-box-secondary"> | ||
| 83 | + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div> | ||
| 84 | + <h3 class="uk-panel-title">进场</h3> | ||
| 85 | + <form class="uk-form uk-form-horizontal inpark_form" empty_form> | ||
| 86 | + <input type="hidden" name="type2" value="2"> | ||
| 87 | + <input type="hidden" name="mileageType" value="empty"> | ||
| 88 | + <div class="uk-grid"> | ||
| 89 | + <div class="uk-width-3-10"> | ||
| 90 | + <div class="uk-form-row"> | ||
| 91 | + <label class="uk-form-label">班次类型 </label> | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | + <div class="uk-width-7-10 pl5"> | ||
| 95 | + <select name="type1" class="ct_focus"> | ||
| 96 | + <option value="正常">正常</option> | ||
| 97 | + <option value="临加">临加</option> | ||
| 98 | + </select> | ||
| 99 | + </div> | ||
| 100 | + </div> | ||
| 101 | + <div class="uk-grid"> | ||
| 102 | + <div class="uk-width-3-10"> | ||
| 103 | + <div class="uk-form-row"> | ||
| 104 | + <label class="uk-form-label">起点 </label> | ||
| 105 | + </div> | ||
| 106 | + </div> | ||
| 107 | + <div class="uk-width-7-10 pl5"> | ||
| 108 | + <select name="startStation" ></select> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + <div class="uk-grid"> | ||
| 112 | + <div class="uk-width-3-10"> | ||
| 113 | + <div class="uk-form-row"> | ||
| 114 | + <label class="uk-form-label">终点 </label> | ||
| 115 | + </div> | ||
| 116 | + </div> | ||
| 117 | + <div class="uk-width-7-10 pl5"> | ||
| 118 | + <select name="endStation" class="ct_focus"></select> | ||
| 119 | + </div> | ||
| 120 | + </div> | ||
| 121 | + <div class="uk-grid"> | ||
| 122 | + <div class="uk-width-3-10"> | ||
| 123 | + <div class="uk-form-row"> | ||
| 124 | + <label class="uk-form-label">空驶里程</label> | ||
| 125 | + </div> | ||
| 126 | + </div> | ||
| 127 | + <div class="uk-width-7-10 pl5"> | ||
| 128 | + <input type="number" step="0.01" name="mileage" required style="width: calc(100% - 62px);"> | ||
| 129 | + <a style="font-size: 12px;color: grey;cursor: default;" data-uk-tooltip title="可选择回场路径,设置途径点位。暂不开放" id="inpark_paths_link">路径(<span>0</span>)</a> | ||
| 130 | + </div> | ||
| 131 | + </div> | ||
| 132 | + <div class="uk-grid"> | ||
| 133 | + <div class="uk-width-3-10"> | ||
| 134 | + <div class="uk-form-row"> | ||
| 135 | + <label class="uk-form-label">开始时间</label> | ||
| 136 | + </div> | ||
| 137 | + </div> | ||
| 138 | + <div class="uk-width-7-10 pl5"> | ||
| 139 | + <input type="time" name="startDate" required> | ||
| 140 | + </div> | ||
| 141 | + </div> | ||
| 142 | + <div class="uk-grid"> | ||
| 143 | + <div class="uk-width-3-10"> | ||
| 144 | + <div class="uk-form-row"> | ||
| 145 | + <label class="uk-form-label">结束时间</label> | ||
| 146 | + </div> | ||
| 147 | + </div> | ||
| 148 | + <div class="uk-width-7-10 pl5"> | ||
| 149 | + <input type="time" name="endDate" required> | ||
| 150 | + </div> | ||
| 151 | + </div> | ||
| 152 | + </form> | ||
| 153 | + </div> | ||
| 154 | + </div> | ||
| 155 | + <div class="sub-task-card destroy-card uk-animation-scale"> | ||
| 156 | + <div class="uk-panel uk-panel-box uk-panel-box-danger"> | ||
| 157 | + <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 158 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 159 | + <form class="uk-form uk-form-horizontal inpark_form" destroy_form> | ||
| 160 | + <input type="hidden" value="正常" name="type1"> | ||
| 161 | + <input type="hidden" value="1" name="type2"> | ||
| 162 | + <input type="hidden" name="mileageType" value="service"> | ||
| 163 | + <input type="hidden" name="destroy" value="true"> | ||
| 164 | + <div class="uk-grid" style="height: 30px;"> | ||
| 165 | + </div> | ||
| 166 | + <div class="uk-grid"> | ||
| 167 | + <div class="uk-width-3-10"> | ||
| 168 | + <div class="uk-form-row"> | ||
| 169 | + <label class="uk-form-label">起点 </label> | ||
| 170 | + </div> | ||
| 171 | + </div> | ||
| 172 | + <div class="uk-width-7-10 pl5"> | ||
| 173 | + <select name="startStation" disabled></select> | ||
| 174 | + </div> | ||
| 175 | + </div> | ||
| 176 | + <div class="uk-grid"> | ||
| 177 | + <div class="uk-width-3-10"> | ||
| 178 | + <div class="uk-form-row"> | ||
| 179 | + <label class="uk-form-label">终点 </label> | ||
| 180 | + </div> | ||
| 181 | + </div> | ||
| 182 | + <div class="uk-width-7-10 pl5"> | ||
| 183 | + <select name="endStation" class="ct_focus" disabled></select> | ||
| 184 | + </div> | ||
| 185 | + </div> | ||
| 186 | + <div class="uk-grid"> | ||
| 187 | + <div class="uk-width-3-10"> | ||
| 188 | + <div class="uk-form-row"> | ||
| 189 | + <label class="uk-form-label">烂班里程</label> | ||
| 190 | + </div> | ||
| 191 | + </div> | ||
| 192 | + <div class="uk-width-7-10 pl5"> | ||
| 193 | + <input type="number" step="0.01" name="mileage" required> | ||
| 194 | + </div> | ||
| 195 | + </div> | ||
| 196 | + <div class="uk-grid"> | ||
| 197 | + <div class="uk-width-3-10"> | ||
| 198 | + <div class="uk-form-row"> | ||
| 199 | + <label class="uk-form-label">开始时间</label> | ||
| 200 | + </div> | ||
| 201 | + </div> | ||
| 202 | + <div class="uk-width-7-10 pl5"> | ||
| 203 | + <input type="time" name="startDate" required> | ||
| 204 | + </div> | ||
| 205 | + </div> | ||
| 206 | + <div class="uk-grid"> | ||
| 207 | + <div class="uk-width-3-10"> | ||
| 208 | + <div class="uk-form-row"> | ||
| 209 | + <label class="uk-form-label">烂班原因</label> | ||
| 210 | + </div> | ||
| 211 | + </div> | ||
| 212 | + <div class="uk-width-7-10 pl5"> | ||
| 213 | + <select name="destroyReason" required></select> | ||
| 214 | + </div> | ||
| 215 | + </div> | ||
| 216 | + </form> | ||
| 217 | + </div> | ||
| 218 | + </div> | ||
| 219 | + | ||
| 220 | + <form class="uk-form" style="margin-top: 15px; padding: 0 10px 0 0;"> | ||
| 221 | + <textarea placeholder="备注" style="width: 100%;height: 70px;" id="globalRemarks"></textarea> | ||
| 222 | + </form> | ||
| 223 | + </div> | ||
| 224 | + | ||
| 225 | + <div class="uk-modal-footer uk-text-right"> | ||
| 226 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 227 | + <button type="button" class="uk-button uk-button-primary" id="submitChildTaskBtn">提交子任务</button> | ||
| 228 | + | ||
| 229 | + <div class="ct-footer-left"> | ||
| 230 | + <a id="betweenStationRangeCalc" data-drawer-id="station_route_spacing_chart_drawer">站点间公里不准?</a> | ||
| 231 | + </div> | ||
| 232 | + </div> | ||
| 233 | + </div> | ||
| 234 | + | ||
| 235 | + <div class="ct-bottom-drawer"> | ||
| 236 | + <div class="ct-bottom-drawer-body"></div> | ||
| 237 | + </div> | ||
| 238 | + | ||
| 239 | + <script id="sub-task-inpark-form-temp" type="text/html"> | ||
| 240 | + </script> | ||
| 241 | + | ||
| 242 | + <script> | ||
| 243 | + (function () { | ||
| 244 | + var modal = '#add-sub-task-inpark-modal', | ||
| 245 | + serviceForm = $('form[service_form]', modal), | ||
| 246 | + emptyForm = $('form[empty_form]', modal), | ||
| 247 | + destroyForm = $('form[destroy_form]', modal), | ||
| 248 | + sch, stationRoutes, parks, information, esCode, timeLocStations; | ||
| 249 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 250 | + $(modal).on('init', function (e, data) { | ||
| 251 | + e.stopPropagation(); | ||
| 252 | + sch = data.sch; | ||
| 253 | + | ||
| 254 | + //站点路由 | ||
| 255 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 256 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 257 | + }), 'directions')[sch.xlDir]; | ||
| 258 | + //空驶终点(停车场) | ||
| 259 | + //切换进场终点 | ||
| 260 | + $('select[name=endStation]', emptyForm).on('change', inparkNavigation); | ||
| 261 | + $.get('/basic/parks', function (rs) { | ||
| 262 | + parks = rs; | ||
| 263 | + var opts = ''; | ||
| 264 | + for (var code in parks) { | ||
| 265 | + opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 266 | + } | ||
| 267 | + $('select[name=endStation]', emptyForm).html(opts).val(information.carPark).trigger('change'); | ||
| 268 | + }); | ||
| 269 | + //线路标准 | ||
| 270 | + information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 271 | + //本地存储的站点耗时 | ||
| 272 | + getLocStationsSpace(); | ||
| 273 | + | ||
| 274 | + //设置默认值 | ||
| 275 | + setDefaultVal(); | ||
| 276 | + | ||
| 277 | + //切换营运终点 | ||
| 278 | + $('select[name=endStation]', serviceForm).val(esCode).on('change', function () { | ||
| 279 | + var val = $(this).val(); | ||
| 280 | + if (val == esCode) { | ||
| 281 | + $('.uk-modal-dialog', modal).removeClass('three-children'); | ||
| 282 | + $('.sub-task-card.destroy-card').css("display", "none"); | ||
| 283 | + } | ||
| 284 | + else { | ||
| 285 | + $('.uk-modal-dialog', modal).addClass('three-children'); | ||
| 286 | + $('.sub-task-card.destroy-card').css("display", "inline-block"); | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + reClac(); | ||
| 290 | + }).trigger('change'); | ||
| 291 | + | ||
| 292 | + | ||
| 293 | + var dataArray = []; | ||
| 294 | + var fs = $('form.inpark_form', modal).formValidation({ | ||
| 295 | + framework: 'uikit', | ||
| 296 | + locale: 'zh_CN' | ||
| 297 | + }); | ||
| 298 | + fs.on('success.form.fv', function(e) { | ||
| 299 | + e.preventDefault(); | ||
| 300 | + if($(this).is(':hidden')) | ||
| 301 | + return; | ||
| 302 | + dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this) | ||
| 303 | + , {remarks: $('#globalRemarks',modal).val(), 'schedule.id': sch.id})); | ||
| 304 | + $(this).data('valid', true); | ||
| 305 | + | ||
| 306 | + if(allValidSuccess()){ | ||
| 307 | + var i = 0, rst; | ||
| 308 | + (function () { | ||
| 309 | + var f = arguments.callee; | ||
| 310 | + if(i >= dataArray.length){ | ||
| 311 | + UIkit.modal(modal).hide(); | ||
| 312 | + $('#history-sch-edit-modal').trigger('init', {id: sch.id}); | ||
| 313 | + return; | ||
| 314 | + } | ||
| 315 | + var data = dataArray[i]; | ||
| 316 | + //里程为0的不保存 | ||
| 317 | + if(data.mileage==0){ | ||
| 318 | + i++; | ||
| 319 | + f(); | ||
| 320 | + } | ||
| 321 | + else{ | ||
| 322 | + //营运子任务不写备注 | ||
| 323 | + if(data.mileageType == 'service' && !data.destroy) | ||
| 324 | + data.remarks = ''; | ||
| 325 | + //需要关联的部分主任务属性 | ||
| 326 | + data['schedule.xlBm'] = sch.xlBm; | ||
| 327 | + data['schedule.xlDir'] = sch.xlDir; | ||
| 328 | + gb_common.$post('/childTask/history', data, function (rs) { | ||
| 329 | + notify_succ('子任务添加成功'); | ||
| 330 | + rst = rs.t; | ||
| 331 | + i++; | ||
| 332 | + f(); | ||
| 333 | + }); | ||
| 334 | + } | ||
| 335 | + })(); | ||
| 336 | + } | ||
| 337 | + }); | ||
| 338 | + | ||
| 339 | + //校验不过 | ||
| 340 | + fs.on('err.field.fv', function () { | ||
| 341 | + $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled'); | ||
| 342 | + }); | ||
| 343 | + | ||
| 344 | + //submit | ||
| 345 | + $('#submitChildTaskBtn', modal).on('click', function () { | ||
| 346 | + $(this).addClass('disabled').attr('disabled','disabled'); | ||
| 347 | + dataArray = []; | ||
| 348 | + fs.data('valid', false); | ||
| 349 | + fs.formValidation('validate'); | ||
| 350 | + //fs.submit(); | ||
| 351 | + }); | ||
| 352 | + | ||
| 353 | + //选择烂班原因 | ||
| 354 | + $('select[name=destroyReason]', destroyForm).on('change', function () { | ||
| 355 | + var e =$('#globalRemarks', modal); | ||
| 356 | + e.val(e.val() + $(this).val() + ','); | ||
| 357 | + }); | ||
| 358 | + | ||
| 359 | + //根据主任务状态,复子任务 | ||
| 360 | + updateTwinsTaskBySch(sch); | ||
| 361 | + }); | ||
| 362 | + | ||
| 363 | + function allValidSuccess() { | ||
| 364 | + var flag = true; | ||
| 365 | + $('form.inpark_form:visible', modal).each(function (i, f) { | ||
| 366 | + if(!$(f).data('valid')){ | ||
| 367 | + flag = false; | ||
| 368 | + return false; | ||
| 369 | + } | ||
| 370 | + }); | ||
| 371 | + return flag; | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + //获取表单disabled 项的值 | ||
| 375 | + function getDisabledVal(f) { | ||
| 376 | + var rs = {}; | ||
| 377 | + $('input,select', f).each(function () { | ||
| 378 | + if($(this).attr('disabled')){ | ||
| 379 | + rs[$(this).attr('name')]=$(this).val(); | ||
| 380 | + } | ||
| 381 | + }); | ||
| 382 | + return rs; | ||
| 383 | + } | ||
| 384 | + | ||
| 385 | + function setDefaultVal() { | ||
| 386 | + var routeOpts = ''; | ||
| 387 | + $.each(stationRoutes, function () { | ||
| 388 | + routeOpts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'; | ||
| 389 | + }); | ||
| 390 | + esCode = stationRoutes[stationRoutes.length - 1].stationCode; | ||
| 391 | + | ||
| 392 | + //营运起终点 | ||
| 393 | + $('select[name=startStation],select[name=endStation]', serviceForm).html(routeOpts); | ||
| 394 | + //空驶起点 | ||
| 395 | + $('select[name=startStation]', emptyForm).html(routeOpts).val(esCode); | ||
| 396 | + //烂班起终点 | ||
| 397 | + $('select[name=startStation],select[name=endStation]', destroyForm).html(routeOpts).val(esCode); | ||
| 398 | + | ||
| 399 | + //烂班原因 | ||
| 400 | + var adjustExpsOpts = '<option value="">请选择...</option>'; | ||
| 401 | + $.each(adjustExps, function (i, str) { | ||
| 402 | + adjustExpsOpts += '<option value="' + str + '">' + str + '</option>'; | ||
| 403 | + }); | ||
| 404 | + $('select[name=destroyReason]', destroyForm).html(adjustExpsOpts); | ||
| 405 | + | ||
| 406 | + //营运开始时间 | ||
| 407 | + $('input[name=startDate]', serviceForm).val(sch.fcsjActual?sch.fcsjActual:sch.dfsj); | ||
| 408 | + | ||
| 409 | + //营运班次类型 | ||
| 410 | + $('select[name=type1]', serviceForm).val(sch['sflj']?'临加':'正常'); | ||
| 411 | + } | ||
| 412 | + | ||
| 413 | + //点击 路径 | ||
| 414 | + $('#inpark_paths_link', modal).on('click', function () { | ||
| 415 | + | ||
| 416 | + }); | ||
| 417 | + | ||
| 418 | + //进场导航 | ||
| 419 | + var drivingRouteResult; | ||
| 420 | + function inparkNavigation() { | ||
| 421 | + var start = $('select[name=startStation]', emptyForm).val() | ||
| 422 | + ,end = $('select[name=endStation]', emptyForm).val(); | ||
| 423 | + | ||
| 424 | + if(!end) return; | ||
| 425 | + | ||
| 426 | + var station = getStationByCode(start).station | ||
| 427 | + ,park = gb_data_basic.getCarparkByCode(end); | ||
| 428 | + | ||
| 429 | + if(!park){ | ||
| 430 | + notify_err('无法找到停车场的坐标对照!!!'); | ||
| 431 | + return; | ||
| 432 | + } | ||
| 433 | + var tArray = park['gCenterPoint'].split(' '); | ||
| 434 | + var sCoord = TransGPS.wgsToBD(station['gLaty'], station['gLonx']) | ||
| 435 | + ,eCoord = TransGPS.wgsToBD(parseFloat(tArray[1]), parseFloat(tArray[0])); | ||
| 436 | + | ||
| 437 | + var sp = new BMap.Point(sCoord.lng,sCoord.lat); | ||
| 438 | + var ep = new BMap.Point(eCoord.lng,eCoord.lat); | ||
| 439 | + | ||
| 440 | + var driving = new BMap.DrivingRoute('上海', { | ||
| 441 | + onSearchComplete: function (rs) { | ||
| 442 | + drivingRouteResult = rs; | ||
| 443 | + calcInparkMileage(0); | ||
| 444 | + } | ||
| 445 | + }); | ||
| 446 | + driving.search(sp,ep); | ||
| 447 | + } | ||
| 448 | + | ||
| 449 | + function calcInparkMileage(index) { | ||
| 450 | + var count = drivingRouteResult.getNumPlans(); | ||
| 451 | + | ||
| 452 | + //选择方案 | ||
| 453 | + var routePlan = drivingRouteResult.getPlan(index); | ||
| 454 | + //里程 | ||
| 455 | + var mileage = routePlan.getDistance(false); | ||
| 456 | + $('input[name=mileage]', emptyForm).val(mileage / 1000); | ||
| 457 | + //结束时间 | ||
| 458 | + var duratio = routePlan.getDuration(false); | ||
| 459 | + var st = $('input[name=startDate]', emptyForm).val(); | ||
| 460 | + var ets = moment(st, 'HH:mm').add(duratio, 'seconds').format('HH:mm'); | ||
| 461 | + $('input[name=endDate]', emptyForm).val(ets); | ||
| 462 | + | ||
| 463 | + | ||
| 464 | + $('#inpark_paths_link span', modal).text(count); | ||
| 465 | + } | ||
| 466 | + | ||
| 467 | + function getStationByCode(code) { | ||
| 468 | + for(var i = 0; i < stationRoutes.length; i++){ | ||
| 469 | + if(stationRoutes[i]['stationCode']==code) | ||
| 470 | + return stationRoutes[i]; | ||
| 471 | + } | ||
| 472 | + return null; | ||
| 473 | + } | ||
| 474 | + | ||
| 475 | + function reClac() { | ||
| 476 | + var serviceEnd = $('select[name=endStation]', serviceForm).val(); | ||
| 477 | + //空驶起点 == 营运终点 | ||
| 478 | + $('select[name=startStation]', emptyForm).val(serviceEnd); | ||
| 479 | + | ||
| 480 | + //计算营运里程 | ||
| 481 | + var s = $('select[name=startStation]', serviceForm).val(), | ||
| 482 | + e = $('select[name=endStation]', serviceForm).val(); | ||
| 483 | + var sMileage = calcMileage(s, e); | ||
| 484 | + if(sMileage >= 0) | ||
| 485 | + $('input[name=mileage]', serviceForm).val(sMileage); | ||
| 486 | + | ||
| 487 | + //营运结束时间 | ||
| 488 | + var et = sch.dfsjT + (parseInt(sMileage / sch.jhlcOrig * sch.bcsj) * 60 * 1000) | ||
| 489 | + ,ets = et > sch.zdsjT?sch.zdsj:moment(et).format('HH:mm'); | ||
| 490 | + $('input[name=endDate]', serviceForm).val(ets); | ||
| 491 | + | ||
| 492 | + //有烂班 | ||
| 493 | + if (serviceEnd != esCode) { | ||
| 494 | + //烂班起点 == 营运终点 | ||
| 495 | + $('select[name=startStation]', destroyForm).val(serviceEnd); | ||
| 496 | + //计算烂班公里 | ||
| 497 | + s = $('select[name=startStation]', destroyForm).val(); | ||
| 498 | + e = $('select[name=endStation]', destroyForm).val(); | ||
| 499 | + var dMileage = calcMileage(s, e); | ||
| 500 | + $('input[name=mileage]', destroyForm).val(dMileage); | ||
| 501 | + //烂班开始时间 | ||
| 502 | + $('input[name=startDate]', destroyForm).val(ets); | ||
| 503 | + } | ||
| 504 | + | ||
| 505 | + //进场开始时间 | ||
| 506 | + $('input[name=startDate]', emptyForm).val(ets); | ||
| 507 | + | ||
| 508 | + //重新导航 | ||
| 509 | + inparkNavigation(); | ||
| 510 | + } | ||
| 511 | + | ||
| 512 | + function calcMileage(s, e) { | ||
| 513 | + var mileage = 0, flag, code; | ||
| 514 | + if (timeLocStations) { | ||
| 515 | + //空间坐标计算的站距 | ||
| 516 | + $.each(timeLocStations, function () { | ||
| 517 | + code = this.station['STATION_CODE']; | ||
| 518 | + if (flag) | ||
| 519 | + mileage = gb_common.accAdd(mileage, this.toDistanceGl); | ||
| 520 | + if (code == s) | ||
| 521 | + flag = true; | ||
| 522 | + if (code == e) | ||
| 523 | + return false; | ||
| 524 | + }); | ||
| 525 | + } | ||
| 526 | + else{ | ||
| 527 | + //从原始站点路由字段里取值 | ||
| 528 | + $.each(stationRoutes, function () { | ||
| 529 | + code = this['stationCode']; | ||
| 530 | + if (flag) | ||
| 531 | + mileage = gb_common.accAdd(mileage, this.distances); | ||
| 532 | + if (code == s) | ||
| 533 | + flag = true; | ||
| 534 | + if (code == e) | ||
| 535 | + return false; | ||
| 536 | + }); | ||
| 537 | + } | ||
| 538 | + return mileage; | ||
| 539 | + } | ||
| 540 | + | ||
| 541 | + //从本地localStorage获取站间距数据 | ||
| 542 | + function getLocStationsSpace() { | ||
| 543 | + try { | ||
| 544 | + timeLocStations = window.localStorage.getItem('control_route_distance_' + sch.xlBm); | ||
| 545 | + if (timeLocStations) | ||
| 546 | + timeLocStations = JSON.parse(timeLocStations).stations[sch.xlDir == 0 ? 'up' : 'down']; | ||
| 547 | + } catch (e) { | ||
| 548 | + console.log(e); | ||
| 549 | + } | ||
| 550 | + } | ||
| 551 | + | ||
| 552 | + //站间距计算后刷新 | ||
| 553 | + $(modal).on('refresh_station_space', function () { | ||
| 554 | + getLocStationsSpace(); | ||
| 555 | + reClac(); | ||
| 556 | + }); | ||
| 557 | + | ||
| 558 | + //------ 下抽屉 ------ | ||
| 559 | + $('#betweenStationRangeCalc', modal).on('click', function () { | ||
| 560 | + var id = $(this).data('drawer-id'); | ||
| 561 | + switchBtmDrawer(id, '/real_control_v2/fragments/line_schedule/context_menu/sub_task/station_route_spacing_chart.html'); | ||
| 562 | + }); | ||
| 563 | + | ||
| 564 | + var btmDrawer = $('.ct-bottom-drawer', modal); | ||
| 565 | + //打开事件 | ||
| 566 | + btmDrawer.on('drawer_show', function () { | ||
| 567 | + var url = $(this).data('url'); | ||
| 568 | + if (!url) { | ||
| 569 | + alert('无效的地址'); | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + var drawerPanel = $(this).data('name'); | ||
| 573 | + $('.ct-bottom-drawer-body', btmDrawer).load(url, function () { | ||
| 574 | + $('#' + drawerPanel).trigger('drawer-init', {sch: sch}); | ||
| 575 | + }); | ||
| 576 | + }); | ||
| 577 | + | ||
| 578 | + function switchBtmDrawer(id, url) { | ||
| 579 | + if (btmDrawer.hasClass('open') && btmDrawer.data('name') == id) { | ||
| 580 | + btmDrawer.removeClass('open'); | ||
| 581 | + btmDrawer.removeData('name').removeData('url'); | ||
| 582 | + } | ||
| 583 | + else { | ||
| 584 | + btmDrawer.addClass('open'); | ||
| 585 | + btmDrawer.data('name', id).data('url', url).trigger('drawer_show'); | ||
| 586 | + } | ||
| 587 | + } | ||
| 588 | + | ||
| 589 | + | ||
| 590 | + function updateTwinsTaskBySch(sch) { | ||
| 591 | + //主任务是烂班 | ||
| 592 | + if(sch.destroy){ | ||
| 593 | + serviceForm.prepend('<input type="hidden" name="destroy" value="true">'); | ||
| 594 | + $('[name=mileage]', serviceForm).val(sch.jhlcOrig).attr('disabled', 'disabled'); | ||
| 595 | + $('.twins_task_panel .uk-badge', modal).addClass('uk-badge-danger').text('烂班'); | ||
| 596 | + //终点禁选 | ||
| 597 | + $('select[name=endStation]', serviceForm).attr('disabled', 'disabled'); | ||
| 598 | + //开始结束时间禁选 | ||
| 599 | + | ||
| 600 | + //空驶起点 | ||
| 601 | + $('select[name=startStation]', emptyForm).val(sch.qdzCode); | ||
| 602 | + } | ||
| 603 | + } | ||
| 604 | + })(); | ||
| 605 | + </script> | ||
| 606 | </div> | 606 | </div> |
| 607 | \ No newline at end of file | 607 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch/h_add_sub_task_other.html
| 1 | -<div class="uk-modal ct-form-modal ct_move_modal" id="add-sub-task-other-modal"> | ||
| 2 | - <div class="uk-modal-dialog" style="width: 635px;"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>自定义子任务</h2></div> | ||
| 6 | - <form class="uk-form uk-form-horizontal"> | ||
| 7 | - </form> | ||
| 8 | - </div> | ||
| 9 | - | ||
| 10 | - <script id="sub-task-other-form-temp" type="text/html"> | ||
| 11 | - <input type="hidden" value="{{sch.id}}" name="schedule.id"> | ||
| 12 | - <div class="uk-grid"> | ||
| 13 | - <div class="uk-width-1-2"> | ||
| 14 | - <div class="uk-form-row"> | ||
| 15 | - <label class="uk-form-label">班次类型</label> | ||
| 16 | - <div class="uk-form-controls"> | ||
| 17 | - <select class="form-control" name="type1" style="width: 65px;"> | ||
| 18 | - <option>正常</option> | ||
| 19 | - <option>临加</option> | ||
| 20 | - </select> | ||
| 21 | - <select class="form-control nt-dictionary" name="type2" data-group=ChildTaskType | ||
| 22 | - style="width: 126px;;"></select> | ||
| 23 | - </div> | ||
| 24 | - </div> | ||
| 25 | - </div> | ||
| 26 | - | ||
| 27 | - <div class="uk-width-1-2 inout_reason_wrap" style="display: none"> | ||
| 28 | - <div class="uk-form-row"> | ||
| 29 | - <label class="uk-form-label">进出场原因</label> | ||
| 30 | - <div class="uk-form-controls"> | ||
| 31 | - <select class="form-control" name="reason" required> | ||
| 32 | - <option value="">请选择..</option> | ||
| 33 | - <option>故障</option> | ||
| 34 | - <option>肇事</option> | ||
| 35 | - <option>纠纷</option> | ||
| 36 | - <option>其他</option> | ||
| 37 | - </select> | ||
| 38 | - </div> | ||
| 39 | - </div> | ||
| 40 | - </div> | ||
| 41 | - | ||
| 42 | - </div> | ||
| 43 | - <div class="uk-grid"> | ||
| 44 | - <div class="uk-width-1-2"> | ||
| 45 | - <div class="uk-form-row"> | ||
| 46 | - <label class="uk-form-label">起点 </label> | ||
| 47 | - <div class="uk-form-controls"> | ||
| 48 | - <select name="startStation" required></select> | ||
| 49 | - </div> | ||
| 50 | - </div> | ||
| 51 | - </div> | ||
| 52 | - <div class="uk-width-1-2"> | ||
| 53 | - <div class="uk-form-row"> | ||
| 54 | - <label class="uk-form-label">终点</label> | ||
| 55 | - <div class="uk-form-controls"> | ||
| 56 | - <select name="endStation" required></select> | ||
| 57 | - </div> | ||
| 58 | - </div> | ||
| 59 | - </div> | ||
| 60 | - </div> | ||
| 61 | - | ||
| 62 | - <div class="uk-grid"> | ||
| 63 | - <div class="uk-width-1-2"> | ||
| 64 | - <div class="uk-form-row"> | ||
| 65 | - <label class="uk-form-label">里程类型</label> | ||
| 66 | - <div class="uk-form-controls"> | ||
| 67 | - <select class="form-control nt-dictionary" required name="mileageType" | ||
| 68 | - data-group="MileageType"></select> | ||
| 69 | - </div> | ||
| 70 | - </div> | ||
| 71 | - </div> | ||
| 72 | - <div class="uk-width-1-2"> | ||
| 73 | - <div class="uk-form-row"> | ||
| 74 | - <label class="uk-form-label">公里数</label> | ||
| 75 | - <div class="uk-form-controls"> | ||
| 76 | - <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false" required> | ||
| 77 | - </div> | ||
| 78 | - </div> | ||
| 79 | - </div> | ||
| 80 | - </div> | ||
| 81 | - | ||
| 82 | - <div class="uk-grid"> | ||
| 83 | - <div class="uk-width-1-2"> | ||
| 84 | - <div class="uk-form-row"> | ||
| 85 | - <label class="uk-form-label">开始时间</label> | ||
| 86 | - <div class="uk-form-controls"> | ||
| 87 | - <input name="startDate" value="{{sch.fcsj}}" type="time" required> | ||
| 88 | - </div> | ||
| 89 | - </div> | ||
| 90 | - </div> | ||
| 91 | - <div class="uk-width-1-2"> | ||
| 92 | - <div class="uk-form-row"> | ||
| 93 | - <label class="uk-form-label">结束时间</label> | ||
| 94 | - <div class="uk-form-controls"> | ||
| 95 | - <input name="endDate" value="{{sch.zdsj}}" type="time" required> | ||
| 96 | - </div> | ||
| 97 | - </div> | ||
| 98 | - </div> | ||
| 99 | - </div> | ||
| 100 | - | ||
| 101 | - <div class="uk-grid"> | ||
| 102 | - <div class="uk-width-1-2"> | ||
| 103 | - <div class="uk-form-row" style="padding-top: 5px;"> | ||
| 104 | - <label class="uk-form-label"></label> | ||
| 105 | - <div class="uk-form-controls"> | ||
| 106 | - <label> | ||
| 107 | - <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班 | ||
| 108 | - </label> | ||
| 109 | - </div> | ||
| 110 | - </div> | ||
| 111 | - </div> | ||
| 112 | - <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;"> | ||
| 113 | - <div class="uk-form-row"> | ||
| 114 | - <label class="uk-form-label">烂班原因</label> | ||
| 115 | - <div class="uk-form-controls"> | ||
| 116 | - <select class="form-control" name="destroyReason"> | ||
| 117 | - <option value="">请选择...</option> | ||
| 118 | - {{each adjustExps as exp i}} | ||
| 119 | - <option value="{{exp}}">{{exp}}</option> | ||
| 120 | - {{/each}} | ||
| 121 | - </select> | ||
| 122 | - </div> | ||
| 123 | - </div> | ||
| 124 | - </div> | ||
| 125 | - </div> | ||
| 126 | - | ||
| 127 | - <div class="uk-grid"> | ||
| 128 | - <div class="uk-width-1-1"> | ||
| 129 | - <div class="uk-form-row ct-stacked"> | ||
| 130 | - <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 131 | - <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" | ||
| 132 | - data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 133 | - </div> | ||
| 134 | - </div> | ||
| 135 | - </div> | ||
| 136 | - </div> | ||
| 137 | - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | ||
| 138 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 139 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 140 | - </div> | ||
| 141 | - </script> | ||
| 142 | - | ||
| 143 | - <script> | ||
| 144 | - (function () { | ||
| 145 | - var modal = '#add-sub-task-other-modal', | ||
| 146 | - sch, stationRoutes, parks, information; | ||
| 147 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 148 | - $(modal).on('init', function (e, data) { | ||
| 149 | - e.stopPropagation(); | ||
| 150 | - sch = data.sch; | ||
| 151 | - var formHtml = template('sub-task-other-form-temp', {sch: sch, adjustExps: adjustExps}); | ||
| 152 | - $('form', modal).html(formHtml); | ||
| 153 | - //字典转换 | ||
| 154 | - dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 155 | - | ||
| 156 | - //站点路由 | ||
| 157 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 158 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 159 | - }), 'directions'); | ||
| 160 | - //停车场 | ||
| 161 | - $.get('/basic/parks', function (rs) { | ||
| 162 | - parks = rs; | ||
| 163 | - }); | ||
| 164 | - //线路标准 | ||
| 165 | - information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 166 | - | ||
| 167 | - //submit | ||
| 168 | - var f = $('form', modal).formValidation(gb_form_validation_opts); | ||
| 169 | - f.on('success.form.fv', function (e) { | ||
| 170 | - disabled_submit_btn(this); | ||
| 171 | - e.preventDefault(); | ||
| 172 | - var data = $(this).serializeJSON(); | ||
| 173 | - | ||
| 174 | - //需要关联的部分主任务属性 | ||
| 175 | - data['schedule.xlBm'] = sch.xlBm; | ||
| 176 | - data['schedule.xlDir'] = sch.xlDir; | ||
| 177 | - gb_common.$post('/childTask/history', data, function (rs) { | ||
| 178 | - notify_succ('子任务添加成功'); | ||
| 179 | - $('#history-sch-edit-modal').trigger('init', {id: sch.id}); | ||
| 180 | - UIkit.modal(modal).hide(); | ||
| 181 | - }); | ||
| 182 | - }); | ||
| 183 | - | ||
| 184 | - //班次类型 | ||
| 185 | - $('[name=type2]', f).on('change', function () { | ||
| 186 | - $('.inout_reason_wrap').hide(); | ||
| 187 | - var routes = stationRoutes[sch.xlDir] | ||
| 188 | - , lastCode = routes[routes.length - 1].stationCode | ||
| 189 | - , opts = '', park_opts = ''; | ||
| 190 | - //station options | ||
| 191 | - $.each(routes, function () { | ||
| 192 | - opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 193 | - }); | ||
| 194 | - //park options | ||
| 195 | - for (var code in parks) | ||
| 196 | - park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 197 | - | ||
| 198 | - var qdz = $('[name=startStation]', f), zdz = $('[name=endStation]', f), mType = $('[name=mileageType]', f); | ||
| 199 | - switch ($(this).val()) { | ||
| 200 | - case '3'://出场 | ||
| 201 | - qdz.html(park_opts).val(information.carPark); | ||
| 202 | - zdz.html(opts); | ||
| 203 | - mType.val('empty'); | ||
| 204 | - //进出场原因 | ||
| 205 | - $('.inout_reason_wrap').show(); | ||
| 206 | - break; | ||
| 207 | - case '2'://进场 | ||
| 208 | - qdz.html(opts); | ||
| 209 | - zdz.html(park_opts).val(information.carPark); | ||
| 210 | - mType.val('empty'); | ||
| 211 | - //进出场原因 | ||
| 212 | - $('.inout_reason_wrap').show(); | ||
| 213 | - break; | ||
| 214 | - default: | ||
| 215 | - qdz.html(opts); | ||
| 216 | - zdz.html(opts).val(lastCode); | ||
| 217 | - mType.val('service'); | ||
| 218 | - | ||
| 219 | - } | ||
| 220 | - }); | ||
| 221 | - | ||
| 222 | - //是否烂班 | ||
| 223 | - $('[name=destroy]', f).on('click', function () { | ||
| 224 | - console.log(this, this.checked); | ||
| 225 | - if (this.checked) { | ||
| 226 | - $('.destroy_reason_wrap', modal).show(); | ||
| 227 | - } | ||
| 228 | - else { | ||
| 229 | - $('.destroy_reason_wrap', modal).hide(); | ||
| 230 | - } | ||
| 231 | - }); | ||
| 232 | - | ||
| 233 | - $('[name=destroyReason]', f).on('change', function () { | ||
| 234 | - var rem = $('[name=remarks]', f); | ||
| 235 | - rem.val(rem.val() + $(this).val() + ','); | ||
| 236 | - }); | ||
| 237 | - }); | ||
| 238 | - })(); | ||
| 239 | - </script> | ||
| 240 | -</div> | 1 | +<div class="uk-modal ct-form-modal ct_move_modal" id="add-sub-task-other-modal"> |
| 2 | + <div class="uk-modal-dialog" style="width: 635px;"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>自定义子任务</h2></div> | ||
| 6 | + <form class="uk-form uk-form-horizontal"> | ||
| 7 | + </form> | ||
| 8 | + </div> | ||
| 9 | + | ||
| 10 | + <script id="sub-task-other-form-temp" type="text/html"> | ||
| 11 | + <input type="hidden" value="{{sch.id}}" name="schedule.id"> | ||
| 12 | + <div class="uk-grid"> | ||
| 13 | + <div class="uk-width-1-2"> | ||
| 14 | + <div class="uk-form-row"> | ||
| 15 | + <label class="uk-form-label">班次类型</label> | ||
| 16 | + <div class="uk-form-controls"> | ||
| 17 | + <select class="form-control" name="type1" style="width: 65px;"> | ||
| 18 | + <option>正常</option> | ||
| 19 | + <option>临加</option> | ||
| 20 | + </select> | ||
| 21 | + <select class="form-control nt-dictionary" name="type2" data-group=ChildTaskType | ||
| 22 | + style="width: 126px;;"></select> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 25 | + </div> | ||
| 26 | + | ||
| 27 | + <div class="uk-width-1-2 inout_reason_wrap" style="display: none"> | ||
| 28 | + <div class="uk-form-row"> | ||
| 29 | + <label class="uk-form-label">进出场原因</label> | ||
| 30 | + <div class="uk-form-controls"> | ||
| 31 | + <select class="form-control" name="reason" required> | ||
| 32 | + <option value="">请选择..</option> | ||
| 33 | + <option>故障</option> | ||
| 34 | + <option>肇事</option> | ||
| 35 | + <option>纠纷</option> | ||
| 36 | + <option>其他</option> | ||
| 37 | + </select> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 40 | + </div> | ||
| 41 | + | ||
| 42 | + </div> | ||
| 43 | + <div class="uk-grid"> | ||
| 44 | + <div class="uk-width-1-2"> | ||
| 45 | + <div class="uk-form-row"> | ||
| 46 | + <label class="uk-form-label">起点 </label> | ||
| 47 | + <div class="uk-form-controls"> | ||
| 48 | + <select name="startStation" required></select> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + </div> | ||
| 52 | + <div class="uk-width-1-2"> | ||
| 53 | + <div class="uk-form-row"> | ||
| 54 | + <label class="uk-form-label">终点</label> | ||
| 55 | + <div class="uk-form-controls"> | ||
| 56 | + <select name="endStation" required></select> | ||
| 57 | + </div> | ||
| 58 | + </div> | ||
| 59 | + </div> | ||
| 60 | + </div> | ||
| 61 | + | ||
| 62 | + <div class="uk-grid"> | ||
| 63 | + <div class="uk-width-1-2"> | ||
| 64 | + <div class="uk-form-row"> | ||
| 65 | + <label class="uk-form-label">里程类型</label> | ||
| 66 | + <div class="uk-form-controls"> | ||
| 67 | + <select class="form-control nt-dictionary" required name="mileageType" | ||
| 68 | + data-group="MileageType"></select> | ||
| 69 | + </div> | ||
| 70 | + </div> | ||
| 71 | + </div> | ||
| 72 | + <div class="uk-width-1-2"> | ||
| 73 | + <div class="uk-form-row"> | ||
| 74 | + <label class="uk-form-label">公里数</label> | ||
| 75 | + <div class="uk-form-controls"> | ||
| 76 | + <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false" required> | ||
| 77 | + </div> | ||
| 78 | + </div> | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + | ||
| 82 | + <div class="uk-grid"> | ||
| 83 | + <div class="uk-width-1-2"> | ||
| 84 | + <div class="uk-form-row"> | ||
| 85 | + <label class="uk-form-label">开始时间</label> | ||
| 86 | + <div class="uk-form-controls"> | ||
| 87 | + <input name="startDate" value="{{sch.fcsj}}" type="time" required> | ||
| 88 | + </div> | ||
| 89 | + </div> | ||
| 90 | + </div> | ||
| 91 | + <div class="uk-width-1-2"> | ||
| 92 | + <div class="uk-form-row"> | ||
| 93 | + <label class="uk-form-label">结束时间</label> | ||
| 94 | + <div class="uk-form-controls"> | ||
| 95 | + <input name="endDate" value="{{sch.zdsj}}" type="time" required> | ||
| 96 | + </div> | ||
| 97 | + </div> | ||
| 98 | + </div> | ||
| 99 | + </div> | ||
| 100 | + | ||
| 101 | + <div class="uk-grid"> | ||
| 102 | + <div class="uk-width-1-2"> | ||
| 103 | + <div class="uk-form-row" style="padding-top: 5px;"> | ||
| 104 | + <label class="uk-form-label"></label> | ||
| 105 | + <div class="uk-form-controls"> | ||
| 106 | + <label> | ||
| 107 | + <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班 | ||
| 108 | + </label> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | + <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;"> | ||
| 113 | + <div class="uk-form-row"> | ||
| 114 | + <label class="uk-form-label">烂班原因</label> | ||
| 115 | + <div class="uk-form-controls"> | ||
| 116 | + <select class="form-control" name="destroyReason"> | ||
| 117 | + <option value="">请选择...</option> | ||
| 118 | + {{each adjustExps as exp i}} | ||
| 119 | + <option value="{{exp}}">{{exp}}</option> | ||
| 120 | + {{/each}} | ||
| 121 | + </select> | ||
| 122 | + </div> | ||
| 123 | + </div> | ||
| 124 | + </div> | ||
| 125 | + </div> | ||
| 126 | + | ||
| 127 | + <div class="uk-grid"> | ||
| 128 | + <div class="uk-width-1-1"> | ||
| 129 | + <div class="uk-form-row ct-stacked"> | ||
| 130 | + <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 131 | + <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" | ||
| 132 | + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 133 | + </div> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + </div> | ||
| 137 | + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | ||
| 138 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 139 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 140 | + </div> | ||
| 141 | + </script> | ||
| 142 | + | ||
| 143 | + <script> | ||
| 144 | + (function () { | ||
| 145 | + var modal = '#add-sub-task-other-modal', | ||
| 146 | + sch, stationRoutes, parks, information; | ||
| 147 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 148 | + $(modal).on('init', function (e, data) { | ||
| 149 | + e.stopPropagation(); | ||
| 150 | + sch = data.sch; | ||
| 151 | + var formHtml = template('sub-task-other-form-temp', {sch: sch, adjustExps: adjustExps}); | ||
| 152 | + $('form', modal).html(formHtml); | ||
| 153 | + //字典转换 | ||
| 154 | + dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 155 | + | ||
| 156 | + //站点路由 | ||
| 157 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 158 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 159 | + }), 'directions'); | ||
| 160 | + //停车场 | ||
| 161 | + $.get('/basic/parks', function (rs) { | ||
| 162 | + parks = rs; | ||
| 163 | + }); | ||
| 164 | + //线路标准 | ||
| 165 | + information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 166 | + | ||
| 167 | + //submit | ||
| 168 | + var f = $('form', modal).formValidation(gb_form_validation_opts); | ||
| 169 | + f.on('success.form.fv', function (e) { | ||
| 170 | + disabled_submit_btn(this); | ||
| 171 | + e.preventDefault(); | ||
| 172 | + var data = $(this).serializeJSON(); | ||
| 173 | + | ||
| 174 | + //需要关联的部分主任务属性 | ||
| 175 | + data['schedule.xlBm'] = sch.xlBm; | ||
| 176 | + data['schedule.xlDir'] = sch.xlDir; | ||
| 177 | + gb_common.$post('/childTask/history', data, function (rs) { | ||
| 178 | + notify_succ('子任务添加成功'); | ||
| 179 | + $('#history-sch-edit-modal').trigger('init', {id: sch.id}); | ||
| 180 | + UIkit.modal(modal).hide(); | ||
| 181 | + }); | ||
| 182 | + }); | ||
| 183 | + | ||
| 184 | + //班次类型 | ||
| 185 | + $('[name=type2]', f).on('change', function () { | ||
| 186 | + $('.inout_reason_wrap').hide(); | ||
| 187 | + var routes = stationRoutes[sch.xlDir] | ||
| 188 | + , lastCode = routes[routes.length - 1].stationCode | ||
| 189 | + , opts = '', park_opts = ''; | ||
| 190 | + //station options | ||
| 191 | + $.each(routes, function () { | ||
| 192 | + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 193 | + }); | ||
| 194 | + //park options | ||
| 195 | + for (var code in parks) | ||
| 196 | + park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 197 | + | ||
| 198 | + var qdz = $('[name=startStation]', f), zdz = $('[name=endStation]', f), mType = $('[name=mileageType]', f); | ||
| 199 | + switch ($(this).val()) { | ||
| 200 | + case '3'://出场 | ||
| 201 | + qdz.html(park_opts).val(information.carPark); | ||
| 202 | + zdz.html(opts); | ||
| 203 | + mType.val('empty'); | ||
| 204 | + //进出场原因 | ||
| 205 | + $('.inout_reason_wrap').show(); | ||
| 206 | + break; | ||
| 207 | + case '2'://进场 | ||
| 208 | + qdz.html(opts); | ||
| 209 | + zdz.html(park_opts).val(information.carPark); | ||
| 210 | + mType.val('empty'); | ||
| 211 | + //进出场原因 | ||
| 212 | + $('.inout_reason_wrap').show(); | ||
| 213 | + break; | ||
| 214 | + default: | ||
| 215 | + qdz.html(opts); | ||
| 216 | + zdz.html(opts).val(lastCode); | ||
| 217 | + mType.val('service'); | ||
| 218 | + | ||
| 219 | + } | ||
| 220 | + }); | ||
| 221 | + | ||
| 222 | + //是否烂班 | ||
| 223 | + $('[name=destroy]', f).on('click', function () { | ||
| 224 | + console.log(this, this.checked); | ||
| 225 | + if (this.checked) { | ||
| 226 | + $('.destroy_reason_wrap', modal).show(); | ||
| 227 | + } | ||
| 228 | + else { | ||
| 229 | + $('.destroy_reason_wrap', modal).hide(); | ||
| 230 | + } | ||
| 231 | + }); | ||
| 232 | + | ||
| 233 | + $('[name=destroyReason]', f).on('change', function () { | ||
| 234 | + var rem = $('[name=remarks]', f); | ||
| 235 | + rem.val(rem.val() + $(this).val() + ','); | ||
| 236 | + }); | ||
| 237 | + }); | ||
| 238 | + })(); | ||
| 239 | + </script> | ||
| 240 | +</div> |
src/main/resources/static/real_control_v2/js/common.js
| 1 | -var gb_common = (function () { | ||
| 2 | - | ||
| 3 | - var flatpickrDateTimeConfig = { | ||
| 4 | - enableTime: true, | ||
| 5 | - time_24hr: true, | ||
| 6 | - "locale": "zh", | ||
| 7 | - onOpen: function () { | ||
| 8 | - $(this.calendarContainer).addClass('showTimeInput'); | ||
| 9 | - } | ||
| 10 | - }; | ||
| 11 | - var reqCode80 = { | ||
| 12 | - 0xA1: '请求恢复运营', | ||
| 13 | - 0xA2: '申请调档', | ||
| 14 | - 0xA3: '出场请求', | ||
| 15 | - 0xA5: '进场请求', | ||
| 16 | - 0xA7: '加油请求', | ||
| 17 | - 0x50: '车辆故障', | ||
| 18 | - 0x70: '路阻报告', | ||
| 19 | - 0x60: '事故报告', | ||
| 20 | - 0x11: '扣证纠纷', | ||
| 21 | - 0x12: '报警' | ||
| 22 | - }; | ||
| 23 | - | ||
| 24 | - var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 25 | - var inOutExps = ['故障', '肇事', '纠纷', '其他']; | ||
| 26 | - | ||
| 27 | - var groupBy = function (list, field) { | ||
| 28 | - var rs = {}, | ||
| 29 | - key; | ||
| 30 | - $.each(list, function () { | ||
| 31 | - key = this[field]; | ||
| 32 | - if (!rs[key]) | ||
| 33 | - rs[key] = []; | ||
| 34 | - | ||
| 35 | - rs[key].push(this); | ||
| 36 | - }); | ||
| 37 | - | ||
| 38 | - return rs; | ||
| 39 | - }; | ||
| 40 | - | ||
| 41 | - /** | ||
| 42 | - * 从班次集合里提取驾驶员 | ||
| 43 | - * @param list | ||
| 44 | - */ | ||
| 45 | - var extractJsy = function (list) { | ||
| 46 | - var rs = {}; | ||
| 47 | - $.each(list, function () { | ||
| 48 | - rs[this.jGh + '/' + this.jName]=1; | ||
| 49 | - }); | ||
| 50 | - return rs; | ||
| 51 | - }; | ||
| 52 | - | ||
| 53 | - /** | ||
| 54 | - * 从班次集合里提取路牌 | ||
| 55 | - * @param list | ||
| 56 | - */ | ||
| 57 | - var extractLpName = function (list) { | ||
| 58 | - var rs = {}; | ||
| 59 | - $.each(list, function () { | ||
| 60 | - rs[this.lpName]=1; | ||
| 61 | - }); | ||
| 62 | - return rs; | ||
| 63 | - }; | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * 从班次集合里提取车辆 | ||
| 67 | - * @param list | ||
| 68 | - */ | ||
| 69 | - var extractNbbm = function (list) { | ||
| 70 | - var rs = {}; | ||
| 71 | - $.each(list, function () { | ||
| 72 | - rs[this.clZbh]=1; | ||
| 73 | - }); | ||
| 74 | - return rs; | ||
| 75 | - }; | ||
| 76 | - | ||
| 77 | - var compileTempByDom = function (dom, opts) { | ||
| 78 | - var tps = {}, | ||
| 79 | - id; | ||
| 80 | - $('script[type="text/html"]', dom).each(function () { | ||
| 81 | - id = $(this).attr('id'); | ||
| 82 | - if (id) | ||
| 83 | - tps[id] = template.compile($(this).html(), opts); | ||
| 84 | - }); | ||
| 85 | - return tps; | ||
| 86 | - }; | ||
| 87 | - | ||
| 88 | - var $get = function (url, data, successFun) { | ||
| 89 | - $.ajax({ | ||
| 90 | - url: url, | ||
| 91 | - data: data, | ||
| 92 | - complete: function (xhr, ts) { | ||
| 93 | - ajaxComplete(xhr, ts, successFun); | ||
| 94 | - } | ||
| 95 | - }); | ||
| 96 | - }; | ||
| 97 | - | ||
| 98 | - var $post = function (url, data, successFun, errFun) { | ||
| 99 | - $.ajax({ | ||
| 100 | - url: url, | ||
| 101 | - method: 'POST', | ||
| 102 | - data: data, | ||
| 103 | - complete: function (xhr, ts) { | ||
| 104 | - ajaxComplete(xhr, ts, successFun, errFun); | ||
| 105 | - } | ||
| 106 | - }); | ||
| 107 | - }; | ||
| 108 | - | ||
| 109 | - var $post_arr = function (url, data, successFun) { | ||
| 110 | - $.ajax({ | ||
| 111 | - url: url, | ||
| 112 | - method: 'POST', | ||
| 113 | - traditional: true, | ||
| 114 | - data: data, | ||
| 115 | - complete: function (xhr, ts) { | ||
| 116 | - ajaxComplete(xhr, ts, successFun); | ||
| 117 | - } | ||
| 118 | - }); | ||
| 119 | - }; | ||
| 120 | - | ||
| 121 | - var $del = function (url, successFun) { | ||
| 122 | - $post(url, {'_method': 'delete'}, function (rs) { | ||
| 123 | - successFun && successFun(rs); | ||
| 124 | - }); | ||
| 125 | - }; | ||
| 126 | - | ||
| 127 | - var errorHead = '<span style="color:red;">异常:</span>'; | ||
| 128 | - | ||
| 129 | - function successHandle(json, handle, err) { | ||
| 130 | - var status = json.status; | ||
| 131 | - if (status == 407) { | ||
| 132 | - location.href = '/login.html'; | ||
| 133 | - return; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - if (!status) { | ||
| 137 | - handle && handle(json); | ||
| 138 | - return; | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - if (status == 'ERROR'){ | ||
| 142 | - UIkit.modal.alert(errorHead + (json.msg ? json.msg : '未知异常'), {labels: {Ok: '确定'}}); | ||
| 143 | - //关闭wait窗口 | ||
| 144 | - hide_wait_modal(); | ||
| 145 | - err && err(); | ||
| 146 | - } | ||
| 147 | - else | ||
| 148 | - handle && handle(json); | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - function ajaxComplete(xhr, ts, succ, err) { | ||
| 152 | - if (ts == 'success') { | ||
| 153 | - successHandle(JSON.parse(xhr.responseText), succ, err); | ||
| 154 | - } else if (ts == 'error') { | ||
| 155 | - UIkit.modal.alert(errorHead + xhr.responseText, {labels: {Ok: '确定'}}); | ||
| 156 | - //关闭wait窗口 | ||
| 157 | - hide_wait_modal(); | ||
| 158 | - err && err(); | ||
| 159 | - } | ||
| 160 | - } | ||
| 161 | - | ||
| 162 | - var get_vals = function (json) { | ||
| 163 | - var array = []; | ||
| 164 | - for (var key in json) { | ||
| 165 | - array.push(json[key]); | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - return array; | ||
| 169 | - }; | ||
| 170 | - | ||
| 171 | - var get_keys = function (json) { | ||
| 172 | - var array = []; | ||
| 173 | - for (var key in json) { | ||
| 174 | - array.push(key); | ||
| 175 | - } | ||
| 176 | - return array; | ||
| 177 | - }; | ||
| 178 | - | ||
| 179 | - var get_device_tree_data = function (allGps, idBefore) { | ||
| 180 | - if (!idBefore) | ||
| 181 | - idBefore = ''; | ||
| 182 | - var treeData = []; | ||
| 183 | - //var data = groupBy(get_vals(gb_data_gps.allGps), 'lineId'); | ||
| 184 | - var data = groupBy(get_vals(allGps), 'lineId'); | ||
| 185 | - var name; | ||
| 186 | - for (var code in data) { | ||
| 187 | - try { | ||
| 188 | - name = gb_data_basic.codeToLine[code].name; | ||
| 189 | - } catch (e) { | ||
| 190 | - continue; | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - data[name] = groupBy(data[code], 'upDown'); | ||
| 194 | - treeData.push({ | ||
| 195 | - 'text': name, | ||
| 196 | - 'a_attr': {'type': 'line', 'id': idBefore + 'line_' + code}, | ||
| 197 | - 'children': [{ | ||
| 198 | - 'text': '上行', | ||
| 199 | - 'children': grabs(data[name][0], idBefore), | ||
| 200 | - 'a_attr': { | ||
| 201 | - 'type': 'route', | ||
| 202 | - 'route': code + '_0', | ||
| 203 | - 'id': idBefore + 'route_' + code + '_0' | ||
| 204 | - } | ||
| 205 | - }, { | ||
| 206 | - 'text': '下行', | ||
| 207 | - 'children': grabs(data[name][1], idBefore), | ||
| 208 | - 'a_attr': { | ||
| 209 | - 'type': 'route', | ||
| 210 | - 'route': code + '_1', | ||
| 211 | - 'id': idBefore + 'route_' + code + '_1' | ||
| 212 | - } | ||
| 213 | - }] | ||
| 214 | - }); | ||
| 215 | - } | ||
| 216 | - | ||
| 217 | - function grabs(array, idBefore) { | ||
| 218 | - if (!array) | ||
| 219 | - return; | ||
| 220 | - var rs = []; | ||
| 221 | - $.each(array, function () { | ||
| 222 | - rs.push({ | ||
| 223 | - 'text': this.nbbm, | ||
| 224 | - 'a_attr': { | ||
| 225 | - 'type': 'device', | ||
| 226 | - 'device': this.deviceId, | ||
| 227 | - 'id': idBefore + 'device_' + this.nbbm | ||
| 228 | - }, | ||
| 229 | - 'data': {lineId: this.lineId, upDown: this.upDown}, | ||
| 230 | - 'icon': 'uk-icon-bus' | ||
| 231 | - }); | ||
| 232 | - }); | ||
| 233 | - return rs; | ||
| 234 | - } | ||
| 235 | - | ||
| 236 | - return treeData; | ||
| 237 | - }; | ||
| 238 | - | ||
| 239 | - var lineAutocomplete = function (element) { | ||
| 240 | - //construction data | ||
| 241 | - var data = [], | ||
| 242 | - code2Name = gb_data_basic.lineCode2NameAll(), | ||
| 243 | - name; | ||
| 244 | - for (var code in code2Name) { | ||
| 245 | - name = code2Name[code]; | ||
| 246 | - data.push({ | ||
| 247 | - value: name, | ||
| 248 | - code: code, | ||
| 249 | - fullChars: pinyin.getFullChars(name), | ||
| 250 | - camelChars: pinyin.getCamelChars(name) | ||
| 251 | - }); | ||
| 252 | - } | ||
| 253 | - init_autocom_pinyin(element, data); | ||
| 254 | - }; | ||
| 255 | - | ||
| 256 | - var personAutocomplete = function (element, personMaps) { | ||
| 257 | - /*var data = [],name; | ||
| 258 | - for(var jobCode in personMaps){ | ||
| 259 | - name=personMaps[jobCode]; | ||
| 260 | - data.push({ | ||
| 261 | - value: jobCode+'/'+name, | ||
| 262 | - fullChars: pinyin.getFullChars(name).toUpperCase(), | ||
| 263 | - camelChars: pinyin.getCamelChars(name) | ||
| 264 | - }); | ||
| 265 | - }*/ | ||
| 266 | - //init_autocom_pinyin(element, data); | ||
| 267 | - init_autocom_pinyin(element, gb_data_basic.allPersonnel()); | ||
| 268 | - }; | ||
| 269 | - | ||
| 270 | - var remarksAutocomplete = function (element) { | ||
| 271 | - init_autocom_pinyin(element, gb_data_basic.remarksMapps()); | ||
| 272 | - }; | ||
| 273 | - | ||
| 274 | - var carAutocomplete = function (element, list) { | ||
| 275 | - var data = []; | ||
| 276 | - $.each(list, function () { | ||
| 277 | - data.push({value: this}); | ||
| 278 | - }); | ||
| 279 | - init_autocomplete(element, data); | ||
| 280 | - }; | ||
| 281 | - | ||
| 282 | - var init_autocom_pinyin = function (element, data) { | ||
| 283 | - // init autocomplete | ||
| 284 | - var autocomplete = UIkit.autocomplete(element, { | ||
| 285 | - minLength: 1, | ||
| 286 | - delay: 50, | ||
| 287 | - source: function (release) { | ||
| 288 | - var q = $('input', element).val().toUpperCase(), | ||
| 289 | - rs = [], | ||
| 290 | - count = 0; | ||
| 291 | - | ||
| 292 | - $.each(data, function () { | ||
| 293 | - if (this.value.indexOf(q) != -1 || this.fullChars.indexOf(q) != -1 || this.camelChars.indexOf(q) != -1) { | ||
| 294 | - rs.push(this); | ||
| 295 | - count++; | ||
| 296 | - } | ||
| 297 | - | ||
| 298 | - if (count >= 10) | ||
| 299 | - return false; | ||
| 300 | - }); | ||
| 301 | - | ||
| 302 | - release && release(rs); | ||
| 303 | - } | ||
| 304 | - }); | ||
| 305 | - }; | ||
| 306 | - | ||
| 307 | - var init_autocomplete = function (element, data) { | ||
| 308 | - var autocomplete = UIkit.autocomplete(element, { | ||
| 309 | - minLength: 1, | ||
| 310 | - delay: 50, | ||
| 311 | - source: function (release) { | ||
| 312 | - var q = $('input', element).val().toUpperCase(), | ||
| 313 | - rs = [], | ||
| 314 | - count = 0; | ||
| 315 | - | ||
| 316 | - $.each(data, function () { | ||
| 317 | - if (this.value.indexOf(q) != -1) { | ||
| 318 | - rs.push(this); | ||
| 319 | - count++; | ||
| 320 | - } | ||
| 321 | - if (count >= 10) | ||
| 322 | - return false; | ||
| 323 | - }); | ||
| 324 | - release && release(rs); | ||
| 325 | - } | ||
| 326 | - }); | ||
| 327 | - }; | ||
| 328 | - | ||
| 329 | - var accAdd = function (a, b) { | ||
| 330 | - var c, d, e; | ||
| 331 | - try { | ||
| 332 | - c = a.toString().split(".")[1].length; | ||
| 333 | - } catch (f) { | ||
| 334 | - c = 0; | ||
| 335 | - } | ||
| 336 | - try { | ||
| 337 | - d = b.toString().split(".")[1].length; | ||
| 338 | - } catch (f) { | ||
| 339 | - d = 0; | ||
| 340 | - } | ||
| 341 | - return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e; | ||
| 342 | - }; | ||
| 343 | - | ||
| 344 | - function accDiv(arg1,arg2){ | ||
| 345 | - var t1=0,t2=0,r1,r2; | ||
| 346 | - try{t1=arg1.toString().split(".")[1].length}catch(e){} | ||
| 347 | - try{t2=arg2.toString().split(".")[1].length}catch(e){} | ||
| 348 | - with(Math){ | ||
| 349 | - r1=Number(arg1.toString().replace(".","")) | ||
| 350 | - r2=Number(arg2.toString().replace(".","")) | ||
| 351 | - return (r1/r2)*pow(10,t2-t1); | ||
| 352 | - } | ||
| 353 | - } | ||
| 354 | - | ||
| 355 | - function mul(a, b) { | ||
| 356 | - var c = 0, | ||
| 357 | - d = a.toString(), | ||
| 358 | - e = b.toString(); | ||
| 359 | - try { | ||
| 360 | - c += d.split(".")[1].length; | ||
| 361 | - } catch (f) { | ||
| 362 | - } | ||
| 363 | - try { | ||
| 364 | - c += e.split(".")[1].length; | ||
| 365 | - } catch (f) { | ||
| 366 | - } | ||
| 367 | - return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c); | ||
| 368 | - } | ||
| 369 | - | ||
| 370 | - var numSubtr = function (a, b) { | ||
| 371 | - var c, d, e; | ||
| 372 | - try { | ||
| 373 | - c = a.toString().split(".")[1].length; | ||
| 374 | - } catch (f) { | ||
| 375 | - c = 0; | ||
| 376 | - } | ||
| 377 | - try { | ||
| 378 | - d = b.toString().split(".")[1].length; | ||
| 379 | - } catch (f) { | ||
| 380 | - d = 0; | ||
| 381 | - } | ||
| 382 | - return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e; | ||
| 383 | - }; | ||
| 384 | - | ||
| 385 | - var trim = function (str, is_global) { | ||
| 386 | - var result; | ||
| 387 | - result = str.replace(/(^\s+)|(\s+$)/g, ""); | ||
| 388 | - if (is_global.toLowerCase() == "g") { | ||
| 389 | - result = result.replace(/\s/g, ""); | ||
| 390 | - } | ||
| 391 | - return result; | ||
| 392 | - }; | ||
| 393 | - | ||
| 394 | - var inverse = function (map) { | ||
| 395 | - var rs = {}; | ||
| 396 | - for(var k in map){ | ||
| 397 | - rs[map[k]] = k; | ||
| 398 | - } | ||
| 399 | - | ||
| 400 | - return rs; | ||
| 401 | - }; | ||
| 402 | - | ||
| 403 | - var next_elem = function (clazz, e) { | ||
| 404 | - var ne = e.next(); | ||
| 405 | - if(ne.length==0) | ||
| 406 | - return []; | ||
| 407 | - else if(ne.hasClass(clazz)) | ||
| 408 | - return ne; | ||
| 409 | - else | ||
| 410 | - return next_elem(clazz, ne); | ||
| 411 | - }; | ||
| 412 | - | ||
| 413 | - var getDisabledVal = function (f) { | ||
| 414 | - var rs = {}; | ||
| 415 | - $('input,select', f).each(function () { | ||
| 416 | - if($(this).attr('disabled')){ | ||
| 417 | - rs[$(this).attr('name')]=$(this).val(); | ||
| 418 | - } | ||
| 419 | - }); | ||
| 420 | - return rs; | ||
| 421 | - }; | ||
| 422 | - | ||
| 423 | - return { | ||
| 424 | - reqCode80: reqCode80, | ||
| 425 | - groupBy: groupBy, | ||
| 426 | - extractJsy: extractJsy, | ||
| 427 | - extractLpName: extractLpName, | ||
| 428 | - compileTempByDom: compileTempByDom, | ||
| 429 | - $get: $get, | ||
| 430 | - $post: $post, | ||
| 431 | - $post_arr: $post_arr, | ||
| 432 | - $del: $del, | ||
| 433 | - get_vals: get_vals, | ||
| 434 | - get_keys: get_keys, | ||
| 435 | - get_device_tree_data: get_device_tree_data, | ||
| 436 | - lineAutocomplete: lineAutocomplete, | ||
| 437 | - personAutocomplete: personAutocomplete, | ||
| 438 | - carAutocomplete: carAutocomplete, | ||
| 439 | - init_autocomplete: init_autocomplete, | ||
| 440 | - init_autocom_pinyin: init_autocom_pinyin, | ||
| 441 | - accAdd: accAdd, | ||
| 442 | - numSubtr: numSubtr, | ||
| 443 | - trim: trim, | ||
| 444 | - remarksAutocomplete: remarksAutocomplete, | ||
| 445 | - flatpickrDateTimeConfig: flatpickrDateTimeConfig, | ||
| 446 | - inverse: inverse, | ||
| 447 | - accDiv: accDiv, | ||
| 448 | - mul: mul, | ||
| 449 | - adjustExps: adjustExps, | ||
| 450 | - inOutExps: inOutExps, | ||
| 451 | - next_elem: next_elem, | ||
| 452 | - getDisabledVal: getDisabledVal, | ||
| 453 | - extractNbbm: extractNbbm | ||
| 454 | - | ||
| 455 | - //whichTransitionEvent:whichTransitionEvent | ||
| 456 | - }; | ||
| 457 | -})(); | 1 | +var gb_common = (function () { |
| 2 | + | ||
| 3 | + var flatpickrDateTimeConfig = { | ||
| 4 | + enableTime: true, | ||
| 5 | + time_24hr: true, | ||
| 6 | + "locale": "zh", | ||
| 7 | + onOpen: function () { | ||
| 8 | + $(this.calendarContainer).addClass('showTimeInput'); | ||
| 9 | + } | ||
| 10 | + }; | ||
| 11 | + var reqCode80 = { | ||
| 12 | + 0xA1: '请求恢复运营', | ||
| 13 | + 0xA2: '申请调档', | ||
| 14 | + 0xA3: '出场请求', | ||
| 15 | + 0xA5: '进场请求', | ||
| 16 | + 0xA7: '加油请求', | ||
| 17 | + 0x50: '车辆故障', | ||
| 18 | + 0x70: '路阻报告', | ||
| 19 | + 0x60: '事故报告', | ||
| 20 | + 0x11: '扣证纠纷', | ||
| 21 | + 0x12: '报警' | ||
| 22 | + }; | ||
| 23 | + | ||
| 24 | + var adjustExps = ['保养', '故障', '事故', '路阻', '纠纷', '缺人', '验车', '天气', '支援', '借调', '其他']; | ||
| 25 | + var inOutExps = ['故障', '肇事', '纠纷', '其他']; | ||
| 26 | + | ||
| 27 | + var groupBy = function (list, field) { | ||
| 28 | + var rs = {}, | ||
| 29 | + key; | ||
| 30 | + $.each(list, function () { | ||
| 31 | + key = this[field]; | ||
| 32 | + if (!rs[key]) | ||
| 33 | + rs[key] = []; | ||
| 34 | + | ||
| 35 | + rs[key].push(this); | ||
| 36 | + }); | ||
| 37 | + | ||
| 38 | + return rs; | ||
| 39 | + }; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 从班次集合里提取驾驶员 | ||
| 43 | + * @param list | ||
| 44 | + */ | ||
| 45 | + var extractJsy = function (list) { | ||
| 46 | + var rs = {}; | ||
| 47 | + $.each(list, function () { | ||
| 48 | + rs[this.jGh + '/' + this.jName]=1; | ||
| 49 | + }); | ||
| 50 | + return rs; | ||
| 51 | + }; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 从班次集合里提取路牌 | ||
| 55 | + * @param list | ||
| 56 | + */ | ||
| 57 | + var extractLpName = function (list) { | ||
| 58 | + var rs = {}; | ||
| 59 | + $.each(list, function () { | ||
| 60 | + rs[this.lpName]=1; | ||
| 61 | + }); | ||
| 62 | + return rs; | ||
| 63 | + }; | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 从班次集合里提取车辆 | ||
| 67 | + * @param list | ||
| 68 | + */ | ||
| 69 | + var extractNbbm = function (list) { | ||
| 70 | + var rs = {}; | ||
| 71 | + $.each(list, function () { | ||
| 72 | + rs[this.clZbh]=1; | ||
| 73 | + }); | ||
| 74 | + return rs; | ||
| 75 | + }; | ||
| 76 | + | ||
| 77 | + var compileTempByDom = function (dom, opts) { | ||
| 78 | + var tps = {}, | ||
| 79 | + id; | ||
| 80 | + $('script[type="text/html"]', dom).each(function () { | ||
| 81 | + id = $(this).attr('id'); | ||
| 82 | + if (id) | ||
| 83 | + tps[id] = template.compile($(this).html(), opts); | ||
| 84 | + }); | ||
| 85 | + return tps; | ||
| 86 | + }; | ||
| 87 | + | ||
| 88 | + var $get = function (url, data, successFun) { | ||
| 89 | + $.ajax({ | ||
| 90 | + url: url, | ||
| 91 | + data: data, | ||
| 92 | + complete: function (xhr, ts) { | ||
| 93 | + ajaxComplete(xhr, ts, successFun); | ||
| 94 | + } | ||
| 95 | + }); | ||
| 96 | + }; | ||
| 97 | + | ||
| 98 | + var $post = function (url, data, successFun, errFun) { | ||
| 99 | + $.ajax({ | ||
| 100 | + url: url, | ||
| 101 | + method: 'POST', | ||
| 102 | + data: data, | ||
| 103 | + complete: function (xhr, ts) { | ||
| 104 | + ajaxComplete(xhr, ts, successFun, errFun); | ||
| 105 | + } | ||
| 106 | + }); | ||
| 107 | + }; | ||
| 108 | + | ||
| 109 | + var $post_arr = function (url, data, successFun) { | ||
| 110 | + $.ajax({ | ||
| 111 | + url: url, | ||
| 112 | + method: 'POST', | ||
| 113 | + traditional: true, | ||
| 114 | + data: data, | ||
| 115 | + complete: function (xhr, ts) { | ||
| 116 | + ajaxComplete(xhr, ts, successFun); | ||
| 117 | + } | ||
| 118 | + }); | ||
| 119 | + }; | ||
| 120 | + | ||
| 121 | + var $del = function (url, successFun) { | ||
| 122 | + $post(url, {'_method': 'delete'}, function (rs) { | ||
| 123 | + successFun && successFun(rs); | ||
| 124 | + }); | ||
| 125 | + }; | ||
| 126 | + | ||
| 127 | + var errorHead = '<span style="color:red;">异常:</span>'; | ||
| 128 | + | ||
| 129 | + function successHandle(json, handle, err) { | ||
| 130 | + var status = json.status; | ||
| 131 | + if (status == 407) { | ||
| 132 | + location.href = '/login.html'; | ||
| 133 | + return; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + if (!status) { | ||
| 137 | + handle && handle(json); | ||
| 138 | + return; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + if (status == 'ERROR'){ | ||
| 142 | + UIkit.modal.alert(errorHead + (json.msg ? json.msg : '未知异常'), {labels: {Ok: '确定'}}); | ||
| 143 | + //关闭wait窗口 | ||
| 144 | + hide_wait_modal(); | ||
| 145 | + err && err(); | ||
| 146 | + } | ||
| 147 | + else | ||
| 148 | + handle && handle(json); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + function ajaxComplete(xhr, ts, succ, err) { | ||
| 152 | + if (ts == 'success') { | ||
| 153 | + successHandle(JSON.parse(xhr.responseText), succ, err); | ||
| 154 | + } else if (ts == 'error') { | ||
| 155 | + UIkit.modal.alert(errorHead + xhr.responseText, {labels: {Ok: '确定'}}); | ||
| 156 | + //关闭wait窗口 | ||
| 157 | + hide_wait_modal(); | ||
| 158 | + err && err(); | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + var get_vals = function (json) { | ||
| 163 | + var array = []; | ||
| 164 | + for (var key in json) { | ||
| 165 | + array.push(json[key]); | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + return array; | ||
| 169 | + }; | ||
| 170 | + | ||
| 171 | + var get_keys = function (json) { | ||
| 172 | + var array = []; | ||
| 173 | + for (var key in json) { | ||
| 174 | + array.push(key); | ||
| 175 | + } | ||
| 176 | + return array; | ||
| 177 | + }; | ||
| 178 | + | ||
| 179 | + var get_device_tree_data = function (allGps, idBefore) { | ||
| 180 | + if (!idBefore) | ||
| 181 | + idBefore = ''; | ||
| 182 | + var treeData = []; | ||
| 183 | + //var data = groupBy(get_vals(gb_data_gps.allGps), 'lineId'); | ||
| 184 | + var data = groupBy(get_vals(allGps), 'lineId'); | ||
| 185 | + var name; | ||
| 186 | + for (var code in data) { | ||
| 187 | + try { | ||
| 188 | + name = gb_data_basic.codeToLine[code].name; | ||
| 189 | + } catch (e) { | ||
| 190 | + continue; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + data[name] = groupBy(data[code], 'upDown'); | ||
| 194 | + treeData.push({ | ||
| 195 | + 'text': name, | ||
| 196 | + 'a_attr': {'type': 'line', 'id': idBefore + 'line_' + code}, | ||
| 197 | + 'children': [{ | ||
| 198 | + 'text': '上行', | ||
| 199 | + 'children': grabs(data[name][0], idBefore), | ||
| 200 | + 'a_attr': { | ||
| 201 | + 'type': 'route', | ||
| 202 | + 'route': code + '_0', | ||
| 203 | + 'id': idBefore + 'route_' + code + '_0' | ||
| 204 | + } | ||
| 205 | + }, { | ||
| 206 | + 'text': '下行', | ||
| 207 | + 'children': grabs(data[name][1], idBefore), | ||
| 208 | + 'a_attr': { | ||
| 209 | + 'type': 'route', | ||
| 210 | + 'route': code + '_1', | ||
| 211 | + 'id': idBefore + 'route_' + code + '_1' | ||
| 212 | + } | ||
| 213 | + }] | ||
| 214 | + }); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + function grabs(array, idBefore) { | ||
| 218 | + if (!array) | ||
| 219 | + return; | ||
| 220 | + var rs = []; | ||
| 221 | + $.each(array, function () { | ||
| 222 | + rs.push({ | ||
| 223 | + 'text': this.nbbm, | ||
| 224 | + 'a_attr': { | ||
| 225 | + 'type': 'device', | ||
| 226 | + 'device': this.deviceId, | ||
| 227 | + 'id': idBefore + 'device_' + this.nbbm | ||
| 228 | + }, | ||
| 229 | + 'data': {lineId: this.lineId, upDown: this.upDown}, | ||
| 230 | + 'icon': 'uk-icon-bus' | ||
| 231 | + }); | ||
| 232 | + }); | ||
| 233 | + return rs; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + return treeData; | ||
| 237 | + }; | ||
| 238 | + | ||
| 239 | + var lineAutocomplete = function (element) { | ||
| 240 | + //construction data | ||
| 241 | + var data = [], | ||
| 242 | + code2Name = gb_data_basic.lineCode2NameAll(), | ||
| 243 | + name; | ||
| 244 | + for (var code in code2Name) { | ||
| 245 | + name = code2Name[code]; | ||
| 246 | + data.push({ | ||
| 247 | + value: name, | ||
| 248 | + code: code, | ||
| 249 | + fullChars: pinyin.getFullChars(name), | ||
| 250 | + camelChars: pinyin.getCamelChars(name) | ||
| 251 | + }); | ||
| 252 | + } | ||
| 253 | + init_autocom_pinyin(element, data); | ||
| 254 | + }; | ||
| 255 | + | ||
| 256 | + var personAutocomplete = function (element, personMaps) { | ||
| 257 | + /*var data = [],name; | ||
| 258 | + for(var jobCode in personMaps){ | ||
| 259 | + name=personMaps[jobCode]; | ||
| 260 | + data.push({ | ||
| 261 | + value: jobCode+'/'+name, | ||
| 262 | + fullChars: pinyin.getFullChars(name).toUpperCase(), | ||
| 263 | + camelChars: pinyin.getCamelChars(name) | ||
| 264 | + }); | ||
| 265 | + }*/ | ||
| 266 | + //init_autocom_pinyin(element, data); | ||
| 267 | + init_autocom_pinyin(element, gb_data_basic.allPersonnel()); | ||
| 268 | + }; | ||
| 269 | + | ||
| 270 | + var remarksAutocomplete = function (element) { | ||
| 271 | + init_autocom_pinyin(element, gb_data_basic.remarksMapps()); | ||
| 272 | + }; | ||
| 273 | + | ||
| 274 | + var carAutocomplete = function (element, list) { | ||
| 275 | + var data = []; | ||
| 276 | + $.each(list, function () { | ||
| 277 | + data.push({value: this}); | ||
| 278 | + }); | ||
| 279 | + init_autocomplete(element, data); | ||
| 280 | + }; | ||
| 281 | + | ||
| 282 | + var init_autocom_pinyin = function (element, data) { | ||
| 283 | + // init autocomplete | ||
| 284 | + var autocomplete = UIkit.autocomplete(element, { | ||
| 285 | + minLength: 1, | ||
| 286 | + delay: 50, | ||
| 287 | + source: function (release) { | ||
| 288 | + var q = $('input', element).val().toUpperCase(), | ||
| 289 | + rs = [], | ||
| 290 | + count = 0; | ||
| 291 | + | ||
| 292 | + $.each(data, function () { | ||
| 293 | + if (this.value.indexOf(q) != -1 || this.fullChars.indexOf(q) != -1 || this.camelChars.indexOf(q) != -1) { | ||
| 294 | + rs.push(this); | ||
| 295 | + count++; | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + if (count >= 10) | ||
| 299 | + return false; | ||
| 300 | + }); | ||
| 301 | + | ||
| 302 | + release && release(rs); | ||
| 303 | + } | ||
| 304 | + }); | ||
| 305 | + }; | ||
| 306 | + | ||
| 307 | + var init_autocomplete = function (element, data) { | ||
| 308 | + var autocomplete = UIkit.autocomplete(element, { | ||
| 309 | + minLength: 1, | ||
| 310 | + delay: 50, | ||
| 311 | + source: function (release) { | ||
| 312 | + var q = $('input', element).val().toUpperCase(), | ||
| 313 | + rs = [], | ||
| 314 | + count = 0; | ||
| 315 | + | ||
| 316 | + $.each(data, function () { | ||
| 317 | + if (this.value.indexOf(q) != -1) { | ||
| 318 | + rs.push(this); | ||
| 319 | + count++; | ||
| 320 | + } | ||
| 321 | + if (count >= 10) | ||
| 322 | + return false; | ||
| 323 | + }); | ||
| 324 | + release && release(rs); | ||
| 325 | + } | ||
| 326 | + }); | ||
| 327 | + }; | ||
| 328 | + | ||
| 329 | + var accAdd = function (a, b) { | ||
| 330 | + var c, d, e; | ||
| 331 | + try { | ||
| 332 | + c = a.toString().split(".")[1].length; | ||
| 333 | + } catch (f) { | ||
| 334 | + c = 0; | ||
| 335 | + } | ||
| 336 | + try { | ||
| 337 | + d = b.toString().split(".")[1].length; | ||
| 338 | + } catch (f) { | ||
| 339 | + d = 0; | ||
| 340 | + } | ||
| 341 | + return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e; | ||
| 342 | + }; | ||
| 343 | + | ||
| 344 | + function accDiv(arg1,arg2){ | ||
| 345 | + var t1=0,t2=0,r1,r2; | ||
| 346 | + try{t1=arg1.toString().split(".")[1].length}catch(e){} | ||
| 347 | + try{t2=arg2.toString().split(".")[1].length}catch(e){} | ||
| 348 | + with(Math){ | ||
| 349 | + r1=Number(arg1.toString().replace(".","")) | ||
| 350 | + r2=Number(arg2.toString().replace(".","")) | ||
| 351 | + return (r1/r2)*pow(10,t2-t1); | ||
| 352 | + } | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + function mul(a, b) { | ||
| 356 | + var c = 0, | ||
| 357 | + d = a.toString(), | ||
| 358 | + e = b.toString(); | ||
| 359 | + try { | ||
| 360 | + c += d.split(".")[1].length; | ||
| 361 | + } catch (f) { | ||
| 362 | + } | ||
| 363 | + try { | ||
| 364 | + c += e.split(".")[1].length; | ||
| 365 | + } catch (f) { | ||
| 366 | + } | ||
| 367 | + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c); | ||
| 368 | + } | ||
| 369 | + | ||
| 370 | + var numSubtr = function (a, b) { | ||
| 371 | + var c, d, e; | ||
| 372 | + try { | ||
| 373 | + c = a.toString().split(".")[1].length; | ||
| 374 | + } catch (f) { | ||
| 375 | + c = 0; | ||
| 376 | + } | ||
| 377 | + try { | ||
| 378 | + d = b.toString().split(".")[1].length; | ||
| 379 | + } catch (f) { | ||
| 380 | + d = 0; | ||
| 381 | + } | ||
| 382 | + return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e; | ||
| 383 | + }; | ||
| 384 | + | ||
| 385 | + var trim = function (str, is_global) { | ||
| 386 | + var result; | ||
| 387 | + result = str.replace(/(^\s+)|(\s+$)/g, ""); | ||
| 388 | + if (is_global.toLowerCase() == "g") { | ||
| 389 | + result = result.replace(/\s/g, ""); | ||
| 390 | + } | ||
| 391 | + return result; | ||
| 392 | + }; | ||
| 393 | + | ||
| 394 | + var inverse = function (map) { | ||
| 395 | + var rs = {}; | ||
| 396 | + for(var k in map){ | ||
| 397 | + rs[map[k]] = k; | ||
| 398 | + } | ||
| 399 | + | ||
| 400 | + return rs; | ||
| 401 | + }; | ||
| 402 | + | ||
| 403 | + var next_elem = function (clazz, e) { | ||
| 404 | + var ne = e.next(); | ||
| 405 | + if(ne.length==0) | ||
| 406 | + return []; | ||
| 407 | + else if(ne.hasClass(clazz)) | ||
| 408 | + return ne; | ||
| 409 | + else | ||
| 410 | + return next_elem(clazz, ne); | ||
| 411 | + }; | ||
| 412 | + | ||
| 413 | + var getDisabledVal = function (f) { | ||
| 414 | + var rs = {}; | ||
| 415 | + $('input,select', f).each(function () { | ||
| 416 | + if($(this).attr('disabled')){ | ||
| 417 | + rs[$(this).attr('name')]=$(this).val(); | ||
| 418 | + } | ||
| 419 | + }); | ||
| 420 | + return rs; | ||
| 421 | + }; | ||
| 422 | + | ||
| 423 | + return { | ||
| 424 | + reqCode80: reqCode80, | ||
| 425 | + groupBy: groupBy, | ||
| 426 | + extractJsy: extractJsy, | ||
| 427 | + extractLpName: extractLpName, | ||
| 428 | + compileTempByDom: compileTempByDom, | ||
| 429 | + $get: $get, | ||
| 430 | + $post: $post, | ||
| 431 | + $post_arr: $post_arr, | ||
| 432 | + $del: $del, | ||
| 433 | + get_vals: get_vals, | ||
| 434 | + get_keys: get_keys, | ||
| 435 | + get_device_tree_data: get_device_tree_data, | ||
| 436 | + lineAutocomplete: lineAutocomplete, | ||
| 437 | + personAutocomplete: personAutocomplete, | ||
| 438 | + carAutocomplete: carAutocomplete, | ||
| 439 | + init_autocomplete: init_autocomplete, | ||
| 440 | + init_autocom_pinyin: init_autocom_pinyin, | ||
| 441 | + accAdd: accAdd, | ||
| 442 | + numSubtr: numSubtr, | ||
| 443 | + trim: trim, | ||
| 444 | + remarksAutocomplete: remarksAutocomplete, | ||
| 445 | + flatpickrDateTimeConfig: flatpickrDateTimeConfig, | ||
| 446 | + inverse: inverse, | ||
| 447 | + accDiv: accDiv, | ||
| 448 | + mul: mul, | ||
| 449 | + adjustExps: adjustExps, | ||
| 450 | + inOutExps: inOutExps, | ||
| 451 | + next_elem: next_elem, | ||
| 452 | + getDisabledVal: getDisabledVal, | ||
| 453 | + extractNbbm: extractNbbm | ||
| 454 | + | ||
| 455 | + //whichTransitionEvent:whichTransitionEvent | ||
| 456 | + }; | ||
| 457 | +})(); |