<!-- 搜索表单 -->
<template>
  <a-space :size="10" style="flex-wrap: wrap">
    <span class="text-gray-400">发票类型</span>
    <a-radio-group v-model:value="where.itype" @change="search">
      <a-radio-button :value="1">场地发票</a-radio-button>
      <a-radio-button :value="2">VIP卡发票</a-radio-button>
      <a-radio-button :value="3">IC卡发票</a-radio-button>
    </a-radio-group>
    <a-input-search
      allow-clear
      placeholder="订单号"
      v-model:value="where.keywords"
      @pressEnter="search"
      @search="search"
      style="width: 360px"
    />
  </a-space>
</template>

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

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

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

  // 表单数据
  const { where } = useSearch<ThinkInvoiceParam>({
    oid: undefined,
    keywords: undefined
  });

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

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