基础数据类型转换处理

This commit is contained in:
714943302@qq.com
2018-12-10 10:55:38 +08:00
parent 73dd1a5abd
commit 4e041d6714
8 changed files with 105 additions and 10 deletions
@@ -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