<template>
  <div class="app-container">
    <!-- <h1>集团</h1> -->
    <el-tabs v-model="activeName" @tab-click="handleTabClick">
      <el-tab-pane label="效率统计" name="first">
        <component :is="myComponent1" ref="detail1" />
      </el-tab-pane>
      <el-tab-pane label="牛群评估" name="second">
        <keep-alive>
          <component :is="myComponent2" ref="detail2" />
        </keep-alive>
      </el-tab-pane>
    </el-tabs>
  </div>

</template>

<script>
import echarts from 'echarts'
require('echarts/theme/macarons')
import { GetDataByName, GetReportform } from '@/api/common'
import Cookies from 'js-cookie'
import { parseTime } from '@/utils/index.js'
import Pagination from '@/components/Pagination'
import { json2excel } from '@/utils/index.js'
import { MessageBox } from 'element-ui'
import Tab1 from './tab1'
import Tab2 from './tab2'
export default {
  name: 'GroupFeedingEfficiency',
  components: { Pagination, Tab1, Tab2 },
  data() {
    return {
      activeName: 'first',
      myComponent1: null,
      myComponent2: null
    }
  },

  created() {},
  mounted() {
    this.detailComponent1()
  },
  methods: {
    detailComponent1() {
      if (this.activeName == 'first') {
        const vue = this
        var myComponent1 = () => import('./tab1.vue')
        return vue.myComponent1 = myComponent1
      }
    },
    handleTabClick() {
      if (this.activeName == 'first') {
        const vue = this
        var myComponent1 = () => import('./tab1.vue')
        return vue.myComponent1 = myComponent1
      } else if (this.activeName == 'second') {
        const vue = this
        var myComponent2 = () => import('./tab2.vue')
        return vue.myComponent2 = myComponent2
      }
    }

  }
}
</script>
<style lang="scss" scoped>
  .search{margin-bottom:10px;}
</style>
