<!-- 批量建单设置 -->
<div class="detail">
  <div class="title">
    <div class="detail_btn">
      <button nz-button nzType="primary" [disabled]="!checkedDepIds.length" (click)='showDelModals($event)'>批量删除</button>
      <button class="ml8" nz-button nzType="primary" (click)="addModal()">新增</button>
    </div>
    <span>{{selectedBatchOrder.title}} - 批量建单设置</span>
    <i class="icon_transport transport-guanbi" (click)="closeHandler()"></i>
  </div>
  <div class="box">
    <nz-table class="hospitalTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
      [nzLoading]="loading1">
      <thead>
        <tr class="thead">
          <th nzWidth="5%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked" (nzCheckedChange)="checkAll($event)"></th>
          <th nzWidth="5%">序号</th>
          <th nzWidth="30%">发起科室</th>
          <th nzWidth="30%">起点科室</th>
          <th nzWidth="30%">终点科室</th>
        </tr>
      </thead>
      <tbody>
        <tr *ngFor="let data of listOfData;let index=index;" (click)="selectedListData(data.id)">
          <td nzShowCheckbox [(nzChecked)]="mapOfCheckedId[data.id]" (nzCheckedChange)="refreshStatus()"></td>
          <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
          <td>{{data.createDept.dept}}</td>
          <td>{{data.startDept.dept}}</td>
          <td>{{data.endDept.dept}}</td>
        </tr>
      </tbody>
    </nz-table>
    <div class="pagination">
      <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
        (nzPageIndexChange)="getList(pageIndex)"
        (nzPageSizeChange)="getList(pageIndex)">
      </nz-pagination>
    </div>
  </div>
  <div class="btns">
    <button class=" btn cancel" nz-button nzType="default" (click)="closeHandler()">关闭</button>
  </div>
</div>
<!-- 批量建单设置 - 新增模态框 -->
<div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
  <div class="modalBody">
    <div class="title">新增批量建单设置<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
    </div>
    <div class="content">
      <form nz-form [formGroup]="validateForm" class="addForm">
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="initiatingDepartment">发起科室</nz-form-label>
          <nz-form-control nzErrorTip="请选择发起科室!">
            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="initiatingDepartment" nzShowSearch
              nzPlaceHolder="请选择发起科室" nzServerSearch (nzOnSearch)="changeInp($event,'initiating')"
              (nzOpenChange)="changeFormDept($event)" (ngModelChange)="selectedDeptHandler($event,'initiating')">
              <ng-container *ngFor="let data of initiatingDepartments">
                <nz-option *ngIf="!isLoading" [nzLabel]="data.dept" [nzValue]="data._uid">
                </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
              nzPlaceHolder="请选择起点科室" nzServerSearch (nzOnSearch)="changeInp($event,'start')"
              (nzOpenChange)="changeFormDept($event)" (ngModelChange)="selectedDeptHandler($event,'start')"
              [nzDisabled]="startDepartmentsDisabled">
              <ng-container *ngFor="let data of startDepartments">
                <nz-option *ngIf="!isLoading" [nzLabel]="data.dept" [nzValue]="data._uid">
                </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 [nzDropdownMatchSelectWidth]="false" formControlName="endDepartment" nzShowSearch
              nzPlaceHolder="请选择终点科室" nzServerSearch (nzOnSearch)="changeInp($event,'end')"
              (nzOpenChange)="changeFormDept($event)" (ngModelChange)="selectedDeptHandler($event,'end')"
              [nzDisabled]="endDepartmentsDisabled">
              <ng-container *ngFor="let data of endDepartments">
                <nz-option *ngIf="!isLoading" [nzLabel]="data.dept" [nzValue]="data._uid">
                </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]="saveLoading">保存</button>
      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
    </div>
  </div>
</div>
<!-- 删除模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="loading3"
(confirmDelEvent)="confirmDel()" content="您确认要删除吗？"></app-dialog-delete>
