<template>
    <order-page ref="pageRef" :pageConfig="pageConfig" permissionKey="awaitAudit">
        <template #toolbar>
            <!-- <el-button type="success" plain class="ele-btn-icon" :icon="DownloadOutlined"
                v-permission="'recycleOrder:awaitAudit:batchAuditComplete'" @click="handleBatchAuditComplete">
                批量审核完成
            </el-button> -->
        </template>
        <BatchComplete ref="batchCompleteRef" @refresh="refresh" />
    </order-page>
</template>

<script setup>
import { ref, reactive } from 'vue';
import { DownloadOutlined } from '@/components/icons';
import { ElMessage } from 'element-plus';
import OrderPage from '@/views/recycleOrder/components/order-page-all.vue';
import BatchComplete from '@/views/recycleOrder/components/batch-complete.vue';
defineOptions({ name: 'recycleOrderAwaitAudit' });

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

const pageConfig = reactive({
    pageUrl: '/order/orderInfo/audit/pageList',
    exportUrl: '/order/orderInfo/audit/export',
    fileName: '待审核订单',
    cacheKey: 'awaitAuditTable'
});


//批量审核完成
function handleBatchAuditComplete() {
    let orderIds = pageRef.value?.selections?.map(item => item.orderId);
    if (!orderIds.length) {
        ElMessage.error('请至少选择一条数据');
        return;
    }
    console.log(orderIds,'orderIds');
    batchCompleteRef.value?.handleOpen(orderIds);
}

//刷新
function refresh() {
    pageRef.value?.reload();
}

</script>

