SelectOptions.vue 2.54 KB
<template>
  <div class='select'>
    <select class='sel' id='sel' v-model='selStr' :style='widthHeight' @change='selSystem()'>
      <option v-for='(item,index) in selectArr' :key='index' :value='item.value'>
        {{ item.label }}
      </option>
    </select>
  </div>
</template>

<script>
export default {
  name: 'SelectOptions',
  props: {
    selectArr: {
      type: Array,
      default: () => []
    },
    widthHeight: {
      type: Object,
      default: () => {
      }
    },
    getQuery: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      selStr: ''
    }
  },
  mounted() {
    this.selStr = this.selectArr[0].value
    // this.initData(this.selStr)

  },

  methods: {
    // 切换系统
    // selSystem() {
    //   this.initData(this.selStr)
    // },

    // 初始化数据
    // initData(val) {
    //   this.getTotal(val) // 获取订单详情
    //
    //   this.getVehicleBrandRanking(val) // 获取车型排名
    //
    //   this.getProductRanking(val) // 获取产品排名
    //
    //   this.getMemberMonthlyTrend(val) // 获取月度趋势
    // },

    handleParamsAndMethod(val, methodName, glParam, ghParam, month) {
      const params = {
        queryItem: val
      }
      if (month) params.month = month
      this.api.equity[methodName](params).then(res => {
        if (res.code == 0) {
          if (val === 'gl_dj' || val === 'gl_scrm') {
            const gl_result = res.data.dataList
            this.$bus.$emit(glParam, { gl_result })
          }
          if (val === 'gh_bodyguard') {
            const gh_result = res.data.dataList
            this.$bus.$emit(ghParam, { gh_result })
          }
        }
      })
    }
    //
    // getMemberMonthlyTrend(val) {
    //   this.handleParamsAndMethod(val, 'getMemberMonthlyTrend', 'glMemberMonthlyTrend', 'ghMemberMonthlyTrend')
    // },
    //
    // // 获取产品排名
    // getProductRanking(val) {
    //   this.handleParamsAndMethod(val, 'getProductRanking', 'glProductRanking', 'ghProductRanking')
    // },
    //
    // // 获取整体车型排名
    // getVehicleBrandRanking(val) {
    //   this.handleParamsAndMethod(val, 'getVehicleBrandRanking', 'glVehicleBrandRanking', 'ghVehicleBrandRanking')
    // },
    //
    // // 获取订单信息
    // getTotal(val) {
    //   this.handleParamsAndMethod(val, 'getTotal', 'glOrderList', 'ghOrderList')
    // }
  }
}
</script>

<style scoped lang='scss'>
.select {
  margin: 1vh;

  .sel {
    background: #2436b7;
    border: none;
    color: #ffffff;
    border-radius: 5px;
  }
}
</style>