|
1 | | -import { Component, OnInit, OnDestroy } from '@angular/core'; |
| 1 | +import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; |
2 | 2 | import { Router, ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router'; |
3 | 3 | import { Subscription } from 'rxjs'; |
4 | 4 | import { HttpClient } from '@angular/common/http'; |
5 | | -import { DialogService } from 'ng-devui'; |
| 5 | +import { DialogService, DataTableComponent } from 'ng-devui'; |
6 | 6 |
|
7 | 7 | @Component({ |
8 | 8 | selector: 'app-article-list', |
9 | 9 | templateUrl: './article-list.component.html', |
10 | 10 | styleUrls: ['./article-list.component.css'] |
11 | 11 | }) |
12 | 12 | export class ArticleListComponent implements OnInit , OnDestroy { |
| 13 | + @ViewChild(DataTableComponent, {static: false}) dataTable: DataTableComponent; |
13 | 14 | showFilterPanel = false; |
14 | 15 | subscription: Subscription; |
15 | 16 | activeListType: string; |
@@ -114,9 +115,6 @@ export class ArticleListComponent implements OnInit , OnDestroy { |
114 | 115 | this.filterOption = event; |
115 | 116 | this.getData(); |
116 | 117 | } |
117 | | - getCheckedRows(event) { |
118 | | - this.checkRows = event; |
119 | | - } |
120 | 118 |
|
121 | 119 | delete(ids, batch= false) { |
122 | 120 | let tips; |
@@ -169,6 +167,7 @@ export class ArticleListComponent implements OnInit , OnDestroy { |
169 | 167 | }); |
170 | 168 | } |
171 | 169 | batchDelete() { |
| 170 | + this.checkRows = this.dataTable.getCheckedRows(); |
172 | 171 | if (!this.checkRows || !this.checkRows.length) { return; } |
173 | 172 | const ids = this.checkRows.map(row => row.id); |
174 | 173 | this.delete(ids, true); |
|
0 commit comments