import { Component, OnInit } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { ExStdEntryInfoPageDetailComponent } from '../ex-std-entry-info-page-detail/ex-std-entry-info-page-detail.component';
import {FramePageComponent} from '../../../../frame/core/page/frame.page';

@Component({
  selector: 'app-ex-std-entry-info-page',
  templateUrl: './ex-std-entry-info-page.component.html',
  styleUrls: ['./ex-std-entry-info-page.component.scss']
})
export class ExStdEntryInfoPageComponent extends FramePageComponent implements OnInit {

  schoolArray = [];
  batchArr = [];
  query = {
    school_id : '',
    batch_id : ''
  };

  constructor(modalService: BsModalService) {
    super(modalService);
    this.modalComponent = ExStdEntryInfoPageDetailComponent;
  }

  ngOnInit(): void {
    this.AjaxService.requestArray('./cf/school/list.htm', {}, (array: any[]) => {
      this.schoolArray = array;
    });
  }

  changeSchool() {
    this.AjaxService.requestArray('./cf/batch/list.htm', {school_id : this.query.school_id}, (array: any[])=>{
      this.batchArr = array;
    });
  }

  requestData() {
    this.pager.reload({school_id : this.query.school_id, batch_id : this.query.batch_id});
  }


  export() {
    const entity = {
      batch_id : this.query.batch_id,
      school_id: this.query.school_id,
      report_name: 'StdEntryInfoReport',
      report_title: '形体测量明细'
    }
    this.FuncService.ajaxDownload('frame/report/download.htm', entity);
  }
}
