季度计划补充不完整字段及计划机位、飞机号变更显示修改

This commit is contained in:
zhouyuejun
2019-01-14 11:01:29 +08:00
parent 1852eb7b04
commit 91e24db0d6
10 changed files with 427 additions and 138 deletions
-14
View File
@@ -166,10 +166,6 @@
<div #tableContainer id="table-container" class="table-container" [ngClass]="{'table-c': !tabClose,'table-o': tabClose}">
<div class="table-head" #tableHead>
<table class="table">
<!-- <colgroup>
<col *ngFor="let common_col of commonCol" [width]="common_col.COL_WIDTH">
<col *ngFor="let airline_col of render_col_lists" [width]="airline_col.COL_WIDTH">
</colgroup> -->
<thead>
<tr>
<th *ngFor="let common_col of commonCol" [ngStyle]="{'min-width':common_col.COL_WIDTH}">{{common_col.COL_CN}}</th>
@@ -181,16 +177,6 @@
<div class="table-body" #tableBody (scroll)="handleScroll($event)">
<div class="list-view-phantom" [ngStyle]="{ 'height': wait_render_data.length * 42 + 'px' }"></div>
<table #tableContent id="table" class="table table-striped">
<!-- <thead>
<tr>
<th *ngFor="let common_col of commonCol" [width]="common_col.COL_WIDTH"></th>
<th *ngFor="let airline_col of render_col_lists" [width]="airline_col.COL_WIDTH"></th>
</tr>
</thead> -->
<!-- <colgroup>
<col *ngFor="let common_col of commonCol" [width]="common_col.COL_WIDTH">
<col *ngFor="let airline_col of render_col_lists" [width]="airline_col.COL_WIDTH">
</colgroup> -->
<tbody>
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(airline_row)"
[ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}">
+3 -2
View File
@@ -61,6 +61,7 @@
th {
background-color: #ddd;
color: rgb(0, 0, 255);
text-align: center;
}
}
&::-webkit-scrollbar {
@@ -98,8 +99,8 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border: none;
// text-align: center;
border: 1px solid #dee2e6;
text-align: center;
}
}
&::-webkit-scrollbar {
+2 -2
View File
@@ -126,7 +126,6 @@ export class MainComponent implements OnInit {
ngOnInit() {
console.log(Object.prototype.toString.call({}));
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px');
this.renderer2.setStyle(this.tableBody.nativeElement, 'height', this.tableContainer.nativeElement.offsetHeight - this.tableHead.nativeElement.offsetHeight + 'px');
if (!this.tabClose) {
@@ -472,7 +471,7 @@ export class MainComponent implements OnInit {
/**
* 创建线程并执行
*/
public promise: Worker = new Worker('/adminweb/assets/web-worker-handle.js');
public promise: Worker = new Worker('/assets/web-worker-handle.js');
creatWorkers() {
let dynamicData = {
raw_data: this.raw_data,
@@ -485,6 +484,7 @@ export class MainComponent implements OnInit {
}
this.promise.postMessage(dynamicData);
this.promise.onmessage = function (e) {
console.log('=====')
this.combined_data = e.data;
this.selectChange('dynamic');
// this.promise.terminate();
@@ -1,5 +1,5 @@
<div class="main-page" #mainPage>
<div class="page-content">
<div class="main-page">
<div class="page-content" #pageContent>
<div class="search-filter mb-3" #searchFilter>
<div class="first-condition row">
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
@@ -81,7 +81,33 @@
<div class="airline-table">
<div #tableContainer id="table-container" class="table-container" [ngClass]="{'table-c': !tabClose,'table-o': tabClose}">
<table id="table" class="table table-bordered table-striped">
<div class="table-head" #tableHead>
<table class="table">
<thead>
<tr>
<th style="min-width:55px">序号</th>
<th *ngFor="let airline_col of render_col_lists" [ngStyle]="{'min-width':airline_col.COL_WIDTH}">{{airline_col.COL_CN}}</th>
</tr>
</thead>
</table>
</div>
<div class="table-body" #tableBody (scroll)="handleScroll($event)">
<div class="list-view-phantom" [ngStyle]="{ 'height': combined_data.length * 42 + 'px' }"></div>
<table #tableContent id="table" class="table table-striped">
<tbody>
<tr *ngFor="let seasonal of render_data;let i = index" (click)="selectRow(seasonal)">
<td style="min-width:55px">{{start+i+1}}</td>
<td *ngFor="let airline_col of render_col_lists" [ngStyle]="{'min-width':airline_col.COL_WIDTH}" [title]="seasonal[airline_col.COL_CODE]">{{seasonal[airline_col.COL_CODE]}}</td>
</tr>
</tbody>
</table>
</div>
<!-- <table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<th>序号</th>
@@ -91,7 +117,6 @@
<th>航空公司</th>
<th>航线类别</th>
<th>航班类别</th>
<!-- <th>航班任务</th> -->
<th>运营日</th>
<th>开始日期</th>
<th>结束日期</th>
@@ -113,7 +138,6 @@
<td>{{seasonal.airlineChnName}}</td>
<td>{{seasonal.routeTypeChn}}</td>
<td>{{seasonal.flightTypeChnName}}</td>
<!-- <td>{{seasonal.flightTask}}</td> -->
<td>{{seasonal.operationDays}}</td>
<td>{{seasonal.startDate}}</td>
<td>{{seasonal.endDate}}</td>
@@ -126,7 +150,7 @@
<td>{{seasonal.flyingTime}}</td>
</tr>
</tbody>
</table>
</table> -->
</div>
<div class="airline-message" [ngClass]="{'tab-c': tabClose,'tab-o': !tabClose}">
<nz-tabset [nzTabPosition]="'top'" [nzType]="'card'" [nzShowPagination]="false">
@@ -4,9 +4,10 @@
height: 100%;
overflow-y: auto;
padding: 15px 10px;
background-color: #fff;
background-color: #fff;
.page-content {
border: 1px solid #ccc;
height: 100%;
padding: 10px 20px;
.search-filter {
padding: 0 15px;
@@ -38,42 +39,75 @@
}
}
.airline-table{
.table-container{
.table-container {
display: inline-block;
// border: 1px solid #ccc;
// position: relative;
width: 100%;
height: 700px;
overflow: auto;
box-shadow: 0 0 1px .5px #ddd;
table{
width: max-content;
tr{
cursor: pointer;
&.selected{
background: rgb(181, 215, 255);
// overflow-x: auto;
overflow-y: hidden;
box-shadow: 0 0 1px 0.5px #ddd;
.table-head {
overflow: hidden;
overflow-y: scroll;
height: 42px;
table {
margin: 0;
width: max-content;
th {
background-color: #ddd;
text-align: center;
color: rgb(0, 0, 255);
}
}
th{
background-color: #ddd;
color: rgb(0, 0, 255);
}
th,td{
// border: none;
text-align: center;
&::-webkit-scrollbar {
width: 15px;
height: 15px;
}
}
&::-webkit-scrollbar {
width: 15px;
height: 15px;
}
&::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
background: rgba(165, 207, 222, 1);
border-radius: 10px;
}
&::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.06);
border-radius: 10px;
.table-body {
position: relative;
// height: 600px;
overflow: auto;
width: 100%;
.list-view-phantom {
position: absolute;
left: 0;
top: 0;
right: 0;
z-index: -1;
}
table {
left: 0;
right: 0;
top: 0;
position: absolute;
width: max-content;
tr {
cursor: pointer;
height: 42px;
&.selected {
background: rgb(181, 215, 255);
}
}
td {
border: 1px solid #dee2e6;
text-align: center
}
}
&::-webkit-scrollbar {
width: 15px;
height: 15px;
}
&::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
background: rgba(165, 207, 222, 1);
border-radius: 10px;
}
&::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.06);
border-radius: 10px;
}
}
}
.airline-message {
@@ -95,6 +129,14 @@
}
}
}
/deep/ .ant-tabs-content{
height: calc(100% - 65px);
overflow-y: auto;
border: 1px solid #ccc;
}
nz-tabset{
height: 100%;
}
&::-webkit-scrollbar {
width: 15px;
height: 15px;
@@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild, Renderer2, ChangeDetectorRef } from '@angular/core';
import { Component, OnInit, ViewChild, Renderer2 } from '@angular/core';
import { OperateSpinServiceService } from '../../services/operate-spin-service.service';
import { HttpClientService } from '../../services/http-client.service';
import { BasicDataService } from '../../services/basic-data-service';
@@ -16,10 +16,8 @@ export class SeasonalPlanComponent implements OnInit {
private httpCilent: HttpClientService,
private basicDataService: BasicDataService,
private operateSpinServiceService: OperateSpinServiceService,
private changeDetectorRef: ChangeDetectorRef
) {
this.operateSpinServiceService.showSpin();
this.changeDetectorRef.detach();
}
//勾选复选框
@@ -40,7 +38,7 @@ export class SeasonalPlanComponent implements OnInit {
{ col_code: 'operationDays', col_chn: '运营日' },
{ col_code: 'startDate', col_chn: '开始日期' },
{ col_code: 'endDate', col_chn: '结束日期' },
{ col_code: 'AirportChn', col_chn: '航线' },
{ col_code: 'routChn', col_chn: '航线' },
{ col_code: 'arriOrDeptChn', col_chn: '进/出港' },
{ col_code: 'arrivalTimeTra', col_chn: '到达时间' },
{ col_code: 'departureTimeTra', col_chn: '出发时间' },
@@ -71,20 +69,55 @@ export class SeasonalPlanComponent implements OnInit {
airlines: Array<any>; //航空公司
aircraftTypes: Array<any>; //机型
flightTypes: Array<any>; //航班类别
airports: Array<any>; //机场
public row_state: any = {};
public combined_data: Array<object> = []; //组合数据,经过转换后的
public wait_render_data: Array<object> = [];
public render_data: Array<object> = []; //显示数据,即需要显示的数据
public return_data: Array<object> = []; //下拉框显示数据
@ViewChild('mainPage') mainPage;
render_col_lists: Array<object> = [
{ "COL_CODE": "flightNumber", "COL_CN": "航班号", "COL_WIDTH": "85px" },
{ "COL_CODE": "seasonRecIdChn", "COL_CN": "航班季度", "COL_WIDTH": "85px" },
{ "COL_CODE": "internationalCode", "COL_CN": "国际代码", "COL_WIDTH": "85px" },
{ "COL_CODE": "airlineChnName", "COL_CN": "航空公司", "COL_WIDTH": "205px" },
{ "COL_CODE": "routeTypeChn", "COL_CN": "航线类别", "COL_WIDTH": "85px" },
{ "COL_CODE": "flightTypeChnName", "COL_CN": "航班类别", "COL_WIDTH": "85px" },
{ "COL_CODE": "operationDays", "COL_CN": "运营日", "COL_WIDTH": "85px" },
{ "COL_CODE": "startDate", "COL_CN": "开始日期", "COL_WIDTH": "100px" },
{ "COL_CODE": "endDate", "COL_CN": "结束日期", "COL_WIDTH": "100px" },
{ "COL_CODE": "routChn", "COL_CN": "航线", "COL_WIDTH": "85px" },
{ "COL_CODE": "arriOrDeptChn", "COL_CN": "进/出港", "COL_WIDTH": "85px" },
{ "COL_CODE": "arrivalTimeTra", "COL_CN": "到达时间", "COL_WIDTH": "100px" },
{ "COL_CODE": "departureTimeTra", "COL_CN": "出发时间", "COL_WIDTH": "100px" },
{ "COL_CODE": "aircraftTypeName", "COL_CN": "机型", "COL_WIDTH": "175px" },
{ "COL_CODE": "flyingDistance", "COL_CN": "飞行距离(千米)", "COL_WIDTH": "125px" },
{ "COL_CODE": "flyingTime", "COL_CN": "飞行时间(分钟)", "COL_WIDTH": "125px" },
]
@ViewChild('pageContent') pageContent;
@ViewChild('searchFilter') searchFilter;
@ViewChild('tableContainer') tableContainer;
@ViewChild('tabContainer') tabContainer;
@ViewChild('tableHead') tableHead;
@ViewChild('tableBody') tableBody;
@ViewChild('tableContent') tableContent;
trItemHeight: number = 42;
start: number = 0;
end: number = 0;
visibleCount: number = 0;
scrollTop: number = 0;
ngOnInit() {
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px');
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px');
this.renderer2.setStyle(this.tableBody.nativeElement, 'height', this.tableContainer.nativeElement.offsetHeight - this.tableHead.nativeElement.offsetHeight + 'px');
if (!this.tabClose) {
this.renderer2.setStyle(this.tabContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px');
}
window.onresize = function () {
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px');
this.calcVisibleCount();
}.bind(this)
this.httpCilent.get('/adminapi/schedule/flightSchdSeason/years').toPromise().then(
@@ -94,9 +127,9 @@ export class SeasonalPlanComponent implements OnInit {
this.httpCilent.get('/adminapi/schedule/flightSchdSeasons', { startDate: this.yearLists[0] }).subscribe(
data => {
this.seasonals = data.body;
// this.render_data = this.seasonals;
this.aircraftTypes = this.basicDataService.aircraft_type;
this.airports = this.basicDataService.airport;
this.flightTypes = this.basicDataService.flightTypes;
this.airlines = this.basicDataService.airline;
if (this.airlines && this.airlines.length > 0) {
@@ -107,6 +140,12 @@ export class SeasonalPlanComponent implements OnInit {
this.aircraftTypes = data;
}
);
this.basicDataService.airport_subject.subscribe(
data => {
this.airports = data;
this.dataTransfer();
}
)
this.basicDataService.flightTypes_subject.subscribe(
data => {
this.flightTypes = data;
@@ -115,7 +154,7 @@ export class SeasonalPlanComponent implements OnInit {
this.basicDataService.airline_subject.subscribe(
data => {
this.airlines = data;
this.dataTransfer();
}
)
}
@@ -187,6 +226,50 @@ export class SeasonalPlanComponent implements OnInit {
return item;
}
//航线数据转换处理
routHandle(item) {
let startIndex = this.airports.findIndex(airport => airport.airportCodeIata === item['startAirport']);
let endIndex = this.airports.findIndex(airport => airport.airportCodeIata === item['endAirport']);
if (startIndex > -1) {
if (this.airports[startIndex]['briefNameChn']) {
item['startAirportChn'] = this.airports[startIndex]['briefNameChn'];
} else {
item['startAirportChn'] = this.airports[startIndex]['airportNameChn'];
}
} else {
item['startAirportChn'] = item['startAirport'];
}
if (endIndex > -1) {
if (this.airports[endIndex]['briefNameChn']) {
item['endAirportChn'] = this.airports[endIndex]['briefNameChn'];
} else {
item['endAirportChn'] = this.airports[endIndex]['airportNameChn'];
}
} else {
item['endAirportChn'] = item['endAirport'];
}
item['routChn'] = item['startAirportChn'] + ' - ' + item['endAirportChn'];
return item;
}
arrDeptTimeHandle(item) {
if (item['arrivalTime']) {
item['arrivalTimeTra'] = item['arrivalTime'].substr(0, 2) + ':' + item['arrivalTime'].substr(2, 3)
} else {
item['arrivalTimeTra'] = '';
}
if (item['departureTime']) {
item['departureTimeTra'] = item['departureTime'].substr(0, 2) + ':' + item['departureTime'].substr(2, 3)
} else {
item['departureTimeTra'] = '';
}
return item;
}
//数据转换统一处理
dataTransfer() {
this.seasonals.forEach(item => {
@@ -196,10 +279,25 @@ export class SeasonalPlanComponent implements OnInit {
line = this.flightTypesHandle(line);
line = this.arriOrDeptHandle(line);
line = this.routeTypeHandle(line);
line = this.routHandle(line);
line = this.arrDeptTimeHandle(line);
this.combined_data.push(line);
})
this.render_data = this.combined_data;
this.changeDetectorRef.detectChanges();
this.wait_render_data = this.combined_data;
this.visibleCount = Math.ceil(this.tableBody.nativeElement.clientHeight / this.trItemHeight);
const scrollTop = this.tableBody.nativeElement.scrollTop;
const fixedScrollTop = scrollTop - scrollTop % this.trItemHeight;
this.tableContent.nativeElement.style.webkitTransform = `translateY(${fixedScrollTop}px)`;
this.start = Math.floor(scrollTop / this.trItemHeight);
this.end = this.start + this.visibleCount;
this.render_data = this.wait_render_data.slice(this.start, this.end);
setTimeout(() => {
$(".table-body tbody>tr").eq(0).find('td').each((index, element) => {
$(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px');
})
}, 500)
this.operateSpinServiceService.hideSpin();
}
@@ -230,7 +328,51 @@ export class SeasonalPlanComponent implements OnInit {
//点击展开切换操作
toggleFilter() {
this.filterClose = !this.filterClose;
this.changeDetectorRef.detectChanges();
setTimeout(() => {
this.calcVisibleCount();
}, 10)
}
/**
* 纵向滚动条滚动渲染数据
*/
handleScroll() {
const scrollTop = this.tableBody.nativeElement.scrollTop;
$(".table-head").scrollLeft($('.table-body').scrollLeft());
const fixedScrollTop = scrollTop - scrollTop % this.trItemHeight;
this.tableContent.nativeElement.style.webkitTransform = `translateY(${fixedScrollTop}px)`;
this.start = Math.floor(scrollTop / this.trItemHeight);
this.end = this.start + this.visibleCount;
this.render_data = this.wait_render_data.slice(this.start, this.end);
setTimeout(() => {
$(".table-body tbody>tr").eq(0).find('td').each((index, element) => {
$(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px');
})
}, 500)
}
/**
* 计算可视区域数据的渲染
*/
calcVisibleCount() {
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px');
this.renderer2.setStyle(this.tableBody.nativeElement, 'height', this.tableContainer.nativeElement.offsetHeight - this.tableHead.nativeElement.offsetHeight + 'px');
if (!this.tabClose) {
this.renderer2.setStyle(this.tabContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px');
}
this.visibleCount = Math.ceil(this.tableBody.nativeElement.clientHeight / this.trItemHeight);
const scrollTop = this.tableBody.nativeElement.scrollTop;
const fixedScrollTop = scrollTop - scrollTop % this.trItemHeight;
this.tableContent.nativeElement.style.transform = `translateY(${fixedScrollTop}px)`;
this.start = Math.floor(scrollTop / this.trItemHeight);
this.end = this.start + this.visibleCount;
this.render_data = this.wait_render_data.slice(this.start, this.end);
setTimeout(() => {
$(".table-body tbody>tr").eq(0).find('td').each((index, element) => {
$(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px');
})
}, 500)
}
/**
@@ -248,14 +390,6 @@ export class SeasonalPlanComponent implements OnInit {
}
}
}
this.changeDetectorRef.detectChanges();
}
/**
* tab项切换事件
*/
nzClick() {
this.changeDetectorRef.detectChanges();
}
/**
@@ -271,7 +405,6 @@ export class SeasonalPlanComponent implements OnInit {
*/
selectRow(seasonal) {
this.row_state = seasonal;
this.changeDetectorRef.detectChanges();
}
//输入框回车事件
@@ -279,7 +412,7 @@ export class SeasonalPlanComponent implements OnInit {
if (this.FLT_POS === 1) {
this.selectChange()
} else {
this.inputPosition(this.render_data)
this.inputPosition(this.wait_render_data)
}
}
@@ -302,12 +435,17 @@ export class SeasonalPlanComponent implements OnInit {
}
return is_satis;
})
this.render_data = filter_data;
if (this.FLT_POS === 1) {
this.inputFilter(this.render_data);
this.inputFilter(filter_data);
} else {
this.wait_render_data = filter_data;
this.render_data = this.wait_render_data.slice(this.start, this.end);
setTimeout(() => {
$(".table-body tbody>tr").eq(0).find('td').each((index, element) => {
$(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px');
})
}, 500)
this.row_state = this.render_data.length > 0 ? this.render_data[0] : {};
this.changeDetectorRef.detectChanges();
this.operateSpinServiceService.hideSpin();
}
}, 10)
@@ -318,7 +456,7 @@ export class SeasonalPlanComponent implements OnInit {
if (this.SEARCH) {
if (this.SEL_COL) {
let sel_col = this.SEL_COL;
this.render_data = filterData.filter(item => {
filterData = filterData.filter(item => {
if (item[sel_col]) {
if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
return true;
@@ -328,7 +466,7 @@ export class SeasonalPlanComponent implements OnInit {
}
})
} else {
this.render_data = filterData.filter(item => {
filterData = filterData.filter(item => {
let is_satis = false;
let cols = this.col_lists;
for (let i = 0; i < cols.length; i++) {
@@ -349,8 +487,13 @@ export class SeasonalPlanComponent implements OnInit {
})
}
}
// this.render_data = filterData;
this.changeDetectorRef.detectChanges();
this.wait_render_data = filterData;
this.render_data = this.wait_render_data.slice(this.start, this.end);
setTimeout(() => {
$(".table-body tbody>tr").eq(0).find('td').each((index, element) => {
$(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px');
})
}, 500)
this.operateSpinServiceService.hideSpin();
}
@@ -411,7 +554,6 @@ export class SeasonalPlanComponent implements OnInit {
} else {
alert('没有搜索到相关数据');
}
this.changeDetectorRef.detectChanges();
let tr = $(".selected");
let objTr = tr[0];
if (objTr) {
+1
View File
@@ -5,6 +5,7 @@ export class FlightsDataHandle {
public transferHandle = new TransferRenderHandle();
public formatter = {
'RENO':this.transferHandle.renoFormatter.bind(this.transferHandle),
'GCTM': this.transferHandle.gctmFormatter.bind(this.transferHandle),
'BOTM': this.transferHandle.botmFormatter.bind(this.transferHandle),
'ABDG': this.transferHandle.abdgFormatter.bind(this.transferHandle),
+35 -4
View File
@@ -1,6 +1,21 @@
import timeFormatter from './time-formatter';
import dateWithNotimeFormatter from './date-with-notime-formatter';
export class TransferRenderHandle {
public renoFormatter(flight){
if(flight['RENO']){
if(flight['LRENO']){
return flight['RENO'] + '(' + flight['LRENO'] + ')';
}else{
return flight['RENO'];
}
}else{
if(flight['LRENO']){
return '(' + flight['LRENO'] + ')';
}else{
return '';
}
}
}
public gctmFormatter(flight) {
if (flight['GTDT']) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
@@ -227,14 +242,30 @@ export class TransferRenderHandle {
psst.push(flight['PSDT'][i]['PSST']);
}
let set = new Set(psst);
return Array.from(set).join(',');
if(flight['LPSDT']){
return Array.from(set).join(',') + '(' + flight['LPSDT'] + ')';
}else{
return Array.from(set).join(',');
}
} else if (Object.prototype.toString.call(flight['PSDT']) === '[object Object]') {
return flight['PSDT']['PSST'];
if(flight['LPSDT']){
return flight['PSDT']['PSST'] + '(' + flight['LPSDT'] + ')';
}else{
return flight['PSDT']['PSST'];
}
} else {
return '';
if(flight['LPSDT']){
return '(' + flight['LPSDT'] + ')';
}else{
return '';
}
}
} else {
return '';
if(flight['LPSDT']){
return '(' + flight['LPSDT'] + ')';
}else{
return '';
}
}
}
public esttFormatter(flight) {
+55 -24
View File
@@ -152,6 +152,21 @@ export default function (dynamicData) {
* 数据转换处理方法集
*/
let formatter = {
'RENO': function renoFormatter(flight) {
if (flight['RENO']) {
if (flight['LRENO']) {
return flight['RENO'] + '(' + flight['LRENO'] + ')';
} else {
return flight['RENO'];
}
} else {
if (flight['LRENO']) {
return '(' + flight['LRENO'] + ')';
} else {
return '';
}
}
},
'GCTM': function gctmFormatter(flight) {
if (flight['GTDT']) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
@@ -378,14 +393,30 @@ export default function (dynamicData) {
psst.push(flight['PSDT'][i]['PSST']);
}
let set = new Set(psst);
return Array.from(set).join(',');
if (flight['LPSDT']) {
return Array.from(set).join(',') + '(' + flight['LPSDT'] + ')';
} else {
return Array.from(set).join(',');
}
} else if (Object.prototype.toString.call(flight['PSDT']) === '[object Object]') {
return flight['PSDT']['PSST'];
if (flight['LPSDT']) {
return flight['PSDT']['PSST'] + '(' + flight['LPSDT'] + ')';
} else {
return flight['PSDT']['PSST'];
}
} else {
if (flight['LPSDT']) {
return '(' + flight['LPSDT'] + ')';
} else {
return '';
}
}
} else {
if (flight['LPSDT']) {
return '(' + flight['LPSDT'] + ')';
} else {
return '';
}
} else {
return '';
}
},
'ESTT': function esttFormatter(flight) {
@@ -921,13 +952,13 @@ export default function (dynamicData) {
for (let i = 0; i < erutCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
if (airportIndex > -1) {
if (airports[airportIndex].briefNameChn) {
erutChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutChnArray.push(airports[airportIndex].airportNameChn);
} else {
erutChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
} else {
erutChnArray.push(erutCodeArray[i]);
}
} catch (error) {
@@ -949,13 +980,13 @@ export default function (dynamicData) {
for (let i = 0; i < erutLinkCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
if (airportIndex > -1) {
if (airports[airportIndex].briefNameChn) {
erutLinkChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutLinkChnArray.push(airports[airportIndex].airportNameChn);
} else {
erutLinkChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
} else {
erutLinkChnArray.push(erutLinkCodeArray[i]);
}
} catch (error) {
@@ -988,13 +1019,13 @@ export default function (dynamicData) {
for (let i = 0; i < erutPreCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
if (airportIndex > -1) {
if (airports[airportIndex].briefNameChn) {
erutPreChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutPreChnArray.push(airports[airportIndex].airportNameChn);
} else {
erutPreChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
} else {
erutPreChnArray.push(erutPreCodeArray[i]);
}
} catch (error) {
@@ -1017,13 +1048,13 @@ export default function (dynamicData) {
for (let i = 0; i < erutReaCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
if (airportIndex > -1) {
if (airports[airportIndex].briefNameChn) {
erutReaChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutReaChnArray.push(airports[airportIndex].airportNameChn);
} else {
erutReaChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
} else {
erutReaChnArray.push(erutReaCodeArray[i]);
}
} catch (error) {
+55 -24
View File
@@ -152,6 +152,21 @@ onmessage = function (dynamicData) {
* 数据转换处理方法集
*/
let formatter = {
'RENO': function renoFormatter(flight) {
if (flight['RENO']) {
if (flight['LRENO']) {
return flight['RENO'] + '(' + flight['LRENO'] + ')';
} else {
return flight['RENO'];
}
} else {
if (flight['LRENO']) {
return '(' + flight['LRENO'] + ')';
} else {
return '';
}
}
},
'GCTM': function gctmFormatter(flight) {
if (flight['GTDT']) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
@@ -378,14 +393,30 @@ onmessage = function (dynamicData) {
psst.push(flight['PSDT'][i]['PSST']);
}
let set = new Set(psst);
return Array.from(set).join(',');
if (flight['LPSDT']) {
return Array.from(set).join(',') + '(' + flight['LPSDT'] + ')';
} else {
return Array.from(set).join(',');
}
} else if (Object.prototype.toString.call(flight['PSDT']) === '[object Object]') {
return flight['PSDT']['PSST'];
if (flight['LPSDT']) {
return flight['PSDT']['PSST'] + '(' + flight['LPSDT'] + ')';
} else {
return flight['PSDT']['PSST'];
}
} else {
if (flight['LPSDT']) {
return '(' + flight['LPSDT'] + ')';
} else {
return '';
}
}
} else {
if (flight['LPSDT']) {
return '(' + flight['LPSDT'] + ')';
} else {
return '';
}
} else {
return '';
}
},
'ESTT': function esttFormatter(flight) {
@@ -921,13 +952,13 @@ onmessage = function (dynamicData) {
for (let i = 0; i < erutCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
if (airportIndex > -1) {
if (airports[airportIndex].briefNameChn) {
erutChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutChnArray.push(airports[airportIndex].airportNameChn);
} else {
erutChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
} else {
erutChnArray.push(erutCodeArray[i]);
}
} catch (error) {
@@ -949,13 +980,13 @@ onmessage = function (dynamicData) {
for (let i = 0; i < erutLinkCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
if (airportIndex > -1) {
if (airports[airportIndex].briefNameChn) {
erutLinkChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutLinkChnArray.push(airports[airportIndex].airportNameChn);
} else {
erutLinkChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
} else {
erutLinkChnArray.push(erutLinkCodeArray[i]);
}
} catch (error) {
@@ -988,13 +1019,13 @@ onmessage = function (dynamicData) {
for (let i = 0; i < erutPreCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
if (airportIndex > -1) {
if (airports[airportIndex].briefNameChn) {
erutPreChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutPreChnArray.push(airports[airportIndex].airportNameChn);
} else {
erutPreChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
} else {
erutPreChnArray.push(erutPreCodeArray[i]);
}
} catch (error) {
@@ -1017,13 +1048,13 @@ onmessage = function (dynamicData) {
for (let i = 0; i < erutReaCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
if(airportIndex>-1){
if(airports[airportIndex].briefNameChn){
if (airportIndex > -1) {
if (airports[airportIndex].briefNameChn) {
erutReaChnArray.push(airports[airportIndex].briefNameChn);
}else{
erutReaChnArray.push(airports[airportIndex].airportNameChn);
} else {
erutReaChnArray.push(airports[airportIndex].airportNameChn);
}
}else{
} else {
erutReaChnArray.push(erutReaCodeArray[i]);
}
} catch (error) {