/* * @FilePath: index.ts * @Author: 王路平 * @文件版本: V1.0.0 * @Date: 2023-01-29 15:16:36 * @Description: * * 版权信息 : 2023 by ${再登软件}, All Rights Reserved. */ import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"; import { selectPermission } from "@/http/rule/index" import { ElMessage, ElMessageBox } from 'element-plus' import { getStoredLanguage, saveStoredLanguage, languageHash } from "@/utils/languageStorage"; const routes: Array = [ { path: "/child", name: "child", component: () => import("../views/child/index.vue"), children: [ //理论二级 { path: "/Mechanics", name: "Mechanics", component: () => import("../views/Mechanics/indexNew.vue"), }, { path: "/demo", name: "demo", // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. component: () => import(/* webpackChunkName: "about" */ "../views/demo/demo.vue"), }, { path: "/environment", name: "environment", // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. component: () => import("../views/environment/index.vue"), }, { path: "/generalEnvironment", name: "generalEnvironment", component: () => import("../views/generalEnvironment/index.vue"), }, { path: "/realtimeSecurity", name: "realtimeSecurity", component: () => import("../views/realtimeSecurity/index.vue"), }, { path: "/energyConsume", name: "energyConsume", component: () => import("../views/energyConsume/index.vue") }, { path: "/energyConsume/historyData", name: 'historyData', component: () => import("../views/energyConsume/content/child/historyData.vue"), }, { path: "/InPlantProducts", name: "InPlantProducts", component: () => import("../views/InPlantProducts/index.vue"), }, { path: "/Offsite", children: [ { path: "/Offsite", name: "Offsite", component: () => import("../views/Offsite/index.vue"), }, { path: "/Offsite/devList/:city", name: "offSiteDevList", component: () => import("../views/Offsite/child/index.vue"), }, ], }, { path: "/MicrofactoryDev", name: "MicrofactoryDev", component: () => import("../views/MicrofactoryDev/index.vue"), }, { path: "/MicrofactoryDevOnline", name: "MicrofactoryDevOnline", component: () => import("../views/MicrofactoryDevOnline/index.vue"), }, { path: "/PaintShopView", name: "PaintShopView", component: () => import("../views/PaintShopView/View1/index.vue"), }, { path: "/stuffView", name: "stuffView", component: () => import("../views/PaintShopView/stuffView/index.vue"), }, { path: "/machiningView", name: "machiningView", component: () => import("../views/PaintShopView/machiningView/index.vue"), }, { path: "/finishView", name: "finishView", component: () => import("../views/PaintShopView/finishView/index.vue"), }, { path: "/weldView", name: "weldView", component: () => import("../views/PaintShopView/weldView/index.vue"), }, { path: "/realtimeSecurityJixie", name: "realtimeSecurityJixie", component: () => import("../views/realtimeSecurityJixiefenchang/index.vue"), }, { path: "/energyConsumejixie", name: "energyConsumejixie", component: () => import("../views/energyConsumeJixiefenchang/index.vue"), children: [ { path: "/energyConsumejixie/historyData", name: "jixieHistoryData", component: () => import( "../views/energyConsumeJixiefenchang/content/child/historyData.vue" ), }, ], }, { path: "/generalEnvironmentjixiefenchang", name: "generalEnvironmentjixiefenchang", component: () => import("../views/generalEnvironmentjixiefenchang/index.vue"), }, { path: "/generalEnvironmentMechanical", name: "generalEnvironmentMechanical", component: () => import("../views/generalEnvironmentMechanical/index.vue"), }, { path: "/FactoryView", name: "FactoryView", component: () => import("../views/FactoryView/index.vue"), }, { path: "/FactoryViewTopo", name: "FactoryViewTopo", component: () => import("../views/FactoryViewTopo/index.vue"), }, { path: "/FactoryView/:type", name: "FactoryViewEdit", component: () => import("../views/FactoryView/index.vue"), }, { path: "/electronicControl", name: "electronicControl", component: () => import("../views/electronicControl/index.vue"), }, { path: "/electronicControlAmbient", name: "electronicControlAmbient", component: () => import("../views/electronicControlAmbient/index.vue"), }, { path: "/legionProducts/:deptId", name: "legionProducts", component: () => import("../views/legionProducts/index.vue"), }, { path: "/pmData", name: "pmData", component: () => import("../views/pmData/index.vue"), }, { path: "/electronicControl", name: "electronicControl", component: () => import("../views/electronicControl/index.vue"), }, { path: "/electronicControlAmbient", name: "electronicControlAmbient", component: () => import("../views/electronicControlAmbient/index.vue"), }, { path: "/", name: "index", component: () => import("../views/index.vue"), }, { path: "/InPlantProducts/:id/:label/:name", name: "devItem", component: () => import("../views/InPlantProducts/child/index.vue"), }, { path: "/InPlantProducts/tufting", name: "tufting", component: () => import("../views/Temp/Tufting/index.vue"), }, { path: "/InPlantProducts/winding", name: "Winding", component: () => import("../views/Temp/Winding/index.vue"), }, { path: "/InPlantProducts/Large_Format", name: "Large_Format", component: () => import("../views/Temp/Large_Format/index.vue"), }, { path: "/InPlantProducts/GetonAgain", name: "GetonAgain", component: () => import("../views/Temp/GetonAgain/index.vue"), }, { path: "/InPlantProducts/OffsiteDevList", name: "OffsiteDevList", component: () => import("../views/Temp/OffsiteDevList/index.vue"), }, { path: "/waterhousedata", name: "waterhousedata", component: () => import("../views/Waterhouse/index.vue"), }, { path: "/TrendChart", name: "TrendChart", component: () => import("../views/TrendChart/index.vue"), }, { path: "/intelligentShelves", name: "intelligentShelves", component: () => import("../views/intelligentShelves/index.vue"), }, { path: "/MicEnvironment", name: "MicEnvironment", component: () => import("../views/MicEnvironment/index.vue"), }, { path: "/MicroExhibition", children: [ { path: "/MicroExhibition", name: "MicroExhibition", component: () => import("../views/MicroExhibition/index.vue"), }, { path: "/MicroExhibition/:id", name: "MicroExhibitionChild", component: () => import("../views/MicroExhibition/child/index.vue"), }, ] }, { path: "/CismaExhibition", name: "CismaExhibition", component: () => import("../views/Exhibition/Cisma/index.vue"), }, { path: "/ColombiaExhibition", name: "ColombiaExhibition", component: () => import("../views/Exhibition/Colombia/index.vue"), }, { path: "/BengalExhibition", name: "BengalExhibition", component: () => import("../views/Exhibition/Bengal/index.vue"), }, { path: "/CHICExhibition", name: "CHICExhibition", component: () => import("../views/Exhibition/CHIC/index.vue"), }, { path: "/SCISMAExhibition", name: "SCISMAExhibition", component: () => import("../views/Exhibition/SCISMA/index.vue"), }, { path: "/ExhibitionTable_:id", name: "ExhibitionTable", component: () => import("../views/Exhibition/table/index.vue"), }, { path: "/ExhibitionStation_:id", name: "ExhibitionStation", component: () => import("../views/Exhibition/Station/index.vue"), }, { path: "/MicroExhibitionTable", name: "MicroExhibitionTable", component: () => import("../views/Exhibition/Cisma/table.vue"), }, { path: "/Hazardous", name: "Hazardous", component: () => import("../views/Hazardous/index.vue"), }, { path: "/stuffCrownBlock", name: "stuffCrownBlock", component: () => import("../views/CrownBlock/stuffCrownBlock/index.vue"), }, { path: "/SewingBift", name: "SewingBift", component: () => import("../views/SewingBift/index.vue"), }, { path: "/Elevator", name: "Elevator", component: () => import("../views/Elevator/index.vue"), }, { path: "/Recorder", name: "Recorder", component: () => import("../views/Recorder/index.vue"), }, // 机械分厂单页面工位屏 { path: "/Station_:id", name: "Station", component: () => import("../views/Mechanics/child/station/index.vue"), }, //理论二级 { path: "/Mechanics/:id", name: "Mechanicschild", component: () => import("../views/Mechanics/child/index.vue"), }, //理论三级 { path: "/Mechanics/:id/:dev", name: "Mechanicsson", component: () => import("../views/Mechanics/child/son/index.vue"), }, ], }, { path: "/AerialView", name: "AerialView", component: () => import("../views/AerialView/index.vue"), }, { path: "/MechanicalView", name: "MechanicalView", component: () => import("../views/MechanicalView/index.vue"), }, { path: "/MechanicalViewEdit", name: "MechanicalViewEdit", component: () => import("../views/MechanicalViewEdit/index.vue"), }, { path: "/MechanicalViewDajian", name: "MechanicalViewDajian", component: () => import("../views/MechanicalView_dajian/index.vue"), }, { path: "/MechanicalViewHanjie", name: "MechanicalViewHanjie", component: () => import("../views/MechanicalView_hanjie/index.vue"), }, { path: "/MechanicalViewJijia", name: "MechanicalViewJijia", component: () => import("../views/MechanicalView_jijia/index.vue"), }, { path: "/MechanicalViewJingjia", name: "MechanicalViewJingjia", component: () => import("../views/MechanicalView_jingjia/index.vue"), }, { path: "/MechanicalViewJingshi", name: "MechanicalViewJingshi", component: () => import("../views/MechanicalView_jingshi/index.vue"), }, ]; const router = createRouter({ history: createWebHashHistory(), routes, }); router.beforeEach(async (to: any, from, next) => { // ... let address = to.name let hash = to.query.hash let lang = to.query?.lang || '' let arr = [ 'legionProducts', 'devItem', 'tufting', 'Winding', 'Large_Format', 'GetonAgain', 'OffsiteDevList', 'Mechanicschild', 'Mechanicsson', 'historyData', 'jixieHistoryData' ] // 返回 false 以取消导航 if (to.path == "/") { sessionStorage.setItem("screen_hash", to.query.hash); next(); } else { if (lang && languageHash(lang) && languageHash(lang) != getStoredLanguage()) { saveStoredLanguage(languageHash(lang)) window.location.reload() return false } next(); } /* else if (arr.includes(address)) { next(); } else { let res: any = await selectPermission({ address, hash }) if (res.data == true) { next() } else { ElMessageBox.alert('没有该页面权限', '通知', { // if you want to disable its autofocus // autofocus: false, confirmButtonText: '确认' }) return false } } */ }) // router.beforeEach(async (to: any, from, next) => { // // 返回 false 以取消导航 // if (to.path !== "/SewingBift") { // return false; // } else { // next(); // } // }) export default router;