<div class="searchDataWrap">
  <div class="searchData">
    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
    <div class="searchDataItem">
      <span class="label">科室</span>：
      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeDeptInp($event)" nzAllowClear nzPlaceHolder="请选择科室" [(ngModel)]="deptId" (nzOpenChange)="openChangeDept($event)">
        <ng-container *ngFor="let option of deptList">
          <nz-option *ngIf="!isLoading" [nzLabel]="option.hospital.hosName + '-' + option.dept" [nzValue]="option.id"></nz-option>
        </ng-container>
        <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
          <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
        </nz-option>
      </nz-select>
    </div>
  </div>
  <div class="operation">
    <i class="icon_transport transport-gengduo" nz-tooltip nzTooltipTitle="更多搜索" (click)="showMore()"></i>
    <button nz-button class="btn default" (click)="search()">查询</button>
    <button nz-button class="btn default ml8" (click)="reset()">重置</button>
    <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
  </div>
</div>
<div class="moreFilter" *ngIf="fieldConfig.fields.taskTypeDTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.deptTypeDTO">
  <span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
  <span>{{fieldConfig.fields.floorDTO?.floorName}}</span>
  <span>{{fieldConfig.fields.deptTypeDTO?.name}}</span>
</div>
<nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
  <thead (nzSortChange)="sort($event)" nzSingleSort>
    <tr>
      <th nzWidth="20%" nzShowSort nzSortKey="orders" [(nzSort)]="sortCurrent.orders">科室名称(编码)</th>
      <th nzWidth="16%">号码</th>
      <th nzWidth="16%" nzShowSort nzSortKey="intoCount" [(nzSort)]="sortCurrent.intoCount">来电量</th>
      <th nzWidth="16%" nzShowSort nzSortKey="intoTime" [(nzSort)]="sortCurrent.intoTime">来电时长</th>
      <th nzWidth="16%" nzShowSort nzSortKey="outCount" [(nzSort)]="sortCurrent.outCount">去电量</th>
      <th nzWidth="16%" nzShowSort nzSortKey="outTime" [(nzSort)]="sortCurrent.outTime">去电时长</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of listOfData">
      <td>{{ data.deptName }}<ng-container *ngIf="data.deptCode">({{ data.deptCode }})</ng-container></td>
      <td>{{ data.deptPhone }}</td>
      <td>{{ data.intoCount }}</td>
      <td>{{ data.intoTime }}</td>
      <td>{{ data.outCount }}</td>
      <td>{{ data.outTime }}</td>
    </tr>
  </tbody>
  <ng-template #footerTpl>
    <table class="footTable">
      <tr *ngFor="let data of listOfDataEnd">
        <td style="width: 20%">{{ data.deptCode }}</td>
        <td style="width: 16%">{{ data.deptPhone }}</td>
        <td style="width: 16%">{{ data.intoCount }}</td>
        <td style="width: 16%">{{ data.intoTime }}</td>
        <td style="width: 16%">{{ data.outCount }}</td>
        <td style="width: 16%">{{ data.outTime }}</td>
      </tr>
    </table>
  </ng-template>
</nz-table>
<div class="pagination">
  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
</div>

<!-- 详细搜索 -->
<app-phone-search-more [fieldConfig]="fieldConfig" *ngIf="showSearchMore" [hosId]="hosId" [queryType]="queryType"  [dutyId]="dutyId"  [parentDutyId]="parentDutyId" (cancelEvent)="cancelEvent()" (submitEvent)="submitEvent($event)"></app-phone-search-more>
