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

@Component({
  selector: 'app-exam-barcode-report',
  templateUrl: './exam-barcode-report.component.html',
  styleUrls: ['./exam-barcode-report.component.scss']
})
export class ExamBarCodeReportComponent implements OnInit {
  
  TASK_BOOK_URL = "kw/kwLayoutDetail/exportTaskBook.htm";
  INSTRUCTIONS_URL = "kw/kwLayoutDetail/exportExamBarCodeInstructions.htm";
  CHECKLIST_URL = "kw/kwLayoutDetail/exportExamBarCodeChecklist.htm";
  EXPORT_EXAM_BARCODE_URL = "kw/kwLayoutDetail/exportExamBarCode.htm";
  EXPORT_POINTADDRESS_URL =  "kw/kwLayoutDetail/queryPointAddress.htm";
  EXPORT_ALLROOMLABEL_URL =  "kw/kwLayoutDetail/queryAllRoomLabel.htm";
  EXPORT_NOTNETROOMLABEL_URL = "kw/kwLayoutDetail/queryNotNetRoomLabel.htm";
  EXPORT_UNITROOMNUM_URL = "kw/kwLayoutDetail/queryUnitRoomNum.htm";
  EXPORT_POINTANDUNIT_URL = "kw/kwLayoutDetail/queryPointAndUnit.htm";
  
  YEAR_CODE_URL = "pl/plExamTime/list.htm";

  constructor() { }

  public query = {
    exam_time_id: 0
  };

  ngOnInit() {
  }

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

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.TASK_BOOK_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("1_广西自考条码打印任务书导出成功");
    });
  }

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

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.INSTRUCTIONS_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("2_广西自考条码打印说明及封装要求导出成功");
    });
  }

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

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.CHECKLIST_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("8_条码打印检测表导出成功");
    });
  }

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

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXPORT_EXAM_BARCODE_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("3_广西自考条码数据导出成功");
    });
  }


  exportPointAddress() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXPORT_POINTADDRESS_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("9_广西自考条码邮寄各地市对应地址导出成功");
    });
  }

  exportAllRoomLabel() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXPORT_ALLROOMLABEL_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("7_所有考场信息标签导出成功");
    });
  }
  
  exportNotNetRoomLabel() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXPORT_NOTNETROOMLABEL_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("4_传统阅卷考场信息标签导出成功");
    });
  }

  exportUnitRoomNum() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXPORT_UNITROOMNUM_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("5_各场次考点考场数导出成功");
    });
  }
  
  exportPointAndUnit() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXPORT_POINTANDUNIT_URL, {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("6_各考区考点关联信息导出成功");
    });
  }

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

  exporKaoWuXinXi() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/kwLayoutDetail/exporKaoWuXinXi.htm", {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("考务信息导出成功");
    });
  }

  exportFenWangPing() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/kwLayoutDetail/exportFenWangPing.htm", {exam_time_id:this.query.exam_time_id}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("非网评导出成功");
    });
  }
  
  
}
