<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>
      <div nz-col nzXl="12" class="list-template__btns">
        <button nz-button *ngIf="coopBtns.add" class="btn default ml8" (click)="addModal()">新增</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%">序号</th>
            <th nzWidth="25%">检查原科室</th>
            <th nzWidth="25%">关键字</th>
            <th nzWidth="25%">匹配的科室</th>
            <th nzWidth="25%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let i = index" (click)="selectedListData(data.id)">
            <td>{{ i+1 }}</td>
            <td>{{ data.dept }}</td>
            <td>{{ data.code }}</td>
            <td>{{ data.matchingDept }}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.edit" (click)="edit($event,data)">修改</span>
                <span *ngIf="coopBtns.del" (click)="showDelModal($event,data.id,'您确认要删除吗？','删除','del')">删除</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">
        <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
          <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+'&&'+data.dept+'&&'+data.type.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="keyword">关键字</nz-form-label>
            <nz-form-control nzErrorTip="请输入关键字!">
              <nz-input-group>
                <input nz-input formControlName="keyword" placeholder="请输入关键字" />
              </nz-input-group>
            </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 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+'&&'+data.dept}}">
                  </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>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>
<!-- 遮罩 -->
<app-mask *ngIf="maskFlag"></app-mask>
