<template>
  <!-- 航站BRS扫描统计 -->
  <div class="statstics-wrapper">
    <StatisticsHeader
      title="航站BRS扫描统计"
      :items="formItems"
      :data="formData"
      with-setting
      :withSetting="false"
      @getFormData="getFormData"
      @export="exportup"
    />
    <Tableformbrs
      upid="1"
      :data-id="dataId"
      :isloadings="isloadings"
      :data-content="dataContent"
      :rows="12"
      label-width="140px"
      :min-height="70"
      width="800px"
      tableHeight="750"
    />
  </div>
</template>
<script>
import StatisticsHeader from '../../components/statisticsHeader.vue'
import Tableformbrs from '../../components/tableformbrs'
import { Format } from '@/utils/validate'
export default {
  name: 'ReportStatistics',
  data() {
    return {
      formData: {
        airport: '',
        dateTime: '',
      },
      formItems: [
        {
          prop: 'airport',
          inputType: 'select',
          placeholder: '航站选择',
          filterable: true,
          clearable: true,
          // multiple: true,
          // disabled: true,
          queryId: SERVICE_ID.termSeleid,
          setKey: 'a2',
          options: [],
        },
        {
          prop: 'interval',
          inputType: 'select',
          placeholder: '时间维度',
          requiredWarning: '请先选择统计时间维度',
          clearable: true,
          options: [
            {
              value: '日',
              label: '按日统计',
            },
            {
              value: '月',
              label: '按月统计',
            },
            {
              value: '季',
              label: '按季统计',
            },
            {
              value: '年',
              label: '按年统计',
            },
          ],
        },
        {
          prop: 'dateTime',
          inputType: 'datePicker',
          clearable: true,
          width: '240px',
          options: [],
        },
      ],
      dataId: SERVICE_ID.stBrsId,
      dataContent: [],
      isloadings: 1,
    }
  },
  components: {
    StatisticsHeader,
    Tableformbrs,
  },
  mounted() {
    this.dataContent = [
      '日',
      'PEK',
      Format('yyyy-MM-dd', new Date()),
      Format('yyyy-MM-dd', new Date()),
    ]
  },
  methods: {
    getFormData(data) {
      this.dataContent = []
      this.dataContent.push(
        data.interval,
        data.airport,
        data.dateTime[0] ? data.dateTime[0] : '',
        data.dateTime[1] ? data.dateTime[1] : ''
      )
    },
    exportup() {
      this.isloadings = this.isloadings += 1
    },
  },
}
</script>
<style lang="scss" scoped></style>
