diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html index cfcdf95..e81d42b 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html @@ -5,19 +5,7 @@
-
- - -
@@ -43,9 +25,6 @@
@@ -70,7 +49,6 @@ CAA码 IATA码 ICAO码 - @@ -90,7 +68,6 @@ {{aircraftType.aircraftTypeCodeCaa}} {{aircraftType.aircraftTypeCodeIata}} {{aircraftType.aircraftTypeCodeIcao}} - diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts index a5a191c..4f91a0e 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts @@ -1,78 +1,92 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; +import { BasicDataService } from '../../basic-data-service'; + import * as $ from 'jquery'; @Component({ selector: 'app-aircraft-type', templateUrl: './aircraft-type.component.html', styleUrls: ['./aircraft-type.component.scss'] - }) +}) export class AircraftTypeComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'aircraftTypeCode', col_chn: '机型代码' }, + { col_code: 'aircraftTypeName', col_chn: '机型名称' }, + { col_code: 'aircraftLength', col_chn: '飞机长度' }, + { col_code: 'aircraftWidth', col_chn: '翼展' }, + { col_code: 'aircraftHeight ', col_chn: '机身高度' }, + { col_code: 'maxPassengers ', col_chn: '最大乘客数' }, + { col_code: 'maxFreightWeight ', col_chn: '最大货物重量' }, + { col_code: 'maxTakeoffWeight ', col_chn: '最大起飞重量' }, + { col_code: 'maxAirbridges ', col_chn: '最大廊桥数' }, + { col_code: 'aircrafttypegroupId ', col_chn: '机型组' }, + { col_code: 'aircraftTypeCodeCaa ', col_chn: 'CAA码' }, + { col_code: 'aircraftTypeCodeIata ', col_chn: 'IATA码' }, + { col_code: 'aircraftTypeCodeIcao ', col_chn: 'ICAO码' }, + ] -//下拉框 -public filterItems = { - aircrafttypegroupId:'', -} + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -aircraftTypes : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.aircraftTypes = this.basicDataService.aircraft_type; - this.basicDataService.aircraft_type_subject.subscribe( - data=>{ - this.aircraftTypes = data; - this.render_data = this.aircraftTypes; + //下拉框 + public filterItems = { + aircrafttypegroupId: '', + } + + aircraftTypes: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + ngOnInit() { + this.aircraftTypes = this.basicDataService.aircraft_type; + this.render_data = this.basicDataService.aircraft_type; + this.basicDataService.aircraft_type_subject.subscribe( + data => { + this.aircraftTypes = data; + this.render_data = 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); + } + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -///输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.aircraftTypes) - } else { - this.inputFilter(this.aircraftTypes) - this.inputPosition(this.aircraftTypes) + ///输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputPosition(this.render_data) + } } -} -//下拉框选择筛选 -selectChange() { - this.return_data = this.aircraftTypes.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.aircraftTypes.filter(item => { let is_satis = true; for (const key in this.filterItems) { if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { - if (item[key] === this.filterItems[key]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -82,36 +96,36 @@ selectChange() { } } return is_satis; - }) - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -119,50 +133,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -176,31 +182,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.html b/src/app/pages/basic-data/aircraft/aircraft.component.html index ef98737..ee79a63 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.html +++ b/src/app/pages/basic-data/aircraft/aircraft.component.html @@ -5,14 +5,7 @@
-
- - -
@@ -44,7 +31,7 @@
@@ -64,7 +51,6 @@ 机主航空公司 航空公司 机型 - @@ -77,9 +63,8 @@ {{aircraft.maxTakeoffWeight}} {{aircraft.maxAirbridges}} {{aircraft.aircraftOwnerCode}} - {{aircraft.airlineName}} - {{aircraft.aircraftTypeName}} - + {{aircraft.airlineCode}} + {{aircraft.aircraftTypeCode}} diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.ts b/src/app/pages/basic-data/aircraft/aircraft.component.ts index 3704c1a..2ffa8e8 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.ts +++ b/src/app/pages/basic-data/aircraft/aircraft.component.ts @@ -1,117 +1,102 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; +import { BasicDataService } from '../../basic-data-service'; + import * as $ from 'jquery'; @Component({ selector: 'app-aircraft', templateUrl: './aircraft.component.html', styleUrls: ['./aircraft.component.scss'] - }) - export class AircraftComponent implements OnInit { +}) +export class AircraftComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'aircraftNumber', col_chn: '飞机号' }, + { col_code: 'maxPassengers', col_chn: '最大乘客数' }, + { col_code: 'maxFreightWeight', col_chn: '最大货物重量' }, + { col_code: 'maxTakeoffWeight', col_chn: '最大起飞重量' }, + { col_code: 'maxAirbridges', col_chn: '最大廊桥数' }, + { col_code: 'aircraftOwnerCode', col_chn: '机主航空公司' }, + { col_code: 'airlineCode', col_chn: '航空公司' }, + { col_code: 'aircraftTypeCode', col_chn: '机型' } + ] -//下拉框 -public filterItems = { - airlineCode:'', - aircraftTypeCode:'', -} -airlines : Array; //航空公司 -aircraftTypes : Array; //机型 -aircrafts : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -ngOnInit() { - this.aircrafts = this.basicDataService.aircraft; - this.basicDataService.aircraft_subject.subscribe( - data=>{ - this.aircrafts = data; - this.render_data = this.aircrafts; - if(this.aircraftTypes && this.aircraftTypes.length > 0){//机型列表数据转换 - this.basicDataTransHandle(); + //下拉框 + public filterItems = { + airlineCode: '', + aircraftTypeCode: '', + } + airlines: Array; //航空公司 + aircraftTypes: Array; //机型 + aircrafts: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + ngOnInit() { + this.airlines = this.basicDataService.airline; + this.aircraftTypes = this.basicDataService.aircraft_type; + this.aircrafts = this.basicDataService.aircraft; + this.render_data = this.basicDataService.aircraft; + this.basicDataService.aircraft_subject.subscribe( + data => { + this.aircrafts = data; + this.render_data = data; } - if(this.airlines && this.airlines.length > 0){//航空公司数据处理 - this.basicDataAirlinesHandle(); + ) + this.basicDataService.airline_subject.subscribe( + data => { + this.airlines = data; } + ) + this.basicDataService.aircraft_type_subject.subscribe( + data => { + this.aircraftTypes = data; + } + ) + + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle() { + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; } - ) - //航空公司 - this.airlines = this.basicDataService.airline; - this.basicDataService.airline_subject.subscribe( - data=>{ - this.airlines = data; - } - ) - //机型 - this.aircraftTypes = this.basicDataService.aircraft_type; - this.basicDataService.aircraft_type_subject.subscribe( - data=>{ - this.aircraftTypes = data; - } - ) - + tableCont.addEventListener('scroll', scrollHandle); + } + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -basicDataTransHandle() { - this.render_data.forEach(item => { - //机型数据转换处理 - let aircraftTypesLinkIndex = this.aircraftTypes.findIndex(val => val.aircraftTypeCode === item['aircraftTypeCode']); - item['aircraftTypeName'] = this.aircraftTypes[aircraftTypesLinkIndex].aircraftTypeName; - }) -} - -basicDataAirlinesHandle() { - this.render_data.forEach(item => { - //航空公司数据处理 - let airlinesLinkIndex = this.airlines.findIndex(val => val.airlineCode === item['airlineCode']); - item['airlineName'] = this.airlines[airlinesLinkIndex].airlineName; - }) -} -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.aircrafts) - } else { - this.inputFilter(this.aircrafts) - this.inputPosition(this.aircrafts) + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputPosition(this.render_data) + } } -} -//下拉框选择筛选 -selectChange() { - this.return_data = this.aircrafts.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.aircrafts.filter(item => { let is_satis = true; for (const key in this.filterItems) { if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { - if (item[key] === this.filterItems[key]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -121,36 +106,36 @@ selectChange() { } } return is_satis; - }) - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -158,50 +143,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -215,31 +192,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/airline/airline.component.html b/src/app/pages/basic-data/airline/airline.component.html index 875b9c8..82d2b6b 100644 --- a/src/app/pages/basic-data/airline/airline.component.html +++ b/src/app/pages/basic-data/airline/airline.component.html @@ -5,15 +5,7 @@
-
- - -
@@ -68,7 +52,6 @@ CAA码 ICAO码 上级母公司 - @@ -84,7 +67,6 @@ {{airline.airlineCodeCaa}} {{airline.airlineCodeIcao}} {{airline.parentAirlineId}} - diff --git a/src/app/pages/basic-data/airline/airline.component.ts b/src/app/pages/basic-data/airline/airline.component.ts index 6ce491b..c4f3de7 100644 --- a/src/app/pages/basic-data/airline/airline.component.ts +++ b/src/app/pages/basic-data/airline/airline.component.ts @@ -1,7 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; +import { BasicDataService } from '../../basic-data-service'; import * as $ from 'jquery'; @Component({ selector: 'app-airline', @@ -10,69 +8,81 @@ import * as $ from 'jquery'; }) export class AirlineComponent implements OnInit { -constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'airlineCode', col_chn: '航空公司代码' }, + { col_code: 'airlineName', col_chn: '航空公司中文名' }, + { col_code: 'briefNameChn', col_chn: '中文简称' }, + { col_code: 'airlineNameEng', col_chn: '航空公司英文名' }, + { col_code: 'briefNameEng', col_chn: '英文简称' }, + { col_code: 'airlineCodeIata', col_chn: 'IATA码' }, + { col_code: 'airlineCodeCaa', col_chn: 'CAA码' }, + { col_code: 'airlineCodeIcao', col_chn: 'ICAO码' }, + { col_code: 'parentAirlineId', col_chn: '上级母公司' }, + ] -airlines:Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -//下拉框 -public filterItems = { - airlineName:'', - briefNameChn:'', -} -ngOnInit() { - this.airlines = this.basicDataService.airline; - this.basicDataService.airline_subject.subscribe( - data=>{ - this.airlines = data; - this.render_data = this.airlines; + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 + + airlines: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + //下拉框 + public filterItems = { + airlineName: '', + briefNameChn: '', + } + ngOnInit() { + this.airlines = this.basicDataService.airline; + this.render_data = this.basicDataService.airline; + this.basicDataService.airline_subject.subscribe( + data => { + this.airlines = data; + this.render_data = 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); + } + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.airlines) - } else { - this.inputFilter(this.airlines) - this.inputPosition(this.airlines) + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputFilter(this.airlines) + this.inputPosition(this.airlines) + } } -} -//下拉框选择筛选 -selectChange() { - this.return_data = this.airlines.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.airlines.filter(item => { let is_satis = true; for (const key in this.filterItems) { if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { - if (item[key] === this.filterItems[key]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -82,36 +92,36 @@ selectChange() { } } return is_satis; - }) - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -119,50 +129,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -176,31 +178,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/airport/airport.component.html b/src/app/pages/basic-data/airport/airport.component.html index 6cd49cc..8cb8739 100644 --- a/src/app/pages/basic-data/airport/airport.component.html +++ b/src/app/pages/basic-data/airport/airport.component.html @@ -5,16 +5,7 @@
-
- - -
@@ -40,8 +24,6 @@
@@ -49,9 +31,6 @@ @@ -74,7 +53,6 @@ ICAO码 机场集团 所在城市 - @@ -90,8 +68,7 @@ {{airport.airportCodeCaa}} {{airport.airportCodeIcao}} {{airport.airportGroupId}} - {{airport.cityName}} - + {{airport.cityId}} diff --git a/src/app/pages/basic-data/airport/airport.component.ts b/src/app/pages/basic-data/airport/airport.component.ts index 907c277..3ad44d5 100644 --- a/src/app/pages/basic-data/airport/airport.component.ts +++ b/src/app/pages/basic-data/airport/airport.component.ts @@ -1,98 +1,98 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { HttpParams } from '@angular/common/http'; +import { BasicDataService } from '../../basic-data-service'; import * as $ from 'jquery'; -import { BasicDataService } from '../../basic-data-service' + @Component({ - selector: 'app-airport', - templateUrl: './airport.component.html', - styleUrls: ['./airport.component.scss'] + selector: 'app-airport', + templateUrl: './airport.component.html', + styleUrls: ['./airport.component.scss'] }) export class AirportComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'airportCode', col_chn: '机场代码' }, + { col_code: 'airportNameChn', col_chn: '机场中文名' }, + { col_code: 'briefNameChn', col_chn: '中文简称' }, + { col_code: 'airportNameEng', col_chn: '机场英文名' }, + { col_code: 'briefNameEng', col_chn: '英文简称' }, + { col_code: 'airportCodeIata', col_chn: 'IATA码' }, + { col_code: 'airportCodeCaa', col_chn: 'CAA码' }, + { col_code: 'airportCodeIcao', col_chn: 'ICAO码' }, + { col_code: 'airportGroupId', col_chn: '机场集团' }, + { col_code: 'cityId', col_chn: '所在城市' }, + ] -//下拉框 -public filterItems = { - airportGroupId:'', - cityId:'', -} -citys : Array; //城市 -airports : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -ngOnInit() { - this.airports = this.basicDataService.airport; - this.basicDataService.airport_subject.subscribe( - data=>{ - this.airports = data; - this.render_data = this.airports; - if(this.citys && this.citys.length > 0){//所在城市列表数据转换 - this.basicDataTransHandle(); + //下拉框 + public filterItems = { + airportGroupId: '', + cityId: '', + } + + citys: Array; //城市 + airports: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + ngOnInit() { + this.citys = this.basicDataService.city; + this.airports = this.basicDataService.airport; + this.render_data = this.basicDataService.airport; + this.basicDataService.airport_subject.subscribe( + data => { + this.airports = data; + this.render_data = data; } + ) + this.basicDataService.city_subject.subscribe( + data => { + this.citys = data; + } + ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle() { + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; } - ) - //城市 - this.citys = this.basicDataService.city; - this.basicDataService.city_subject.subscribe( - data=>{ - this.citys = data; - } - ) + tableCont.addEventListener('scroll', scrollHandle); + } + + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -//所在城市数据转换处理 -basicDataTransHandle() { - this.render_data.forEach(item => { - let citysLinkIndex = this.citys.findIndex(val => val.cityId === item['cityId']); - item['cityName'] = this.citys[citysLinkIndex].cityNameChn; - }) -} - -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.airports) - } else { - this.inputFilter(this.airports) - this.inputPosition(this.airports) + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputPosition(this.render_data) + } } -} -//下拉框选择筛选 -selectChange() { - this.return_data = this.airports.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.airports.filter(item => { let is_satis = true; 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]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -102,36 +102,36 @@ selectChange() { } } return is_satis; - }) - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + filterData = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -139,50 +139,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -196,31 +188,29 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } } } diff --git a/src/app/pages/basic-data/basic-data.module.ts b/src/app/pages/basic-data/basic-data.module.ts index f18b95f..f338507 100644 --- a/src/app/pages/basic-data/basic-data.module.ts +++ b/src/app/pages/basic-data/basic-data.module.ts @@ -1,5 +1,9 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { BasicDataPipesModule } from '../../pipes/basic-data-pipes/basic-data-pipes.module'; + import { BasicDataComponent } from './basic-data.component'; import { BasicDataRouting } from './basic-data-routing.module'; import { CheckinGroupComponent } from './checkin-group/checkin-group.component'; @@ -15,25 +19,26 @@ import { AircraftTypeComponent } from './aircraft-type/aircraft-type.component'; import { AircraftComponent } from './aircraft/aircraft.component'; import { TerminalAreaComponent } from './terminal-area/terminal-area.component'; import { AirlineComponent } from './airline/airline.component'; -import { FormsModule } from '@angular/forms'; + @NgModule({ imports: [ CommonModule, BasicDataRouting, - FormsModule + FormsModule, + BasicDataPipesModule ], declarations: [ - BasicDataComponent, - CheckinGroupComponent, - GateComponent, TerminalComponent, - ChutComponent, StandComponent, - CarouselComponent, - CheckinDeskComponent, - AirportComponent, - CityComponent, - AircraftTypeComponent, - AircraftComponent, - TerminalAreaComponent, + BasicDataComponent, + CheckinGroupComponent, + GateComponent, TerminalComponent, + ChutComponent, StandComponent, + CarouselComponent, + CheckinDeskComponent, + AirportComponent, + CityComponent, + AircraftTypeComponent, + AircraftComponent, + TerminalAreaComponent, AirlineComponent] }) export class BasicDataModule { } diff --git a/src/app/pages/basic-data/carousel/carousel.component.html b/src/app/pages/basic-data/carousel/carousel.component.html index efaeb05..00a4c67 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.html +++ b/src/app/pages/basic-data/carousel/carousel.component.html @@ -1,84 +1,71 @@
-
-
-
-
+
+
+
+
- -
-
- - -
-
+ +
+
-
-
- - -
-
- - -
+
+
+ + +
+
+ + +
+
-
-
-
- - - - - - - - - - - - - - - - - - - - - -
序号行李转盘代码行李转盘名称航站楼区域资源状态
{{i+1}}{{carousel.carouselCode}}{{carousel.carouselName}}{{carousel.terminalAreaName}}{{carousel.carouselStatus}}
-
-
-
+
+
+ + + + + + + + + + + + + + + + + + + +
序号行李转盘代码行李转盘名称航站楼区域资源状态
{{i+1}}{{carousel.carouselCode}}{{carousel.carouselName}}{{carousel.terminalAreaCode|terminalArea}}{{carousel.carouselStatus}}
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/carousel/carousel.component.ts b/src/app/pages/basic-data/carousel/carousel.component.ts index 20bd5c2..8304321 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.ts +++ b/src/app/pages/basic-data/carousel/carousel.component.ts @@ -1,134 +1,91 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ - selector: 'app-carousel', - templateUrl: './carousel.component.html', - styleUrls: ['./carousel.component.scss'] + selector: 'app-carousel', + templateUrl: './carousel.component.html', + styleUrls: ['./carousel.component.scss'] }) export class CarouselComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 -//下拉框 -public filterItems = { - terminalAreaCode:'', - carouselStatus:'', -} -terminalAreas:Array; //所属航站楼区域 -carousels:Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.carousels = this.basicDataService.carousel; - this.basicDataService.carousel_subject.subscribe( - data=>{ - this.carousels = data; - this.render_data = this.carousels; - if(this.terminalAreas && this.terminalAreas.length > 0){//所属航站楼区域数据显示处理 - this.terminalAreasHandle(); + public col_lists = [ + { col_code: 'carouselCode', col_chn: '行李转盘代码' }, + { col_code: 'carouselName', col_chn: '行李转盘名称' }, + { col_code: 'terminalAreaCode', col_chn: '航站楼区域' }, + { col_code: 'carouselStatus', col_chn: '资源状态' }, + ] + + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 + + //下拉框 + public filterItems = { + terminalAreaCode: '', + carouselStatus: '', + } + terminalAreas: Array; //所属航站楼区域 + carousels: Array; + + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + ngOnInit() { + this.terminalAreas = this.basicDataService.terminal_area; + this.carousels = this.basicDataService.carousel; + this.render_data = this.basicDataService.carousel; + this.basicDataService.carousel_subject.subscribe( + data => { + this.carousels = data; + this.render_data = data; } - this.render_data.forEach(element => {//资源状态列表显示数据转换 - if (element['carouselStatus'] == '0') { - element['carouselStatus'] = '可用' - return element['carouselStatus']; - } - if(element['carouselStatus'] == '1'){ - element['carouselStatus'] = '在用' - return element['carouselStatus']; - } - if(element['carouselStatus'] == '2'){ - element['carouselStatus'] = '锁定' - return element['carouselStatus']; - } - if(element['carouselStatus'] == '3'){ - element['carouselStatus'] = '禁用' - return element['carouselStatus']; - } - if(element['carouselStatus'] == '4'){ - element['carouselStatus'] = '预分' - return element['carouselStatus']; - } - }); + ); + this.basicDataService.terminal_area_subject.subscribe( + data => { + this.terminalAreas = data; + } + ); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle() { + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; } - ) - //所属航站楼区域 - this.terminalAreas = this.basicDataService.terminal_area; - this.basicDataService.terminal_area_subject.subscribe( - data=>{ - this.terminalAreas = data; - } - ) + tableCont.addEventListener('scroll', scrollHandle); + } + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -//所属航站楼区域数据转换处理 -terminalAreasHandle() { - this.render_data.forEach(item => { - let terminalAreasLinkIndex = this.terminalAreas.findIndex(val => val.terminalAreaCode === item['terminalAreaCode']); - item['terminalAreaName'] = this.terminalAreas[terminalAreasLinkIndex].terminalAreaName; - }) -} - -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.carousels) - } else { - this.inputFilter(this.carousels) - this.inputPosition(this.carousels) + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputPosition(this.render_data) + } } -} -//下拉框选择筛选 -selectChange() { - this.return_data = this.carousels.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.carousels.filter(item => { let is_satis = true; - if (item['carouselStatus'] == '可用') { - item['carouselStatus'] = '0' - } - if(item['carouselStatus'] == '在用'){ - item['carouselStatus'] = '1' - } - if(item['carouselStatus'] == '锁定'){ - item['carouselStatus'] = '2' - } - if(item['carouselStatus'] == '禁用'){ - item['carouselStatus'] = '3' - } - if(item['carouselStatus'] == '预分'){ - item['carouselStatus'] = '4' - } 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]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -138,58 +95,37 @@ selectChange() { } } return is_satis; - }) - this.return_data.forEach(element => {//资源状态列表显示数据转换 - if (element['carouselStatus'] == '0') { - element['carouselStatus'] = '可用' - return element['carouselStatus']; - } - if(element['carouselStatus'] == '1'){ - element['carouselStatus'] = '在用' - return element['carouselStatus']; - } - if(element['carouselStatus'] == '2'){ - element['carouselStatus'] = '锁定' - return element['carouselStatus']; - } - if(element['carouselStatus'] == '3'){ - element['carouselStatus'] = '禁用' - return element['carouselStatus']; - } - if(element['carouselStatus'] == '4'){ - element['carouselStatus'] = '预分' - return element['carouselStatus']; - } - }); - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -197,50 +133,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -254,31 +182,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html index 6a9708d..292b1e9 100644 --- a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html +++ b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html @@ -5,11 +5,7 @@
-
- - -
@@ -34,9 +25,6 @@
@@ -44,9 +32,6 @@
@@ -54,9 +39,6 @@
@@ -73,7 +55,6 @@ 值机岛 行李传送带 航站楼区域 - @@ -82,10 +63,9 @@ {{i+1}} {{checkinDesk.checkindeskCode}} {{checkinDesk.checkindeskName}} - {{checkinDesk.checkinGroupName}} - {{checkinDesk.chutName}} - {{checkinDesk.terminalAreaName}} - + {{checkinDesk.checkinGroupCode}} + {{checkinDesk.chutCode}} + {{checkinDesk.terminalAreaCode|terminalArea}} diff --git a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts index b885d0c..da2be7d 100644 --- a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts +++ b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts @@ -1,143 +1,107 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; +import { BasicDataService } from '../../basic-data-service'; import * as $ from 'jquery'; @Component({ - selector: 'app-checkin-desk', - templateUrl: './checkin-desk.component.html', - styleUrls: ['./checkin-desk.component.scss'] + selector: 'app-checkin-desk', + templateUrl: './checkin-desk.component.html', + styleUrls: ['./checkin-desk.component.scss'] }) export class CheckinDeskComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'checkindeskCode', col_chn: '值机柜台代码' }, + { col_code: 'checkindeskName', col_chn: '值机柜台名称' }, + { col_code: 'checkinGroupCode', col_chn: '值机岛' }, + { col_code: 'chutCode', col_chn: '行李传送带' }, + { col_code: 'terminalAreaCode', col_chn: '航站楼区域' }, + ] -//下拉框 -public filterItems = { - terminalAreaCode:'', - checkinGroupCode:'', - chutCode:'', -} + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -checkinGroups : Array; //值机岛 -terminalAreas : Array; //所属航站楼区域 -chuts : Array; //行李传送带 -checkinDesks : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.checkinDesks = this.basicDataService.checkin_desk; - this.basicDataService.checkin_desk_subject.subscribe( - data=>{ - this.checkinDesks = data; - this.render_data = this.checkinDesks; - if(this.terminalAreas && this.terminalAreas.length>0){//所属航站楼区域数据转换处理 - this.terminalAreasHandle(); + //下拉框 + public filterItems = { + terminalAreaCode: '', + checkinGroupCode: '', + chutCode: '', + } + + checkinGroups: Array; //值机岛 + terminalAreas: Array; //所属航站楼区域 + chuts: Array; //行李传送带 + checkinDesks: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + ngOnInit() { + this.terminalAreas = this.basicDataService.terminal_area; + this.checkinGroups = this.basicDataService.checkin_group; + this.chuts = this.basicDataService.chut; + this.checkinDesks = this.basicDataService.checkin_desk; + this.render_data = this.basicDataService.checkin_desk; + + this.basicDataService.checkin_desk_subject.subscribe( + data => { + this.checkinDesks = data; + this.render_data = data; } - if(this.checkinGroups && this.checkinGroups.length>0){//值机岛数据转换处理 - this.checkinGroupsHandle(); + ) + this.basicDataService.terminal_area_subject.subscribe( + data => { + this.terminalAreas = data; } - if(this.checkinGroups && this.checkinGroups.length>0){//行李传送带数据转换处理 - this.chutsHandle(); + ) + this.basicDataService.checkin_group_subject.subscribe( + data => { + this.checkinGroups = data; } + ) + this.basicDataService.chut_subject.subscribe( + data => { + this.chuts = data; + } + ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle() { + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; } - ) - //所属航站楼区域 - this.terminalAreas = this.basicDataService.terminal_area; - this.basicDataService.terminal_area_subject.subscribe( - data=>{ - this.terminalAreas = data; - } - ) - //值机岛 - this.checkinGroups = this.basicDataService.checkin_group; - this.basicDataService.checkin_group_subject.subscribe( - data=>{ - this.checkinGroups = data; - } - ) - //行李传送带 - this.chuts = this.basicDataService.chut; - this.basicDataService.chut_subject.subscribe( - data=>{ - this.chuts = data; - } - ) + tableCont.addEventListener('scroll', scrollHandle); + } + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -//所属航站楼区域数据转换处理 -terminalAreasHandle() { - this.render_data.forEach(item => { - let terminalAreasLinkIndex = this.terminalAreas.findIndex(val => val.terminalAreaCode === item['terminalAreaCode']); - item['terminalAreaName'] = this.terminalAreas[terminalAreasLinkIndex].terminalAreaName; - }) -} - -//值机岛数据转换处理 -checkinGroupsHandle() { - this.render_data.forEach(item => { - let checkinGroupsLinkIndex = this.checkinGroups.findIndex(val => val.checkinGroupCode === item['checkinGroupCode']); - let checkinGroups = this.checkinGroups[checkinGroupsLinkIndex].checkinGroupName - if(checkinGroups !=null){ - item['checkinGroupName'] = checkinGroups; + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputPosition(this.render_data) } - }) -} - -//行李传送带数据转换处理 -chutsHandle() { - this.render_data.forEach(item => { - let chutsLinkIndex = this.chuts.findIndex(val => val.chutCode === item['chutCode']); - let chuts = this.chuts[chutsLinkIndex].chutName - if(chuts !=null && chuts !=""){ - item['chutName'] = chuts; - } - }) -} - -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.checkinDesks) - } else { - this.inputFilter(this.checkinDesks) - this.inputPosition(this.checkinDesks) } -} -//下拉框选择筛选 -selectChange() { - this.return_data = this.checkinDesks.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.checkinDesks.filter(item => { let is_satis = true; for (const key in this.filterItems) { if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { - if (item[key] === this.filterItems[key]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -147,36 +111,36 @@ selectChange() { } } return is_satis; - }) - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -184,50 +148,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -241,31 +197,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/checkin-group/checkin-group.component.html b/src/app/pages/basic-data/checkin-group/checkin-group.component.html index 2f4bbbf..3361d2e 100644 --- a/src/app/pages/basic-data/checkin-group/checkin-group.component.html +++ b/src/app/pages/basic-data/checkin-group/checkin-group.component.html @@ -5,8 +5,7 @@
-
- - -
@@ -34,7 +28,6 @@ 序号 值机岛代码 值机岛名称 - @@ -43,7 +36,6 @@ {{i+1}} {{checkinGroup.checkinGroupCode}} {{checkinGroup.checkinGroupName}} - diff --git a/src/app/pages/basic-data/checkin-group/checkin-group.component.scss b/src/app/pages/basic-data/checkin-group/checkin-group.component.scss index dba3c39..91cccf7 100644 --- a/src/app/pages/basic-data/checkin-group/checkin-group.component.scss +++ b/src/app/pages/basic-data/checkin-group/checkin-group.component.scss @@ -9,16 +9,6 @@ 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 { diff --git a/src/app/pages/basic-data/checkin-group/checkin-group.component.ts b/src/app/pages/basic-data/checkin-group/checkin-group.component.ts index fbae15b..47161d2 100644 --- a/src/app/pages/basic-data/checkin-group/checkin-group.component.ts +++ b/src/app/pages/basic-data/checkin-group/checkin-group.component.ts @@ -1,117 +1,94 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { HttpParams } from '@angular/common/http'; +import { BasicDataService } from '../../basic-data-service'; + import * as $ from 'jquery'; -import { BasicDataService } from '../../basic-data-service' + @Component({ - selector: 'app-checkin-group', - templateUrl: './checkin-group.component.html', - styleUrls: ['./checkin-group.component.scss'] + selector: 'app-checkin-group', + templateUrl: './checkin-group.component.html', + styleUrls: ['./checkin-group.component.scss'] }) export class CheckinGroupComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'checkinGroupCode', col_chn: '值机岛代码' }, + { col_code: 'checkinGroupName', col_chn: '值机岛名称' } + ] -//下拉框 -public filterItems = { + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -} + checkinGroups: Array = []; + public render_data: Array = []; //显示数据,即需要显示的数据 -checkinGroups : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.checkinGroups = this.basicDataService.checkin_group; - this.basicDataService.checkin_group_subject.subscribe( - data=>{ - this.checkinGroups = data; - this.render_data = this.checkinGroups; - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); -} + public row_state: any = {}; -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.checkinGroups) - } else { - this.inputFilter(this.checkinGroups) - this.inputPosition(this.checkinGroups) - } -} - -//下拉框选择筛选 -selectChange() { - this.return_data = this.checkinGroups.filter(item=>{ - let is_satis = true; - 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; - } - } + ngOnInit() { + this.checkinGroups = this.basicDataService.checkin_group; + this.render_data = this.basicDataService.checkin_group; + this.basicDataService.checkin_group_subject.subscribe( + data => { + this.checkinGroups = data; + this.render_data = data; } - return is_satis; - }) - this.render_data = this.return_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); + } -//输入框筛选 -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; - } - } - }) + /** + * 选中某行 + * @param i + */ + selectRow(i) { + this.row_state = i; + } + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.inputFilter(this.checkinGroups) } 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'))) { + this.inputPosition(this.render_data) + } + } + + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -119,50 +96,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -176,31 +145,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/chut/chut.component.html b/src/app/pages/basic-data/chut/chut.component.html index 0465f84..173f29e 100644 --- a/src/app/pages/basic-data/chut/chut.component.html +++ b/src/app/pages/basic-data/chut/chut.component.html @@ -5,8 +5,7 @@
-
- - -
@@ -34,7 +28,6 @@ 序号 行李传送带代码 行李传送带名称 - @@ -43,7 +36,6 @@ {{i+1}} {{chut.chutCode}} {{chut.chutName}} - diff --git a/src/app/pages/basic-data/chut/chut.component.ts b/src/app/pages/basic-data/chut/chut.component.ts index 351c86e..35f3cf6 100644 --- a/src/app/pages/basic-data/chut/chut.component.ts +++ b/src/app/pages/basic-data/chut/chut.component.ts @@ -1,117 +1,91 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; + @Component({ - selector: 'app-chut', - templateUrl: './chut.component.html', - styleUrls: ['./chut.component.scss'] + selector: 'app-chut', + templateUrl: './chut.component.html', + styleUrls: ['./chut.component.scss'] }) export class ChutComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'chutCode', col_chn: '行李传送带代码' }, + { col_code: 'chutName', col_chn: '行李传送带名称' } + ] -//下拉框 -public filterItems = { - -} + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -chuts : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.chuts = this.basicDataService.chut; - this.basicDataService.chut_subject.subscribe( - data=>{ - this.chuts = data; - this.render_data = this.chuts; - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); -} + chuts: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.chuts) - } else { - this.inputFilter(this.chuts) - this.inputPosition(this.chuts) - } -} - -//下拉框选择筛选 -selectChange() { - this.return_data = this.chuts.filter(item=>{ - let is_satis = true; - 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; - } - } + ngOnInit() { + this.chuts = this.basicDataService.chut; + this.render_data = this.basicDataService.chut; + this.basicDataService.chut_subject.subscribe( + data => { + this.chuts = data; + this.render_data = data; } - return is_satis; - }) - this.render_data = this.return_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); + } -//输入框筛选 -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; - } - } - }) + /** + * 选中某行 + * @param i + */ + selectRow(i) { + this.row_state = i; + } + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.inputFilter(this.chuts) } 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'))) { + this.inputPosition(this.render_data) + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -119,50 +93,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -176,31 +142,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/city/city.component.html b/src/app/pages/basic-data/city/city.component.html index 4dc6a79..307e628 100644 --- a/src/app/pages/basic-data/city/city.component.html +++ b/src/app/pages/basic-data/city/city.component.html @@ -1,68 +1,38 @@
-
-
-
-
+
+
+
+
- -
-
- - -
-
+ +
+
-
- -
- - -
-
- - -
+
+
+ + +
+
-
-
-
- +
+
@@ -71,22 +41,19 @@ - - + -
城市中文名 城市英文名 所在国家
{{i+1}} {{city.cityCode}} {{city.cityNameChn}} {{city.cityNameEng}} {{city.countryId}}
-
-
-
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/city/city.component.ts b/src/app/pages/basic-data/city/city.component.ts index 1b3bfc3..b6b1c1a 100644 --- a/src/app/pages/basic-data/city/city.component.ts +++ b/src/app/pages/basic-data/city/city.component.ts @@ -1,78 +1,83 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; + +import { BasicDataService } from '../../basic-data-service'; import * as $ from 'jquery'; @Component({ - selector: 'app-city', - templateUrl: './city.component.html', - styleUrls: ['./city.component.scss'] + selector: 'app-city', + templateUrl: './city.component.html', + styleUrls: ['./city.component.scss'] }) export class CityComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'cityCode', col_chn: '城市代码' }, + { col_code: 'cityNameChn', col_chn: '城市中文名' }, + { col_code: 'cityNameEng', col_chn: '城市英文名' }, + { col_code: 'countryId', col_chn: '所在国家' }, + ]; -//下拉框 -public filterItems = { - countryId:'', -} + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -citys : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.citys = this.basicDataService.city; - this.basicDataService.city_subject.subscribe( - data=>{ - this.citys = data; - this.render_data = this.citys; + //下拉框 + public filterItems = { + countryId: '', + } + + citys: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + ngOnInit() { + this.citys = this.basicDataService.city; + this.render_data = this.basicDataService.city; + this.basicDataService.city_subject.subscribe( + data => { + this.citys = data; + this.render_data = 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); + } + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.citys) - } else { - this.inputFilter(this.citys) - this.inputPosition(this.citys) + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputPosition(this.render_data) + } } -} -//下拉框选择筛选 -selectChange() { - this.return_data = this.citys.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.citys.filter(item => { let is_satis = true; for (const key in this.filterItems) { if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { - if (item[key] === this.filterItems[key]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -82,36 +87,36 @@ selectChange() { } } return is_satis; - }) - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -119,50 +124,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -176,31 +173,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/gate/gate.component.html b/src/app/pages/basic-data/gate/gate.component.html index 287b863..df1d7ea 100644 --- a/src/app/pages/basic-data/gate/gate.component.html +++ b/src/app/pages/basic-data/gate/gate.component.html @@ -5,55 +5,48 @@
- - -
-
- - + + 过滤 + + +
- +
-
- - +
+ + +
+
+ + +
-
- - -
-
- +
- +
@@ -61,22 +54,19 @@ - - + - + -
序号登机门名称 航站楼区域 资源状态
{{i+1}} {{gate.gateCode}} {{gate.gateName}}{{gate.terminalAreaName}}{{gate.terminalAreaCode|terminalArea}} {{gate.gateStatus}}
- \ No newline at end of file + \ No newline at end of file diff --git a/src/app/pages/basic-data/gate/gate.component.ts b/src/app/pages/basic-data/gate/gate.component.ts index 7e38eb3..135f82c 100644 --- a/src/app/pages/basic-data/gate/gate.component.ts +++ b/src/app/pages/basic-data/gate/gate.component.ts @@ -1,134 +1,89 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ - selector: 'app-gate', - templateUrl: './gate.component.html', - styleUrls: ['./gate.component.scss'] + selector: 'app-gate', + templateUrl: './gate.component.html', + styleUrls: ['./gate.component.scss'] }) export class GateComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'gateCode', col_chn: '登机门代码' }, + { col_code: 'gateName', col_chn: '登机门名称' }, + { col_code: 'terminalAreaCode', col_chn: '航站楼区域' }, + { col_code: 'gateStatus', col_chn: '资源状态' }, + ] -//下拉框 -public filterItems = { - terminalAreaCode:'', - gateStatus:'', -} -terminalAreas : Array; //所属航站楼区域 -gates : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.gates = this.basicDataService.gate; - this.basicDataService.gate_subject.subscribe( - data=>{ - this.gates = data; - this.render_data = this.gates; - if(this.terminalAreas && this.terminalAreas.length > 0){//所属航站楼区域数据显示处理 - this.terminalAreasHandle(); + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 + + //下拉框 + public filterItems = { + terminalAreaCode: '', + gateStatus: '', + } + terminalAreas: Array; //所属航站楼区域 + gates: Array; + + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + ngOnInit() { + this.terminalAreas = this.basicDataService.terminal_area; + this.gates = this.basicDataService.gate; + this.render_data = this.basicDataService.gate; + this.basicDataService.gate_subject.subscribe( + data => { + this.gates = data; + this.render_data = data; } - this.render_data.forEach(element => {//资源状态列表显示数据转换 - if (element['gateStatus'] == '0') { - element['gateStatus'] = '可用' - return element['gateStatus']; - } - if(element['gateStatus'] == '1'){ - element['gateStatus'] = '在用' - return element['gateStatus']; - } - if(element['gateStatus'] == '2'){ - element['gateStatus'] = '锁定' - return element['gateStatus']; - } - if(element['gateStatus'] == '3'){ - element['gateStatus'] = '禁用' - return element['gateStatus']; - } - if(element['gateStatus'] == '4'){ - element['gateStatus'] = '预分' - return element['gateStatus']; - } - }); + ) + this.basicDataService.terminal_area_subject.subscribe( + data => this.terminalAreas = data + ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle() { + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; } - ) - //所属航站楼区域 - this.terminalAreas = this.basicDataService.terminal_area; - this.basicDataService.terminal_area_subject.subscribe( - data=>{ - this.terminalAreas = data; - } - ) + tableCont.addEventListener('scroll', scrollHandle); + } + + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -//所属航站楼区域数据转换处理 -terminalAreasHandle() { - this.render_data.forEach(item => { - let terminalAreasLinkIndex = this.terminalAreas.findIndex(val => val.terminalAreaCode === item['terminalAreaCode']); - item['terminalAreaName'] = this.terminalAreas[terminalAreasLinkIndex].terminalAreaName; - }) -} - -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.gates) - } else { - this.inputFilter(this.gates) - this.inputPosition(this.gates) + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputPosition(this.render_data) + } } -} -//下拉框选择筛选 -selectChange() { - this.return_data = this.gates.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.gates.filter(item => { let is_satis = true; - if (item['gateStatus'] == '可用') { - item['gateStatus'] = '0' - } - if(item['gateStatus'] == '在用'){ - item['gateStatus'] = '1' - } - if(item['gateStatus'] == '锁定'){ - item['gateStatus'] = '2' - } - if(item['gateStatus'] == '禁用'){ - item['gateStatus'] = '3' - } - if(item['gateStatus'] == '预分'){ - item['gateStatus'] = '4' - } 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]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -138,58 +93,35 @@ selectChange() { } } return is_satis; - }) - this.return_data.forEach(element => {//资源状态列表显示数据转换 - if (element['gateStatus'] == '0') { - element['gateStatus'] = '可用' - return element['gateStatus']; - } - if(element['gateStatus'] == '1'){ - element['gateStatus'] = '在用' - return element['gateStatus']; - } - if(element['gateStatus'] == '2'){ - element['gateStatus'] = '锁定' - return element['gateStatus']; - } - if(element['gateStatus'] == '3'){ - element['gateStatus'] = '禁用' - return element['gateStatus']; - } - if(element['gateStatus'] = '4'){ - element['gateStatus'] = '预分' - return element['gateStatus']; - } - }); - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -197,50 +129,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -254,31 +178,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/stand/stand.component.html b/src/app/pages/basic-data/stand/stand.component.html index b9e84bf..aaac99d 100644 --- a/src/app/pages/basic-data/stand/stand.component.html +++ b/src/app/pages/basic-data/stand/stand.component.html @@ -5,11 +5,7 @@
-
- - -
@@ -34,9 +25,6 @@
@@ -77,7 +65,6 @@ 机位类型 资源状态 航站楼区域 - @@ -88,8 +75,7 @@ {{stand.standName}} {{stand.standType}} {{stand.standStatus}} - {{stand.terminalAreaName}} - + {{stand.terminalAreaCode|terminalArea}} diff --git a/src/app/pages/basic-data/stand/stand.component.ts b/src/app/pages/basic-data/stand/stand.component.ts index 19eaf52..c477319 100644 --- a/src/app/pages/basic-data/stand/stand.component.ts +++ b/src/app/pages/basic-data/stand/stand.component.ts @@ -1,175 +1,93 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; +import { BasicDataService } from '../../basic-data-service'; + import * as $ from 'jquery'; @Component({ - selector: 'app-stand', - templateUrl: './stand.component.html', - styleUrls: ['./stand.component.scss'] + selector: 'app-stand', + templateUrl: './stand.component.html', + styleUrls: ['./stand.component.scss'] }) export class StandComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'standCode', col_chn: '机位代码' }, + { col_code: 'standName', col_chn: '机位名称' }, + { col_code: 'standType', col_chn: '机位类型' }, + { col_code: 'standStatus', col_chn: '资源状态' }, + { col_code: 'terminalAreaCode', col_chn: '航站楼区域' }, + ] -//下拉框 -public filterItems = { - terminalAreaCode:'', - standType:'', - standStatus:'', -} + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -terminalAreas : Array; //所属航站楼区域 -stands : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.stands = this.basicDataService.stand; - this.basicDataService.stand_subject.subscribe( - data=>{ - this.stands = data; - this.render_data = this.stands; - if(this.terminalAreas && this.terminalAreas.length>0){//所属航站楼区域数据转换处理 - this.terminalAreasHandle(); + //下拉框 + public filterItems = { + terminalAreaCode: '', + standType: '', + standStatus: '', + } + + terminalAreas: Array; //所属航站楼区域 + stands: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + + ngOnInit() { + this.terminalAreas = this.basicDataService.terminal_area; + this.stands = this.basicDataService.stand; + this.render_data = this.basicDataService.stand; + this.basicDataService.stand_subject.subscribe( + data => { + this.stands = data; + this.render_data = data; } - this.render_data.forEach(element => {//机位类型列表显示数据转换 - if (element['standType'] == 'bridge') { - element['standType'] = '靠桥机位' - return element['standType']; - } - if(element['standType'] == 'remote'){ - element['standType'] = '远机位' - return element['standType']; - } - if(element['standType'] == 'near'){ - element['standType'] = '近机位' - return element['standType']; - } - if(element['standType'] == 'night'){ - element['standType'] = '过夜机位' - return element['standType']; - } - if(element['standType'] == 'specific'){ - element['standType'] = '专机位' - return element['standType']; - } - }); - this.render_data.forEach(element => {//资源状态列表显示数据转换 - if (element['standStatus'] == '0') { - element['standStatus'] = '可用' - return element['standStatus']; - } - if(element['standStatus'] == '1'){ - element['standStatus'] = '在用' - return element['standStatus']; - } - if(element['standStatus'] == '2'){ - element['standStatus'] = '锁定' - return element['standStatus']; - } - if(element['standStatus'] == '3'){ - element['standStatus'] = '禁用' - return element['standStatus']; - } - if(element['standStatus'] == '4'){ - element['standStatus'] = '预分' - return element['standStatus']; - } - }); + ) + this.basicDataService.terminal_area_subject.subscribe( + data => { + this.terminalAreas = data; + } + ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle() { + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; } - ) - //所属航站楼区域 - this.terminalAreas = this.basicDataService.terminal_area; - this.basicDataService.terminal_area_subject.subscribe( - data=>{ - this.terminalAreas = data; + tableCont.addEventListener('scroll', scrollHandle); + } + + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.inputPosition(this.render_data) } - ) + } + /** - * 固定表头 + * 选中某行 + * @param i */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + selectRow(i) { + this.row_state = i; } - tableCont.addEventListener('scroll',scrollHandle); -} -//所属航站楼区域数据转换处理 -terminalAreasHandle() { - this.render_data.forEach(item => { - let terminalAreasLinkIndex = this.terminalAreas.findIndex(val => val.terminalAreaCode === item['terminalAreaCode']); - item['terminalAreaName'] = this.terminalAreas[terminalAreasLinkIndex].terminalAreaName; - }) -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.stands) - } else { - this.inputFilter(this.stands) - this.inputPosition(this.stands) - } -} - -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//下拉框选择筛选 -selectChange() { - this.return_data = this.stands.filter(item=>{ + //下拉框选择筛选 + selectChange() { + this.render_data = this.stands.filter(item => { let is_satis = true; - //资源状态 - if (item['standStatus'] == '可用') { - item['standStatus'] = '0' - } - if(item['standStatus'] == '在用'){ - item['standStatus'] = '1' - } - if(item['standStatus'] == '锁定'){ - item['standStatus'] = '2' - } - if(item['standStatus'] == '禁用'){ - item['standStatus'] = '3' - } - if(item['standStatus'] == '预分'){ - item['standStatus'] = '4' - } - //机位类型 - if (item['standType'] == '靠桥机位') { - item['standType'] = 'bridge' - } - if(item['standType'] == '远机位'){ - item['standType'] = 'remote' - } - if(item['standType'] == '近机位'){ - item['standType'] = 'near' - } - if(item['standType'] == '过夜机位'){ - item['standType'] = 'night' - } - if(item['standType'] == '专机位'){ - item['standType'] = 'specific' - } 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]) { + if (item[key] == this.filterItems[key]) { is_satis = true; continue; } else { @@ -179,80 +97,36 @@ selectChange() { } } return is_satis; - }) - this.return_data.forEach(element => { //机位类型列表显示数据转换 - if (element['standType'] == 'bridge') { - element['standType'] = '靠桥机位' - return element['standType']; - } - if(element['standType'] == 'remote'){ - element['standType'] = '远机位' - return element['standType']; - } - if(element['standType'] == 'near'){ - element['standType'] = '近机位' - return element['standType']; - } - if(element['standType'] == 'night'){ - element['standType'] = '过夜机位' - return element['standType']; - } - if(element['standType'] == 'specific'){ - element['standType'] = '专机位' - return element['standType']; - } - }); - this.return_data.forEach(element => { //资源状态列表显示数据转换 - if (element['standStatus'] == '0') { - element['standStatus'] = '可用' - return element['standStatus']; - } - if(element['standStatus'] == '1'){ - element['standStatus'] = '在用' - return element['standStatus']; - } - if(element['standStatus'] == '2'){ - element['standStatus'] = '锁定' - return element['standStatus']; - } - if(element['standStatus'] == '3'){ - element['standStatus'] = '禁用' - return element['standStatus']; - } - if(element['standStatus'] == '4'){ - element['standStatus'] = '预分' - return element['standStatus']; - } - }); - 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; - } - } - }) - + }) + if (this.FLT_POS === 1) { + this.inputFilter(this.render_data); } 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'))) { + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + } + } + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -260,50 +134,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -317,31 +183,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/terminal-area/terminal-area.component.html b/src/app/pages/basic-data/terminal-area/terminal-area.component.html index 833c417..0bda148 100644 --- a/src/app/pages/basic-data/terminal-area/terminal-area.component.html +++ b/src/app/pages/basic-data/terminal-area/terminal-area.component.html @@ -5,8 +5,7 @@
-
- - -
@@ -34,7 +28,6 @@ 序号 航站楼区域代码 航站楼区域名称 - @@ -43,7 +36,6 @@ {{i+1}} {{terminalArea.terminalAreaCode}} {{terminalArea.terminalAreaName}} - diff --git a/src/app/pages/basic-data/terminal-area/terminal-area.component.ts b/src/app/pages/basic-data/terminal-area/terminal-area.component.ts index 08f6038..d8bfbb2 100644 --- a/src/app/pages/basic-data/terminal-area/terminal-area.component.ts +++ b/src/app/pages/basic-data/terminal-area/terminal-area.component.ts @@ -1,117 +1,92 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; -import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; +import { BasicDataService } from '../../basic-data-service'; import * as $ from 'jquery'; @Component({ - selector: 'app-terminal-area', - templateUrl: './terminal-area.component.html', - styleUrls: ['./terminal-area.component.scss'] + selector: 'app-terminal-area', + templateUrl: './terminal-area.component.html', + styleUrls: ['./terminal-area.component.scss'] }) export class TerminalAreaComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'terminalAreaCode', col_chn: '航站楼区域代码' }, + { col_code: 'terminalAreaName', col_chn: '航站楼区域名称' } + ]; -//下拉框 -public filterItems = { - -} + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -terminalAreas : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.terminalAreas = this.basicDataService.terminal_area; - this.basicDataService.terminal_area_subject.subscribe( - data=>{ - this.terminalAreas = data; - this.render_data = this.terminalAreas; - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); -} -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} + terminalAreas: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.terminalAreas) - } else { - this.inputFilter(this.terminalAreas) - this.inputPosition(this.terminalAreas) - } -} - -//下拉框选择筛选 -selectChange() { - this.return_data = this.terminalAreas.filter(item=>{ - let is_satis = true; - 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; - } - } + ngOnInit() { + this.terminalAreas = this.basicDataService.terminal_area; + this.render_data = this.basicDataService.terminal_area; + this.basicDataService.terminal_area_subject.subscribe( + data => { + this.terminalAreas = data; + this.render_data = data; } - return is_satis; - }) - this.render_data = this.return_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); + } -//输入框筛选 -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; - } - } - }) + /** + * 选中某行 + * @param i + */ + selectRow(i) { + this.row_state = i; + } + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.inputFilter(this.terminalAreas) } 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'))) { + this.inputPosition(this.render_data) + } + } + + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -119,50 +94,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -176,31 +143,30 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } + } } diff --git a/src/app/pages/basic-data/terminal/terminal.component.html b/src/app/pages/basic-data/terminal/terminal.component.html index 1e86894..ea59d66 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.html +++ b/src/app/pages/basic-data/terminal/terminal.component.html @@ -5,8 +5,7 @@
-
- - -
@@ -34,7 +28,6 @@ 序号 航站楼代码 航站楼名称 - @@ -43,7 +36,6 @@ {{i+1}} {{terminal.terminalCode}} {{terminal.terminalName}} - diff --git a/src/app/pages/basic-data/terminal/terminal.component.ts b/src/app/pages/basic-data/terminal/terminal.component.ts index 89663bb..4e9c9db 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.ts +++ b/src/app/pages/basic-data/terminal/terminal.component.ts @@ -1,117 +1,92 @@ import { Component, OnInit } from '@angular/core'; -import { HttpClientService } from '../../../services/http-client.service'; import { BasicDataService } from '../../basic-data-service' -import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; + @Component({ - selector: 'app-terminal', - templateUrl: './terminal.component.html', - styleUrls: ['./terminal.component.scss'] + selector: 'app-terminal', + templateUrl: './terminal.component.html', + styleUrls: ['./terminal.component.scss'] }) export class TerminalComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService -) { } + constructor( + private basicDataService: BasicDataService + ) { } -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 + public col_lists = [ + { col_code: 'terminalCode', col_chn: '航站楼代码' }, + { col_code: 'terminalName', col_chn: '航站楼名称' } + ] -//下拉框 -public filterItems = { - -} + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -terminals : Array; -public row_state: any = { renderFlight: {} }; -public render_data: Array = []; //显示数据,即需要显示的数据 -public return_data: Array = []; //下拉框显示数据 -ngOnInit() { - this.terminals = this.basicDataService.terminal; - this.basicDataService.terminal_subject.subscribe( - data=>{ - this.terminals = data; - this.render_data = this.terminals; - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); -} + terminals: Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 -/** - * 选中某行 - * @param i - */ -selectRow(i) { - this.row_state = i; -} - -//输入框回车事件 -inputEnter() { - if (this.FLT_POS === 1) { - this.inputFilter(this.terminals) - } else { - this.inputFilter(this.terminals) - this.inputPosition(this.terminals) - } -} - -//下拉框选择筛选 -selectChange() { - this.return_data = this.terminals.filter(item=>{ - let is_satis = true; - 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; - } - } + ngOnInit() { + this.terminals = this.basicDataService.terminal; + this.render_data = this.basicDataService.terminal; + this.basicDataService.terminal_subject.subscribe( + data => { + this.terminals = data; + this.render_data = data; } - return is_satis; - }) - this.render_data = this.return_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); + } -//输入框筛选 -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; - } - } - }) + /** + * 选中某行 + * @param i + */ + selectRow(i) { + this.row_state = i; + } + //输入框回车事件 + inputEnter() { + if (this.FLT_POS === 1) { + this.inputFilter(this.terminals) } 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'))) { + this.inputPosition(this.render_data) + } + } + + + //输入框筛选 + inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + this.render_data = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + return false; + } + }) + + } else { + this.render_data = filterData.filter(item => { + let is_satis = false; + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (item[cols[i].col_code]) { + if (item[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -119,50 +94,42 @@ inputFilter(filterData) { continue; } } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } - } else { - continue; } - } - return is_satis; - }) + return is_satis; + }) + } + } else { + this.render_data = filterData; } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; -} -positionArray: Array = []; -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) + positionArray: Array = []; + 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 { - 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'))) { + }); + } else { + filterData.forEach(element => { + let cols = this.col_lists; + for (let i = 0; i < cols.length; i++) { + if (element[cols[i].col_code]) { + if (element[cols[i].col_code].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -176,31 +143,29 @@ inputPosition(filterData) { break; } } - - } else { - continue; } - } - }); - } + }); + } - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { + 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]; } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + alert('没有搜索到相关数据'); } - } else { - alert('没有搜索到相关数据'); - } let tr = $(".selected"); let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + if (objTr) { + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } } } diff --git a/src/app/pages/main/main.module.ts b/src/app/pages/main/main.module.ts index 759e671..ff8684e 100644 --- a/src/app/pages/main/main.module.ts +++ b/src/app/pages/main/main.module.ts @@ -3,7 +3,6 @@ import { CommonModule } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { NgZorroAntdModule } from 'ng-zorro-antd' -import { PipesModule } from '../../pipes/pipes.module'; import { MainComponent } from './main.component'; import { MainRoutingModule } from './main-routing.module'; import { RelatedTabComponent } from './related-tab/related-tab.component'; @@ -18,7 +17,6 @@ import { SpecialTabComponent } from './special-tab/special-tab.component'; FormsModule, ReactiveFormsModule, NgZorroAntdModule, - PipesModule, MainRoutingModule ], declarations: [ diff --git a/src/app/pages/pages.component.ts b/src/app/pages/pages.component.ts index 5cbe838..07d47c5 100644 --- a/src/app/pages/pages.component.ts +++ b/src/app/pages/pages.component.ts @@ -18,7 +18,7 @@ import { filter } from 'rxjs/operators'; }) export class PagesComponent implements OnInit { public menuClose: boolean = false; - public isSpinning: any = true; + public isSpinning: any = false; menuData = [ { "name": "航班动态", diff --git a/src/app/pages/system-management/department-management/department-management.component.ts b/src/app/pages/system-management/department-management/department-management.component.ts index 6ac6591..8353b02 100644 --- a/src/app/pages/system-management/department-management/department-management.component.ts +++ b/src/app/pages/system-management/department-management/department-management.component.ts @@ -75,8 +75,8 @@ export class DepartmentManagementComponent implements OnInit { treeSave(){ if(this.treeSelectedChild){ this.orgSeleted=this.treeSelectedChild; - this.visible = false; - this.orgSeletedBtn=false; + // this.visible = false; + // this.orgSeletedBtn=false; }else{ //如果没有选择机构,提示请选择机构 this.message.create('warning', `请选择所属机构!`,{ nzDuration: 2000 }); @@ -85,15 +85,15 @@ export class DepartmentManagementComponent implements OnInit { //打开机构树抽屉 open(): void { this.treeSelectedChild=''; - this.visible = true; + // this.visible = true; } //关闭机构选择页面 close(): void { - this.visible = false; + // this.visible = false; } //删除机构标签 tagClose(event){ - this.orgSeletedBtn=true; + // this.orgSeletedBtn=true; this.orgSeleted=''; } //修改时查询该系统下的所有用户 diff --git a/src/app/pipes/basic-data-pipes/basic-data-pipes.module.spec.ts b/src/app/pipes/basic-data-pipes/basic-data-pipes.module.spec.ts new file mode 100644 index 0000000..4ca8134 --- /dev/null +++ b/src/app/pipes/basic-data-pipes/basic-data-pipes.module.spec.ts @@ -0,0 +1,13 @@ +import { BasicDataPipesModule } from './basic-data-pipes.module'; + +describe('BasicDataPipesModule', () => { + let basicDataPipesModule: BasicDataPipesModule; + + beforeEach(() => { + basicDataPipesModule = new BasicDataPipesModule(); + }); + + it('should create an instance', () => { + expect(basicDataPipesModule).toBeTruthy(); + }); +}); diff --git a/src/app/pipes/basic-data-pipes/basic-data-pipes.module.ts b/src/app/pipes/basic-data-pipes/basic-data-pipes.module.ts new file mode 100644 index 0000000..09cabe4 --- /dev/null +++ b/src/app/pipes/basic-data-pipes/basic-data-pipes.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { TerminalAreaPipe } from './terminal-area.pipe'; +import { GateStatusPipe } from './gate-status.pipe'; + +@NgModule({ + imports: [ + CommonModule + ], + declarations: [TerminalAreaPipe, GateStatusPipe], + exports: [TerminalAreaPipe, GateStatusPipe] +}) +export class BasicDataPipesModule { } diff --git a/src/app/pipes/basic-data-pipes/gate-status.pipe.spec.ts b/src/app/pipes/basic-data-pipes/gate-status.pipe.spec.ts new file mode 100644 index 0000000..309ba60 --- /dev/null +++ b/src/app/pipes/basic-data-pipes/gate-status.pipe.spec.ts @@ -0,0 +1,8 @@ +import { GateStatusPipe } from './gate-status.pipe'; + +describe('GateStatusPipe', () => { + it('create an instance', () => { + const pipe = new GateStatusPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/src/app/pipes/basic-data-pipes/gate-status.pipe.ts b/src/app/pipes/basic-data-pipes/gate-status.pipe.ts new file mode 100644 index 0000000..80c7601 --- /dev/null +++ b/src/app/pipes/basic-data-pipes/gate-status.pipe.ts @@ -0,0 +1,17 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'gateStatus' +}) +export class GateStatusPipe implements PipeTransform { + + transform(value: any, args?: any): any { + if(value){ + + }else{ + return null; + } + + } + +} diff --git a/src/app/pipes/basic-data-pipes/terminal-area.pipe.spec.ts b/src/app/pipes/basic-data-pipes/terminal-area.pipe.spec.ts new file mode 100644 index 0000000..04ca76b --- /dev/null +++ b/src/app/pipes/basic-data-pipes/terminal-area.pipe.spec.ts @@ -0,0 +1,8 @@ +import { TerminalAreaPipe } from './terminal-area.pipe'; + +describe('TerminalAreaPipe', () => { + it('create an instance', () => { + const pipe = new TerminalAreaPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/src/app/pipes/basic-data-pipes/terminal-area.pipe.ts b/src/app/pipes/basic-data-pipes/terminal-area.pipe.ts new file mode 100644 index 0000000..1c63cae --- /dev/null +++ b/src/app/pipes/basic-data-pipes/terminal-area.pipe.ts @@ -0,0 +1,22 @@ +import { Pipe, PipeTransform, OnInit } from '@angular/core'; +import { BasicDataService } from '../../pages/basic-data-service'; + +@Pipe({ + name: 'terminalArea' +}) +export class TerminalAreaPipe implements PipeTransform { + constructor( + private basicDataService: BasicDataService + ) { } + + transform(value: any, args?: any): any { + let terminal_area = this.basicDataService.terminal_area.find(val => val.terminalAreaCode === value) + if (terminal_area) { + return terminal_area.terminalAreaName + } else { + return null; + } + + } + +} diff --git a/src/app/pipes/pipes.module.ts b/src/app/pipes/pipes.module.ts deleted file mode 100644 index a3b30c3..0000000 --- a/src/app/pipes/pipes.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NgModule } from '@angular/core'; - -@NgModule({ - imports: [], - declarations: [ - ], - exports: [ - ] -}) - -export class PipesModule { } \ No newline at end of file