<div class="content-heading  justify-content-between">
  <div>专业成绩</div>
  <div class="float-right">

    <div class="row">
      <div class="wd-xs">
        <ngx-select [items]="batchNameArray" [(ngModel)]="score.batch_id" (ngModelChange)="changeBatch()"
                    [autoClearSearch]="true" optionValueField="dict_value" optionTextField="dict_text"
                    placeholder="批次"></ngx-select>
      </div>
      <div class="wd-xl ml-2">
        <ngx-select [items]="aspectArray" [(ngModel)]="score.aspect_id" [autoClearSearch]="true"
                    (ngModelChange)="changeAspect()" optionValueField="aspect_id" optionTextField="aspect_value"
                    placeholder="请选择招考方向"></ngx-select>
      </div>

      <div class="btn-group ml-3 mr-5" dropdown>
        <button class="btn dropdown-toggle btn-secondary" type="button" dropdownToggle>专业成绩
          <span class="caret"></span>
        </button>
        <div *dropdownMenu class="dropdown-menu" role="menu"><a class="dropdown-item text-warning" href="#"
                                                                (click)="makeAspectScore()">重算所有专业</a>
           <div class="dropdown-divider"></div>
          <a class="dropdown-item text-warning" href="#" (click)="makeAspectScore(aspect?.aspect_id)"
             *ngIf="aspect">重算【{{aspect.aspect_name}}】</a>
             <div class="dropdown-divider"  *ngIf="aspect"></div>
             <a class="dropdown-item text-warning" href="#" (click)="ModalService.showUploadWindow(bsService,'score/aspect/upload.htm',
             {},{
               uploadTitle:'专业成绩上传',
               templateFile:'模板-专业分数导入.xls',
               uploadCallback:uploadCallback.bind(this),
               autoClose:true
             })">导入专业成绩</a>
             <div class="dropdown-divider"></div>
           <a class="dropdown-item text-warning" href="#" (click)="exportAspect(aspect?.aspect_id)">导出专业成绩(单个)</a>
           <div class="dropdown-divider"></div>
           <a class="dropdown-item text-warning" href="#" (click)="exportAspectScore()">导出专业成绩(全部)</a>
        </div>
      </div>
    </div>

  </div>
</div>


<div class="table-responsive bg-white table-full">
  <table class="table table-striped table-hover table-bordered">
    <thead>
    <tr *ngIf="score.aspect_id">
      <th></th>
      <th class="table-sort" (click)="pager.sort('province_id')">生源地</th>
      <th class="table-sort" (click)="pager.sort('ticket_no')">准考证号</th>
      <th class="table-sort" (click)="pager.sort('aspect_ticket_num')">专业考号</th>
      <th>考生姓名</th>
      <th>证件号码</th>
      <th>性别</th>
      <th class="table-sort"
          (click)="pager.sort(score.batch_id==='1'?'score_1':(score.batch_id==='2'?'score_2':'score_3'))">
        专业总分
      </th>
      <th class="table-sort"
          (click)="pager.sort(score.batch_id==='1'?'score_1_qualified':(score.batch_id==='2'?'score_2_qualified':'score_3_qualified'))">
        合格
      </th>
      <!--
      <th *ngFor="let sb of subjectArray" class="table-sort"
          (click)="pager.sort('s0'+sb.subject_id)">{{sb.subject_name}}</th>
          -->
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let v of pager.getRecords(); let i = index">
      <td>{{i + 1}}</td>
      <td>{{v.province_name}}</td>
      <td>{{v.ticket_no}}</td>
      <td>{{v.aspect_ticket_num}}</td>
      <td>{{v.std_name}}</td>
      <td>{{v.cert_id}}</td>
      <td>{{v.std_sex}}</td>
      <td *ngIf="score.batch_id === '1'">{{v.score_1_value}}</td>
      <td *ngIf="score.batch_id === '2'">{{v.score_2_value}}</td>
      <td *ngIf="score.batch_id === '3'">{{v.score_3_value}}</td>
      <td *ngIf="score.batch_id === '1'"><span
        [ngClass]="{'text-danger':v.score_1_qualified === 'InActive','text-success':v.score_1_qualified === 'Active'}">
        <span *ngIf="v.score_1_qualified === 'InActive'">不合格</span>
        <span *ngIf="v.score_1_qualified === 'Active'">合格</span>
      </span>
      </td>
      <td *ngIf="score.batch_id === '2'"><span
        [ngClass]="{'text-danger':v.score_2_qualified === 'InActive','text-success':v.score_2_qualified === 'Active'}">
        <span *ngIf="v.score_2_qualified === 'InActive'">不合格</span>
        <span *ngIf="v.score_2_qualified === 'Active'">合格</span>
      </span>
      </td>
      <td *ngIf="score.batch_id === '3'"><span
        [ngClass]="{'text-danger':v.score_3_qualified === 'InActive','text-success':v.score_3_qualified === 'Active'}">
        <span *ngIf="v.score_3_qualified === 'InActive'">不合格</span>
        <span *ngIf="v.score_3_qualified === 'Active'">合格</span>
      </span>
      </td>

      <!--
      <td *ngFor="let sb of subjectArray">{{v['s0' + sb.subject_id]}}</td>
      -->
    </tr>
    </tbody>
  </table>
  <frame-pager [url]="'./score/aspect/page.htm'" [autoRequest]="false"
               [pagerParams]="{aspect_id: score?.aspect_id,batch_id:score?.batch_id}" #pager></frame-pager>
</div>
