import {Component, ViewChild, OnInit} from '@angular/core';
import { FramePageComponent } from '../../../frame/core/page/frame.page';
import { BsModalService } from 'ngx-bootstrap/modal';
import { FrameUpload } from '../../../../core/frame/upload/frame-upload/frame-upload';
import {ScoreYmEmsDetailComponent} from '../score-ym-ems-detail/score-ym-ems-detail.component';
import {ScoreYmReportComponent} from '../score-ym-report/score-ym-report.component';
import {ScoreYmEmsReportComponent} from '../score-ym-ems-report/score-ym-ems-report.component';
import {ScoreYmEmsReturnComponent} from '../score-ym-ems-return/score-ym-ems-return.component';
import { ModalService } from '../../../../core/service/modal.service';

@Component({
  selector: 'app-score-ym-ems',
  templateUrl: './score-ym-ems.component.html',
  styleUrls: ['./score-ym-ems.component.scss']
})
export class ScoreYmEmsComponent extends FramePageComponent implements OnInit {
  @ViewChild('uploader', {static: false}) uploader: FrameUpload;

  constructor(private modalService: BsModalService) {
    super(modalService);
    this.modalComponent = ScoreYmEmsDetailComponent;
  }


  ngOnInit() {
  }

  showReportModal() {

    this.showComponentModal(ScoreYmEmsReportComponent);
  }

  showEmsReturn() {
    this.showComponentModal(ScoreYmEmsReturnComponent,{class: 'modal-85p'});
  }

  doUploaFile() {
    debugger;
    ModalService.showUploadWindow(this.bsService,'./score/ym/ems/upload.htm',{},{
      uploadTitle:'EMS导入',
      uploadCallback: this.uploadWithThreadCallback.bind(this),
      autoClose:true
    });
  }

  uploadWithThreadCallback(ajax) {
    debugger;
    this.pager.reload();
  }
}
