import { Component, OnInit } from '@angular/core';
import {FormBuilder, Validators} from '@angular/forms';
import {BsModalRef} from 'ngx-bootstrap/modal';
import { FrameDetailComponent } from '../../../frame/core/detail/frame.detail';
import { AjaxService } from '../../../../core/service/ajax.service';
import { FuncService } from '../../../../core/service/func.service';
import { MsgService } from '../../../../core/service/msg.service';

declare let laydate;

@Component({
  selector: 'app-cf-school-detail',
  templateUrl: './school-detail.component.html',
  styleUrls: ['./school-detail.component.scss']
})
export class CfSchoolDetailComponent extends FrameDetailComponent implements OnInit {
  deptArray = [];

  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
    this.detailForm = fb.group({
      'school_code': [null, Validators.compose([Validators.required, Validators.minLength(2), Validators.maxLength(8)])],
      'school_name': [null, Validators.compose([Validators.required, Validators.minLength(2), Validators.maxLength(64)])],
      'appid': [null,Validators.compose([Validators.required])],
      'dept_id': [null,Validators.compose([Validators.required])],
    });
  }

  ngOnInit() {
    //查询机构
    AjaxService.requestArray("frame/dept/list.htm",{dept_type : "School"},(array)=>{
      this.deptArray = array;
    });
  }

  initDefautEntity() {
    if (this.detailMode === 'add') {

    }
  }

}
