export default {
  data() {
    return {
      customFormItems: [
        {
          itemIndex: 0,
          replaceNum: 1,
          prop: 'range',
          inputType: 'select',
          placeholder: '统计范围',
          requiredWarning: '请先选择统计范围',
          options: [
            {
              value: '全部',
              label: '全部'
            },
            {
              value: '航线',
              label: '航线'
            },
            {
              value: '基地分公司',
              label: '基地分公司'
            },
            {
              value: '航站',
              label: '航站'
            }
          ],
          changeHandler(value) {
            this.setInOrOutOptions(value)
            const rangeMap = {
              航线: 'airline',
              基地分公司: 'area',
              航站: 'airport'
            }
            Object.entries(rangeMap).forEach(([k, v]) => {
              const theItem = this.formItems.find(item => item.prop === v)
              if (value === k) {
                theItem && (theItem.disabled = false)
              } else {
                this.formData[v] = ''
                theItem && (theItem.disabled = true)
              }
            })
          }
        },
        {
          itemIndex: 7,
          replaceNum: 1
        }
      ]
    }
  }
}
