增加季度计划
This commit is contained in:
@@ -1,3 +1,106 @@
|
||||
<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" name="" id="">
|
||||
<option value="">选择列名</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">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航空公司: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.HZ" (ngModelChange)="selectChange()">
|
||||
<option value=""></option>
|
||||
<option value="GH">国内区域</option>
|
||||
<option value="CH">国际区域</option>
|
||||
<option value="QT">其他区域</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航线类别: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.ZY" (ngModelChange)="selectChange()">
|
||||
<option value=""></option>
|
||||
<option value="K">可用</option>
|
||||
<option value="R">不可用</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航班类别: </label>
|
||||
<select class="form-control" (ngModelChange)="selectChange()">
|
||||
<option value=""></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">到达/出发: </label>
|
||||
<select class="form-control" (ngModelChange)="selectChange()">
|
||||
<option value=""></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航班任务: </label>
|
||||
<select class="form-control" (ngModelChange)="selectChange()">
|
||||
<option value=""></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 *ngFor="let airline_col of seasonal_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(airline_row)"
|
||||
[ngClass]="{'selected':row_state['renderFlight']===airline_row['renderFlight']}">
|
||||
<td>{{i+1}}</td>
|
||||
<!-- <td>{{airline_col.gateCode}}</td>
|
||||
<td>{{airline_col.gateName}}</td>
|
||||
<td>{{airline_col.terminalAreaCode}}</td>
|
||||
<td>{{airline_col.gateStatus}}</td> -->
|
||||
<td *ngFor="let airline_col of seasonal_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.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,9 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
import { HttpClientService } from '../../services/http-client.service';
|
||||
import dateFormatter from '../../utils/data-formatter';
|
||||
import { HttpParams } from '@angular/common/http';
|
||||
import * as $ from 'jquery';
|
||||
@Component({
|
||||
selector: 'app-seasonal-plan',
|
||||
templateUrl: './seasonal-plan.component.html',
|
||||
@@ -7,9 +11,381 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class SeasonalPlanComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public seasonal_lists: Array<object>; //列数据
|
||||
|
||||
public row_state: any = { renderFlight: {} };
|
||||
|
||||
// 搜索条件
|
||||
SEARCH = ''; //手动输入条件
|
||||
FLT_POS = 1; //过滤还是定位
|
||||
SEL_COL = ''; //选择列名
|
||||
|
||||
public filterItems = {
|
||||
HZ: '', //所属航站楼区域
|
||||
ZY: '', //资源状态
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'HZ': {
|
||||
'GH': '国内区域',
|
||||
'CH': '国际区域',
|
||||
"QT": '其他区域'
|
||||
},
|
||||
'ZY': {
|
||||
'K': '可用',
|
||||
'R': '不可用',
|
||||
"T": '其他'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.changeDetectorRef.detach();
|
||||
/* 获取显示列 */
|
||||
this.httpCilent.get('/assets/mock-data/seasonal-code.json').subscribe(
|
||||
data => {
|
||||
data.sort(function (a, b) {
|
||||
return (a['COL_ORDER'] - b['COL_ORDER']);
|
||||
})
|
||||
this.seasonal_lists = data;
|
||||
}
|
||||
)
|
||||
/* 获取登机门信息 */
|
||||
this.httpCilent.get('/assets/mock-data/seasonal-data.json').subscribe(
|
||||
data => {
|
||||
//解析数据
|
||||
data.forEach(element => {
|
||||
this.raw_data.push(JSON.parse(element.value));
|
||||
});
|
||||
|
||||
let combined_linked_data = this.raw_data
|
||||
|
||||
combined_linked_data.forEach(element => {
|
||||
let row_flights = {};
|
||||
let render_flight = {};
|
||||
let render_pre_flight = {};
|
||||
let render_rea_flight = {};
|
||||
row_flights['preFlight'] = element;
|
||||
|
||||
for (let i = 0; i < this.seasonal_lists.length; i++) {
|
||||
let key = this.seasonal_lists[i]['COL_CODE']
|
||||
render_flight[key] = typeof (this.formatter[key]) === 'function' ? this.formatter[key](row_flights['preFlight'][key], 1) : this.formatter[key] ? this.formatter[key][row_flights['preFlight'][key]] : row_flights['preFlight'][key];
|
||||
}
|
||||
row_flights['renderFlight'] = render_flight;
|
||||
if (element['isLinked']) {
|
||||
row_flights['preFlight'] = element['linkFlight'];
|
||||
delete element['linkFlight'];
|
||||
delete element['isLinked'];
|
||||
row_flights['reaFlight'] = element;
|
||||
|
||||
for (let i = 0; i < this.seasonal_lists.length; i++) {
|
||||
let key = this.seasonal_lists[i]['COL_CODE']
|
||||
if (this.formatter.hasOwnProperty(key)) {
|
||||
if (typeof (this.formatter[key]) === 'function') {
|
||||
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key](row_flights['preFlight'][key], 1)) : (this.formatter[key](row_flights['preFlight'][key], 1) + '/' + this.formatter[key](row_flights['reaFlight'][key], 1));
|
||||
render_pre_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1);
|
||||
render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1);
|
||||
} else {
|
||||
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key][row_flights['preFlight'][key]]) : (this.formatter[key][row_flights['preFlight'][key]] + '/' + this.formatter[key][row_flights['reaFlight'][key]]);
|
||||
render_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]];
|
||||
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
|
||||
}
|
||||
} else {
|
||||
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (row_flights['preFlight'][key]) : (row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key]);
|
||||
render_pre_flight[key] = row_flights['preFlight'][key];
|
||||
render_rea_flight[key] = row_flights['reaFlight'][key];
|
||||
}
|
||||
}
|
||||
row_flights['renderFlight'] = render_flight;
|
||||
row_flights['renderPreFlight'] = render_pre_flight;
|
||||
row_flights['renderReaFlight'] = render_rea_flight;
|
||||
}
|
||||
this.combined_data.push(row_flights);
|
||||
})
|
||||
// this.doSequence(this.combined_data);
|
||||
this.render_data = this.combined_data
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
)
|
||||
/**
|
||||
* 固定表头
|
||||
*/
|
||||
var tableCont = document.querySelector('#table-container');
|
||||
function scrollHandle (){
|
||||
var scrollTop = this.scrollTop;
|
||||
this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
|
||||
}
|
||||
tableCont.addEventListener('scroll',scrollHandle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行排序并渲染
|
||||
*/
|
||||
/* doSequence(sequenceData) {
|
||||
sequenceData.forEach(element => {
|
||||
element['ORDER'] = this.sequence(element);
|
||||
})
|
||||
|
||||
sequenceData.sort(function (a, b) {
|
||||
return (a['ORDER'] - b['ORDER']);
|
||||
})
|
||||
|
||||
this.render_data = sequenceData;
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
this.changeDetectorRef.detectChanges();
|
||||
} */
|
||||
|
||||
/**
|
||||
* 过滤及定位
|
||||
* @param filterItems
|
||||
* @return
|
||||
*/
|
||||
//输入框回车事件
|
||||
inputEnter() {
|
||||
if (this.FLT_POS === 1) {
|
||||
this.selectChange()
|
||||
} else {
|
||||
this.selectChange()
|
||||
this.inputPosition(this.render_data)
|
||||
}
|
||||
}
|
||||
|
||||
//下拉框选择筛选
|
||||
selectChange() {
|
||||
let filter_data = [];
|
||||
let filterItems = this.filterItems;
|
||||
this.combined_data.forEach(item => {
|
||||
filter_data.push(Object.assign({}, item));
|
||||
})
|
||||
//下拉框筛选
|
||||
filter_data = filter_data.filter(item => {
|
||||
if (item) {
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['preFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return is_satis;
|
||||
} else if (item) {
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['reaFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return is_satis;
|
||||
} else {
|
||||
let pre_satis = true;
|
||||
let rea_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['preFlight'][key] === filterItems[key]) {
|
||||
pre_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
pre_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['reaFlight'][key] === filterItems[key]) {
|
||||
rea_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
rea_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (pre_satis && !rea_satis) {
|
||||
item['renderFlight'] = item['renderPreFlight'];
|
||||
return pre_satis;
|
||||
} else if (!pre_satis && rea_satis) {
|
||||
item['renderFlight'] = item['renderReaFlight'];
|
||||
return rea_satis;
|
||||
} else if (pre_satis && rea_satis) {
|
||||
return pre_satis && rea_satis;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
if (this.FLT_POS === 1) {
|
||||
this.inputFilter(filter_data);
|
||||
} else {
|
||||
this.render_data = filter_data;
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
// this.inputPosition(this.render_data);
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
}
|
||||
|
||||
//输入框筛选
|
||||
inputFilter(filterData) {
|
||||
if (this.SEARCH) {
|
||||
if (this.SEL_COL) {
|
||||
let sel_col = this.SEL_COL;
|
||||
filterData = filterData.filter(item => {
|
||||
if (item['renderFlight'][sel_col]) {
|
||||
if (item['renderFlight'][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['renderFlight']) {
|
||||
if (item['renderFlight'].hasOwnProperty(key)) {
|
||||
if (item['renderFlight'][key]) {
|
||||
if (item['renderFlight'][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: {} };
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
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['renderFlight'][sel_col]) {
|
||||
if (element['renderFlight'][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['renderFlight']) {
|
||||
if (element['renderFlight'].hasOwnProperty(key)) {
|
||||
if (element['renderFlight'][key]) {
|
||||
if (element['renderFlight'][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('没有搜索到相关数据');
|
||||
}
|
||||
|
||||
this.changeDetectorRef.detectChanges();
|
||||
|
||||
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]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user