Commit 7f3c3588 authored by wangqinghua's avatar wangqinghua

update

parent f5b8b044
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of basicTable.data"> <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.name}}</td>
<td>{{data.comments}}</td> <td>{{data.comments}}</td>
</tr> </tr>
......
...@@ -19,35 +19,21 @@ export class SelectRoleComponent implements OnInit { ...@@ -19,35 +19,21 @@ export class SelectRoleComponent implements OnInit {
indeterminate = false; indeterminate = false;
userId; userId;
userRoleList = []; userRoleList = [];
displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = [];
constructor(private systemSer: SystemService) { constructor(private systemSer: SystemService) {
} }
checkAll(value: boolean): void { checkAll(value: boolean): void {
this.displayData.forEach(data => data.checked = value); this.dataSet.forEach(data => data.checked = value);
this.refreshStatus(); this.refreshStatus();
} }
currentPageDataChange($event: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }>): void { currentPageDataChange($event: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }>): void {
this.displayData = $event; this.dataSet = $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()
} }
refreshStatus(): void { refreshStatus(): void {
const allChecked = this.displayData.every(value => value.checked === true); const allChecked = this.dataSet.every(value => value.checked === true);
const allUnChecked = this.displayData.every(value => !value.checked); const allUnChecked = this.dataSet.every(value => !value.checked);
this.allChecked = allChecked; this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked); this.indeterminate = (!allChecked) && (!allUnChecked);
this.disabledButton = !this.dataSet.some(value => value.checked); this.disabledButton = !this.dataSet.some(value => value.checked);
...@@ -91,7 +77,13 @@ export class SelectRoleComponent implements OnInit { ...@@ -91,7 +77,13 @@ export class SelectRoleComponent implements OnInit {
} }
handEditleOk(){ 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.allChecked = false;
this.isVisible = 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