import { Component, OnInit } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { FrameService } from 'src/app/core/service/frame.service';
import { FramePageComponent } from '../../../../frame/core/page/frame.page';

@Component({
  selector: 'app-enrol-report-common',
  templateUrl: './enrol-report-common.component.html',
  styleUrls: ['./enrol-report-common.component.scss']
})
export class EnrolReportCommonComponent extends FramePageComponent implements OnInit {
  dimenArr = []; //统计维度
  dimen: any; //维度
  exam_batch:any; //考试批次
  flag = false;
  dataArr = [];
  batchArr = [];

  constructor(modalService: BsModalService) { 
    super(modalService);
  }

  ngOnInit(): void {
    this.dimenArr.push({value: 1 , text: '各专业进入复试人数'});
    this.dimenArr.push({value: 2 , text: '各分组最终考试人数'});
    this.dimenArr.push({value: 3 , text: '小三门兼报流院人数'});
    this.dimenArr.push({value: 4 , text: '小三门只报流院人数'});
  }

  changeBatch() {
    this.flag = true;
    this.batchArr = FrameService.DictMap['ExamBatchName'];
  }

  requestData() {
    if(this.dimen == 1) {
      this.AjaxService.requestArray('enrol/report/all/restest.htm', {std_batch : this.exam_batch}, (array) => {
        this.dataArr = array;
      });
    } else if(this.dimen == 2) {
      this.AjaxService.requestArray('enrol/report/all/group.htm', {std_batch : this.exam_batch}, (array) => {
        this.dataArr = array;
      });
    } else if(this.dimen == 3) {
      this.AjaxService.requestArray('enrol/report/all/fashion.htm', {std_batch : this.exam_batch, flag: 'Active'}, (array) => {
        this.dataArr = array;
      });
    } else if(this.dimen == 4) {
      this.AjaxService.requestArray('enrol/report/all/fashion.htm', {std_batch : this.exam_batch, flag: 'InActive'}, (array) => {
        this.dataArr = array;
      });
    }
  }

}
