<nz-card nzSize="small" [nzExtra]="refresh" [nzTitle]="cardTitle" [nzLoading]="loading">
    <nz-table nzTableLayout="fixed"
              [nzData]="dataList.list"
              [nzTotal]="dataList.total"
              [(nzPageIndex)]="dataList.pageNum"
              [nzPageSize]="dataList.pageSize"
              (nzPageIndexChange)="getData()"
              nzFrontPagination="false"
              [nzScroll]="{x:'1300px'}">
        <thead>
        <tr>
            <ng-container *ngFor="let headData of data">
                <th *ngIf="headData.show">
                    {{headData.fieldName}}
                </th>
            </ng-container>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let t of dataList.list;let index = index">
            <ng-container *ngFor="let headData of data">
                <td *ngIf="headData.show"
                    nz-typography
                    nzEllipsis
                    [nzEllipsisRows]="headData.isActionColumns?3:1"
                    [nzTooltipTitle]="headData.isActionColumns ? null : headData.fieldName+' : '+getValue(index,headData.fieldValue)"
                    nzTooltipPlacement="top"
                    nz-tooltip>
                    <ng-template [ngIf]="!headData.isActionColumns">
                        <ng-template [ngIf]="template[headData.fieldValue]">
                            <ng-container
                                    *ngTemplateOutlet="template[headData.fieldValue].temp; context:getContext(headData.fieldValue,index) ">
                            </ng-container>
                        </ng-template>
                        <ng-template [ngIf]="!template[headData.fieldValue]">
                            {{ getValue(index, headData.fieldValue) }}
                        </ng-template>
                    </ng-template>
                    <ng-container *ngIf="headData.isActionColumns">
                        <a *ngFor="let action of headData.action; let i = index"
                           (mouseenter)="action.hover(t)"
                           (mouseout)="null"
                           [ngStyle]="{'color':action.color,'font-size':action.fontSize}"
                           nz-popconfirm
                           [nzPopconfirmTitle]="'是否确认'+action.name+'该数据?'"
                           [nzCondition]="!action.needConfirm"
                           (nzOnConfirm)="action.click(t)"
                           [title]="action.name">
                            {{action.name}}
                            <ng-template [ngIf]="i!=headData.action.length-1">
                                <nz-divider nzType="vertical"></nz-divider>
                            </ng-template>
                        </a>
                    </ng-container>
                </td>
            </ng-container>
        </tr>
        </tbody>
    </nz-table>
</nz-card>


<ng-template #refresh>
    <i nz-icon nzType="reload" nzTheme="outline" (click)="getData()" title="刷新" style="cursor: pointer"></i>
</ng-template>
