<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 // tab值  1轮胎统计报表 2 轮胎明细报表
    }
  },
  methods: {
    // 切换tab值  change
    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>
