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';


@Component({
  selector: 'app-cf-initial-review-reject',
  templateUrl: './initial-review-reject.component.html',
  styleUrls: ['./initial-review-reject.component.scss']
})
export class InitialReviewRejectComponent extends FrameDetailComponent implements OnInit {
  initial_remark = "";
  currReviewMsg = "";//常用审核
  reviewMsgArray = [];

  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
  }

  ngOnInit() {
    /*AjaxService.requestArray("cf/material/def/msg/list.htm", {material_def_id: this.ResponseEntity.material_def_id}, (array)=>{
      debugger;
      this.reviewMsgArray = array;
    });*/
    this.initial_remark = "材料不符要求，请及时修正并重传不符合要求的材料，逾期不予受理。";
  }

  fileLoadCompeleted() {
  }

  onError() {
  }


  //明细退回
  doRejectMain() {
    let _this = this;
    if (!this.initial_remark) {
      MsgService.errorAlert("请输入退回原因");
      return;
    }
    let param = {apply_id: [this.ResponseEntity.main_id], initial_remark: this.initial_remark};
    MsgService.showLoading();
    AjaxService.request('review/initial/main/reject.htm', param, (entity) => {
      MsgService.hideLoading();
      MsgService.successToastr("已退回!");
      _this.closeWindow();
    });
  }
}
