import {Component, OnInit, ViewChild} from '@angular/core';
import {WishProvinceColumnComponent} from '../wish-province-column/wish-province-column.component';
import {WishProvinceAspectComponent} from '../wish-province-aspect/wish-province-aspect.component';
import { BsModalService } from 'ngx-bootstrap/modal';
import { FramePageComponent } from '../../../frame/core/page/frame.page';
import { MsgService } from '../../../../core/service/msg.service';

@Component({
  selector: 'app-wish-province-page',
  templateUrl: './wish-province-page.component.html',
  styleUrls: ['./wish-province-page.component.scss']
})
export class WishProvincePageComponent extends FramePageComponent implements OnInit {

  // 分页组件
  // @ViewChild('uploader', {static: false}) uploader: UploaderComponent;
  searchText:any;

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

  ngOnInit() {
  }

  uploadWish(province) {
   // this.uploader.uploadFiles({province_id: province.province_id});
  }

  showColumn(v) {
    this.showModal({
      ResponseEntity: v,
      arrayUrl: 'wish/province/column/list.htm', arrayParam: {
        province_id: v.province_id
      }, closeCallback: this.reload.bind(this)
    });
  }
  showAspect(v) {
    this.showComponentModal(WishProvinceAspectComponent,{
      ResponseEntity: v,
      arrayUrl: 'wish/province/aspect/list.htm', arrayParam: {
        province_id: v.province_id
      }, closeCallback: this.reload.bind(this)
    });
  }

  reload() {
    this.ajax.reload();
  }

  uploadCallback() {
      MsgService.successAlert('导入成功!');
  }

}
