<div class="content-heading justify-content-between">
  <div>基础配置 -专业管理</div>
  <div>
      <a [hidden]="viewStep !=='page' " href="#" (click) = "optrMajor('add', initMajor)"><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('major_name')">专业名称</a></th>
      <th><a (click)="page.sort('category_name')">所属大类</a></th>
      <th>状态</th>
      <th><a (click)="page.sort('major_code')">编号</a></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.major_name}}</td>
      <td>{{v.category_name}}</td>
      <td [innerHTML]="v.major_status | frameStatus"></td>
      <td>{{v.major_code}}</td>
      <td>{{v.major_count}}</td>
      <td>{{v.major_aspect_limit}}</td>
      <td>
        <a class="ml-3" href="#" (click)="optrMajor('edit', v, 'cf/major/find.htm')"><em class="fa-lg fas fa-edit "></em></a>
        <a frameRole res="cf_manage" class="ml-3" href="#" (click)="page.optr('cf/major/del.htm',{major_id:v.major_id},undefined,'专业【'+v.major_id+'】已成功删除！')"><em class="fa-lg fas fa-trash text-danger"></em></a>
      </td>
    </tr>
    </tbody>
  </table>
  <frame-pager [url]="'cf/major/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="major_name" [formControl]="valForm.controls['major_name']" [(ngModel)]="entity.major_name" />
            <span class="text-danger" *ngIf="valForm.controls['major_name'].hasError('required') && (valForm.controls['major_name'].dirty || valForm.controls['major_name'].touched)">请输入专业名称</span>
            <span class="text-danger" *ngIf="valForm.controls['major_name'].hasError('rangewords') && (valForm.controls['major_name'].dirty ||valForm.controls['major_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="major_status" [formControl]="valForm.controls['major_status']" [(ngModel)]="entity.major_status" frameDict [dictName]="'FrameStatus'"></select>
            <span class="text-danger" *ngIf="valForm.controls['major_status'].hasError('required') && (valForm.controls['major_status'].dirty || valForm.controls['major_status'].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_id" [formControl]="valForm.controls['category_id']" [(ngModel)]="entity.category_id" >
              <option value="">请选择大类</option>
              <option *ngFor="let v of categoryArray" value="{{v.category_id}}">{{v.category_name}}</option>
            </select>
            <span class="text-danger" *ngIf="valForm.controls['category_id'].hasError('required') && (valForm.controls['category_id'].dirty || valForm.controls['category_id'].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.major_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.major_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.major_aspect_limit" />
        </div>

      </div>


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


