<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"></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 SampleBackupsManage from './DataAudit'
import SampleBackupsQuery from './DataAuditHis'

export default {
  // eslint-disable-next-line vue/no-unused-components
  components: { SampleBackupsManage, SampleBackupsQuery },
  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 = 'SampleBackupsQuery'
        this.$nextTick(() => {
          this.$refs.refModal._page()
        })
      }
    },
    _page() {
      this.currentComponent = 'SampleBackupsManage'
      this.$nextTick(() => {
        this.$refs.refModal._page()
      })
      // this.$refs.entrustTabs._page()
    }
  }
}
</script>
