创建websocket服务和spin服务
This commit is contained in:
@@ -5,7 +5,9 @@ import { ToastService } from '../../components/toast/toast.service';
|
||||
import { ToastConfig, ToastType } from '../../components/toast/toast-model';
|
||||
|
||||
import { HttpClientService } from '../../services/http-client.service';
|
||||
import { BasicDataService } from '../basic-data-service'
|
||||
import { BasicDataService } from '../basic-data-service';
|
||||
import { OperateSpinServiceService } from '../operate-spin-service.service';
|
||||
import { WebsocketService } from '../../services/websocket.service';
|
||||
|
||||
import dateFormatter from '../../utils/data-formatter';
|
||||
import timeFormatter from '../../utils/time-formatter';
|
||||
@@ -44,14 +46,16 @@ export class MainComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private basicDataService: BasicDataService,
|
||||
// private operateSpinServiceService:OperateSpinServiceService,
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private toastService: ToastService,
|
||||
private websocketService: WebsocketService
|
||||
) {
|
||||
console.log(new Date().getTime())
|
||||
}
|
||||
public tabClose: boolean = true;
|
||||
public isSpinning:boolean = true;
|
||||
public isSpinning: boolean = true;
|
||||
|
||||
//各项基础数据
|
||||
public terminals: Array<any>;
|
||||
@@ -104,6 +108,11 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.websocketService.dynamicsMessage().subscribe(
|
||||
event => {
|
||||
console.log(event);
|
||||
}
|
||||
)
|
||||
// this.getBasicData()
|
||||
this.changeDetectorRef.detach();
|
||||
/* 获取显示列 */
|
||||
@@ -172,9 +181,18 @@ export class MainComponent implements OnInit {
|
||||
let preHasValue = this.formatter[key](row_flights['preFlight']);
|
||||
let reaHasValue = this.formatter[key](row_flights['reaFlight']);
|
||||
if (preHasValue && !reaHasValue) {
|
||||
render_flight[key] = preHasValue;
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = preHasValue + ' / '
|
||||
} else {
|
||||
render_flight[key] = preHasValue;
|
||||
}
|
||||
} else if (!preHasValue && reaHasValue) {
|
||||
render_flight[key] = reaHasValue;
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = ' / ' + reaHasValue
|
||||
} else {
|
||||
render_flight[key] = reaHasValue;
|
||||
}
|
||||
// render_flight[key] = reaHasValue;
|
||||
} else if (preHasValue && reaHasValue) {
|
||||
if (preHasValue === reaHasValue) {
|
||||
render_flight[key] = preHasValue
|
||||
@@ -195,9 +213,17 @@ export class MainComponent implements OnInit {
|
||||
let preHasValue = row_flights['preFlight'][key];
|
||||
let reaHasValue = row_flights['reaFlight'][key]
|
||||
if (preHasValue && !reaHasValue) {
|
||||
render_flight[key] = preHasValue;
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = preHasValue + ' / '
|
||||
} else {
|
||||
render_flight[key] = preHasValue;
|
||||
}
|
||||
} else if (!preHasValue && reaHasValue) {
|
||||
render_flight[key] = reaHasValue;
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = ' / ' + reaHasValue
|
||||
} else {
|
||||
render_flight[key] = reaHasValue;
|
||||
}
|
||||
} else if (preHasValue && reaHasValue) {
|
||||
if (preHasValue === reaHasValue) {
|
||||
render_flight[key] = preHasValue
|
||||
@@ -282,9 +308,13 @@ export class MainComponent implements OnInit {
|
||||
let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
let erutChnArray = []
|
||||
for (let i = 0; i < erutCodeArray.length; i++) {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
try {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutChnArray.push(erutCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderFlight']['ERUT'] = erutChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
@@ -297,11 +327,13 @@ export class MainComponent implements OnInit {
|
||||
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
let erutLinkChnArray = []
|
||||
for (let i = 0; i < erutLinkCodeArray.length; i++) {
|
||||
console.log(erutLinkCodeArray[i]);
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
|
||||
console.log(airportIndex);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutLinkChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
try {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutLinkChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutLinkChnArray.push(erutLinkCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderFlight']['ERUT'] = erutLinkChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
@@ -319,9 +351,13 @@ export class MainComponent implements OnInit {
|
||||
let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - ');
|
||||
let erutPreChnArray = []
|
||||
for (let i = 0; i < erutPreCodeArray.length; i++) {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutPreChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
try {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutPreChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutPreChnArray.push(erutPreCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderPreFlight']['ERUT'] = erutPreChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
@@ -334,9 +370,13 @@ export class MainComponent implements OnInit {
|
||||
let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - ');
|
||||
let erutReaChnArray = []
|
||||
for (let i = 0; i < erutReaCodeArray.length; i++) {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutReaChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
try {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutReaChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutReaChnArray.push(erutReaCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderReaFlight']['ERUT'] = erutReaChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
@@ -442,6 +482,7 @@ export class MainComponent implements OnInit {
|
||||
* 下拉框选择筛选
|
||||
*/
|
||||
selectChange() {
|
||||
// this.operateSpinServiceService.showSpin()
|
||||
let filter_data = [];
|
||||
let filterItems = this.filterItems;
|
||||
this.combined_data.forEach(item => {
|
||||
@@ -967,7 +1008,6 @@ export class MainComponent implements OnInit {
|
||||
*/
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
// console.log(i)
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
@@ -975,12 +1015,89 @@ export class MainComponent implements OnInit {
|
||||
* 获取当前单元格颜色
|
||||
* @param col_CODE
|
||||
*/
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
getColor(col_CODE, flight) {
|
||||
if (this.isArriFlight(flight)) {
|
||||
if (col_CODE === 'SODT') {
|
||||
if (flight['preFlight']['SODT']) {
|
||||
if (!flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
|
||||
return 'rgb(0,255,255)';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (col_CODE === 'ESTT') {
|
||||
if (flight['preFlight']['ESTT']) {
|
||||
if (!flight['preFlight']['ACTT']) {
|
||||
return 'rgb(255,207,156)';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (col_CODE === 'ACTT') {
|
||||
if (flight['preFlight']['ACTT']) {
|
||||
return 'rgb(148,207,255)';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
return null
|
||||
if (col_CODE === 'SODT') {
|
||||
if (flight['reaFlight']['SODT']) {
|
||||
if (!flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
|
||||
return 'rgb(0,255,255)';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (col_CODE === 'ESTT') {
|
||||
if (flight['reaFlight']['ESTT']) {
|
||||
if (!flight['reaFlight']['ACTT']) {
|
||||
return 'rgb(255,207,156)';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (col_CODE === 'ACTT') {
|
||||
if (flight['reaFlight']['ACTT']) {
|
||||
return 'rgb(148,207,255)';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单元格内容居左居右
|
||||
* @param col_CODE
|
||||
* @param flight
|
||||
*/
|
||||
getPosition(col_CODE, flight) {
|
||||
if (this.isDeptFlight(flight)) {
|
||||
if (col_CODE === 'FLNO' || col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
|
||||
return 'text-right';
|
||||
}
|
||||
} else if (this.isLinked(flight)) {
|
||||
if (col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
|
||||
if (!flight['renderPreFlight'][col_CODE] && flight['renderReaFlight'][col_CODE]) {
|
||||
return 'text-right';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user