From a92770f3a092331d437086f71797ba69c298f67b Mon Sep 17 00:00:00 2001 From: zhouyuejun <505127606@qq.com> Date: Tue, 15 Jan 2019 15:11:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E8=88=AA=E7=8F=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=85=B1=E4=BA=AB=E8=88=AA=E7=8F=AD=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/main/main.component.html | 10 +- src/app/pages/main/main.component.ts | 39 +- .../related-tab/related-tab.component.html | 2 +- src/app/utils/flights-data-handle.ts | 493 +++--------------- src/app/utils/web-worker-handle.ts | 17 +- src/assets/web-worker-handle.js | 18 +- 6 files changed, 103 insertions(+), 476 deletions(-) diff --git a/src/app/pages/main/main.component.html b/src/app/pages/main/main.component.html index d3d5128..6e1011e 100644 --- a/src/app/pages/main/main.component.html +++ b/src/app/pages/main/main.component.html @@ -209,19 +209,19 @@
- + - + - + - + - + diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index 3d7f354..06b5d94 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -141,7 +141,7 @@ export class MainComponent implements OnInit { let data = JSON.parse(event as string); if (data.topic === 'schd') { let message = JSON.parse(data.message); - // console.log(message); + console.log(message); //是否可以开始处理动态消息 if (this.canHandleDynamicMessage) { this.dynamicMessageHandle(message); @@ -150,7 +150,7 @@ export class MainComponent implements OnInit { } } else if (data.topic === 'msg') { let message = JSON.parse(data.message); - // console.log(message); + console.log(message); if (this.canHandleDynamicAlert) { this.dynamicAlertHandle(message); } else { @@ -432,28 +432,6 @@ export class MainComponent implements OnInit { this.raw_data.push(message); } - //查找链接航班并将其组合成一条数据 - // let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data); - // let combined_data = []; - // this.combined_data = []; - // combined_linked_data.forEach(element => { - // let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists); - // this.combined_data.push(flights_item); - // }); - // this.combined_data.forEach(item => { - // combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus, this.flightTypes)); - // }) - // this.combined_data = combined_data; - // 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.selectChange('dynamic'); - if (this.airlinesSelections.findIndex(airline => airline.airlineCodeIata === message['ALCD']) === -1) { let index = this.airlines.findIndex(val => val.airlineCodeIata === message['ALCD']); this.airlinesSelections.push(this.airlines[index]); @@ -471,7 +449,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, @@ -484,7 +462,7 @@ export class MainComponent implements OnInit { } this.promise.postMessage(dynamicData); this.promise.onmessage = function (e) { - // console.log('=====') + console.log('=====') this.combined_data = e.data; this.selectChange('dynamic'); // this.promise.terminate(); @@ -878,7 +856,7 @@ export class MainComponent implements OnInit { }) }, 500) // this.render_data = filterData; - 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.operateSpinServiceService.hideSpin(); } @@ -1228,11 +1206,4 @@ export class MainComponent implements OnInit { }, 10) } } - - /** - * tab项切换事件 - */ - nzClick() { - } - } \ No newline at end of file diff --git a/src/app/pages/main/related-tab/related-tab.component.html b/src/app/pages/main/related-tab/related-tab.component.html index ceaee63..7864c1a 100644 --- a/src/app/pages/main/related-tab/related-tab.component.html +++ b/src/app/pages/main/related-tab/related-tab.component.html @@ -3,7 +3,7 @@
共享航班代码
-

共享航班号:{{lines['renderFlight'].CSFT}}

+

共享航班号:{{lines['renderFlight'].MAFL}}

diff --git a/src/app/utils/flights-data-handle.ts b/src/app/utils/flights-data-handle.ts index 1cba1ff..b513ec1 100644 --- a/src/app/utils/flights-data-handle.ts +++ b/src/app/utils/flights-data-handle.ts @@ -5,7 +5,7 @@ export class FlightsDataHandle { public transferHandle = new TransferRenderHandle(); public formatter = { - 'RENO':this.transferHandle.renoFormatter.bind(this.transferHandle), + '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), @@ -69,6 +69,20 @@ export class FlightsDataHandle { raw_flights.forEach(element => { copy_raw_flights.push(Object.assign({}, element)) }) + for (let i = 0; i < copy_raw_flights.length; i++) { + if (copy_raw_flights[i]['MAID']) { + let index = copy_raw_flights.findIndex(val => { return val['FLID'] === copy_raw_flights[i]['MAID'] }); + if (index > -1) { + if (copy_raw_flights[index]['MAFL'] && Array.isArray(copy_raw_flights[index]['MAFL'])) { + copy_raw_flights[index]['MAFL'].push(copy_raw_flights[i]['FLNO']); + } else { + copy_raw_flights[index]['MAFL'] = []; + copy_raw_flights[index]['MAFL'].push(copy_raw_flights[i]['FLNO']); + } + } + } + } + for (let i = 0; i < copy_raw_flights.length; i++) { if (copy_raw_flights[i]['MVIN'] === 'A') { if (copy_raw_flights[i]['TAID']) { @@ -109,32 +123,32 @@ export class FlightsDataHandle { if (typeof Object.assign != 'function') { // Must be writable: true, enumerable: false, configurable: true Object.defineProperty(Object, "assign", { - value: function assign(target, varArgs) { // .length of function is 2 - 'use strict'; - if (target == null) { // TypeError if undefined or null - throw new TypeError('Cannot convert undefined or null to object'); - } - - var to = Object(target); - - for (var index = 1; index < arguments.length; index++) { - var nextSource = arguments[index]; - - if (nextSource != null) { // Skip over if undefined or null - for (var nextKey in nextSource) { - // Avoid bugs when hasOwnProperty is shadowed - if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { - to[nextKey] = nextSource[nextKey]; - } + value: function assign(target, varArgs) { // .length of function is 2 + 'use strict'; + if (target == null) { // TypeError if undefined or null + throw new TypeError('Cannot convert undefined or null to object'); } - } - } - return to; - }, - writable: true, - configurable: true + + var to = Object(target); + + for (var index = 1; index < arguments.length; index++) { + var nextSource = arguments[index]; + + if (nextSource != null) { // Skip over if undefined or null + for (var nextKey in nextSource) { + // Avoid bugs when hasOwnProperty is shadowed + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + to[nextKey] = nextSource[nextKey]; + } + } + } + } + return to; + }, + writable: true, + configurable: true }); - } + } let render_flight = {}, render_pre_flight = {}, render_rea_flight = {}, @@ -184,9 +198,9 @@ export class FlightsDataHandle { } } else if (preHasValue && reaHasValue) { if (preHasValue === reaHasValue) { - if(key==='FLNO'){ + if (key === 'FLNO') { render_flight[key] = preHasValue + ' / ' + reaHasValue; - }else{ + } else { render_flight[key] = preHasValue; } } else { @@ -223,13 +237,13 @@ export class FlightsDataHandle { 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) { @@ -251,13 +265,13 @@ export class FlightsDataHandle { 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) { @@ -290,13 +304,13 @@ export class FlightsDataHandle { 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) { @@ -319,13 +333,13 @@ export class FlightsDataHandle { 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) { @@ -348,389 +362,4 @@ export class FlightsDataHandle { return item; } } - - // public dynamicMessageHandle(message, render_data, col_lists, filterItems, LASTSEARCH, LAST_SEL_COL, airports, citys, airlines, flightStatus, flightTypes) { - - // try { - // if (message.MVIN === 'A') { - // //针对render_data的处理 - // let index1 = 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) { - // render_data[index1]['preFlight'] = message; - // render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists); - // render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes); - - // let is_satis = true; - // for (const key in filterItems) { - // if (filterItems.hasOwnProperty(key) && filterItems[key]) { - // if (key === 'Abnormal_state') { - // if (render_data[index1]['preFlight'][filterItems[key]]) { - // is_satis = true; - // continue; - // } else { - // is_satis = false; - // break; - // } - // } else { - // if (render_data[index1]['preFlight'][key] === filterItems[key]) { - // is_satis = true; - // continue; - // } else { - // is_satis = false; - // break; - // } - // } - // } - // } - // let search_satis = true; - // if (LASTSEARCH) { - // if (LAST_SEL_COL) { - // if (render_data[index1]['preFlight'][LAST_SEL_COL]) { - // if (render_data[index1]['preFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) { - // search_satis = true; - // } else { - // search_satis = false; - // } - // } else { - // search_satis = false; - // } - // } else { - // let cols = col_lists; - // for (let i = 0; i < cols.length; i++) { - // if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) { - // if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(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 (message.TAID) { - // if (this.orderHandle.isArriFlight(render_data[index1])) { - // let i = 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) { - // // render_data.splice(index1, 1); - // render_data[i]['reaFlight']['TAID'] = message.FLID; - // render_data[i]['preFlight'] = message; - // render_data.splice(index1, 1); - // // let newFlight = {}; - // // newFlight['preFlight'] = message; - // // newFlight['reaFlight'] = render_data[i]['reaFlight']; - // // render_data.splice(i, 1); - // render_data[i] = this.flightsRenderTransfer(render_data[i], col_lists); - // render_data[i] = this.basicDataTransHandle(render_data[i], airports, citys, airlines, flightStatus, flightTypes); - // // render_data.push(newFlight) - // } - // } - // } else { - // if (this.orderHandle.isLinked(render_data[index1])) { - // let newPreFlight = {}, - // newReaFlight = {}; - - // delete render_data[index1]['preFlight']['TAID']; - // newPreFlight['preFlight'] = render_data[index1]['preFlight']; - // newPreFlight['renderFlight'] = render_data[index1]['renderPreFlight']; - // delete render_data[index1]['reaFlight']['TAID']; - // newPreFlight['reaFlight'] = render_data[index1]['reaFlight']; - // newPreFlight['renderFlight'] = render_data[index1]['renderReaFlight']; - // render_data.splice(index1, 1); - // render_data.push(newPreFlight); - // render_data.push(newReaFlight); - // } - // } - // // } - // } else { - // if (this.orderHandle.isArriFlight(render_data[index1])) { - // render_data.splice(index1, 1); - // } else if (this.orderHandle.isLinked(render_data[index1])) { - // delete render_data[index1]['preFlight']; - // delete render_data[index1]['renderPreFlight']; - // render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists); - // render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes); - // } - // } - // } else { - // let newFlight = {}; - // newFlight['preFlight'] = message; - // newFlight = this.flightsRenderTransfer(newFlight, col_lists); - // newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes); - - // let is_satis = true; - // for (const key in filterItems) { - // if (filterItems.hasOwnProperty(key) && filterItems[key]) { - // if (key === 'Abnormal_state') { - // if (newFlight['preFlight'][filterItems[key]]) { - // is_satis = true; - // continue; - // } else { - // is_satis = false; - // break; - // } - // } else { - // if (newFlight['preFlight'][key] === filterItems[key]) { - // is_satis = true; - // continue; - // } else { - // is_satis = false; - // break; - // } - // } - // } - // } - - // let search_satis = true; - // if (LASTSEARCH) { - // if (LAST_SEL_COL) { - // if (newFlight['preFlight'][LAST_SEL_COL]) { - // if (newFlight['preFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) { - // search_satis = true; - // } else { - // search_satis = false; - // } - // } else { - // search_satis = false; - // } - // } else { - // let cols = 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(LASTSEARCH, 'i'))) { - // search_satis = true; - // break; - // } else { - // search_satis = false; - // continue; - // } - // } else { - // search_satis = false; - // continue; - // } - // } - // } - // } - // if (is_satis && search_satis) { - // if (message.TAID) { - // let i = 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) { - // render_data[i]['preFlight'] = newFlight['preFlight']; - // render_data[i]['renderPreFlight'] = newFlight['renderPreFlight']; - // } else { - // render_data.push(newFlight); - // } - // } else { - // render_data.push(newFlight); - // } - // } - // } - // } else { - // //针对render_data的处理 - // let index1 = 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) { - // render_data[index1]['reaFlight'] = message; - // render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists); - // render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes); - - // let is_satis = true; - // for (const key in filterItems) { - // if (filterItems.hasOwnProperty(key) && filterItems[key]) { - // if (key === 'Abnormal_state') { - // if (render_data[index1]['reaFlight'][filterItems[key]]) { - // is_satis = true; - // continue; - // } else { - // is_satis = false; - // break; - // } - // } else { - // if (render_data[index1]['reaFlight'][key] === filterItems[key]) { - // is_satis = true; - // continue; - // } else { - // is_satis = false; - // break; - // } - // } - // } - // } - // let search_satis = true; - // if (LASTSEARCH) { - // if (LAST_SEL_COL) { - // if (render_data[index1]['reaFlight'][LAST_SEL_COL]) { - // if (render_data[index1]['reaFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) { - // search_satis = true; - // } else { - // search_satis = false; - // } - // } else { - // search_satis = false; - // } - // } else { - // let cols = col_lists; - // for (let i = 0; i < cols.length; i++) { - // if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) { - // if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(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(render_data[index1])) { - // render_data.splice(index1, 1); - // } else if (this.orderHandle.isLinked(render_data[index1])) { - // delete render_data[index1]['reaFlight']; - // delete render_data[index1]['renderReaFlight']; - - // render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists); - // render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes); - // } - // } - // } else { - // let newFlight = {}; - // newFlight['reaFlight'] = message; - // newFlight = this.flightsRenderTransfer(newFlight, col_lists); - // newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes); - - // let is_satis = true; - // for (const key in filterItems) { - // if (filterItems.hasOwnProperty(key) && filterItems[key]) { - // if (key === 'Abnormal_state') { - // if (newFlight['reaFlight'][filterItems[key]]) { - // is_satis = true; - // continue; - // } else { - // is_satis = false; - // break; - // } - // } else { - // if (newFlight['reaFlight'][key] === filterItems[key]) { - // is_satis = true; - // continue; - // } else { - // is_satis = false; - // break; - // } - // } - // } - // } - // let search_satis = true; - // if (LASTSEARCH) { - // if (LAST_SEL_COL) { - // if (newFlight['reaFlight'][LAST_SEL_COL]) { - // if (newFlight['reaFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) { - // search_satis = true; - // } else { - // search_satis = false; - // } - // } else { - // search_satis = false; - // } - // } else { - // let cols = 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(LASTSEARCH, 'i'))) { - // search_satis = true; - // break; - // } else { - // search_satis = false; - // continue; - // } - // } else { - // search_satis = false; - // continue; - // } - // } - // } - // } - // if (is_satis && search_satis) { - // let i = 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) { - // render_data[i]['reaFlight'] = newFlight['reaFlight']; - // render_data[i]['renderReaFlight'] = newFlight['renderReaFlight']; - // } else { - // render_data.push(newFlight); - // } - // } - // } - // } - // } catch (error) { - // console.log('航班号为:' + message.FLNO + ' - 消息有误,处理失败,请检查消息数据'); - // throw error; - // } finally { - // return { - // 'render_data': render_data - // } - // } - // } } \ No newline at end of file diff --git a/src/app/utils/web-worker-handle.ts b/src/app/utils/web-worker-handle.ts index 43dc788..246a949 100644 --- a/src/app/utils/web-worker-handle.ts +++ b/src/app/utils/web-worker-handle.ts @@ -822,7 +822,20 @@ export default function (dynamicData) { let copy_raw_flights = []; raw_data.forEach(element => { copy_raw_flights.push(Object.assign({}, element)) - }) + }); + for (let i = 0; i < copy_raw_flights.length; i++) { + if (copy_raw_flights[i]['MAID']) { + let index = copy_raw_flights.findIndex(val => { return val['FLID'] === copy_raw_flights[i]['MAID'] }); + if (index > -1) { + if (copy_raw_flights[index]['MAFL'] && Array.isArray(copy_raw_flights[index]['MAFL'])) { + copy_raw_flights[index]['MAFL'].push(copy_raw_flights[i]['FLNO']); + } else { + copy_raw_flights[index]['MAFL'] = []; + copy_raw_flights[index]['MAFL'].push(copy_raw_flights[i]['FLNO']); + } + } + } + }; for (let i = 0; i < copy_raw_flights.length; i++) { if (copy_raw_flights[i]['MVIN'] === 'A') { if (copy_raw_flights[i]['TAID']) { @@ -838,7 +851,7 @@ export default function (dynamicData) { } } } - } + }; copy_raw_flights.forEach(element => { let flights_item = {}; if (element['MVIN'] === 'A' && !element['isLinked']) { diff --git a/src/assets/web-worker-handle.js b/src/assets/web-worker-handle.js index b6d5715..2c428f9 100644 --- a/src/assets/web-worker-handle.js +++ b/src/assets/web-worker-handle.js @@ -822,7 +822,21 @@ onmessage = function (dynamicData) { let copy_raw_flights = []; raw_data.forEach(element => { copy_raw_flights.push(Object.assign({}, element)) - }) + }); + + for (let i = 0; i < copy_raw_flights.length; i++) { + if (copy_raw_flights[i]['MAID']) { + let index = copy_raw_flights.findIndex(val => { return val['FLID'] === copy_raw_flights[i]['MAID'] }); + if (index > -1) { + if (copy_raw_flights[index]['MAFL'] && Array.isArray(copy_raw_flights[index]['MAFL'])) { + copy_raw_flights[index]['MAFL'].push(copy_raw_flights[i]['FLNO']); + } else { + copy_raw_flights[index]['MAFL'] = []; + copy_raw_flights[index]['MAFL'].push(copy_raw_flights[i]['FLNO']); + } + } + } + }; for (let i = 0; i < copy_raw_flights.length; i++) { if (copy_raw_flights[i]['MVIN'] === 'A') { if (copy_raw_flights[i]['TAID']) { @@ -838,7 +852,7 @@ onmessage = function (dynamicData) { } } } - } + }; copy_raw_flights.forEach(element => { let flights_item = {}; if (element['MVIN'] === 'A' && !element['isLinked']) {