<template>
    <div class="common-btn-box4" @click="handleBtnClick()" style="">
        <span>重新装箱</span>
    </div>
</template>

<script setup lang="ts" name="RefreshBox">
import { ElMessage } from "element-plus";
const props = defineProps<{
    selectionList: any[];
    handleChildBtnCallback?: () => void;
    ruleForm: any;
}>();
const emits = defineEmits<{
    (e: "handleBtnItemCallback", result: Record<string, any>): void;
}>();
const msgHtml = (msg: any) => {
    ElMessage({
        dangerouslyUseHTMLString: true,
        customClass: "custom-message-style",
        message: `<div style='font-size: 18px;color:red;font-weight:bold;'>${msg}</div>`
    });
};
// 提交事件
const handleBtnClick = () => {
    if (!props.selectionList.length) {
        msgHtml("请选择需要重新装箱的数据 !");
        return;
    }
    let length: any = props.selectionList.length;
    for (let i = 0; i < length; i++) {
        let item: any = props.selectionList[i];
        if (item.status !== "已完成") {
            msgHtml("请选择装箱状态为已完成的数据 !");
            return;
        }
    }
    emits("handleBtnItemCallback", {
        type: "Refresh"
    });
};
</script>

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