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 2dd8cfa..cfcdf95 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,6 +5,19 @@
@@ -61,7 +74,8 @@ - + {{i+1}} {{aircraftType.aircraftTypeCode}} {{aircraftType.aircraftTypeName}} 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 26adbb0..a5a191c 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 @@ -48,13 +48,21 @@ ngOnInit() { 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.render_data) + this.inputPosition(this.aircraftTypes) } } @@ -191,5 +199,8 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } + let tr = $(".selected"); + let objTr = tr[0]; + $("#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 50fd68f..ef98737 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.html +++ b/src/app/pages/basic-data/aircraft/aircraft.component.html @@ -5,6 +5,14 @@
- - - - +
- - - - - +
@@ -63,7 +68,8 @@ - + {{i+1}} {{aircraft.aircraftNumber}} {{aircraft.maxPassengers}} @@ -71,8 +77,8 @@ {{aircraft.maxTakeoffWeight}} {{aircraft.maxAirbridges}} {{aircraft.aircraftOwnerCode}} - {{aircraft.airlineCode}} - {{aircraft.aircraftTypeCode}} + {{aircraft.airlineName}} + {{aircraft.aircraftTypeName}} diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.ts b/src/app/pages/basic-data/aircraft/aircraft.component.ts index 889e4cf..3704c1a 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.ts +++ b/src/app/pages/basic-data/aircraft/aircraft.component.ts @@ -20,17 +20,47 @@ SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 +//下拉框 +public filterItems = { + airlineCode:'', + aircraftTypeCode:'', +} +airlines : Array; //航空公司 +aircraftTypes : Array; //机型 aircrafts : Array; public row_state: any = { renderFlight: {} }; public render_data: Array = []; //显示数据,即需要显示的数据 +public return_data: Array = []; //下拉框显示数据 + 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(); + } + if(this.airlines && this.airlines.length > 0){//航空公司数据处理 + this.basicDataAirlinesHandle(); + } } ) + //航空公司 + 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; + } + ) + /** * 固定表头 */ @@ -42,113 +72,61 @@ ngOnInit() { tableCont.addEventListener('scroll',scrollHandle); } -//刷新 -clearFiter(){ - $("#inputerInfo").val(""); //清空过滤或查找定位文本框 - $("#airlineCompany").val(""); //清空航空公司 - $("#jx").val(""); //清空机型 - this.ngOnInit(); +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.selectChange() -} else { - this.selectChange() - this.inputPosition(this.render_data) -} + if (this.FLT_POS === 1) { + this.inputFilter(this.aircrafts) + } else { + this.inputFilter(this.aircrafts) + this.inputPosition(this.aircrafts) + } } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filteraircrafts = this.render_data; - this.render_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } else { - this.aircrafts = filter_data; - this.row_state = this.aircrafts.length > 0 ? this.aircrafts[0] : { renderFlight: {} }; - } - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { + this.return_data = this.aircrafts.filter(item=>{ let is_satis = true; - for (const key in filteraircrafts) { - if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) { - if (item[key] === filteraircrafts[key]) { + for (const key in this.filterItems) { + if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { + if (item[key] === this.filterItems[key]) { is_satis = true; continue; } else { is_satis = false; break; } - } } return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filteraircrafts) { - if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) { - if (item[key] === filteraircrafts[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filteraircrafts) { - if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) { - if (item[key] === filteraircrafts[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filteraircrafts) { - if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) { - if (item[key] === filteraircrafts[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item = item; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item = item; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } }) - } + this.render_data = this.return_data; +} - //输入框筛选 - inputFilter(filterData) { +//输入框筛选 +inputFilter(filterData) { if (this.SEARCH) { if (this.SEL_COL) { let sel_col = this.SEL_COL; @@ -196,14 +174,14 @@ selectChange() { }) } } - this.aircrafts = filterData; - this.row_state = this.aircrafts.length > 0 ? this.aircrafts[0] : { renderFlight: {} }; - } + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; +} - positionArray: Array = []; - positionArrayIndex: number = 0; - //输入框定位 - inputPosition(filterData) { +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { let transArray = [] if (this.SEL_COL) { let sel_col = this.SEL_COL; @@ -260,5 +238,8 @@ selectChange() { } else { alert('没有搜索到相关数据'); } + let tr = $(".selected"); + let objTr = tr[0]; + $("#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 5fde90d..875b9c8 100644 --- a/src/app/pages/basic-data/airline/airline.component.html +++ b/src/app/pages/basic-data/airline/airline.component.html @@ -5,6 +5,15 @@
@@ -36,7 +45,7 @@
- @@ -63,7 +72,8 @@ - + {{i+1}} {{airline.airlineCode}} {{airline.airlineName}} diff --git a/src/app/pages/basic-data/airline/airline.component.ts b/src/app/pages/basic-data/airline/airline.component.ts index 114b9a2..6ce491b 100644 --- a/src/app/pages/basic-data/airline/airline.component.ts +++ b/src/app/pages/basic-data/airline/airline.component.ts @@ -10,43 +10,51 @@ import * as $ from 'jquery'; }) export class AirlineComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private basicDataService: BasicDataService - ) { } +constructor( + private httpCilent: HttpClientService, + private basicDataService: BasicDataService +) { } - // 搜索条件 - SEARCH = ''; //手动输入条件 - FLT_POS = 1; //过滤还是定位 - SEL_COL = ''; //选择列名 +// 搜索条件 +SEARCH = ''; //手动输入条件 +FLT_POS = 1; //过滤还是定位 +SEL_COL = ''; //选择列名 - 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; - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; +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; } - tableCont.addEventListener('scroll',scrollHandle); + ) + /** + * 固定表头 + */ + 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; +} //输入框回车事件 inputEnter() { @@ -54,7 +62,7 @@ inputEnter() { this.inputFilter(this.airlines) } else { this.inputFilter(this.airlines) - // this.inputPosition(this.render_data) + this.inputPosition(this.airlines) } } @@ -62,7 +70,7 @@ inputEnter() { selectChange() { this.return_data = this.airlines.filter(item=>{ let is_satis = true; - for (const key in this.filterItems) {debugger + for (const key in this.filterItems) { if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { if (item[key] === this.filterItems[key]) { is_satis = true; @@ -191,5 +199,8 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } + let tr = $(".selected"); + let objTr = tr[0]; + $("#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 a406903..6cd49cc 100644 --- a/src/app/pages/basic-data/airport/airport.component.html +++ b/src/app/pages/basic-data/airport/airport.component.html @@ -5,6 +5,16 @@
@@ -42,7 +52,7 @@ - + @@ -68,7 +78,8 @@ - + {{i+1}} {{airport.airportCode}} {{airport.airportNameChn}} @@ -79,7 +90,7 @@ {{airport.airportCodeCaa}} {{airport.airportCodeIcao}} {{airport.airportGroupId}} - {{airport.cityId}} + {{airport.cityName}} diff --git a/src/app/pages/basic-data/airport/airport.component.ts b/src/app/pages/basic-data/airport/airport.component.ts index d2530d8..907c277 100644 --- a/src/app/pages/basic-data/airport/airport.component.ts +++ b/src/app/pages/basic-data/airport/airport.component.ts @@ -25,7 +25,7 @@ public filterItems = { airportGroupId:'', cityId:'', } - +citys : Array; //城市 airports : Array; public row_state: any = { renderFlight: {} }; public render_data: Array = []; //显示数据,即需要显示的数据 @@ -37,6 +37,16 @@ ngOnInit() { data=>{ this.airports = data; this.render_data = this.airports; + if(this.citys && this.citys.length > 0){//所在城市列表数据转换 + this.basicDataTransHandle(); + } + } + ) + //城市 + this.citys = this.basicDataService.city; + this.basicDataService.city_subject.subscribe( + data=>{ + this.citys = data; } ) /** @@ -49,13 +59,30 @@ ngOnInit() { } 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.render_data) + this.inputPosition(this.airports) } } @@ -65,7 +92,7 @@ selectChange() { 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] || item[key] === this.filterItems[key]) { is_satis = true; continue; } else { @@ -192,5 +219,8 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); } } diff --git a/src/app/pages/basic-data/carousel/carousel.component.html b/src/app/pages/basic-data/carousel/carousel.component.html index 2fbc36f..efaeb05 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.html +++ b/src/app/pages/basic-data/carousel/carousel.component.html @@ -5,6 +5,10 @@
@@ -28,7 +32,7 @@ - - + + + + + + @@ -60,11 +67,12 @@ - + {{i+1}} {{carousel.carouselCode}} {{carousel.carouselName}} - {{carousel.terminalAreaCode}} + {{carousel.terminalAreaName}} {{carousel.carouselStatus}} diff --git a/src/app/pages/basic-data/carousel/carousel.component.ts b/src/app/pages/basic-data/carousel/carousel.component.ts index 48a2196..20bd5c2 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.ts +++ b/src/app/pages/basic-data/carousel/carousel.component.ts @@ -25,6 +25,7 @@ public filterItems = { terminalAreaCode:'', carouselStatus:'', } +terminalAreas:Array; //所属航站楼区域 carousels:Array; public row_state: any = { renderFlight: {} }; public render_data: Array = []; //显示数据,即需要显示的数据 @@ -35,6 +36,38 @@ ngOnInit() { data=>{ this.carousels = data; this.render_data = this.carousels; + if(this.terminalAreas && this.terminalAreas.length > 0){//所属航站楼区域数据显示处理 + this.terminalAreasHandle(); + } + 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.terminalAreas = this.basicDataService.terminal_area; + this.basicDataService.terminal_area_subject.subscribe( + data=>{ + this.terminalAreas = data; } ) /** @@ -48,13 +81,29 @@ ngOnInit() { 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.render_data) + this.inputPosition(this.carousels) } } @@ -62,9 +111,24 @@ inputEnter() { selectChange() { this.return_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]) { + if (item[key] === +this.filterItems[key] || item[key] === this.filterItems[key]) { is_satis = true; continue; } else { @@ -75,6 +139,28 @@ 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; } @@ -191,5 +277,8 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } + let tr = $(".selected"); + let objTr = tr[0]; + $("#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 a78066f..6a9708d 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,6 +5,11 @@
- - - + +
- - - + +
- - - + +
@@ -69,13 +77,14 @@ - + {{i+1}} {{checkinDesk.checkindeskCode}} {{checkinDesk.checkindeskName}} - {{checkinDesk.checkinGroupCode}} - {{checkinDesk.chutCode}} - {{checkinDesk.terminalAreaCode}} + {{checkinDesk.checkinGroupName}} + {{checkinDesk.chutName}} + {{checkinDesk.terminalAreaName}} 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 f244420..b885d0c 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 @@ -20,15 +20,56 @@ SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 +//下拉框 +public filterItems = { + terminalAreaCode:'', + checkinGroupCode:'', + chutCode:'', +} + +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(); + } + if(this.checkinGroups && this.checkinGroups.length>0){//值机岛数据转换处理 + this.checkinGroupsHandle(); + } + if(this.checkinGroups && this.checkinGroups.length>0){//行李传送带数据转换处理 + this.chutsHandle(); + } + } + ) + //所属航站楼区域 + 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; } ) /** @@ -42,114 +83,76 @@ ngOnInit() { tableCont.addEventListener('scroll',scrollHandle); } -//刷新 -clearFiter(){ - $("#inputerInfo").val(""); //清空过滤或查找定位文本框 - $("#qy").val(""); //清空所属航站楼区域 - $("#zjd").val(""); //清空值机岛 - $("#xl").val(""); //清空行李传送带 - this.ngOnInit(); +//所属航站楼区域数据转换处理 +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; + } + }) +} + +//行李传送带数据转换处理 +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.selectChange() -} else { - this.selectChange() - this.inputPosition(this.render_data) -} + if (this.FLT_POS === 1) { + this.inputFilter(this.checkinDesks) + } else { + this.inputFilter(this.checkinDesks) + this.inputPosition(this.checkinDesks) + } } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filtercheckinDesks = this.render_data; - this.render_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } else { - this.checkinDesks = filter_data; - this.row_state = this.checkinDesks.length > 0 ? this.checkinDesks[0] : { renderFlight: {} }; - } - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { + this.return_data = this.checkinDesks.filter(item=>{ let is_satis = true; - for (const key in filtercheckinDesks) { - if (filtercheckinDesks.hasOwnProperty(key) && filtercheckinDesks[key]) { - if (item[key] === filtercheckinDesks[key]) { + for (const key in this.filterItems) { + if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { + if (item[key] === this.filterItems[key]) { is_satis = true; continue; } else { is_satis = false; break; } - } } return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filtercheckinDesks) { - if (filtercheckinDesks.hasOwnProperty(key) && filtercheckinDesks[key]) { - if (item[key] === filtercheckinDesks[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filtercheckinDesks) { - if (filtercheckinDesks.hasOwnProperty(key) && filtercheckinDesks[key]) { - if (item[key] === filtercheckinDesks[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filtercheckinDesks) { - if (filtercheckinDesks.hasOwnProperty(key) && filtercheckinDesks[key]) { - if (item[key] === filtercheckinDesks[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item = item; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item = item; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } }) - } + this.render_data = this.return_data; +} - //输入框筛选 - inputFilter(filterData) { +//输入框筛选 +inputFilter(filterData) { if (this.SEARCH) { if (this.SEL_COL) { let sel_col = this.SEL_COL; @@ -197,14 +200,14 @@ selectChange() { }) } } - this.checkinDesks = filterData; - this.row_state = this.checkinDesks.length > 0 ? this.checkinDesks[0] : { renderFlight: {} }; - } + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; +} - positionArray: Array = []; - positionArrayIndex: number = 0; - //输入框定位 - inputPosition(filterData) { +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { let transArray = [] if (this.SEL_COL) { let sel_col = this.SEL_COL; @@ -261,5 +264,8 @@ selectChange() { } else { alert('没有搜索到相关数据'); } + let tr = $(".selected"); + let objTr = tr[0]; + $("#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 9eb8af7..2f4bbbf 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,6 +5,8 @@
@@ -36,7 +38,8 @@ - + {{i+1}} {{checkinGroup.checkinGroupCode}} {{checkinGroup.checkinGroupName}} 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 553b222..fbae15b 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 @@ -20,9 +20,15 @@ SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 +//下拉框 +public filterItems = { + +} + 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( @@ -42,221 +48,159 @@ ngOnInit() { tableCont.addEventListener('scroll',scrollHandle); } -//刷新 -clearFiter(){ - $("#inputerInfo").val(""); //清空过滤或查找定位文本框 - this.ngOnInit(); +/** + * 选中某行 + * @param i + */ +selectRow(i) { + this.row_state = i; } + //输入框回车事件 inputEnter() { -if (this.FLT_POS === 1) { - this.selectChange() -} else { - this.selectChange() - this.inputPosition(this.render_data) -} + if (this.FLT_POS === 1) { + this.inputFilter(this.checkinGroups) + } else { + this.inputFilter(this.checkinGroups) + this.inputPosition(this.checkinGroups) + } } //下拉框选择筛选 selectChange() { -let filter_data = []; -let filtercheckinGroups = this.render_data; -this.render_data.forEach(item => { - filter_data.push(Object.assign({}, item)); -}) -if (this.FLT_POS === 1) { - this.inputFilter(filter_data); -} else { - this.checkinGroups = filter_data; - this.row_state = this.checkinGroups.length > 0 ? this.checkinGroups[0] : { renderFlight: {} }; -} -//下拉框筛选 -filter_data = filter_data.filter(item => { - if (item) { - let is_satis = true; - for (const key in filtercheckinGroups) { - if (filtercheckinGroups.hasOwnProperty(key) && filtercheckinGroups[key]) { - if (item[key] === filtercheckinGroups[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; + 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; + } } - } - } - return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filtercheckinGroups) { - if (filtercheckinGroups.hasOwnProperty(key) && filtercheckinGroups[key]) { - if (item[key] === filtercheckinGroups[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filtercheckinGroups) { - if (filtercheckinGroups.hasOwnProperty(key) && filtercheckinGroups[key]) { - if (item[key] === filtercheckinGroups[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filtercheckinGroups) { - if (filtercheckinGroups.hasOwnProperty(key) && filtercheckinGroups[key]) { - if (item[key] === filtercheckinGroups[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item = item; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item = item; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } -}) + 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; - } - } - }) - - } else { - filterData = filterData.filter(item => { - let is_satis = false; - for (const key in item) { - if (item.hasOwnProperty(key)) { - if (item[key]) { - if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { - is_satis = true; - break; - } else { - is_satis = false; - continue; - } - } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + 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 { - continue; + if (this.SEARCH) { + return false; + } else { + return true; + } } - } - return is_satis; - }) + }) + + } else { + filterData = filterData.filter(item => { + let is_satis = false; + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { + is_satis = true; + break; + } else { + is_satis = false; + continue; + } + } else { + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } + } + } else { + continue; + } + } + return is_satis; + }) + } } -} -this.checkinGroups = filterData; -this.row_state = this.checkinGroups.length > 0 ? this.checkinGroups[0] : { renderFlight: {} }; + 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) - } - } else { - if (!this.SEARCH) { - transArray.push(element) - } - } - }); -} else { - filterData.forEach(element => { - for (const key in element) { - if (element.hasOwnProperty(key)) { - if (element[key]) { - if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { - transArray.push(element) - break; - } else { - continue; - } - } else { - if (this.SEARCH) { - continue; - } else { - transArray.push(element) - break; - } + 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 { - continue; + if (!this.SEARCH) { + transArray.push(element) + } } - } - }); -} - -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]; + filterData.forEach(element => { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } + + } else { + continue; + } + } + }); + } + + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); } -} else { - alert('没有搜索到相关数据'); -} -} } diff --git a/src/app/pages/basic-data/chut/chut.component.html b/src/app/pages/basic-data/chut/chut.component.html index 254b85a..0465f84 100644 --- a/src/app/pages/basic-data/chut/chut.component.html +++ b/src/app/pages/basic-data/chut/chut.component.html @@ -5,6 +5,8 @@
@@ -36,7 +38,8 @@ - + {{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 9b382df..351c86e 100644 --- a/src/app/pages/basic-data/chut/chut.component.ts +++ b/src/app/pages/basic-data/chut/chut.component.ts @@ -20,9 +20,15 @@ SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 +//下拉框 +public filterItems = { + +} + 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( @@ -42,160 +48,95 @@ ngOnInit() { tableCont.addEventListener('scroll',scrollHandle); } -//刷新 -clearFiter(){ - $("#inputerInfo").val(""); //清空过滤或查找定位文本框 - this.ngOnInit(); +/** + * 选中某行 + * @param i + */ +selectRow(i) { + this.row_state = i; } + //输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { - this.selectChange() + this.inputFilter(this.chuts) } else { - this.selectChange() - this.inputPosition(this.render_data) + this.inputFilter(this.chuts) + this.inputPosition(this.chuts) } } //下拉框选择筛选 selectChange() { -let filter_data = []; -let filterchuts = this.render_data; -this.render_data.forEach(item => { - filter_data.push(Object.assign({}, item)); -}) -if (this.FLT_POS === 1) { - this.inputFilter(filter_data); -} else { - this.chuts = filter_data; - this.row_state = this.chuts.length > 0 ? this.chuts[0] : { renderFlight: {} }; -} -//下拉框筛选 -filter_data = filter_data.filter(item => { - if (item) { - let is_satis = true; - for (const key in filterchuts) { - if (filterchuts.hasOwnProperty(key) && filterchuts[key]) { - if (item[key] === filterchuts[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; + 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; + } } - } - } - return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterchuts) { - if (filterchuts.hasOwnProperty(key) && filterchuts[key]) { - if (item[key] === filterchuts[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterchuts) { - if (filterchuts.hasOwnProperty(key) && filterchuts[key]) { - if (item[key] === filterchuts[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterchuts) { - if (filterchuts.hasOwnProperty(key) && filterchuts[key]) { - if (item[key] === filterchuts[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item = item; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item = item; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } -}) + 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; - } - } - }) - - } else { - filterData = filterData.filter(item => { - let is_satis = false; - for (const key in item) { - if (item.hasOwnProperty(key)) { - if (item[key]) { - if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { - is_satis = true; - break; - } else { - is_satis = false; - continue; - } - } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + 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 { - continue; + if (this.SEARCH) { + return false; + } else { + return true; + } } - } - return is_satis; - }) + }) + + } else { + filterData = filterData.filter(item => { + let is_satis = false; + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { + is_satis = true; + break; + } else { + is_satis = false; + continue; + } + } else { + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } + } + } else { + continue; + } + } + return is_satis; + }) + } } -} - this.chuts = filterData; - this.row_state = this.chuts.length > 0 ? this.chuts[0] : { renderFlight: {} }; + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; } positionArray: Array = []; @@ -258,5 +199,8 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } + let tr = $(".selected"); + let objTr = tr[0]; + $("#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 fa31878..4dc6a79 100644 --- a/src/app/pages/basic-data/city/city.component.html +++ b/src/app/pages/basic-data/city/city.component.html @@ -5,6 +5,10 @@
-
+
- - - + +
-