<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl='16' class="list-template__searchBox">
        <div class="list-template__searchItem">
          <span class="label">公司名称</span>：
          <input nz-input class="formItem" placeholder="请输入公司名称" [(ngModel)]="searchDto.name" />
        </div>
        <div class="list-template__searchItem">
          <span class="label">公司分类</span>：
          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择公司分类" [(ngModel)]="searchDto.companyTypeIds">
            <ng-container *ngFor="let option of companyTypeList">
              <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="8" class="list-template__btns">
        <button nz-button class="btn default ml8" (click)='search()'>搜索</button>
        <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
        <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="14%">公司编号</th>
            <th nzWidth="14%">公司全称</th>
            <th nzWidth="14%">公司简称</th>
            <th nzWidth="14%">公司分类</th>
            <th nzWidth="14%">联系人</th>
            <th nzWidth="14%">联系电话</th>
            <th nzWidth="11%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let i = index">
            <td>{{data.code}}</td>
            <td>{{data.name}}</td>
            <td>{{data.nickName}}</td>
            <td>{{data.companyTypeList | dataToName:'name':'，'}}</td>
            <td>{{data.contacts}}</td>
            <td>{{data.mphone}}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.edit" (click)="edit($event, data)">编辑</span>
                <span *ngIf="coopBtns.del" (click)="showDelModal($event, 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 class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
    <div class="modalBody">
      <div class="title">{{modelName}}<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i></div>
      <div class="content">
        <form nz-form [formGroup]="validateForm" class="addForm">
          <nz-form-item *ngIf="!add">
            <nz-form-label [nzSpan]="5" nzRequired>公司编号</nz-form-label>
            <nz-form-control [nzSpan]="19">
              {{coopData.code}}
            </nz-form-control>
          </nz-form-item>
					<nz-form-item>
					  <nz-form-label [nzSpan]="5" nzRequired nzFor="name">使用范围</nz-form-label>
					  <nz-form-control [nzSpan]="19" nzErrorTip="请输入使用范围!">
					    <nz-radio-group formControlName="employScope">
					    	<label nz-radio [nzValue]="i.id" *ngFor="let i of scopeList" [nzDisabled]="i.disabled">{{i.name}}</label>
					    	<!-- <label nz-radio nzValue="1">院区内使用</label> -->
					    	<!-- <label nz-radio nzValue="2" *ngIf="currentHospital.parentDeptId">部门内使用</label> -->
					    	<!-- <label nz-radio nzValue="3" *ngIf="currentHospital.parent || currentHospital.parentDeptId">垂直部门使用</label> -->
					    </nz-radio-group>
					  </nz-form-control>
					</nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzRequired nzFor="name">公司全称</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请输入公司全称!">
              <nz-input-group>
                  <input formControlName="name" nz-input placeholder="请输入公司全称">
              </nz-input-group>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzRequired nzFor="nickName">公司简称</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请输入公司简称!">
              <nz-input-group>
                  <input formControlName="nickName" nz-input placeholder="请输入公司简称">
              </nz-input-group>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzRequired nzFor="companyTypeIds">公司分类</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请选择公司分类!">
              <nz-checkbox-group formControlName="companyTypeIds"></nz-checkbox-group>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzFor="contacts">&nbsp;&nbsp;联&nbsp;系&nbsp;人</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请输入联系人!">
              <nz-input-group>
                  <input formControlName="contacts" nz-input placeholder="请输入联系人">
              </nz-input-group>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzFor="mphone">&nbsp;&nbsp;联系电话</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请输入联系电话!">
              <nz-input-group>
                  <input formControlName="mphone" nz-input placeholder="请输入联系电话">
              </nz-input-group>
            </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>
