季度计划检测机制优化

This commit is contained in:
zhouyuejun
2018-12-25 14:04:41 +08:00
parent 0f9593b7fe
commit afa8646322
3 changed files with 272 additions and 337 deletions
+2 -1
View File
@@ -56,7 +56,7 @@ export class MainComponent implements OnInit {
this.airline_message_alert = JSON.parse(element.settingContent).targetList; this.airline_message_alert = JSON.parse(element.settingContent).targetList;
} }
}); });
this.changeDetectorRef.detectChanges(); // this.changeDetectorRef.detectChanges();
// this.operateSpinServiceService.hideSpin(); // this.operateSpinServiceService.hideSpin();
} }
) )
@@ -584,6 +584,7 @@ export class MainComponent implements OnInit {
this.render_data = filter_data; this.render_data = filter_data;
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.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
this.operateSpinServiceService.hideSpin();
} }
}, 10) }, 10)
} }
@@ -1,39 +1,39 @@
<div class="main-page" #mainPage> <div class="main-page" #mainPage>
<div class="page-content"> <div class="page-content">
<div class="search-filter mb-3" #searchFilter> <div class="search-filter mb-3" #searchFilter>
<div class="first-condition row"> <div class="first-condition row">
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10"> <div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id=""> <select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
<option value="">选择列名</option> <option value="">选择列名</option>
<option *ngFor="let col of col_lists" [value]="col.col_code">{{col.col_chn}}</option> <option *ngFor="let col of col_lists" [value]="col.col_code">{{col.col_chn}}</option>
</select> </select>
<label class="radio-inline custom-radio nowrap mr-4"> <label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position"> <input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
<span>过滤</span> <span>过滤</span>
</label> </label>
<label class="radio-inline custom-radio nowrap mr-4"> <label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position"> <input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
<span>查找定位</span> <span>查找定位</span>
</label> </label>
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputEnter()"> <input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter)="inputEnter()">
</div> </div>
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-2"> <div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-2">
<button type="button" class="btn btn-info mr-2" (click)="toggleFilter()">{{filterClose?'展开':'关闭'}}</button> <button type="button" class="btn btn-info mr-2" (click)="toggleFilter()">{{filterClose?'展开':'关闭'}}</button>
<button type="button" class="btn btn-info mr-2" (click)="refresh()">刷新</button> <button type="button" class="btn btn-info mr-2" (click)="refresh()">刷新</button>
</div> </div>
</div> </div>
<div class="second-condition mb-3 row" [ngClass]="{'filterClose-c':filterClose,'filterClose-o':!filterClose}"> <div class="second-condition mb-3 row" [ngClass]="{'filterClose-c':filterClose,'filterClose-o':!filterClose}">
<div class="input-container mr-4"> <div class="input-container mr-4">
<label for="airlineId">航空公司:&nbsp;&nbsp;</label> <label for="airlineId">航空公司:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.airlineId" (ngModelChange)="selectChange()"> <select class="form-control" [(ngModel)]="filterItems.airlineId" (ngModelChange)="selectChange()">
<option value=""></option> <option value=""></option>
<option *ngFor="let item of airlines" [value]="item.airlineId">{{item.airlineName}}</option> <option *ngFor="let item of airlines" [value]="item.airlineId">{{item.airlineName}}</option>
</select> </select>
</div> </div>
<div class="input-container mr-4"> <div class="input-container mr-4">
<label for="routeType">航线类别:&nbsp;&nbsp;</label> <label for="routeType">航线类别:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.routeType" (ngModelChange)="selectChange()"> <select class="form-control" [(ngModel)]="filterItems.routeType" (ngModelChange)="selectChange()">
<option value=""></option> <option value=""></option>
<option value="D">国内</option> <option value="D">国内</option>
<option value="I">国际</option> <option value="I">国际</option>
@@ -43,25 +43,31 @@
</div> </div>
<div class="input-container mr-4"> <div class="input-container mr-4">
<label for="flightTypeCode">航班类别:&nbsp;&nbsp;</label> <label for="flightTypeCode">航班类别:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.flightTypeCode" (ngModelChange)="selectChange()" > <select class="form-control" [(ngModel)]="filterItems.flightTypeCode" (ngModelChange)="selectChange()">
<option value=""></option> <option value=""></option>
<option *ngFor="let item of flightTypes" [value]="item.flightTypeCode">{{item.flightTypeNameCn}}</option> <option *ngFor="let item of flightTypes" [value]="item.flightTypeCode">{{item.flightTypeNameCn}}</option>
</select> </select>
</div> </div>
<div class="input-container mr-4"> <!-- <div class="input-container mr-4">
<label for="startDate">查询年份:&nbsp;&nbsp;</label> <label for="startDate">查询年份:&nbsp;&nbsp;</label>
<input readonly type="text" id="startDate" class="form-control" style="background:transparent;cursor: pointer"> <input readonly type="text" id="startDate" class="form-control" style="background:transparent;cursor: pointer">
</div> </div> -->
<div class="input-container mr-4"> <div class="input-container mr-4">
<label for="arriOrDept">到达/出发:&nbsp;&nbsp;</label> <label for="arriOrDept">到达/出发:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.arriOrDept" (ngModelChange)="selectChange()"> <select class="form-control" [(ngModel)]="filterItems.arriOrDept" (ngModelChange)="selectChange()">
<option value=""></option> <option value=""></option>
<option value="A">到达</option> <option value="A">到达</option>
<option value="D">出发</option> <option value="D">出发</option>
</select> </select>
</div> </div>
</div> <div class="input-container mr-4">
<div class="third-condition row" [ngClass]="{'filterClose-c':filterClose,'filterClose-o':!filterClose}"> <label for="arriOrDept">查询年份:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterYear" (ngModelChange)="selectYearChange($event)">
<option *ngFor="let year of yearLists" [value]="year">{{year}}</option>
</select>
</div>
</div>
<div class="third-condition row" [ngClass]="{'filterClose-c':filterClose,'filterClose-o':!filterClose}">
<label class="radio-inline custom-checkbox nowrap mr-4"> <label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox" [(ngModel)]="checkboxGroup.related" (ngModelChange)="checkboxChange()"> <input type="checkbox" [(ngModel)]="checkboxGroup.related" (ngModelChange)="checkboxChange()">
<span>航班关联信息</span> <span>航班关联信息</span>
@@ -70,58 +76,57 @@
<input type="checkbox" [(ngModel)]="checkboxGroup.detail" (ngModelChange)="checkboxChange()"> <input type="checkbox" [(ngModel)]="checkboxGroup.detail" (ngModelChange)="checkboxChange()">
<span>详细信息</span> <span>详细信息</span>
</label> </label>
</div> </div>
</div> </div>
<div class="airline-table"> <div class="airline-table">
<div #tableContainer id="table-container" class="table-container" [ngClass]="{'table-c': !tabClose,'table-o': tabClose}"> <div #tableContainer id="table-container" class="table-container" [ngClass]="{'table-c': !tabClose,'table-o': tabClose}">
<table id="table" class="table table-bordered table-striped"> <table id="table" class="table table-bordered table-striped">
<thead> <thead>
<tr> <tr>
<th>序号</th> <th>序号</th>
<th>航班号</th> <th>航班号</th>
<th>航班季度</th> <th>航班季度</th>
<th>国际代码</th> <th>国际代码</th>
<th>航空公司</th> <th>航空公司</th>
<th>航线类别</th> <th>航线类别</th>
<th>航班类别</th> <th>航班类别</th>
<!-- <th>航班任务</th> --> <!-- <th>航班任务</th> -->
<th>运营日</th> <th>运营日</th>
<th>开始日期</th> <th>开始日期</th>
<th>结束日期</th> <th>结束日期</th>
<th>航线</th> <th>航线</th>
<th>进/出港</th> <th>进/出港</th>
<th>到达时间</th> <th>到达时间</th>
<th>出发时间</th> <th>出发时间</th>
<th>机型</th> <th>机型</th>
<th>飞行距离(千米)</th> <th>飞行距离(千米)</th>
<th>飞行时间(分钟)</th> <th>飞行时间(分钟)</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let seasonal of render_data;let i = index" (click)="selectRow(seasonal)" <tr *ngFor="let seasonal of render_data;let i = index" (click)="selectRow(seasonal)" [ngClass]="{'selected':row_state.seasonflightId===seasonal.seasonflightId}">
[ngClass]="{'selected':row_state===seasonal}"> <td>{{i+1}}{{seasonal.seasonflightId}}</td>
<td>{{i+1}}</td> <td>{{seasonal.flightNumber}}</td>
<td>{{seasonal.flightNumber}}</td> <td>{{seasonal.seasonRecIdChn}}</td>
<td>{{seasonal.seasonRecId}}</td> <td>{{seasonal.internationalCode}}</td>
<td>{{seasonal.internationalCode}}</td> <td>{{seasonal.airlineChnName}}</td>
<td>{{seasonal.airlineChnName}}</td> <td>{{seasonal.routeTypeChn}}</td>
<td>{{seasonal.routeType}}</td> <td>{{seasonal.flightTypeChnName}}</td>
<td>{{seasonal.flightTypeNameCn}}</td> <!-- <td>{{seasonal.flightTask}}</td> -->
<!-- <td>{{seasonal.flightTask}}</td> --> <td>{{seasonal.operationDays}}</td>
<td>{{seasonal.operationDays}}</td> <td>{{seasonal.startDate}}</td>
<td>{{seasonal.startDate}}</td> <td>{{seasonal.endDate}}</td>
<td>{{seasonal.endDate}}</td> <td>{{seasonal.AirportChn}}</td>
<td>{{seasonal.startAirport}}</td> <td>{{seasonal.arriOrDeptChn}}</td>
<td>{{seasonal.arriOrDept}}</td> <td>{{seasonal.arrivalTimeTra}}</td>
<td>{{seasonal.arrivalTime}}</td> <td>{{seasonal.departureTimeTra}}</td>
<td>{{seasonal.departureTime}}</td> <td>{{seasonal.aircraftTypeName}}</td>
<td>{{seasonal.aircraftTypeName}}</td> <td>{{seasonal.flyingDistance}}</td>
<td>{{seasonal.flyingDistance}}</td> <td>{{seasonal.flyingTime}}</td>
<td>{{seasonal.flyingTime}}</td> </tr>
</tr> </tbody>
</tbody> </table>
</table>
</div> </div>
<div class="airline-message" [ngClass]="{'tab-c': tabClose,'tab-o': !tabClose}"> <div class="airline-message" [ngClass]="{'tab-c': tabClose,'tab-o': !tabClose}">
<nz-tabset [nzTabPosition]="'top'" [nzType]="'card'" [nzShowPagination]="false"> <nz-tabset [nzTabPosition]="'top'" [nzType]="'card'" [nzShowPagination]="false">
@@ -133,6 +138,6 @@
</nz-tab> </nz-tab>
</nz-tabset> </nz-tabset>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -1,16 +1,21 @@
import { Component, OnInit ,ViewChild,Renderer2 } from '@angular/core'; import { Component, OnInit, ViewChild, Renderer2, ChangeDetectorRef } from '@angular/core';
import { OperateSpinServiceService } from '../../services/operate-spin-service.service';
import { HttpClientService } from '../../services/http-client.service'; import { HttpClientService } from '../../services/http-client.service';
import { BasicDataService } from '../../services/basic-data-service'; import { BasicDataService } from '../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import { ToastService } from '../../components/toast/toast.service'; import { ToastService } from '../../components/toast/toast.service';
import { ToastConfig, ToastType } from '../../components/toast/toast-model'; import { ToastConfig, ToastType } from '../../components/toast/toast-model';
import * as $ from 'jquery'; import * as $ from 'jquery';
import { format } from 'util'; import { format } from 'util';
declare var laydate: any; declare var laydate: any;
@Component({ @Component({
selector: 'app-seasonal-plan', selector: 'app-seasonal-plan',
templateUrl: './seasonal-plan.component.html', templateUrl: './seasonal-plan.component.html',
styleUrls: ['./seasonal-plan.component.scss'] styleUrls: ['./seasonal-plan.component.scss']
}) })
export class SeasonalPlanComponent implements OnInit { export class SeasonalPlanComponent implements OnInit {
@@ -18,9 +23,13 @@ export class SeasonalPlanComponent implements OnInit {
private renderer2: Renderer2, private renderer2: Renderer2,
private httpCilent: HttpClientService, private httpCilent: HttpClientService,
private basicDataService: BasicDataService, private basicDataService: BasicDataService,
private operateSpinServiceService: OperateSpinServiceService,
private toastService: ToastService, private toastService: ToastService,
private changeDetectorRef: ChangeDetectorRef private changeDetectorRef: ChangeDetectorRef
) { } ) {
this.operateSpinServiceService.showSpin();
this.changeDetectorRef.detach();
}
//勾选复选框 //勾选复选框
public checkboxGroup = { public checkboxGroup = {
@@ -31,19 +40,19 @@ export class SeasonalPlanComponent implements OnInit {
//选择列名 //选择列名
public col_lists = [ public col_lists = [
{ col_code: 'flightNumber', col_chn: '航班号' }, { col_code: 'flightNumber', col_chn: '航班号' },
{ col_code: 'seasonRecId', col_chn: '航班季度' }, { col_code: 'seasonRecIdChn', col_chn: '航班季度' },
{ col_code: 'internationalCode', col_chn: '国际代码' }, { col_code: 'internationalCode', col_chn: '国际代码' },
{ col_code: 'airlineChnName', col_chn: '航空公司' }, { col_code: 'airlineChnName', col_chn: '航空公司' },
{ col_code: 'routeType', col_chn: '航线类别' }, { col_code: 'routeTypeChn', col_chn: '航线类别' },
{ col_code: 'flightTypeNameCn', col_chn: '航班类别' }, { col_code: 'flightTypeChnName', col_chn: '航班类别' },
/* { col_code: 'flightTask', col_chn: '航班任务' }, */ /* { col_code: 'flightTask', col_chn: '航班任务' }, */
{ col_code: 'operationDays', col_chn: '运营日' }, { col_code: 'operationDays', col_chn: '运营日' },
{ col_code: 'startDate', col_chn: '开始日期' }, { col_code: 'startDate', col_chn: '开始日期' },
{ col_code: 'endDate', col_chn: '结束日期' }, { col_code: 'endDate', col_chn: '结束日期' },
{ col_code: 'startAirport', col_chn: '航线' }, { col_code: 'AirportChn', col_chn: '航线' },
{ col_code: 'arriOrDept', col_chn: '进/出港' }, { col_code: 'arriOrDeptChn', col_chn: '进/出港' },
{ col_code: 'arrivalTime', col_chn: '到达时间' }, { col_code: 'arrivalTimeTra', col_chn: '到达时间' },
{ col_code: 'departureTime', col_chn: '出发时间' }, { col_code: 'departureTimeTra', col_chn: '出发时间' },
{ col_code: 'aircraftTypeName', col_chn: '机型' }, { col_code: 'aircraftTypeName', col_chn: '机型' },
{ col_code: 'flyingDistance', col_chn: '飞行距离(千米)' }, { col_code: 'flyingDistance', col_chn: '飞行距离(千米)' },
{ col_code: 'flyingTime', col_chn: '飞行时间(分钟)' }, { col_code: 'flyingTime', col_chn: '飞行时间(分钟)' },
@@ -63,208 +72,168 @@ export class SeasonalPlanComponent implements OnInit {
} }
public tabClose: boolean = true; public tabClose: boolean = true;
seasonals : Array<any>; yearLists: Array<any>;
airlines : Array<any>; //航空公司 filterYear: string = '';
aircraftTypes : Array<any>; //机型 yearOldValue: string = '';
flightTypes : Array<any>; //航班类别
public row_state: any = { renderFlight: {} }; seasonals: Array<any>; //季度计划
airlines: Array<any>; //航空公司
aircraftTypes: Array<any>; //机型
flightTypes: Array<any>; //航班类别
public row_state: any = {};
public combined_data: Array<object> = []; //组合数据,经过转换后的
public render_data: Array<object> = []; //显示数据,即需要显示的数据 public render_data: Array<object> = []; //显示数据,即需要显示的数据
public return_data: Array<object> = []; //下拉框显示数据 public return_data: Array<object> = []; //下拉框显示数据
@ViewChild('mainPage') mainPage; @ViewChild('mainPage') mainPage;
@ViewChild('searchFilter') searchFilter; @ViewChild('searchFilter') searchFilter;
@ViewChild('tableContainer') tableContainer; @ViewChild('tableContainer') tableContainer;
ngOnInit() { ngOnInit() {
//选择年份
this.laydateYear();
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px'); this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px');
window.onresize = function () { window.onresize = function () {
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px'); this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px');
}.bind(this) }.bind(this)
/* 获取季度计划信息 */
var value = new Date(new Date().getTime());
var subValue = format(value).substring(11,15); //时间截取到年份 this.httpCilent.get('/adminapi/schedule/flightSchdSeason/years').toPromise().then(
this.httpCilent.get('/adminapi/schedule/flightSchdSeasons',{startDate: subValue}).subscribe( years => {
data => { this.yearLists = years.body;
this.seasonals = data.body; this.filterYear = this.yearLists[0];
this.render_data = this.seasonals; this.httpCilent.get('/adminapi/schedule/flightSchdSeasons', { startDate: this.yearLists[0] }).subscribe(
this.airlinesHandle(); //航空公司 data => {
this.aircraftTypesHandle(); //机型 this.seasonals = data.body;
this.flightTypesHandle(); //航班类别 // this.render_data = this.seasonals;
this.render_data.forEach(element => {//航线类别列表显示数据转换
if (element['routeType'] == 'D') { this.aircraftTypes = this.basicDataService.aircraft_type;
element['routeType'] = '国内' this.flightTypes = this.basicDataService.flightTypes;
return element['routeType']; this.airlines = this.basicDataService.airline;
if (this.airlines && this.airlines.length > 0) {
this.dataTransfer();
} else {
this.basicDataService.aircraft_type_subject.subscribe(
data => {
this.aircraftTypes = data;
}
);
this.basicDataService.flightTypes_subject.subscribe(
data => {
this.flightTypes = data;
}
);
this.basicDataService.airline_subject.subscribe(
data => {
this.airlines = data;
this.dataTransfer();
}
)
}
} }
if(element['routeType'] == 'I'){ )
element['routeType'] = '国际'
return element['routeType'];
}
if(element['routeType'] == 'M'){
element['routeType'] = '混合'
return element['routeType'];
}
if(element['routeType'] = 'R'){
element['routeType'] = '地区'
return element['routeType'];
}
});
this.render_data.forEach(item => {//到达/出发列表显示数据转换
if(item['arriOrDept'] == 'A'){
item['arriOrDept'] = '到达'
return item['arriOrDept']
}
if(item['arriOrDept'] == 'D'){
item['arriOrDept'] = '出发'
return item['arriOrDept']
}
});
} }
) ).catch(err => {
//航空公司 alert('请求失败')
this.airlines = this.basicDataService.airline; })
this.basicDataService.airline_subject.subscribe(
data=>{
this.airlines = data;
if(this.airlines && this.airlines.length > 0){//航空公司列表数据转换
this.airlinesHandle();
}
}
)
//机型
this.aircraftTypes = this.basicDataService.aircraft_type;
this.basicDataService.aircraft_type_subject.subscribe(
data => {
this.aircraftTypes = data;
if(this.aircraftTypes && this.aircraftTypes.length > 0){//机型列表数据转换
this.aircraftTypesHandle();
}
}
)
//航班类别
this.flightTypes = this.basicDataService.flightTypes;
this.basicDataService.flightTypes_subject.subscribe(
data=> {
this.flightTypes = data;
if(this.flightTypes && this.flightTypes.length > 0){//航班类别列表数据转换
this.flightTypesHandle();
}
}
)
/**
* 固定表头
*/
var tableCont = document.querySelector('#table-container'); var tableCont = document.querySelector('#table-container');
function scrollHandle (){ function scrollHandle() {
var scrollTop = this.scrollTop; var scrollTop = this.scrollTop;
this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
} }
tableCont.addEventListener('scroll',scrollHandle); tableCont.addEventListener('scroll', scrollHandle);
} }
//航空公司名称数据转换处理 //航空公司名称数据转换处理
airlinesHandle() { airlinesHandle(item) {
this.render_data.forEach(item => { let airlineLinkIndex = this.airlines.findIndex(val => val.airlineId === item['airlineId']);
let airlineLinkIndex = this.airlines.findIndex(val => val.airlineId === item['airlineId']); if (airlineLinkIndex > -1) {
if(this.airlines[airlineLinkIndex]){ item['airlineChnName'] = this.airlines[airlineLinkIndex].airlineName;
item['airlineChnName'] = this.airlines[airlineLinkIndex].airlineName; }
} return item;
})
} }
//机型数据转换处理 //机型数据转换处理
aircraftTypesHandle() { aircraftTypesHandle(item) {
this.render_data.forEach(item => { let aircraftTypesLinkIndex = this.aircraftTypes.findIndex(val => val.aircraftTypeCode === item['aircraftTypeCode']);
let aircraftTypesLinkIndex = this.aircraftTypes.findIndex(val => val.aircraftTypeCode === item['aircraftTypeCode']); if (aircraftTypesLinkIndex > -1) {
if(this.aircraftTypes[aircraftTypesLinkIndex]){ item['aircraftTypeName'] = this.aircraftTypes[aircraftTypesLinkIndex].aircraftTypeName;
item['aircraftTypeName'] = this.aircraftTypes[aircraftTypesLinkIndex].aircraftTypeName; }
} return item;
})
} }
//航班类别数据转换处理 //航班类别数据转换处理
flightTypesHandle() { flightTypesHandle(item) {
this.render_data.forEach(item => { let flightTypesLinkIndex = this.flightTypes.findIndex(val => val.flightTypeCode === item['flightTypeCode']);
let flightTypesLinkIndex = this.flightTypes.findIndex(val => val.flightTypeCode === item['flightTypeCode']); if (flightTypesLinkIndex > -1) {
if(this.flightTypes[flightTypesLinkIndex]){ item['flightTypeChnName'] = this.flightTypes[flightTypesLinkIndex].flightTypeNameCn;
item['flightTypeNameCn'] = this.flightTypes[flightTypesLinkIndex].flightTypeNameCn; }
} return item;
})
} }
//选择年份 //进/出港数据转换处理
laydateYear(){ arriOrDeptHandle(item) {
laydate.render({ if (item['arriOrDept'] === 'A') {
elem: '#startDate', item['arriOrDeptChn'] = '到达'
showBottom: true, } else if (item['arriOrDept'] === 'D') {
value: new Date(new Date().getTime()), item['arriOrDeptChn'] = '出发'
type: 'year', }
// format: 'yyyy', return item;
done: (value) => { }
this.httpCilent.get('/adminapi/schedule/flightSchdSeasons', { startDate: value }).subscribe(
data => { //航线类别数据转换处理
this.seasonals = data.body; routeTypeHandle(item) {
this.render_data = this.seasonals; if (item['routeType'] === 'D') {
if(this.airlines && this.airlines.length > 0){//航空公司列表数据转换 item['routeTypeChn'] = '国内';
this.airlinesHandle(); } else if (item['routeType'] === 'I') {
} item['routeTypeChn'] = '国际';
if(this.aircraftTypes && this.aircraftTypes.length > 0){//机型列表数据转换 } else if (item['routeType'] === 'M') {
this.aircraftTypesHandle(); item['routeTypeChn'] = '混合';
} } else if (item['routeType'] === 'R') {
if(this.flightTypes && this.flightTypes.length > 0){//航班类别列表数据转换 item['routeTypeChn'] = '地区';
this.flightTypesHandle(); } else {
} item['routeTypeChn'] = '其他';
this.render_data.forEach(element => {//航线类别列表显示数据转换 }
if (element['routeType'] == 'D') { return item;
element['routeType'] = '国内' }
return element['routeType'];
} //数据转换统一处理
if(element['routeType'] == 'I'){ dataTransfer() {
element['routeType'] = '国际' this.seasonals.forEach(item => {
return element['routeType']; let line = Object.assign({}, item);
} line = this.airlinesHandle(line);
if(element['routeType'] == 'M'){ line = this.aircraftTypesHandle(line);
element['routeType'] = '混合' line = this.flightTypesHandle(line);
return element['routeType']; line = this.arriOrDeptHandle(line);
} line = this.routeTypeHandle(line);
if(element['routeType'] = 'R'){ this.combined_data.push(line);
element['routeType'] = '地区' })
return element['routeType']; this.render_data = this.combined_data;
} this.changeDetectorRef.detectChanges();
}); this.operateSpinServiceService.hideSpin();
this.render_data.forEach(item => {//到达/出发列表显示数据转换 }
if(item['arriOrDept'] == 'A'){
item['arriOrDept'] = '到达'
return item['arriOrDept'] selectYearChange($event) {
} this.operateSpinServiceService.showSpin();
if(item['arriOrDept'] == 'D'){ this.SEARCH = '';
item['arriOrDept'] = '出发' this.FLT_POS = 1;
return item['arriOrDept'] this.SEL_COL = '';
}
}); this.filterItems = {
}) airlineId: '',
//航空公司 routeType: '',
this.airlines = this.basicDataService.airline; flightTypeCode: '',
this.basicDataService.airline_subject.subscribe( arriOrDept: '',
data=>{ }
this.airlines = data; this.httpCilent.get('/adminapi/schedule/flightSchdSeasons', { startDate: $event }).subscribe(
} data => {
) this.seasonals = data.body;
//机型 this.combined_data = [];
this.aircraftTypes = this.basicDataService.aircraft_type; this.dataTransfer();
this.basicDataService.aircraft_type_subject.subscribe(
data => {
this.aircraftTypes = data;
}
)
//航班类别
this.flightTypes = this.basicDataService.flightTypes;
this.basicDataService.flightTypes_subject.subscribe(
data=> {
this.flightTypes = data;
}
)
} }
}); )
} }
public filterClose: boolean = true; public filterClose: boolean = true;
@@ -289,29 +258,30 @@ export class SeasonalPlanComponent implements OnInit {
} }
} }
} }
this.changeDetectorRef.detectChanges();
} }
/** /**
* tab项切换事件 * tab项切换事件
*/ */
nzClick() { nzClick() {
this.changeDetectorRef.detectChanges();
} }
/** /**
* 刷新 * 刷新
*/ */
refresh() { refresh() {
const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '刷新成功!', 3000); this.selectYearChange(this.filterYear);
this.toastService.toast(toastCfg);
} }
/** /**
* 选中某行 * 选中某行
* @param i * @param seasonal
*/ */
selectRow(i) { selectRow(seasonal) {
this.row_state = i; this.row_state = seasonal;
this.changeDetectorRef.detectChanges();
} }
//输入框回车事件 //输入框回车事件
@@ -325,75 +295,32 @@ export class SeasonalPlanComponent implements OnInit {
//下拉框选择筛选 //下拉框选择筛选
selectChange() { selectChange() {
this.return_data = this.seasonals.filter(item=>{ this.operateSpinServiceService.showSpin();
let is_satis = true; setTimeout(() => {
if(item['routeType'] == '国内'){ let filter_data = this.combined_data.filter(item => {
item['routeType'] = 'D' let is_satis = true;
} for (const key in this.filterItems) {
if(item['routeType'] == '国际'){ if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
item['routeType'] = 'I' if (item[key] === this.filterItems[key]) {
} is_satis = true;
if(item['routeType'] == '混合'){ continue;
item['routeType'] = 'M' } else {
} is_satis = false;
if(item['routeType'] == '地区'){ break;
item['routeType'] = 'R' }
}
//到达/出发
if(item['arriOrDept'] == '到达'){
item['arriOrDept'] = 'A'
}
if(item['arriOrDept'] == '出发'){
item['arriOrDept'] = 'D'
}
for (const key in this.filterItems) {
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
if (item[key] == this.filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
} }
} }
return is_satis;
})
this.render_data = filter_data;
if (this.FLT_POS === 1) {
this.inputFilter(this.render_data);
} else {
this.row_state = this.render_data.length > 0 ? this.render_data[0] : {};
this.changeDetectorRef.detectChanges();
this.operateSpinServiceService.hideSpin();
} }
return is_satis; }, 10)
})
this.return_data.forEach(element => {//航线类别列表显示数据转换
if (element['routeType'] == 'D') {
element['routeType'] = '国内'
return element['routeType'];
}
if(element['routeType'] == 'I'){
element['routeType'] = '国际'
return element['routeType'];
}
if(element['routeType'] == 'M'){
element['routeType'] = '混合'
return element['routeType'];
}
if(element['routeType'] == 'R'){
element['routeType'] = '地区'
return element['routeType'];
}
});
this.return_data.forEach(item => {//到达/出发列表显示数据转换
if(item['arriOrDept'] == 'A'){
item['arriOrDept'] = '到达'
return item['arriOrDept']
}
if(item['arriOrDept'] == 'D'){
item['arriOrDept'] = '出发'
return item['arriOrDept']
}
});
this.render_data = this.return_data;
if (this.FLT_POS === 1) {
this.inputFilter(this.render_data);
} else {
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
}
} }
//输入框筛选 //输入框筛选
@@ -431,9 +358,11 @@ export class SeasonalPlanComponent implements OnInit {
return is_satis; return is_satis;
}) })
} }
} else {
this.render_data = filterData;
} }
// this.render_data = filterData;
this.changeDetectorRef.detectChanges();
this.operateSpinServiceService.hideSpin();
} }
positionArray: Array<any> = []; positionArray: Array<any> = [];