<template>
  <a-select
      :getPopupContainer="
                          (triggerNode) => {
                            return triggerNode.parentNode || document.body;
                          }
                        "
      v-model:value="id"
      :options="options"
      style="width: 100%"
      placeholder="请选择分类"
      @change="change"
      :disabled="disabled"
  />
</template>
<script setup>
import {computed, defineEmits, defineProps, onMounted, ref} from "vue";
import {useStore} from "vuex";

const store = useStore();

const props = defineProps({
  value: String,
  disabled: String
})

const id = computed(() => {
  return props.value
})

const emit = defineEmits({})

const options = ref([])

onMounted(() => {
  options.value = store.state.projectSys.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
})

function change(key) {
  emit('update:value', key)
}

</script>
