Commit a911871ae425d8de0eb36a5aaa5a0bbc8535b4c5

Authored by 潘钊
1 parent c8f05358

update...

src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
@@ -88,6 +88,21 @@ public class ChildTaskPlan { @@ -88,6 +88,21 @@ public class ChildTaskPlan {
88 */ 88 */
89 private String destroyReason; 89 private String destroyReason;
90 90
  91 + /**
  92 + * 包括 烂班原因、进出场原因、换车原因 等
  93 + */
  94 + private String reason;
  95 +
  96 + /**
  97 + * 车辆 如果为空,继承主任务
  98 + */
  99 + private String nbbm;
  100 +
  101 + /**
  102 + * 为true 则无售票员, 否则继承主任务
  103 + */
  104 + private boolean noClerk;
  105 +
91 /** 创建日期 */ 106 /** 创建日期 */
92 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") 107 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
93 private Date createDate; 108 private Date createDate;
@@ -238,4 +253,28 @@ public class ChildTaskPlan { @@ -238,4 +253,28 @@ public class ChildTaskPlan {
238 public void setCreateDate(Date createDate) { 253 public void setCreateDate(Date createDate) {
239 this.createDate = createDate; 254 this.createDate = createDate;
240 } 255 }
  256 +
  257 + public String getReason() {
  258 + return reason;
  259 + }
  260 +
  261 + public void setReason(String reason) {
  262 + this.reason = reason;
  263 + }
  264 +
  265 + public String getNbbm() {
  266 + return nbbm;
  267 + }
  268 +
  269 + public void setNbbm(String nbbm) {
  270 + this.nbbm = nbbm;
  271 + }
  272 +
  273 + public boolean isNoClerk() {
  274 + return noClerk;
  275 + }
  276 +
  277 + public void setNoClerk(boolean noClerk) {
  278 + this.noClerk = noClerk;
  279 + }
241 } 280 }
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
@@ -45,14 +45,21 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon @@ -45,14 +45,21 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon
45 try { 45 try {
46 ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId()); 46 ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
47 //保存起终点名称 47 //保存起终点名称
48 - String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; 48 + //String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
49 if(StringUtils.isEmpty(t.getStartStationName())) 49 if(StringUtils.isEmpty(t.getStartStationName()))
50 - t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix)); 50 + t.setStartStationName(getStationName(sch.getXlBm(), t.getStartStation()));
  51 + //t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
51 52
52 if(StringUtils.isEmpty(t.getEndStationName())) 53 if(StringUtils.isEmpty(t.getEndStationName()))
53 - t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix)); 54 + t.setEndStationName(getStationName(sch.getXlBm(), t.getEndStation()));
  55 + //t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
54 if(t.getDestroyReason() == null) 56 if(t.getDestroyReason() == null)
55 t.setDestroyReason(""); 57 t.setDestroyReason("");
  58 +
  59 + //烂班说明,为兼容之前的数据结构
  60 + if(t.isDestroy() && StringUtils.isEmpty(t.getDestroyReason()))
  61 + t.setDestroyReason(t.getReason());
  62 +
56 //先持久化子任务 63 //先持久化子任务
57 rs = super.save(t); 64 rs = super.save(t);
58 //关联主任务 65 //关联主任务
@@ -71,6 +78,17 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon @@ -71,6 +78,17 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon
71 return rs; 78 return rs;
72 } 79 }
73 80
  81 + private String getStationName(String lineCode, String stationCode){
  82 + String name;
  83 + String prefix1 = lineCode + "_" + 0 + "_",
  84 + prefix2 = lineCode + "_" + 1 + "_";
  85 +
  86 + name = BasicData.getStationNameByCode(stationCode, prefix1);
  87 + if(StringUtils.isEmpty(name))
  88 + name = BasicData.getStationNameByCode(stationCode, prefix2);
  89 + return name;
  90 + }
  91 +
