<template>
    <div class="common-btn-box font12" @click="handleBtnClick()" v-if="isBtnShow[routeName]">
        <span>打印</span>
    </div>
</template>

<script setup lang="ts">
import { useAuthStore } from "@/stores/modules/auth";
import { useMsg } from "@/hooks/useMsg";
const authStore = useAuthStore();
const $router = useRouter();
const routeName: string = $router.currentRoute.value.name as string;

const props: any = defineProps<{
    selectionList?: any[];
    handleChildBtnCallback?: () => void;
    ruleForm: any;
}>();
const emits = defineEmits<{
    (e: "handleChildBtnCallback", result: Record<string, any>): void;
}>();

// 提交事件
const handleBtnClick = () => {
    if (!props.selectionList.length) {
        useMsg("warning", "请选择需要打印的数据 ！");
        return false;
    }
    emits("handleChildBtnCallback", {
        type: "Print"
    });
};
//渲染按钮
const isBtnShow = computed(() => {
    const btnShowObj: any = {
        boxMarkIndex: false
    };
    let btnName = routeName + "Print";
    btnShowObj[routeName] = authStore.btnsAuthList.includes(btnName);
    return btnShowObj;
});
</script>

<style scoped>
@import "../index.scss";
</style>
