
<div class="select-content">
<div class="nameShow" title="{{item.name}}"
[innerHTML]="item.nameHtml">
</div>
<div class="deptName" title="{{item.deptName}}">
{{item.deptName}}
</div>
</div>
.select-content {
display: flex;
flex-direction: column;
width: 70%;
margin-left: 10%;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.nameShow {
width: 100%;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-top: 2px;
}
.deptName {
font-size: 14px;
text-align: left;
line-height: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #ccc;
margin-top: 2px;
}
}
if(th.personnelSearchKeyword){
th.rosterList =data.data
th.rosterList.forEach((item)=>{
if (item.hasOwnProperty("name") && item.name) {
var reg = new RegExp(th.personnelSearchKeyword.replace(/[-\[\]\/\{\}\
(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), "igm");
let html = item.name.replace(reg, (txt) => {
return '<span style="color:#18aeff;">' + txt + '</span>';
})
item.nameHtml = this.sanitizer.bypassSecurityTrustHtml(html);
} else {
item.nameHtml = "";
}
})
}