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-jrxtqxzyxxb',
  templateUrl: './jrxtqxzyxxb.component.html',
  styleUrls: ['./jrxtqxzyxxb.component.scss']
})
export class JrxtqxzyxxbComponent extends FlexTableComponent implements OnInit {

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


  constructor() {
    super();
  }

  ngOnInit() {
   
  }

  async syn() {
    
    let checkedArray = this.framePager.getCheckedArray();
    if(checkedArray.length === 0) {
      AppComponent.alert({title:"信息提示",text:"请选择数据!"})
      return;
    }
   
    AppComponent.confirm("确定将资源从自考前置数据库同步到自考数据库",()=>{
      checkedArray = this.framePager.getCheckedArray((item)=>item.zyid);
      FrameRequest.requestMap("msgque/jrxtqxzyxxb/syn.htm", {zyids:checkedArray.join()}, () => {
        AppComponent.GobalComponent.successMsg('资源信息同步成功');
        this.framePager.reload();
      });
    })
  }

}
