公共组件 #18
@@ -1,4 +1,10 @@
|
||||
<nz-table>
|
||||
<nz-table nzTableLayout="fixed"
|
||||
[nzData]="dataList.list"
|
||||
[nzTotal]="dataList.total"
|
||||
[(nzPageIndex)]="dataList.pageNum"
|
||||
[nzPageSize]="dataList.pageSize"
|
||||
(nzPageIndexChange)="getData()"
|
||||
nzFrontPagination="false">
|
||||
<thead>
|
||||
<tr>
|
||||
<ng-container *ngFor="let headData of data">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
|
||||
import {Data} from './data';
|
||||
import {PageList, RequestObj} from '../../../../class/HttpReqAndResp';
|
||||
import {HttpService} from '../../../../api/http/http.service';
|
||||
@@ -8,7 +8,7 @@ import {HttpService} from '../../../../api/http/http.service';
|
||||
templateUrl: './common-table.component.html',
|
||||
styleUrls: ['./common-table.component.less']
|
||||
})
|
||||
export class CommonTableComponent<T> implements OnInit {
|
||||
export class CommonTableComponent<T> implements OnInit, OnChanges {
|
||||
|
||||
constructor(private httpService: HttpService) {
|
||||
|
||||
@@ -20,9 +20,7 @@ export class CommonTableComponent<T> implements OnInit {
|
||||
dataList: PageList<T> = new PageList<T>();
|
||||
|
||||
ngOnInit(): void {
|
||||
this.httpService.Service<PageList<T>>(this.request).subscribe(resp => {
|
||||
this.dataList = resp.result;
|
||||
});
|
||||
this.getData();
|
||||
this.data.forEach(dat => {
|
||||
if (!dat.action) return;
|
||||
dat.action.forEach(act => {
|
||||
@@ -33,4 +31,13 @@ export class CommonTableComponent<T> implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
getData = () => {
|
||||
this.httpService.Service<PageList<T>>(this.request).subscribe(resp => {
|
||||
this.dataList = resp.result;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user