<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl='19' class="list-template__searchBox">
        <div class="list-template__searchItem">
          <span class="label">时间区间</span>：
          <nz-range-picker nzShowTime [(ngModel)]="dateRange" (nzOnCalendarChange)="onCalendarChangeDate($event)"></nz-range-picker>
        </div>
        <div class="list-template__searchItem">
          <span class="label">打包科室</span>：
          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择打包科室" [(ngModel)]="searchDto.packDept" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeInp('department', $event)" (nzOpenChange)="openChangeDept($event)" (ngModelChange)="setIsSelecting(true)">
            <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" nzPlaceHolder="请选择送达人" [(ngModel)]="searchDto.deliveryUser" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeInp('patient', $event)" (nzOpenChange)="openChangePatient($event)" (ngModelChange)="setIsSelecting(true)">
            <ng-container *ngFor="let option of deliveryUserList">
              <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 class="list-template__searchItem">
          <span class="label">状态</span>：
          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzAllowClear nzPlaceHolder="请选择状态" [(ngModel)]="searchDto.status">
            <ng-container *ngFor="let option of stateList">
              <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 nz-col nzLg="5" class="list-template__btns">
        <button nz-button class="btn default ml8" (click)='search()'>搜索</button>
        <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
      </div>
    </div>
    <div class="list-template__bottom">
      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
        [nzLoading]="loading1">
        <thead>
          <tr class="thead">
            <th nzWidth="10%">包号</th>
            <th nzWidth="10%">打包人</th>
            <th nzWidth="10%">打包科室</th>
            <th nzWidth="10%">检验科室</th>
            <th nzWidth="10%">标本数</th>
            <th nzWidth="10%">收取人|收取时间</th>
            <th nzWidth="10%">送达人|送达时间</th>
            <th nzWidth="10%">状态</th>
            <th nzWidth="10%">工单号</th>
            <th nzWidth="10%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let i = index">
            <td class="underline" (click)="viewSpe(data)">{{data.packCode}}</td>
            <td>{{ data.packUserDTO?.name }}<br>{{ data.packTime | date: 'yyyy-MM-dd HH:mm'}}</td>
            <td>{{data.packDeptDTO?.dept}}</td>
            <td>{{ data.endDeptNames }}</td>
            <td>{{data.specimenNum}}</td>
            <td>{{ data.receiveUserDTO?.name }}<br>{{ data.receiveTime | date: 'yyyy-MM-dd HH:mm'}}</td>
            <td>{{ data.deliveryUserDTO?.name }}<br>{{ data.deliveryTime | date: 'yyyy-MM-dd HH:mm'}}</td>
            <td>{{ data.status?.name }}</td>
            <td class="clickable" (click)="detail($event, data.gdid)">{{ data.gdDTO?.gdcode }}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.lookLog" (click)="showLogs(data)">查看日志</span>
                <span *ngIf="coopBtns.del && (data.status.value === '0' || data.status.value === '1')" (click)="showDelModal(data, '您确认要删除吗？', '删除', 'del')">删除</span>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" nzShowSizeChanger
          (nzPageIndexChange)="getList(0)" (nzPageSizeChange)="getList(0)">
        </nz-pagination>
      </div>
    </div>
  </div>
</div>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>

<!-- 查看日志 -->
<app-specimen-package-log-prompt-modal
  *ngIf="logPromptModalShow"
  [show]="logPromptModalShow"
  [id]="packId"
  (closeModelHs)="closeModelLog($event)"
></app-specimen-package-log-prompt-modal>

<!-- 模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
(confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>

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

<!-- 查看标本 -->
<app-view-specimen *ngIf="showModal" [speId]="speId" (closeModelHs)="closeModel($event)"></app-view-specimen>
