<!-- 搜索表单 -->
<template>
    <ele-card :body-style="{ paddingBottom: '8px' }">
        <ProSearch
            :items="formItems"
            ref="searchRef"
            @search="search"
            :initKeys="initKeys"
        />
    </ele-card>
</template>

<script setup>
    import { reactive, ref, defineEmits } from 'vue';
    import ProSearch from '@/components/CommonPage/ProSearch2.vue';

    const emit = defineEmits(['search']);

    const formItems = computed(() => {
        return [
            { type: 'input', label: '用户ID', prop: 'id' },
            { type: 'input', label: '用户OpenId', prop: 'openId' },
            { type: 'input', label: '用户昵称', prop: 'nickName' },
            { type: 'input', label: '手机号', prop: 'mobile' },
            {
                type: 'dictSelect',
                label: '状态',
                prop: 'status',
                props: {
                    code: 'user_info_status'
                }
            },
            {
                type: 'dictSelect',
                label: '用户类型',
                prop: 'plat',
                props: {
                    code: 'user_plat_type'
                }
            }
        ];
    });

    const initKeys = reactive({
        name: '',
        nickName: '',
        openId: '',
        phone: '',
        status: ''
    });

    const searchRef = ref(null);
    /** 搜索 */
    const search = (data) => {
        emit('search', { ...data });
    };
</script>
