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

@Component({
  selector: 'app-score-check-detail',
  templateUrl: './score-check-detail.component.html',
  styleUrls: ['./score-check-detail.component.scss']
})
export class ScoreCheckDetailComponent  extends FramePageComponent implements OnInit {

  currStd: any;
  searchText: any;
  subjectArr = [];
  judgeArr = []; //评委数目

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

  ngOnInit(): void {
    this.currStd = {};
    this.initJudgeNum();
  }

  //初始化评委数量
  initJudgeNum() {
    for(let i=1; i<=parseInt(FrameService.getParamValue('MaxJudgeNum', 7), 10); i++) {
      this.judgeArr.push({value: i, text: (i > 9 ? '' : '0') + i});
    }
  }


  queryScore() {
    this.AjaxService.requestMap('sc/std/subject/check.htm', {query: this.searchText}, (map) => {
      this.currStd = map.std;
      this.subjectArr = map.scoreArr;
    });
  }

}
