<template>
    <div v-if="isBtnShow[routeName]" class="font12" @click="handleBtnClick()" style="display: flex; align-items: center">
        <div style="margin-right: 4px">
            <span>打印份数设置</span>
            <el-tooltip class="box-item" effect="dark" content="默认打印2份,关闭打印1份" placement="top">
                <el-icon style="cursor: pointer"><QuestionFilled /></el-icon>
            </el-tooltip>
        </div>

        <el-switch v-model="switchValue" />
    </div>
</template>

<script setup lang="ts">
import { QuestionFilled } from "@element-plus/icons-vue";
import { useAuthStore } from "@/stores/modules/auth";
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;
}>();
console.log(props);
const switchValue = ref(true);

const emits = defineEmits<{
    (e: "handleChildBtnCallback", result: Record<string, any>): void;
}>();

// 提交事件
const handleBtnClick = () => {
    emits("handleChildBtnCallback", {
        type: "Switch",
        data: switchValue.value ? 2 : 1
    });
};
//渲染按钮
const isBtnShow = computed(() => {
    const btnShowObj: any = {
        boxMarkIndex: false
    };
    let btnName = routeName + "Switch";
    btnShowObj[routeName] = authStore.btnsAuthList.includes(btnName);
    return btnShowObj;
});
</script>

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