<!-- 搜索表单 -->
<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';

    let { proxy } = getCurrentInstance();
    const emit = defineEmits(['search']);

    const formItems = reactive([
        { type: 'input', label: 'ISBN', prop: 'isbn' },
        {
            type: 'dictSelect',
            label: '状态',
            prop: 'status',
            props: { code: 'dispose_status' }
        },
        { type: 'input', label: '处理人', prop: 'disposeName' },
        {
            type: 'select',
            label: '处理标记',
            prop: 'disposeFlag',
            options: [
                { label: '全部', value: 0 },
                { label: '已导出', value: 1 },
                { label: '已爬取', value: 2 }
            ]
        }
    ]);

    const initKeys = reactive({
        isbn: '',
        status: '',
        disposeName: '',
        disposeFlag: ''
    });

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