diff --git a/src/api/system-boot/csstatisticalset.ts b/src/api/system-boot/csstatisticalset.ts index f72e219..7ddae60 100644 --- a/src/api/system-boot/csstatisticalset.ts +++ b/src/api/system-boot/csstatisticalset.ts @@ -77,3 +77,11 @@ export const queryByPagePath = (params: any) => { params }) } +// 根据用户id查询用户驾驶舱 +export const getDashboardPageByUserId = (params: any) => { + return createAxios({ + url: '/system-boot/dashboard/getDashboardPageByUserId', + method: 'post', + params + }) +} diff --git a/src/components/cockpit/governanceReport/index.vue b/src/components/cockpit/governanceReport/index.vue index ce917b8..3265470 100644 --- a/src/components/cockpit/governanceReport/index.vue +++ b/src/components/cockpit/governanceReport/index.vue @@ -1,7 +1,7 @@ - + - - + + + + + + + + + + + + + + + diff --git a/src/utils/router.ts b/src/utils/router.ts index d098402..49fbbf7 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -1,5 +1,5 @@ import router from '@/router/index' -import { isNavigationFailure, NavigationFailureType } from 'vue-router' +import { isNavigationFailure, NavigationFailureType ,useRouter} from 'vue-router' import type { RouteRecordRaw, RouteLocationRaw } from 'vue-router' import { ElNotification } from 'element-plus' import { useConfig } from '@/stores/config' @@ -8,8 +8,9 @@ import { closeShade } from '@/utils/pageShade' import { adminBaseRoute } from '@/router/static' import { compact, isEmpty, reverse } from 'lodash-es' import { isAdminApp } from '@/utils/common' -import { log } from 'console' - +import { getRouteMenu, dictDataCache } from '@/api/auth' +import { adminBaseRoutePath } from '@/router/static' +const route = useRouter() /** * 导航失败有错误消息的路由push * @param to — 导航位置,同 router.push @@ -17,7 +18,7 @@ import { log } from 'console' export const routePush = async (to: RouteLocationRaw) => { try { const failure = await router.push(to) - + if (isNavigationFailure(failure, NavigationFailureType.aborted)) { ElNotification({ message: 'utils.Navigation failed, navigation guard intercepted!', @@ -279,6 +280,41 @@ export const addRouteItem = ( } } +// 刷新菜单 +export const getMenu = () => { + getRouteMenu().then((res: any) => { + const handlerMenu = (data: any) => { + data.forEach((item: any) => { + item.routePath = + item.routePath[0] == '/' ? item.routePath.substring(1, item.routePath.length) : item.routePath + item.path = item.routePath + item.name = item.routePath + item.keepalive = item.routePath + item.component = item.routeName + ? item.routeName.indexOf('/src/views/') > -1 + ? item.routeName + : `/src/views/${item.routeName}/index.vue` + : '' + item.type = item.children && item.children.length > 0 ? 'menu_dir' : 'menu' + item.menu_type = item.children && item.children.length > 0 ? null : 'tab' + if (item.children) { + handlerMenu(item.children) + } + }) + } + handlerMenu(res.data) + handleAdminRoute(res.data) + if (route.params.to) { + const lastRoute = JSON.parse(route.params.to as string) + if (lastRoute.path != adminBaseRoutePath) { + let query = !isEmpty(lastRoute.query) ? lastRoute.query : {} + routePush({ path: lastRoute.path, query: query }) + return + } + } + }) +} + /** * 根据name字符串,获取父级name组合的数组 * @param name diff --git a/src/views/pqs/cockpit/homePage/components/routingConfig.vue b/src/views/pqs/cockpit/homePage/components/routingConfig.vue new file mode 100644 index 0000000..0de4b55 --- /dev/null +++ b/src/views/pqs/cockpit/homePage/components/routingConfig.vue @@ -0,0 +1,161 @@ + + + + + 新增 + + + + + + + + + + + + + + + + + + 编辑 + + 删除 + + + + + + + + + diff --git a/src/views/pqs/cockpit/homePage/index.vue b/src/views/pqs/cockpit/homePage/index.vue index 4f601b0..0ea237c 100644 --- a/src/views/pqs/cockpit/homePage/index.vue +++ b/src/views/pqs/cockpit/homePage/index.vue @@ -1,12 +1,17 @@ - + + + 编辑 + 设置 + + - - {{ item.name }} + + {{ (item as LayoutItem).name }} 组件加载失败... + +