import { Component, OnInit } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { FramePageComponent } from '../../../../frame/core/page/frame.page';
import { CfRemarkPageDetailComponent } from '../cf-remark-page-detail/cf-remark-page-detail.component';

@Component({
  selector: 'app-cf-remark-page',
  templateUrl: './cf-remark-page.component.html',
  styleUrls: ['./cf-remark-page.component.scss']
})
export class CfRemarkPageComponent extends FramePageComponent implements OnInit {
  schoolArr = [];
  school_id: any;
  constructor(modalService: BsModalService) {
    super(modalService);
    this.modalComponent = CfRemarkPageDetailComponent;
  }

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

  requestSchool() {
    this.AjaxService.requestArray('cf/school/list.htm',{}, (array) => {
      this.schoolArr = array;
      //管理员
      if(this.FrameService.FrameOptr.optr_id == 0) {
        this.schoolArr.unshift({school_id:'', school_name: '所有'});
      }
      if(this.schoolArr.length == 1) {
        this.school_id = this.schoolArr[0].school_id;
        this.reload();
      }
    });
  }

  //重载
  reload() {
    this.pager.reload({school_id: this.school_id});
  }


}
