Merge branch 'develop-3'

This commit is contained in:
zhouyuejun
2018-12-03 11:30:45 +08:00
38 changed files with 2977 additions and 985 deletions
@@ -1,3 +1,172 @@
<p>
seasonal-plan works!
</p>
<div class="main-page">
<div class="page-content">
<div class="search-filter mb-3">
<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">
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
<option value="">选择列名</option>
<option value="flightNumber">航班号</option>
<option value="seasonRecId">航班季度</option>
<option value="internationalCode">国际代码</option>
<option value="airlineChnName">航空公司</option>
<option value="routeType">航线类别</option>
<option value="flightTypeCode">航班类别</option>
<option value="flightTask">航班任务</option>
<option value="operationDays">运营日</option>
<option value="startDate">开始日期</option>
<option value="endDate">结束日期</option>
<option value="startAirport">航线</option>
<option value="arriOrDept">进/出港</option>
<option value="arrivalTime">到达时间</option>
<option value="departureTime">出发时间</option>
<option value="aircraftTypeCode">机型</option>
<option value="flyingDistance">飞行距离(千米)</option>
<option value="flyingTime">飞行时间(分钟)</option>
<!-- <option *ngFor="let seasonal of seasonal_lists" [value]="seasonal.COL_CODE">{{seasonal.COL_CN}}</option> -->
</select>
<label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
<span>过滤</span>
</label>
<label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
<span>查找定位</span>
</label>
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputEnter()">
</div>
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
<!-- <button type="button" class="btn btn-info mr-3">打印</button>
<button type="button" class="btn btn-info mr-3">航班季度</button>
<button type="button" class="btn btn-info mr-3">季度计划发布</button>
<button type="button" class="btn btn-info mr-3">刷新数据</button>
<button type="button" class="btn btn-info mr-3">季度计划维护</button> -->
<button type="button" class="btn btn-info mr-3" (click)="refresh()">刷新</button>
</div>
</div>
<div class="second-condition mb-3 row">
<div class="input-container mr-4">
<label for="airlineId">航空公司:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.airlineId" (ngModelChange)="selectChange()">
<option value=""></option>
<option *ngFor="let item of airlines" [value]="item.airlineId">{{item.airlineName}}</option>
</select>
</div>
<div class="input-container mr-4">
<label for="routeType">航线类别:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.routeType" (ngModelChange)="selectChange()">
<option value=""></option>
<option value="D">国内</option>
<option value="I">国际</option>
<option value="M">混合</option>
<option value="R">地区</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.routeType">{{item.routeType}}</option> -->
</select>
</div>
<div class="input-container mr-4">
<label for="flightTypeCode">航班类别:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.flightTypeCode" (ngModelChange)="selectChange()" >
<option value=""></option>
<option value="P">客机</option>
<option value="F">货机</option>
<option value="B">专机</option>
<option value="O">公务机</option>
<option value="M">军机</option>
<option value="X">其他</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.flightTypeCode">{{item.flightTypeCode}}</option> -->
</select>
</div>
<div class="input-container mr-4">
<label for="arriOrDept">到达/出发:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.arriOrDept" (ngModelChange)="selectChange()">
<option value=""></option>
<option value="A">到达</option>
<option value="D">出发</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.arriOrDept">{{item.arriOrDept}}</option> -->
</select>
</div>
<div class="input-container mr-4">
<label for="flightTask">航班任务:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.flightTask" (ngModelChange)="selectChange()">
<option value=""></option>
<option value="S">正班</option>
<option value="N">包机</option>
<option value="E">急救</option>
<option value="B">专机</option>
<option value="G">通用</option>
<option value="J">加班</option>
<option value="M">军用</option>
<option value="Q">补班</option>
<option value="X">其他</option>
<option value="A">计划外</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.flightTask">{{item.flightTask}}</option> -->
</select>
</div>
</div>
<div class="third-condition row">
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox">
<span>航班关联信息</span>
</label>
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox">
<span>详细信息</span>
</label>
</div>
</div>
<div class="airline-table">
<div id="table-container" class="table-container">
<table id="table" class="table table-bordered table-striped">
<thead>
<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 *ngFor="let seasonal of seasonal_lists">{{seasonal.COL_CN}}</th> -->
</tr>
</thead>
<tbody>
<tr *ngFor="let seasonal of render_data;let i = index" (click)="selectRow(seasonal)"
[ngClass]="{'selected':row_state===seasonal}">
<td>{{i+1}}</td>
<td>{{seasonal.flightNumber}}</td>
<td>{{seasonal.seasonRecId}}</td>
<td>{{seasonal.internationalCode}}</td>
<td>{{seasonal.airlineChnName}}</td>
<td>{{seasonal.routeType}}</td>
<td>{{seasonal.flightTypeCode}}</td>
<td>{{seasonal.flightTask}}</td>
<td>{{seasonal.operationDays}}</td>
<td>{{seasonal.startDate}}</td>
<td>{{seasonal.endDate}}</td>
<td>{{seasonal.startAirport}}</td>
<td>{{seasonal.arriOrDept}}</td>
<td>{{seasonal.arrivalTime}}</td>
<td>{{seasonal.departureTime}}</td>
<td>{{seasonal.aircraftTypeCode}}</td>
<td>{{seasonal.flyingDistance}}</td>
<td>{{seasonal.flyingTime}}</td>
<!-- <td *ngFor="let seasonal of seasonal_lists" [ngStyle]="{'background-color':getColor(seasonal.COL_CODE)}">{{airline_row['renderFlight'][seasonal.COL_CODE]}}</td> -->
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -0,0 +1,68 @@
.main-page {
width: 100%;
height: 100%;
overflow-y: scroll;
padding: 15px 10px;
background-color: #fff;
.page-content {
border: 1px solid #ccc;
padding: 10px 20px;
.search-filter {
padding: 0 15px;
.first-condition {
.line-operator-right {
text-align: right;
padding: 0;
.btn-info {
background-color: rgb(122, 156, 204);
border-color: rgb(122, 156, 204);
}
}
}
.input-container {
padding: 0;
> .form-control {
width: 180px;
display: inline-block;
}
}
}
.airline-table{
.table-container{
// border: 1px solid #ccc;
width: 100%;
height: 700px;
overflow: auto;
box-shadow: 0 0 1px .5px #ddd;
table{
width: max-content;
tr{
cursor: pointer;
&.selected{
background: rgb(181, 215, 255);
}
}
th{
background-color: #ddd;
}
th,td{
// border: none;
text-align: center;
}
}
}
}
}
}
@media screen and (max-width: 991px) {
.line-operator-right {
text-align: left !important;
}
}
// @media screen and (min-width: 1200px){
// .line-operator-right{
// text-align: left;
// }
// }
@@ -1,5 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { HttpClientService } from '../../services/http-client.service';
import { HttpParams } from '@angular/common/http';
import * as $ from 'jquery';
import { BasicDataService } from '../basic-data-service'
@Component({
selector: 'app-seasonal-plan',
templateUrl: './seasonal-plan.component.html',
@@ -7,9 +10,487 @@ import { Component, OnInit } from '@angular/core';
})
export class SeasonalPlanComponent implements OnInit {
constructor() { }
constructor(
private httpCilent: HttpClientService,
private basicDataService: BasicDataService
) { }
ngOnInit() {
}
// 搜索条件
SEARCH = ''; //手动输入条件
FLT_POS = 1; //过滤还是定位
SEL_COL = ''; //选择列名
public filterItems = {
airlineId: '', //航空公司
routeType: '', //航线类别
flightTypeCode: '', //航班类别
arriOrDept: '', //到达/出发
flightTask: '', //航班任务
}
seasonals : Array<any>;
airlines : Array<any>; //航空公司
public row_state: any = { renderFlight: {} };
public render_data: Array<object> = []; //显示数据,即需要显示的数据
public return_data: Array<object> = []; //下拉框显示数据
ngOnInit() {
/* 获取季度计划信息 */
this.httpCilent.get('/adminapi/schedule/flightSchdSeasons').subscribe(
data => {
this.seasonals = data.body;
this.render_data = this.seasonals;
if(this.airlines && this.airlines.length > 0){//航空公司列表数据转换
this.basicDataTransHandle();
}
this.render_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.render_data.forEach(item => {//到达/出发列表显示数据转换
if(item['arriOrDept'] == 'A'){
item['arriOrDept'] = '到达'
return item['arriOrDept']
}
if(item['arriOrDept'] == 'D'){
item['arriOrDept'] = '出发'
return item['arriOrDept']
}
});
this.render_data.forEach(item => {//航班类别列表显示数据转换
if(item['flightTypeCode'] == 'P'){
item['flightTypeCode'] = '客机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'F'){
item['flightTypeCode'] = '货机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'B'){
item['flightTypeCode'] = '专机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'O'){
item['flightTypeCode'] = '公务机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'M'){
item['flightTypeCode'] = '军机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'X'){
item['flightTypeCode'] = '其他'
return item['flightTypeCode']
}
});
this.render_data.forEach(item => {//航班任务列表显示数据转换
if(item['flightTask'] == 'S'){
item['flightTask'] = '正班'
return item['flightTask']
}
if(item['flightTask'] == 'N'){
item['flightTask'] = '包机'
return item['flightTask']
}
if(item['flightTask'] == 'E'){
item['flightTask'] = '急救'
return item['flightTask']
}
if(item['flightTask'] == 'B'){
item['flightTask'] = '专机'
return item['flightTask']
}
if(item['flightTask'] == 'G'){
item['flightTask'] = '通用'
return item['flightTask']
}
if(item['flightTask'] == 'J'){
item['flightTask'] = '加班'
return item['flightTask']
}
if(item['flightTask'] == 'M'){
item['flightTask'] = '军用'
return item['flightTask']
}
if(item['flightTask'] == 'Q'){
item['flightTask'] = '补班'
return item['flightTask']
}
if(item['flightTask'] == 'X'){
item['flightTask'] = '其他'
return item['flightTask']
}
if(item['flightTask'] == 'A'){
item['flightTask'] = '计划外'
return item['flightTask']
}
});
}
)
//航空公司
this.airlines = this.basicDataService.airline;
this.basicDataService.airline_subject.subscribe(
data=>{
this.airlines = data;
}
)
/**
* 固定表头
*/
var tableCont = document.querySelector('#table-container');
function scrollHandle (){
var scrollTop = this.scrollTop;
this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
}
tableCont.addEventListener('scroll',scrollHandle);
}
//航空公司名称数据转换处理
basicDataTransHandle() {
this.render_data.forEach(item => {
let airlineLinkIndex = this.airlines.findIndex(val => val.airlineId === item['airlineId']);
item['airlineChnName'] = this.airlines[airlineLinkIndex].airlineName;
})
}
/**
* 刷新
*/
refresh() {
this.render_data.reverse();
}
/**
* 选中某行
* @param i
*/
selectRow(i) {
this.row_state = i;
}
//输入框回车事件
inputEnter() {
if (this.FLT_POS === 1) {
this.inputFilter(this.seasonals)
} else {
this.inputFilter(this.seasonals)
this.inputPosition(this.seasonals)
}
}
//下拉框选择筛选
selectChange() {
this.return_data = this.seasonals.filter(item=>{
let is_satis = true;
if(item['routeType'] == '国内'){
item['routeType'] = 'D'
}
if(item['routeType'] == '国际'){
item['routeType'] = 'I'
}
if(item['routeType'] == '混合'){
item['routeType'] = 'M'
}
if(item['routeType'] == '地区'){
item['routeType'] = 'R'
}
//到达/出发
if(item['arriOrDept'] == '到达'){
item['arriOrDept'] = 'A'
}
if(item['arriOrDept'] == '出发'){
item['arriOrDept'] = 'D'
}
//航班类别
if(item['flightTypeCode'] == '客机'){
item['flightTypeCode'] = 'P'
}
if(item['flightTypeCode'] == '货机'){
item['flightTypeCode'] = 'F'
}
if(item['flightTypeCode'] == '专机'){
item['flightTypeCode'] = 'B'
}
if(item['flightTypeCode'] == '公务机'){
item['flightTypeCode'] = 'O'
}
if(item['flightTypeCode'] == '军机'){
item['flightTypeCode'] = 'M'
}
if(item['flightTypeCode'] == '其他'){
item['flightTypeCode'] = 'X'
}
//航班任务
if(item['flightTask'] == '正班'){
item['flightTask'] = 'S'
}
if(item['flightTask'] == '包机'){
item['flightTask'] = 'N'
}
if(item['flightTask'] == '急救'){
item['flightTask'] = 'E'
}
if(item['flightTask'] == '专机'){
item['flightTask'] = 'B'
}
if(item['flightTask'] == '通用'){
item['flightTask'] = 'G'
}
if(item['flightTask'] == '加班'){
item['flightTask'] = 'J'
}
if(item['flightTask'] == '军用'){
item['flightTask'] = 'M'
}
if(item['flightTask'] == '补班'){
item['flightTask'] = 'Q'
}
if(item['flightTask'] == '其他'){
item['flightTask'] = 'X'
}
if(item['flightTask'] == '计划外'){
item['flightTask'] = 'A'
}
for (const key in this.filterItems) {
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
if (item[key] === +this.filterItems[key] || item[key] === this.filterItems[key]) {
is_satis = true;
continue;
}else {
is_satis = false;
break;
}
}
}
return is_satis;
})
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.return_data.forEach(item => {//航班类别列表显示数据转换
if(item['flightTypeCode'] == 'P'){
item['flightTypeCode'] = '客机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'F'){
item['flightTypeCode'] = '货机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'B'){
item['flightTypeCode'] = '专机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'O'){
item['flightTypeCode'] = '公务机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'M'){
item['flightTypeCode'] = '军机'
return item['flightTypeCode']
}
if(item['flightTypeCode'] == 'X'){
item['flightTypeCode'] = '其他'
return item['flightTypeCode']
}
});
this.return_data.forEach(item => {//航班任务列表显示数据转换
if(item['flightTask'] == 'S'){
item['flightTask'] = '正班'
return item['flightTask']
}
if(item['flightTask'] == 'N'){
item['flightTask'] = '包机'
return item['flightTask']
}
if(item['flightTask'] == 'E'){
item['flightTask'] = '急救'
return item['flightTask']
}
if(item['flightTask'] == 'B'){
item['flightTask'] = '专机'
return item['flightTask']
}
if(item['flightTask'] == 'G'){
item['flightTask'] = '通用'
return item['flightTask']
}
if(item['flightTask'] == 'J'){
item['flightTask'] = '加班'
return item['flightTask']
}
if(item['flightTask'] == 'M'){
item['flightTask'] = '军用'
return item['flightTask']
}
if(item['flightTask'] == 'Q'){
item['flightTask'] = '补班'
return item['flightTask']
}
if(item['flightTask'] == 'X'){
item['flightTask'] = '其他'
return item['flightTask']
}
if(item['flightTask'] == 'A'){
item['flightTask'] = '计划外'
return item['flightTask']
}
});
this.render_data = this.return_data;
}
//输入框筛选
inputFilter(filterData) {
if (this.SEARCH) {
if (this.SEL_COL) {
let sel_col = this.SEL_COL;
filterData = filterData.filter(item => {
if (item[sel_col]) {
if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
return true;
}
} else {
if (this.SEARCH) {
return false;
} else {
return true;
}
}
})
} else {
filterData = filterData.filter(item => {
let is_satis = false;
for (const key in item) {
if (item.hasOwnProperty(key)) {
if (item[key]) {
if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) {
is_satis = true;
break;
} else {
is_satis = false;
continue;
}
} else {
if (this.SEARCH) {
is_satis = false;
continue;
} else {
is_satis = true;
break;
}
}
} else {
continue;
}
}
return is_satis;
})
}
}
this.render_data = filterData;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
}
positionArray: Array<any> = [];
positionArrayIndex: number = 0;
//输入框定位
inputPosition(filterData) {
let transArray = []
if (this.SEL_COL) {
let sel_col = this.SEL_COL;
filterData.forEach(element => {
if (element[sel_col]) {
if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
transArray.push(element)
}
} else {
if (!this.SEARCH) {
transArray.push(element)
}
}
});
} else {
filterData.forEach(element => {
for (const key in element) {
if (element.hasOwnProperty(key)) {
if (element[key]) {
if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) {
transArray.push(element)
break;
} else {
continue;
}
} else {
if (this.SEARCH) {
continue;
} else {
transArray.push(element)
break;
}
}
} else {
continue;
}
}
});
}
if (transArray.length > 0) {
if (transArray.toString() == this.positionArray.toString()) {
this.positionArrayIndex++;
if (this.positionArrayIndex === this.positionArray.length) {
this.positionArrayIndex = 0;
}
this.row_state = this.positionArray[this.positionArrayIndex];
} else {
this.positionArray = transArray;
this.positionArrayIndex = 0;
this.row_state = this.positionArray[this.positionArrayIndex];
}
} else {
alert('没有搜索到相关数据');
}
let tr = $(".selected");
let objTr = tr[0];
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
}
}
@@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SeasonalPlanComponent } from './seasonal-plan.component';
import { SeasonalPlanRouting } from './seasonal-plan-routing.module'
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
CommonModule,
SeasonalPlanRouting
SeasonalPlanRouting,
FormsModule
],
declarations: [SeasonalPlanComponent]
})