import { useAuthStore } from "@/stores/modules/auth";
const authStore = useAuthStore();
import download from "../components/download.vue";
import Refresh from "../components/Refresh.vue";
import Generate from "../components/Generate.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 GenerateBox from "../components/GenerateBox.vue";
import PackingBox from "../components/PackingBox.vue";
import PrintBox from "../components/PrintBox.vue";
import RefreshBox from "../components/RefreshBox.vue";
import Generates from "../components/Generates.vue";
import Convert from "../components/Convert.vue";
// const BTNS =[]

// 路由跳转映射表
export const OPENS: Record<string, string> = {
    mateList: "/material/list/details"
};

export const BTNS_ROUTE = (routeName: any) => {
    const SHOW_BTBS: any = authStore.btnsAuthList;
    const btnsCom: any = {
        antiCode: [],
        barCode: [],
        boxCode: [],
        boxMarkIndex: []
    };
    for (let key in SHOW_BTBS) {
        let length = SHOW_BTBS[key].length;
        if (SHOW_BTBS[key] && SHOW_BTBS[key].length > 0) {
            for (let i = 0; i < length; i++) {
                if (SHOW_BTBS[key][i] === "antiCodeGenerate" && routeName === "antiCode") {
                    btnsCom[key].push(Generate);
                }
                if (SHOW_BTBS[key][i] === "antiCodeRefresh" && routeName === "antiCode") {
                    btnsCom[key].push(Refresh);
                }
                if (SHOW_BTBS[key][i] === "antiCodeDownload" && routeName === "antiCode") {
                    btnsCom[key].push(download);
                }
                if (SHOW_BTBS[key][i] === "barCodeGenerate" && routeName === "barCode") {
                    btnsCom[key].push(Generate);
                }

                if (SHOW_BTBS[key][i] === "barCodeGenerates" && routeName === "barCode") {
                    btnsCom[key].push(Generates);
                }
                if (SHOW_BTBS[key][i] === "barCodeRefresh" && routeName === "barCode") {
                    btnsCom[key].push(Refresh);
                }
                if (SHOW_BTBS[key][i] === "barCodedownload" && routeName === "barCode") {
                    btnsCom[key].push(download);
                }
                //两件装
                if (routeName === "barCode" && SHOW_BTBS[key][i] === "barCodeConvert") {
                    btnsCom[key].push(Convert);
                }
                if (SHOW_BTBS[key][i] === "boxMarkAdd") {
                    btnsCom[key].push(Add);
                }
                if (SHOW_BTBS[key][i] === "boxMarkDel") {
                    btnsCom[key].push(Del);
                }
                if (SHOW_BTBS[key][i] === "boxMarkPrint") {
                    btnsCom[key].push(Print);
                }
                if (SHOW_BTBS[key][i] === "boxMarkSwitch") {
                    btnsCom[key].push(Switch);
                }
                if (SHOW_BTBS[key][i] === "boxCodeGenerateBox") {
                    btnsCom[key].push(GenerateBox);
                }
                if (SHOW_BTBS[key][i] === "boxCodePackingBox") {
                    btnsCom[key].push(PackingBox);
                }
                if (SHOW_BTBS[key][i] === "boxCodePrintBox") {
                    btnsCom[key].push(PrintBox);
                }
                if (SHOW_BTBS[key][i] === "boxCodeRefreshBox") {
                    btnsCom[key].push(RefreshBox);
                }
            }
        }
    }
    return btnsCom;
};
