<template>
    <ele-page flex-table>
        <page-search @search="reload" />

        <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
            <template #toolbar>
                <el-button
                    type="success"
                    plain
                    v-permission="'recycleLogistics:expressCheck:export'"
                    @click="handleExportExcel"
                    :icon="DownloadOutlined"
                >
                    导出EXCEL
                </el-button>
            </template>
        </common-table>
    </ele-page>
</template>

<script setup>
    import { ref, reactive } from 'vue';
    import { DownloadOutlined } from '@/components/icons';
    import CommonTable from '@/components/CommonPage/CommonTable.vue';
    import pageSearch from './components/page-search.vue';

    defineOptions({ name: 'ExpressCheck' });

    /** 表格列配置 */
    const columns = ref([
        {
            label: '员工姓名',
            prop: 'signUserName',
            align: 'center'
        },
        { label: '批次号', prop: 'batchNum', align: 'center' },
        { label: '物流单号', prop: 'expressNumber', align: 'center' },
        { label: '物流CODE', prop: 'finalExpressName', align: 'center' },
        { label: '包裹号', prop: 'packageCode', align: 'center' },
        { label: '仓库', prop: 'godownName', align: 'center' },
        { label: '签收时间', prop: 'createTime', align: 'center' }
    ]);

    /** 页面组件实例 */
    const pageRef = ref(null);

    const pageConfig = reactive({
        pageUrl: '/order/ordersign/expressSign',
        exportUrl: '/order/ordersign/expressSignExport',
        fileName: '快递验收',
        cacheKey: 'expressCheckTable'
    });

    //刷新表格
    function reload(where) {
        pageRef.value?.reload(where);
    }

    //导出excel
    function handleExportExcel() {
        pageRef.value?.exportData('快递验收');
    }
</script>
