动态消息更新处理
This commit is contained in:
@@ -64,13 +64,484 @@ export class MainComponent implements OnInit {
|
||||
//订阅航班更新
|
||||
this.websocketService.dynamicsMessage().subscribe(
|
||||
event => {
|
||||
console.log(JSON.parse(event['data']));
|
||||
// let index = this.raw_data.findIndex(val => val['FLID'] === event['FLID']);
|
||||
// if (index > -1) {
|
||||
// this.raw_data[index] = event;
|
||||
// } else {
|
||||
// this.raw_data.push(event)
|
||||
// }
|
||||
let data = JSON.parse(event as string);
|
||||
if (data.topic === 'schd') {
|
||||
console.log('========')
|
||||
let message = JSON.parse(data.message);
|
||||
let index = this.raw_data.findIndex(element => element['FLID'] === message.FLID);
|
||||
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;
|
||||
|
||||
//查找链接航班并将其组合成一条数据
|
||||
let combined_linked_data = this.dataHandle.findLinkFlights(data.body);
|
||||
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);
|
||||
this.combined_data.push(flights_item);
|
||||
@@ -103,7 +574,11 @@ export class MainComponent implements OnInit {
|
||||
this.airports = this.basicDataService.airport;
|
||||
|
||||
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);
|
||||
} else {
|
||||
this.basicDataService.terminal_subject.subscribe(
|
||||
@@ -121,7 +596,11 @@ export class MainComponent implements OnInit {
|
||||
this.basicDataService.airport_subject.subscribe(
|
||||
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);
|
||||
}
|
||||
);
|
||||
@@ -143,14 +622,16 @@ export class MainComponent implements OnInit {
|
||||
/**
|
||||
* 执行排序并渲染
|
||||
*/
|
||||
doSequence(sequenceData) {
|
||||
sequenceData.forEach(element => {
|
||||
doSequence(combined_data) {
|
||||
|
||||
combined_data.forEach(element => {
|
||||
element['ORDER'] = this.orderHandle.sequence(element);
|
||||
})
|
||||
sequenceData.sort(function (a, b) {
|
||||
combined_data.sort(function (a, b) {
|
||||
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.changeDetectorRef.detectChanges();
|
||||
this.operateSpinServiceService.hideSpin()
|
||||
@@ -160,7 +641,13 @@ export class MainComponent implements OnInit {
|
||||
* 刷新
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -171,8 +658,10 @@ export class MainComponent implements OnInit {
|
||||
* @return
|
||||
*/
|
||||
SEARCH = ''; //手动输入条件
|
||||
LASTSEARCH = '';
|
||||
FLT_POS = 1; //过滤还是定位
|
||||
SEL_COL = ''; //选择列名
|
||||
LAST_SEL_COL = '';
|
||||
public filterItems = {
|
||||
ALCD: '', //航空公司
|
||||
FLIN: '', //航线类别
|
||||
@@ -266,9 +755,13 @@ export class MainComponent implements OnInit {
|
||||
|
||||
if (pre_satis && !rea_satis) {
|
||||
item['renderFlight'] = item['renderPreFlight'];
|
||||
delete item['reaFlight'];
|
||||
delete item['renderReaFlight'];
|
||||
return pre_satis;
|
||||
} else if (!pre_satis && rea_satis) {
|
||||
item['renderFlight'] = item['renderReaFlight'];
|
||||
delete item['preFlight'];
|
||||
delete item['renderPreFlight'];
|
||||
return rea_satis;
|
||||
} else if (pre_satis && rea_satis) {
|
||||
return pre_satis && rea_satis;
|
||||
@@ -292,6 +785,8 @@ export class MainComponent implements OnInit {
|
||||
* @param filterData
|
||||
*/
|
||||
inputFilter(filterData) {
|
||||
this.LAST_SEL_COL = this.SEL_COL;
|
||||
this.LASTSEARCH = this.SEARCH;
|
||||
if (this.SEARCH) {
|
||||
if (this.SEL_COL) {
|
||||
let sel_col = this.SEL_COL;
|
||||
@@ -301,37 +796,25 @@ export class MainComponent implements OnInit {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (this.SEARCH) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
filterData = filterData.filter(item => {
|
||||
let is_satis = false;
|
||||
for (const key in item['renderFlight']) {
|
||||
if (item['renderFlight'].hasOwnProperty(key)) {
|
||||
if (item['renderFlight'][key]) {
|
||||
if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||
is_satis = true;
|
||||
break;
|
||||
} else {
|
||||
is_satis = false;
|
||||
continue;
|
||||
}
|
||||
let cols = this.col_lists;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
if (item['renderFlight'][cols[i]['COL_CODE']]) {
|
||||
if (item['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||
is_satis = true;
|
||||
break;
|
||||
} else {
|
||||
if (this.SEARCH) {
|
||||
is_satis = false;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = true;
|
||||
break;
|
||||
}
|
||||
is_satis = false;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
is_satis = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -368,26 +851,22 @@ export class MainComponent implements OnInit {
|
||||
});
|
||||
} else {
|
||||
filterData.forEach(element => {
|
||||
for (const key in element['renderFlight']) {
|
||||
if (element['renderFlight'].hasOwnProperty(key)) {
|
||||
if (element['renderFlight'][key]) {
|
||||
if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||
transArray.push(element)
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
let cols = this.col_lists;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
if (element['renderFlight'][cols[i]['COL_CODE']]) {
|
||||
if (element['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||
transArray.push(element)
|
||||
break;
|
||||
} else {
|
||||
if (this.SEARCH) {
|
||||
continue;
|
||||
} else {
|
||||
transArray.push(element)
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
continue;
|
||||
if (this.SEARCH) {
|
||||
continue;
|
||||
} else {
|
||||
transArray.push(element)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -413,7 +892,10 @@ export class MainComponent implements OnInit {
|
||||
|
||||
let tr = $(".selected");
|
||||
let objTr = tr[0];
|
||||
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
|
||||
if (objTr) {
|
||||
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user