<nz-table
  class="precaution-table"
  #table
  [nzData]="list"
  nzShowPagination
  nzPaginationType="small"
  [nzFrontPagination]="false"
  [nzTotal]="pageConfig.total"
  [nzPageIndex]="pageConfig.page + 1"
  (nzPageIndexChange)="onCurrentPageChange($event - 1)"
  [nzLoading]="loading"
>
  <thead>
    <tr>
      <th>文档名称</th>
      <th>文档类别</th>
      <th>文档级别</th>
      <th>更新日期</th>
      <th>更新人</th>
      <th [nzRight]="'0px'">操作</th>
    </tr>
  </thead>
  <tbody>
    @for (data of table.data; track $index) {
      <tr>
        <td>
          <button class="precaution-button" nz-button nzType="link" (click)="onView(data)">
            <span nz-icon nzType="icons:docx" class="mr-2"></span>
            <span>{{ data.name }}</span>
          </button>
        </td>
        <td>{{ data.category }}</td>
        <td>{{ data.level }}</td>
        <td>{{ data.updatedDate | date: 'yyyy-MM-dd HH:mm' }}</td>
        <td>{{ data.updateBy }}</td>

        <td [nzRight]="'0px'">
          <nz-upload
            [nzAction]="'/doc/update?id=' + data.id"
            nzAccept=".docx,.pdf"
            [nzShowUploadList]="false"
            (nzChange)="handleImportStatusChange($event)"
          >
            <button class="precaution-button ml-4 mr-2" nzType="primary" nzSize="small" nz-button>更新文档</button>
          </nz-upload>
          <button
            class="precaution-secondary px-2 ml-4"
            nz-button
            nzSize="small"
            nzType="primary"
            nzDanger
            (click)="onRemove(data)"
          >
            删除
          </button>
        </td>
      </tr>
    }
  </tbody>
</nz-table>
