公共组件 #18
@@ -36,9 +36,14 @@
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ng-container *ngIf="headData.isActionColumns">
|
<ng-container *ngIf="headData.isActionColumns">
|
||||||
<a *ngFor="let action of headData.action; let i = index" (mouseenter)="action.hover(t)"
|
<a *ngFor="let action of headData.action; let i = index"
|
||||||
(mouseout)="null" (click)="action.click(t)"
|
(mouseenter)="action.hover(t)"
|
||||||
[ngStyle]="{'color':action.color,'font-size':action.fontSize}">
|
(mouseout)="null"
|
||||||
|
[ngStyle]="{'color':action.color,'font-size':action.fontSize}"
|
||||||
|
nz-popconfirm
|
||||||
|
[nzPopconfirmTitle]="'是否确认'+action.name+'该数据?'"
|
||||||
|
[nzCondition]="!action.needConfirm"
|
||||||
|
(nzOnConfirm)="action.click(t)">
|
||||||
{{action.name}}
|
{{action.name}}
|
||||||
<ng-template [ngIf]="i!=headData.action.length-1">
|
<ng-template [ngIf]="i!=headData.action.length-1">
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class CommonTableComponent<T> implements OnInit, OnChanges {
|
|||||||
dataList: PageList<T> = new PageList<T>();
|
dataList: PageList<T> = new PageList<T>();
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.getData();
|
if (!this.template) this.template = {}
|
||||||
this.data.forEach(dat => {
|
this.data.forEach(dat => {
|
||||||
if (!dat.action) return;
|
if (!dat.action) return;
|
||||||
dat.action.forEach(act => {
|
dat.action.forEach(act => {
|
||||||
@@ -40,7 +40,9 @@ export class CommonTableComponent<T> implements OnInit, OnChanges {
|
|||||||
act.hover = () => null;
|
act.hover = () => null;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
if (!this.request) return
|
||||||
|
this.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
getData = () => {
|
getData = () => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {CommonTableComponent} from './common-table.component';
|
|||||||
import {
|
import {
|
||||||
NzCardModule,
|
NzCardModule,
|
||||||
NzDividerModule,
|
NzDividerModule,
|
||||||
NzIconModule, NzOutletModule,
|
NzIconModule, NzOutletModule, NzPopconfirmModule,
|
||||||
NzTableModule,
|
NzTableModule,
|
||||||
NzToolTipModule,
|
NzToolTipModule,
|
||||||
NzTypographyModule
|
NzTypographyModule
|
||||||
@@ -26,7 +26,8 @@ import {
|
|||||||
NzToolTipModule,
|
NzToolTipModule,
|
||||||
NzCardModule,
|
NzCardModule,
|
||||||
NzIconModule,
|
NzIconModule,
|
||||||
NzOutletModule
|
NzOutletModule,
|
||||||
|
NzPopconfirmModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class CommonTableModule {
|
export class CommonTableModule {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export class Data<T> {
|
|||||||
color?: string,
|
color?: string,
|
||||||
order?: number,
|
order?: number,
|
||||||
fontSize?: string,
|
fontSize?: string,
|
||||||
|
needConfirm?: boolean,
|
||||||
click: (data: T) => void,
|
click: (data: T) => void,
|
||||||
hover?: (data: T) => void | null;
|
hover?: (data: T) => void | null;
|
||||||
}[] = []
|
}[] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user