<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="lab">
            <labSampleReceive ref="labTabs" />
          </el-tab-pane>
          <el-tab-pane label="流转历史" name="his">
            <historyTask ref="hisTabs" />
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>
<script>
import labSampleReceive from './tabs/labSampleFlow'
import historyTask from './tabs/historyTask'

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