<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-01-12 10:52:50
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-01-18 17:16:18
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\contract-management\\components\\contract-template\\contract-template.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->

<!-- 搜索表单 -->
<page-header-wrapper [title]="'合同模板'">
</page-header-wrapper>
<nz-card>
  <div nz-row nzGutter="8">
    <!-- 查询字段小于或等于3个时，不显示伸缩按钮 -->
    <div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
      <sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="service.http.loading"
        (formSubmit)="st?.load(1)" (formReset)="resetSF()"></sf>
    </div>

    <!-- 查询字段大于3个时，根据展开状态调整布局 -->
    <ng-container *ngIf="queryFieldCount > 4">
      <div nz-col [nzSpan]="_$expand ? 24 : 18">
        <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
      </div>
      <div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
        <button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading"
          (click)="st?.load(1)">查询</button>
        <button nz-button nzType="primary" 
         >导出</button>
        <button nz-button (click)="resetSF()">重置</button>
        <button nz-button nzType="link" (click)="expandToggle()">
          {{ !_$expand ? '展开' : '收起' }}
          <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
        </button>
      </div>
    </ng-container>
  </div>
</nz-card>

<nz-card >
  <div class="NewBtn">
    <button  nz-button nzType="primary"(click)="creatTemplate()">
    新建
</button> 
  </div>
  <div style="margin-top: 15px;">
    <st
    #st
    [bordered]="true"
    [data]="service.$api_get_contractTemplate_page"
    [columns]="columns"
    [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
    [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
    [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
    [loading]="service.http.loading"
    >
    <ng-template st-row="templateName" let-item let-index="index">
      <a (click)="view(item)">{{item.templateName}}</a>
    </ng-template>
    </st>
  </div>
</nz-card>
