<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl='18' class="list-template__searchBox">
        <div class="list-template__searchItem">
          <nz-radio-group [(ngModel)]="dateType" (ngModelChange)="changeDateType($event)">
            <label *ngFor="let data of dateTypes" nz-radio-button [nzValue]="data.value">{{data.label}}</label>
          </nz-radio-group>
        </div>
        <div class="list-template__searchItem">
          <span class="label">发起时间</span>：
          <nz-range-picker *ngIf="dateType=='day'" [(ngModel)]="dateRange" [nzAllowClear]='false'
            [nzDisabledDate]="disabledDate" (ngModelChange)="changeDate($event)">
          </nz-range-picker>
          <nz-month-picker *ngIf="dateType=='month'" [(ngModel)]="monthRangeStart" [nzDisabledDate]="disabledMonthStart"
            (ngModelChange)="changeMonthStart($event)" nzPlaceHolder="请选择开始月份">
          </nz-month-picker>
          <span *ngIf="dateType=='month'"> ~ </span>
          <nz-month-picker *ngIf="dateType=='month'" [(ngModel)]="monthRangeEnd" [nzDisabledDate]="disabledMonthEnd"
            (ngModelChange)="changeMonthEnd($event)" nzPlaceHolder="请选择截止月份">
          </nz-month-picker>
          <nz-year-picker *ngIf="dateType=='year'" [(ngModel)]="yearRangeStart" [nzDisabledDate]="disabledYearStart"
            (ngModelChange)="changeYearStart($event)" nzPlaceHolder="请选择开始年份">
          </nz-year-picker>
          <span *ngIf="dateType=='year'"> ~ </span>
          <nz-year-picker *ngIf="dateType=='year'" [(ngModel)]="yearRangeEnd" (ngModelChange)="changeYearEnd($event)"
            [nzDisabledDate]="disabledYearEnd" nzPlaceHolder="请选择截止年份">
          </nz-year-picker>
        </div>
        <div class="list-template__searchItem ml8">
          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" [nzShowSearch]="false" nzPlaceHolder="请选择时间"
            [(ngModel)]="defRange" (ngModelChange)="changeDateRange($event)">
            <nz-option nzLabel="{{data.label}}" nzValue="{{data.id}}" *ngFor="let data of defRanges"></nz-option>
          </nz-select>
        </div>
        <div class="list-template__searchItem">
          <span class="label">科室名称</span>：
          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
            (nzOnSearch)="changeInp($event, 'getDeptList')" nzAllowClear nzPlaceHolder="请选择科室名称" [(ngModel)]="searchDto.dept">
            <ng-container *ngFor="let option of deptList">
              <nz-option *ngIf="!isLoading" [nzLabel]="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 class="list-template__searchItem">
          <span class="label">楼栋名称</span>：
          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
            (nzOnSearch)="changeInp($event, 'getBuildingList')" nzAllowClear nzPlaceHolder="请选择楼栋名称" [(ngModel)]="searchDto.building">
            <ng-container *ngFor="let option of buildingList">
              <nz-option *ngIf="!isLoading" [nzLabel]="option.buildingName" [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 nz-col nzXl='6' class="list-template__btns">
        <button nz-button class="btn default" (click)='search(1)'>搜索</button>
        <button nz-button class="btn default ml8" (click)='export()' [nzLoading]="loading2">导出</button>
        <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
        <!-- <button nz-button class="btn default ml8" (click)='exportDetail()' [nzLoading]="loading3" [disabled]="!checkedDepIds.length">批量导出详细科室报表</button> -->
      </div>
    </div>
		<div class="cont">
		  <div>
		    <span>总计</span>
		    <span class="rate"></span>
		  </div>
		  <div>
		    <span>科室数</span>
		    <span>{{summary[0] || 0}}</span>
		  </div>
		  <div>
		    <span>总重量(kg)</span>
		    <span>{{summary[1] || 0}}</span>
		  </div>
		  <div *ngFor="let item of heads;let index=index;">
		    <span>{{item}}(kg)</span>
				<span>{{summary[index+2] || 0}}</span>
		  </div>
		</div>
    <div class="list-template__bottom">
      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
        [nzLoading]="loading1">
        <thead (nzSortChange)="sort($event)" nzSingleSort>
          <tr class="thead">
            <th>序号</th>
            <th>科室名称</th>
            <th nzShowSort nzSortKey="totalWeight" [(nzSort)]="sortCurrent.totalWeight">总重量(kg)</th>
            <th *ngFor="let data of heads">{{data}}(kg)</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let index=index;" (click)="selectedListData(data)">
            <td>{{ index+(pageIndex-1) * pageSize + 1 }}</td>
            <td *ngFor="let item of data;">{{ item }}</td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [nzPageSizeOptions]="[10,100]" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"
          (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)">
        </nz-pagination>
      </div>
    </div>
  </div>
</div>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo"></app-prompt-modal>

<!-- 查看详情 -->
<router-outlet></router-outlet>
