import { Component, OnInit } from '@angular/core';
import { FlexTableComponent } from '../../../../../shared/common/FlexTable.component';
import { FrameRequest } from '../../../../../shared/frame/frame-request';
import { AppComponent } from '../../../../..';

@Component({
  selector: 'app-exam-bar-code',
  templateUrl: './exam-bar-code.component.html',
  styleUrls: ['./exam-bar-code.component.scss']
})
export class ExamBarCodeComponent extends FlexTableComponent implements OnInit {

  QUERY_URL = "kw/kwLayoutDetail/pagedetail.htm";
  EXPORT_URL = "kw/kwLayoutDetail/exportDetail.htm";
  examTimeIdArray=[];

  constructor() {
    super();
    FrameRequest.requestArray('pl/plExamTime/listtime.htm', {}, (array) => {
      this.examTimeIdArray = array;
    });
  }

  ngOnInit() {
  }

  query = {
    exam_time_id: "",
    query: ""
  };

  search(param) {
    // if (this.query.exam_time_id) {
    //   this.query.exam_time_id = "";
    // }
    param.exam_time_id=this.query.exam_time_id;
    param.query=this.query.query;
  }

  //导出考点考场数
  export() {
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXPORT_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg('导出成功');
    });
  }

  exportPdf() {
    FrameRequest.download("kw/nomal/barcode/exportpdf.htm",this.query);
  }

  exportExcel() {
    FrameRequest.download("kw/nomal/barcode/exportxls.htm",this.query);
  }
}
