import { Component, OnInit } from '@angular/core';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { FrameDetailComponent } from '../../../../frame/core/detail/frame.detail';

@Component({
  selector: 'app-conf-range-score-subject',
  templateUrl: './conf-range-score-subject.component.html',
  styleUrls: ['./conf-range-score-subject.component.scss']
})
export class ConfRangeScoreSubjectComponent extends FrameDetailComponent implements OnInit {

  subjectArr = [];

  constructor(bsModalRef: BsModalRef) { 
    super(bsModalRef);
  }

  ngOnInit(): void {
    this.AjaxService.requestArray("ex/score/range/subject/list.htm",{
      score_id: this.ResponseEntity.score_id,
      school_id: this.ResponseEntity.school_id
    }, (array) => {
      this.subjectArr = array;
    });
  }

  saveRangeScore() {
    this.AjaxService.request('ex/score/range/subject/save.htm', {
      score_id : this.currentEntity.score_id,
      subject_json: JSON.stringify(this.subjectArr)
    }, () => {
      this.MsgService.successToastr('配置成功！');
      this.closeWindow();
    });
  }

}
