import { Component,ViewChild,OnInit } from '@angular/core';
import { FramePageComponent } from '../../../frame/core/page/frame.page';
import { BsModalService } from 'ngx-bootstrap/modal';
import {ScoreFinalYmDetailComponent} from '../score-final-ym-detail/score-final-ym-detail.component';
import {ScoreYmReportComponent} from '../score-ym-report/score-ym-report.component';
import { FrameUpload } from '../../../../core/frame/upload/frame-upload/frame-upload';
import { ModalService } from '../../../../core/service/modal.service';

@Component({
  selector: 'app-score-final-ym',
  templateUrl: './score-final-ym.component.html',
  styleUrls: ['./score-final-ym.component.scss']
})
export class ScoreFinalYmComponent extends FramePageComponent implements OnInit {
  @ViewChild('uploader', {static: false}) uploader: FrameUpload;
  constructor(private modalService: BsModalService) {
    super(modalService);
    this.modalComponent = ScoreFinalYmDetailComponent;
  }

  ngOnInit() {
  }

  showConfrimModal () {
    this.showComponentModal(ScoreYmReportComponent);
  }

  doUploaFile() {
    ModalService.showUploadWindow(this.bsService,'./score/ymfinal/upload.htm',{},{
      uploadTitle:'复试成绩',
      templateFile:'模版-成绩发布.xls',
      uploadCallback: this.uploadWithThreadCallback.bind(this),
      autoClose:true
    });
  }

  uploadWithThreadCallback(ajax) {
    this.pager.reload();
  }


  downloadReviewLog(v) {
    window.open(this.FrameService.getParamValue('EnrolMaterialWebPath') + '/' + v.review_log_file);
  }

  makeStdReviewLog(v, flag) {
    let msg = '确定要生成该考生的成绩复核日志吗！';
    if (flag) {
      msg = '确定要重新生成该考生的成绩复核日志吗？';
    }
    this.MsgService.confirmAlert(msg, () => {
      this.FuncService.ajaxDownload('score/ym/make/review/log.htm', { cert_id: v.cert_id, aspect_name: v.aspect_name, batch: v.batch });
      setTimeout(() => {
        this.pager.reload();
      }, 1000);
    });
  }


}
