index.js
39.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
import {
allDictData, // 获取全部字典
findDestinationFltRuleByFlightNo, // 航线维度设置详情
findByFlightId, // 通过id查询目的航班维度设置详情
} from "@/api/destinationFlight";
import { formConfig, routeRuleForm } from "../flightRouteInfo/formConfig";
import { removeDuplicates } from "@/utils";
export default {
data() {
return {
formConfig: formConfig, // 表单配置项
queryForm: {
// 表单参数
},
routeSpecifyDateSeq: [], // 日期级别航班顺位
};
},
computed: {
// 获取路由参数
getRouter() {
if (this.$route.query.name == "add") {
return "保存";
} else if (this.$route.query.name == "edit") {
return "修改";
} else {
return false;
}
},
},
methods: {
// 指定隐藏或显示From表单域
hiddenFormItem({ dataStatus, querySpecifyData }) {
// 指定隐藏或显示From表单域【add时】
if (dataStatus == "add") {
formConfig.map((item) => {
if (item.type !== "slot") {
item.disable = false;
if (item.label == "航班日期" || item.label == "航线") {
item.hidden = true;
}
}
});
} else {
// 【edit和view及空值时】
formConfig.map((item) => {
if (item.type !== "slot") {
item.disable = true;
if (item.label == "航班日期" || item.label == "航线") {
item.hidden = false;
}
}
});
}
// 【航班配舱设置】非日期级别
if (querySpecifyData == "2") {
formConfig.map((item) => {
if (item.type !== "slot") {
if (item.label == "航线") {
item.hidden = true;
}
}
});
}
// 【航班配舱设置】日期级别
if (querySpecifyData == "1") {
formConfig.map((item) => {
if (item.type !== "slot") {
if (item.label == "航线") {
item.hidden = true;
}
}
});
}
},
// 页面跳转传参
queryCondition(parmas) {
let _this = this;
// 航班配舱维度规则设置查询条件
let queryCondition = {
// 航班配舱设置
flightAllocConfig: {
noDateParmas: {
flightDate: "",
flightRoute: "",
purposeOfFlightNo: parmas.purposeOfFlightNo,
status: parmas.status,
},
dateParmas: {
flightDate: parmas.flightDate,
flightRoute: "",
flightRouteListStr: "",
purposeOfFlightNo: parmas.purposeOfFlightNo,
status: parmas.status,
},
queryParmas: function () {
// 非日期级别
if (parmas.querySpecifyData == "2") {
_this.noDateLevelData(this.noDateParmas);
}
// 日期级别
if (parmas.querySpecifyData == "1") {
_this.dateLevelData({
dateParmas: this.dateParmas,
noDateParmas: this.noDateParmas,
});
}
_this.queryForm = _this.$route.query; // 获取跳转过来的参数
},
},
// 航班信息维护
flightInformationMaintenance: {
noDateParmas: {
purposeOfFlightNo: parmas.purposeOfFlightNo,
flightRouteListStr: parmas.flightRouteListStr,
status: "",
},
dateParmas: {
purposeOfFlightNo: parmas.purposeOfFlightNo,
flightDate: parmas.flightDate,
flightRouteListStr: parmas.flightRouteListStr,
status: "",
},
queryParmas: function () {
// White Tail
if (parmas.flightKindName == "White Tail") {
_this.dateLevelData({
dateParmas: this.dateParmas,
noDateParmas: this.noDateParmas,
});
}
// Purple Tail
if (parmas.flightKindName == "Purple Tail") {
_this.dateLevelData({
dateParmas: this.dateParmas,
noDateParmas: this.noDateParmas,
});
}
},
},
// 航班顺位设置
flightRandConfig: {
noDateParmas: {
flightRoute: "",
flightRouteListStr: "",
purposeOfFlightNo: parmas.purposeOfFlightNo,
status: "",
},
dateParmas: {
flightDate: parmas.flightDate,
flightRoute: "",
purposeOfFlightNo: parmas.purposeOfFlightNo,
status: "",
},
queryParmas: function () {
// 普通级别
if (parmas.pageName == "flightRandConfig") {
_this.dateLevelData({
dateParmas: this.dateParmas,
noDateParmas: this.noDateParmas,
});
}
},
},
// 【系统日志】DM数据处理
dmLog: {
queryParmas: function () {
if (parmas.pageName == "dmLog") {
_this.getFindByFlightId({
id: parmas.id,
});
}
},
},
};
// 航班配舱设置
queryCondition.flightAllocConfig.queryParmas();
// 航班信息维护
queryCondition.flightInformationMaintenance.queryParmas();
// 航班顺位设置
queryCondition.flightRandConfig.queryParmas();
// 【系统日志】DM数据处理
queryCondition.dmLog.queryParmas();
},
// 获取所有数据字典
getAllDictData() {
allDictData()
.then((res) => {
if (res.code != 200) {
this.msgError(res.msg);
return;
}
// 给checkBox表单赋值做展示信息
const { data } = res;
this.cargoType = data.cargoType; // 申报类别
this.cargoStatus = data.cargoStatus; // 货物类型
this.puporpux = data.puporpux; // 取件扫描号
// Service Code
this.serviceCode = this.dicSort(
data.serviceCode.sort((a, b) =>
a.chineseName.localeCompare(b.chineseName)
)
);
// Handling Code
this.handlingCode = this.dicSort(
this.sorttodo(data.handlingCode, "BLANK")
);
// Sub Category
this.subCategory = this.dicSort(
this.sorttodo(data.subCategory, "Blank")
);
})
.catch(() => {});
},
// 【接口调用和数据去重整合】普通级别
noDateLevelRoute(parmas) {
return new Promise((resolve, reject) => {
this.pageLoading = true;
findDestinationFltRuleByFlightNo(parmas)
.then((res) => {
const { code, data, msg } = res;
if (code != 200) {
this.msgError(msg);
return;
}
let noDateRouteLists = data.routeList; // 只负责展示航线优先级
// 航班航线基本信息(过滤ET86航线的)
let noDateRouteList = data.routeList.filter(
(item) => item.etesRule == "N"
);
// 航班信息维护从非日期级别拿数据时要删掉id 和 historyId
if (
this.$route.query.flightKindName == "Purple Tail" ||
this.$route.query.flightKindName == "White Tail" ||
this.$route.query.querySpecifyData == "1"
) {
data.list.map((item) => {
delete item.id;
delete item.historyId;
return item;
});
}
// 普通级别航班航线维度规则详情
const noDateDataList = removeDuplicates(data.list, {
duplicate: "flightRoute", // 去重字段
dateTime: "createTime", // 从重复的数据中根据时间取最新的一条
sort: false, // 是否要排序
sortType: "Number", // 排序类型
sortAttr: "routePriority", // 排序字段
});
// 整合飞行航线配置信息
const mergeNoDateRouteInfo = this.mergeFlightRouteConfigObj(
noDateRouteList,
noDateDataList
);
// 当前所有航线都有航线配置信息返回true,否则返回false
let noDateConfigFlag = mergeNoDateRouteInfo.every(
(item) => item.config == true
);
if (noDateDataList.length == 0) {
noDateConfigFlag = false;
}
resolve({
noDateConfigFlag,
noDateRouteLists,
noDateRouteList,
mergeNoDateRouteInfo,
});
})
.catch(() => {
this.pageLoading = false;
});
});
},
// 【接口调用和数据去重整合】日期级别
dateLevelRoute(parmas) {
return new Promise((resolve, reject) => {
this.pageLoading = true;
findDestinationFltRuleByFlightNo(parmas)
.then((res) => {
const { code, data, msg } = res;
if (code != 200) {
this.msgError(msg);
return;
}
let dateDataLists = data.routeList; // 只负责展示航线优先级
this.routeSpecifyDateSeq = data.routeList; // 日期级别航班顺位
// 航班航线基本信息(过滤ET86航线的)
let dateRouteList = data.routeList.filter(
(item) => item.etesRule == "N"
);
// 日期级别航班航线维度规则详情
const dateDataList = removeDuplicates(data.list, {
duplicate: "flightRoute", // 去重字段
dateTime: "createTime", // 从重复的数据中根据时间取最新的一条
sort: false, // 是否要排序
sortType: "Number", // 排序类型
sortAttr: "routePriority", // 排序字段
});
// 整合飞行航线配置信息,对没有航线配置信息的也已经做了config为false的处理;
const mergeDateRouteInfo = this.mergeFlightRouteConfigObj(
dateRouteList,
dateDataList
);
/*
【dateConfigFlag】:
判断日期级别的航线有没有航线配置的数据,如果其中一条没有返回false,
然后再接着调用非日期级别的查询做数据处理;
*/
let dateConfigFlag = mergeDateRouteInfo.every(
(item) => item.config == true
);
if (dateDataList.length == 0) {
dateConfigFlag = false;
}
// 返回日期级别查询结果
resolve({
dateConfigFlag,
dateDataLists,
dateRouteList,
mergeDateRouteInfo,
});
})
.catch(() => {});
});
},
// 根据航班号ID查看航班航线配置详情
getFindByFlightId(parmas) {
this.pageLoading = true;
findByFlightId(parmas)
.then((res) => {
const { code, data, msg } = res;
if (code != 200) {
this.msgError(msg);
return;
}
const routeList = [data.list];
// 航班航线维度规则详情
const dataList = removeDuplicates(routeList, {
duplicate: "flightRoute", // 去重字段
dateTime: "createTime", // 从重复的数据中根据时间取最新的一条
sort: false, // 是否要排序
sortType: "Number", // 排序类型
sortAttr: "routePriority", // 排序字段
});
// 将flightRoute航线赋值给route属性,并且追加到当前对象
routeList.map((item) => {
if (item.flightRoute) {
item.route = item.flightRoute;
}
});
// 整合飞行航线配置信息,对没有航线配置信息的也已经做了config为false的处理;
const mergeRouteInfo = this.mergeFlightRouteConfigObj(
routeList,
dataList
);
// 处理属性
mergeRouteInfo.map((item) => {
if (item.config) {
this.hasOwnProperty(item, "typeOfGoods");
this.hasOwnProperty(item, "puporpuxCode");
this.hasOwnProperty(item, "serviceCode");
this.hasOwnProperty(item, "handlingCode");
this.hasOwnProperty(item, "subCategory");
this.setattrVal(item); // 设置属性值
}
});
this.routeList = routeList; // 航班航线列表
mergeRouteInfo.sort((a, b) => {
return (
routeList.findIndex((item) => item.route == a.route) -
routeList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = mergeRouteInfo; // 航班航线配置信息列表
this.pageLoading = false;
})
.catch(() => {
this.pageLoading = false;
});
},
// 拿到【接口调用和数据去重整合】的数据做数据页面显示处理:非日期级别
noDateLevelData(noDateParmas) {
this.noDateLevelRoute(noDateParmas).then(
({ noDateConfigFlag, noDateRouteList, mergeNoDateRouteInfo }) => {
// 满足非日期级别航线的配置信息
// 处理属性
mergeNoDateRouteInfo.map((item) => {
if (item.config) {
this.hasOwnProperty(item, "typeOfGoods");
this.hasOwnProperty(item, "puporpuxCode");
this.hasOwnProperty(item, "serviceCode");
this.hasOwnProperty(item, "handlingCode");
this.hasOwnProperty(item, "subCategory");
this.setattrVal(item); // 设置属性值
}
});
this.routeList = noDateRouteList; // 航班航线列表
mergeNoDateRouteInfo.sort((a, b) => {
return (
noDateRouteList.findIndex((item) => item.route == a.route) -
noDateRouteList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = mergeNoDateRouteInfo; // 航班航线配置信息列表
this.pageLoading = false;
}
);
},
// 拿到【接口调用和数据去重整合】的数据做数据页面显示处理:日期级别
dateLevelData({ dateParmas, noDateParmas }) {
this.dateLevelRoute(dateParmas).then((res) => {
const {
dateConfigFlag,
dateDataLists,
dateRouteList,
mergeDateRouteInfo,
} = res;
if (dateConfigFlag) {
// 日期级别当前航班航线配置没有缺省的,就不用再去查询非日期级别了
// 处理属性
mergeDateRouteInfo.map((item) => {
if (item.config) {
this.hasOwnProperty(item, "typeOfGoods");
this.hasOwnProperty(item, "puporpuxCode");
this.hasOwnProperty(item, "serviceCode");
this.hasOwnProperty(item, "handlingCode");
this.hasOwnProperty(item, "subCategory");
this.setattrVal(item); // 设置属性值
}
});
this.routeList = dateRouteList; // 航班航线列表
mergeDateRouteInfo.sort((a, b) => {
return (
dateRouteList.findIndex((item) => item.route == a.route) -
dateRouteList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = mergeDateRouteInfo; // 航班航线配置信息列表
if (this.$route.query.flightKindName == "Purple Tail") {
this.showFlightKind(dateDataLists);
}
this.pageLoading = false;
} else {
// 当前航线有缺省的航线配置
// 航班航线有规则配置的
const dateListHas = mergeDateRouteInfo.filter(
(item) => item.config == true
);
// 航班航线没有规则配置的
const dateListNo = mergeDateRouteInfo.filter(
(item) => item.config == false
);
this.noDateLevelRoute(noDateParmas).then(
({
noDateConfigFlag,
noDateRouteLists,
noDateRouteList,
mergeNoDateRouteInfo,
}) => {
// 航班种类
this.flightKindName({
noDateConfigFlag,
noDateRouteLists,
noDateRouteList,
mergeNoDateRouteInfo,
dateDataLists,
dateRouteList,
dateListHas,
dateListNo,
});
}
);
}
});
},
// 航班种类
flightKindName({
noDateConfigFlag,
noDateRouteLists,
noDateRouteList,
mergeNoDateRouteInfo,
dateDataLists,
dateRouteList,
dateListHas,
dateListNo,
}) {
if (this.$route.query.flightKindName == "White Tail") {
// White Tail只展示当前查询的一条
const route = this.$route.query.flightRouteListStr;
let noDateRouteInfo, result;
this.routeList = dateRouteList;
// 从日期取
if (dateListHas.length) {
const dateRouteInfo = dateListHas.filter(
(item) => item.flightRoute == route
);
result = dateRouteInfo; // 航班航线配置信息列表
} else {
// 从非日期级别取
noDateRouteInfo = mergeNoDateRouteInfo.filter(
(item) => item.flightRoute == route
);
result = noDateRouteInfo; // 航班航线配置信息列表
}
if (result.length) {
// 处理属性
result.map((item) => {
if (item.config) {
this.hasOwnProperty(item, "typeOfGoods");
this.hasOwnProperty(item, "puporpuxCode");
this.hasOwnProperty(item, "serviceCode");
this.hasOwnProperty(item, "handlingCode");
this.hasOwnProperty(item, "subCategory");
this.setattrVal(item); // 设置属性值
}
});
result.sort((a, b) => {
return (
dateRouteList.findIndex((item) => item.route == a.route) -
dateRouteList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = result;
this.pageLoading = false;
} else {
// 日期级别和非日期级别都没有配置信息的时候,
// 从数据整合的里面取一个对应的航线数据作为回显暂无数据处理。
noDateRouteInfo = mergeNoDateRouteInfo.filter(
(item) => item.route == route
);
noDateRouteInfo.sort((a, b) => {
return (
dateRouteList.findIndex((item) => item.route == a.route) -
dateRouteList.findIndex((item) => item.route == b.route)
);
});
// this.defaultRouteData(noDateRouteInfo) // 默认航线配置信息数据;
this.routesInfo = noDateRouteInfo;
this.pageLoading = false;
}
} else {
// 日期级别和航班种类为Purple Tail的时候
// 日期级别的时候要注意dateListNo里没有flightRoute字段,也就是说只有航班航线没有航班航线配置信息;
// 其次是非日期级别mergeNoDateRouteInfo也可能没有对应的数据,没有flightRoute字段。
// 那么这个时候使用mergeFlightRouteConfigObj方法就会出问题。
const result = this.mergeFlightRouteConfigObj(
dateListNo,
mergeNoDateRouteInfo
);
let dateList = dateListHas.concat(result);
// 处理属性
dateList.map((item) => {
if (item.config) {
this.hasOwnProperty(item, "typeOfGoods");
this.hasOwnProperty(item, "puporpuxCode");
this.hasOwnProperty(item, "serviceCode");
this.hasOwnProperty(item, "handlingCode");
this.hasOwnProperty(item, "subCategory");
this.setattrVal(item); // 设置属性值
}
});
this.routeList = dateRouteList; // 航线优先级
// 查找包含的航线并且按照dateList航线排序
dateList.sort((a, b) => {
return (
dateRouteList.findIndex((item) => item.route == a.route) -
dateRouteList.findIndex((item) => item.route == b.route)
);
});
if (this.$route.query.flightKindName == "Purple Tail") {
let flightRouteListStr =
this.$route.query.flightRouteListStr.split(";"); // 跳转传过来的航线
// 查找跳转传过来的对应的航线把包含的航线并且按照dateDataLists航线排序
let inRoutes = dateDataLists
.filter((item) => flightRouteListStr.includes(item.route))
.sort(
(a, b) =>
flightRouteListStr.indexOf(a.route) -
flightRouteListStr.indexOf(b.route)
);
// 处理航线优先级展示ET86
let routes = [];
inRoutes.map((item, i, arr) => {
if (arr[i].etesRule == "Y") {
routes.push(`${arr[i].route}(ET86)`);
} else {
routes.push(arr[i].route);
}
});
// 把处理ET86航线优先级展示
this.queryForm.flightRouteListStr = routes.join(";");
// 跳转传过来的对应的航线把ET86航线的过滤掉
let noEtesRoutes = inRoutes.filter((item) => item.etesRule == "N");
let noRoutes = dateList.filter((item) => {
return noEtesRoutes.some((el) => el.route === item.route);
});
const result = noRoutes
.filter((item2) => {
return noEtesRoutes.some((item1) => {
return item1.route === item2.route;
});
})
.sort((a, b) => {
return (
noEtesRoutes.findIndex((item) => item.route === a.route) -
noEtesRoutes.findIndex((item) => item.route === b.route)
);
});
// this.defaultRouteData(result) // 默认航线配置信息数据;
this.routesInfo = result;
this.pageLoading = false;
} else {
this.queryForm = this.$route.query; // 获取跳转过来的参数
this.routesInfo = dateList;
this.pageLoading = false;
}
}
},
// 默认航线配置信息数据
defaultRouteData(result) {
// 如果当前航班号的航线下没有数据,新增规则给默认数据
routeRuleForm.purposeOfFlightNo = this.$route.query.purposeOfFlightNo;
this.setattrVal(routeRuleForm);
const routesInfo = result.map((item) => {
if (!item.config) {
item = {
...item,
...routeRuleForm,
};
}
return item;
});
return routesInfo;
},
// 处理跳转显示航线种类
showFlightKind(dateDataLists) {
let flightRouteListStr = this.$route.query.flightRouteListStr.split(";"); // 跳转传过来的航线
// 查找跳转传过来的对应的航线把包含的航线并且按照dateDataLists航线排序
let inRoutes = dateDataLists
.filter((item) => flightRouteListStr.includes(item.route))
.sort(
(a, b) =>
flightRouteListStr.indexOf(a.route) -
flightRouteListStr.indexOf(b.route)
);
// 处理航线优先级展示ET86
let routes = [];
inRoutes.map((item, i, arr) => {
if (arr[i].etesRule == "Y") {
routes.push(`${arr[i].route}(ET86)`);
} else {
routes.push(arr[i].route);
}
});
// 把处理ET86航线优先级展示
this.queryForm.flightRouteListStr = routes.join(";");
},
// 整合飞行航线配置信息
mergeFlightRouteConfigObj(routeList, dataList) {
if (dataList.length) {
let flightRoute1 = routeList.some((obj) =>
obj.hasOwnProperty("flightRoute")
);
let flightRoute2 = dataList.some((obj) =>
obj.hasOwnProperty("flightRoute")
);
const result = routeList.map((item1) => {
const item2 = dataList.find((item2) => {
if (flightRoute1) {
if (item2.route === item1.flightRoute) {
item2.config = true;
return item2;
}
} else if (flightRoute2) {
if (item2.flightRoute === item1.route) {
item2.config = true;
return item2;
}
}
}); // 返回当前相等的一条数据
if (item2) {
return { ...item1, ...item2 };
} else {
item1.config = false;
return item1; // 没有的返回当前的
}
});
return result;
} else {
// 没有航班航线配置的情况下
const result = routeList.map((item) => {
item.config = false;
if (item) {
return item;
}
});
return result;
}
},
// 回显时所用:判断对象是否存在某个属性,并且把这个属性值使用分号分隔
hasOwnProperty(item, key) {
if (item.hasOwnProperty(key)) {
if (item[key]) {
item[key] = item[key].split(";");
} else {
item[key] = [];
}
}
},
// 保存提交时所用:改方法主要用于提交保存时,再把数组转换成字符串,与hasOwnProperty相反
returnString(parmas, key) {
if (parmas.hasOwnProperty(key)) {
if (parmas[key].length) {
parmas[key] = parmas[key].join(";");
} else {
parmas[key] = null;
}
}
},
//排序
sorttodo(arr, chineseName) {
var index = 1,
newArr = [],
length = arr.length;
for (var i = 0; i < length; i++) {
if (arr[i].chineseName === chineseName) {
newArr[0] = arr[i];
} else {
newArr[index++] = arr[i];
}
}
return newArr;
},
// 数据字典排序
dicSort(val) {
let status1 = [];
let status0 = [];
let arr = [];
val.forEach((item) => {
if (item.status == 1) {
status1.push(item);
} else {
status0.push(item);
}
});
arr = status1.concat(status0);
return arr;
},
// 设置属性值
setattrVal(item) {
if (item.location) {
// 始发站
item.isLocation = "1";
}
if (item.notLocation) {
item.isLocation = "2";
}
if (item.location == null && item.notLocation == null) {
item.isLocation = "1";
}
if (item.destinationSite) {
// 目的站
item.isDestinationSite = "1";
}
if (item.notDestinationSite) {
item.isDestinationSite = "2";
}
if (item.destinationSite == null && item.notDestinationSite == null) {
item.isDestinationSite = "1";
}
let routes = [];
if (this.routeList.length) {
this.routeList.map((item) => {
routes.push(item.route);
});
routeRuleForm.routeSpecifyDateSeq = routes.join(";");
}
},
// 失焦事件
blurEvent({ originOfFlightNo }) {
this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo);
},
// 始发地
locRadio({ index, item }) {
const validateData = {
reg: /^[a-zA-Z0-9]*$/,
index: index,
radio: item.isLocation,
include: item.location,
notInclude: item.notLocation,
errorMsgAttr: "locationError",
validateForm: false, // form表单节流阀
errorMsg: {
repeat: "填写的始发站已重复",
empty: "不能为空",
error: "始发站之间用分号分隔,例:P1;P2;P3",
},
};
// this.validateParmas(validateData);
},
// 目的站
dessiteRadio({ index, item }) {
const validateData = {
reg: /^[a-zA-Z0-9]*$/,
index: index,
radio: item.isLocation,
include: item.location,
notInclude: item.notLocation,
errorMsgAttr: "destinationSiteError",
validateForm: false, // form表单节流阀
errorMsg: {
repeat: "填写的目的站已重复",
empty: "不能为空",
error: "目的站之间用分号分隔,例:P1;P2;P3",
},
};
// this.validateParmas(validateData);
},
// 校验目的地
validateParmas({
reg,
index,
radio,
include,
notInclude,
errorMsgAttr,
errorMsg,
ursaMark,
}) {
let includeVal,
notIncludeVal,
repeat = false,
validate = true;
if (radio == "1") {
if (include) {
// 分隔字符串并且转数组&去除数组空字符串
includeVal = include.split(";").filter((str) => str !== "");
// 是否有重复的
repeat = new Set(includeVal).size !== includeVal.length;
// 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/
validate = includeVal.every((item) => reg.test(item));
}
} else {
if (notInclude) {
notIncludeVal = notInclude.split(";").filter((str) => str !== "");
repeat = new Set(notIncludeVal).size !== notIncludeVal.length;
validate = notIncludeVal.every((item) => reg.test(item));
}
}
if (ursaMark) {
if (include) {
includeVal = include.split(";").filter((str) => str !== "");
repeat = new Set(includeVal).size !== includeVal.length;
validate = includeVal.every((item) => reg.test(item));
} else {
this.routesInfo[index].validateForm = true; // form表单节流阀
this.routesInfo[index][errorMsgAttr] = "";
this.$set(this.routesInfo, index, this.routesInfo[index]);
}
}
if (ursaMark == false) {
if (notInclude) {
notIncludeVal = notInclude.split(";").filter((str) => str !== "");
repeat = new Set(notIncludeVal).size !== notIncludeVal.length;
validate = notIncludeVal.every((item) => reg.test(item));
} else {
this.routesInfo[index].validateForm = true; // form表单节流阀
this.routesInfo[index][errorMsgAttr] = "";
this.$set(this.routesInfo, index, this.routesInfo[index]);
}
}
if (repeat) {
this.routesInfo[index].validateForm = false; // form表单节流阀
this.routesInfo[index][errorMsgAttr] = errorMsg.repeat;
this.$set(this.routesInfo, index, this.routesInfo[index]);
}
if (!validate) {
this.routesInfo[index].validateForm = false; // form表单节流阀
this.routesInfo[index][errorMsgAttr] = errorMsg.error;
this.$set(this.routesInfo, index, this.routesInfo[index]);
}
if (!repeat && validate) {
this.routesInfo[index].validateForm = true; // form表单节流阀
this.routesInfo[index][errorMsgAttr] = "";
this.$set(this.routesInfo, index, this.routesInfo[index]);
}
if (radio == "1" && !include) {
this.routesInfo[index].validateForm = true; // form表单节流阀
this.routesInfo[index][errorMsgAttr] = "";
this.$set(this.routesInfo, index, this.routesInfo[index]);
}
if (radio == "2" && !notInclude) {
this.routesInfo[index].validateForm = true; // form表单节流阀
this.routesInfo[index][errorMsgAttr] = "";
this.$set(this.routesInfo, index, this.routesInfo[index]);
}
},
// 包含始发站失焦事件
locationBur({ index, item }) {
// 不为空的时候做校验
const validateData = {
reg: /^[a-zA-Z0-9]*$/,
index: index,
radio: item.isLocation,
include: item.location,
notInclude: item.notLocation,
errorMsgAttr: "locationError",
validateForm: false, // form表单节流阀
errorMsg: {
repeat: "填写的始发站已重复",
empty: "不能为空",
error: "始发站之间用分号分隔,例:P1;P2;P3",
},
};
// this.validateParmas(validateData);
},
// 不包含始发站失焦事件
notLocationBur({ index, item }) {
const validateData = {
reg: /^[a-zA-Z0-9]*$/,
index: index,
radio: item.isLocation,
include: item.location,
notInclude: item.notLocation,
errorMsgAttr: "locationError",
validateForm: false, // form表单节流阀
errorMsg: {
repeat: "填写的始发站已重复",
empty: "不能为空",
error: "始发站之间用分号分隔,例:P1;P2;P3",
},
};
// this.validateParmas(validateData);
},
// 包含目的站失焦事件
destinationSiteBur({ index, item }) {
const validateData = {
reg: /^[a-zA-Z0-9]*$/,
index: index,
radio: item.isLocation,
include: item.location,
notInclude: item.notLocation,
errorMsgAttr: "destinationSiteError",
validateForm: false, // form表单节流阀
errorMsg: {
repeat: "填写的目的站已重复",
empty: "不能为空",
error: "目的站之间用分号分隔,例:P1;P2;P3",
},
};
// this.validateParmas(validateData);
},
// 不包含目的站失焦事件
notDestinationSiteBur({ index, item }) {
const validateData = {
reg: /^[a-zA-Z0-9]*$/,
index: index,
radio: item.isLocation,
include: item.location,
notInclude: item.notLocation,
errorMsgAttr: "destinationSiteError",
validateForm: false, // form表单节流阀
errorMsg: {
repeat: "填写的目的站已重复",
empty: "不能为空",
error: "目的站之间用分号分隔,例:P1;P2;P3",
},
};
// this.validateParmas(validateData);
},
// URSA包含失焦事件
includeUrsaBur({ index, item }) {
const validateData = {
reg: /^[a-zA-Z0-9]*_$/,
index: index,
ursaMark: true,
include: item.includeUrsa,
notInclude: item.notIncludeUrsa,
errorMsgAttr: "ursaError",
validateForm: false, // form表单节流阀
errorMsg: {
repeat: "填写的URSA已重复",
empty: "不能为空",
error: "URSA包含之间用分号分隔,例:P1_;F2_;F3_",
},
};
// this.validateParmas(validateData);
},
// URSA不包含失焦事件
notIncludeUrsaBur({ index, item }) {
const validateData = {
reg: /^[a-zA-Z0-9]*$/,
index: index,
ursaMark: false,
include: item.includeUrsa,
notInclude: item.notIncludeUrsa,
errorMsgAttr: "notUrsaError",
validateForm: false, // form表单节流阀
errorMsg: {
repeat: "填写的URSA已重复",
empty: "不能为空",
error: "URSA包含之间用分号分隔,例:P1;F2;F3",
},
};
// this.validateParmas(validateData);
},
// 最少件数失焦事件
minNumOfPiecesBur({ index, item }) {
// console.log("minNumOfPiecesBur", index, item);
},
// 最多件数失焦事件
maxNumOfPiecesBur({ index, item }) {
// console.log("maxNumOfPiecesBur", index, item);
},
// 最小重量失焦事件
minWeightBur({ index, item }) {
// console.log("minWeightBur", index, item);
},
// 最大重量失焦事件
maxWeightBur({ index, item }) {
// console.log("maxWeightBur", index, item);
},
},
};
/*
【整个航班航线维度设置的回显逻辑以及数据处理思路】如下:
1:获取航班航线列表和航班航线配置信息列表。
2:如果航班航线配置信息列表有数据,先做航线去重。
3:拿航班航线列表和航班航线配置信息列表去做遍历,判断当前航班航线在航班航线配置信息列表中有没有对应的数据。
如果有给当前航班航线设置一个属性值为true的config属性,并且把当前航班航线与航线配置信息列表中对应的对象合并,
如果当前航班航线没有在航线配置列表中找到,那么直接给航班航线列表中的这条航线数据设置一个属性值为false的config属性。
4:当把航班航线列表和航班航线配置信息列表数据整合到一块以后,那么在做数据渲染的时候就可以根据config值来显示当前航班航线有没有航线配置信息,
从而显示暂无数据用来去展示“新增规则”按钮。
此外config属性还有一个作用就是在做日期级别航线查询的时候,如果日期级别的航线没有航线配置信息会走一次非日期级别的航线配置信息查询,
那么当有了这个config属性,如果在做日期级别航线配置信息查询的时候,当前日期级别航班航线列表与航班航线配置信息列表做遍历查询时,
且航班航线列表每一个航线都有航班航线配置信息,那么就可以使用every对航班航线列表与航班配置信息列表做数据整合之后做遍历。
当返回true时,那么就不需要再走一次非日期级别的航线配置信息查询了,当返回false说明航班航线列表中存在没有航班航线的配置信息,
那么这个时候就可以根据config属性值为false走一次非日期级别的航线配置信息查询;
5:【航班配舱设置】逻辑:根据路由跳转传参过来的querySpecifyData值,如果querySpecifyData等于2的时候就是非日期级别,
那么只需要走非日期级别的查询即可,如果querySpecifyData属性值等于1的时候,说明是日期级别的,那么则走日期级别的查询,
但是当航班航线列表和航班航线配置信息列表做数据整合之后返回的数组中的JSON对象中config属性值有一个为false,
那么如同上述第4条提的,就需要再走一次非日期级别的航线配置信息查询;反之则不需要;
6:【航班信息维护】逻辑:和上述第5条查询的区别之处是根据航班种类flightKindName字段是White Tail还是Purple Tail,
但是不管是哪种航班类型都是先走日期级别的航班航线配置信息查询,当有config属性值有一个为false的时候还需要走一次非日期级别的航班航线配置信息查询。
但是有一点就是White Tail只查询一条航班航线配置信息,根据从航班信息维护White Tail类型查看维度,
做路由跳转传参带过来的航线首先在日期级别航线配置信息中遍历查询有没有该航班航线的配置信息,如果有,
那么则不需要再走一次非日期级别的航班航线配置信息查询,如果没有那么则再走一次非日期航班航线配置信息查询。
但是航线优先级显示的航线还是取日期级别航班航线列表中的航线。最后航班航线配置信息依照航班航线列表排序即可;
7:航班航线信息列表和航班航线配置信息列表在做完航班航线配置信息列表去重之后和航班航线列表做数据整合之后,
还要对所有关于显示的数据做处理,比如页面上所有关于checkbox的勾选框radio单选框;
8: 在保存提交的时候对所有关于页面checkbox的勾选框做数据处理;
*/