<ic-module-title [config]="formConfig"></ic-module-title>
<nz-card class="ic-tree-info-page-left">
  <nz-affix [nzOffsetTop]="64">
    <button nz-button [nzType]="'primary'" (click)="add()">
      <span>新增</span>
    </button>
<!--    <button nz-popconfirm nzPopconfirmTitle="确定删除吗?" nzOkText="确定" nzCancelText="取消" (nzOnConfirm)="deleteRows()"-->
<!--      nz-button nzDanger [disabled]="nodeCheck.length == 0">-->
<!--      {{ 'ic.actions.delete' | i18n }}-->
<!--    </button>-->
    <button nz-button [nzType]="'primary'" (click)="expandAll(false)">
      <span>{{ 'ic.actions.collapse.all' | i18n }}</span>
    </button>
    <button nz-button [nzType]="'primary'" (click)="expandAll(true)">
      <span>{{ 'ic.actions.expand.all' | i18n }}</span>
    </button>
  </nz-affix>
  <nz-input-group class="ic-tree-search-input" [nzSuffix]="suffixIcon">
    <input type="text" nz-input placeholder="{{ 'ic.actions.search' | i18n }}" [(ngModel)]="searchValue"
      (ngModelChange)="searchValueChange($event)" (keyup.enter)="startFilter()" />
  </nz-input-group>
  <ng-template #suffixIcon>
    <i nz-icon nzType="search" (click)="startFilter()"></i>
  </ng-template>
  <nz-tree #baseTree (nzCheckBoxChange)="treeChange($event)" (nzClick)="treeChange($event)" [nzData]="nodes"
    [nzSelectedKeys]="selectedKeys" [nzCheckedKeys]="checkedKeys" [nzSearchValue]="searchValue" nzVirtualHeight="600px"
    nzCheckable>
  </nz-tree>
</nz-card>
<nz-card class="ic-tree-info-page-right">
  <ng-template #indicatorTemplate></ng-template>
  <nz-spin [nzTip]="'请先选择一个节点！'" [nzIndicator]="indicatorTemplate" [nzSpinning]="formId == '-1'">
    <nz-tabset>
      <nz-tab nzTitle="基础信息">
        <sf [button]="null" #baseFormSf [schema]="baseFormSchema" [formData]="baseFormData"
          (formChange)="baseFormChange($event)" (formError)="baseFormError($event)">
          <button nz-button (click)="baseFormSf.reset()">
            {{ 'rw.incontrol.actions.reset' | i18n }}
          </button>
          <button [disabled]="!baseFormSf.valid" type="submit" nz-button nzType="primary" (click)="saveNode('save')"> 保存
          </button>
          <button [disabled]="!baseFormSf.valid" type="submit" nz-button nzType="primary"
            (click)="saveNode('addSameLevel')">
            保存并新增同级节点
          </button>
          <button [disabled]="!baseFormSf.valid" type="submit" nz-button nzType="primary"
            (click)="saveNode('addChildLevel')">
            保存并新增子节点
          </button>
        </sf>
      </nz-tab>
      <nz-tab nzTitle="用户">
        <div style="width: 80%; float: left">
          <sf #searchSf [schema]="searchSchema" [button]="null"> </sf>
        </div>
        <div style="float: left">
          <button nz-button nzType="primary" (click)="getOrganizationUserByOrgId()">搜索</button>
          <button nz-button nzType="primary" (click)="addUsers()">新增用户</button>
        </div>
        <nz-table #userTable [nzData]="userTableData" nzShowPagination="true">
          <thead>
            <tr>
              <th>账号</th>
              <th>员工名</th>
              <th>角色</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let row of userTable.data">
              <td>{{ row.account }}</td>
              <td>{{ row.userName }}</td>
              <td>{{ row.roleName }}</td>
              <td><a (click)="deleteUsers(row)">删除</a></td>
            </tr>
          </tbody>
        </nz-table>
      </nz-tab>
    </nz-tabset>
  </nz-spin>
</nz-card>
