<div class="wechatConfig" *ngIf="!loading1">
  <overlay-scrollbars #osComponentRef1 class="main">
    <h2>微信配置</h2>
    <form nz-form [formGroup]="validateForm" class="form">
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="24" nzFor="appid" nzRequired class="label">微信APPID</nz-form-label>
        <nz-form-control [nzSpan]="24" nzErrorTip="请输入微信APPID!">
          <input nz-input formControlName="appid" id="appid" placeholder="请输入微信APPID" disabled>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="24" nzFor="secret" nzRequired class="label">微信Secret</nz-form-label>
        <nz-form-control [nzSpan]="24" nzErrorTip="请输入微信Secret!">
          <input nz-input formControlName="secret" id="secret" placeholder="请输入微信Secret">
        </nz-form-control>
      </nz-form-item>
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="24" nzFor="agentid" nzRequired class="label">微信应用的agentid</nz-form-label>
        <nz-form-control [nzSpan]="24" nzErrorTip="请输入微信应用的agentid!">
          <input nz-input formControlName="agentid" id="agentid" placeholder="请输入微信应用的agentid" disabled>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="6" nzFor="bindAccount" nzRequired class="label">是否账号绑定</nz-form-label>
        <nz-form-control [nzSpan]="18" nzErrorTip="是否账号绑定是必填项!">
          <nz-radio-group formControlName="bindAccount">
            <label nz-radio nzValue="1">是</label>
            <label nz-radio nzValue="0">否</label>
          </nz-radio-group>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="6" nzFor="autoCreateUser" nzRequired class="label">自动创建用户</nz-form-label>
        <nz-form-control [nzSpan]="18" nzErrorTip="是否自动创建用户是必填项!">
          <nz-radio-group formControlName="autoCreateUser">
            <label nz-radio nzValue="1">是</label>
            <label nz-radio nzValue="0">否</label>
          </nz-radio-group>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="24" nzFor="defaultRole" nzRequired class="label">微信默认角色</nz-form-label>
        <nz-form-control [nzSpan]="24" nzErrorTip="请输入微信默认角色!">
          <nz-select formControlName="defaultRole" nzPlaceHolder="请输入微信默认角色" nzDisabled>
            <nz-option [nzValue]="role.id" [nzLabel]="role.role" *ngFor="let role of roleList"></nz-option>
          </nz-select>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="24" nzFor="defaultHospital" nzRequired class="label">微信默认院区</nz-form-label>
        <nz-form-control [nzSpan]="24" nzErrorTip="请输入微信默认院区!">
          <nz-select formControlName="defaultHospital" nzPlaceHolder="请输入微信默认院区" (ngModelChange)="hospitalChange($event)">
            <nz-option [nzValue]="hospital.id" [nzLabel]="hospital.hosName" *ngFor="let hospital of hospitals"></nz-option>
          </nz-select>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="24" nzFor="defaultDept" nzRequired class="label">微信默认科室</nz-form-label>
        <nz-form-control [nzSpan]="24" nzErrorTip="请输入微信默认科室!">
          <nz-select (nzOnSearch)="onDeptSearchNew($event)" nzShowSearch nzServerSearch formControlName="defaultDept" nzPlaceHolder="请输入微信默认科室">
            <ng-container *ngFor="let dept of deptList">
              <nz-option *ngIf="!loading3" [nzValue]="dept.id" [nzLabel]="dept.dept"></nz-option>
            </ng-container>
            <nz-option *ngIf="loading3" nzDisabled nzCustomContent>
              <i nz-icon nzType="loading" class="loading-icon"></i> 加载中...
            </nz-option>
          </nz-select>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item class="formItem">
        <nz-form-label [nzSpan]="24" nzFor="defaultGroup" nzRequired class="label">微信默认组</nz-form-label>
        <nz-form-control [nzSpan]="24" nzErrorTip="请输入微信默认组!">
          <nz-select nzShowSearch formControlName="defaultGroup" nzPlaceHolder="请输入微信默认组">
            <nz-option [nzValue]="group.id" [nzLabel]="group.groupName" *ngFor="let group of groupList"></nz-option>
          </nz-select>
        </nz-form-control>
      </nz-form-item>
    </form>
  </overlay-scrollbars>
  <div class="submit">
    <button [disabled]="!coopBtns.edit" nz-button nzType="primary" class="save" (click)="submitForm()" [nzLoading]="loading2">保存</button>
  </div>
</div>
<div class="wechatConfig" *ngIf="loading1">
  <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>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>
