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

@Component({
  selector: 'app-security-code-report',
  templateUrl: './security-code-report.component.html',
  styleUrls: ['./security-code-report.component.scss']
})
export class SecurityCodeReportComponent implements OnInit {
  
  BMH_URL = "kw/kwLayoutDetail/exportBmhDbf.htm";
  COURSE_URL = "kw/kwLayoutDetail/exportCourseDbf.htm";
  UNIT_URL = "kw/kwLayoutDetail/exportUnitDbf.htm";
  CITY_URL = "kw/kwLayoutDetail/exportCityDbf.htm";
  EXAMTIME_URL =  "kw/kwLayoutDetail/exportExamTime.htm";
  SJD_URL =  "kw/kwLayoutDetail/exportSjdDbf.htm";
 
  
  YEAR_CODE_URL = "pl/plExamTime/list.htm";

  constructor() { }

  public query = {
    exam_time_id: 0
  };

  ngOnInit() {
  }

  exportBmh() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.BMH_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("保密号信息dbf导出成功");
    });
  }

  exportCourseDbf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.COURSE_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("课程信息dbf导出成功");
    });
  }

  exportUnitDbf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.UNIT_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("考点信息dbf导出成功");
    });
  }

  exportCityDbf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.CITY_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("地市信息dbf导出成功");
    });
  }


  exportExamTime() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXAMTIME_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("考试时间信息dbf导出成功");
    });
  }

  exportSjdDbf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.SJD_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("试卷袋信息dbf导出成功");
    });
  }

  exportSecurityCodeOnePdf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/exportSecurityCodeOnePdf.htm", {}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("考场信息表（贴试卷袋上）PDF导出成功");
    });
  }

  exportSecurityCodeTwoPdf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/exportSecurityCodeTwoPdf.htm", {}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("考场登记表（贴答题卡上）PDF导出成功");
    });
  }

  exportSecurityCodeThreePdf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/exportSecurityCodeThreePdf.htm", {}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("考场登记表（贴答题卡上）PDF导出成功");
    });
  }
  
  
  
  
}
