import { createWebHistory, createRouter } from "vue-router";
/* Layout */
import Layout from "@/layout";
import { deepClone, flattenTreeList } from "@/utils";
import BasicRoute from "./routeBasic";
const modules = import.meta.glob("@/views/**");
import emitter from "@/utils/eventBus";
/**
* Note: 路由配置项
*
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
* roles: ['admin', 'common'] // 访问路由的角色权限
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
* meta : {
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
}
*/
// 公共路由
export const constantRoutes = [
{
path: "/",
redirect: "/myWorkbench",
},
{
path: "/login",
name: "login",
component: () => import("@/views/login"),
hidden: true,
},
{
path: "/register",
component: () => import("@/views/register"),
hidden: true,
},
{
path: "/:pathMatch(.*)*",
component: () => import("@/views/error/404"),
hidden: true,
},
{
path: "/401",
component: () => import("@/views/error/401"),
hidden: true,
},
];
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: "/search",
component: Layout,
redirect: "search",
meta: {
docTitle: "搜索",
parentActive: "search",
},
children: [
{
name: "search",
path: "/search",
component: () => import("@/views/search"),
},
],
},
{
path: "/notice",
component: Layout,
redirect: "/notice",
meta: {
docTitle: "通知",
},
children: [
{
name: "notice",
path: "/notice",
redirect: "/notify",
component: () => import("@/views/notice"),
children: [
{
name: "notify",
path: "/notify",
title: "通知",
meta: {
parentActive: "notice",
},
component: () => import("@/views/notice/notify"),
},
],
},
],
},
{
path: "/myWork",
component: Layout,
redirect: "/dashboard",
meta: {
docTitle: "工作台",
},
children: [
{
name: "myWorkbench",
path: "/myWorkbench",
redirect: "/dashboard",
component: () => import("@/views/myWorkbench"),
children: [
{
name: "dashboard",
path: "/dashboard",
title: "仪表盘",
meta: {
parentActive: "myWorkbench",
},
component: () => import("@/views/myWorkbench/dashboard"),
},
{
name: "todoTasks",
path: "/todoTasks",
title: "待办任务",
meta: {
parentActive: "myWorkbench",
},
component: () => import("@/views/myWorkbench/todoTasks"),
},
{
name: "reviewCenter",
path: "/reviewCenter",
title: "流程中心",
meta: {
parentActive: "myWorkbench",
},
component: () => import("@/views/myWorkbench/reviewCenter"),
},
],
},
],
},
{
path: "/ComponentiInProject",
component: Layout,
redirect: "ComponentiInProject",
children: [
{
name: "workItems",
path: "/workItems",
meta: {
parentActive: "ComponentiInProject",
},
component: () => import("@/views/workitem"),
},
{
name: "projectPageSetting",
path: "/projectPageSetting/:projectId",
meta: {
parentActive: "ProjectManagements",
},
component: () => import("@/views/pm/pmpm"),
props: (route) => ({
projectId: route.params.projectId,
}),
// redirect: "/projectPageSetting/overview", // 添加默认重定向
children: [
{
name: "baseline",
path: "baseline",
component: () =>
import("@/views/pm/pmpm/components/baseLine/index.vue"),
},
{
name: "changeManager",
path: "changeManager",
title: "变更管理",
// redirect: { name: "change-manager-list" },
component: () =>
import("@/views/changeManager/index.vue"),
children: [
{
name: "change-manager-list",
path: "manager",
component: () => import("@/views/changeManager/components/manage.vue"),
},
{
name: "change-ledger-list",
path: "ledger",
component: () => import("@/views/changeManager/components/ledger.vue"),
},
]
},
{
name: "workItem",
path: "work-item",
component: () => import("@/views/workitem/index.vue"),
},
{
name: "testManager",
path: "test-manager",
component: () => import("@/views/pm/pmpm/components/testManager"),
redirect: { name: "testOverview" },
children: [
{
name: "testOverview",
path: "overview",
component: () =>
import(
"@/views/pm/pmpm/components/testManager/overview/index"
),
},
{
name: "testCase",
path: "case",
component: () =>
import("@/views/pm/pmpm/components/testManager/case/index"),
redirect: { name: "testCaseLibrary" },
children: [
{
name: "testCaseLibrary",
path: "library",
component: () =>
import(
"@/views/pm/pmpm/components/testManager/case/libraryList"
),
},
{
name: "testCaseList",
path: "list/:libraryId",
component: () =>
import(
"@/views/pm/pmpm/components/testManager/case/case"
),
},
{
name: "testCaseList2",
path: "list2/:libraryId",
component: () =>
import(
"@/views/pm/pmpm/components/testManager/case/caseList/caselist"
),
},
],
},
{
name: "testPlan",
path: "plan",
component: () =>
import("@/views/pm/pmpm/components/testManager/plan/index"),
redirect: { name: "planList" },
children: [
{
name: "planList",
path: "list",
component: () =>
import(
"@/views/pm/pmpm/components/testManager/plan/planList"
),
},
{
name: "planDetail",
path: "detail/:planId",
component: () =>
import(
"@/views/pm/pmpm/components/testManager/plan/planLibrary"
),
},
],
},
{
name: "testReport",
path: "report",
component: () =>
import(
"@/views/pm/pmpm/components/testManager/report/reportList"
),
},
],
},
{
name: "overview",
path: "overview",
component: () =>
import("@/views/pm/pmpm/components/overview/index.vue"),
},
{
name: "member",
path: "member",
component: () =>
import("@/views/pm/pmpm/components/member/index.vue"),
},
{
name: "communicationDesign",
path: "communication-design",
component: () =>
import("@/views/pm/pmpm/components/communicationDesign/index.vue"),
},
{
name: "checklist",
path: "software-inventory",
component: () =>
import("@/views/pm/pmpm/components/softwareInventory/index.vue"),
},
{
name: "funcSecurity",
path: "funcSecurity",
redirect: { name: "hara" },
component: () =>
import("@/views/pm/pmpm/components/funcSecurity/index.vue"),
children: [
{
name: "hara",
path: "hara",
component: () => import("@/views/pm/pmpm/components/funcSecurity/component/hara.vue"),
},
{
name: "func-sec-fault",
path: "fault",
component: () => import("@/views/pm/pmpm/components/funcSecurity/component/fault.vue"),
},
{
name: "func-sec-hazard",
path: "hazard",
component: () => import("@/views/pm/pmpm/components/funcSecurity/component/hazard.vue"),
},
{
name: "func-sec-scene",
path: "scene",
component: () => import("@/views/pm/pmpm/components/funcSecurity/component/scene.vue"),
},
{
name: "func-sec-event",
path: "event",
component: () => import("@/views/pm/pmpm/components/funcSecurity/component/event.vue"),
},
{
name: "func-sec-target",
path: "target",
component: () => import("@/views/pm/pmpm/components/funcSecurity/component/target.vue"),
},
]
},
// {
// name: "projectPlan",
// path: "project-plan",
// title: "项目计划",
// redirect: { name: "plan-list" },
// component: () =>
// import("@/views/pm/pmpm/components/projectPlan/index.vue"),
// children: [
// {
// name: "plan-list",
// path: "plan",
// component: () => import("@/views/pm/pmpm/components/projectPlan/plan/index.vue"),
// },
// {
// name: "milestone-list",
// path: "milestone",
// component: () => import("@/views/pm/pmpm/components/projectPlan/milestone/index.vue"),
// },
// ]
// },
{
name: "bugManager",
path: "bugManager",
component: () =>
import("@/views/pm/pmpm/components/bugManager/index.vue"),
},
{
name: "iteration",
path: "iteration",
component: () =>
import("@/views/pm/pmpm/components/iteration/index.vue"),
},
{
name: "knowledgeBase",
path: "knowledge-base",
component: () => import("@/views/pm/pmpm/components/pmpmWiki/index.vue"),
redirect: { name: 'pmRecently'},
children: [
{
name: "pmRecently",
path: "recently",
title: "最近",
icon: "time",
meta: {
parentActive: "pmWiki",
},
component: () => import("@/views/wiki/recently"),
},
{
name: "pMycollectiton",
path: "mycollectiton",
title: "我的收藏",
icon: "rate",
meta: {
parentActive: "pmWiki",
},
component: () => import("@/views/wiki/mycollectiton"),
},
{
name: "pmShare",
path: "share",
title: "与我共享",
icon: "redo",
meta: {
parentActive: "pmWiki",
},
component: () => import("@/views/wiki/share"),
},
// {
// path: "shareManage",
// redirect: "/shareManage/:knowledgeGroupId",
// children: [
// {
// path: "/shareManage/:knowledgeGroupId",
// name: "pmShareManage",
// component: () => import("@/views/wiki/shareManage"),
// meta: {
// parentActive: "pmWiki",
// topActive: "share"
// },
// },
// ],
// },
{
path: "shareManage/:knowledgeGroupId",
name: "pmShareManage",
component: () => import("@/views/wiki/shareManage"),
meta: {
parentActive: "pmWiki",
topActive: "pmShare"
},
},
{
name: "pmPageGroup",
path: "pageGroup",
title: "知识库",
icon: "space",
meta: {
parentActive: "pmWiki",
},
component: () => import("@/views/wiki/pageGroup"),
},
{
name: "pmInsightOverview",
path: "insightOverview",
title: "数据统计",
icon: "monitor",
meta: {
parentActive: "pmWiki",
},
component: () => import("@/views/wiki/insightOverview"),
},
// {
// path: "pageGroupManage",
// redirect: "pageGroupManage",
// children: [
// {
// path: "pageGroupManage/:knowledgeGroupId",
// name: "pmPageGroupManage",
// component: () => import("@/views/wiki/pageGroupManage"),
// meta: {
// parentActive: "pmWiki",
// topActive: "pageGroup"
// },
// },
// ],
// },
{
path: "pageGroupManage/:knowledgeGroupId",
name: "pmPageGroupManage",
component: () => import("@/views/wiki/pageGroupManage"),
meta: {
parentActive: "pmWiki",
topActive: "pmPageGroup"
},
},
// {
// path: "archiveManage",
// redirect: "archiveManage/:knowledgeGroupId",
// children: [
// {
// path: "archiveManage/:knowledgeGroupId",
// name: "pmArchiveManage",
// component: () => import("@/views/wiki/archiveManage"),
// meta: {
// parentActive: "pmWiki",
// topActive: "pageGroup"
// },
// },
// ],
// },
{
path: "archiveManage/:knowledgeGroupId",
name: "pmArchiveManage",
component: () => import("@/views/wiki/archiveManage"),
meta: {
parentActive: "pmWiki",
topActive: "pmPageGroup"
},
},
// {
// path: "pageGroupSet",
// redirect: "pageGroupSet/:knowledgeGroupId",
// children: [
// {
// path: "pageGroupSet/:knowledgeGroupId",
// name: "pmPageGroupSet",
// component: () => import("@/views/wiki/pageGroupSet"),
// meta: {
// parentActive: "pmWiki",
// topActive: "pageGroup"
// },
// },
// ],
// },
{
path: "pageGroupSet/:knowledgeGroupId",
name: "pmPageGroupSet",
component: () => import("@/views/wiki/pageGroupSet"),
meta: {
parentActive: "pmWiki",
topActive: "pmPageGroup"
},
},
// {
// path: "wikiHistory",
// redirect: "wikiHistory/:knowledgeGroupId",
// children: [
// {
// path: "wikiHistory/:knowledgeGroupId",
// name: "pmSikiHistory",
// component: () => import("@/views/wiki/history"),
// meta: {
// parentActive: "pmWiki",
// topActive: "pageGroup"
// },
// },
// ],
// },
{
path: "wikiHistory/:knowledgeGroupId",
name: "pmWikiHistory",
component: () => import("@/views/wiki/history"),
meta: {
parentActive: "pmWiki",
topActive: "pmPageGroup"
},
},
],
},
{
name: "projectPlan",
path: "project-plan",
title: "项目计划",
redirect: { name: "plan-list" },
component: () =>
import("@/views/pm/pmpm/components/projectPlan/index.vue"),
children: [
{
name: "plan-list",
path: "plan",
component: () => import("@/views/pm/pmpm/components/projectPlan/plan/index.vue"),
},
{
name: "milestone-list",
path: "milestone",
component: () => import("@/views/pm/pmpm/components/projectPlan/milestone/index.vue"),
},
]
},
{
name: "projectSetting",
path: "project-setting",
component: () => import("@/views/pm/pmpm/components/setTab.vue"),
},
{
name: "fileManager",
path: "fileManager",
title: "文件管理",
component: () => import("_f/views/File.vue"),
},
{
path: "onlyoffice",
name: "Onlyoffice",
meta: {
title: "在线编辑预览",
content: {
description:
"onlyoffice 文档在线编辑预览,支持 Word Excel PowerPoint",
},
},
component: () => import("@/views/QWFile/views/OnlyOffice.vue"),
},
{
name: 'softwareManager',
path: 'software-management',
title: '软件管理',
component: () => import("@/views/pm/pmpm/components/softwareManagement/index.vue"),
children: [
// {
// name: "software-board",
// path: "board",
// component: () => import("@/views/pm/pmpm/components/softwareManagement/board"),
// },
{
name: "software-train",
path: "train",
component: () => import("@/views/pm/pmpm/components/softwareManagement/train"),
},
{
name: "software-ecu",
path: "ecu",
component: () => import("@/views/pm/pmpm/components/softwareManagement/ECUList"),
},
{
name: "software-ecu-version",
path: "ecu-version",
component: () => import("@/views/pm/pmpm/components/softwareManagement/ECUVersionList"),
},
{
name: "software-delivery",
path: "delivery",
component: () => import("@/views/pm/pmpm/components/softwareManagement/delivery"),
},
{
name: "software-ecu-base-version-list",
path: "ecu-base",
component: () => import("@/views/pm/pmpm/components/softwareManagement/ECUBaseVersionList"),
},
{
name: "software-delivery-list",
path: "delivery-list",
component: () => import("@/views/pm/pmpm/components/softwareManagement/deliveryList"),
},
{
name: "efficiency-board",
path: "efficiency",
component: () => import("@/views/pm/pmpm/components/softwareManagement/efficiency"),
},
]
},
{
name: "projectTask",
path: "task",
title: "任务",
redirect: { name: "task-list" },
component: () => import("@/views/pm/pmpm/components/taskManagement/index.vue"),
children: [
{
name: "task-list",
path: "list",
title: "任务列表",
component: () => import("@/views/pm/pmpm/components/taskManagement/list.vue"),
},
{
name: "task-test",
path: "test",
title: "任务测试",
component: () => import("@/views/pm/pmpm/components/taskManagement/test.vue"),
}
]
}
],
},
],
},
{
path: "/wiki",
component: Layout,
redirect: "/recently",
meta: {
docTitle: "知识库",
},
children: [
{
name: "wiki",
path: "/wiki",
redirect: "/recently",
component: () => import("@/views/wiki"),
children: [
{
name: "recently",
path: "/recently",
title: "最近",
icon: "time",
meta: {
parentActive: "wiki",
},
component: () => import("@/views/wiki/recently"),
},
{
name: "mycollectiton",
path: "/mycollectiton",
title: "我的收藏",
icon: "rate",
meta: {
parentActive: "wiki",
},
component: () => import("@/views/wiki/mycollectiton"),
},
{
name: "share",
path: "/share",
title: "与我共享",
icon: "redo",
meta: {
parentActive: "wiki",
},
component: () => import("@/views/wiki/share"),
},
{
path: "/shareManage",
redirect: "/shareManage/:knowledgeGroupId",
children: [
{
path: "/shareManage/:knowledgeGroupId",
name: "shareManage",
component: () => import("@/views/wiki/shareManage"),
meta: {
parentActive: "wiki",
topActive: "share",
},
},
],
},
{
name: "pageGroup",
path: "/pageGroup",
title: "知识库",
icon: "space",
meta: {
parentActive: "wiki",
},
component: () => import("@/views/wiki/pageGroup"),
},
{
name: "insightOverview",
path: "/insightOverview",
title: "数据统计",
icon: "monitor",
meta: {
parentActive: "wiki",
},
component: () => import("@/views/wiki/insightOverview"),
},
{
path: "/pageGroupManage",
redirect: "pageGroupManage",
children: [
{
path: "/pageGroupManage/:knowledgeGroupId",
name: "pageGroupManage",
component: () => import("@/views/wiki/pageGroupManage"),
meta: {
parentActive: "wiki",
topActive: "pageGroup",
},
},
],
},
{
path: "/archiveManage",
redirect: "/archiveManage/:knowledgeGroupId",
children: [
{
path: "/archiveManage/:knowledgeGroupId",
name: "archiveManage",
component: () => import("@/views/wiki/archiveManage"),
meta: {
parentActive: "wiki",
topActive: "pageGroup",
},
},
],
},
{
path: "/pageGroupSet",
redirect: "/pageGroupSet/:knowledgeGroupId",
children: [
{
path: "/pageGroupSet/:knowledgeGroupId",
name: "pageGroupSet",
component: () => import("@/views/wiki/pageGroupSet"),
meta: {
parentActive: "wiki",
topActive: "pageGroup",
},
},
],
},
{
path: "/wikiHistory",
redirect: "/wikiHistory/:knowledgeGroupId",
children: [
{
path: "/wikiHistory/:knowledgeGroupId",
name: "wikiHistory",
component: () => import("@/views/wiki/history"),
meta: {
parentActive: "wiki",
topActive: "pageGroup",
},
},
],
},
],
},
],
},
{
path: "/rdLibrary",
component: Layout,
redirect: "/library",
meta: {
docTitle: "研发库",
},
children: [
{
name: "rdLibrary",
path: "/rdLibrary",
redirect: "/library",
component: () => import("@/views/RdLibrary/index.vue"),
children: [
{
name: "library",
path: "/library",
component: () => import("@/views/RdLibrary/library/index.vue"),
},
{
name: "libraryContents",
path: "/libraryContents",
component: () => import("@/views/RdLibrary/library/contents.vue"),
},
{
name: "demandPoolLadger",
path: "/demandPoolLadger",
component: () => import("@/views/RdLibrary/components/demandPoolLadger.vue"),
},
{
name: "librarySettings",
path: "/librarySettings",
component: () => import("@/views/RdLibrary/library/librarySettings.vue"),
},
]
}
],
},
{
path:"/Architecture",
component: Layout,
redirect: "/architecture",
meta: {
docTitle: "架构设计",
},
children: [
{
name: "architectureDesign",
path: "/architectureDesign",
component: () => import("@/views/architecture"),
}
]
},
{
path: "/baselineManagements",
component: Layout,
redirect: "/baselinesManagement",
meta: {
docTitle: "基线管理",
},
children: [
{
name: "baselinesManagement",
path: "/baselinesManagement",
component: () => import("@/views/baselineManagement/index.vue"),
}
],
},
{
path: "/HelpCenters",
component: Layout,
redirect: "/updateLog",
meta: {
docTitle: "帮助",
},
children: [
{
name: "HelpCenters",
path: "/HelpCenters",
redirect: "/updateLog",
component: () => import("@/views/HelpCenters"),
children: [
{
name: "updateLog",
path: "/updateLog",
title: "更新日志",
meta: {
parentActive: "HelpCenters",
},
component: () => import("@/views/HelpCenters/updateLog"),
},
],
},
],
},
{
path: "/configurationCenter",
component: Layout,
redirect: "/projectGroupMag",
meta: {
docTitle: "配置",
},
children: [
{
name: "configurationCenter",
path: "/configurationCenter",
redirect: "/projectGroupMag",
component: () => import("@/views/configurationCenter"),
children: [
{
name: "MenuManagement",
path: "/MenuManagement",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/configurationCenter/MenuManagement"),
},
{
name: "UserManagement",
path: "/UserManagement",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/configurationCenter/UserManagement"),
},
{
name: "/userGroup",
path: "/userGroup",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/ugm"),
},
{
name: "departManagement",
path: "/departManageMent",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/dgm"),
},
{
name: "RoleManagement",
path: "/RoleManagement",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/configurationCenter/RoleManagement"),
},
{
name: "functionalSafety",
path: "/functionalSafety",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/securityConfig/functionalSafety"),
},
{
name: "WorkitemType",
path: "/WorkitemType",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/workitemConfig/workType"),
},
{
name: "Notification",
path: "/WorkitemType/Notification",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/workitemConfig/notification"),
},
{
name: "jiraSetting",
path: "/jiraSetting",
component: () => import("@/views/jiraSetting"),
meta: {
parentActive: "configurationCenter",
},
},
{
name: "WindowConfig",
path: "/WindowConfig",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/workitemConfig/workFrame"),
},
{
name: "ProcessDesign",
path: "/ProcessDesign",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/workitemConfig/workFlow"),
},
{
name: "ProjectM",
path: "/ProjectM",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/pm/proManaConfig/components/projectMag.vue"),
},
{
name: "projectGroupMag",
path: "/projectGroupMag",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/pm/proManaConfig/components/projectGroupMag"),
},
{
name: "projectAttribute",
path: "/projectAttribute",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/pm/proManaConfig/components/projectAttribute"),
},
{
name: "projectStatus",
path: "/projectStatus",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/pm/proManaConfig/components/projectStatus"),
},
{
name: "projectRole",
path: "/projectRole",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/pm/proManaConfig/components/projectRole"),
},
{
path: "/aclmanager",
name: "aclmanager",
props: (route) => ({ projectId: route.query.projectId || "-1" }),
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/workitemConfig/acl/index.vue"),
// children: [{
// name: "aclmanager",
// path: "/aclmanager",
// component: () => import('@/views/workitemConfig/acl/index.vue')
// }]
},
{
name: "TestPlanAttribute",
path: "/TestPlanAttribute",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/TestManagementConfig/TestPlanAttribute"),
},
{
name: "FileSizeConfig",
path: "/FileSizeConfig",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/fileConfig/fileInfoManage"),
},
{
name: "LoginLogs",
path: "/LoginLogs",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/logManagement/loginlogs"),
},
{
name: "ActionLogs",
path: "/ActionLogs",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/logManagement/actionlogs"),
},
{
name: "InterfaceLogs",
path: "/InterfaceLogs",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/logManagement/interfacelogs"),
},
{
name: "iterationAttribute",
path: "/iterationAttribute",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/pm/iterationAttributeConfig/iterationAttribute"),
},
{
name: "wikiPermissConfig",
path: "/wikiPermissConfig",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/wiki/wikiManaConfig/wikiPermissConfig"),
},
{
name: "wikiPageManage",
path: "/wikiPageManage",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/wiki/wikiManaConfig/wikiPageManage"),
},
{
name: "wikiInfoManage",
path: "/wikiInfoManage",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/wiki/wikiManaConfig/wikiInfoManage"),
},
{
name: "wikiTemplateManage",
path: "/wikiTemplateManage",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/wiki/wikiManaConfig/wikiTemplateManage"),
},
{
name: "templateList",
path: "/templateList",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/templateList"),
},
{
name: "formFlowEdit",
path: "/formFlowEdit",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import(
"@/views/pm/reviewCenter/formFlowEdit/FormProcessDesigner"
),
},
{
name: "componentManage",
path: "/componentManage",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/componentManage"),
},
{
name: "dataManage",
path: "/dataManage",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/dataManage"),
},
{
name: "dataStatistics",
path: "/dataStatistics",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/dataStatistics"),
},
{
name: "baseLineAttribute",
path: "/baseLineAttribute",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/pm/baseLineM/attribute.vue"),
},
{
name: "baseLineStatus",
path: "/baseLineStatus",
meta: {
parentActive: "configurationCenter",
},
component: () =>
import("@/views/pm/baseLineM/status.vue"),
},
{
name: "applicableCarType", // 适用车型
path: "/applicableCarType",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/applicableConfig/applicableCarType"),
},
{
name: "applicableStage", // 适用阶段
path: "/applicableStage",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/applicableConfig/applicableStage"),
},
{
name: "approvalSet", // 审批设置
path: "/approvalSet",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/approvalSet"),
}, {
name: "ECUDataSet", // ECU主数据
path: "/ECUDataSet",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/ECUDataSet"),
},
{
name: "ECUDataSet", // ECU主数据
path: "/ECUDataSet",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/reviewCenter/ECUDataSet"),
},
{
name: "ecuConfig", // data dictionary-ecu配置
path: "/ecuConfig",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/dataDictionary/ecu"),
},
{
name: "systemConfig", // 数据字典-系统配置
path: "/systemConfig",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/dataDictionary/system"),
},
{
name: "stageConfig", // 数据字典-阶段配置
path: "/stageConfig",
meta: {
parentActive: "configurationCenter",
},
component: () => import("@/views/pm/dataDictionary/stage"),
},
],
},
],
},
{
path: "/workitem",
component: Layout,
redirect: "workitem",
children: [
{
name: "workitem",
path: "/workitem",
component: () => import("@/views/workitem"),
},
],
},
{
path: "/pm",
component: Layout,
redirect: "/projectManagement",
meta: {
docTitle: "项目",
},
children: [
{
name: "ProjectManagements",
path: "/pm",
redirect: "/projectManagement", //重定向的目标路径
component: () => import("@/views/pm/home"),
children: [
{
name: "ProjectManagements",
path: "/projectManagement",
title: "项目列表",
// meta: {
// parentActive: "myWorkbench",
// },
component: () =>
import("@/views/pm/home/conmponents/projectManagement.vue"),
},
],
},
],
},
{
path: "/fileManagement",
component: Layout,
redirect: "/File",
meta: {
docTitle: "文件管理",
},
children: [
{
name: "File",
path: "/File",
title: "文件管理",
component: () => import("_f/views/File.vue"),
},
],
},
{
path: "/office",
name: "office",
meta: {
title: "在线编辑预览",
content: {
description: "onlyoffice 文档在线编辑预览,支持 Word Excel PowerPoint",
},
},
component: () => import("@/views/QWFile/views/OnlyOffice.vue"),
},
];
const router = createRouter({
history: createWebHistory(),
routes: [...constantRoutes, ...dynamicRoutes],
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
}
return { top: 0 };
},
});
// 添加路由
export const resetRouter = (params) => {
const dashboardRoute =
router.options.routes.filter((el) => el?.path.indexOf("/dashboard") > -1) ??
[];
const param = [...params, ...BasicRoute, ...dashboardRoute];
router.options.routes = [];
router.options.routes.push(...param);
// param.forEach((item) => {
// router.addRoute(item);
// });
};
// 生成路由
export const filterRoute = (rou) => {
const permission = [];
if (rou && Array.isArray(rou)) {
rou.sort((a, b) => a.displayOrder - b.displayOrder);
const forFn = (arr, val) => {
// eslint-disable-next-line array-callback-return
for (let i = 0; i < arr.length; i++) {
// 跳过第一层非目录的数据
const item = arr[i];
if (item?.resourceType === 1 && item?.pid === "0") {
continue;
}
item.name = item.routerName;
item.path = item.routerAddress;
try {
// eslint-disable-next-line no-eval
item.meta = JSON.parse(item.meta);
item.meta.resourceName = item.resourceName;
item.meta.resourceCode = item.resourceCode;
} catch (e) {
console.log(e);
}
// 处理菜单
if (item.resourceType !== 2) {
item.meta.icon = item.icon || "";
item.meta.btncontent = [];
if (item.meta.permission) {
permission.push(item);
}
if (item.fileAddress) {
item.component = modules[`/src/${item.fileAddress}/index.vue`];
item.componentString = `@/${item.fileAddress}`;
}
}
if (item.resourceType === 2) {
permission.push(item);
val?.meta?.btncontent?.push({
icon: item.icon,
btnName: item.resourceName,
btnCode: item.resourceCode,
});
if (val.meta?.list) {
const child = val?.children?.find(
(el) => el.resourceCode === item.resourceCode
);
if (child) {
child.meta.btncontent = [];
child.meta.btncontent.push({
icon: item.icon,
btnName: item.resourceName,
btnCode: item.resourceCode,
});
}
}
arr.splice(i--, 1);
}
if (item.children && Array.isArray(item.children)) {
if (item.children.length > 0) {
item.children.sort((a, b) => a.displayOrder - b.displayOrder);
item.redirect = item.children.filter(
(el) => el.resourceType === 1
)?.[0]?.routerAddress;
forFn(item.children, item);
}
}
}
};
forFn(rou);
}
return { rou, permission };
};
router.beforeEach((to, from) => {
// 如果是从 fileManager 页面离开
if (from.path.includes("/fileManager")) {
emitter.emit("routeChange", { to, from });
}
});
export default router;
最新发布