<template>
    <div class="flx-align-center" style="padding-bottom: 16px">
        <template v-for="item in comps" :key="item">
            <!-- @getType="getType" -->
            <component
                :is="item"
                :selectionList="selectionList"
                @handleChildBtnCallback="handleChildCallback"
                :ruleForm="ruleForm"
            ></component>
        </template>
    </div>
</template>

<script setup lang="ts">
import Retransmission from "./components/Retransmission.vue";
import Export from "./components/Export.vue";
import ExprotSelect from "./components/ExprotSelect.vue";
import Refresh from "./components/Refresh.vue";
import ToVoid from "./components/ToVoid.vue";
import Merge from "./components/Merge.vue";
import Add from "./components/Add.vue";
import Del from "./components/Del.vue";
import Print from "./components/Print.vue";
import Switch from "./components/Switch.vue";
import noToVoid from "./components/noToVoid.vue";
import Synchronous from "./components/Synchronous.vue";
const $router = useRouter();

const routeName: any = ref($router.currentRoute.value.name);

const props = defineProps<{
    selectionList?: any[];
    handleParentCallback?: () => void;
    ruleForm?: any;
}>();
console.log(props.ruleForm, "=ruleForm=");
const emits = defineEmits<{
    (e: "handleParentCallback", result: Record<string, any>): void;
}>();
const BTNS_ROUTE: any = {
    ofInboundInstructionsList: [ToVoid, noToVoid, Export, Refresh],
    warehouseReceiptList: [Retransmission, Export, Synchronous],
    outboundOrderList: [Export],
    outboundTaskList: [Merge, ToVoid, noToVoid, Refresh, ExprotSelect],
    inboundOutboundRollbackList: [Export],
    boxModificationsList: [Export],
    movingBoxesList: [Export],
    boxStorage: [Export],
    material: [Export],
    immediately: [Export],
    inventoryList: [Export],
    boxMarkIndex: [Add, Del, Print, Switch],
    subscriptionIndex: [Add, Del],
    finishedProductIndex: [Export]
};
const comps = computed(() => {
    return BTNS_ROUTE[routeName.value];
});

const handleChildCallback = (result: Record<string, any>) => {
    emits("handleParentCallback", result);
};
</script>

<style scoped></style>
