import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { BsModalService } from 'ngx-bootstrap/modal';
import { FramePageComponent } from '../../../../frame/core/page/frame.page';

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

  std: any;
  schoolArr = [];

  constructor(private modalService: BsModalService,  private router: Router) {
    super(modalService);
   }

  ngOnInit(): void {
    this.std = {};
    this.requestSchool();
  }

   //学校初始化
   requestSchool() {
    this.AjaxService.requestArray('cf/school/list.htm',{}, (array) => {
      this.schoolArr = array;
      if(this.schoolArr.length == 1) {
        this.std.school_id = this.schoolArr[0].school_id;
        this.pager.reload({school_id: this.std.school_id });
      }
    });
  }

  //重新加载考生
  requestStd() {
    this.pager.reload({school_id: this.std.school_id });
  }

  //考生详情
  showStdDetail(v) {
    this.router.navigate(['/art/material/reg/detail',v.std_id]);
  }

}