74 @Override 92 @Override
75 public Map<String, Object> delete(Long id) { 93 public Map<String, Object> delete(Long id) {
76 Map<String, Object> rs; 94 Map<String, Object> rs;
src/main/resources/static/real_control_v2/css/line_schedule.css
@@ -691,7 +691,7 @@ label.destroy-sch small{ @@ -691,7 +691,7 @@ label.destroy-sch small{
691 text-align: center; 691 text-align: center;
692 } 692 }
693 .sub-task-table dl dt:nth-of-type(2), .sub-task-table dl dd:nth-of-type(2) { 693 .sub-task-table dl dt:nth-of-type(2), .sub-task-table dl dd:nth-of-type(2) {
694 - width: 15%; 694 + width: 13%;
695 } 695 }
696 .sub-task-table dl dt:nth-of-type(3), .sub-task-table dl dd:nth-of-type(3) { 696 .sub-task-table dl dt:nth-of-type(3), .sub-task-table dl dd:nth-of-type(3) {
697 width: 16%; 697 width: 16%;
@@ -706,7 +706,7 @@ label.destroy-sch small{ @@ -706,7 +706,7 @@ label.destroy-sch small{
706 width: 11%; 706 width: 11%;
707 } 707 }
708 .sub-task-table dl dt:nth-of-type(7), .sub-task-table dl dd:nth-of-type(7) { 708 .sub-task-table dl dt:nth-of-type(7), .sub-task-table dl dd:nth-of-type(7) {
709 - width: 14%; 709 + width: 16%;
710 } 710 }
711 .sub-task-table dl dt:nth-of-type(8), .sub-task-table dl dd:nth-of-type(8) { 711 .sub-task-table dl dt:nth-of-type(8), .sub-task-table dl dd:nth-of-type(8) {
712 width: 9%; 712 width: 9%;
src/main/resources/static/real_control_v2/css/main.css
@@ -1255,4 +1255,183 @@ ul.left_tabs_lg li{ @@ -1255,4 +1255,183 @@ ul.left_tabs_lg li{
1255 text-indent: 12px; 1255 text-indent: 12px;
1256 margin-bottom: 0; 1256 margin-bottom: 0;
1257 padding: 18px 5px; 1257 padding: 18px 5px;
  1258 +}
  1259 +
  1260 +.sub_task_form_v2{
  1261 + background: #f9f9f9;
  1262 + padding: 12px 15px;
  1263 + border-radius: 5px 0 5px 5px;
  1264 + border: 1px solid #dfdfdf;
  1265 + position: relative;
  1266 + margin-bottom: 20px;
  1267 +}
  1268 +
  1269 +.task_form_close_icon{
  1270 + background: #f9f9f9;
  1271 + padding: 0px 4px;
  1272 + position: absolute;
  1273 + top: -8px;
  1274 + right: -8px;
  1275 + color: #898989;
  1276 + font-size: 15px;
  1277 + border: 1px solid #dfdfdf;
  1278 + border-radius: 100%;
  1279 + border-left: none;
  1280 + border-bottom: none;
  1281 + transition: all .03s;
  1282 +}
  1283 +
  1284 +.task_form_close_icon:hover{
  1285 + border: 1px solid #ff1515;
  1286 + border-left: none;
  1287 + border-bottom: none;
  1288 + color: #e03e3e;
  1289 +}
  1290 +
  1291 +.sub_task_form_v2:hover::after{
  1292 + color: #5f5b5b;
  1293 +}
  1294 +
  1295 +.sub_task_form_v2.uk-form-horizontal .uk-form-label{
  1296 + width: 80px;
  1297 +}
  1298 +
  1299 +.sub_task_form_v2.uk-form-horizontal .uk-form-controls{
  1300 + margin-left: 85px;
  1301 +}
  1302 +
  1303 +.sub_task_form_v2.uk-form-horizontal .uk-form-controls input[type=text],
  1304 +.sub_task_form_v2.uk-form-horizontal .uk-form-controls input[type=time],
  1305 +.sub_task_form_v2.uk-form-horizontal .uk-form-controls select{
  1306 + width: 100%;
  1307 +}
  1308 +
  1309 +#add-sub-task-main-modal .uk-modal-footer{
  1310 + background: none;
  1311 + border-top: none;
  1312 +}
  1313 +
  1314 +#add-sub-task-main-modal .uk-grid+.uk-grid{
  1315 + margin-top: 12px;
  1316 +}
  1317 +
  1318 +#add-sub-task-main-modal .plus_icon_span{
  1319 + font-size: 26px;
  1320 + color: #b2b2b2;
  1321 + padding: 10px 64px;
  1322 + display: inline-block;
  1323 + border: 1px dashed grey;
  1324 + margin: 15px 0;
  1325 + border-radius: 5px;
  1326 + cursor: pointer;
  1327 +}
  1328 +
  1329 +#add-sub-task-main-modal .uk-animation-fade{
  1330 + animation-duration: .3s;
  1331 +}
  1332 +
  1333 +#add-sub-task-main-modal .forms{
  1334 + max-height: 488px;
  1335 + overflow-y: auto;
  1336 + overflow-x: hidden;
  1337 + padding: 8px 8px 0 0;
  1338 +}
  1339 +
  1340 +.add_custom_wrap .forms .sub_task_form_v2:last-child{
  1341 + margin-bottom: 0;
  1342 +}
  1343 +
  1344 +.sub_task_form_v2.repeat_main:before{
  1345 + content: '复';
  1346 + position: absolute;
  1347 + top: -10px;
  1348 + font-size: 12px;
  1349 + color: #2196F3;
  1350 + background: #ffffff;
  1351 + padding: 0 3px;
  1352 + font-weight: 600;
  1353 +}
  1354 +
  1355 +.sub_task_form_v2.repeat_main.destroy_form:before{
  1356 + color: #F44336;
  1357 +}
  1358 +
  1359 +.sub_task_form_v2.repeat_main{
  1360 + background: #f4faff;
  1361 +}
  1362 +
  1363 +.sub_task_form_v2.destroy_form{
  1364 + background-color: #fff5f4 !important;
  1365 +}
  1366 +
  1367 +.uk-form>.half_change_car_box{
  1368 + margin: -10px 0 15px;
  1369 + padding: 3px 5px;
  1370 + display: inline-block;
  1371 + border: 1px solid #dfdddd;
  1372 + color: #918f8f;
  1373 +}
  1374 +
  1375 +.half_change_car_box input[type=checkbox]{
  1376 + vertical-align: top;
  1377 +}
  1378 +
  1379 +.uk-form>.half_change_car_box.active{
  1380 + background: #4CAF50;
  1381 + color: #fff;
  1382 +}
  1383 +
  1384 +.uk-form>.half_change_car_box.active input[type=checkbox]{
  1385 + background: #4caf50;
  1386 + border-color: #4caf50;
  1387 +}
  1388 +
  1389 +.uk-form>.half_change_car_box.active input[type=checkbox]:before{
  1390 + color: #ffffff;
  1391 +}
  1392 +
  1393 +.sub_task_form_v2.change_car{
  1394 + z-index: 99;
  1395 +}
  1396 +
  1397 +.st_range_top_form{
  1398 + padding: 0 0 15px 5px;
  1399 + border: 1px solid #c4bb76;
  1400 + background: #e5e1c1;
  1401 + margin-bottom: 15px;
  1402 + box-shadow: 0px 4px 3px 0 rgba(142, 138, 138, 0.2), 0px 4px 5px 0 rgba(157, 156, 156, 0.19);
  1403 +}
  1404 +
  1405 +.st_range_top_form .uk-form-row{
  1406 + margin-top: 20px;
  1407 +}
  1408 +
  1409 +.uk-form-horizontal.st_range_top_form .uk-form-label{
  1410 + width: 80px;
  1411 +}
  1412 +
  1413 +.uk-form-horizontal.st_range_top_form .uk-form-controls{
  1414 + margin-left: 84px;
  1415 +}
  1416 +
  1417 +.uk-form-horizontal.st_range_top_form .uk-form-controls select{
  1418 + width: calc(100% - 2px);
  1419 +}
  1420 +
  1421 +.sub_task_form_v2.service_st_form{
  1422 + background: #f4faff;
  1423 +}
  1424 +
  1425 +.uk-modal .uk-form.fv-form.sub_task_form_v2{
  1426 + margin-bottom: 20px !important;
  1427 +}
  1428 +
  1429 +.sub_task_table_wrap .ct_table>.ct_table_body{
  1430 + border-bottom: none;
  1431 +}
  1432 +
  1433 +.add_range_wrap>.err_panel{
  1434 + font-size: 16px;
  1435 + color: #a44a4a;
  1436 + font-family: 微软雅黑;
1258 } 1437 }
1259 \ No newline at end of file 1438 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <a href="" class="uk-modal-close uk-close"></a> 3 <a href="" class="uk-modal-close uk-close"></a>
4 <div class="uk-modal-header"> 4 <div class="uk-modal-header">
5 <h2>临加/子任务</h2></div> 5 <h2>临加/子任务</h2></div>
6 - <div class="uk-panel uk-panel-box uk-panel-box-primary"> 6 + <div class="uk-panel uk-panel-box uk-panel-box-primary" style="padding: 12px;">
7 <form class="uk-form uk-form-horizontal search-form"> 7 <form class="uk-form uk-form-horizontal search-form">
8 <div class="uk-grid"> 8 <div class="uk-grid">
9 <div class="uk-width-1-3"> 9 <div class="uk-width-1-3">
@@ -51,13 +51,13 @@ @@ -51,13 +51,13 @@
51 </div> 51 </div>
52 </div> 52 </div>
53 53
54 - <div class="uk-panel uk-panel-box uk-panel-box-secondary" style="padding-bottom: 0;"> 54 + <div class="uk-panel uk-panel-box uk-panel-box-secondary" style="padding-bottom: 0;box-shadow: 0px -2px 4px 0 rgba(214, 214, 214, 0.2), 0px -2px 3px 0 rgba(123, 122, 122, 0.19);">
55 <h3 class="uk-panel-title" id="childTaskTitle"> 55 <h3 class="uk-panel-title" id="childTaskTitle">
56 子任务列表 56 子任务列表
57 <a id="addChildTaskBtn" data-uk-tooltip title="添加子任务"><i 57 <a id="addChildTaskBtn" data-uk-tooltip title="添加子任务"><i
58 class="uk-icon-plus"></i> </a> 58 class="uk-icon-plus"></i> </a>
59 </h3> 59 </h3>
60 - <div class="ct_table_wrap ct_table_no_border sub_task_table_wrap" style="height: 142px;"> 60 + <div class="ct_table_wrap ct_table_no_border sub_task_table_wrap" style="height: 147px;">
61 <div class="ct_table sub-task-table"> 61 <div class="ct_table sub-task-table">
62 <div class="ct_table_head"> 62 <div class="ct_table_head">
63 <dl> 63 <dl>
@@ -137,9 +137,12 @@ @@ -137,9 +137,12 @@
137 {{if task.destroy}} 137 {{if task.destroy}}
138 <small style="color:red;">烂班</small> 138 <small style="color:red;">烂班</small>
139 {{/if}} 139 {{/if}}
  140 + {{if task.nbbm!=null}},{{task.nbbm}}{{/if}}
140 ) 141 )
141 </dd> 142 </dd>
142 - <dd title="{{task.remarks}}">{{task.remarks}}</dd> 143 + <dd title="{{task.remarks}}">
  144 + {{task.remarks}}
  145 + </dd>
143 </dl> 146 </dl>
144 {{/each}} 147 {{/each}}
145 </script> 148 </script>
@@ -328,8 +331,6 @@ @@ -328,8 +331,6 @@
328 }, modal_opts); 331 }, modal_opts);
329 }; 332 };
330 333
331 - $('#addChildTaskBtn').on('click', add_sub_task_other);  
332 -  
333 //回场子任务 334 //回场子任务
334 var add_sub_task_in = function () { 335 var add_sub_task_in = function () {
335 var sch = getActiveSch(); 336 var sch = getActiveSch();
@@ -408,6 +409,18 @@ @@ -408,6 +409,18 @@
408 }, modal_opts); 409 }, modal_opts);
409 }; 410 };
410 411
  412 + var add_sub_task = function () {
  413 + var sch = getActiveSch();
  414 + if (!sch)
  415 + return notify_err('无法获取到主任务信息!');
  416 +
  417 + open_modal(folder + '/sub_task_v2/main.html', {
  418 + sch: sch
  419 + }, modal_opts);
  420 + };
  421 +
  422 + $('#addChildTaskBtn').on('click', add_sub_task);
  423 +
