<!-- 搜索表单 -->
<template>
  <a-space :size="10" style="flex-wrap: wrap">
    <a-input-search
      allow-clear
      placeholder="姓名|电话"
      style="width: 240px"
      v-model:value="where.keywords"
      @search="reload"
    />
  </a-space>
</template>

<script lang="ts" setup>
  import type { GradeParam } from '@/api/user/grade/model';
  import { watch } from 'vue';
  import useSearch from "@/utils/use-search";
  import {ShopDealerUserParam} from "@/api/shop/shopDealerUser/model";

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

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

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

  // 表单数据
  const { where } = useSearch<ShopDealerUserParam>({
    keywords: '',
    userId: undefined,
    mobile: undefined,
    realName: undefined
  });

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