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-file-transfer-table',
  templateUrl: './file-transfer-table.component.html',
  styleUrls: ['./file-transfer-table.component.scss']
})
export class FileTransferTableComponent extends FlexTableComponent implements OnInit {

  query = {
    query: "",
    city_code: "",
    exam_time_id: "",
    major_level: "",
    org_id : "",
    school_id: ""
  }

  QUERY_URL = "by/byApply/pagefile.htm";
  DW_URL = "by/byApply/listUnit.htm?exam_time_id="+this.query.exam_time_id;
  CITY_URL = "cf/cfCity/list.htm";
  EXPORT_URL = "by/byApply/exportfile.htm";
  SCHOOL_URL = "cf/cfOrganization/list.htm?org_type=1&status=1";

  constructor() {
    super();
  }

  ngOnInit() {
  }

  //导出档案交接表
  export() {
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download(this.EXPORT_URL, {
      city_code: this.query.city_code, 
      exam_time_id : this.query.exam_time_id,
      org_id: this.query.org_id,
      school_id: this.query.school_id
    }, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("档案交接表导出成功");
    });
  }

}