411 var callbackHandler = { 424 var callbackHandler = {
412 add_temp_sch: add_temp_sch, 425 add_temp_sch: add_temp_sch,
413 remove_sch: remove_sch, 426 remove_sch: remove_sch,
@@ -416,7 +429,9 @@ @@ -416,7 +429,9 @@
416 remove_sub_task: remove_sub_task, 429 remove_sub_task: remove_sub_task,
417 add_sub_task_out: add_sub_task_out, 430 add_sub_task_out: add_sub_task_out,
418 add_sub_task_range_turn: add_sub_task_range_turn, 431 add_sub_task_range_turn: add_sub_task_range_turn,
419 - add_oil: add_oil 432 + add_oil: add_oil,
  433 +
  434 + add_sub_task: add_sub_task
420 }; 435 };
421 436
422 //右键菜单 437 //右键菜单
@@ -431,7 +446,7 @@ @@ -431,7 +446,7 @@
431 name: "临加班次" 446 name: "临加班次"
432 }, 447 },
433 "add_sub_task": { 448 "add_sub_task": {
434 - name: "添加子任务", 449 + name: "添加子任务"/*,
435 items: { 450 items: {
436 'add_oil':{ 451 'add_oil':{
437 name: '空驶进出场' 452 name: '空驶进出场'
@@ -448,7 +463,7 @@ @@ -448,7 +463,7 @@
448 'add_sub_task_other': { 463 'add_sub_task_other': {
449 name: '自定义' 464 name: '自定义'
450 } 465 }
451 - } 466 + }*/
452 }, 467 },
453 'remove_sch': { 468 'remove_sch': {
454 name: '删除' 469 name: '删除'
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_custom.html 0 → 100644
  1 +<div class="add_custom_wrap">
  2 + <div class="forms"></div>
  3 + <span class="plus_icon_span">
  4 + <i class="uk-icon-plus"></i>
  5 + </span>
  6 + <form class="uk-form remarks_form">
  7 + <div class="uk-grid">
  8 + <div class="uk-width-1-1">
  9 + <div class="uk-form-row ct-stacked">
  10 + <div class="uk-form-controls" style="margin-top: 5px;">
  11 + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;"
  12 + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea>
  13 + </div>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + </form>
  18 + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;">
  19 + <button type="button" class="uk-button uk-modal-close">取消</button>
  20 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  21 + </div>
  22 +
  23 + <script>
  24 + (function () {
  25 + var wrap = '#add-sub-task-main-modal .add_custom_wrap',
  26 + sch, fs=[];
  27 +
  28 + $(wrap).on('init', function (e, data) {
  29 + e.stopPropagation();
  30 + sch = data.sch;
  31 + $('.plus_icon_span', wrap).trigger('click');
  32 + });
  33 +
  34 + //plsu icon
  35 + $('.plus_icon_span', wrap).on('click', addTaskForm);
  36 +
  37 + var bcTypeMap = {'in': 2, 'out': 3, 'normal': 1};
  38 + function addTaskForm() {
  39 + var htmlStr = template('sub-task-v2-form-temp', {sch: sch})
  40 + var f = $(htmlStr);
  41 + $('.forms', wrap).append(f);
  42 + //字典转换
  43 + dictionaryUtils.transformDom($('.nt-dictionary', f));
  44 +
  45 + //班次类型切换
  46 + if(bcTypeMap[sch.bcType])
  47 + $('[name=type2]', f).val(bcTypeMap[sch.bcType])
  48 + $('[name=type2]', f).trigger('change');
  49 +
  50 + //滚动条到底
  51 + $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight);
  52 +
  53 + //起点站trigger change
  54 + $('[name=startStation]',f).trigger('change');
  55 +
  56 + f.prev('.sub_task_form_v2').find('[name=endDate]').trigger('input');
  57 +
  58 + f.formValidation({
  59 + framework: 'uikit',
  60 + locale: 'zh_CN'
  61 + }).on('add_reason_field', function () {
  62 + $(this).formValidation('addField', 'reason');
  63 + });
  64 + }
  65 +
  66 + //提交
  67 + $('button[type=submit]', wrap).on('click', function () {
  68 + $(this).addClass('disabled').attr('disabled','disabled');
  69 + dataArray = [];
  70 + $('form.sub_task_form_v2', wrap).data('valid', false)
  71 + .formValidation('validate');
  72 + });
  73 +
  74 + var dataArray = [];
  75 + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) {
  76 + e.preventDefault();
  77 +
  78 + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this)
  79 + , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id}));
  80 + $(this).data('valid', true);
  81 +
  82 + if(allValidSuccess()){
  83 + var i = 0, rst;
  84 + (function () {
  85 + var f = arguments.callee;
  86 + if(i >= dataArray.length){
  87 + //完成后更新前端数据
  88 + gb_schedule_table.updateSchedule(rst);
  89 + UIkit.modal('#add-sub-task-main-modal').hide();
  90 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  91 + return;
  92 + }
  93 + var data = dataArray[i];
  94 + //里程为0的不保存
  95 + if(data.mileage==0){
  96 + i++;
  97 + f();
  98 + }
  99 + else{
  100 + //营运子任务不写备注
  101 + if(data.mileageType == 'service' && !data.destroy)
  102 + data.remarks = '';
  103 + gb_common.$post('/childTask', data, function (rs) {
  104 + notify_succ('子任务添加成功');
  105 + rst = rs.t;
  106 + i++;
  107 + f();
  108 + });
  109 + }
  110 + })();
  111 + }
  112 + });
  113 + //校验不过
  114 + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () {
  115 + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled');
  116 + });
  117 +
  118 + function allValidSuccess() {
  119 + var flag = true;
  120 + $('form.sub_task_form_v2', wrap).each(function (i, f) {
  121 + if(!$(f).data('valid')){
  122 + flag = false;
  123 + return false;
  124 + }
  125 + });
  126 + return flag;
  127 + }
  128 +
  129 + function $f(name, f) {
  130 + return $('[name=' + name + ']', f);
  131 + }
  132 + })();
  133 + </script>
  134 +</div>
