<template>
  <CommonBarStatisticsCharts
    charts-title="行李小时量数量"
    :pageAuthtablesList="pageAuthtablesList"
    :query-settings="querySettings"
    :formItems="formItems"
    :formData="formData"
  />
</template>

<script>
import CommonBarStatisticsCharts from '../../components/newBarStatisticsCharts.vue'
import { mapGetters } from 'vuex'
export default {
  name: 'FlightStatisticsCharts',
  components: { CommonBarStatisticsCharts },
  data() {
    return {
      querySettings: {
        serviceid: '',
        seriesKey: 'bags',
        xAxisKey: 'dat',
      },
      formData: {
        airport: 'CAN',
        dateTime: [],
        io_type: '',
      },
      formItems: [
        {
          prop: 'airport',
          inputType: 'select',
          placeholder: '航站',
          requiredWarning: '请先选择航站',
          width: '150px',
          filterable: true,
          // clearable: true,
          // multiple: true,
          // disabled: true,
          queryId: 74,
          setKey: 'IATACode',
          options: [],
        },
        {
          prop: 'io_type',
          inputType: 'select',
          placeholder: '进出港',
          requiredWarning: '请先选择进出港',
          // clearable: true,
          options: [
            {
              value: '离港',
              label: '离港',
            },
            {
              value: '进港',
              label: '进港',
            },
            {
              value: '中转',
              label: '中转',
            },
          ],
        },
        {
          prop: 'dateTime',
          inputType: 'datePicker',
          // clearable: true,
          width: '240px',
          requiredWarning: '请先选择时间范围',
        },
      ],
      pageAuthtablesList: {
        authArrs: [],
        pageAuthtables:[]
      },
    }
  },
  computed: {
    ...mapGetters(['authArrs']),
  },
  mounted() {
    this.pageInit()
  },
  methods: {
    //页面初始化
    pageInit () {
      //获取页面查询参数
      const { query } = this.$route
      this.pageQuery = query
      //获取页面配置
      const { pagecode, qid, auth_id } = this.$route.meta
      //获取页面权限类型组件  pagetype 1模块  2页面  3按钮 4表格 5树形  6弹窗 
      const pageAuths = this.authArrs
      this.pageAuthtablesList.authArrs = pageAuths
      if (!pageAuths.length) return
      //获取当前页面权限类型
      const pageAuthArrs = pageAuths.filter(item => item['superiorid'] == auth_id)
      if (!pageAuthArrs.length) return
      // console.log(pageAuthArrs)
      this.querySettings.serviceid = pageAuthArrs[0].serviceid
       //获取图表权限
      const pageAuthtables = pageAuthArrs.filter(item => item.pagetype == 'chart')
      this.pageAuthtablesList.pageAuthtables = pageAuthtables
      if (pageAuthtables?.length) return
    },
  },
}
</script>
