<!-- 搜索表单 -->
<template>
  <a-space :size="10" style="flex-wrap: wrap">
    <a-input-search
      allow-clear
      placeholder="请输入关键词"
      style="width: 280px"
      v-model:value="where.keywords"
      @search="reload"
    />
  </a-space>
</template>

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

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

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

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

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

  const reload = () => {
    emit('search', where);
  };

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