工具类抽取及历史数据处理
This commit is contained in:
@@ -0,0 +1,274 @@
|
||||
import timeFormatter from './time-formatter';
|
||||
export class TransferRenderHandle {
|
||||
|
||||
public gctmFormatter(flight) {
|
||||
if (flight['GTDT']) {
|
||||
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
|
||||
return timeFormatter(flight['GTDT'][0]['GCTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public botmFormatter(flight) {
|
||||
if (flight['BOTM']) {
|
||||
return timeFormatter(flight['BOTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public abdgFormatter(flight) {
|
||||
if (flight['ABTM']) {
|
||||
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
|
||||
let abdg = [];
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
abdg.push(flight['ABTM'][i]['ABDG']);
|
||||
}
|
||||
let set = new Set(abdg);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public aotm_aFormatter(flight) {
|
||||
if (flight['ABTM']) {
|
||||
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
if (flight['ABTM'][i]['ABOP'] === 'A') {
|
||||
return timeFormatter(flight['ABTM'][i]['AOTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public aotm_dFormatter(flight) {
|
||||
if (flight['ABTM']) {
|
||||
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
if (flight['ABTM'][i]['ABOP'] === 'D') {
|
||||
return timeFormatter(flight['ABTM'][i]['AOTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public beltFormatter(flight) {
|
||||
if (flight['CLDT']) {
|
||||
if (Array.isArray(flight['CLDT']) && flight['CLDT'].length > 0) {
|
||||
let belt = [];
|
||||
for (let i = 0; i < flight['CLDT'].length; i++) {
|
||||
belt.push(flight['CLDT'][i]['BELT']);
|
||||
}
|
||||
let set = new Set(belt);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public chkcFormatter(flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
let chkc = [];
|
||||
for (let i = 0; i < flight['CKDT'].length; i++) {
|
||||
chkc.push(flight['CKDT'][i]['CHKC']);
|
||||
}
|
||||
let set = new Set(chkc);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public cctmFormatter(flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
return timeFormatter(flight['CKDT'][0]['CCTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public cotmFormatter(flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
return timeFormatter(flight['CKDT'][0]['COTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public chtmOnFormatter(flight) {
|
||||
if (flight['CHOT']) {
|
||||
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
|
||||
for (let i = 0; i < flight['CHOT'].length; i++) {
|
||||
if (flight['CHOT'][i]['CHID'] === 'ON') {
|
||||
return timeFormatter(flight['CHOT'][i]['CHTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public chtmOffFormatter(flight) {
|
||||
if (flight['CHOT']) {
|
||||
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
|
||||
for (let i = 0; i < flight['CHOT'].length; i++) {
|
||||
if (flight['CHOT'][i]['CHID'] === 'OFF') {
|
||||
return timeFormatter(flight['CHOT'][i]['CHTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public laclFormatter(flight) {
|
||||
if (flight['LACL']) {
|
||||
return timeFormatter(flight['LACL']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public chutFormatter(flight) {
|
||||
if (flight['CHDT']) {
|
||||
if (Array.isArray(flight['CHDT']) && flight['CHDT'].length > 0) {
|
||||
let chdt = [];
|
||||
for (let i = 0; i < flight['CHDT'].length; i++) {
|
||||
chdt.push(flight['CHDT'][i]['CHUT']);
|
||||
}
|
||||
let set = new Set(chdt);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public acttFormatter(flight) {
|
||||
if (flight['ACTT']) {
|
||||
return timeFormatter(flight['ACTT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public psstFormatter(flight) {
|
||||
if (flight['PSDT']) {
|
||||
if (Array.isArray(flight['PSDT']) && flight['PSDT'].length > 0) {
|
||||
let chkc = [];
|
||||
for (let i = 0; i < flight['PSDT'].length; i++) {
|
||||
chkc.push(flight['PSDT'][i]['PSST']);
|
||||
}
|
||||
let set = new Set(chkc);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public esttFormatter(flight) {
|
||||
if (flight['ESTT']) {
|
||||
return timeFormatter(flight['ESTT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public mvinFormatter(flight) {
|
||||
if (flight['MVIN']) {
|
||||
if (flight['MVIN'] === 'A') {
|
||||
return '到达';
|
||||
} else if (flight['MVIN'] === 'D') {
|
||||
return '出发';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public erutFormatter(flight) {
|
||||
if (flight['ERUT']) {
|
||||
if (Array.isArray(flight['ERUT']) && flight['ERUT'].length > 0) {
|
||||
let erut = [];
|
||||
for (let i = 0; i < flight['ERUT'].length; i++) {
|
||||
erut.push(flight['ERUT'][i]['APCD']);
|
||||
}
|
||||
return erut.join(' - ');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public flinFormatter(flight) {
|
||||
const flinChn = {
|
||||
'D': '国内',
|
||||
'I': '国际',
|
||||
'M': '混合',
|
||||
'R': '地区'
|
||||
}
|
||||
if (flight['FLIN']) {
|
||||
return flinChn[flight['FLIN']];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public sodtFormatter(flight) {
|
||||
if (flight['SODT']) {
|
||||
return timeFormatter(flight['SODT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public gateFormatter(flight) {
|
||||
if (flight['GTDT']) {
|
||||
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
|
||||
let gate = [];
|
||||
for (let i = 0; i < flight['GTDT'].length; i++) {
|
||||
gate.push(flight['GTDT'][i]['GATE']);
|
||||
}
|
||||
let set = new Set(gate);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public padtFormatter(flight) {
|
||||
if (flight['PADT']) {
|
||||
return timeFormatter(flight['PADT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user