Commit 7f3c3588 authored by wangqinghua's avatar wangqinghua

update

parent f5b8b044
......@@ -10,7 +10,7 @@
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td nzShowCheckbox (nzCheckedChange)="selectItem($event,data)" [(nzChecked)]="data.checked"></td>
<td nzShowCheckbox (nzCheckedChange)="refreshStatus()" [(nzChecked)]="data.checked"></td>
<td>{{data.name}}</td>
<td>{{data.comments}}</td>
</tr>
......
......@@ -19,35 +19,21 @@ export class SelectRoleComponent implements OnInit {
indeterminate = false;
userId;
userRoleList = [];
displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = [];
constructor(private systemSer: SystemService) {
}
checkAll(value: boolean): void {
this.displayData.forEach(data => data.checked = value);
this.dataSet.forEach(data => data.checked = value);
this.refreshStatus();
}
currentPageDataChange($event: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }>): void {
this.displayData = $event;
}
selectItem(event,item){
if(event){
this.selectList.push(item);
}else{
this.selectList.forEach((value,index)=>{
if(value.id == item.id){
this.selectList.splice(index,1)
}
})
}
this.refreshStatus()
this.dataSet = $event;
}
refreshStatus(): void {
const allChecked = this.displayData.every(value => value.checked === true);
const allUnChecked = this.displayData.every(value => !value.checked);
const allChecked = this.dataSet.every(value => value.checked === true);
const allUnChecked = this.dataSet.every(value => !value.checked);
this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked);
this.disabledButton = !this.dataSet.some(value => value.checked);
......@@ -91,7 +77,13 @@ export class SelectRoleComponent implements OnInit {
}
handEditleOk(){
this.done.emit(this.selectList);
let arr = [];
this.dataSet.forEach(e => {
if (e.checked) {
arr.push(e);
}
});
this.done.emit(arr);
this.allChecked = false;
this.isVisible = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment