<template>
  <div class="main-content illegal-print">
    <div class="print-entrance">
      <el-button v-if="isPrint === '1' && tsbizserillegal.decorg && tsbizserillegal.decorg!=='440101' && tsbizserillegal.sourceType ==='2' && tsbizserillegal.sourceType ==='2'" type="primary" @click="$router.push({path:'/illegal/inclusion/printHigherLevel', query})">打印决定上级审批表</el-button>
      <el-button v-if="illegalInc && tsbizserillegal.decorg && tsbizserillegal.decorg!=='440101' && tsbizserillegal.sourceType ==='2' && tsbizserillegal.sourceType ==='2'" type="primary" @click="$router.push({path:'/illegal/inclusion/printHigherLevel', query})">打印决定上级审批表</el-button>
      <el-button v-if="illegalInc" type="primary" @click="$router.push({path:'/illegal/inclusion/printExamine', query})">打印审批表</el-button>
      <el-button v-if="illegalInc" type="primary" @click="$router.push({path:'/illegal/inclusion/printDecision', query})">打印列入决定文书</el-button>
      <el-button v-if="illegalDiss2" type="primary" @click="$router.push({path:'/illegal/dissent/printAccept', query})">打印受理/不予受理通知书</el-button>
      <el-button v-if="illegalDiss2" type="primary" @click="$router.push({path:'/illegal/dissent/printApply', query})">打印异议申请表</el-button>
      <el-button v-if="illegalDiss" type="primary" @click="$router.push({path:'/illegal/dissent/printAccept', query})">打印受理/不予受理通知书</el-button>
      <el-button v-if="illegalDiss" type="primary" @click="$router.push({path:'/illegal/dissent/printApply', query})">打印异议申请表</el-button>
      <el-button v-if="illegalDiss" type="primary" @click="$router.push({path:'/illegal/dissent/printExamine', query})">打印异议审批表</el-button>
      <el-button v-if="illegalDiss" type="primary" @click="$router.push({path: '/illegal/dissent/printResult', query})">打印核实结果告知书</el-button>
      <el-button v-if="illegalRem" type="primary" @click="$router.push({path:'/illegal/remove/printRemoveApply', query})">打印申请表</el-button>
      <el-button v-if="illegalRem" type="primary" @click="$router.push({path:'/illegal/remove/printReceipt', query})">打印移出受理回执单</el-button>
      <el-button v-if="illegalRem" type="primary" @click="$router.push({path:'/illegal/remove/printRemove', query})">打印移出决定文书</el-button>
      <el-button v-if="forIllOperatingBn" type="primary" @click="$router.push({path:'/illegal/inclusion/DraftPrintExamine', query})">打印拟列入审批表</el-button>
      <el-button v-if="forIllOperatingBn" type="primary" @click="$router.push({path:'/illegal/inclusion/DraftPrintDecision', query})">打印拟列入决定文书</el-button>
      <el-button type="primary"  @click="$router.go(-1)">返回</el-button>
    </div>
  </div>
</template>

<script>
import { listIllegalByBizSeq, checTask } from '@/api/illegal'

export default {
  data() {
    return {
      illegalInc: true,
      illegalDiss: false,
      illegalDiss2: false, // 异议未办结
      illegalRem: true,
      forIllOperatingBn: true,
      query: {},
      tsbizserillegal: {},
      isPrint: ''
    }
  },
  mounted() {
    this.query = this.$route.query
    this.isPrint = this.query.isPrint
    const bustype = this.query.bustype
    this.illegalInc = bustype === '15'
    // this.illegalDiss = bustype === '16'
    this.illegalRem = bustype === '17'
    if (bustype === '16') {
      // 查看是否办结
      checTask(this.query.bizseq).then(res => {
        if (res.data.isPass) {
          this.illegalDiss = true
        } else {
          this.illegalDiss2 = true
        }
      })
    }
    this.forIllOperatingBn = bustype === '55'
    // 判断是否严重违法列入，则查询详情业务数据
    if (this.illegalInc) {
      this.findIncForm()
    }
    // 行政处罚严重违法为办结但通过区局审批只打印决定上级审批表
    if (this.isPrint === '1') {
      this.illegalInc = false
      this.findIncForm()
    }
  },
  methods: {
    findIncForm() {
      listIllegalByBizSeq(this.query.bizseq).then(res => {
        res.data.forEach(each => {
          this.tsbizserillegal = each
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
 .print-entrance{
   margin:20px
 }
</style>
