<nz-table
  #table
  [nzShowPagination]="false"
  nzPaginationType="small"
  class="precaution-table"
  [nzFrontPagination]="false"
  [nzData]="list"
  [nzScroll]="{ y: '550px' }"
>
  <thead>
    <tr>
      <th>地点</th>
      <th nzWidth="33%">排查风险项</th>
      <th nzWidth="120px">排查人数</th>
      <th nzWidth="120px">负责人</th>
      <th nzWidth="120px">班组</th>
      <th nzWidth="244px">状态</th>
    </tr>
  </thead>
  <tbody>
    @for (item of table.data; track $index) {
      <tr>
        <td class="font-td">{{ getPositionText(item) }}</td>
        <td class="font-td">
          <span
            class="line-clamp-1 whitespace-pre-line"
            [nzTooltipTitle]="tpl"
            nz-tooltip
            nzTooltipColor="var(--manager-gray)"
            nzTooltipOverlayClassName="customTooltip"
          >
            {{ getRiskItemText(item) }}
          </span>
          <ng-template #tpl>
            @for (point of item.targets; track $index) {
              <div class="mb-2 text-sm flex">
                <div class="mr-2">{{ $index + 1 }}.</div>
                <div>{{ getSingleRiskItemText(point) }}</div>
              </div>
            }
          </ng-template>
        </td>
        <td class="font-td text-center">{{ item.peopleNumber }}</td>
        <td class="font-td">{{ getResponsibleName(item) }}</td>
        <td class="font-td">
          @for (team of item.teams; track $index) {
            <div class="mr-2">{{ getTeamName(team) }}</div>
          }
        </td>
        <td class="font-td">
          @if (!item.checkWorkSituation) {
            @if (getTaskFillPriority(item)) {
              <button nz-button nzType="link" nzSize="small" (click)="handleFill(item)">填报</button>
            }
          } @else {
            <div>
              <div>
                @if (item.checkAbnormal) {
                  <span
                    >排查完成，发现
                    <span
                      class="text-red-500 font-bold text-lg px-1 hover:underline hover:cursor-pointer"
                      (click)="toHazardListPage(item)"
                      >{{ item.checkOpinions?.length }}
                    </span>
                    处隐患</span
                  >
                } @else {
                  <span>排查完成，无异常</span>
                }
              </div>
              <div>
                @if (getTaskFillPriority(item)) {
                  <button nz-button nzType="link" nzSize="small" class="ml-2" (click)="handleEdit(item)">编辑</button>
                }
              </div>
            </div>
          }
        </td>
      </tr>
    }
  </tbody>
</nz-table>
