<div class="searchBar" @fade>
  <app-search-select [(value)]="companyNo" [label]="'selectCompany' | translate" optL="companyName"
                     [data]="companys" optV="companyNo"></app-search-select>
  <div class="btnLine">
    <button nz-button class="searchBtn" [nzType]="'primary'" [nzLoading]="isLoading" (click)="onSearch()"><span>{{'search' | translate}}</span></button>
    <button nz-button class="searchBtn" [nzLoading]="isLoading" (click)="onGetAll()"><span>{{'allData' | translate}}</span></button>
    <button nz-button class="searchBtn" [nzLoading]="isLoading" (click)="add()"><span>{{'add' | translate}}</span></button>
  </div>
</div>
<div class="tableBar" @fade>
  <nz-table #nzTable
            [nzData]="data"
            [nzLoading]="isLoading">
    <thead nz-thead>
    <tr>
      <th nz-th><span>{{'num' | translate}}</span></th>
      <th nz-th><span>{{'databaseName' | translate}}</span></th>
      <th nz-th><span>{{'companyName' | translate}}</span></th>
      <th nz-th><span>{{'field' | translate}}</span></th>
      <th nz-th><span>{{'dbPolicy' | translate}}</span></th>
      <th nz-th><span>{{'dbState' | translate}}</span></th>
      <th nz-th><span>{{'description' | translate}}</span></th>
      <th nz-th><span>{{'remark' | translate}}</span></th>
      <th nz-th><span>{{'oper' | translate}}</span></th>
    </tr>
    </thead>
    <tbody nz-tbody>
    <tr *ngFor="let one of nzTable.data,let i = index">
      <td nz-td>{{i + 1}}</td>
      <td nz-td>{{one.databaseName}}</td>
      <td nz-td>{{one.companyName}}</td>
      <td nz-td>{{one.field}}</td>
      <td nz-td>{{one.policy}}</td>
      <td nz-td>{{one.state}}</td>
      <td nz-td>{{one.description}}</td>
      <td nz-td>{{one.remark}}</td>
      <td nz-td>
        <span class="editSpan" (click)="edit(one)">{{'edit' | translate}}</span>
        <nz-divider nzType="vertical"></nz-divider>
        <span class="deleteFontColor" (click)="deleteConfirm(one)">{{'delete' | translate}}</span>
      </td>
    </tr>
    </tbody>
  </nz-table>
</div>

<nz-modal [(nzVisible)]="isVisible" [nzTitle]="(isUpdate ? 'editUser' : 'addUser') | translate" [nzContent]="modalContent" nzWidth="500"
          [nzFooter]="modalFooter" (nzOnCancel)="cancel()" nzMaskClosable="false">
  <ng-template #modalContent>
    <app-search-item isMust="true" [(value)]="req.databaseName" [label]="'databaseName' | translate" inModal="true"></app-search-item>
    <app-search-item isMust="true" [(value)]="req.field" [label]="'field' | translate" inModal="true"></app-search-item>
    <app-search-item isMust="true" [(value)]="req.description" [label]="'description' | translate" inModal="true"></app-search-item>
    <app-search-select isMust="true" [(value)]="req.companyNo" [label]="'selectCompany' | translate" optL="companyName"
                       [data]="companys" inModal="true" optV="companyNo"></app-search-select>
    <app-search-select isMust="true" [(value)]="req.state" [label]="'dbState' | translate" optL="a" optV="b"
                       [data]="[{a: '好', b: 1}, {a: '坏', b: 0}]" inModal="true"></app-search-select>
    <app-search-item isMust="true" [(value)]="req.policy" [label]="'dbPolicy' | translate" inModal="true"></app-search-item>
    <app-search-item [(value)]="req.remark" [label]="'remark' | translate" inModal="true"></app-search-item>
  </ng-template>
  <ng-template #modalFooter>
    <button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel()"><span>{{'cancel' | translate}}</span></button>
    <button nz-button class="searchBtn" nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span></button>
  </ng-template>
</nz-modal>