0 \ No newline at end of file 135 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_in_out.html 0 → 100644
  1 +<div class="add_inOut_wrap">
  2 + <div class="forms"></div>
  3 + <form class="uk-form remarks_form">
  4 + <div class="uk-grid">
  5 + <div class="uk-width-1-1">
  6 + <div class="uk-form-row ct-stacked">
  7 + <div class="uk-form-controls" style="margin-top: 5px;">
  8 + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;"
  9 + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea>
  10 + </div>
  11 + </div>
  12 + </div>
  13 + </div>
  14 + </form>
  15 + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;">
  16 + <button type="button" class="uk-button uk-modal-close">取消</button>
  17 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  18 + </div>
  19 +
  20 + <script>
  21 + (function () {
  22 + var wrap = '#add-sub-task-main-modal .add_inOut_wrap',
  23 + sch, sf, inf, outf, destroyf;
  24 +
  25 + $(wrap).on('init', function (e, data) {
  26 + e.stopPropagation();
  27 + sch = data.sch;
  28 +
  29 + //线路上
  30 + sf = addTaskForm();
  31 + //进场
  32 + inf = addTaskForm();
  33 + //出场
  34 + outf = addTaskForm();
  35 +
  36 + setTimeout(function () {
  37 + //复主任务
  38 + repeat_main(sf);
  39 + //进场子任务
  40 + repeat_In(inf);
  41 + //出场子任务
  42 + repeat_Out(outf);
  43 + }, 500);
  44 +
  45 + //营运终点和进场起点改变事件
  46 + $f('endStation', sf).on('change', changeServiceEnd);
  47 + //$f('startStation', inf).on('change', changeServiceEnd);
  48 + });
  49 +
  50 + function addTaskForm() {
  51 + var htmlStr = template('sub-task-v2-form-temp', {sch: sch});
  52 + var f = $(htmlStr);
  53 + $('.forms', wrap).append(f);
  54 + //字典转换
  55 + dictionaryUtils.transformDom($('.nt-dictionary', f));
  56 +
  57 + //班次类型切换
  58 + $('select[name=type2]', f).trigger('change');
  59 +
  60 + //滚动条到底
  61 + $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight);
  62 +
  63 + f.formValidation({
  64 + framework: 'uikit',
  65 + locale: 'zh_CN'
  66 + }).on('add_reason_field', function () {
  67 + $(this).formValidation('addField', 'reason');
  68 + });
  69 + return f;
  70 + }
  71 +
  72 + /**
  73 + * 复主任务
  74 + * @param f
  75 + */
  76 + function repeat_main(f) {
  77 + f.addClass('repeat_main');
  78 + $f('type2', f).html('<option value="1">线路上站点间</option>');
  79 + $f('mileage', f).val(sch.jhlc).trigger('input');
  80 + $f('mileageType', f).val('service').attr('disabled', 'disabled');
  81 + //主任务是烂班
  82 + if (sch.status == -1) {
  83 + $f('destroy', f)[0].checked = true;
  84 + $f('reason', f).val(sch.adjustExps);
  85 + $('.destroy_reason_wrap', f).show();
  86 + $f('mileage', f).val(sch.jhlcOrig);
  87 + $('input,select', f).attr('disabled', 'disabled');
  88 + f.addClass('destroy_form');
  89 + }
  90 + else if (sch.status == 2) {
  91 + $f('destroy', f).parents('label').hide();
  92 + $f('endDate', f).val(sch.zdsjActual);
  93 + $('input,select', f).attr('disabled', 'disabled');
  94 + }
  95 + }
  96 +
  97 + function repeat_In(f) {
  98 + $f('type2', f).html('<option value="2">进场</option>').trigger('change');
  99 + if (sch.status != -1)
  100 + $f('startStation', f).val(sch.zdzCode);//主任务终点进场
  101 +
  102 + //起点改变
  103 + $f('startStation', f).on('change', function () {
  104 + $f('endStation', outf).val($(this).val());//.trigger('change');
  105 + }).trigger('change');
  106 +
  107 + //烂班原因
  108 + if(sch.status == -1 &&
  109 + gb_common.inOutExps.indexOf(sch.adjustExps)!=-1)
  110 + $f('inOutReason',inf).val(sch.adjustExps).trigger('change');
  111 + }
  112 +
  113 + function repeat_Out(f) {
  114 + $f('type2', f).html('<option value="3">出场</option>').trigger('change');
  115 +
  116 + var code;
  117 + if (sch.status != -1)
  118 + code=sch.zdzCode;
  119 + else
  120 + code=sch.qdzCode;
  121 + $f('endStation', f).val(code).trigger('change'); //出场到主任务终点
  122 + $f('startDate', f).val($f('endDate', inf).val()).trigger('input');//开始时间
  123 + }
  124 +
  125 + function $f(name, f) {
  126 + return $('[name=' + name + ']', f);
  127 + }
  128 +
  129 + /**
  130 + * 切换营运终点
  131 + */
  132 + function changeServiceEnd() {
  133 + var eCode = $(this).val();
  134 + if(half_form){
  135 + half_form.remove();
  136 + changeCarBox.remove();
  137 + }
  138 + if(eCode==sch.qdzCode || eCode==sch.zdzCode){
  139 + $f('startStation',inf).val(eCode).trigger('change');
  140 + return;
  141 + }
  142 +
  143 + //进场起点
  144 + $f('startStation',inf).val(eCode);
  145 +
  146 + //中途进场
  147 + showHalfPanel(eCode);
  148 + }
  149 +
  150 + var half_form, changeCarBox;
  151 + function showHalfPanel(station) {
  152 + half_form = $(template('sub-task-v2-form-temp', {sch: sch}));
  153 + half_form.addClass('repeat_main destroy_form');
  154 + //字典转换
  155 + dictionaryUtils.transformDom($('.nt-dictionary', half_form));
  156 + sf.after(half_form);
  157 +
  158 +
  159 + //班次类型切换
  160 + $f('type2', half_form).trigger('change');
  161 + //设置起点
  162 + $f('startStation',half_form).val(station).trigger('change');
  163 + //烂班
  164 + $f('destroy',half_form)[0].checked=true;
  165 + $f('mileageType',half_form).attr('disabled','disabled');
  166 + $f('type2',half_form).html('<option value="1">线路上站点间</option>');
  167 + $('.destroy_reason_wrap',half_form).show();
  168 + half_form.attr('destroy', true);
  169 +
  170 + setTimeout(function () {
  171 + //烂班开始时间
  172 + $f('startDate',half_form).val($f('endDate',sf).val()).trigger('input');
  173 + }, 300);
  174 +
  175 + //换车营运
  176 + var se = $f('startStation',half_form)[0],
  177 + sname = se.options[se.options.selectedIndex].text;
  178 + changeCarBox = $('<form class="uk-form"><label class="half_change_car_box"><input type="checkbox"> 换车出场至【'+sname+'】继续营运</label></form>');
  179 + half_form.after(changeCarBox);
  180 +
  181 + //删除
  182 + $('.task_form_close_icon', half_form).on('click', function () {
  183 + changeCarBox.remove();
  184 + $f('type2',outf).trigger('change');
  185 + });
  186 +
  187 + //校验
  188 + half_form.formValidation({
  189 + framework: 'uikit',
  190 + locale: 'zh_CN'
  191 + }).on('add_reason_field', function () {
  192 + $(this).formValidation('addField', 'reason');
  193 + });
  194 + }
  195 +
  196 + $(wrap).on('click', '.half_change_car_box>input[type=checkbox]', function () {
  197 + var box=$(this).parents('.half_change_car_box');
  198 + if(this.checked){
  199 + box.addClass('active');
  200 + enableChangeCar();
  201 + }
  202 + else{
  203 + box.removeClass('active');
  204 + disabledChangeCar();
  205 + }
  206 + });
  207 +
  208 + /**
  209 + * 换车出场
  210 + */
  211 + function enableChangeCar() {
  212 + var htmlStr = template('st-v2-domains-changecar-form-temp', {inOutExps: gb_common.inOutExps});
  213 + $('.domains', half_form).html(htmlStr);
  214 + $('.domains', outf).html(htmlStr);
  215 + half_form.css('z-index', 99).trigger('add_reason_field');
  216 + outf.trigger('add_reason_field');
  217 +
  218 + //车辆 autocomplete
  219 + var data = gb_data_basic.carsArray();
  220 + gb_common.carAutocomplete($('.autocomplete-cars', half_form), data);
  221 +
  222 + //同步车辆编码
  223 + $f('nbbm', half_form).on('input change', function () {
  224 + $f('nbbm', outf).val($(this).val());
  225 + });
  226 +
  227 + half_form.removeClass('destroy_form');
  228 +
  229 + //出场终点
  230 + $f('endStation',outf).val($f('endStation',sf).val());
  231 + }
  232 +
  233 + function disabledChangeCar() {
  234 + $f('type2',outf).trigger('change');
  235 + $f('endStation',sf).trigger('change');
  236 + }
  237 +
  238 +
  239 + //提交
  240 + $('button[type=submit]', wrap).on('click', function () {
  241 + $(this).addClass('disabled').attr('disabled','disabled');
  242 + dataArray = [];
  243 + $('form.sub_task_form_v2', wrap).data('valid', false)
  244 + .formValidation('validate');
  245 + });
  246 +
  247 + var dataArray = [];
  248 + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) {
  249 + e.preventDefault();
  250 +
  251 + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this)
  252 + , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id}));
  253 + $(this).data('valid', true);
  254 +
  255 + if(allValidSuccess()){
  256 + var i = 0, rst;
  257 + (function () {
  258 + var f = arguments.callee;
  259 + if(i >= dataArray.length){
  260 + //完成后更新前端数据
  261 + gb_schedule_table.updateSchedule(rst);
  262 + UIkit.modal('#add-sub-task-main-modal').hide();
  263 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  264 + return;
  265 + }
  266 + var data = dataArray[i];
  267 + //里程为0的不保存
  268 + if(data.mileage==0){
  269 + i++;
  270 + f();
  271 + }
  272 + else{
  273 + //营运子任务不写备注
  274 + if(data.mileageType == 'service' && !data.destroy)
  275 + data.remarks = '';
  276 + gb_common.$post('/childTask', data, function (rs) {
  277 + notify_succ('子任务添加成功');
  278 + rst = rs.t;
  279 + i++;
  280 + f();
  281 + });
  282 + }
  283 + })();
  284 + }
  285 + });
  286 + //校验不过
  287 + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () {
  288 + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled');
  289 + });
  290 +
  291 + function allValidSuccess() {
  292 + var flag = true;
  293 + $('form.sub_task_form_v2', wrap).each(function (i, f) {
  294 + if(!$(f).data('valid')){
  295 + flag = false;
  296 + return false;
  297 + }
  298 + });
  299 + return flag;
  300 + }
  301 + })();
  302 + </script>
  303 +</div>
