<template>
  <div>
    <a-card size="small" :bordered="false">
      <a-tabs default-active-key="1" @change="handleChange">
        <a-tab-pane key="1" tab="轮胎统计报表">
          <!-- 列表 -->
          <tireList ref="tireStatisticsList"></tireList>
        </a-tab-pane>
        <a-tab-pane key="2" tab="轮胎明细报表" force-render>
          <detailList ref="tireDetailList"></detailList>
        </a-tab-pane>
      </a-tabs>
    </a-card>
  </div>
</template>
<script>
import { commonMixin } from '@/utils/mixin'
import tireList from './list'
import detailList from './detailList'
export default {
  name: 'TireSalesReportIndex',
  mixins: [commonMixin],
  components: { tireList, detailList },
  data () {
    return {
      tabVal: 1
    }
  },
  methods: {
    handleChange (val) {
      this.tabVal = val
    },
    pageInit () {
      if (this.tabVal == 1) {
        this.$refs.tireStatisticsList.pageInit()
      } else {
        this.$refs.tireDetailList.pageInit()
      }
    }
  },
  mounted () {
    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
      this.pageInit()
    }
  },
  activated () {
    // 如果是新页签打开，则重置当前页面
    if (this.$store.state.app.isNewTab) {
      this.pageInit()
    }
  }
}

</script>

<style lang="less" scoped>
  .monthBox{
    /deep/.ant-calendar-picker-icon{
      display:none !important;
    }
    /deep/.ant-calendar-picker input{
      text-align:center;
    }
  }
</style>
