<div class="content-heading justify-content-between">
  <div>基础配置 -方向管理</div>
  <div>
      <a [hidden]="viewStep !=='page' " href="#" (click) = "optrAspect('add', initAspect)"><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('aspect_name')">方向名称</a></th>
      <th><a (click)="page.sort('aspect_code')">方向代码</a></th>
      <th><a (click)="page.sort('major_name')">所属方向</a></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.aspect_name}}</td>
      <td>{{v.aspect_code}}</td>
      <td>{{v.major_name}}</td>
      <td [innerHTML]="v.aspect_status | frameStatus"></td>
      <td>{{v.aspect_ticket_rule}}</td>
      <td>{{v.subject_count}}</td>
      <td>{{v.fee_name}}（{{v.fee_amount/100 | currency : 'CNY' : 'symbol-narrow'}}）</td>
      <td>
        <a class="ml-3" href="#" (click)="optrAspect('edit', v, 'cf/aspect/find.htm')"><em class="fa-lg fas fa-edit "></em></a>
        <a frameRole res="cf_manage" class="ml-3" href="#" (click)="page.optr('cf/aspect/del.htm',{aspect_id:v.aspect_id},undefined,'方向【'+v.aspect_name+'】已成功删除！')"><em class="fa-lg fas fa-trash text-danger"></em></a>
      </td>
    </tr>
    </tbody>
  </table>
  <frame-pager [url]="'cf/aspect/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="aspect_name" [formControl]="valForm.controls['aspect_name']" [(ngModel)]="entity.aspect_name" />
            <span class="text-danger" *ngIf="valForm.controls['aspect_name'].hasError('required') && (valForm.controls['aspect_name'].dirty || valForm.controls['aspect_name'].touched)">请输入方向名称</span>
            <span class="text-danger" *ngIf="valForm.controls['aspect_name'].hasError('rangewords') && (valForm.controls['aspect_name'].dirty ||valForm.controls['aspect_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_id" [formControl]="valForm.controls['major_id']" [(ngModel)]="entity.major_id" >
              <option value="">请选择专业</option>
              <option *ngFor="let v of majorArray" value="{{v.major_id}}">{{v.major_name}}</option>
            </select>
            <span class="text-danger" *ngIf="valForm.controls['major_id'].hasError('required') && (valForm.controls['major_id'].dirty || valForm.controls['major_id'].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="aspect_fee_id" [formControl]="valForm.controls['aspect_fee_id']" [(ngModel)]="entity.aspect_fee_id" >
              <option value="">请选择费用</option>
              <option *ngFor="let v of feeArray" value="{{v.fee_id}}">{{v.fee_name}}</option>
            </select>
            <span class="text-danger" *ngIf="valForm.controls['aspect_fee_id'].hasError('required') && (valForm.controls['aspect_fee_id'].dirty || valForm.controls['aspect_fee_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">
          <select class="custom-select" [(ngModel)]="entity.aspect_status" frameDict [dictName]="'FrameStatus'" [tipFlag]="false"></select>
         </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.aspect_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.aspect_ticket_rule" />
        </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.aspect_desc" rows="5"></textarea>
        </div>
      </div>
      <div class="card-footer mt-2 text-center">
        <button class="btn btn-info" (click)="submitForm('cf/aspect/')">{{getStepName()}}报考大类</button>&nbsp;&nbsp;&nbsp;
        <button class="btn btn-default" (click)="viewStep ='page'">取消操作</button>
      </div>
    </div>
  </div>
</div>


