diff --git a/data/magic-api/api/系统管理/菜单管理/当前用户菜单.ms b/data/magic-api/api/系统管理/菜单管理/当前用户菜单.ms index ade434b..a371f58 100644 --- a/data/magic-api/api/系统管理/菜单管理/当前用户菜单.ms +++ b/data/magic-api/api/系统管理/菜单管理/当前用户菜单.ms @@ -5,7 +5,7 @@ "groupId" : "67b2ce258e24491194b74992958c74aa", "name" : "当前用户菜单", "createTime" : null, - "updateTime" : 1656340766427, + "updateTime" : 1656390120715, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -564,7 +564,8 @@ var menus = db.select(""" sm.sort, sm.icon, sm.keep_alive, - sm.component_name + sm.component_name, + sm.open_mode from sys_menu sm where 1=1 ?{userId != '1', and sm.id in ( diff --git a/data/magic-api/api/系统管理/菜单管理/获取菜单tree.ms b/data/magic-api/api/系统管理/菜单管理/获取菜单tree.ms index e80fc66..84a2c53 100644 --- a/data/magic-api/api/系统管理/菜单管理/获取菜单tree.ms +++ b/data/magic-api/api/系统管理/菜单管理/获取菜单tree.ms @@ -5,7 +5,7 @@ "groupId" : "67b2ce258e24491194b74992958c74aa", "name" : "获取菜单tree", "createTime" : null, - "updateTime" : 1648014003694, + "updateTime" : 1656386304094, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -119,7 +119,7 @@ } ================================ var toTree = (list,pid) => select t.*,toTree(list,t.id) children from list t where t.pid = pid -var list = toTree(db.select('select id,name,pid,is_show,url,sort,permission,desc_ribe,icon,keep_alive,component_name from sys_menu where is_del = 0 order by sort'),'0') +var list = toTree(db.select('select id,name,pid,is_show,url,sort,permission,desc_ribe,icon,keep_alive,component_name,open_mode from sys_menu where is_del = 0 order by sort'),'0') return { list: list, diff --git a/db/magic-boot.sql b/db/magic-boot.sql index 41648b2..150de92 100644 --- a/db/magic-boot.sql +++ b/db/magic-boot.sql @@ -198,6 +198,7 @@ CREATE TABLE `sys_menu` ( `permission` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '权限', `sort` int(12) DEFAULT NULL COMMENT '排序', `component_name` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '组件名称', + `open_mode` char(1) COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT '打开方式,0:iframe 1:新标签页', `is_del` int(1) DEFAULT '0' COMMENT '是否删除:0未删除,1已删除', `create_by` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人', `create_date` datetime DEFAULT NULL COMMENT '创建时间', diff --git a/magic-boot-ui/src/scripts/router.js b/magic-boot-ui/src/scripts/router.js index d6dc264..2379166 100644 --- a/magic-boot-ui/src/scripts/router.js +++ b/magic-boot-ui/src/scripts/router.js @@ -21,9 +21,9 @@ const routes = [ redirect: '/home', children: [ { - name: '首页', path: '/home', - component: () => import('@/views/home.vue') + component: () => import('@/views/home.vue'), + meta: { title: '首页' } } ] }, @@ -35,7 +35,6 @@ const routes = [ hidden: true, children: [{ path: '/system/user/user-center', - name: '个人中心', component: () => import('@/views/system/user/user-center'), meta: { title: '个人中心' } }] diff --git a/magic-boot-ui/src/scripts/routerPermission.js b/magic-boot-ui/src/scripts/routerPermission.js index e7f5098..c1de86d 100644 --- a/magic-boot-ui/src/scripts/routerPermission.js +++ b/magic-boot-ui/src/scripts/routerPermission.js @@ -8,7 +8,22 @@ export const filterAsyncRouter = (routers, level) => { level = level || 0 const accessedRouters = routers.filter(router => { if (router.isShow === 1) { - if (router.componentName) { + var setIframe = () => { + router.component = loadView(`/common/iframe`) + router.props = { url: router.url } + router.path = "/" + common.uuid() + } + if(router.url.startsWith('http')){ + if(router.openMode == '0'){ + setIframe() + } + } else if(router.url.startsWith('/') && router.url.indexOf('.htm') != -1) { + if(router.openMode == '0'){ + setIframe() + }else{ + router.path = location.href.substring(0, location.href.indexOf('/', location.href.indexOf('/', location.href.indexOf('/') + 1) + 1)) + router.path + } + } else if (router.componentName) { router.component = loadView(`/common/show-component`) router.props = { name: router.componentName } } else if (router.component) { diff --git a/magic-boot-ui/src/views/common/iframe.vue b/magic-boot-ui/src/views/common/iframe.vue new file mode 100644 index 0000000..6ad513f --- /dev/null +++ b/magic-boot-ui/src/views/common/iframe.vue @@ -0,0 +1,23 @@ + + + + + + diff --git a/magic-boot-ui/src/views/system/menu/menu-form.vue b/magic-boot-ui/src/views/system/menu/menu-form.vue index 3a9be80..1aa5f0b 100644 --- a/magic-boot-ui/src/views/system/menu/menu-form.vue +++ b/magic-boot-ui/src/views/system/menu/menu-form.vue @@ -5,7 +5,7 @@