<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl='12' class="list-template__searchBox">
        <div class="list-template__searchItem">
          <span class="label label--big">快捷建单名称：</span>
          <input nz-input class="formItem" placeholder="请输入关键字" [(ngModel)]="searchCriteria.name" />
        </div>
        <!-- <div class="list-template__searchItem">
          <span class="label">起点科室：</span>
          <nz-select [nzDropdownMatchSelectWidth]="false" class="formItem" nzServerSearch nzShowSearch nzAllowClear
            nzPlaceHolder="请选择起点科室" [(ngModel)]="searchCriteria.startDepartment"
            (nzOnSearch)="changeInp($event,'search')" (nzOpenChange)="changeSearch($event)">
            <ng-container *ngFor="let data of departmentSearch">
              <nz-option *ngIf="!isLoading" nzLabel="{{data.dept}}" nzValue="{{data.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="12" class="list-template__btns">
        <button nz-button class="btn default" (click)='reset()'>重置</button>
        <button nz-button *ngIf="coopBtns.add" class="btn default ml8" (click)="addModal()">新增</button>
        <button nz-button *ngIf="coopBtns.generateQRcode" class="btn default ml8" nzType="primary"
          [nzLoading]="printLoading" [disabled]="!checkedDepIds.length" (click)="print($event,true)">批量生成二维码</button>
        <button nz-button class="btn default ml8" (click)='getList(1)'>搜索</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="5%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked"
              (nzCheckedChange)="checkAll($event)"></th>
            <th nzWidth="15%">快捷建单名称</th>
            <th nzWidth="15%">快捷建单类型</th>
            <th nzWidth="20%">起点科室</th>
            <th nzWidth="20%">终点科室</th>
            <th nzWidth="25%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let i = index" (click)="selectedListData(data.id)">
            <td nzShowCheckbox [(nzChecked)]="mapOfCheckedId[data.id]" (nzCheckedChange)="refreshStatus()"></td>
            <td>{{ data.title }}</td>
            <td>{{ data.taskTypeShow}}</td>
            <td>{{ data.startDeptHosName}}（{{ data.startDeptShow }}）</td>
            <td>
              <div class="targetDept" nz-tooltip nzTooltipTitle="{{ data.targetDeptHosName}}（{{ data.targetDeptShow }}）">{{ data.targetDeptHosName}}（{{ data.targetDeptShow }}）
              </div>
            </td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.look" (click)="detail($event,data.id)">查看</span>
                <span *ngIf="coopBtns.edit" (click)="edit($event,data)">修改</span>
                <span *ngIf="coopBtns.del" (click)="showDelModal($event,data.id,'您确认要删除此快捷建单吗？','删除','del')">删除</span>
                <span style="width: 90px;" *ngIf="coopBtns.generateQRcode"
                  (click)="print($event,false,data.id)">生成二维码</span>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList(0)" (nzPageSizeChange)="getList(0)">
        </nz-pagination>
      </div>
    </div>
  </div>

  <!-- 新增/编辑模态框 -->
  <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
    <div class="modalBody">
      <div class="title">{{add?"新增":"编辑"}}快捷建单<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i>
      </div>
      <div class="content">
        <p>创建人：{{createUser}}</p>
        <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="roundRobinName">快捷建单名称</nz-form-label>
            <nz-form-control nzErrorTip="请输入快捷建单名称!">
              <nz-input-group>
                <input nz-input formControlName="roundRobinName" placeholder="请输入快捷建单名称" />
              </nz-input-group>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="roundRobinType">快捷建单类型</nz-form-label>
            <nz-form-control nzErrorTip="请选择快捷建单类型!">
              <nz-select [nzDropdownMatchSelectWidth]="false" [nzDisabled]="false" formControlName="roundRobinType"
                (ngModelChange)="changeType($event)" nzShowSearch nzAllowClear nzPlaceHolder="请选择快捷建单类型">
                <nz-option nzLabel="{{data.taskName}}" nzValue="{{data.id}}" *ngFor="let data of roundRobinTypes">
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="startDepartmentHospital">起点科室院区</nz-form-label>
            <nz-form-control nzErrorTip="请选择起点科室院区!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="startDepartmentHospital" nzShowSearch
                nzAllowClear nzPlaceHolder="请选择起点科室院区" nzServerSearch (ngModelChange)="changeStartHospital($event)">
                <ng-container *ngFor="let data of userInfo.infoPermission.hospitals">
                  <nz-option *ngIf="!isLoading" nzLabel="{{data.hosName}}" nzValue="{{data.id}}"></nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="startDepartment">起点科室</nz-form-label>
            <nz-form-control nzErrorTip="请选择起点科室!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="startDepartment" nzShowSearch
                nzAllowClear nzPlaceHolder="请选择起点科室" nzServerSearch (nzOnSearch)="changeInp($event,'form')"
                (nzOpenChange)="changeForm($event)">
                <ng-container *ngFor="let data of department">
                  <nz-option *ngIf="!isLoading" nzLabel="{{data.dept}}" nzValue="{{data.id}}"></nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="endDepartmentHospital">终点科室院区</nz-form-label>
            <nz-form-control nzErrorTip="请选择终点科室院区!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="endDepartmentHospital" nzShowSearch
                nzAllowClear nzPlaceHolder="请选择终点科室院区" nzServerSearch (ngModelChange)="changeEndHospital($event)">
                <ng-container *ngFor="let data of userInfo.infoPermission.hospitals">
                  <nz-option *ngIf="!isLoading" nzLabel="{{data.hosName}}" nzValue="{{data.id}}"></nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="endDepartment">终点科室</nz-form-label>
            <nz-form-control nzErrorTip="请选择终点科室!">
              <nz-select [(nzMode)]="isOrther" [nzDropdownMatchSelectWidth]="false" formControlName="endDepartment"
                nzShowSearch nzAllowClear nzPlaceHolder="请选择终点科室" nzServerSearch
                (nzOnSearch)="changeInp($event,'formEnd')" (nzOpenChange)="changeFormEnd($event)">
                <ng-container *ngFor="let data of department1">
                  <nz-option *ngIf="!isLoading" nzLabel="{{data.dept}}" nzValue="{{data.id}}"></nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </form>
      </div>
      <div class=" display_flex justify-content_flex-center">
        <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">保存</button>
        <button class="btn cancel" nz-button nzType="default" (click)="hideAddModal()">取消</button>
      </div>
    </div>
  </div>

  <!-- 删除模态框 -->
  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
    (confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
  <!-- 二维码打印 -->
  <div id="report" style="display: none">
    <img *ngFor="let img of codes" style="width: 200px;height:200px;" [src]="img.base64" alt="">
  </div>
</div>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>
<!-- 查看详情 -->
<router-outlet></router-outlet>
<!-- 遮罩 -->
<app-mask *ngIf="maskFlag"></app-mask>
