<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="check">-->
<!--            <ReportMakeByEntrust ref="checkTabs"></ReportMakeByEntrust>-->
<!--          </el-tab-pane>-->
<!--          <el-tab-pane label="历史报告" name="checkHis">-->
<!--            <ReportMakeHis ref="checkHisTabs"></ReportMakeHis>-->
<!--          </el-tab-pane>-->
<!--        </el-tabs>-->
        <el-tabs v-model="activeName" @tab-click="_changeTabs">
          <el-tab-pane label="数据审核" name="check"></el-tab-pane>
          <el-tab-pane label="历史任务" name="checkHis"></el-tab-pane>
        </el-tabs>
        <keep-alive>
          <!-- eslint-disable-next-line vue/require-component-is -->
          <component ref="refModal" :is="currentComponent"></component>
        </keep-alive>
      </div>
    </div>
  </div>
</template>

<script>
import ReportMakeByEntrust from './tabs/ReportMakeByEntrust'
import ReportMakeHis from './ReportMakeHis'

export default {
  // eslint-disable-next-line vue/no-unused-components
  components: { ReportMakeByEntrust, ReportMakeHis },
  data() {
    return {
      activeName: 'check',
      currentComponent: ''
    }
  },
  mounted() {
    this.activeName = 'check'
    this._page()
  },
  methods: {
    _changeTabs(tab, event) {
      if (tab.name === 'check') {
        this._page()
      } else if (tab.name === 'applyRecord') {
        // this.$refs.applyRecordTabs._page()
      } else {
        this.currentComponent = 'ReportMakeHis'
        this.$nextTick(() => {
          this.$refs.refModal._page()
        })
      }
    },
    _page() {
      this.currentComponent = 'ReportMakeByEntrust'
      this.$nextTick(() => {
        this.$refs.refModal._page()
      })
      // this.$refs.entrustTabs._page()
    }
  }
}
</script>