0 \ No newline at end of file 304 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_range_turn.html 0 → 100644
  1 +<div class="add_range_wrap">
  2 + <div>
  3 + <form class="uk-form uk-form-horizontal st_range_top_form">
  4 + <div class="uk-grid">
  5 + <div class="uk-width-1-3">
  6 + <div class="uk-form-row" style="padding-left: 10px;">
  7 + <label class="uk-form-label">调头站点</label>
  8 + <div class="uk-form-controls">
  9 + <select id="turnStationSelect">
  10 + <option value="">请选择...</option>
  11 + </select>
  12 + </div>
  13 + </div>
  14 + </div>
  15 + <div class="uk-width-1-3">
  16 + <div class="uk-form-row">
  17 + <label class="uk-form-label">调头原因</label>
  18 + <div class="uk-form-controls">
  19 + <select id="turnReason" style="width: calc(100% - 13px);">
  20 + <option value="">请选择...</option>
  21 + </select>
  22 + </div>
  23 + </div>
  24 + </div>
  25 + <div class="uk-width-1-3" style="padding: 28px 0 0 28px;">
  26 + <label id="emptyTurnCbox"></label>
  27 + </div>
  28 + </div>
  29 + </form>
  30 + </div>
  31 +
  32 + <div class="forms"></div>
  33 + <form class="uk-form remarks_form">
  34 + <div class="uk-grid">
  35 + <div class="uk-width-1-1">
  36 + <div class="uk-form-row ct-stacked">
  37 + <div class="uk-form-controls" style="margin-top: 5px;">
  38 + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;"
  39 + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea>
  40 + </div>
  41 + </div>
  42 + </div>
  43 + </div>
  44 + </form>
  45 + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;">
  46 + <button type="button" class="uk-button uk-modal-close">取消</button>
  47 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  48 + </div>
  49 +
  50 + <script>
  51 + (function () {
  52 + var wrap = '#add-sub-task-main-modal .add_range_wrap',
  53 + sch, nextSch, stationRoutes, f1, f2, df1, df2, topf = $('.st_range_top_form', wrap);
  54 +
  55 + $(wrap).on('init', function (e, data) {
  56 + e.stopPropagation();
  57 + sch = data.sch;
  58 + nextSch = gb_schedule_table.getNextSch(sch);
  59 + if(!nextSch || nextSch.bcType!='normal'){
  60 + $(wrap).html('<div class="err_panel">无法做区间调头,原因是没有找到返程班次!</div>');
  61 + return;
  62 + }
  63 +
  64 + //站点路由
  65 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  66 + return a.stationRouteCode - b.stationRouteCode;
  67 + }), 'directions');
  68 + //第一段营运
  69 + f1 = addTaskForm();
  70 + $f('startStation', f1).trigger('change');
  71 +
  72 + disabled_form(f1);
  73 + $('.domains', f1).empty();
  74 + //top form 站点select
  75 + $('#turnStationSelect', topf).append($f('startStation', f1).html()).on('change', changeTurnStation);
  76 + //top form 原因select
  77 + var opts = '';
  78 + $.each(gb_common.adjustExps, function () {
  79 + opts += '<option value="' + this + '">' + this + '</option>';
  80 + });
  81 + $('#turnReason', topf).append(opts).on('change', changeTurnReason);
  82 + //调头空驶
  83 + $('#emptyTurnCbox',topf).html('<input type="checkbox"> 调头空驶回 ' + sch.qdzName);
  84 + $('#emptyTurnCbox input',topf).on('click', emptyTurn);
  85 + });
  86 +
  87 +
  88 + function addTaskForm() {
  89 + var htmlStr = template('sub-task-v2-form-temp', {sch: sch});
  90 + var f = $(htmlStr);
  91 + $('.forms', wrap).append(f);
  92 + //字典转换
  93 + dictionaryUtils.transformDom($('.nt-dictionary', f));
  94 +
  95 + //班次类型切换
  96 + $('select[name=type2]', f).trigger('change');
  97 +
  98 + //滚动条到底
  99 + //$('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight);
  100 +
  101 + f.formValidation({
  102 + framework: 'uikit',
  103 + locale: 'zh_CN'
  104 + }).on('add_reason_field', function () {
  105 + $(this).formValidation('addField', 'reason');
  106 + });
  107 + return f;
  108 + }
  109 +
  110 + function disabled_form(f) {
  111 + //$('input,select',f).attr('disabled', 'disabled');
  112 + $f('type2', f).attr('disabled', 'disabled');
  113 + $f('startStation', f).attr('disabled', 'disabled');
  114 + $f('endStation', f).attr('disabled', 'disabled');
  115 + $f('mileageType', f).attr('disabled', 'disabled');
  116 + $f('destroy', f).attr('disabled', 'disabled');
  117 + return f;
  118 + }
  119 +
  120 + function $f(name, f) {
  121 + return $('[name=' + name + ']', f);
  122 + }
  123 +
  124 +
  125 + /**
  126 + * 切换调头站点
  127 + */
  128 + function changeTurnStation() {
  129 + f1.nextAll('.sub_task_form_v2').remove();
  130 +
  131 + //烂班1
  132 + df1 = destroyForm(disabled_form(addTaskForm()));
  133 + //烂班2
  134 + df2 = destroyForm(disabled_form(addTaskForm()));
  135 + //营运2
  136 + f2 = disabled_form(addTaskForm());
  137 + $('.domains', f2).empty();
  138 + //掉头站点编码
  139 + var eCode = $('#turnStationSelect', topf).val();
  140 +
  141 + //营运1终点
  142 + $f('endStation', f1).val(eCode).trigger('change');
  143 + //烂班1起点
  144 + $f('startStation', df1).val(eCode).trigger('change');
  145 + //烂班2
  146 + $f('startStation', df2).val(sch.zdzCode);
  147 + $f('endStation', df2).val(eCode);
  148 + $f('mileage', df2).val($f('mileage', df1).val()).trigger('input');
  149 + $('[sch_id_inp]', df2).val(nextSch.id);
  150 + //营运2
  151 + $f('startStation', f2).val(eCode);
  152 + $f('endStation', f2).val(sch.qdzCode);
  153 + $f('startDate',f2).val($f('endDate',f1).val());
  154 + $f('mileage', f2).val($f('mileage', f1).val()).trigger('input');
  155 + $('[sch_id_inp]', f2).val(nextSch.id);
  156 +
  157 + //set css
  158 + setCss();
  159 + //reason
  160 + changeTurnReason();
  161 + }
  162 +
  163 + /**
  164 + * 切换调头原因
  165 + */
  166 + function changeTurnReason() {
  167 + var reason = $('#turnReason',topf).val();
  168 + if(reason){
  169 + $('.sub_task_form_v2 [name=reason]', wrap).val(reason).trigger('change');
  170 + //var reInput=$('.remarks_form [name=remarks]', wrap);
  171 + //reInput.val(reInput.val() + reason + ',');
  172 + }
  173 + }
  174 +
  175 + function destroyForm(f) {
  176 + $f('destroy', f)[0].checked = true;
  177 + $('.destroy_reason_wrap', f).show();
  178 + f.addClass('destroy_form');
  179 + f.attr('destroy', true);
  180 + return f;
  181 + }
  182 +
  183 + function setCss() {
  184 + $('.sub_task_form_v2', wrap).each(function () {
  185 + if($(this).hasClass('destroy_form'))
  186 + return true;
  187 +
  188 + if($f('mileageType', this).val()=='service')
  189 + $(this).addClass('service_st_form');
  190 + else
  191 + $(this).removeClass('service_st_form');
  192 + });
  193 + }
  194 +
  195 + /**
  196 + * 空驶调头
  197 + */
  198 + function emptyTurn() {
  199 + if(this.checked){
  200 + //烂班2 烂全程
  201 + $f('startStation', df2).val(sch.zdzCode);
  202 + $f('endStation', df2).val(sch.qdzCode);
  203 + $f('mileage', df2).val(nextSch.jhlcOrig);
  204 + $f('startDate', df2).val(nextSch.dfsj);
  205 + $f('endDate', df2).val(nextSch.zdsj);
  206 + //营运2 变空驶
  207 + f2.removeClass('service_st_form');
  208 + $f('mileageType',f2).val('empty');
  209 + }
  210 + else{
  211 + changeTurnStation();
  212 + }
  213 + }
  214 +
  215 + //提交
  216 + $('button[type=submit]', wrap).on('click', function () {
  217 + $(this).addClass('disabled').attr('disabled','disabled');
  218 + dataArray = [];
  219 + $('form.sub_task_form_v2', wrap).data('valid', false)
  220 + .formValidation('validate');
  221 + });
  222 +
  223 + var dataArray = [];
  224 + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) {
  225 + e.preventDefault();
  226 +
  227 + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this)
  228 + , {remarks: $('#form-s-t',wrap).val()}));
  229 + $(this).data('valid', true);
  230 +
  231 + if (allValidSuccess()) {
  232 + var i = 0;
  233 + (function () {
  234 + var f = arguments.callee;
  235 + if (i >= dataArray.length) {
  236 + /**
  237 + * 为班次添加备注
  238 + */
  239 + //var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $.trim($('#turnReason', modal).val()) + '在' + $('[name=endStation] option:selected', csf).text() + '调头';
  240 + //gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g'));
  241 + UIkit.modal('#add-sub-task-main-modal').hide();
  242 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  243 + return;
  244 + }
  245 + var data = dataArray[i];
  246 + //营运子任务不写备注
  247 + if(data.mileageType == 'service' && !data.destroy)
  248 + data.remarks = '';
  249 + gb_common.$post('/childTask', data, function (rs) {
  250 + notify_succ('子任务添加成功');
  251 + gb_schedule_table.updateSchedule(rs.t);
  252 + i++;
  253 + f();
  254 + });
  255 + })();
  256 + }
  257 + });
  258 + //校验不过
  259 + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () {
  260 + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled');
  261 + });
  262 +
  263 + function allValidSuccess() {
  264 + var flag = true;
  265 + $('form.sub_task_form_v2', wrap).each(function (i, f) {
  266 + if(!$(f).data('valid')){
  267 + flag = false;
  268 + return false;
  269 + }
  270 + });
  271 + return flag;
  272 + }
  273 + })();
  274 + </script>
  275 +</div>
