<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="wait">
            <MeterSubpackageTask ref="waitTabs"></MeterSubpackageTask>
          </el-tab-pane>
          <el-tab-pane label="历史任务" name="his">
            <MeterSubpackageTaskHis ref="hisTabs"></MeterSubpackageTaskHis>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>

<script>
import MeterSubpackageTask from './MeterSubpackageTask'
import MeterSubpackageTaskHis from './MeterSubpackageTaskHis'
export default {
  name: 'MeterSubpackageTaskIndex',
  components: {
    MeterSubpackageTask,
    MeterSubpackageTaskHis
  },
  data() {
    return {
      activeName: 'wait'
    }
  },
  mounted() {
    this.activeName = 'wait'
    this._page()
  },
  methods: {
    _changeTabs(tab, event) {
      if (tab.name === 'wait') {
        this._page()
      } else {
        this.$refs.hisTabs._page()
      }
    },
    _page() {
      this.$refs.waitTabs._page()
    }
  }
}
</script>

<style scoped>
</style>
