<!--
 * @Author: lixg lixg@dongwu-inc.com
 * @Date: 2022-12-14 15:46:36
 * @LastEditors: lixg lixg@dongwu-inc.com
 * @LastEditTime: 2022-12-14 15:47:48
 * @FilePath: /fe-manage/src/components/project/ProjectClass.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!-- 评估管理-创建评估页面 -->
<template>
  <a-select
    :getPopupContainer="
      (triggerNode) => {
        return triggerNode.parentNode || document.body;
      }
    "
    v-model:value="id"
    placeholder="请选择分类"
    style="width: 100%"
    :options="options"
    allowClear
    @change="change"
    :disabled="disabled"
  >
  </a-select>
</template>
<script setup>
import { computed, defineEmits, defineProps } from "vue";
import { useStore } from "vuex";

const store = useStore();

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

const options = computed(() =>
  store.state.projectClass.map((e) => ({
    value: parseInt(e.dictCode),
    label: e.dictName,
  }))
);

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

function change(key, obj) {
  emit("update:name", obj[0]);
  emit("update:value", key);
}
</script>
