<div class="modal-header">
  <h4 class="modal-title pull-left">{{ResponseEntity.category_name}}-{{ResponseEntity.material_name}}-文字补充</h4>
</div>
<div class="modal-body" *ngIf="step == 'add'||step == 'edit'">
  <div class="card card-default">
    <div class="card-body">
      <div class="form-group row">
        <label class="col-lg-2 col-form-label text-lg-right">补充项目</label>
        <div class="col-lg-4 col-md-4">
          <input class="form-control" type="text" [(ngModel)]="currentEntity.attr_name"/>
        </div>
      </div>
      <div class="form-group row">
        <label class="col-lg-2 col-form-label text-lg-right">是否必填</label>
        <div class="col-lg-4 col-md-4">
          <ngx-select [items]="'YesOrNo' | frameDict" [(ngModel)]="currentEntity.attr_requrid"
                      optionValueField="dict_value" optionTextField="dict_text"></ngx-select>
        </div>
      </div>
      <div class="form-group row">
        <label class="col-lg-2 col-form-label text-lg-right">格式</label>
        <div class="col-lg-4 col-md-4">
          <ngx-select [items]="'TextFormart' | frameDict" [(ngModel)]="currentEntity.attr_formart"
                      optionValueField="dict_value" optionTextField="dict_text"></ngx-select>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="modal-footer">
  <button class="btn btn-primary" *ngIf="step == 'add'" type="button" (click)="save()">保存</button>
  <button class="btn btn-primary" *ngIf="step == 'edit'" type="button" (click)="update()">保存</button>
  <button class="btn btn-secondary" *ngIf="step != 'page'" type="button" (click)="goPage()">返回</button>
</div>
<div class="modal-body" *ngIf="step == 'page'">
  <div class="card card-default">
    <div class="card-body">
      <div class="table-responsive bg-white table-full" style="margin-top: 5px;">
        <table class="table table-striped table-hover table-bordered">
          <thead>
          <tr>
            <th>补充项目</th>
            <th>是否必填</th>
            <th>格式</th>
            <th></th>
          </tr>
          </thead>
          <tbody>
          <tr *ngFor="let v of pager.getRecords(); let i = index">
            <td>{{v.attr_name}}</td>
            <td>{{v.attr_requrid | frameDict:'YesOrNo'}}</td>
            <td>{{v.attr_formart | frameDict:'TextFormart'}}</td>
            <td>
              <span class="table-button" (click)="goEdit(v)"><em class="fa-lg fas fa-edit"></em></span>
              <span class="table-button ml-1 text-danger" (click)="pager.optrRecord('cf/material/textattr/delete.htm', v, {successMsg:'已删除！', confirmMsg: '谨慎操作，确定要删除吗？', successMsgType:'Swal'})"><em
                class="fa-lg fas fa-trash-alt "></em></span>
            </td>
          </tr>
          </tbody>
        </table>
        <frame-pager [url]="'./cf/material/textattr/page.htm'"
          [pagerParams]="{material_def_id: this.ResponseEntity.material_def_id}" #pager></frame-pager>
      </div>
    </div>
  </div>
</div>
<div class="modal-footer" *ngIf="step == 'page'">
<!--  <button class="btn btn-primary" type="button" (click)="doUploadFile()">导入数据</button>-->
  <button class="btn btn-primary" type="button" (click)="goAdd()">新增</button>
  <button class="btn btn-secondary" type="button" (click)="closeWindow()">关闭窗口</button>
</div>
