<!-- 搜索表单 -->
<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: '推送人', prop: 'pushName' },
        {
            type: 'date',
            label: '推送时间(开始时间)',
            prop: 'pushTimeStart',
            props: {
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss'
            }
        },
        {
            type: 'date',
            label: '推送时间(结束时间)',
            prop: 'pushTimeEnd',
            props: {
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss'
            }
        },
        { type: 'input', label: '处理人', prop: 'checkName' },
        {
            type: 'date',
            label: '处理时间(开始时间)',
            prop: 'checkTimeStart',
            props: {
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss'
            }
        },
        {
            type: 'date',
            label: '处理时间(结束时间)',
            prop: 'checkTimeEnd',
            props: {
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss'
            }
        },
        { type: 'input', label: '订单编号', prop: 'orderId' },
        { type: 'input', label: '物流单号', prop: 'waybillCode' },
        {
            type: 'dictSelect',
            label: '处理结果',
            prop: 'checkStatus',
            props: { code: 'abnormal_check_status' }
        }
    ]);

    const initKeys = reactive({
        pushName: '',
        pushTimeStart: '',
        pushTimeEnd: '',
        checkName: '',
        checkTimeStart: '',
        checkTimeEnd: '',
        orderId: '',
        waybillCode: '',
        checkStatus: ''
    });

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