<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useVModel } from "@vueuse/core";
import { httpCompanylist } from "/@/api/netOrderEnter/netOrderEntry";

const props = defineProps<{
  modelValue?: string;
  disabled?: boolean;
}>();

const emit = defineEmits(['change']);

const value = useVModel(props, "modelValue");
const list = ref<any[]>([])

onMounted(async () => {
  const { data } = await httpCompanylist({ size: 10000 })
  list.value = data.list
});

defineExpose({ initalData: data => {} });
</script>

<template>
  <ElSelect style="width: 100%" v-model="value" :disabled="disabled" @change="(val) => emit('change',val)" clearable>
    <ElOption 
      v-for="opt in list" 
      :key="opt.companyNo"
      :value="opt.companyNo"
      :label="opt.company"
   />
  </ElSelect>
</template>
