<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="25%">预制名称</th>
            <th nzWidth="25%">序号名称</th>
            <th nzWidth="25%">条码样式</th>
            <th nzWidth="25%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let index=index;">
            <td>{{ data.title }}</td>
            <td>{{ data.snConfigDTO ? data.snConfigDTO.title : '' }}</td>
            <td>{{ data.codeType ? data.codeType.name : '' }}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.generateQRcode" (click)="generateQRcode(data)">生成</span>
                <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="title">预制名称</nz-form-label>
          <nz-form-control nzErrorTip="请填写预制名称!">
            <nz-input-group>
              <input nz-input formControlName="title" placeholder="请填写预制名称" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="snConfig">序号名称</nz-form-label>
          <nz-form-control nzErrorTip="请选择序号名称!">
            <nz-select (nzOnSearch)="changeInp($event)" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear formControlName="snConfig" nzPlaceHolder="请选择序号名称">
              <ng-container *ngFor="let option of snConfigs">
                <nz-option *ngIf="!isLoading" [nzLabel]="option.title" [nzValue]="option.id"></nz-option>
              </ng-container>
              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
              </nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="codeType">条码样式</nz-form-label>
          <nz-form-control nzErrorTip="请选择条码样式!">
            <nz-select [nzDropdownMatchSelectWidth]="false" nzShowSearch nzAllowClear
              formControlName="codeType" nzPlaceHolder="请选择条码样式">
              <nz-option [nzLabel]="data.name" [nzValue]="data.id" *ngFor="let data of codeTypes">
              </nz-option>
            </nz-select>
          </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>
<!-- 生成模态框 -->
<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="generateModal">
  <div class="modalBody">
    <div class="title">条码生成<i class="icon_transport transport-guanbi" (click)="hideGenerateModal()"></i>
    </div>
    <overlay-scrollbars #osComponentRef1 class="content">
      <form nz-form [formGroup]="validateGenerateForm" class="addForm" (ngSubmit)="submitGenerateForm()">
        <nz-form-item *ngIf="coopData.snConfigDTO.dateType">
          <nz-form-label [nzSm]="8" [nzXs]="24" nzRequired nzFor="date">选择日期（{{dateText}}）</nz-form-label>
          <nz-form-control nzErrorTip="请选择日期（{{dateText}}）!">
            <div>
              <nz-year-picker class="w100" *ngIf="isYear && !isMonth && !isDay" formControlName="date" nzPlaceHolder="请选择日期（{{dateText}}）"></nz-year-picker>
              <nz-month-picker class="w100" *ngIf="isYear && isMonth && !isDay" formControlName="date" nzPlaceHolder="请选择日期（{{dateText}}）"></nz-month-picker>
              <nz-date-picker class="w100" *ngIf="isYear && isMonth && isDay" formControlName="date" nzPlaceHolder="请选择日期（{{dateText}}）"></nz-date-picker>
            </div>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="count">生成数量</nz-form-label>
          <nz-form-control nzErrorTip="请选择生成数量!">
            <div style="margin-top: 15px;">
              <nz-input-number nz-input formControlName="count" nzPlaceHolder="请填写生成数量" [nzMin]="1" [nzStep]="1" [nzPrecision]="0"></nz-input-number>
            </div>
          </nz-form-control>
        </nz-form-item>
      </form>
    </overlay-scrollbars>
    <div class="display_flex justify-content_flex-center">
      <button nzType="primary" nz-button (click)="submitGenerateForm()" [nzLoading]="btnLoading">生成打印</button>
      <button class="btn cancel" nz-button nzType="default" (click)="hideGenerateModal()">取消</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>

<!-- 打印二维码的内容 -->
<div id="print-section" hidden>
  <table>
    <tr style="overflow: hidden;box-sizing: border-box;page-break-inside:avoid;" *ngFor="let item of codeList">
      <td style="padding:0;width: 70mm;height: 50mm;">
        <div style="display: flex;justify-content: center;align-items: center;height: 8mm;background-color: #F4EE17;-webkit-print-color-adjust: exact;font-size: 4mm;letter-spacing: 1mm;font-weight: bold;">
          医疗废物标签
        </div>
        <div style="display:flex;overflow: hidden;height: 42mm;">
          <div style="width:34mm;height: 34mm;">
            <img [src]="item.qrCode" style="height: 34mm;">
            <div style="font-size: 3mm;margin: 0 1mm 0 2mm;height: 1.5em;word-break: break-all;overflow: hidden;text-align: center;">{{item.clinicalWasteSn}}</div>
          </div>
          <div style="flex: 1;height: 34mm;">
            <div style="font-size: 3mm;margin: 1mm 0 1mm;">科室:____________________</div>
            <div style="font-size: 3mm;margin: 0; overflow: hidden;">
              <p style="float: left;margin: 0;">类型:</p>
              <ul style="margin:0;padding: 0;list-style-type: none;float: right;width: 29mm;">
                <li *ngFor="let clinicalWasteType of clinicalWasteTypes;let first = first;" style="height: 1.5em;word-break: break-all;overflow: hidden;"><span style="display: inline-block;width: 3mm;height: 3mm;border:1px solid #000;position: relative;top: 0.7mm;margin-right: 1mm;"></span>{{clinicalWasteType.typeName}}</li>
              </ul>
            </div>
          </div>
        </div>
      </td>
    </tr>
  </table>
</div>
<button ngxPrint printSectionId="print-section" #printBtn hidden [printStyle]="{ '@page': { margin: '0 !important' }, 'body': { margin: '0 !important' } }">打印</button>

