diff --git a/src/app/view/admin/components/common-table/common-table.component.html b/src/app/view/admin/components/common-table/common-table.component.html index 22e3c51..d81c2ba 100644 --- a/src/app/view/admin/components/common-table/common-table.component.html +++ b/src/app/view/admin/components/common-table/common-table.component.html @@ -1,40 +1,51 @@ - - - - - - {{headData.fieldName}} - - - - - - - - - - {{t[headData.fieldValue]}} - - - - {{action.name}} - - - - - - - + + + + + + + {{headData.fieldName}} + + + + + + + + + + {{t[headData.fieldValue]}} + + + + {{action.name}} + + + + + + + + + + + - - - + + + diff --git a/src/app/view/admin/components/common-table/common-table.component.ts b/src/app/view/admin/components/common-table/common-table.component.ts index 309368f..a2e6fdf 100644 --- a/src/app/view/admin/components/common-table/common-table.component.ts +++ b/src/app/view/admin/components/common-table/common-table.component.ts @@ -16,6 +16,8 @@ export class CommonTableComponent implements OnInit, OnChanges { @Input() data: Data[] @Input() request: RequestObj + @Input() title: string + loading: boolean = true; dataList: PageList = new PageList(); @@ -32,12 +34,17 @@ export class CommonTableComponent implements OnInit, OnChanges { } getData = () => { + this.loading = true; this.request.queryParam = { page: this.dataList.pageNum ? this.dataList.pageNum : 1, count: this.dataList.pageSize ? this.dataList.pageSize : 10 } - this.httpService.Service>(this.request).subscribe(resp => { - this.dataList = resp.result; + this.httpService.Service>(this.request).subscribe({ + next: resp => { + this.dataList = resp.result; + this.loading = false; + }, + error: err => this.loading = false }); } diff --git a/src/app/view/admin/components/common-table/common-table.module.ts b/src/app/view/admin/components/common-table/common-table.module.ts index 3e832b6..e546f2a 100644 --- a/src/app/view/admin/components/common-table/common-table.module.ts +++ b/src/app/view/admin/components/common-table/common-table.module.ts @@ -1,7 +1,14 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {CommonTableComponent} from './common-table.component'; -import {NzDividerModule, NzTableModule} from 'ng-zorro-antd'; +import { + NzCardModule, + NzDividerModule, + NzIconModule, + NzTableModule, + NzToolTipModule, + NzTypographyModule +} from 'ng-zorro-antd'; @NgModule({ @@ -14,7 +21,11 @@ import {NzDividerModule, NzTableModule} from 'ng-zorro-antd'; imports: [ CommonModule, NzTableModule, - NzDividerModule + NzDividerModule, + NzTypographyModule, + NzToolTipModule, + NzCardModule, + NzIconModule ] }) export class CommonTableModule { diff --git a/src/app/view/admin/test-common-table/test-common-table.component.html b/src/app/view/admin/test-common-table/test-common-table.component.html index bbb6b23..51b3df4 100644 --- a/src/app/view/admin/test-common-table/test-common-table.component.html +++ b/src/app/view/admin/test-common-table/test-common-table.component.html @@ -1 +1 @@ - +