<template>
  <div>
    <a-card size="small" :bordered="false">
      <a-tabs default-active-key="1" @change="handleChange">
        <a-tab-pane key="1" tab="轮胎月度费用报表">
          <monthQueryList ref="tireStatisticsList"></monthQueryList>
        </a-tab-pane>
        <a-tab-pane key="2" tab="轮胎季度费用报表" force-render>
          <quarterQueryList ref="tireDetailList"></quarterQueryList>
        </a-tab-pane>
        <a-tab-pane key="3" tab="轮胎年度费用报表" force-render>
          <yearQueryList ref="tireDetailList"></yearQueryList>
        </a-tab-pane>
        <a-tab-pane key="4" tab="轮胎费用明细报表" force-render>
          <feeDetailList ref="tireDetailList"></feeDetailList>
        </a-tab-pane>
      </a-tabs>
    </a-card>
  </div>
</template>
<script>
import { commonMixin } from '@/utils/mixin'
// 组件
import monthQueryList from './monthQueryList.vue'
import quarterQueryList from './quarterQueryList.vue'
import yearQueryList from './yearQueryList.vue'
import feeDetailList from './feeDetailList.vue'
export default {
  name: 'TireFeeReportIndex',
  mixins: [commonMixin],
  components: { monthQueryList, quarterQueryList, yearQueryList, feeDetailList },
  data () {
    return {
      tabVal: 1 // tab值  1轮胎月度费用报表 2轮胎季度费用报表 3轮胎年度费用报表 4轮胎费用明细报表
    }
  },
  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>
