<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl='18' class="list-template__searchBox"></div>
      <div nz-col nzXl='6' class="list-template__btns">
        <button nz-button *ngIf="coopBtns.add" class="btn ml8 default" (click)="showModal()">新增</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="20%">类型名称</th>
            <th nzWidth="16%">单价</th>
            <th nzWidth="16%">单位</th>
            <th nzWidth="16%">储存单位</th>
            <th nzWidth="16%">库存限制天数</th>
            <th nzWidth="16%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let index=index;">
            <td>{{ data.typeName }}</td>
            <td>{{ data.unitPrice }}</td>
            <td>{{ data.unit ? data.unit.name : '' }}</td>
            <td>{{ data.storageUnit ? data.storageUnit.name : '' }}</td>
            <td>{{ data.inventoryDays }}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.edit" (click)="edit(data)">修改</span>
                <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
        </nz-pagination>
      </div>
    </div>
  </div>
</div>
<!-- 新增/编辑模态框 -->
<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
  <div class="modalBody">
    <div class="title">{{add?"新增":"编辑"}}医费类型<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
    </div>
    <overlay-scrollbars #osComponentRef1 class="content">
      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="typeName">类型名称</nz-form-label>
          <nz-form-control nzErrorTip="请填写类型名称!">
            <nz-input-group>
              <input nz-input formControlName="typeName" placeholder="请填写类型名称" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="unitPrice">单价</nz-form-label>
          <nz-form-control nzErrorTip="请输入单价!">
            <nz-input-group>
              <nz-input-number formControlName="unitPrice" placeholder="请输入单价" [nzMin]="0" [nzStep]="1" [nzPrecision]="2"></nz-input-number>
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="unit">单位</nz-form-label>
          <nz-form-control nzErrorTip="请选择单位!">
            <nz-select [nzDropdownMatchSelectWidth]="false" nzShowSearch nzAllowClear
              formControlName="unit" nzPlaceHolder="请选择单位">
              <nz-option [nzLabel]="data.name" [nzValue]="data.id" *ngFor="let data of units">
              </nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="storageUnit">储存单位</nz-form-label>
          <nz-form-control nzErrorTip="请选择储存单位!">
            <nz-select [nzDropdownMatchSelectWidth]="false" nzShowSearch nzAllowClear
              formControlName="storageUnit" nzPlaceHolder="请选择储存单位">
              <nz-option [nzLabel]="data.name" [nzValue]="data.id" *ngFor="let data of storageUnits">
              </nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="inventoryDays">库存限制天数</nz-form-label>
          <nz-form-control nzErrorTip="请填写库存限制天数!">
            <div style="margin-top: 15px;">
              <nz-input-number nz-input formControlName="inventoryDays" nzPlaceHolder="请填写库存限制天数" [nzMin]="0" [nzStep]="1" [nzPrecision]="0"></nz-input-number>
              <span class="red">（零为不限制，1以上为限制）</span>
            </div>
          </nz-form-control>
        </nz-form-item>
      </form>
    </overlay-scrollbars>
    <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)="hideModal()">取消</button>
    </div>
  </div>
</div>
<!-- 删除模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
  (confirmDelEvent)="confirmDel()" content="您确认要删除吗？">
</app-dialog-delete>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo"></app-prompt-modal>

<!-- 遮罩 -->
<app-mask *ngIf="maskFlag"></app-mask>
