import { Component, OnInit } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { FrameService } from 'src/app/core/service/frame.service';
import { FramePageComponent } from 'src/app/routes/frame/core/page/frame.page';

@Component({
  selector: 'app-exam-interview-no-complete',
  templateUrl: './exam-interview-no-complete.component.html',
  styleUrls: ['./exam-interview-no-complete.component.scss']
})
export class ExamInterviewNoCompleteComponent extends FramePageComponent implements OnInit {

  aspectArr = [];
  batchArr = [];
  query= {
    aspect_batch: '1',
    aspect_id: ''
  };

  constructor(private modalService: BsModalService) {
    super(modalService);
   }

  ngOnInit(): void {
      this.batchArr = FrameService.getFrameDictArray('ExamBatchName');
      setTimeout(() => {
        if(!this.query.aspect_batch) this.query.aspect_batch='1';
        this.requestAspect();
      }, 100);
  }
  

  requestAspect() {
    this.AjaxService.requestArray('conf/aspect/list/by/batch.htm', {aspect_batch: this.query.aspect_batch}, (array) => {
      this.aspectArr = array;
      for(const aspect of this.aspectArr) {
        aspect.aspect_text = aspect.aspect_code +'|' +aspect.aspect_name;
      }
      this.aspectArr.unshift({aspect_id: '', aspect_text: '所有'});
      this.reloadStd();
    });
  }

  //重新加载
  reloadStd() {
    this.pager.reload({aspect_batch: this.query.aspect_batch, aspect_id: this.query.aspect_id});
  }

  //导出考生
  exportStd() {
    this.FuncService.ajaxDownload('exam/no/complete/std/export.htm', {aspect_batch: this.query.aspect_batch, aspect_id: this.query.aspect_id});
  }

}
