<template>
  <!-- 自定义下拉组件 -->
  <CustomSelectComponent
    :value="props.value"
    :record="props.record"
    :formData="props.formData"
    :disabled="props.disabled"
    :readonly="props.readonly"
    :placeholder="props.record?.placeholderContent || props.placeholder"
    :isDesgin="props.isDesgin"
    @update:value="updateValue"
    @onBlur="dataValueBlur"
    @onClick="dataValueClick"
    @onChange="dataValueChange"
    @onFocus="dataValueFocus"
  ></CustomSelectComponent>
</template>

<script setup name="FormCustomSelect">
const props = defineProps({
  value: {
    type: String,
    default: ''
  },
  //当前行配置
  record: {
    type: Object,
    default: {}
  },
  // 当前行数据
  formData: {
    type: Object,
    default: {}
  },
  //是否禁用
  disabled: {
    type: Boolean,
    default: false
  },
  placeholder: {
    type: String,
    default: '请选择'
  },
  // 是否只读
  readonly: {
    type: Boolean,
    default: false
  },
  // 是否是设计
  isDesgin: {
    type: Boolean,
    default: false
  }
});

const emits = defineEmits(['update:value', 'onClick', 'onBlur', 'onChange', 'onFocus']);

const updateValue = value => {
  emits('update:value', value);
};

// 点击
const dataValueClick = () => {
  emits('onClick', props.record);
};
// 失去焦点
const dataValueBlur = () => {
  emits('onBlur', props.record);
};
// 改变
const dataValueChange = () => {
  emits('onChange', props.record);
};
// 获取焦点
const dataValueFocus = () => {
  emits('onFocus', props.record);
};
</script>

<style></style>
