<template>
  <div>
    <a-card size="small" :bordered="false">
      <a-tabs default-active-key="1" @change="handleChange">
        <a-tab-pane key="1" tab="服务费运费明细报表" force-render>
          <serviceFreightDetailList ref="tableList1"></serviceFreightDetailList>
        </a-tab-pane>
        <a-tab-pane key="2" tab="服务费运费报表" force-render>
          <serviceFreightList ref="tableList2"></serviceFreightList>
        </a-tab-pane>
        <a-tab-pane key="3" tab="增量补贴报表(季度)" force-render>
          <incrementalSubsidyList ref="tableList3"></incrementalSubsidyList>
        </a-tab-pane>
        <a-tab-pane key="4" tab="增量补贴报表(年度)" force-render>
          <incrementalSubsidyYearList ref="tableList4"></incrementalSubsidyYearList>
        </a-tab-pane>
        <a-tab-pane key="5" tab="供应商轮胎补贴返利报表" force-render>
          <supplierRebateList ref="tableList5"></supplierRebateList>
        </a-tab-pane>
      </a-tabs>
    </a-card>
  </div>
</template>
<script>
import { commonMixin } from '@/utils/mixin'
// 组件
import serviceFreightList from './serviceFreightList.vue'
import incrementalSubsidyList from './incrementalSubsidyList.vue'
import incrementalSubsidyYearList from './incrementalSubsidyYearList.vue'
import serviceFreightDetailList from './serviceFreightDetailList.vue'
import supplierRebateList from './supplierRebateList.vue'
export default {
  name: 'TireFeeReportIndex',
  mixins: [commonMixin],
  components: { serviceFreightList, incrementalSubsidyList, incrementalSubsidyYearList, serviceFreightDetailList, supplierRebateList },
  data () {
    return {
      tabVal: 1 // tab值
    }
  },
  methods: {
    // 切换tab值  change
    handleChange (val) {
      this.tabVal = val
    },
    // 初始化
    pageInit () {
      if (this.tabVal == 1) {
        this.$refs.tableList1.pageInit()
      }
    }
  },
  mounted () {
    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
      this.pageInit()
    }
  },
  activated () {
    // 如果是新页签打开，则重置当前页面
    if (this.$store.state.app.isNewTab) {
      this.pageInit()
    }
  }
}

</script>
