import { Component, OnInit } from '@angular/core';
import { FlexTableComponent } from '../../../../shared/common/FlexTable.component';
import { BsModalService } from 'ngx-bootstrap/modal';
import { FormBuilder, Validators } from '@angular/forms';
import { FrameRequest } from '../../../../shared/frame/frame-request';
import { AppComponent } from '../../../..';
import { FrameFunction } from '../../../../shared/frame/frame_function';

@Component({
  selector: 'app-jcJgxxzb',
  templateUrl: './jcJgxxzb.component.html',
  styleUrls: ['./jcJgxxzb.component.scss']
})
export class JcJgxxzbComponent extends FlexTableComponent implements OnInit {

  public query = {
    query: ""
  };
  QUERY_URL = "msgque/jcJgxxzb/page.htm";
  


  constructor() {
    super();
  }

  ngOnInit() {
   
  }

  async syn() {
    
    let checkedArray = this.framePager.getCheckedArray();
    if(checkedArray.length === 0) {
      AppComponent.alert({title:"信息提示",text:"请选择数据!"})
      return;
    }

    if(checkedArray.length > 1) {
      AppComponent.alert({title:"信息提示",text:"请选择一条数据!"})
      return;
    }
   
    AppComponent.confirm("确定将机构从自考前置数据库同步到自考数据库",()=>{
      FrameRequest.requestMap("msgque/jcJgxxzb/syn.htm", {jgdm:checkedArray[0].jgdm,jgzzdm:checkedArray[0].jgzzdm}, () => {
        AppComponent.GobalComponent.successMsg('机构信息同步成功');
        this.framePager.reload();
      });
    })
  }

}
