const children = [ { path: "/dispatch", name: "dispatch", component: () => import(/* webpackChunkName: "home" */ "../views/dispatch/index.vue"), meta: { title: "指挥调度", cache: true, platform: ["*"], activePath: "/dispatch", }, }, { path: "/resources", name: "resources", component: () => import(/* webpackChunkName: "resources" */ "../views/resources/index.vue"), meta: { title: "安保资源", cache: true, platform: ["1"], activePath: "/resources", }, }, { path: "/business", name: "business", component: () => import(/* webpackChunkName: "business" */ "../views/business/index.vue"), meta: { title: "业务管理", cache: true, platform: ["*"], activePath: "/business", }, }, { path: "/lowAltitude", name: "LowAltitude", component: () => import("../views/lowAltitude/index.vue"), meta: { title: "低空反制", cache: true, platform: ["3"], activePath: "/lowAltitude", }, }, // { // path: "/dataScreen", // name: "DataScreen", // component: () => import("../views/dataScreen/index.vue"), // meta: { // title: "人员管控", // cache: true, // platform: ["3"], // activePath: "/dataScreen", // }, // }, ]; const routesInPermission = function (platform, userInfo) { const validOrganizationIdList = [ "09T9dNBG", "1tBb2bDAEeJsWHEi02u", "Jhwx4QbA", "2lM9EmWI", "2q2vgdok", "5jpd0sLw", "7JXUKfBb", "8z4xyS11", "dhzd5mhY", "F2ACPNgL", "fQApDBw1", "GyuorRdo", "HBFWrven", "HEMcjFVa", "hQm4YmPf", "i4P1jXhT", "IsARDObt", "kkYyAtqg", "KwQQ69Dv", "mztStsRw", "O7f4fVUf", "PuMEHWd8", "sj1Kf5em", "SQqrXjZR", "SwFbtxtI", "UylOOzvJ", "VNzrc1JJ", "VP5I6tAj", "VxPArVQC", "wQXqGyYF", "Zyrpkhh1", "__7Zw9tQ63kkYjLppAa0X", "__iZjB3As6MOfttXkZTXo", "__l4j8hCF7xNmFSRfeQb0", "__Ovmh5cBQhH9e6IJtWlz", "__PqwmbX3GUVvK74BWzKY", "__Qqg3L4GhNXG4iRAmcTB", "__yUx7oCr0CPEjfFd0T1K", "__Zjepzcyikm2y1AHdlbQ", "eGrmlAN1", "gZGdnW3U", "kJe5VD6U", "mli417t9", "3iT1CmoS", "qdnOMp3X", ]; /** * 前面是测试;后面是生产的晋城监管 */ var allowedOrgMapIds = [ "O7f4fVUf","aSuXCEfz", "4M7RXroG","4QGmpAGh","6ANmoszz","71X9cdyh","9sMq8EPh","AwxGWFRk","cP7MDSKk","Cv8XDpGP","gg6iICab","HSokHrED","I14RzqIk","kl7jYiJE","kSfurmSQ","LOvwa730","n0Hha7MO","oPz2xZZZ","pc7RXsqo","tfbBTBuA","vZftGH9g","WRrytEl4","wzFgCQTd","YRFbg5AS","Zi6bq4Ko","ZncuHFnv" ]; if(allowedOrgMapIds.includes(userInfo.organizationId)) { children.push( { path: "/bigScreen", name: "bigScreen", component: () => import(/* webpackChunkName: "business" */ "../views/bigScreen/index.vue"), meta: { title: "指挥大屏", cache: true, platform: ["*"], activePath: "/bigScreen", }, } ); } let permissionList = [...children]; if (process.env.VUE_APP_ENV === "production") { //如果是生产环境,判断是否在组织内,显示点名管理菜单 if (validOrganizationIdList.includes(userInfo.organizationId)) { permissionList.push({ path: "/rollCallManage", name: "rollCallManage", component: () => import(/* webpackChunkName: "business" */ "../components/parentView/index.vue"), meta: { title: "点名管理", cache: true, platform: ["1", "2"], activePath: "/rollCallManage", }, redirect: "/polling", children: [ { path: "/polling", name: "polling", component: () => import(/* webpackChunkName: "business" */ "../views/rollCallManage/polling/index.vue"), meta: { title: "点名轮询", cache: true, platform: ["*"], hidden: true, activePath: "/rollCallManage", }, }, { path: "/supervision", name: "supervision", component: () => import(/* webpackChunkName: "business" */ "../views/rollCallManage/supervision/index.vue"), meta: { title: "督导点名", cache: true, platform: ["*"], hidden: true, activePath: "/rollCallManage", }, }, ], }); } } else { //如果不是生产环境,显示点名管理菜单 permissionList.push({ path: "/rollCallManage", name: "rollCallManage", component: () => import(/* webpackChunkName: "business" */ "../components/parentView/index.vue"), meta: { title: "点名管理", cache: true, platform: ["1", "2"], activePath: "/rollCallManage", }, redirect: "/polling", children: [ { path: "/polling", name: "polling", component: () => import(/* webpackChunkName: "business" */ "../views/rollCallManage/polling/index.vue"), meta: { title: "点名轮询", cache: true, platform: ["*"], hidden: true, activePath: "/rollCallManage", }, }, { path: "/supervision", name: "supervision", component: () => import(/* webpackChunkName: "business" */ "../views/rollCallManage/supervision/index.vue"), meta: { title: "督导点名", cache: true, platform: ["*"], hidden: true, activePath: "/rollCallManage", }, }, ], }); } if (process.env.VUE_APP_DISPALY_RISK_CIRCLE === "true") { permissionList = permissionList.filter((route) => route.name !== "rollCallManage"); } console.log("======permissionList======", permissionList); return permissionList.filter((route) => { // const sysUserInfo = JSON.parse(userInfo); return (route.meta.platform.includes("*") || route.meta.platform.includes(platform)) && !route.meta.hidden; }); }; export default function generateRoutes(platform, userInfo) { return [ { path: "/", name: "layout", redirect: "/dispatch", component: () => import(/* webpackChunkName: "home" */ "../views/layout/index.vue"), children: routesInPermission(platform, userInfo), meta: { hidden: true, }, }, ]; }