0 \ No newline at end of file 276 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/main.html 0 → 100644
  1 +<div class="uk-modal ct_move_modal" id="add-sub-task-main-modal">
  2 + <div class="uk-modal-dialog" style="width: 1100px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>添加子任务</h2></div>
  6 +
  7 + <div class="uk-grid uk-grid-small">
  8 + <div class="uk-width-2-10">
  9 + <ul data-uk-switcher="{connect:'#tempScheduleContent',swiping:false}" class="uk-nav uk-nav-side left_tabs_lg">
  10 + <li name="normal"><a>1、子任务</a></li>
  11 + <li name="in_out"><a>2、进出场</a></li>
  12 + <li name="range_turn"><a>3、区间调头</a></li>
  13 + </ul>
  14 + </div>
  15 + <div class="uk-width-8-10">
  16 + <ul id="tempScheduleContent" class="uk-switcher">
  17 + <li class="tab_cont normalCont"></li>
  18 + <li class="tab_cont inOutCont"></li>
  19 + <li class="tab_cont rangeTurnCont"></li>
  20 + </ul>
  21 + </div>
  22 + </div>
  23 + </div>
  24 +
  25 + <script id="sub-task-v2-form-temp" type="text/html">
  26 + <form class="uk-form uk-form-horizontal uk-animation-fade sub_task_form_v2">
  27 + <span class="task_form_close_icon">
  28 + <i class="uk-icon-times"></i>
  29 + </span>
  30 + <input type="hidden" value="{{sch.id}}" name="schedule.id" sch_id_inp>
  31 + <input type="hidden" value="正常" name="type1">
  32 + <div class="uk-grid">
  33 + <div class="uk-width-1-3">
  34 + <div class="uk-form-row">
  35 + <label class="uk-form-label">班次类型</label>
  36 + <div class="uk-form-controls">
  37 + <select class="form-control nt-dictionary" data-code="-100" name="type2"
  38 + data-group=ChildTaskType></select>
  39 + </div>
  40 + </div>
  41 + </div>
  42 + <div class="uk-width-1-3">
  43 + <div class="uk-form-row">
  44 + <label class="uk-form-label">起点 </label>
  45 + <div class="uk-form-controls">
  46 + <select name="startStation" required></select>
  47 + </div>
  48 + </div>
  49 + </div>
  50 + <div class="uk-width-1-3">
  51 + <div class="uk-form-row">
  52 + <label class="uk-form-label">终点</label>
  53 + <div class="uk-form-controls">
  54 + <select name="endStation" required></select>
  55 + </div>
  56 + </div>
  57 + </div>
  58 + </div>
  59 +
  60 + <div class="uk-grid">
  61 + <div class="uk-width-1-3">
  62 + <div class="uk-form-row">
  63 + <label class="uk-form-label">开始时间</label>
  64 + <div class="uk-form-controls">
  65 + <input name="startDate" value="{{sch.fcsjActual==null?sch.dfsj:sch.fcsjActual}}" type="time"
  66 + required>
  67 + </div>
  68 + </div>
  69 + </div>
  70 + <div class="uk-width-1-3">
  71 + <div class="uk-form-row">
  72 + <label class="uk-form-label">结束时间</label>
  73 + <div class="uk-form-controls">
  74 + <input name="endDate" type="time" required>
  75 + </div>
  76 + </div>
  77 + </div>
  78 + <div class="uk-width-1-3">
  79 + <div class="uk-form-row">
  80 + <label class="uk-form-label">公里数</label>
  81 + <div class="uk-form-controls">
  82 + <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false"
  83 + required>
  84 + </div>
  85 + </div>
  86 + </div>
  87 + </div>
  88 +
  89 + <div class="uk-grid">
  90 + <div class="uk-width-2-3 domains"></div>
  91 + <div class="uk-width-1-3">
  92 + <div class="uk-form-row">
  93 + <label class="uk-form-label">里程类型</label>
  94 + <div class="uk-form-controls">
  95 + <select class="form-control nt-dictionary" required name="mileageType"
  96 + data-group="MileageType"></select>
  97 + </div>
  98 + </div>
  99 + </div>
  100 + </div>
  101 + </form>
  102 + </script>
  103 +
  104 + <script id="st-v2-domains-changecar-form-temp" type="text/html">
  105 + <div class="uk-grid">
  106 + <div class="uk-width-1-2">
  107 + <div class="uk-form-row">
  108 + <label class="uk-form-label">车辆编码</label>
  109 + <div class="uk-form-controls">
  110 + <div class="uk-autocomplete autocomplete-cars">
  111 + <input type="text" name="nbbm" placeholder="车辆自编号">
  112 + </div>
  113 + </div>
  114 + </div>
  115 + </div>
  116 + <div class="uk-width-1-2 destroy_reason_wrap">
  117 + <div class="uk-form-row">
  118 + <label class="uk-form-label">换车原因</label>
  119 + <div class="uk-form-controls">
  120 + <select class="form-control" name="reason" required>
  121 + <option value="">请选择...</option>
  122 + {{each inOutExps as exp i}}
  123 + <option value="{{exp}}">{{exp}}</option>
  124 + {{/each}}
  125 + </select>
  126 + </div>
  127 + </div>
  128 + </div>
  129 + </div>
  130 + </script>
  131 +
  132 + <script id="st-v2-domains-inout-form-temp" type="text/html">
  133 + <div class="uk-grid">
  134 + <div class="uk-width-1-2">
  135 + <div class="uk-form-row" style="padding-top: 5px;">
  136 + <label class="uk-form-label"></label>
  137 + <div class="uk-form-controls">
  138 + <label data-uk-tooltip title="如是无人售票线路,忽略这个选项">
  139 + <input type="checkbox" value=1 name="noClerk" class="i-cbox"> 无售票员
  140 + </label>
  141 + </div>
  142 + </div>
  143 + </div>
  144 + <div class="uk-width-1-2 destroy_reason_wrap">
  145 + <div class="uk-form-row">
  146 + <label class="uk-form-label">进出场原因</label>
  147 + <div class="uk-form-controls">
  148 + <select class="form-control" name="reason" required>
  149 + <option value="">请选择...</option>
  150 + {{each inOutExps as exp i}}
  151 + <option value="{{exp}}">{{exp}}</option>
  152 + {{/each}}
  153 + </select>
  154 + </div>
  155 + </div>
  156 + </div>
  157 + </div>
  158 + </script>
  159 +
  160 + <script id="st-v2-domains-service-form-temp" type="text/html">
  161 + <div class="uk-grid">
  162 + <div class="uk-width-1-2">
  163 + <div class="uk-form-row" style="padding-top: 5px;">
  164 + <label class="uk-form-label"></label>
  165 + <div class="uk-form-controls">
  166 + <label>
  167 + <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班
  168 + </label>
  169 + </div>
  170 + </div>
  171 + </div>
  172 + <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;">
  173 + <div class="uk-form-row">
  174 + <label class="uk-form-label">烂班原因</label>
  175 + <div class="uk-form-controls">
  176 + <select class="form-control" name="reason" required>
  177 + <option value="">请选择...</option>
  178 + {{each adjustExps as exp i}}
  179 + <option value="{{exp}}">{{exp}}</option>
  180 + {{/each}}
  181 + </select>
  182 + </div>
  183 + </div>
  184 + </div>
  185 + </div>
  186 + </script>
  187 + <script>
  188 + (function () {
  189 + var modal = '#add-sub-task-main-modal', sch,
  190 + stationRoutes,
  191 + parks,
  192 + information;
  193 +
  194 + $(modal).on('init', function (e, data) {
  195 + e.stopPropagation();
  196 + sch = data.sch;
  197 +
  198 + //站点路由
  199 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  200 + return a.stationRouteCode - b.stationRouteCode;
  201 + }), 'directions');
  202 + //停车场
  203 + parks = gb_data_basic.simpleParksArray();
  204 + //线路标准
  205 + information = gb_data_basic.getLineInformation(sch.xlBm);
  206 +
  207 + var st_doms = gb_schedule_context_menu.get_st_doms();
  208 + //普通
  209 + $('.normalCont', modal).html(st_doms.custom_dom);
  210 + $('.add_custom_wrap', modal).trigger('init', data);
  211 +
  212 + //进出场班次
  213 + if(sch.bcType=='in'||sch.bcType=='out'){
  214 + $('.left_tabs_lg li[name=in_out]').remove();
  215 + $('.left_tabs_lg li[name=range_turn]').remove();
  216 + }
  217 + else{
  218 + //进出场
  219 + $('.inOutCont', modal).html(st_doms.inout_dom);
  220 + $('.add_inOut_wrap', modal).trigger('init', data);
  221 + //区间调头
  222 + $('.rangeTurnCont', modal).html(st_doms.range_dom);
  223 + $('.add_range_wrap', modal).trigger('init', data);
  224 + }
  225 + });
  226 +
  227 + //班次类型切换事件
  228 + $(modal).on('change', 'select[name=type2]', reCalcInputs_type);
  229 + //烂班选项点击事件
  230 + $(modal).on('change', 'input[name=destroy]', destroyClick);
  231 + //起终点站切换事件
  232 + $(modal).on('change', 'select[name=startStation],select[name=endStation]', reCalcInputs_station);
  233 + //开始时间和公里数改变
  234 + $(modal).on('input', 'input[name=startDate], input[name=mileage]', reCalcEndTime);
  235 + //终点时间改变
  236 + $(modal).on('input', 'input[name=endDate]', reCalcNext_s_time);
  237 + //进出场原因切换
  238 + $(modal).on('change', 'select[name=reason]', reSynchroReason);
  239 + //关闭
  240 + $(modal).on('click', '.task_form_close_icon', closeTaskForm);
  241 +
  242 + /**
  243 + * 根据班次类型切换起终点下拉框
  244 + */
  245 + function reCalcInputs_type() {
  246 + var f = $(this).parents('.sub_task_form_v2');
  247 +
  248 + var routes = stationRoutes[sch.xlDir]
  249 + , lastCode = routes[routes.length - 1].stationCode
  250 + , opts = '', park_opts = '';
  251 + //station options
  252 + $.each(routes, function () {
  253 + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'
  254 + });
  255 + //park options
  256 + for (var code in parks)
  257 + park_opts += '<option value="' + code + '">' + parks[code] + '</option>';
  258 +
  259 + var qdz = $f('startStation', f), zdz = $f('endStation', f), mType = $f('mileageType', f);
  260 + var domainsTemp;
  261 + switch ($(this).val()) {
  262 + case '3'://出场
  263 + qdz.html(park_opts).val(information.carPark);
  264 + zdz.html(opts);
  265 + mType.val('empty').attr('disabled', 'disabled');
  266 + domainsTemp = 'st-v2-domains-inout-form-temp';
  267 + //如果上一个form是进场
  268 + try {
  269 + var prev_f = f.prev('.sub_task_form_v2');
  270 + if ($f('type2', prev_f).val() == 2)
  271 + zdz.val($f('startStation', prev_f).val());
  272 + } catch (e) {
  273 + console.log(e);
  274 + }
  275 + break;
  276 + case '2'://进场
  277 + qdz.html(opts)
  278 + zdz.html(park_opts).val(information.carPark);
  279 + mType.val('empty').attr('disabled', 'disabled');
  280 + domainsTemp = 'st-v2-domains-inout-form-temp';
  281 + break;
  282 + default:
  283 + qdz.html(opts);
  284 + zdz.html(opts).val(lastCode);
  285 + mType.val('service').removeAttr('disabled');
  286 + domainsTemp = 'st-v2-domains-service-form-temp';
  287 + }
  288 +
  289 + //可变选项区域
  290 + $('.domains', f).html(template(domainsTemp, {
  291 + adjustExps: gb_common.adjustExps,
  292 + inOutExps: gb_common.inOutExps
  293 + }));
  294 +
  295 + //校验reason
  296 + f.trigger('add_reason_field');
  297 + //qdz.trigger('change');
  298 + //zdz.trigger('change');
  299 + }
  300 +
  301 + /**
  302 + * 根据站位站距计算公里和时间
  303 + */
  304 + function reCalcInputs_station() {
  305 + var f = $(this).parents('.sub_task_form_v2')
  306 + , type2 = $f('type2', f).val()//班次类型
  307 + , qdzCode = $f('startStation', f).val()//起点站
  308 + , zdzCode = $f('endStation', f).val()//终点站
  309 + , startDate = $f('startDate', f).val();//开始时间
  310 + var mileage, time, upDown;
  311 + switch (type2) {
  312 + case '2':
  313 + upDown = inout_updown(qdzCode, sch);
  314 + break;
  315 + case '3':
  316 + upDown = inout_updown(zdzCode, sch);
  317 + break;
  318 + default:
  319 + upDown = sch.xlDir
  320 + }
  321 +
  322 + switch (upDown + '_' + type2) {
  323 + case '0_3'://上行出场
  324 + mileage = information.upOutMileage;
  325 + time = information.upOutTimer;
  326 + break;
  327 + case '1_3'://下行出场
  328 + mileage = information.downOutMileage;
  329 + time = information.downOutTimer;
  330 + break;
  331 + case '0_2'://上行进场
  332 + mileage = information.upInMileage;
  333 + time = information.upInTimer;
  334 + break;
  335 + case '1_2'://下行进场
  336 + mileage = information.downInMileage;
  337 + time = information.downInTimer;
  338 + break;
  339 + default:
  340 + //线路上站点间
  341 + mileage = calcMileageByRoutes(stationRoutes[upDown], qdzCode, zdzCode);
  342 + time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage);
  343 + }
  344 +
  345 + $f('mileage', f).val(mileage);
  346 + var et = moment(startDate, 'HH:mm').add(time, 'minutes');
  347 + $f('endDate', f).val(et.format('HH:mm'));
  348 +
  349 + if (type2 != 1) {
  350 + reCalcEndTime.call(this);
  351 + }
  352 + }
  353 +
  354 + /**
  355 + * 计算结束时间
  356 + */
  357 + function reCalcEndTime() {
  358 + var f = $(this).parents('.sub_task_form_v2')
  359 + , startDate = $f('startDate', f).val()//开始时间
  360 + , mileage = $f('mileage', f).val()//公里
  361 + , type2 = $f('type2', f).val();//班次类型
  362 + if (!startDate || !mileage)
  363 + return;
  364 +
  365 + var time;
  366 + if (type2 == 1) {
  367 + time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage);
  368 + }
  369 + else if (type2 == 2) {
  370 + //进场
  371 + var qdzCode = $f('startStation', f).val(),
  372 + updown = inout_updown(qdzCode, sch);
  373 +
  374 + if (updown == -1)
  375 + return;
  376 + time = updown == 0 ? information.upInTimer : information.downInTimer;
  377 + }
  378 + else if (type2 == 3) {
  379 + //出场
  380 + var zdzCode = $f('endStation', f).val(),
  381 + updown = inout_updown(zdzCode, sch);
  382 +
  383 + if (updown == -1)
  384 + return;
  385 + time = updown == 0 ? information.upOutTimer : information.downOutTimer;
  386 + }
  387 +
  388 + var et = moment(startDate, 'HH:mm').add(time, 'minutes');
  389 + $f('endDate', f).val(et.format('HH:mm')).trigger('input');
  390 + }
  391 +
  392 + /**
  393 + * 将结束时间写入下一个表单的开始时间
  394 + */
  395 + function reCalcNext_s_time() {
  396 + var f = $(this).parents('.sub_task_form_v2'),
  397 + et = $f('endDate', f).val();
  398 +
  399 + var nf = gb_common.next_elem('sub_task_form_v2', f);
  400 +
  401 + if (f.attr('destroy'))
  402 + et = $f('startDate', f).val();
  403 +
  404 + if (nf.length > 0) {
  405 + $f('startDate', nf).val(et).trigger('input');
  406 + }
  407 + }
  408 +
  409 + /**
  410 + * 切换原因
  411 + */
  412 + function reSynchroReason() {
  413 + var f = $(this).parents('.sub_task_form_v2'),
  414 + reason = $(this).val();
  415 +
  416 + var nf = gb_common.next_elem('sub_task_form_v2', f),
  417 + nInput = $f('reason', nf);
  418 +
  419 + if (nf.length > 0 && nInput.length > 0) {
  420 + nInput.val(reason).trigger('change');
  421 + }
  422 + else {
  423 + var cont = f.parents('li.tab_cont'),
  424 + remInput = $('.remarks_form [name=remarks]', cont);
  425 +
  426 + if(remInput.val()==reason + ',')
  427 + return;
  428 + remInput.val(remInput.val() + reason + ',');
  429 + }
  430 + }
  431 +
  432 + function calcMileageByRoutes(routes, s, e) {
  433 + var code, flag, mileage = 0;
  434 + $.each(routes, function () {
  435 + code = this['stationCode'];
  436 + if (flag) {
  437 + if (!this.distances)
  438 + this.distances = 0;
  439 + mileage = gb_common.accAdd(mileage, this.distances);
  440 + }
  441 + if (code == s)
  442 + flag = true;
  443 + if (code == e)
  444 + return false;
  445 + });
  446 + return mileage;
  447 + }
  448 +
  449 + function destroyClick() {
  450 + var f = $(this).parents('.sub_task_form_v2');
  451 + if (this.checked) {
  452 + $('.destroy_reason_wrap', f).show();
  453 + f.attr('destroy', true).addClass('destroy_form');
  454 + }
  455 + else {
  456 + $('.destroy_reason_wrap', f).hide();
  457 + f.removeAttr('destroy').removeClass('destroy_form');
  458 + }
  459 + }
  460 +
  461 + function $f(name, f) {
  462 + return $('[name=' + name + ']', f);
  463 + }
  464 +
  465 + function closeTaskForm() {
  466 + $(this).parents('.sub_task_form_v2').remove();
  467 + }
  468 +
  469 + /**
  470 + * 进出场上下行
  471 + * @param qdzCode
  472 + * @param sch
  473 + */
  474 + function inout_updown(station, sch) {
  475 + if (station == sch.qdzCode)
  476 + return sch.xlDir;
  477 + else if (station == sch.zdzCode)
  478 + return sch.xlDir == 0 ? 1 : 0;
  479 + else
  480 + return -1;
  481 + }
  482 +
  483 + })();
  484 + </script>
  485 +</div>
