<!-- 搜索表单 -->
<template>
  <a-space :size="10" style="flex-wrap: wrap">
    <a-input-search
      allow-clear
      placeholder="姓名|手机号|用户ID"
      v-model:value="where.keywords"
      @pressEnter="search"
      @search="search"
      style="width: 360px"
    />
  </a-space>
</template>

<script lang="ts" setup>
  import { watch } from 'vue';
  import { BookingIntegralParam } from '@/api/booking/bookingIntegral/model';
  import useSearch from '@/utils/use-search';

  const props = withDefaults(
    defineProps<{
      // 选中的角色
      selection?: [];
    }>(),
    {}
  );

  const emit = defineEmits<{
    (e: 'search', where?: BookingIntegralParam): void;
    (e: 'add'): void;
    (e: 'remove'): void;
    (e: 'batchMove'): void;
  }>();

  // 表单数据
  const { where } = useSearch<BookingIntegralParam>({
    id: undefined,
    timeStart: undefined,
    timeEnd: undefined,
    keywords: undefined
  });

  // 新增
  const search = () => {
    emit('search');
  };

  watch(
    () => props.selection,
    () => {}
  );
</script>
