<template>
  <search-item
    :label="label"
    :size="size"
  >
    <el-select
      clearable
      filterable
      :value="value"
      @change="changeHandle"
    >
      <el-option
        v-for="(item, index) in baseDataOptionsList"
        :key="index"
        :value="item.value"
        :label="item.name"
      ></el-option>
    </el-select>
  </search-item>

</template>

<script>
import { mapGetters, mapActions } from 'vuex';
import baseDataMixin from '../../mixins/base/BaseDataSelect.js';
import { selectTypeMapping } from '@/config';

export default {
  name: 'base-data-select',
  mixins: [baseDataMixin],
  props: {
    size: {
      type: String,
      default: 'normal',
    },
    value: {
      type: String,
      default: '',
    },
    label: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      baseDataOptionsList: [],
    };
  },
  created() {
    if (this.label) {
      this.getOptionsList(this.label).then(list => {
        this.baseDataOptionsList = list;
      });
    }
  },
};
</script>

