<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="report">
            <preparationManage ref="reportTabs" />
          </el-tab-pane>
          <el-tab-pane label="历史留样" name="his">
            <preparationManageHistory ref="hisTabs" />
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>
<script>
import preparationManage from './tabs/preparationManage'
import preparationManageHistory from './tabs/preparationManageHistory'

export default {
  components: { preparationManage, preparationManageHistory },
  data() {
    return {
      activeName: 'report'
    }
  },
  mounted() {
    this.activeName = 'report'
    this._page()
  },
  methods: {
    _changeTabs(tab, event) {
      if (tab.name === 'report') {
        this._page()
      } else {
        this.$refs.hisTabs._clearPage()
        this.$refs.hisTabs._page()
      }
    },
    _page() {
      this.$refs.reportTabs._clearPage()
      this.$refs.reportTabs._page()
    }
  }
}
</script>
