init commit
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { HttpClientService } from '../../services/http-client.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main',
|
||||
templateUrl: './main.component.html',
|
||||
styleUrls: ['./main.component.scss']
|
||||
})
|
||||
export class MainComponent implements OnInit {
|
||||
public airline_col_lists: Array<object>;
|
||||
public airline_row_lists: Array<object> = [];
|
||||
public airline_color: Array<object> = [];
|
||||
public row_state: number;
|
||||
|
||||
|
||||
constructor(
|
||||
private httpCilent: HttpClientService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
/* 获取显示列 */
|
||||
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
|
||||
data => {
|
||||
data.sort(function (a, b) {
|
||||
return (a['COL_ORDER'] - b['COL_ORDER']);
|
||||
})
|
||||
this.airline_col_lists = data;
|
||||
}
|
||||
)
|
||||
/* 获取航班动态信息 */
|
||||
this.httpCilent.get('/assets/mock-data/airline-data.json').subscribe(
|
||||
data => {
|
||||
this.airline_row_lists = []
|
||||
data.forEach(element => {
|
||||
this.airline_row_lists.push(JSON.parse(element.value));
|
||||
});
|
||||
}
|
||||
)
|
||||
/* 获取颜色数据 */
|
||||
// this.httpCilent.get('/assets/mock-data/airline-color.json').subscribe(
|
||||
// data => {
|
||||
// this.airline_color = data;
|
||||
// console.log(data);
|
||||
// }
|
||||
// )
|
||||
}
|
||||
|
||||
selectRow($event, i) {
|
||||
this.row_state = i;
|
||||
}
|
||||
|
||||
findColor(items,marryItem){
|
||||
// console.log(items,marryItem);
|
||||
let index = items.findIndex(element=>{
|
||||
element.COL_CODE === marryItem;
|
||||
})
|
||||
console.log(index)
|
||||
if(index===-1){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user