<div class="content-heading justify-content-between">
  <div>基础配置 - 大类管理</div>
  <div>
    <a [hidden]="viewStep !=='page' " href="#" (click) = "goViewStep('add', initCategory)"><em class="fa-lg fas icon-plus "></em></a>
  </div>
</div>
<div class="ml-0 table-responsive bg-white" [hidden]="viewStep !== 'page'">
  <table class="table table-striped table-hover table-bordered">
    <thead>
    <tr>
      <th>#</th>
      <th><a (click)="page.sort('category_name')">大类名称</a></th>
      <th>类型</th>
      <th>状态</th>
      <th>编号</th>
      <th>最大专业数</th>
      <th>最大方向数</th>
      <th style="width:110px;"></th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let v of page.getRecords(); let i = index">
      <td>{{i + 1}}</td>
      <td>{{v.category_name}}</td>
      <td [innerHTML]="v.category_type | frameDict : 'FrameRoleType'"></td>
      <td [innerHTML]="v.category_status | frameStatus"></td>
      <td>{{v.category_code}}</td>
      <td>{{v.max_major_count}}</td>
      <td>{{v.max_aspect_count}}</td>
      <td>
        <a class="ml-3" href="#" (click)="goViewStep('edit', v, 'cf/category/find.htm')"><em class="fa-lg fas fa-edit "></em></a>
        <a frameRole res="cf_manage" class="ml-3" href="#" (click)="page.optr('cf/category/del.htm',{category_id:v.category_id},undefined,'大类【'+v.category_id+'】已成功删除！')"><em class="fa-lg fas fa-trash text-danger"></em></a>
      </td>
    </tr>
    </tbody>
  </table>
  <frame-pager [url]="'cf/category/page.htm'" #page></frame-pager>
</div>


<div  [hidden]="viewStep === 'page' ">
  <div class="card card-default">
    <div class="card-body">
      <form [formGroup]="valForm"  class="form-validate form-horizontal" novalidate="">
        <div class="row" >
          <label class="col-lg-1 col-form-label text-lg-right">大类名称</label>
          <div class="col-lg-3">
            <input class="form-control" #elAutoFocus type="text" formControlName="category_name" [formControl]="valForm.controls['category_name']" [(ngModel)]="entity.category_name" />
            <span class="text-danger" *ngIf="valForm.controls['category_name'].hasError('required') && (valForm.controls['category_name'].dirty || valForm.controls['category_name'].touched)">请输入大类名称</span>
            <span class="text-danger" *ngIf="valForm.controls['category_name'].hasError('rangewords') && (valForm.controls['category_name'].dirty ||valForm.controls['category_name'].touched)">最少需要2个字符，最大允许32个字符</span>
          </div>

          <label class="col-lg-1 col-form-label text-lg-right">大类类型</label>
          <div class="col-lg-3">
            <select class="custom-select" formControlName="category_type" [formControl]="valForm.controls['category_type']" [(ngModel)]="entity.category_type" frameDict [dictName]="'CfCategoryType'" ></select>
            <span class="text-danger" *ngIf="valForm.controls['category_type'].hasError('required') && (valForm.controls['category_type'].dirty || valForm.controls['category_type'].touched)">大类类型不允许为空</span>
          </div>

          <label class="col-lg-1 col-form-label text-lg-right">大类状态</label>
          <div class="col-lg-3">
            <select class="custom-select" formControlName="category_status" [formControl]="valForm.controls['category_status']" [(ngModel)]="entity.category_status" frameDict [dictName]="'FrameStatus'"></select>
            <span class="text-danger" *ngIf="valForm.controls['category_status'].hasError('required') && (valForm.controls['category_status'].dirty || valForm.controls['category_status'].touched)">大类状态不允许为空</span>
          </div>
        </div>

      </form>
      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">专业代码</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.category_code" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">编排规则</label>
        <div class="col-lg-3">
          <input class="form-control" type="text" [(ngModel)]="entity.category_ticket_rule" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">最大专业数</label>
        <div class="col-lg-3">
          <input class="form-control" type="text" [(ngModel)]="entity.max_major_count" />
        </div>
      </div>


      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">最大方向数</label>
        <div class="col-lg-3">
          <input class="form-control" type="text" [(ngModel)]="entity.max_aspect_count" />
        </div>
      <label class="col-lg-1 col-form-label text-lg-right">描述信息</label>
      <div class="col-lg-7">
        <textarea class="form-control" [(ngModel)]="entity.category_desc" rows="5"></textarea>
      </div>
    </div>
    <div class="card-footer mt-2 text-center">
      <button class="btn btn-info" (click)="submitForm('cf/category/')">{{getStepName()}}报考大类</button>&nbsp;&nbsp;&nbsp;
      <button class="btn btn-default" (click)="viewStep ='page'">取消操作</button>
    </div>
    </div>
  </div>
</div>


