<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)]="deptId" nzServerSearch nzShowSearch (nzOnSearch)="changeInp($event)">
        <ng-container *ngFor="let option of alldepart">
          <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.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.taskTypeDTO || fieldConfig.fields.statisticsTypeDTO || fieldConfig.fields.buildingDTO">
  <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
  <span>{{fieldConfig.fields.userDTO?.name}}</span>
  <span>{{fieldConfig.fields.statisticsTypeDTO?.name}}</span>
  <span>{{fieldConfig.fields.taskTypeDTO?.taskName}}</span>
	<span>{{fieldConfig.fields.buildingDTO?.buildingName}}</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]="widthStyle" *ngIf="parent==1" nzShowSort nzSortKey="parentOrders" [(nzSort)]="sortCurrent.parentOrders">父级科室(编码)</th>
      <th [nzWidth]="widthStyle" nzShowSort nzSortKey="orders" [(nzSort)]="sortCurrent.orders">科室(编码)</th>
      <th [nzWidth]="widthThStyle" nzShowSort nzSortKey="totalCount" [(nzSort)]="sortCurrent.totalCount">工单数量</th>
      <th [nzWidth]="widthThStyle" nzShowSort nzSortKey="evaCount" [(nzSort)]="sortCurrent.evaCount">评价总工单数</th>
      <th [nzWidth]="widthThStyle" nzShowSort nzSortKey="eva1" [(nzSort)]="sortCurrent.eva1">一星评价数</th>
      <th [nzWidth]="widthThStyle" nzShowSort nzSortKey="eva2" [(nzSort)]="sortCurrent.eva2">二星评价数</th>
      <th [nzWidth]="widthThStyle" nzShowSort nzSortKey="eva3" [(nzSort)]="sortCurrent.eva3">三星评价数</th>
      <th [nzWidth]="widthThStyle" nzShowSort nzSortKey="eva4" [(nzSort)]="sortCurrent.eva4">四星评价数</th>
      <th [nzWidth]="widthThStyle" nzShowSort nzSortKey="eva5" [(nzSort)]="sortCurrent.eva5">五星评价数</th>
      <th [nzWidth]="widthThStyle" nzShowSort nzSortKey="avgCount" [(nzSort)]="sortCurrent.avgCount">平均总星级</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of listOfData">
			<td *ngIf="parent==1">{{ data.parentName || '无' }}</td>
      <td>{{ data.name }}</td>
      <td class="text-sign" (click)="viewDetail1(data)">{{ data.totalCount }}</td>
      <td>{{ data.evaCount }}</td>
      <td class="text-sign" (click)="viewDetail2(data)">{{ data.eva1 }}</td>
      <td class="text-sign" (click)="viewDetail3(data)">{{ data.eva2 }}</td>
      <td class="text-sign" (click)="viewDetail4(data)">{{ data.eva3 }}</td>
      <td class="text-sign" (click)="viewDetail5(data)">{{ data.eva4 }}</td>
      <td class="text-sign" (click)="viewDetail6(data)">{{ data.eva5 }}</td>
      <td>{{ data.avgCount }}</td>
    </tr>
  </tbody>
  <ng-template #footerTpl>
    <table class="footTable">
      <tr *ngFor="let data of listOfDataEnd">
				<td [ngStyle]="{width: widthStyle}" *ngIf="parent==1">{{ data.parentName }}</td>
				<td [ngStyle]="{width: widthStyle}" *ngIf="parent==0">{{ data.name }}</td>
				<td [ngStyle]="{width: widthStyle}" *ngIf="parent==1"></td>
        <td [ngStyle]="{width: widthThStyle}" class="text-sign" (click)="viewDetail1(data, 'all')">{{ data.totalCount }}</td>
        <td [ngStyle]="{width: widthThStyle}">{{ data.evaCount }}</td>
        <td [ngStyle]="{width: widthThStyle}" class="text-sign" (click)="viewDetail2(data, 'all')">{{ data.eva1 }}</td>
        <td [ngStyle]="{width: widthThStyle}" class="text-sign" (click)="viewDetail3(data, 'all')">{{ data.eva2 }}</td>
        <td [ngStyle]="{width: widthThStyle}" class="text-sign" (click)="viewDetail4(data, 'all')">{{ data.eva3 }}</td>
        <td [ngStyle]="{width: widthThStyle}" class="text-sign" (click)="viewDetail5(data, 'all')">{{ data.eva4 }}</td>
        <td [ngStyle]="{width: widthThStyle}" class="text-sign" (click)="viewDetail6(data, 'all')">{{ data.eva5 }}</td>
        <td [ngStyle]="{width: widthThStyle}">{{ data.avgCount }}</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>
