<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 class="list-template__searchItem">
          <span class="label">药品标识</span>：
          <input nz-input class="formItem" [(ngModel)]="drugCode" placeholder="请输入药品标识" nzSize="default" />
        </div>
        <div class="list-template__searchItem">
          <span class="label">药品名称</span>：
          <input nz-input class="formItem" [(ngModel)]="name" placeholder="请输入药品名称" nzSize="default" />
        </div>
      </div>
      <div nz-col nzXl='6' class="list-template__btns">
        <button nz-button class="btn default" (click)='search()'>搜索</button>
        <button nz-button class="btn ml8 default" (click)='reset()'>重置</button>
        <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="5%">序号</th>
            <th nzWidth="10%">药品标识</th>
            <th nzWidth="20%">药品名称</th>
            <th nzWidth="10%">规格</th>
            <th nzWidth="9%">单位</th>
            <th nzWidth="9%">单价</th>
            <th nzWidth="9%">包装规格</th>
            <th nzWidth="9%">低舍</th>
						<th nzWidth="9%">高入</th>
            <th nzWidth="10%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let index=index;">
            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
            <td>{{ data.drugCode||'-' }}</td>
            <td>{{ data.drugName||'-' }}</td>
            <td>{{ data.specs||'-'}}</td>
            <td>{{ data.unit||'-' }}</td>
            <td>{{ data.unitPrice||'-' }}</td>
            <td>{{ data.packingSpecs }}</td>
						<td>{{ data.lowerRound }}</td>
						<td>{{ data.upperRound }}</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="drugCode">药品标识</nz-form-label>
          <nz-form-control nzErrorTip="请填写药品标识!">
            <nz-input-group>
              <input type="text" pattern="^[^\u4e00-\u9fa5]+$" (input)="handleInput($event)"
							nz-input formControlName="drugCode" placeholder="请填写药品标识" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="drugName">药品名称</nz-form-label>
          <nz-form-control nzErrorTip="请填写药品名称!">
            <nz-input-group>
              <input type="drugName" nz-input formControlName="drugName" placeholder="请填写药品名称" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="specs">规格</nz-form-label>
          <nz-form-control nzErrorTip="请填写规格!">
            <nz-input-group>
              <input type="specs" nz-input formControlName="specs" placeholder="请填写规格" />
            </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-input-group>
              <input nz-input formControlName="unit" 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-number
							formControlName="unitPrice"
            	[nzMin]="0"
							[nzPrecision]="2"
            	[nzMax]="999999"
            	[nzStep]="0.1"
            	[nzPlaceHolder]="'请填写单价(保留2位小数)'"
            ></nz-input-number>
          </nz-form-control>
        </nz-form-item>
				<nz-form-item>
				  <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="packingSpecs">包装规格</nz-form-label>
				  <nz-form-control nzErrorTip="请填写包装规格!">
				    <nz-input-group>
							<nz-input-number
								formControlName="packingSpecs"
								[nzMin]="0"
								[nzPrecision]="0"
								[nzMax]="999999"
								[nzStep]="1"
								[nzPlaceHolder]="'请填写包装规格'"
							 ></nz-input-number>
						 </nz-input-group>
				  </nz-form-control>
				</nz-form-item>
				<nz-form-item>
				  <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="lowerRound">低舍</nz-form-label>
				  <nz-form-control nzErrorTip="请填写低舍!">
				    <nz-input-group>
							<nz-input-number
								(ngModelChange)="lowerChange($event)"
								formControlName="lowerRound"
								[nzMin]="0"
								[nzPrecision]="0"
								[nzMax]="999999"
								[nzStep]="1"
								[nzPlaceHolder]="'请填写低舍'"
							 ></nz-input-number>
						</nz-input-group>
				  </nz-form-control>
				</nz-form-item>
				<nz-form-item>
				  <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="upperRound">高入</nz-form-label>
				  <nz-form-control nzErrorTip="请填写高入!">
				    <nz-input-group>
							<nz-input-number
								formControlName="upperRound"
								[nzDisabled]="true"
								[nzMin]="0"
								[nzPrecision]="0"
								[nzMax]="999999"
								[nzStep]="1"
								[nzPlaceHolder]="'请填写高入'"
							 ></nz-input-number>
						</nz-input-group>
				  </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()" (cancelDelEvent)="cancelDel()" content="是否删除药品信息？" confirmTxt="是" cancelTxt="否">
</app-dialog-delete>

<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo"></app-prompt-modal>

<!-- 查看详情 -->
<router-outlet (deactivate)="getList()"></router-outlet>

