基础数据停机位类别数据转换处理

This commit is contained in:
714943302@qq.com
2018-12-24 14:07:12 +08:00
parent cff0ebd561
commit 5165822bed
3 changed files with 58 additions and 35 deletions
@@ -17,7 +17,7 @@ export class StandComponent implements OnInit {
public col_lists = [
{ col_code: 'standCode', col_chn: '机位代码' },
{ col_code: 'standName', col_chn: '机位名称' },
{ col_code: 'standType', col_chn: '机位类型' },
{ col_code: 'standTypeDesc', col_chn: '机位类型' },
{ col_code: 'standStatus', col_chn: '资源状态' },
{ col_code: 'terminalAreaName', col_chn: '航站楼区域' },
]
@@ -35,6 +35,7 @@ export class StandComponent implements OnInit {
}
terminalAreas: Array<any>; //所属航站楼区域
standTypes: Array<any>; //停机位类别
stands: Array<any>;
public row_state: any = { renderFlight: {} };
public render_data: Array<object> = []; //显示数据,即需要显示的数据
@@ -42,6 +43,7 @@ export class StandComponent implements OnInit {
ngOnInit() {
this.terminalAreas = this.basicDataService.terminal_area;
this.stands = this.basicDataService.stand;
this.standTypes = this.basicDataService.standType;
this.render_data = this.basicDataService.stand;
this.basicDataService.stand_subject.subscribe(
data => {
@@ -54,13 +56,23 @@ export class StandComponent implements OnInit {
this.terminalAreas = data;
//航站楼区域数据转换处理
if(this.terminalAreas && this.terminalAreas.length > 0){
this.basicDataTransHandle();
this.terminalAreasHandle();
}
}
)
this.basicDataService.standType_subject.subscribe(
data => {
//停机位类别
if(this.standTypes && this.standTypes.length > 0){
this.standTypesHandle();
}
}
)
//航站楼区域数据转换处理
if(this.render_data){
this.basicDataTransHandle();
//航站楼区域数据转换处理
this.terminalAreasHandle();
//停机位类别数据转换处理
this.standTypesHandle();
}
/**
* 固定表头
@@ -74,7 +86,7 @@ export class StandComponent implements OnInit {
}
//航站楼区域数据转换处理
basicDataTransHandle() {
terminalAreasHandle() {
this.render_data.forEach(item => {
let terminalAreasLinkIndex = this.terminalAreas.findIndex(val => val.terminalAreaCode === item['terminalAreaCode']);
if(this.terminalAreas[terminalAreasLinkIndex]){
@@ -82,6 +94,15 @@ export class StandComponent implements OnInit {
}
})
}
//停机位类别数据转换处理
standTypesHandle() {
this.render_data.forEach(item => {
let standTypesLinkIndex = this.standTypes.findIndex(val => val.standType === item['standType']);
if(this.standTypes[standTypesLinkIndex]){
item['standTypeDesc'] = this.standTypes[standTypesLinkIndex].standTypeDesc;
}
})
}
//输入框回车事件
inputEnter() {