动态消息更新处理
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
"ws": true
|
"ws": true
|
||||||
},
|
},
|
||||||
"/v2": {
|
"/v2": {
|
||||||
"target": "http://130.120.3.231:97",
|
"target": "http://130.120.3.231:91",
|
||||||
"secure": false,
|
"secure": false,
|
||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
"ws": true
|
"ws": true
|
||||||
|
|||||||
@@ -64,13 +64,484 @@ export class MainComponent implements OnInit {
|
|||||||
//订阅航班更新
|
//订阅航班更新
|
||||||
this.websocketService.dynamicsMessage().subscribe(
|
this.websocketService.dynamicsMessage().subscribe(
|
||||||
event => {
|
event => {
|
||||||
console.log(JSON.parse(event['data']));
|
let data = JSON.parse(event as string);
|
||||||
// let index = this.raw_data.findIndex(val => val['FLID'] === event['FLID']);
|
if (data.topic === 'schd') {
|
||||||
// if (index > -1) {
|
console.log('========')
|
||||||
// this.raw_data[index] = event;
|
let message = JSON.parse(data.message);
|
||||||
// } else {
|
let index = this.raw_data.findIndex(element => element['FLID'] === message.FLID);
|
||||||
// this.raw_data.push(event)
|
if (index > -1) {
|
||||||
// }
|
this.raw_data[index] = message;
|
||||||
|
} else {
|
||||||
|
this.raw_data.push(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// let testss = []
|
||||||
|
// let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data);
|
||||||
|
// combined_linked_data.forEach(element => {
|
||||||
|
// let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists);
|
||||||
|
// testss.push(flights_item);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// let combined_data = [];
|
||||||
|
// testss.forEach(item => {
|
||||||
|
// combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
|
||||||
|
// })
|
||||||
|
// this.combined_data = combined_data;
|
||||||
|
// this.doSequence(this.combined_data);
|
||||||
|
|
||||||
|
|
||||||
|
if (message.MVIN === 'A') {
|
||||||
|
//针对combined_data的处理
|
||||||
|
let index = this.combined_data.findIndex(element => {
|
||||||
|
if (this.orderHandle.isArriFlight(element) || this.orderHandle.isLinked(element)) {
|
||||||
|
if (element['preFlight']['FLID'] === message.FLID) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (index > -1) {
|
||||||
|
this.combined_data[index]['preFlight'] = message;
|
||||||
|
this.combined_data[index] = this.dataHandle.flightsRenderTransfer(this.combined_data[index], this.col_lists);
|
||||||
|
this.combined_data[index] = this.dataHandle.basicDataTransHandle(this.combined_data[index], this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
|
||||||
|
if (message.UPTP === 'FLOP-AOTP') {
|
||||||
|
if (this.orderHandle.isArriFlight(this.combined_data[index])) {
|
||||||
|
if (message.TAID) {
|
||||||
|
this.combined_data.splice(index, 1);
|
||||||
|
|
||||||
|
let i = this.combined_data.findIndex(element => {
|
||||||
|
if (this.orderHandle.isDeptFlight(element)) {
|
||||||
|
if (message.TAID === element['reaFlight']['FLID']) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.combined_data[i]['reaFlight']['TAID'] = message.FLID;
|
||||||
|
let newFlight = {};
|
||||||
|
newFlight['preFlight'] = message;
|
||||||
|
newFlight['reaFlight'] = this.combined_data[i]['reaFlight'];
|
||||||
|
|
||||||
|
this.combined_data.splice(i, 1);
|
||||||
|
|
||||||
|
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
|
||||||
|
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
this.combined_data.push(newFlight)
|
||||||
|
}
|
||||||
|
} else if (this.orderHandle.isLinked(this.combined_data[index])) {
|
||||||
|
if (!message.TAID) {
|
||||||
|
let newPreFlight = {},
|
||||||
|
newReaFlight = {};
|
||||||
|
|
||||||
|
newPreFlight['preFlight'] = this.combined_data[index]['preFlight'];
|
||||||
|
newPreFlight['renderFlight'] = this.combined_data[index]['renderPreFlight'];
|
||||||
|
this.combined_data.push(newPreFlight);
|
||||||
|
|
||||||
|
delete this.combined_data[index]['reaFlight']['TAID'];
|
||||||
|
newPreFlight['reaFlight'] = this.combined_data[index]['reaFlight'];
|
||||||
|
newPreFlight['renderFlight'] = this.combined_data[index]['renderReaFlight'];
|
||||||
|
this.combined_data.push(newReaFlight);
|
||||||
|
|
||||||
|
this.combined_data.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let newFlight = {};
|
||||||
|
newFlight['preFlight'] = message;
|
||||||
|
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
|
||||||
|
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
this.combined_data.push(newFlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//针对render_data的处理
|
||||||
|
let index1 = this.render_data.findIndex(element => {
|
||||||
|
if (this.orderHandle.isArriFlight(element) || this.orderHandle.isLinked(element)) {
|
||||||
|
if (element['preFlight']['FLID'] === message.FLID) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (index1 > -1) {
|
||||||
|
this.render_data[index1]['preFlight'] = message;
|
||||||
|
this.render_data[index1] = this.dataHandle.flightsRenderTransfer(this.render_data[index1], this.col_lists);
|
||||||
|
this.render_data[index1] = this.dataHandle.basicDataTransHandle(this.render_data[index1], this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
|
||||||
|
let is_satis = true;
|
||||||
|
for (const key in this.filterItems) {
|
||||||
|
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
|
||||||
|
if (this.render_data[index1]['preFlight'][key] === this.filterItems[key]) {
|
||||||
|
is_satis = true;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
is_satis = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let search_satis = true;
|
||||||
|
if (this.LASTSEARCH) {
|
||||||
|
if (this.LAST_SEL_COL) {
|
||||||
|
if (this.render_data[index1]['preFlight'][this.LAST_SEL_COL]) {
|
||||||
|
if (this.render_data[index1]['preFlight'][this.LAST_SEL_COL].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
|
||||||
|
search_satis = true;
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let cols = this.col_lists;
|
||||||
|
for (let i = 0; i < cols.length; i++) {
|
||||||
|
if (this.render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) {
|
||||||
|
if (this.render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
|
||||||
|
search_satis = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_satis && search_satis) {
|
||||||
|
if (message.UPTP === 'FLOP-TAOP') {
|
||||||
|
if (this.orderHandle.isArriFlight(this.render_data[index1])) {
|
||||||
|
if (message.TAID) {
|
||||||
|
let i = this.render_data.findIndex(element => {
|
||||||
|
if (this.orderHandle.isDeptFlight(element)) {
|
||||||
|
if (message.TAID === element['reaFlight']['FLID']) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (i > -1) {
|
||||||
|
this.render_data.splice(index1, 1);
|
||||||
|
this.render_data[i]['reaFlight']['TAID'] = message.FLID;
|
||||||
|
let newFlight = {};
|
||||||
|
newFlight['preFlight'] = message;
|
||||||
|
newFlight['reaFlight'] = this.render_data[i]['reaFlight'];
|
||||||
|
this.render_data.splice(i, 1);
|
||||||
|
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
|
||||||
|
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
this.render_data.push(newFlight)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (this.orderHandle.isLinked(this.render_data[index1])) {
|
||||||
|
if (!message.TAID) {
|
||||||
|
let newPreFlight = {},
|
||||||
|
newReaFlight = {};
|
||||||
|
delete this.render_data[index1]['preFlight']['TAID'];
|
||||||
|
newPreFlight['preFlight'] = this.render_data[index1]['preFlight'];
|
||||||
|
newPreFlight['renderFlight'] = this.render_data[index1]['renderPreFlight'];
|
||||||
|
delete this.render_data[index1]['reaFlight']['TAID'];
|
||||||
|
newPreFlight['reaFlight'] = this.render_data[index1]['reaFlight'];
|
||||||
|
newPreFlight['renderFlight'] = this.render_data[index1]['renderReaFlight'];
|
||||||
|
this.render_data.splice(index1, 1);
|
||||||
|
this.render_data.push(newPreFlight);
|
||||||
|
this.render_data.push(newReaFlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.orderHandle.isArriFlight(this.render_data[index1])) {
|
||||||
|
this.render_data.splice(index1, 1);
|
||||||
|
} else if (this.orderHandle.isLinked(this.render_data[index1])) {
|
||||||
|
delete this.render_data[index1]['preFlight'];
|
||||||
|
delete this.render_data[index1]['renderPreFlight'];
|
||||||
|
this.render_data[index1] = this.dataHandle.flightsRenderTransfer(this.render_data[index1], this.col_lists);
|
||||||
|
this.render_data[index1] = this.dataHandle.basicDataTransHandle(this.render_data[index1], this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let newFlight = {};
|
||||||
|
newFlight['preFlight'] = message;
|
||||||
|
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
|
||||||
|
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
|
||||||
|
let is_satis = true;
|
||||||
|
for (const key in this.filterItems) {
|
||||||
|
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
|
||||||
|
if (newFlight['preFlight'][key] === this.filterItems[key]) {
|
||||||
|
is_satis = true;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
is_satis = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let search_satis = true;
|
||||||
|
if (this.LASTSEARCH) {
|
||||||
|
if (this.LAST_SEL_COL) {
|
||||||
|
if (newFlight['preFlight'][this.LAST_SEL_COL]) {
|
||||||
|
if (newFlight['preFlight'][this.LAST_SEL_COL].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
|
||||||
|
search_satis = true;
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let cols = this.col_lists;
|
||||||
|
for (let i = 0; i < cols.length; i++) {
|
||||||
|
if (newFlight['renderFlight'][cols[i]['COL_CODE']]) {
|
||||||
|
if (newFlight['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
|
||||||
|
search_satis = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_satis && search_satis) {
|
||||||
|
let i = this.render_data.findIndex(element => {
|
||||||
|
if (this.orderHandle.isDeptFlight(element)) {
|
||||||
|
if (message.TAID === element['reaFlight']['FLID']) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (i > -1) {
|
||||||
|
let newFlight = {};
|
||||||
|
newFlight['preFlight'] = message;
|
||||||
|
newFlight['reaFlight'] = Object.assign({}, this.render_data[i]['reaFlight']);
|
||||||
|
this.render_data.splice(i, 1);
|
||||||
|
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
|
||||||
|
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
this.render_data.push(newFlight);
|
||||||
|
} else {
|
||||||
|
this.render_data.push(newFlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//针对combined_data的处理
|
||||||
|
let index = this.combined_data.findIndex(element => {
|
||||||
|
if (this.orderHandle.isDeptFlight(element) || this.orderHandle.isLinked(element)) {
|
||||||
|
if (element['reaFlight']['FLID'] === message.FLID) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (index > -1) {
|
||||||
|
this.combined_data[index]['reaFlight'] = message;
|
||||||
|
this.combined_data[index] = this.dataHandle.flightsRenderTransfer(this.combined_data[index], this.col_lists);
|
||||||
|
this.combined_data[index] = this.dataHandle.basicDataTransHandle(this.combined_data[index], this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
} else {
|
||||||
|
let newFlight = {};
|
||||||
|
newFlight['reaFlight'] = message;
|
||||||
|
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
|
||||||
|
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
this.combined_data.push(newFlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//针对render_data的处理
|
||||||
|
let index1 = this.render_data.findIndex(element => {
|
||||||
|
if (this.orderHandle.isDeptFlight(element) || this.orderHandle.isLinked(element)) {
|
||||||
|
if (element['reaFlight']['FLID'] === message.FLID) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (index1 > -1) {
|
||||||
|
this.render_data[index1]['reaFlight'] = message;
|
||||||
|
this.render_data[index1] = this.dataHandle.flightsRenderTransfer(this.render_data[index1], this.col_lists);
|
||||||
|
this.render_data[index1] = this.dataHandle.basicDataTransHandle(this.render_data[index1], this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
|
||||||
|
let is_satis = true;
|
||||||
|
for (const key in this.filterItems) {
|
||||||
|
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
|
||||||
|
if (this.render_data[index1]['reaFlight'][key] === this.filterItems[key]) {
|
||||||
|
is_satis = true;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
is_satis = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let search_satis = true;
|
||||||
|
if (this.LASTSEARCH) {
|
||||||
|
if (this.LAST_SEL_COL) {
|
||||||
|
if (this.render_data[index1]['reaFlight'][this.LAST_SEL_COL]) {
|
||||||
|
if (this.render_data[index1]['reaFlight'][this.LAST_SEL_COL].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
|
||||||
|
search_satis = true;
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let cols = this.col_lists;
|
||||||
|
for (let i = 0; i < cols.length; i++) {
|
||||||
|
if (this.render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) {
|
||||||
|
if (this.render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
|
||||||
|
search_satis = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!is_satis || !search_satis) {
|
||||||
|
if (this.orderHandle.isDeptFlight(this.render_data[index1])) {
|
||||||
|
this.render_data.splice(index1, 1);
|
||||||
|
} else if (this.orderHandle.isLinked(this.render_data[index1])) {
|
||||||
|
delete this.render_data[index1]['reaFlight'];
|
||||||
|
delete this.render_data[index1]['renderReaFlight'];
|
||||||
|
|
||||||
|
this.render_data[index1] = this.dataHandle.flightsRenderTransfer(this.render_data[index1], this.col_lists);
|
||||||
|
this.render_data[index1] = this.dataHandle.basicDataTransHandle(this.render_data[index1], this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let newFlight = {};
|
||||||
|
newFlight['reaFlight'] = message;
|
||||||
|
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
|
||||||
|
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
|
||||||
|
let is_satis = true;
|
||||||
|
for (const key in this.filterItems) {
|
||||||
|
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
|
||||||
|
if (newFlight['reaFlight'][key] === this.filterItems[key]) {
|
||||||
|
is_satis = true;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
is_satis = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let search_satis = true;
|
||||||
|
if (this.LASTSEARCH) {
|
||||||
|
if (this.LAST_SEL_COL) {
|
||||||
|
if (newFlight['reaFlight'][this.LAST_SEL_COL]) {
|
||||||
|
if (newFlight['reaFlight'][this.LAST_SEL_COL].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
|
||||||
|
search_satis = true;
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let cols = this.col_lists;
|
||||||
|
for (let i = 0; i < cols.length; i++) {
|
||||||
|
if (newFlight['renderFlight'][cols[i]['COL_CODE']]) {
|
||||||
|
if (newFlight['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
|
||||||
|
search_satis = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
search_satis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_satis && search_satis) {
|
||||||
|
let i = this.render_data.findIndex(element => {
|
||||||
|
if (this.orderHandle.isArriFlight(element)) {
|
||||||
|
if (message.TAID === element['preFlight']['FLID']) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (i > -1) {
|
||||||
|
let newFlight = {};
|
||||||
|
newFlight['reaFlight'] = message;
|
||||||
|
newFlight['preFlight'] = Object.assign({}, this.render_data[i]['preFlight']);
|
||||||
|
this.render_data.splice(i, 1);
|
||||||
|
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
|
||||||
|
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||||
|
this.render_data.push(newFlight);
|
||||||
|
} else {
|
||||||
|
this.render_data.push(newFlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.combined_data.forEach(element => {
|
||||||
|
element['ORDER'] = this.orderHandle.sequence(element);
|
||||||
|
})
|
||||||
|
this.combined_data = this.combined_data.sort(function (a, b) {
|
||||||
|
return (a['ORDER'] - b['ORDER']);
|
||||||
|
})
|
||||||
|
|
||||||
|
this.render_data.forEach(element => {
|
||||||
|
element['ORDER'] = this.orderHandle.sequence(element);
|
||||||
|
})
|
||||||
|
this.render_data = this.render_data.sort(function (a, b) {
|
||||||
|
return (a['ORDER'] - b['ORDER']);
|
||||||
|
})
|
||||||
|
this.changeDetectorRef.detectChanges();
|
||||||
|
|
||||||
|
// this.doSequence(this.combined_data);
|
||||||
|
|
||||||
|
} else if (data.topic === 'msg') {
|
||||||
|
let message = JSON.parse(data.message);
|
||||||
|
console.log(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -89,7 +560,7 @@ export class MainComponent implements OnInit {
|
|||||||
this.raw_data = data.body;
|
this.raw_data = data.body;
|
||||||
|
|
||||||
//查找链接航班并将其组合成一条数据
|
//查找链接航班并将其组合成一条数据
|
||||||
let combined_linked_data = this.dataHandle.findLinkFlights(data.body);
|
let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data);
|
||||||
combined_linked_data.forEach(element => {
|
combined_linked_data.forEach(element => {
|
||||||
let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists);
|
let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists);
|
||||||
this.combined_data.push(flights_item);
|
this.combined_data.push(flights_item);
|
||||||
@@ -103,7 +574,11 @@ export class MainComponent implements OnInit {
|
|||||||
this.airports = this.basicDataService.airport;
|
this.airports = this.basicDataService.airport;
|
||||||
|
|
||||||
if (this.airports && this.airports.length > 0) {
|
if (this.airports && this.airports.length > 0) {
|
||||||
this.combined_data = this.dataHandle.basicDataTransHandle(this.combined_data, this.airports, this.citys, this.airlines, this.flightStatus);
|
let combined_data = []
|
||||||
|
this.combined_data.forEach(item => {
|
||||||
|
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
|
||||||
|
})
|
||||||
|
this.combined_data = combined_data;
|
||||||
this.doSequence(this.combined_data);
|
this.doSequence(this.combined_data);
|
||||||
} else {
|
} else {
|
||||||
this.basicDataService.terminal_subject.subscribe(
|
this.basicDataService.terminal_subject.subscribe(
|
||||||
@@ -121,7 +596,11 @@ export class MainComponent implements OnInit {
|
|||||||
this.basicDataService.airport_subject.subscribe(
|
this.basicDataService.airport_subject.subscribe(
|
||||||
val => {
|
val => {
|
||||||
this.airports = val;
|
this.airports = val;
|
||||||
this.combined_data = this.dataHandle.basicDataTransHandle(this.combined_data, this.airports, this.citys, this.airlines, this.flightStatus);
|
let combined_data = []
|
||||||
|
this.combined_data.forEach(item => {
|
||||||
|
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
|
||||||
|
})
|
||||||
|
this.combined_data = combined_data;
|
||||||
this.doSequence(this.combined_data);
|
this.doSequence(this.combined_data);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -143,14 +622,16 @@ export class MainComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* 执行排序并渲染
|
* 执行排序并渲染
|
||||||
*/
|
*/
|
||||||
doSequence(sequenceData) {
|
doSequence(combined_data) {
|
||||||
sequenceData.forEach(element => {
|
|
||||||
|
combined_data.forEach(element => {
|
||||||
element['ORDER'] = this.orderHandle.sequence(element);
|
element['ORDER'] = this.orderHandle.sequence(element);
|
||||||
})
|
})
|
||||||
sequenceData.sort(function (a, b) {
|
combined_data.sort(function (a, b) {
|
||||||
return (a['ORDER'] - b['ORDER']);
|
return (a['ORDER'] - b['ORDER']);
|
||||||
})
|
})
|
||||||
this.render_data = sequenceData;
|
this.render_data = combined_data;
|
||||||
|
console.log(new Date().getTime());
|
||||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||||
this.changeDetectorRef.detectChanges();
|
this.changeDetectorRef.detectChanges();
|
||||||
this.operateSpinServiceService.hideSpin()
|
this.operateSpinServiceService.hideSpin()
|
||||||
@@ -160,7 +641,13 @@ export class MainComponent implements OnInit {
|
|||||||
* 刷新
|
* 刷新
|
||||||
*/
|
*/
|
||||||
refresh() {
|
refresh() {
|
||||||
this.render_data.reverse();
|
let testss = this.render_data.reverse();
|
||||||
|
let tstt = [];
|
||||||
|
testss.forEach(element => {
|
||||||
|
tstt.push(Object.assign({}, element))
|
||||||
|
})
|
||||||
|
|
||||||
|
this.render_data = testss;
|
||||||
this.changeDetectorRef.detectChanges();
|
this.changeDetectorRef.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,8 +658,10 @@ export class MainComponent implements OnInit {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SEARCH = ''; //手动输入条件
|
SEARCH = ''; //手动输入条件
|
||||||
|
LASTSEARCH = '';
|
||||||
FLT_POS = 1; //过滤还是定位
|
FLT_POS = 1; //过滤还是定位
|
||||||
SEL_COL = ''; //选择列名
|
SEL_COL = ''; //选择列名
|
||||||
|
LAST_SEL_COL = '';
|
||||||
public filterItems = {
|
public filterItems = {
|
||||||
ALCD: '', //航空公司
|
ALCD: '', //航空公司
|
||||||
FLIN: '', //航线类别
|
FLIN: '', //航线类别
|
||||||
@@ -266,9 +755,13 @@ export class MainComponent implements OnInit {
|
|||||||
|
|
||||||
if (pre_satis && !rea_satis) {
|
if (pre_satis && !rea_satis) {
|
||||||
item['renderFlight'] = item['renderPreFlight'];
|
item['renderFlight'] = item['renderPreFlight'];
|
||||||
|
delete item['reaFlight'];
|
||||||
|
delete item['renderReaFlight'];
|
||||||
return pre_satis;
|
return pre_satis;
|
||||||
} else if (!pre_satis && rea_satis) {
|
} else if (!pre_satis && rea_satis) {
|
||||||
item['renderFlight'] = item['renderReaFlight'];
|
item['renderFlight'] = item['renderReaFlight'];
|
||||||
|
delete item['preFlight'];
|
||||||
|
delete item['renderPreFlight'];
|
||||||
return rea_satis;
|
return rea_satis;
|
||||||
} else if (pre_satis && rea_satis) {
|
} else if (pre_satis && rea_satis) {
|
||||||
return pre_satis && rea_satis;
|
return pre_satis && rea_satis;
|
||||||
@@ -292,6 +785,8 @@ export class MainComponent implements OnInit {
|
|||||||
* @param filterData
|
* @param filterData
|
||||||
*/
|
*/
|
||||||
inputFilter(filterData) {
|
inputFilter(filterData) {
|
||||||
|
this.LAST_SEL_COL = this.SEL_COL;
|
||||||
|
this.LASTSEARCH = this.SEARCH;
|
||||||
if (this.SEARCH) {
|
if (this.SEARCH) {
|
||||||
if (this.SEL_COL) {
|
if (this.SEL_COL) {
|
||||||
let sel_col = this.SEL_COL;
|
let sel_col = this.SEL_COL;
|
||||||
@@ -301,37 +796,25 @@ export class MainComponent implements OnInit {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.SEARCH) {
|
return false;
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
filterData = filterData.filter(item => {
|
filterData = filterData.filter(item => {
|
||||||
let is_satis = false;
|
let is_satis = false;
|
||||||
for (const key in item['renderFlight']) {
|
let cols = this.col_lists;
|
||||||
if (item['renderFlight'].hasOwnProperty(key)) {
|
for (let i = 0; i < cols.length; i++) {
|
||||||
if (item['renderFlight'][key]) {
|
if (item['renderFlight'][cols[i]['COL_CODE']]) {
|
||||||
if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
if (item['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||||
is_satis = true;
|
is_satis = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
is_satis = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (this.SEARCH) {
|
is_satis = false;
|
||||||
is_satis = false;
|
continue;
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
is_satis = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
is_satis = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -368,26 +851,22 @@ export class MainComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
filterData.forEach(element => {
|
filterData.forEach(element => {
|
||||||
for (const key in element['renderFlight']) {
|
let cols = this.col_lists;
|
||||||
if (element['renderFlight'].hasOwnProperty(key)) {
|
for (let i = 0; i < cols.length; i++) {
|
||||||
if (element['renderFlight'][key]) {
|
if (element['renderFlight'][cols[i]['COL_CODE']]) {
|
||||||
if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
if (element['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||||
transArray.push(element)
|
transArray.push(element)
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (this.SEARCH) {
|
continue;
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
transArray.push(element)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
continue;
|
if (this.SEARCH) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
transArray.push(element)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -413,7 +892,10 @@ export class MainComponent implements OnInit {
|
|||||||
|
|
||||||
let tr = $(".selected");
|
let tr = $(".selected");
|
||||||
let objTr = tr[0];
|
let objTr = tr[0];
|
||||||
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
|
if (objTr) {
|
||||||
|
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,35 +54,38 @@ export class FlightsDataHandle {
|
|||||||
|
|
||||||
public findLinkFlights(raw_flights) {
|
public findLinkFlights(raw_flights) {
|
||||||
let combined_raw_flights: Array<any> = [];
|
let combined_raw_flights: Array<any> = [];
|
||||||
|
let copy_raw_flights = [];
|
||||||
for (let i = 0; i < raw_flights.length; i++) {
|
raw_flights.forEach(element => {
|
||||||
if (raw_flights[i]['MVIN'] === 'D') {
|
copy_raw_flights.push(Object.assign({}, element))
|
||||||
if (raw_flights[i]['TAID']) {
|
})
|
||||||
let index = raw_flights.findIndex(val => { return val['FLID'] === raw_flights[i]['TAID'] });
|
for (let i = 0; i < copy_raw_flights.length; i++) {
|
||||||
|
if (copy_raw_flights[i]['MVIN'] === 'A') {
|
||||||
|
if (copy_raw_flights[i]['TAID']) {
|
||||||
|
let index = copy_raw_flights.findIndex(val => { return val['FLID'] === copy_raw_flights[i]['TAID'] });
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
raw_flights[i]['isLinked'] = true;
|
copy_raw_flights[i]['isLinked'] = true;
|
||||||
raw_flights[i]['linkFlight'] = raw_flights[index];
|
copy_raw_flights[i]['linkFlight'] = copy_raw_flights[index];
|
||||||
if (!raw_flights[i]['linkFlight']['TAID']) {
|
if (!copy_raw_flights[i]['linkFlight']['TAID']) {
|
||||||
raw_flights[i]['linkFlight']['TAID'] = raw_flights[i]['TAID'];
|
copy_raw_flights[i]['linkFlight']['TAID'] = copy_raw_flights[i]['FLID'];
|
||||||
}
|
}
|
||||||
raw_flights.splice(index, 1);
|
copy_raw_flights.splice(index, 1);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
raw_flights.forEach(element => {
|
copy_raw_flights.forEach(element => {
|
||||||
let flights_item = {};
|
let flights_item = {};
|
||||||
if (element['MVIN'] === 'A' && !element['isLinked']) {
|
if (element['MVIN'] === 'A' && !element['isLinked']) {
|
||||||
flights_item['preFlight'] = element;
|
flights_item['preFlight'] = element;
|
||||||
} else if (element['MVIN'] === 'D' && !element['isLinked']) {
|
} else if (element['MVIN'] === 'D' && !element['isLinked']) {
|
||||||
flights_item['reaFlight'] = element;
|
flights_item['reaFlight'] = element;
|
||||||
} else {
|
} else {
|
||||||
flights_item['preFlight'] = element['linkFlight'];
|
flights_item['reaFlight'] = element['linkFlight'];
|
||||||
delete element['linkFlight'];
|
delete element['linkFlight'];
|
||||||
delete element['isLinked'];
|
delete element['isLinked'];
|
||||||
flights_item['reaFlight'] = element;
|
flights_item['preFlight'] = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
combined_raw_flights.push(flights_item);
|
combined_raw_flights.push(flights_item);
|
||||||
@@ -91,10 +94,11 @@ export class FlightsDataHandle {
|
|||||||
return combined_raw_flights;
|
return combined_raw_flights;
|
||||||
}
|
}
|
||||||
|
|
||||||
public flightsRenderTransfer(flights_item, col_lists) {
|
public flightsRenderTransfer(item, col_lists) {
|
||||||
let render_flight = {},
|
let render_flight = {},
|
||||||
render_pre_flight = {},
|
render_pre_flight = {},
|
||||||
render_rea_flight = {};
|
render_rea_flight = {},
|
||||||
|
flights_item = Object.assign({}, item)
|
||||||
|
|
||||||
if (flights_item['preFlight'] && !flights_item['reaFlight']) {
|
if (flights_item['preFlight'] && !flights_item['reaFlight']) {
|
||||||
for (let i = 0; i < col_lists.length; i++) {
|
for (let i = 0; i < col_lists.length; i++) {
|
||||||
@@ -148,9 +152,10 @@ export class FlightsDataHandle {
|
|||||||
render_pre_flight[key] = preHasValue;
|
render_pre_flight[key] = preHasValue;
|
||||||
render_rea_flight[key] = reaHasValue;
|
render_rea_flight[key] = reaHasValue;
|
||||||
}
|
}
|
||||||
flights_item['renderFlight'] = render_flight;
|
flights_item['renderCombinedFlight'] = render_flight;
|
||||||
flights_item['renderPreFlight'] = render_pre_flight;
|
flights_item['renderPreFlight'] = render_pre_flight;
|
||||||
flights_item['renderReaFlight'] = render_rea_flight;
|
flights_item['renderReaFlight'] = render_rea_flight;
|
||||||
|
flights_item['renderFlight'] = Object.assign({}, render_flight);
|
||||||
}
|
}
|
||||||
|
|
||||||
return flights_item;
|
return flights_item;
|
||||||
@@ -159,91 +164,114 @@ export class FlightsDataHandle {
|
|||||||
/**
|
/**
|
||||||
* 基础数据转换
|
* 基础数据转换
|
||||||
*/
|
*/
|
||||||
basicDataTransHandle(combind_flights, airports, citys, airlines, flightStatus) {
|
basicDataTransHandle(item, airports, citys, airlines, flightStatus) {
|
||||||
combind_flights.forEach(item => {
|
if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) {
|
||||||
if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) {
|
//航线处理
|
||||||
//航线处理
|
let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||||
let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
let erutChnArray = []
|
||||||
let erutChnArray = []
|
for (let i = 0; i < erutCodeArray.length; i++) {
|
||||||
for (let i = 0; i < erutCodeArray.length; i++) {
|
try {
|
||||||
try {
|
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
|
||||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
|
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
erutChnArray.push(citys[cityIndex].cityNameChn);
|
||||||
erutChnArray.push(citys[cityIndex].cityNameChn);
|
} catch (error) {
|
||||||
} catch (error) {
|
erutChnArray.push(erutCodeArray[i]);
|
||||||
erutChnArray.push(erutCodeArray[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
item['renderFlight']['ERUT'] = erutChnArray.join(' - ');
|
|
||||||
//航空公司处理
|
|
||||||
let airlineIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
|
||||||
item['renderFlight']['ALCD'] = airlines[airlineIndex].airlineName;
|
|
||||||
//运营状态处理
|
|
||||||
item['renderFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc
|
|
||||||
} else {
|
|
||||||
//航线处理
|
|
||||||
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
|
||||||
let erutLinkChnArray = []
|
|
||||||
for (let i = 0; i < erutLinkCodeArray.length; i++) {
|
|
||||||
try {
|
|
||||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
|
|
||||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
|
||||||
erutLinkChnArray.push(citys[cityIndex].cityNameChn);
|
|
||||||
} catch (error) {
|
|
||||||
erutLinkChnArray.push(erutLinkCodeArray[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
item['renderFlight']['ERUT'] = erutLinkChnArray.join(' - ');
|
|
||||||
//航空公司处理
|
|
||||||
let airlineLinkIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
|
||||||
item['renderFlight']['ALCD'] = airlines[airlineLinkIndex].airlineName;
|
|
||||||
//运营状态处理
|
|
||||||
let ftssLinkCodeArray = item['renderFlight']['FTSS'].split(' / ');
|
|
||||||
let ftssChnArray = [];
|
|
||||||
for (let i = 0; i < ftssLinkCodeArray.length; i++) {
|
|
||||||
ftssChnArray.push(flightStatus.find(val => val.sttc === ftssLinkCodeArray[i]).stdc)
|
|
||||||
}
|
|
||||||
item['renderFlight']['FTSS'] = ftssChnArray.join(' / ');
|
|
||||||
|
|
||||||
//航线处理
|
|
||||||
let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - ');
|
|
||||||
let erutPreChnArray = []
|
|
||||||
for (let i = 0; i < erutPreCodeArray.length; i++) {
|
|
||||||
try {
|
|
||||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
|
|
||||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
|
||||||
erutPreChnArray.push(citys[cityIndex].cityNameChn);
|
|
||||||
} catch (error) {
|
|
||||||
erutPreChnArray.push(erutPreCodeArray[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
item['renderPreFlight']['ERUT'] = erutPreChnArray.join(' - ');
|
|
||||||
//航空公司处理
|
|
||||||
let airlinePreIndex = airlines.findIndex(val => val.airlineCode === item['renderPreFlight']['ALCD']);
|
|
||||||
item['renderPreFlight']['ALCD'] = airlines[airlinePreIndex].airlineName;
|
|
||||||
//运营状态处理
|
|
||||||
item['renderPreFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc
|
|
||||||
|
|
||||||
//航线处理
|
|
||||||
let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - ');
|
|
||||||
let erutReaChnArray = []
|
|
||||||
for (let i = 0; i < erutReaCodeArray.length; i++) {
|
|
||||||
try {
|
|
||||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
|
|
||||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
|
||||||
erutReaChnArray.push(citys[cityIndex].cityNameChn);
|
|
||||||
} catch (error) {
|
|
||||||
erutReaChnArray.push(erutReaCodeArray[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
item['renderReaFlight']['ERUT'] = erutReaChnArray.join(' - ');
|
|
||||||
//航空公司处理
|
|
||||||
let airlineReaIndex = airlines.findIndex(val => val.airlineCode === item['renderReaFlight']['ALCD']);
|
|
||||||
item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName;
|
|
||||||
//运营状态处理
|
|
||||||
item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc
|
|
||||||
}
|
}
|
||||||
});
|
item['renderFlight']['ERUT'] = erutChnArray.join(' - ');
|
||||||
return combind_flights;
|
//航空公司处理
|
||||||
|
let airlineIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
||||||
|
item['renderFlight']['ALCD'] = airlines[airlineIndex].airlineName;
|
||||||
|
//运营状态处理
|
||||||
|
item['renderFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc
|
||||||
|
} else {
|
||||||
|
//航线处理
|
||||||
|
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||||
|
let erutLinkChnArray = []
|
||||||
|
for (let i = 0; i < erutLinkCodeArray.length; i++) {
|
||||||
|
try {
|
||||||
|
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
|
||||||
|
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||||
|
erutLinkChnArray.push(citys[cityIndex].cityNameChn);
|
||||||
|
} catch (error) {
|
||||||
|
erutLinkChnArray.push(erutLinkCodeArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item['renderFlight']['ERUT'] = erutLinkChnArray.join(' - ');
|
||||||
|
//航空公司处理
|
||||||
|
let airlineLinkIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
||||||
|
item['renderFlight']['ALCD'] = airlines[airlineLinkIndex].airlineName;
|
||||||
|
//运营状态处理
|
||||||
|
let ftssLinkCodeArray = item['renderFlight']['FTSS'].split(' / ');
|
||||||
|
let ftssLinkChnArray = [];
|
||||||
|
for (let i = 0; i < ftssLinkCodeArray.length; i++) {
|
||||||
|
ftssLinkChnArray.push(flightStatus.find(val => val.sttc === ftssLinkCodeArray[i]).stdc)
|
||||||
|
}
|
||||||
|
item['renderFlight']['FTSS'] = ftssLinkChnArray.join(' / ');
|
||||||
|
|
||||||
|
//航线处理
|
||||||
|
let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - ');
|
||||||
|
let erutPreChnArray = []
|
||||||
|
for (let i = 0; i < erutPreCodeArray.length; i++) {
|
||||||
|
try {
|
||||||
|
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
|
||||||
|
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||||
|
erutPreChnArray.push(citys[cityIndex].cityNameChn);
|
||||||
|
} catch (error) {
|
||||||
|
erutPreChnArray.push(erutPreCodeArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item['renderPreFlight']['ERUT'] = erutPreChnArray.join(' - ');
|
||||||
|
//航空公司处理
|
||||||
|
let airlinePreIndex = airlines.findIndex(val => val.airlineCode === item['renderPreFlight']['ALCD']);
|
||||||
|
item['renderPreFlight']['ALCD'] = airlines[airlinePreIndex].airlineName;
|
||||||
|
//运营状态处理
|
||||||
|
item['renderPreFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc
|
||||||
|
|
||||||
|
//航线处理
|
||||||
|
let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - ');
|
||||||
|
let erutReaChnArray = []
|
||||||
|
for (let i = 0; i < erutReaCodeArray.length; i++) {
|
||||||
|
try {
|
||||||
|
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
|
||||||
|
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||||
|
erutReaChnArray.push(citys[cityIndex].cityNameChn);
|
||||||
|
} catch (error) {
|
||||||
|
erutReaChnArray.push(erutReaCodeArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item['renderReaFlight']['ERUT'] = erutReaChnArray.join(' - ');
|
||||||
|
//航空公司处理
|
||||||
|
let airlineReaIndex = airlines.findIndex(val => val.airlineCode === item['renderReaFlight']['ALCD']);
|
||||||
|
item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName;
|
||||||
|
//运营状态处理
|
||||||
|
item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc
|
||||||
|
|
||||||
|
// //航线处理
|
||||||
|
// let erutCombinedCodeArray = item['renderCombinedFlight']['ERUT'].split(' - ');
|
||||||
|
// let erutCombinedChnArray = []
|
||||||
|
// for (let i = 0; i < erutCombinedCodeArray.length; i++) {
|
||||||
|
// try {
|
||||||
|
// let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCombinedCodeArray[i]);
|
||||||
|
// let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||||
|
// erutCombinedChnArray.push(citys[cityIndex].cityNameChn);
|
||||||
|
// } catch (error) {
|
||||||
|
// erutCombinedChnArray.push(erutCombinedCodeArray[i]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// item['renderCombinedFlight']['ERUT'] = erutCombinedChnArray.join(' - ');
|
||||||
|
// //航空公司处理
|
||||||
|
// let airlineCombinedIndex = airlines.findIndex(val => val.airlineCode === item['renderCombinedFlight']['ALCD']);
|
||||||
|
// item['renderCombinedFlight']['ALCD'] = airlines[airlineCombinedIndex].airlineName;
|
||||||
|
// //运营状态处理
|
||||||
|
// let ftssCombinedCodeArray = item['renderCombinedFlight']['FTSS'].split(' / ');
|
||||||
|
// let ftssCombinedChnArray = [];
|
||||||
|
// for (let i = 0; i < ftssCombinedCodeArray.length; i++) {
|
||||||
|
// ftssCombinedChnArray.push(flightStatus.find(val => val.sttc === ftssCombinedCodeArray[i]).stdc)
|
||||||
|
// }
|
||||||
|
// item['renderCombinedFlight']['FTSS'] = ftssCombinedChnArray.join(' / ');
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ export class WebsocketService {
|
|||||||
console.log('websocket was connected...')
|
console.log('websocket was connected...')
|
||||||
}
|
}
|
||||||
this.websocket.onmessage = (event) => {
|
this.websocket.onmessage = (event) => {
|
||||||
ob.next(event)
|
ob.next(event.data)
|
||||||
}
|
}
|
||||||
this.websocket.onerror = () => {
|
this.websocket.onerror = () => {
|
||||||
ob.error("连接失败")
|
ob.error("连接失败")
|
||||||
|
|||||||
Reference in New Issue
Block a user