From 9dca081c7a0348ab5934f15aadc5391624a25f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=87=A0=E6=B5=B7?= Date: Wed, 1 Jul 2020 17:58:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=94=A8=E7=BB=84=E4=BB=B6-=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common-table/common-table.component.html | 11 ++++++++--- .../components/common-table/common-table.component.ts | 6 ++++-- .../components/common-table/common-table.module.ts | 5 +++-- src/app/view/admin/components/common-table/data.ts | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) 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 5aa02aa..6fbb235 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 @@ -36,9 +36,14 @@ - + {{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 e0e3016..be65f87 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 @@ -32,7 +32,7 @@ export class CommonTableComponent implements OnInit, OnChanges { dataList: PageList = new PageList(); ngOnInit(): void { - this.getData(); + if (!this.template) this.template = {} this.data.forEach(dat => { if (!dat.action) return; dat.action.forEach(act => { @@ -40,7 +40,9 @@ export class CommonTableComponent implements OnInit, OnChanges { act.hover = () => null; } }) - }) + }); + if (!this.request) return + this.getData(); } getData = () => { 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 4244f58..c371954 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 @@ -4,7 +4,7 @@ import {CommonTableComponent} from './common-table.component'; import { NzCardModule, NzDividerModule, - NzIconModule, NzOutletModule, + NzIconModule, NzOutletModule, NzPopconfirmModule, NzTableModule, NzToolTipModule, NzTypographyModule @@ -26,7 +26,8 @@ import { NzToolTipModule, NzCardModule, NzIconModule, - NzOutletModule + NzOutletModule, + NzPopconfirmModule ] }) export class CommonTableModule { diff --git a/src/app/view/admin/components/common-table/data.ts b/src/app/view/admin/components/common-table/data.ts index 421f3bb..4eb528f 100644 --- a/src/app/view/admin/components/common-table/data.ts +++ b/src/app/view/admin/components/common-table/data.ts @@ -17,6 +17,7 @@ export class Data { color?: string, order?: number, fontSize?: string, + needConfirm?: boolean, click: (data: T) => void, hover?: (data: T) => void | null; }[] = []