<div class="groupManagement">
  <div class="groupInfo">
    <div class="title">检查类型</div>
    <div class="operate">
      <div *ngIf="coopBtns.add" class="add item" (click)="showCoopModal('add')">新增</div>
      <div *ngIf="coopBtns.edit" class="edit item" (click)="showCoopModal('edit')">编辑</div>
      <div *ngIf="coopBtns.del" class="del item" (click)="showDelModal()">删除</div>
    </div>
    <div class="groups" [ngStyle]="{display:!buildingsLoading?'block':'none'}">
      <overlay-scrollbars #osComponentRef1 [ngStyle]="{ height:'100%' }">
        <div [ngClass]="{'item':true,'checked':data.id==checkedInspectType.id}" *ngFor="let data of inspectTypeList"
          (click)="checkBuilding(data)" [title]="data.name">{{data.name}}</div>
      </overlay-scrollbars>
    </div>
    <div class="groups" *ngIf="buildingsLoading">
      <div class="loadingFull display_flex justify-content_flex-center align-items_center">
        <div class="loadingFullInner">
          <img src="../../../assets/images/loading.gif" alt="">
          <div>加载中...</div>
        </div>
      </div>
    </div>
  </div>
  <div class="userInfo">
    <div class="top display_flex justify-content_flex-end align-items_center">
      <div class="display_flex align-items_center">
        <span>已选择 {{selectedFloor.length}} 个关键字</span>
        <button class="btn default" *ngIf="coopBtns.add&&inspectTypeList.length" nzType="primary" nz-button
          (click)="showFloorModal($event,'add')">新增</button>
        <button class="btn default" *ngIf="coopBtns.del&&inspectTypeList.length" nzType="primary" nz-button
          (click)="showDelFloorModal($event)" [disabled]="selectedFloor.length===0">批量删除</button>
      </div>
    </div>
    <div class="table" *ngIf="!buildingsLoading">
      <nz-table class="groupManagementTable" #rowSelectionTable [nzPageSize]="9999" [nzData]="allKeyword"
        [nzShowPagination]="false" [nzScroll]="{ y: tableHeight+'px' }" [nzLoading]="floorsLoading">
        <thead>
          <tr class="thead">
            <th nzWidth="5%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked"
              (nzCheckedChange)="checkAll($event)"></th>
            <th nzWidth="75%">关键字</th>
            <th nzWidth="20%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of rowSelectionTable.data" (click)="selectedUser(data)">
            <td nzShowCheckbox [(nzDisabled)]="!coopBtns.edit" [(nzChecked)]="mapOfCheckedId[data.id]"
              (nzCheckedChange)="refreshStatus()"></td>
            <td>{{ data.keyword }}</td>
            <td>
              <button nz-button nzType="primary" nzSize="small" (click)="showFloorModal($event,'edit',data)">编辑</button>
              <button nz-button nzType="primary" nzSize="small" class="ml8"
                (click)="showDelFloorModal($event,data)">删除</button>
            </td>
          </tr>
        </tbody>
      </nz-table>
    </div>
  </div>

  <!-- 新增/编辑检查类型模态框 -->
  <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="coopModal">
    <div class="modalBody">
      <div class="title">{{add?'新增':'编辑'}}检查类型信息<i class="icon_transport transport-guanbi"
          (click)="hideCoopModal()"></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="inspectTypeName">检查类型名称</nz-form-label>
            <nz-form-control nzErrorTip="请输入检查类型名称!">
              <nz-input-group>
                <input nz-input formControlName="inspectTypeName" placeholder="请输入检查类型名称" />
              </nz-input-group>
            </nz-form-control>
          </nz-form-item>
        </form>
      </div>
      <div class=" display_flex justify-content_flex-center">
        <button nzType="primary" [nzLoading]="btnLoading" nz-button (click)="submitForm()">确认</button>
        <button class="btn cancel" nz-button nzType="default" (click)="hideCoopModal()">取消</button>
      </div>
    </div>
  </div>
  <!-- 新增/编辑关键字模态框 -->
  <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="floorModal">
    <div class="modalBody">
      <div class="title">{{add?'新增':'编辑'}}关键字信息<i class="icon_transport transport-guanbi"
          (click)="hideFloorModal()"></i>
      </div>
      <div class="content">
        <form nz-form [formGroup]="validateFloorForm" class="addForm" (ngSubmit)="submitFormFloor()">
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="inspectTypeName">检查类型</nz-form-label>
            <nz-form-control nzErrorTip="请选择检查类型!">
              <nz-input-group>
                <input nz-input disabled formControlName="inspectTypeName" placeholder="请输入检查类型名称" />
              </nz-input-group>
            </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>
        </form>
      </div>
      <div class="display_flex justify-content_flex-center">
        <button nzType="primary" [nzLoading]="btnLoading" nz-button (click)="submitFormFloor()">确认</button>
        <button class="btn cancel" nz-button nzType="default" (click)="hideFloorModal()">取消</button>
      </div>
    </div>
  </div>
  <!-- 删除检查类型模态框 -->
  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
    (confirmDelEvent)="confirmDel()" content="您确认要删除检查类型吗？"></app-dialog-delete>
  <!-- 删除关键字模态框 -->
  <app-dialog-delete [delModal]="delFloorModal" (hideDelModalEvent)="hideDelFloorModal()" [btnLoading]="btnLoading"
    (confirmDelEvent)="confirmFloorDel()" content="您确认要删除关键字吗？"></app-dialog-delete>
</div>

<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>
