screenFront/src/router/index.ts

510 lines
14 KiB
TypeScript
Raw Normal View History

2023-05-12 08:41:33 +00:00
/*
* @FilePath: index.ts
2023-05-12 08:41:33 +00:00
* @Author:
* @文件版本: V1.0.0
* @Date: 2023-01-29 15:16:36
* @Description:
*
* 版权信息 : 2023 by ${}, All Rights Reserved.
*/
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
2023-08-02 10:04:04 +00:00
import { selectPermission } from "@/http/rule/index"
import { ElMessage, ElMessageBox } from 'element-plus'
import { getStoredLanguage, saveStoredLanguage, languageHash } from "@/utils/languageStorage";
2023-05-12 08:41:33 +00:00
const routes: Array<RouteRecordRaw> = [
{
path: "/child",
name: "child",
component: () => import("../views/child/index.vue"),
children: [
//理论二级
{
path: "/Mechanics",
name: "Mechanics",
component: () => import("../views/Mechanics/indexNew.vue"),
2023-05-12 08:41:33 +00:00
},
{
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",
2023-08-07 02:28:46 +00:00
component: () => import("../views/energyConsume/index.vue")
},
{
path: "/energyConsume/historyData",
name: 'historyData',
component: () =>
import("../views/energyConsume/content/child/historyData.vue"),
2023-05-12 08:41:33 +00:00
},
{
path: "/InPlantProducts",
name: "InPlantProducts",
component: () => import("../views/InPlantProducts/index.vue"),
},
{
path: "/Offsite",
children: [
{
2023-12-13 08:16:30 +00:00
path: "/Offsite",
name: "Offsite",
2023-05-12 08:41:33 +00:00
component: () => import("../views/Offsite/index.vue"),
},
{
path: "/Offsite/devList/:city",
2023-08-02 10:04:04 +00:00
name: "offSiteDevList",
2023-05-12 08:41:33 +00:00
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"),
},
2023-05-12 08:41:33 +00:00
{
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",
2023-08-02 10:04:04 +00:00
component: () => import("../views/energyConsumeJixiefenchang/index.vue"),
2023-05-12 08:41:33 +00:00
children: [
{
path: "/energyConsumejixie/historyData",
2023-08-02 10:04:04 +00:00
name: "jixieHistoryData",
2023-05-12 08:41:33 +00:00
component: () =>
import(
"../views/energyConsumeJixiefenchang/content/child/historyData.vue"
),
},
],
},
{
path: "/generalEnvironmentjixiefenchang",
name: "generalEnvironmentjixiefenchang",
component: () =>
import("../views/generalEnvironmentjixiefenchang/index.vue"),
},
2023-06-07 09:00:51 +00:00
{
path: "/generalEnvironmentMechanical",
name: "generalEnvironmentMechanical",
component: () =>
import("../views/generalEnvironmentMechanical/index.vue"),
},
2023-05-12 08:41:33 +00:00
{
path: "/FactoryView",
name: "FactoryView",
component: () => import("../views/FactoryView/index.vue"),
},
{
path: "/FactoryViewTopo",
name: "FactoryViewTopo",
component: () => import("../views/FactoryViewTopo/index.vue"),
},
2023-05-12 08:41:33 +00:00
{
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"),
},
2023-05-31 08:16:19 +00:00
{
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"),
},
2023-08-14 03:40:23 +00:00
{
path: "/MicEnvironment",
name: "MicEnvironment",
component: () => import("../views/MicEnvironment/index.vue"),
},
2023-08-23 10:06:47 +00:00
{
path: "/MicroExhibition",
2023-08-25 09:54:48 +00:00
children: [
{
path: "/MicroExhibition",
name: "MicroExhibition",
component: () => import("../views/MicroExhibition/index.vue"),
2023-08-25 09:54:48 +00:00
},
{
path: "/MicroExhibition/:id",
name: "MicroExhibitionChild",
component: () => import("../views/MicroExhibition/child/index.vue"),
},
]
2023-08-23 10:06:47 +00:00
},
2023-12-22 08:53:21 +00:00
{
path: "/CismaExhibition",
name: "CismaExhibition",
component: () => import("../views/Exhibition/Cisma/index.vue"),
2023-12-22 08:53:21 +00:00
},
{
path: "/ColombiaExhibition",
name: "ColombiaExhibition",
component: () => import("../views/Exhibition/Colombia/index.vue"),
},
{
path: "/BengalExhibition",
name: "BengalExhibition",
component: () => import("../views/Exhibition/Bengal/index.vue"),
},
2024-02-23 09:01:59 +00:00
{
path: "/CHICExhibition",
name: "CHICExhibition",
component: () => import("../views/Exhibition/CHIC/index.vue"),
},
2024-03-12 09:03:49 +00:00
{
path: "/SCISMAExhibition",
name: "SCISMAExhibition",
component: () => import("../views/Exhibition/SCISMA/index.vue"),
},
2024-03-14 09:07:42 +00:00
{
path: "/CIFMExhibition",
name: "CIFMExhibition",
component: () => import("../views/Exhibition/CIFM/index.vue"),
},
2024-03-19 03:26:43 +00:00
{
path: "/CIFMExhibitionMain",
name: "CIFMExhibitionMain",
component: () => import("../views/Exhibition/CIFM/main.vue"),
},
{
2024-03-21 09:07:40 +00:00
path: "/CIFMExhibitionMain_:name",
2024-03-19 03:26:43 +00:00
name: "CIFMExhibitionMainChild",
component: () => import("../views/Exhibition/CIFM/child.vue"),
},
2024-03-19 09:06:56 +00:00
{
path: "/DEMOExhibition",
name: "DEMOExhibition",
component: () => import("../views/Exhibition/Demo/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"),
},
2023-10-12 09:01:52 +00:00
{
path: "/stuffCrownBlock",
name: "stuffCrownBlock",
component: () => import("../views/CrownBlock/stuffCrownBlock/index.vue"),
},
{
path: "/SewingBift",
name: "SewingBift",
component: () => import("../views/SewingBift/index.vue"),
},
2023-12-19 09:09:23 +00:00
{
path: "/Elevator",
name: "Elevator",
component: () => import("../views/Elevator/index.vue"),
},
2024-01-05 08:25:49 +00:00
{
path: "/Recorder",
name: "Recorder",
component: () => import("../views/Recorder/index.vue"),
},
2024-01-09 00:37:13 +00:00
// 机械分厂单页面工位屏
{
2024-01-12 09:05:48 +00:00
path: "/Station_:id",
2024-01-09 00:37:13 +00:00
name: "Station",
component: () => import("../views/Mechanics/child/station/index.vue"),
},
2024-04-16 05:11:56 +00:00
// 德国展会
{
path: "/GermanyExhibition",
name: "GermanyExhibition",
2024-04-17 09:17:09 +00:00
component: () => import("../views/Exhibition/Germany/index.vue"),
},
{
path: "/GermanyExhibitionChild",
name: "GermanyExhibitionChild",
2024-04-16 05:11:56 +00:00
component: () => import("../views/Exhibition/Germany/child.vue"),
},
2024-04-18 06:46:40 +00:00
{
path: "/GermanyExhibitionLoop",
name: "GermanyExhibitionLoop",
component: () => import("../views/Exhibition/Germany/loop.vue"),
},
2024-07-31 01:08:38 +00:00
// 昌昊大屏
{
path:"/ChangHaoView_:id",
name:"ChangHaoView",
component: () => import("../views/ChangHaoView/index.vue"),
},
2023-05-12 08:41:33 +00:00
//理论二级
{
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,
});
2023-11-09 02:54:50 +00:00
2023-08-02 10:04:04 +00:00
router.beforeEach(async (to: any, from, next) => {
2023-08-01 01:22:16 +00:00
// ...
2023-08-02 10:04:04 +00:00
let address = to.name
let hash = to.query.hash
let lang = to.query?.lang || ''
2023-08-02 10:04:04 +00:00
let arr = [
'legionProducts', 'devItem', 'tufting', 'Winding', 'Large_Format',
'GetonAgain', 'OffsiteDevList', 'Mechanicschild', 'Mechanicsson', 'historyData', 'jixieHistoryData'
2023-08-02 10:04:04 +00:00
]
2024-01-30 06:54:10 +00:00
2023-08-01 01:22:16 +00:00
// 返回 false 以取消导航
2023-08-02 10:04:04 +00:00
if (to.path == "/") {
2023-08-03 03:37:01 +00:00
sessionStorage.setItem("screen_hash", to.query.hash);
2023-08-02 10:04:04 +00:00
next();
2024-01-30 06:54:10 +00:00
} else {
if (lang && languageHash(lang) && languageHash(lang) != getStoredLanguage()) {
saveStoredLanguage(languageHash(lang))
window.location.reload()
return false
}
next();
}
/*
else if (arr.includes(address)) {
2023-08-02 10:04:04 +00:00
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
}
}
2024-01-30 06:54:10 +00:00
*/
2023-08-01 01:22:16 +00:00
})
2023-11-09 02:54:50 +00:00
// router.beforeEach(async (to: any, from, next) => {
// // 返回 false 以取消导航
// if (to.path !== "/SewingBift") {
// return false;
// } else {
// next();
// }
// })
2023-05-12 08:41:33 +00:00
export default router;