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

@Component({
  selector: 'app-by-turn-in-archive',
  templateUrl: './by-turn-in-archive.component.html',
  styleUrls: ['./by-turn-in-archive.component.scss']
})
export class ByTurnInArchiveComponent implements OnInit {

  ARCHIVE_URL = "by/byTurnInApply/archive.htm";
  ARCHIVE_DATA_URL = "by/byTurnInApply/auditData.htm";
  TIME_URL = "by/byTurnTimeConfig/list.htm?turn_type=3";

  public query = {
    time: ""
  };

  constructor() { }

  ngOnInit() {
  }


  //外省转入成绩归档
  archive() {
    if (!this.query.time) {
      AppComponent.alert({ title: '提示', text: '请选择转考批次' });
      return;
    }

    FrameRequest.requestArray(this.ARCHIVE_DATA_URL, {}, (array) => {
      let msg = "";
      if(array && array.length > 0 ) {
        msg = "存在正在审批中的数据，确认归档吗？"
      } else {
        msg = "确认归档吗？";
      }
      AppComponent.confirm(msg, () => {
      FrameRequest.request(this.ARCHIVE_URL, {time_config_id:this.query.time}, () => {
        AppComponent.GobalComponent.successMsg("外省转入归档成功");
      });
    });
    });
    

  }

}
