<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" nzAllowClear nzPlaceHolder="请选择统计分类" [(ngModel)]="statisticsTypeId" (nzOpenChange)="openChangeStatisticsType($event)">
        <ng-container *ngFor="let option of statisticsTypeList">
          <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [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.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.deptDTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.taskTypeDTO">
  <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
  <span>{{fieldConfig.fields.userDTO?.name}}</span>
	<span>{{fieldConfig.fields.taskTypeDTO?.taskName}}</span>
	<span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
  <span>{{fieldConfig.fields.deptDTO?.dept}}</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="10%" nzShowSort nzSortKey="date" [(nzSort)]="sortCurrent.date">时</th>
      <th nzWidth="9%" nzShowSort nzSortKey="totalCount" [(nzSort)]="sortCurrent.totalCount">工单数量</th>
      <th nzWidth="9%" nzShowSort nzSortKey="avgCount" [(nzSort)]="sortCurrent.avgCount">平均单量</th>
      <th nzWidth="9%" nzShowSort nzSortKey="totalGrade" [(nzSort)]="sortCurrent.totalGrade">总积分</th>
			<th nzWidth="9%" nzShowSort nzSortKey="response_time_num" [(nzSort)]="sortCurrent.response_time_num">平均响应时间</th>
			<th nzWidth="9%" nzShowSort nzSortKey="arrive_time_num" [(nzSort)]="sortCurrent.arrive_time_num">平均到达时间</th>
      <th nzWidth="9%" nzShowSort nzSortKey="execution_time_num" [(nzSort)]="sortCurrent.execution_time_num">平均送达时间</th>
      <th nzWidth="9%" nzShowSort nzSortKey="aveper" [(nzSort)]="sortCurrent.aveper">按时达标率</th>
      <th nzWidth="9%" nzShowSort nzSortKey="total_time" [(nzSort)]="sortCurrent.total_time">平均总时间</th>
      <th nzWidth="9%" nzShowSort nzSortKey="five_count" [(nzSort)]="sortCurrent.five_count">五分钟内工单</th>
      <th nzWidth="9%" nzShowSort nzSortKey="special_close" [(nzSort)]="sortCurrent.special_close">特殊关闭数</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of listOfData">
      <td>{{ data.date }}</td>
      <td class="text-sign" (click)="viewDetail1(data)">{{ data.totalCount }}</td>
      <td>{{ data.avgCount }}</td>
      <td>{{ data.totalGrade }}</td>
      <td>{{ data.response_time_num }}</td>
      <td>{{ data.arrive_time_num }}</td>
      <td>{{ data.execution_time_num }}</td>
      <td>{{ data.aveper }}</td>
      <td>{{ data.total_time }}</td>
      <td class="text-sign" (click)="viewDetail2(data)">{{ data.five_count }}</td>
      <td class="text-sign" (click)="viewDetail3(data)">{{ data.special_close }}</td>
    </tr>
  </tbody>
  <ng-template #footerTpl>
    <table class="footTable">
      <tr *ngFor="let data of listOfDataEnd">
        <td style="width: 10%">{{ data.date }}</td>
        <td style="width: 9%" class="text-sign" (click)="viewDetail1(data, 'all')">{{ data.totalCount }}</td>
        <td style="width: 9%">{{ data.avgCount }}</td>
        <td style="width: 9%">{{ data.totalGrade }}</td>
        <td style="width: 9%">{{ data.response_time_num }}</td>
        <td style="width: 9%">{{ data.arrive_time_num }}</td>
        <td style="width: 9%">{{ data.execution_time_num }}</td>
        <td style="width: 9%">{{ data.aveper }}</td>
        <td style="width: 9%">{{ data.total_time }}</td>
        <td style="width: 9%" class="text-sign" (click)="viewDetail2(data, 'all')">{{ data.five_count }}</td>
        <td style="width: 9%" class="text-sign" (click)="viewDetail3(data, 'all')">{{ data.special_close }}</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-distribution-search-more [fieldConfig]="fieldConfig" *ngIf="showSearchMore" [hosId]="hosId" [queryType]="queryType"  [dutyId]="dutyId"  [parentDutyId]="parentDutyId" (cancelEvent)="cancelEvent()" (submitEvent)="submitEvent($event)"></app-distribution-search-more>
