<!-- <comp-table-list
  #list
  [schema]="Profile"
  *ngIf="className && fieldsArray"
  [className]="className"
  [fieldsArray]="fieldsArray"
  [queryParams]="queryParams"
></comp-table-list> -->
<nz-table
  #basicTable
  [nzData]="profiles"
  [nzScroll]="{ x: (maxWidth || '800') + 'px', y: '480px' }"
  [nzTotal]="profiles.length"
  [nzPageSize]="10"
  [nzLoading]="loading"
  nzTableLayout="fixed"
  nzTemplateMode
  style="margin: 10px 0"
>
  <thead>
    <tr>
      <th nzWidth="120px" nzLeft>账号</th>
      <th nzWidth="120px">电话号码</th>
      <th nzWidth="120px">邮箱</th>
      <th nzWidth="120px">所属部门</th>
      <th nzWidth="50px" nzRight>操作</th>
    </tr>
  </thead>
  <tbody>
    @for (data of profiles; track data.id) {
    <tr>
      <td nzEllipsis nzLeft>
        <nz-avatar nzIcon="user"></nz-avatar>
        {{ data?.get("user").get("name") || "-" }}
      </td>
      <td nzEllipsis>
        {{ data?.get("user").get("phone") || "-" }}
      </td>
      <td nzEllipsis>
        {{ data?.get("user").get("email") || data?.get("email") || "-" }}
      </td>
      <td nzEllipsis>
        {{ data?.get("user").get("departmentName") || "-" }}
      </td>
      <td nzEllipsis nzRight>
        @if (hideBtn) { - } @else {
        <button
          nz-button
          nz-dropdown
          [nzDropdownMenu]="menu"
          [nzPlacement]="'bottomLeft'"
        >
          <span nz-icon nzType="ellipsis" nzTheme="outline"></span>
        </button>
        <nz-dropdown-menu #menu="nzDropdownMenu">
          <ul nz-menu>
            <li nz-menu-item>
              @if(checked(data.id)){
              <button
                nz-button
                (click)="onChange(data.id, 'delete')"
                nzType="link"
                style="color: #231c1f"
              >
                <span nz-icon nzType="delete" nzTheme="outline"></span>删除
              </button>
              }@else {
              <button
                nz-button
                (click)="onChange(data.id, 'push')"
                nzType="link"
                style="color: #231c1f"
              >
                <span nz-icon nzType="edit" nzTheme="outline"></span>设为联系人
              </button>
              }
            </li>
          </ul>
        </nz-dropdown-menu>
        }
      </td>
    </tr>
    }
  </tbody>
</nz-table>
@if (profiles.length == 0) {
<nz-empty></nz-empty>
}
