<template>
  <div>
    <div class="layout-content-padding">
      <div class="layout-content-main">
        <el-tabs v-model="activeName" @tab-click="_changeTabs">
          <el-tab-pane label="报告档案" name="contract"/>
          <el-tab-pane label="报告台账" name="report"/>
        </el-tabs>
        <!--组件加载，缓存-->
        <keep-alive>
          <!-- eslint-disable-next-line vue/require-component-is -->
          <component :is="currentComponent"></component>
        </keep-alive>
      </div>
    </div>
  </div>
</template>

<script>
import ReportByContract from './tab/ReportByContract'
import ReportByReport from './tab/ReportByReport'
/**
 * 报告档案
 */
export default {
  components: {
    // eslint-disable-next-line vue/no-unused-components
    ReportByContract,
    // eslint-disable-next-line vue/no-unused-components
    ReportByReport
  },
  data() {
    return {
      activeName: '',
      // 结束
      reportStatus: 'FLOW_END',
      currentComponent: ''
    }
  },
  mounted() {
    this.activeName = 'contract'
    this.currentComponent = 'ReportByContract'
  },
  methods: {
    _changeTabs(tab, event) {
      if (tab.name === 'contract') {
        this.currentComponent = 'ReportByContract'
      } else if (tab.name === 'report') {
        this.currentComponent = 'ReportByReport'
      }
    }
  }
}
</script>