0 \ No newline at end of file 486 \ No newline at end of file
src/main/resources/static/real_control_v2/js/common.js
@@ -21,6 +21,9 @@ var gb_common = (function () { @@ -21,6 +21,9 @@ var gb_common = (function () {
21 0x12: '报警' 21 0x12: '报警'
22 }; 22 };
23 23
  24 + var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他'];
  25 + var inOutExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他'];
  26 +
24 var groupBy = function (list, field) { 27 var groupBy = function (list, field) {
25 var rs = {}, 28 var rs = {},
26 key; 29 key;
@@ -324,6 +327,17 @@ var gb_common = (function () { @@ -324,6 +327,17 @@ var gb_common = (function () {
324 return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e; 327 return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e;
325 }; 328 };
326 329
  330 + function accDiv(arg1,arg2){
  331 + var t1=0,t2=0,r1,r2;
  332 + try{t1=arg1.toString().split(".")[1].length}catch(e){}
  333 + try{t2=arg2.toString().split(".")[1].length}catch(e){}
  334 + with(Math){
  335 + r1=Number(arg1.toString().replace(".",""))
  336 + r2=Number(arg2.toString().replace(".",""))
  337 + return (r1/r2)*pow(10,t2-t1);
  338 + }
  339 + }
  340 +
327 function mul(a, b) { 341 function mul(a, b) {
328 var c = 0, 342 var c = 0,
329 d = a.toString(), 343 d = a.toString(),
@@ -372,6 +386,26 @@ var gb_common = (function () { @@ -372,6 +386,26 @@ var gb_common = (function () {
372 return rs; 386 return rs;
373 }; 387 };
374 388
  389 + var next_elem = function (clazz, e) {
  390 + var ne = e.next();
  391 + if(ne.length==0)
  392 + return [];
  393 + else if(ne.hasClass(clazz))
  394 + return ne;
  395 + else
  396 + return next_elem(clazz, ne);
  397 + };
  398 +
  399 + var getDisabledVal = function (f) {
  400 + var rs = {};
  401 + $('input,select', f).each(function () {
  402 + if($(this).attr('disabled')){
  403 + rs[$(this).attr('name')]=$(this).val();
  404 + }
  405 + });
  406 + return rs;
  407 + };
  408 +
375 return { 409 return {
376 reqCode80: reqCode80, 410 reqCode80: reqCode80,
377 groupBy: groupBy, 411 groupBy: groupBy,
@@ -395,7 +429,13 @@ var gb_common = (function () { @@ -395,7 +429,13 @@ var gb_common = (function () {
395 trim: trim, 429 trim: trim,
396 remarksAutocomplete: remarksAutocomplete, 430 remarksAutocomplete: remarksAutocomplete,
397 flatpickrDateTimeConfig: flatpickrDateTimeConfig, 431 flatpickrDateTimeConfig: flatpickrDateTimeConfig,
398 - inverse: inverse 432 + inverse: inverse,
  433 + accDiv: accDiv,
  434 + mul: mul,
  435 + adjustExps: adjustExps,
  436 + inOutExps: inOutExps,
  437 + next_elem: next_elem,
  438 + getDisabledVal: getDisabledVal
399 439
400 //whichTransitionEvent:whichTransitionEvent 440 //whichTransitionEvent:whichTransitionEvent
401 }; 441 };
src/main/resources/static/real_control_v2/js/forms/form_embed.js
@@ -61,7 +61,7 @@ var gb_embed_form_hanlde = (function () { @@ -61,7 +61,7 @@ var gb_embed_form_hanlde = (function () {
61 61
62 } 62 }
63 }); 63 });
64 - } 64 + };
65 65
66 66
67 return { 67 return {
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
@@ -7,7 +7,23 @@ var gb_schedule_context_menu = (function () { @@ -7,7 +7,23 @@ var gb_schedule_context_menu = (function () {
7 bgclose: false 7 bgclose: false
8 }, 8 },
9 folder = '/real_control_v2/fragments/line_schedule/context_menu'; 9 folder = '/real_control_v2/fragments/line_schedule/context_menu';
  10 +
  11 + //提前缓存子任务的片段页面
  12 + var st_doms={};
  13 + $.get(folder + '/sub_task_v2/add_custom.html', function (dom) {
  14 + st_doms.custom_dom=dom;
  15 + });
  16 + $.get(folder + '/sub_task_v2/add_in_out.html', function (dom) {
  17 + st_doms.inout_dom=dom;
  18 + });
  19 + $.get(folder + '/sub_task_v2/add_range_turn.html', function (dom) {
  20 + st_doms.range_dom=dom;
  21 + });
  22 +
10 var callbackHandler = { 23 var callbackHandler = {
  24 + get_st_doms: function () {
  25 + return st_doms;
  26 + },
11 dftz: function (sch) { 27 dftz: function (sch) {
12 open_modal(folder + '/dftz.html', { 28 open_modal(folder + '/dftz.html', {
13 sch: sch 29 sch: sch
@@ -234,6 +250,11 @@ var gb_schedule_context_menu = (function () { @@ -234,6 +250,11 @@ var gb_schedule_context_menu = (function () {
234 open_modal(folder + '/add_temp_sch.html', { 250 open_modal(folder + '/add_temp_sch.html', {
235 sch: sch 251 sch: sch
236 }, modal_opts); 252 }, modal_opts);
  253 + },
  254 + add_sub_task: function (sch) {
  255 + open_modal(folder + '/sub_task_v2/main.html', {
  256 + sch: sch
  257 + }, modal_opts);
237 } 258 }
238 }; 259 };
239 260
@@ -274,7 +295,7 @@ var gb_schedule_context_menu = (function () { @@ -274,7 +295,7 @@ var gb_schedule_context_menu = (function () {
274 }, 295 },
275 'lj_zrw': { 296 'lj_zrw': {
276 name: '临加/子任务' 297 name: '临加/子任务'
277 - }, 298 + }/*,
278 'shortcut': { 299 'shortcut': {
279 name: '...', 300 name: '...',
280 items: { 301 items: {
@@ -294,6 +315,13 @@ var gb_schedule_context_menu = (function () { @@ -294,6 +315,13 @@ var gb_schedule_context_menu = (function () {
294 name: '(子任务)区间调头' 315 name: '(子任务)区间调头'
295 } 316 }
296 } 317 }
  318 + }*/,
  319 + 'sep3': '---------',
  320 + 'add_temp_sch': {
  321 + name: '添加临加班次'
  322 + },
  323 + 'add_sub_task': {
  324 + name: '添加子任务'
297 }, 325 },
298 'sep4': '---------', 326 'sep4': '---------',
299 'tzrc': { 327 'tzrc': {
@@ -305,7 +333,7 @@ var gb_schedule_context_menu = (function () { @@ -305,7 +333,7 @@ var gb_schedule_context_menu = (function () {
305 'wdtz': { 333 'wdtz': {
306 name: '误点调整' 334 name: '误点调整'
307 }, 335 },
308 - 'sep3': '---------', 336 + 'sep4': '---------',
309 'lp_change': { 337 'lp_change': {
310 name: '路牌对调' 338 name: '路牌对调'
311 } 339 }