<template>
  <CommonPieStatisticsCharts
    charts-title="特殊行李分析"
    :pageAuthtablesList="pageAuthtablesList"
    :query-settings="querySettings"
    :categories="categories"
    :form-data="formData"
    :form-items="formItems"
  />
</template>

<script>
import CommonPieStatisticsCharts from '../components/newPieStatisticsChartscpsy.vue'
import { mapGetters } from 'vuex'
export default {
  name: 'AbnormalBaggageClassificationStatisticsCharts',
  components: { CommonPieStatisticsCharts },

  data() {
    return {
      querySettings: {
        serviceid: '',
      },
      categories: ['小动物', '机组', '枪支', '其它', '超规'],
      formData: {
        dateTime: [],
        airport: '',
      },
      formItems: [
        {
          prop: 'airport',
          inputType: 'select',
          placeholder: '航站',
          width: '150px',
          filterable: true,
          // multiple: true,
          queryId: 74,
          setKey: 'IATACode',
          requiredWarning: '请先选择航站',
          options: [],
        },
        {
          prop: 'dateTime',
          inputType: 'datePicker',
          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>
