From d9f67af30b9b98d89fb17ad47a220c4466f23d96 Mon Sep 17 00:00:00 2001
From: XieYongHong <18010623010@163.com>
Date: Fri, 21 Jul 2023 18:49:10 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=8F=9C=E5=8D=95?=
=?UTF-8?q?=E8=B7=B3=E8=BD=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/App.vue | 5 -
src/components/Layout/BasicLayoutPage.vue | 124 ++---
src/components/Layout/BlankLayoutPage.vue | 20 +-
src/store/menu.ts | 39 +-
src/store/permission.ts | 13 +
src/store/system.ts | 12 +
src/utils/menu.ts | 486 ++++++++++++------
src/views/device/Instance/Detail/index.vue | 2 +-
.../device/components/Metadata/Base/Base.vue | 41 +-
9 files changed, 454 insertions(+), 288 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index c1c758c3..8c6581c2 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,10 +1,5 @@
-
-
-
-
-
diff --git a/src/components/Layout/BasicLayoutPage.vue b/src/components/Layout/BasicLayoutPage.vue
index 8f97ad37..6e5a0ae7 100644
--- a/src/components/Layout/BasicLayoutPage.vue
+++ b/src/components/Layout/BasicLayoutPage.vue
@@ -1,12 +1,12 @@
@@ -25,9 +25,9 @@
-
-
-
+
+
+
@@ -54,14 +54,14 @@ const route = useRoute();
const menu = useMenuStore();
const system = useSystem();
-const {configInfo,layout} = storeToRefs(system);
+const {configInfo,layout, basicLayout} = storeToRefs(system);
const layoutConf = reactive({
theme: DefaultSetting.layout.theme,
siderWidth: layout.value.siderWidth,
logo: DefaultSetting.layout.logo,
title: DefaultSetting.layout.title,
- menuData: [...clearMenuItem(menu.siderMenus), AccountMenu],
+ menuData: [...menu.siderMenus, AccountMenu],
// menuData: menu.siderMenus,
splitMenus: true,
});
@@ -72,87 +72,51 @@ watchEffect(() => {
layoutConf.logo = configInfo.value.front?.logo || DefaultSetting.layout.logo;
})
-const state = reactive({
- pure: false,
- collapsed: false, // default value
- openKeys: [],
- selectedKeys: [],
-});
+const components = computed(() => {
+ const componentName = route.matched[route.matched.length - 1]?.components?.default?.name
+ if (componentName !== 'BasicLayoutPage') {
+ return route.matched[route.matched.length - 1]?.components?.default
+ }
+ return undefined
+})
+
+/**
+ * 面包屑
+ */
+const breadcrumbs = computed(() =>
+ {
+ const paths = router.currentRoute.value.matched
+
+ return paths.map((item, index) => {
+ return {
+ index,
+ isLast: index === (paths.length -1),
+ path: item.path,
+ breadcrumbName: (item.meta as any).title || '',
+ }
+ })
+ }
+);
const routerBack = () => {
router.go(-1)
}
-const findRouteMeta = (code: string) => {
- let meta = []
- let menuItem: any = menu.menus[code]
- while (menuItem) {
- meta.unshift(menuItem)
- if (menuItem.parentName) {
- menuItem = menu.menus[menuItem.parentName]
- } else {
- menuItem = false
- }
- }
- return meta
-}
const jump = (item: any) => {
- let path = history.state.back
- if (path) {
- // 包含query参数,清除?参数
- if (path.includes('?')) {
- const _path = path.split('?')[0]
- path = _path === item.path ? path : item.path
- } else if (path !== item.path) {
- path = item.path
- }
- } else {
- path = item.path
- }
-
- // jumpPage(slotProps.route.path)
- router.push(path)
+ router.push(item.path)
}
-const breadcrumb = computed(() =>
- {
- const paths = router.currentRoute.value.name as string
- const metas = findRouteMeta(paths)
- return metas.map((item, index) => {
- return {
- index,
- isLast: index === (metas.length - 1),
- path: item.path,
- breadcrumbName: item.title || '',
- };
- })
+
+watchEffect(() => {
+ if (router.currentRoute) {
+ const paths = router.currentRoute.value.matched
+ basicLayout.value.selectedKeys = paths.map(item => item.path)
+ basicLayout.value.openKeys = paths.map(item => item.path)
+ console.log(paths) //
}
-);
-
-watchEffect(() => {
- if (router.currentRoute) {
- const paths = router.currentRoute.value.name as string
- if (paths) {
- const _metas = findRouteMeta(paths)
- state.selectedKeys = _metas.map(item => item.path)
- state.openKeys = _metas.filter((r) => r !== router.currentRoute.value.path).map(item => item.path)
- }
- }
-});
-
-watchEffect(() => {
- if (
- route.query &&
- 'layout' in route.query &&
- route.query.layout === 'false'
- ) {
- state.pure = true;
- } else {
- state.pure = false;
- }
-});
+})
const toDoc = () => window.open('http://doc.v2.jetlinks.cn/');
diff --git a/src/components/Layout/BlankLayoutPage.vue b/src/components/Layout/BlankLayoutPage.vue
index 69d6fa16..72b16120 100644
--- a/src/components/Layout/BlankLayoutPage.vue
+++ b/src/components/Layout/BlankLayoutPage.vue
@@ -1,11 +1,21 @@
-
+
+
+
-