基础数据类型转换处理
This commit is contained in:
@@ -46,8 +46,17 @@ export class CityComponent implements OnInit {
|
||||
}
|
||||
)
|
||||
this.basicDataService.country_subject.subscribe(
|
||||
data => this.countrys = data
|
||||
data => {
|
||||
this.countrys = data
|
||||
if(this.countrys && this.countrys.length > 0){//国家列表数据转换
|
||||
this.basicDataTransHandle();
|
||||
}
|
||||
}
|
||||
)
|
||||
this.render_data.forEach(item => {//国家数据转换处理
|
||||
let countryLinkIndex = this.countrys.findIndex(val => val.countryId === item['countryId']);
|
||||
item['countryNameChn'] = this.countrys[countryLinkIndex].countryNameChn;
|
||||
})
|
||||
/**
|
||||
* 固定表头
|
||||
*/
|
||||
@@ -59,6 +68,13 @@ export class CityComponent implements OnInit {
|
||||
tableCont.addEventListener('scroll', scrollHandle);
|
||||
}
|
||||
|
||||
//国家数据转换处理
|
||||
basicDataTransHandle() {
|
||||
this.render_data.forEach(item => {
|
||||
let countryLinkIndex = this.countrys.findIndex(val => val.countryId === item['countryId']);
|
||||
item['countryNameChn'] = this.countrys[countryLinkIndex].countryNameChn;
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 选中某行
|
||||
* @param i
|
||||
|
||||
Reference in New Issue
Block a user