|
|
@ -1,29 +1,30 @@ |
|
|
import Vue from "vue"; |
|
|
import Vue from "vue"; |
|
|
import Router from "vue-router"; |
|
|
import Router from "vue-router"; |
|
|
import http from "@/utils/request"; |
|
|
import http from "@/utils/request"; |
|
|
import { |
|
|
import { isURL } from "@/utils/validate"; |
|
|
isURL |
|
|
|
|
|
} from "@/utils/validate"; |
|
|
|
|
|
import store from "@/js/store"; |
|
|
import store from "@/js/store"; |
|
|
import { message } from "@/utils/message.js"; |
|
|
import { message } from "@/utils/message.js"; |
|
|
Vue.use(Router); |
|
|
Vue.use(Router); |
|
|
const CUSTOMER = process.env.VUE_APP_CUSTOMER; |
|
|
const CUSTOMER = process.env.VUE_APP_CUSTOMER; |
|
|
// 页面路由(独立页面)
|
|
|
// 页面路由(独立页面)
|
|
|
export const pageRoutes = [{ |
|
|
export const pageRoutes = [ |
|
|
|
|
|
{ |
|
|
path: "/login", |
|
|
path: "/login", |
|
|
component: () => import("@/views/pages/login"), |
|
|
component: () => import("@/views/pages/login"), |
|
|
name: "login", |
|
|
name: "login", |
|
|
meta: { |
|
|
meta: { |
|
|
title: "登录", |
|
|
title: "登录", |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "/", |
|
|
path: "/", |
|
|
name: "index", |
|
|
name: "index", |
|
|
// component: () => import("@/views/pages/index"),
|
|
|
// component: () => import("@/views/pages/index"),
|
|
|
redirect: { |
|
|
redirect: { |
|
|
path: "/main/home", |
|
|
path: "/main/home", |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "/404", |
|
|
path: "/404", |
|
|
component: () => import("@/views/pages/404"), |
|
|
component: () => import("@/views/pages/404"), |
|
|
name: "404", |
|
|
name: "404", |
|
|
@ -38,7 +39,8 @@ export const pageRoutes = [{ |
|
|
} |
|
|
} |
|
|
next(); |
|
|
next(); |
|
|
}, |
|
|
}, |
|
|
}, ]; |
|
|
}, |
|
|
|
|
|
]; |
|
|
// 模块路由(基于主入口布局页面)
|
|
|
// 模块路由(基于主入口布局页面)
|
|
|
export const moduleRoutes = { |
|
|
export const moduleRoutes = { |
|
|
path: "/main", |
|
|
path: "/main", |
|
|
@ -51,7 +53,8 @@ export const moduleRoutes = { |
|
|
title: "主入口布局", |
|
|
title: "主入口布局", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
children: [{ |
|
|
children: [ |
|
|
|
|
|
{ |
|
|
path: "home", |
|
|
path: "home", |
|
|
component: () => import("@/views/modules/home/index"), |
|
|
component: () => import("@/views/modules/home/index"), |
|
|
name: "home", |
|
|
name: "home", |
|
|
@ -59,7 +62,8 @@ export const moduleRoutes = { |
|
|
title: "首页", |
|
|
title: "首页", |
|
|
isTab: true, |
|
|
isTab: true, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "unopen", |
|
|
path: "unopen", |
|
|
component: () => import("@/views/modules/unopen"), |
|
|
component: () => import("@/views/modules/unopen"), |
|
|
name: "unopen", |
|
|
name: "unopen", |
|
|
@ -67,7 +71,8 @@ export const moduleRoutes = { |
|
|
title: "未开放功能", |
|
|
title: "未开放功能", |
|
|
isTab: true, |
|
|
isTab: true, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "404", |
|
|
path: "404", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/modules/404"), |
|
|
component: () => import("@/views/modules/404"), |
|
|
@ -76,7 +81,8 @@ export const moduleRoutes = { |
|
|
title: "页面未找到或无权访问", |
|
|
title: "页面未找到或无权访问", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "home-notice", |
|
|
path: "home-notice", |
|
|
props: true, |
|
|
props: true, |
|
|
name: "home-notice", |
|
|
name: "home-notice", |
|
|
@ -84,12 +90,15 @@ export const moduleRoutes = { |
|
|
meta: { |
|
|
meta: { |
|
|
isTab: true, |
|
|
isTab: true, |
|
|
title: "智能提醒", |
|
|
title: "智能提醒", |
|
|
parent: [{ |
|
|
parent: [ |
|
|
|
|
|
{ |
|
|
title: "首页", |
|
|
title: "首页", |
|
|
path: "/main/home-index", |
|
|
path: "/main/home-index", |
|
|
}, ], |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "shequ-chaxun", |
|
|
path: "shequ-chaxun", |
|
|
props: true, |
|
|
props: true, |
|
|
name: "shequ-chaxun", |
|
|
name: "shequ-chaxun", |
|
|
@ -98,7 +107,8 @@ export const moduleRoutes = { |
|
|
isTab: true, |
|
|
isTab: true, |
|
|
title: "社区查询", |
|
|
title: "社区查询", |
|
|
}, |
|
|
}, |
|
|
}, ], |
|
|
}, |
|
|
|
|
|
], |
|
|
}; |
|
|
}; |
|
|
// pc端菜单的 如果没有配置 默认的 或者配置了默认的 但没有权限 默认选中第一
|
|
|
// pc端菜单的 如果没有配置 默认的 或者配置了默认的 但没有权限 默认选中第一
|
|
|
function cookApiDataItem(item) { |
|
|
function cookApiDataItem(item) { |
|
|
@ -114,7 +124,9 @@ function cookApiDataItem(item) { |
|
|
// console.log("aaaa", ret);
|
|
|
// console.log("aaaa", ret);
|
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
let allChildrenUrl = n2one(item.children).filter((i) => i.url != "" && i.showFlag == 1).map((i) => i.url); |
|
|
let allChildrenUrl = n2one(item.children) |
|
|
|
|
|
.filter((i) => i.url != "" && i.showFlag == 1) |
|
|
|
|
|
.map((i) => i.url); |
|
|
// console.log("))))))))))))", allChildrenUrl);
|
|
|
// console.log("))))))))))))", allChildrenUrl);
|
|
|
if (item.children.length > 0) { |
|
|
if (item.children.length > 0) { |
|
|
if (item.url == "" || !allChildrenUrl.find((i) => i.url == item.url)) { |
|
|
if (item.url == "" || !allChildrenUrl.find((i) => i.url == item.url)) { |
|
|
@ -129,9 +141,7 @@ function cookApiDataItem(item) { |
|
|
} |
|
|
} |
|
|
// 把按钮都化为页面内部的权限
|
|
|
// 把按钮都化为页面内部的权限
|
|
|
function cookApiDataItem2(item) { |
|
|
function cookApiDataItem2(item) { |
|
|
let { |
|
|
let { children } = item; |
|
|
children |
|
|
|
|
|
} = item; |
|
|
|
|
|
if (children && Array.isArray(children) && children.length > 0) { |
|
|
if (children && Array.isArray(children) && children.length > 0) { |
|
|
let btns = item.children.filter((item) => item.type == 1); |
|
|
let btns = item.children.filter((item) => item.type == 1); |
|
|
item.btns = btns; |
|
|
item.btns = btns; |
|
|
@ -142,14 +152,17 @@ function cookApiDataItem2(item) { |
|
|
// 把父级拼到子集
|
|
|
// 把父级拼到子集
|
|
|
function cookApiDataItem3(item, parent = []) { |
|
|
function cookApiDataItem3(item, parent = []) { |
|
|
item.parent = parent; |
|
|
item.parent = parent; |
|
|
let { |
|
|
let { children } = item; |
|
|
children |
|
|
|
|
|
} = item; |
|
|
|
|
|
if (children && Array.isArray(children) && children.length > 0) { |
|
|
if (children && Array.isArray(children) && children.length > 0) { |
|
|
item.children = children.map((val) => cookApiDataItem3(val, [...parent, { |
|
|
item.children = children.map((val) => |
|
|
|
|
|
cookApiDataItem3(val, [ |
|
|
|
|
|
...parent, |
|
|
|
|
|
{ |
|
|
title: item.name || "", |
|
|
title: item.name || "", |
|
|
path: (item.url || "").replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)), |
|
|
path: (item.url || "").replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)), |
|
|
}, ])); |
|
|
}, |
|
|
|
|
|
]) |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
return item; |
|
|
return item; |
|
|
} |
|
|
} |
|
|
@ -164,7 +177,8 @@ export const dataBoardRoutes = { |
|
|
meta: { |
|
|
meta: { |
|
|
title: "主入口布局", |
|
|
title: "主入口布局", |
|
|
}, |
|
|
}, |
|
|
children: [{ |
|
|
children: [ |
|
|
|
|
|
{ |
|
|
path: "renfang/index", |
|
|
path: "renfang/index", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/renfang/index"), |
|
|
component: () => import("@/views/dataBoard/renfang/index"), |
|
|
@ -173,7 +187,8 @@ export const dataBoardRoutes = { |
|
|
title: "人房总览", |
|
|
title: "人房总览", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "renfang/resi-list", |
|
|
path: "renfang/resi-list", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/renfang/resi/list"), |
|
|
component: () => import("@/views/dataBoard/renfang/resi/list"), |
|
|
@ -182,7 +197,8 @@ export const dataBoardRoutes = { |
|
|
title: "居民列表", |
|
|
title: "居民列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "renfang/resi-class", |
|
|
path: "renfang/resi-class", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/renfang/resi/class"), |
|
|
component: () => import("@/views/dataBoard/renfang/resi/class"), |
|
|
@ -191,7 +207,8 @@ export const dataBoardRoutes = { |
|
|
title: "居民分类列表", |
|
|
title: "居民分类列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "renfang/resi-analyze", |
|
|
path: "renfang/resi-analyze", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/renfang/resi/analyze"), |
|
|
component: () => import("@/views/dataBoard/renfang/resi/analyze"), |
|
|
@ -200,7 +217,8 @@ export const dataBoardRoutes = { |
|
|
title: "居民分析列表", |
|
|
title: "居民分析列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "renfang/house-list", |
|
|
path: "renfang/house-list", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/renfang/house/list"), |
|
|
component: () => import("@/views/dataBoard/renfang/house/list"), |
|
|
@ -209,7 +227,8 @@ export const dataBoardRoutes = { |
|
|
title: "房屋列表", |
|
|
title: "房屋列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "renfang/warn-building", |
|
|
path: "renfang/warn-building", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/renfang/warn/building"), |
|
|
component: () => import("@/views/dataBoard/renfang/warn/building"), |
|
|
@ -218,7 +237,8 @@ export const dataBoardRoutes = { |
|
|
title: "预警楼栋列表", |
|
|
title: "预警楼栋列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "renfang/warn-resi", |
|
|
path: "renfang/warn-resi", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/renfang/warn/resi"), |
|
|
component: () => import("@/views/dataBoard/renfang/warn/resi"), |
|
|
@ -227,7 +247,8 @@ export const dataBoardRoutes = { |
|
|
title: "预警楼栋居民", |
|
|
title: "预警楼栋居民", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "sida/index", |
|
|
path: "sida/index", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/index"), |
|
|
component: () => import("@/views/dataBoard/sida/index"), |
|
|
@ -236,7 +257,8 @@ export const dataBoardRoutes = { |
|
|
title: "四大清单", |
|
|
title: "四大清单", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "sida/xq/list", |
|
|
path: "sida/xq/list", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/xq/list"), |
|
|
component: () => import("@/views/dataBoard/sida/xq/list"), |
|
|
@ -245,7 +267,8 @@ export const dataBoardRoutes = { |
|
|
title: "需求清单列表", |
|
|
title: "需求清单列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
},{ |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "sida/wt/eventList", |
|
|
path: "sida/wt/eventList", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/wt/eventList"), |
|
|
component: () => import("@/views/dataBoard/sida/wt/eventList"), |
|
|
@ -254,7 +277,8 @@ export const dataBoardRoutes = { |
|
|
title: "治理事件列表", |
|
|
title: "治理事件列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
},{ |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "sida/wt/hiddenDangerList", |
|
|
path: "sida/wt/hiddenDangerList", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/wt/hiddenDangerList"), |
|
|
component: () => import("@/views/dataBoard/sida/wt/hiddenDangerList"), |
|
|
@ -263,7 +287,8 @@ export const dataBoardRoutes = { |
|
|
title: "安全隐患列表", |
|
|
title: "安全隐患列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
},{ |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "sida/wt/specialCategoryList", |
|
|
path: "sida/wt/specialCategoryList", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/wt/specialCategoryList"), |
|
|
component: () => import("@/views/dataBoard/sida/wt/specialCategoryList"), |
|
|
@ -272,7 +297,8 @@ export const dataBoardRoutes = { |
|
|
title: "综治人群列表", |
|
|
title: "综治人群列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
},{ |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "sida/zy/peopleResList", |
|
|
path: "sida/zy/peopleResList", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/zy/peopleResList"), |
|
|
component: () => import("@/views/dataBoard/sida/zy/peopleResList"), |
|
|
@ -281,7 +307,8 @@ export const dataBoardRoutes = { |
|
|
title: "人资源列表", |
|
|
title: "人资源列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
},{ |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "sida/zy/goodsResList", |
|
|
path: "sida/zy/goodsResList", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/zy/goodsResList"), |
|
|
component: () => import("@/views/dataBoard/sida/zy/goodsResList"), |
|
|
@ -290,7 +317,8 @@ export const dataBoardRoutes = { |
|
|
title: "物资源列表", |
|
|
title: "物资源列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
},{ |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "sida/zy/placeResList", |
|
|
path: "sida/zy/placeResList", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/zy/placeResList"), |
|
|
component: () => import("@/views/dataBoard/sida/zy/placeResList"), |
|
|
@ -299,8 +327,8 @@ export const dataBoardRoutes = { |
|
|
title: "场所隐患列表", |
|
|
title: "场所隐患列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
} |
|
|
}, |
|
|
, { |
|
|
{ |
|
|
path: "sida/fw", |
|
|
path: "sida/fw", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/sida/fw"), |
|
|
component: () => import("@/views/dataBoard/sida/fw"), |
|
|
@ -309,7 +337,8 @@ export const dataBoardRoutes = { |
|
|
title: "四大清单-服务清单查看更多", |
|
|
title: "四大清单-服务清单查看更多", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "fifteen/index", |
|
|
path: "fifteen/index", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/fifteen/index"), |
|
|
component: () => import("@/views/dataBoard/fifteen/index"), |
|
|
@ -318,7 +347,58 @@ export const dataBoardRoutes = { |
|
|
title: "十五分钟生活圈", |
|
|
title: "十五分钟生活圈", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: "overview/index", |
|
|
|
|
|
props: true, |
|
|
|
|
|
component: () => import("@/views/dataBoard/overview/index"), |
|
|
|
|
|
name: "dataBoard-overview-index", |
|
|
|
|
|
meta: { |
|
|
|
|
|
title: "概览", |
|
|
|
|
|
isTab: false, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: "organizational/index", |
|
|
|
|
|
props: true, |
|
|
|
|
|
component: () => import("@/views/dataBoard/organizational/index"), |
|
|
|
|
|
name: "dataBoard-organizational-index", |
|
|
|
|
|
meta: { |
|
|
|
|
|
title: "组织架构", |
|
|
|
|
|
isTab: false, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: "humanData/index", |
|
|
|
|
|
props: true, |
|
|
|
|
|
component: () => import("@/views/dataBoard/humanData/index"), |
|
|
|
|
|
name: "dataBoard-humanData-index", |
|
|
|
|
|
meta: { |
|
|
|
|
|
title: "人房数据", |
|
|
|
|
|
isTab: false, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: "satisfactionEval/index", |
|
|
|
|
|
props: true, |
|
|
|
|
|
component: () => import("@/views/dataBoard/satisfactionEval/index"), |
|
|
|
|
|
name: "dataBoard-satisfactionEval-index", |
|
|
|
|
|
meta: { |
|
|
|
|
|
title: "满意度评价", |
|
|
|
|
|
isTab: false, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: "organizational/index", |
|
|
|
|
|
props: true, |
|
|
|
|
|
component: () => import("@/views/dataBoard/organizational/index"), |
|
|
|
|
|
name: "dataBoard-organizational-index", |
|
|
|
|
|
meta: { |
|
|
|
|
|
title: "组织架构", |
|
|
|
|
|
isTab: false, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "404", |
|
|
path: "404", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/dataBoard/404"), |
|
|
component: () => import("@/views/dataBoard/404"), |
|
|
@ -335,7 +415,8 @@ export const dataBoardRoutes = { |
|
|
} |
|
|
} |
|
|
next(); |
|
|
next(); |
|
|
}, |
|
|
}, |
|
|
}, ], |
|
|
}, |
|
|
|
|
|
], |
|
|
}; |
|
|
}; |
|
|
// 模块路由(基于主入口布局页面) 可视化数据
|
|
|
// 模块路由(基于主入口布局页面) 可视化数据
|
|
|
export const moduleShujuRoutes = { |
|
|
export const moduleShujuRoutes = { |
|
|
@ -348,7 +429,8 @@ export const moduleShujuRoutes = { |
|
|
meta: { |
|
|
meta: { |
|
|
title: "主入口布局", |
|
|
title: "主入口布局", |
|
|
}, |
|
|
}, |
|
|
children: [{ |
|
|
children: [ |
|
|
|
|
|
{ |
|
|
path: "/main-shuju/visual-basicinfo-people/:uid", |
|
|
path: "/main-shuju/visual-basicinfo-people/:uid", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/modules/visual/basicinfo/people"), |
|
|
component: () => import("@/views/modules/visual/basicinfo/people"), |
|
|
@ -357,7 +439,8 @@ export const moduleShujuRoutes = { |
|
|
title: "个人详情", |
|
|
title: "个人详情", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "/main-shuju/visual-basicinfo-people-list", |
|
|
path: "/main-shuju/visual-basicinfo-people-list", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/modules/visual/basicinfo/peopleList"), |
|
|
component: () => import("@/views/modules/visual/basicinfo/peopleList"), |
|
|
@ -366,7 +449,8 @@ export const moduleShujuRoutes = { |
|
|
title: "人员列表", |
|
|
title: "人员列表", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "404", |
|
|
path: "404", |
|
|
props: true, |
|
|
props: true, |
|
|
component: () => import("@/views/modules/visual/404"), |
|
|
component: () => import("@/views/modules/visual/404"), |
|
|
@ -375,13 +459,13 @@ export const moduleShujuRoutes = { |
|
|
title: "页面未找到或无权访问", |
|
|
title: "页面未找到或无权访问", |
|
|
isTab: false, |
|
|
isTab: false, |
|
|
}, |
|
|
}, |
|
|
}, ], |
|
|
}, |
|
|
|
|
|
], |
|
|
}; |
|
|
}; |
|
|
export function addDynamicRoute(routeParams, router) { |
|
|
export function addDynamicRoute(routeParams, router) { |
|
|
// 组装路由名称, 并判断是否已添加, 如是: 则直接跳转
|
|
|
// 组装路由名称, 并判断是否已添加, 如是: 则直接跳转
|
|
|
var routeName = routeParams.routeName; |
|
|
var routeName = routeParams.routeName; |
|
|
var dynamicRoute = window.SITE_CONFIG["dynamicRoutes"].filter( |
|
|
var dynamicRoute = window.SITE_CONFIG["dynamicRoutes"].filter((item) => item.name === routeName)[0]; |
|
|
(item) => item.name === routeName)[0]; |
|
|
|
|
|
if (dynamicRoute) { |
|
|
if (dynamicRoute) { |
|
|
return router.push({ |
|
|
return router.push({ |
|
|
name: routeName, |
|
|
name: routeName, |
|
|
@ -400,12 +484,14 @@ export function addDynamicRoute(routeParams, router) { |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
router.matcher = new Router().matcher |
|
|
router.matcher = new Router().matcher; |
|
|
router.addRoutes([{ |
|
|
router.addRoutes([ |
|
|
|
|
|
{ |
|
|
...moduleRoutes, |
|
|
...moduleRoutes, |
|
|
name: `main-dynamic__${dynamicRoute.name}`, |
|
|
name: `main-dynamic__${dynamicRoute.name}`, |
|
|
children: [dynamicRoute], |
|
|
children: [dynamicRoute], |
|
|
}, ]); |
|
|
}, |
|
|
|
|
|
]); |
|
|
window.SITE_CONFIG["dynamicRoutes"].push(dynamicRoute); |
|
|
window.SITE_CONFIG["dynamicRoutes"].push(dynamicRoute); |
|
|
router.push({ |
|
|
router.push({ |
|
|
name: dynamicRoute.name, |
|
|
name: dynamicRoute.name, |
|
|
@ -430,17 +516,17 @@ router.beforeEach((to, from, next) => { |
|
|
} |
|
|
} |
|
|
const customerId = localStorage.getItem("customerId"); |
|
|
const customerId = localStorage.getItem("customerId"); |
|
|
console.log("customerId:", customerId); |
|
|
console.log("customerId:", customerId); |
|
|
http.get("gov/access/menu/navDigitalCommunityNew?tableName=data_menu").then(({ |
|
|
http |
|
|
data: res |
|
|
.get("gov/access/menu/navDigitalCommunityNew?tableName=data_menu") |
|
|
}) => { |
|
|
.then(({ data: res }) => { |
|
|
if (res.code == 10005 || res.code == 10006 || res.code == 10007) { |
|
|
if (res.code == 10005 || res.code == 10006 || res.code == 10007) { |
|
|
// 10005 token为空 10006登陆超时 10007别处登录
|
|
|
// 10005 token为空 10006登陆超时 10007别处登录
|
|
|
console.log("登录失效"); |
|
|
console.log("登录失效"); |
|
|
message({ |
|
|
message({ |
|
|
message: res.msg || "未知错误", |
|
|
message: res.msg || "未知错误", |
|
|
type: 'error', |
|
|
type: "error", |
|
|
duration: 2 * 1000 |
|
|
duration: 2 * 1000, |
|
|
}) |
|
|
}); |
|
|
return next({ |
|
|
return next({ |
|
|
name: "login", |
|
|
name: "login", |
|
|
}); |
|
|
}); |
|
|
@ -451,37 +537,41 @@ router.beforeEach((to, from, next) => { |
|
|
...to, |
|
|
...to, |
|
|
replace: true, |
|
|
replace: true, |
|
|
}); |
|
|
}); |
|
|
}).catch((err) => { |
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
console.log(err); |
|
|
console.log(err); |
|
|
next({ |
|
|
next({ |
|
|
name: "login", |
|
|
name: "login", |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
http.get("gov/access/menu/navDigitalCommunityNew").then(({ |
|
|
http |
|
|
data: res |
|
|
.get("gov/access/menu/navDigitalCommunityNew") |
|
|
}) => { |
|
|
.then(({ data: res }) => { |
|
|
console.log(res); |
|
|
console.log(res); |
|
|
if (res.code == 10005 || res.code == 10006 || res.code == 10007) { |
|
|
if (res.code == 10005 || res.code == 10006 || res.code == 10007) { |
|
|
// 10005 token为空 10006登陆超时 10007别处登录
|
|
|
// 10005 token为空 10006登陆超时 10007别处登录
|
|
|
console.log("登录失效"); |
|
|
console.log("登录失效"); |
|
|
message({ |
|
|
message({ |
|
|
message: res.msg || "未知错误", |
|
|
message: res.msg || "未知错误", |
|
|
type: 'error', |
|
|
type: "error", |
|
|
duration: 2 * 1000 |
|
|
duration: 2 * 1000, |
|
|
}) |
|
|
}); |
|
|
return next({ |
|
|
return next({ |
|
|
name: "login", |
|
|
name: "login", |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
window.SITE_CONFIG["menuList"] = res.data.map((item) => cookApiDataItem3(item)).map((item) => |
|
|
window.SITE_CONFIG["menuList"] = res.data |
|
|
cookApiDataItem2(item)).map((item) => cookApiDataItem(item)); |
|
|
.map((item) => cookApiDataItem3(item)) |
|
|
|
|
|
.map((item) => cookApiDataItem2(item)) |
|
|
|
|
|
.map((item) => cookApiDataItem(item)); |
|
|
fnAddDynamicMenuRoutes(window.SITE_CONFIG["menuList"]); |
|
|
fnAddDynamicMenuRoutes(window.SITE_CONFIG["menuList"]); |
|
|
// next({ ...to, replace: true })
|
|
|
// next({ ...to, replace: true })
|
|
|
next({ |
|
|
next({ |
|
|
...to, |
|
|
...to, |
|
|
replace: true, |
|
|
replace: true, |
|
|
}); |
|
|
}); |
|
|
}).catch((err) => { |
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
console.log(err); |
|
|
console.log(err); |
|
|
next({ |
|
|
next({ |
|
|
name: "login", |
|
|
name: "login", |
|
|
@ -534,8 +624,7 @@ function fnAddDynamicMenuRoutes(menuList = [], routes = []) { |
|
|
let URL = (menuList[i].url || "").replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)); // URL支持{{ window.xxx }}占位符变量
|
|
|
let URL = (menuList[i].url || "").replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)); // URL支持{{ window.xxx }}占位符变量
|
|
|
if (isURL(URL)) { |
|
|
if (isURL(URL)) { |
|
|
if (menuList[i].children && menuList[i].children.length >= 1) { |
|
|
if (menuList[i].children && menuList[i].children.length >= 1) { |
|
|
let item = menuList[i].children.find( |
|
|
let item = menuList[i].children.find((subMenu) => subMenu.url == menuList[i].url); |
|
|
(subMenu) => subMenu.url == menuList[i].url); |
|
|
|
|
|
if (item) { |
|
|
if (item) { |
|
|
route["path"] = route["name"] = `i-${menuList[i].id}`; |
|
|
route["path"] = route["name"] = `i-${menuList[i].id}`; |
|
|
route["redirect"] = `i-${item.id}`; |
|
|
route["redirect"] = `i-${item.id}`; |
|
|
@ -567,16 +656,19 @@ function fnAddDynamicMenuRoutes(menuList = [], routes = []) { |
|
|
} |
|
|
} |
|
|
// routers.reverse();
|
|
|
// routers.reverse();
|
|
|
// 添加路由
|
|
|
// 添加路由
|
|
|
router.addRoutes([{ |
|
|
router.addRoutes([ |
|
|
|
|
|
{ |
|
|
...moduleRoutes, |
|
|
...moduleRoutes, |
|
|
name: "main-dynamic-menu", |
|
|
name: "main-dynamic-menu", |
|
|
children: routes, |
|
|
children: routes, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "/main/*", |
|
|
path: "/main/*", |
|
|
redirect: { |
|
|
redirect: { |
|
|
path: "/main/404", |
|
|
path: "/main/404", |
|
|
}, |
|
|
}, |
|
|
}, ]); |
|
|
}, |
|
|
|
|
|
]); |
|
|
window.SITE_CONFIG["dynamicMenuRoutes"] = routes; |
|
|
window.SITE_CONFIG["dynamicMenuRoutes"] = routes; |
|
|
window.SITE_CONFIG["dynamicMenuRoutesHasAdded"] = true; |
|
|
window.SITE_CONFIG["dynamicMenuRoutesHasAdded"] = true; |
|
|
} |
|
|
} |
|
|
@ -603,8 +695,7 @@ function fnAddDynamicMenuRoutes2(menuList = [], routes = []) { |
|
|
let URL = (menuList[i].url || "").replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)); // URL支持{{ window.xxx }}占位符变量
|
|
|
let URL = (menuList[i].url || "").replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)); // URL支持{{ window.xxx }}占位符变量
|
|
|
if (isURL(URL)) { |
|
|
if (isURL(URL)) { |
|
|
if (menuList[i].children && menuList[i].children.length >= 1) { |
|
|
if (menuList[i].children && menuList[i].children.length >= 1) { |
|
|
let item = menuList[i].children.find( |
|
|
let item = menuList[i].children.find((subMenu) => subMenu.url == menuList[i].url); |
|
|
(subMenu) => subMenu.url == menuList[i].url); |
|
|
|
|
|
if (item) { |
|
|
if (item) { |
|
|
route["path"] = route["name"] = `i-${menuList[i].id}`; |
|
|
route["path"] = route["name"] = `i-${menuList[i].id}`; |
|
|
route["redirect"] = `i-${item.id}`; |
|
|
route["redirect"] = `i-${item.id}`; |
|
|
@ -635,16 +726,19 @@ function fnAddDynamicMenuRoutes2(menuList = [], routes = []) { |
|
|
return fnAddDynamicMenuRoutes2(temp, routes); |
|
|
return fnAddDynamicMenuRoutes2(temp, routes); |
|
|
} |
|
|
} |
|
|
// 添加路由
|
|
|
// 添加路由
|
|
|
router.addRoutes([{ |
|
|
router.addRoutes([ |
|
|
|
|
|
{ |
|
|
...moduleShujuRoutes, |
|
|
...moduleShujuRoutes, |
|
|
name: "main-dynamic-menu-shuju", |
|
|
name: "main-dynamic-menu-shuju", |
|
|
children: routes, |
|
|
children: routes, |
|
|
}, { |
|
|
}, |
|
|
|
|
|
{ |
|
|
path: "/main-shuju/*", |
|
|
path: "/main-shuju/*", |
|
|
redirect: { |
|
|
redirect: { |
|
|
path: "/main-shuju/404", |
|
|
path: "/main-shuju/404", |
|
|
}, |
|
|
}, |
|
|
}, ]); |
|
|
}, |
|
|
|
|
|
]); |
|
|
window.SITE_CONFIG["dynamicMenuRoutesShuju"] = routes; |
|
|
window.SITE_CONFIG["dynamicMenuRoutesShuju"] = routes; |
|
|
window.SITE_CONFIG["dynamicMenuRoutesShujuHasAdded"] = true; |
|
|
window.SITE_CONFIG["dynamicMenuRoutesShujuHasAdded"] = true; |
|
|
} |
|
|
} |
|
|
|