<script setup lang="ts">
import { ref } from "vue";
import { useVModel } from "@vueuse/core";
import RemoteSelect from "/@/components/RemoteSelect";
import { httpUserlist } from "/@/api/netOrderEnter/netOrderEntry";

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

const value = useVModel(props, "modelValue");
const RemoteSelectRef = ref<InstanceType<typeof RemoteSelect> | null>(null);

defineExpose({
  initalData: data => (RemoteSelectRef.value as any).initalData(data)
});
</script>

<template>
  <RemoteSelect
    v-model="value"
    style="width: 100%"
    :api="httpUserlist"
    :pro-data="() => ({ companyNo, level: '2' })"
    ref="RemoteSelectRef"
    requset-prop="nickname"
    response-label-prop="nickname"
    response-val-prop="id"
    @inital="id => (value = id)"
  />
</template>
