Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
6130bebb
"vscode:/vscode.git/clone" did not exist on "0523c246b205d2da6a69f7c90bef703f2e969067"
Commit
6130bebb
authored
Mar 06, 2022
by
RuoYi
Browse files
开启TopNav没有子菜单情况隐藏侧边栏
parent
9f944c04
Changes
27
Hide whitespace changes
Inline
Side-by-side
ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
View file @
6130bebb
<template>
<template>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
#
foreach
($
column
in
$
columns
)
#
foreach
($
column
in
$
columns
)
#
if
($
column
.
query
)
#
if
($
column
.
query
)
#
set
($
dictType
=
$
column
.
dictType
)
#
set
($
dictType
=
$
column
.
dictType
)
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
View file @
6130bebb
...
@@ -176,7 +176,7 @@ public class SysMenuServiceImpl implements ISysMenuService
...
@@ -176,7 +176,7 @@ public class SysMenuServiceImpl implements ISysMenuService
else
if
(
menu
.
getParentId
().
intValue
()
==
0
&&
isInnerLink
(
menu
))
else
if
(
menu
.
getParentId
().
intValue
()
==
0
&&
isInnerLink
(
menu
))
{
{
router
.
setMeta
(
new
MetaVo
(
menu
.
getMenuName
(),
menu
.
getIcon
()));
router
.
setMeta
(
new
MetaVo
(
menu
.
getMenuName
(),
menu
.
getIcon
()));
router
.
setPath
(
"/
inner
"
);
router
.
setPath
(
"/"
);
List
<
RouterVo
>
childrenList
=
new
ArrayList
<
RouterVo
>();
List
<
RouterVo
>
childrenList
=
new
ArrayList
<
RouterVo
>();
RouterVo
children
=
new
RouterVo
();
RouterVo
children
=
new
RouterVo
();
String
routerPath
=
innerLinkReplaceEach
(
menu
.
getPath
());
String
routerPath
=
innerLinkReplaceEach
(
menu
.
getPath
());
...
...
ruoyi-ui/src/assets/styles/sidebar.scss
View file @
6130bebb
...
@@ -7,6 +7,10 @@
...
@@ -7,6 +7,10 @@
position
:
relative
;
position
:
relative
;
}
}
.sidebarHide
{
margin-left
:
0
!
important
;
}
.sidebar-container
{
.sidebar-container
{
-webkit-transition
:
width
.28s
;
-webkit-transition
:
width
.28s
;
transition
:
width
0
.28s
;
transition
:
width
0
.28s
;
...
...
ruoyi-ui/src/components/TopNav/index.vue
View file @
6130bebb
...
@@ -71,7 +71,7 @@ export default {
...
@@ -71,7 +71,7 @@ export default {
for
(
var
item
in
router
.
children
)
{
for
(
var
item
in
router
.
children
)
{
if
(
router
.
children
[
item
].
parentPath
===
undefined
)
{
if
(
router
.
children
[
item
].
parentPath
===
undefined
)
{
if
(
router
.
path
===
"
/
"
)
{
if
(
router
.
path
===
"
/
"
)
{
router
.
children
[
item
].
path
=
"
/
redirect/
"
+
router
.
children
[
item
].
path
;
router
.
children
[
item
].
path
=
"
/
"
+
router
.
children
[
item
].
path
;
}
else
{
}
else
{
if
(
!
this
.
ishttp
(
router
.
children
[
item
].
path
))
{
if
(
!
this
.
ishttp
(
router
.
children
[
item
].
path
))
{
router
.
children
[
item
].
path
=
router
.
path
+
"
/
"
+
router
.
children
[
item
].
path
;
router
.
children
[
item
].
path
=
router
.
path
+
"
/
"
+
router
.
children
[
item
].
path
;
...
@@ -87,22 +87,23 @@ export default {
...
@@ -87,22 +87,23 @@ export default {
// 默认激活的菜单
// 默认激活的菜单
activeMenu
()
{
activeMenu
()
{
const
path
=
this
.
$route
.
path
;
const
path
=
this
.
$route
.
path
;
let
activePath
=
th
is
.
defaultRouter
()
;
let
activePath
=
pa
th
;
if
(
path
.
lastIndexOf
(
"
/
"
)
>
0
)
{
if
(
path
.
lastIndexOf
(
"
/
"
)
>
0
)
{
const
tmpPath
=
path
.
substring
(
1
,
path
.
length
);
const
tmpPath
=
path
.
substring
(
1
,
path
.
length
);
activePath
=
"
/
"
+
tmpPath
.
substring
(
0
,
tmpPath
.
indexOf
(
"
/
"
));
activePath
=
"
/
"
+
tmpPath
.
substring
(
0
,
tmpPath
.
indexOf
(
"
/
"
));
this
.
$store
.
dispatch
(
'
app/toggleSideBarHide
'
,
false
);
}
else
if
(
"
/index
"
==
path
||
""
==
path
)
{
}
else
if
(
"
/index
"
==
path
||
""
==
path
)
{
if
(
!
this
.
isFrist
)
{
if
(
!
this
.
isFrist
)
{
this
.
isFrist
=
true
;
this
.
isFrist
=
true
;
}
else
{
}
else
{
activePath
=
"
index
"
;
activePath
=
"
index
"
;
}
}
this
.
$store
.
dispatch
(
'
app/toggleSideBarHide
'
,
true
);
}
else
if
(
!
this
.
$route
.
children
)
{
activePath
=
path
;
this
.
$store
.
dispatch
(
'
app/toggleSideBarHide
'
,
true
);
}
}
var
routes
=
this
.
activeRoutes
(
activePath
);
this
.
activeRoutes
(
activePath
);
if
(
routes
.
length
===
0
)
{
activePath
=
this
.
currentIndex
||
this
.
defaultRouter
()
this
.
activeRoutes
(
activePath
);
}
return
activePath
;
return
activePath
;
},
},
},
},
...
@@ -121,29 +122,21 @@ export default {
...
@@ -121,29 +122,21 @@ export default {
const
width
=
document
.
body
.
getBoundingClientRect
().
width
/
3
;
const
width
=
document
.
body
.
getBoundingClientRect
().
width
/
3
;
this
.
visibleNumber
=
parseInt
(
width
/
85
);
this
.
visibleNumber
=
parseInt
(
width
/
85
);
},
},
// 默认激活的路由
defaultRouter
()
{
let
router
;
Object
.
keys
(
this
.
routers
).
some
((
key
)
=>
{
if
(
!
this
.
routers
[
key
].
hidden
)
{
router
=
this
.
routers
[
key
].
path
;
return
true
;
}
});
return
router
;
},
// 菜单选择事件
// 菜单选择事件
handleSelect
(
key
,
keyPath
)
{
handleSelect
(
key
,
keyPath
)
{
this
.
currentIndex
=
key
;
this
.
currentIndex
=
key
;
const
route
=
this
.
routers
.
find
(
item
=>
item
.
path
===
key
);
if
(
this
.
ishttp
(
key
))
{
if
(
this
.
ishttp
(
key
))
{
// http(s):// 路径新窗口打开
// http(s):// 路径新窗口打开
window
.
open
(
key
,
"
_blank
"
);
window
.
open
(
key
,
"
_blank
"
);
}
else
if
(
key
.
indexOf
(
"
/redirect
"
)
!==
-
1
)
{
}
else
if
(
!
route
||
!
route
.
children
)
{
// /redirect 路径内部打开
// 没有子路由路径内部打开
this
.
$router
.
push
({
path
:
key
.
replace
(
"
/redirect
"
,
""
)
});
this
.
$router
.
push
({
path
:
key
});
this
.
$store
.
dispatch
(
'
app/toggleSideBarHide
'
,
true
);
}
else
{
}
else
{
// 显示左侧联动菜单
// 显示左侧联动菜单
this
.
activeRoutes
(
key
);
this
.
activeRoutes
(
key
);
this
.
$store
.
dispatch
(
'
app/toggleSideBarHide
'
,
false
);
}
}
},
},
// 当前激活的路由
// 当前激活的路由
...
@@ -159,9 +152,8 @@ export default {
...
@@ -159,9 +152,8 @@ export default {
if
(
routes
.
length
>
0
)
{
if
(
routes
.
length
>
0
)
{
this
.
$store
.
commit
(
"
SET_SIDEBAR_ROUTERS
"
,
routes
);
this
.
$store
.
commit
(
"
SET_SIDEBAR_ROUTERS
"
,
routes
);
}
}
return
routes
;
},
},
ishttp
(
url
)
{
ishttp
(
url
)
{
return
url
.
indexOf
(
'
http://
'
)
!==
-
1
||
url
.
indexOf
(
'
https://
'
)
!==
-
1
return
url
.
indexOf
(
'
http://
'
)
!==
-
1
||
url
.
indexOf
(
'
https://
'
)
!==
-
1
}
}
},
},
...
...
ruoyi-ui/src/layout/components/Settings/index.vue
View file @
6130bebb
...
@@ -108,6 +108,7 @@ export default {
...
@@ -108,6 +108,7 @@ export default {
value
:
val
value
:
val
})
})
if
(
!
val
)
{
if
(
!
val
)
{
this
.
$store
.
dispatch
(
'
app/toggleSideBarHide
'
,
false
);
this
.
$store
.
commit
(
"
SET_SIDEBAR_ROUTERS
"
,
this
.
$store
.
state
.
permission
.
defaultRoutes
);
this
.
$store
.
commit
(
"
SET_SIDEBAR_ROUTERS
"
,
this
.
$store
.
state
.
permission
.
defaultRoutes
);
}
}
}
}
...
...
ruoyi-ui/src/layout/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
:class=
"classObj"
class=
"app-wrapper"
:style=
"
{'--current-color': theme}">
<div
:class=
"classObj"
class=
"app-wrapper"
:style=
"
{'--current-color': theme}">
<div
v-if=
"device==='mobile'&&sidebar.opened"
class=
"drawer-bg"
@
click=
"handleClickOutside"
/>
<div
v-if=
"device==='mobile'&&sidebar.opened"
class=
"drawer-bg"
@
click=
"handleClickOutside"
/>
<sidebar
class=
"sidebar-container"
/>
<sidebar
v-if=
"!sidebar.hide"
class=
"sidebar-container"
/>
<div
:class=
"
{hasTagsView:needTagsView}" class="main-container">
<div
:class=
"
{hasTagsView:needTagsView
,sidebarHide:sidebar.hide
}" class="main-container">
<div
:class=
"
{'fixed-header':fixedHeader}">
<div
:class=
"
{'fixed-header':fixedHeader}">
<navbar
/>
<navbar
/>
<tags-view
v-if=
"needTagsView"
/>
<tags-view
v-if=
"needTagsView"
/>
...
...
ruoyi-ui/src/router/index.js
View file @
6130bebb
...
@@ -164,6 +164,12 @@ export const dynamicRoutes = [
...
@@ -164,6 +164,12 @@ export const dynamicRoutes = [
}
}
]
]
// 防止连续点击多次路由报错
let
routerPush
=
Router
.
prototype
.
push
;
Router
.
prototype
.
push
=
function
push
(
location
)
{
return
routerPush
.
call
(
this
,
location
).
catch
(
err
=>
err
)
}
export
default
new
Router
({
export
default
new
Router
({
mode
:
'
history
'
,
// 去掉url中的#
mode
:
'
history
'
,
// 去掉url中的#
scrollBehavior
:
()
=>
({
y
:
0
}),
scrollBehavior
:
()
=>
({
y
:
0
}),
...
...
ruoyi-ui/src/store/modules/app.js
View file @
6130bebb
...
@@ -3,7 +3,8 @@ import Cookies from 'js-cookie'
...
@@ -3,7 +3,8 @@ import Cookies from 'js-cookie'
const
state
=
{
const
state
=
{
sidebar
:
{
sidebar
:
{
opened
:
Cookies
.
get
(
'
sidebarStatus
'
)
?
!!+
Cookies
.
get
(
'
sidebarStatus
'
)
:
true
,
opened
:
Cookies
.
get
(
'
sidebarStatus
'
)
?
!!+
Cookies
.
get
(
'
sidebarStatus
'
)
:
true
,
withoutAnimation
:
false
withoutAnimation
:
false
,
hide
:
false
},
},
device
:
'
desktop
'
,
device
:
'
desktop
'
,
size
:
Cookies
.
get
(
'
size
'
)
||
'
medium
'
size
:
Cookies
.
get
(
'
size
'
)
||
'
medium
'
...
@@ -30,6 +31,9 @@ const mutations = {
...
@@ -30,6 +31,9 @@ const mutations = {
SET_SIZE
:
(
state
,
size
)
=>
{
SET_SIZE
:
(
state
,
size
)
=>
{
state
.
size
=
size
state
.
size
=
size
Cookies
.
set
(
'
size
'
,
size
)
Cookies
.
set
(
'
size
'
,
size
)
},
SET_SIDEBAR_HIDE
:
(
state
,
status
)
=>
{
state
.
sidebar
.
hide
=
status
}
}
}
}
...
@@ -45,6 +49,9 @@ const actions = {
...
@@ -45,6 +49,9 @@ const actions = {
},
},
setSize
({
commit
},
size
)
{
setSize
({
commit
},
size
)
{
commit
(
'
SET_SIZE
'
,
size
)
commit
(
'
SET_SIZE
'
,
size
)
},
toggleSideBarHide
({
commit
},
status
)
{
commit
(
'
SET_SIDEBAR_HIDE
'
,
status
)
}
}
}
}
...
...
ruoyi-ui/src/store/modules/permission.js
View file @
6130bebb
...
@@ -22,12 +22,7 @@ const permission = {
...
@@ -22,12 +22,7 @@ const permission = {
state
.
defaultRoutes
=
constantRoutes
.
concat
(
routes
)
state
.
defaultRoutes
=
constantRoutes
.
concat
(
routes
)
},
},
SET_TOPBAR_ROUTES
:
(
state
,
routes
)
=>
{
SET_TOPBAR_ROUTES
:
(
state
,
routes
)
=>
{
// 顶部导航菜单默认添加统计报表栏指向首页
state
.
topbarRouters
=
routes
const
index
=
[{
path
:
'
index
'
,
meta
:
{
title
:
'
统计报表
'
,
icon
:
'
dashboard
'
}
}]
state
.
topbarRouters
=
routes
.
concat
(
index
);
},
},
SET_SIDEBAR_ROUTERS
:
(
state
,
routes
)
=>
{
SET_SIDEBAR_ROUTERS
:
(
state
,
routes
)
=>
{
state
.
sidebarRouters
=
routes
state
.
sidebarRouters
=
routes
...
...
ruoyi-ui/src/views/monitor/job/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"任务名称"
prop=
"jobName"
>
<el-form-item
label=
"任务名称"
prop=
"jobName"
>
<el-input
<el-input
v-model=
"queryParams.jobName"
v-model=
"queryParams.jobName"
...
...
ruoyi-ui/src/views/monitor/job/log.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"任务名称"
prop=
"jobName"
>
<el-form-item
label=
"任务名称"
prop=
"jobName"
>
<el-input
<el-input
v-model=
"queryParams.jobName"
v-model=
"queryParams.jobName"
...
...
ruoyi-ui/src/views/monitor/logininfor/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"登录地址"
prop=
"ipaddr"
>
<el-form-item
label=
"登录地址"
prop=
"ipaddr"
>
<el-input
<el-input
v-model=
"queryParams.ipaddr"
v-model=
"queryParams.ipaddr"
...
...
ruoyi-ui/src/views/monitor/online/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"登录地址"
prop=
"ipaddr"
>
<el-form-item
label=
"登录地址"
prop=
"ipaddr"
>
<el-input
<el-input
v-model=
"queryParams.ipaddr"
v-model=
"queryParams.ipaddr"
...
...
ruoyi-ui/src/views/monitor/operlog/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"系统模块"
prop=
"title"
>
<el-form-item
label=
"系统模块"
prop=
"title"
>
<el-input
<el-input
v-model=
"queryParams.title"
v-model=
"queryParams.title"
...
...
ruoyi-ui/src/views/system/config/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"参数名称"
prop=
"configName"
>
<el-form-item
label=
"参数名称"
prop=
"configName"
>
<el-input
<el-input
v-model=
"queryParams.configName"
v-model=
"queryParams.configName"
...
...
ruoyi-ui/src/views/system/dept/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
>
<el-form-item
label=
"部门名称"
prop=
"deptName"
>
<el-form-item
label=
"部门名称"
prop=
"deptName"
>
<el-input
<el-input
v-model=
"queryParams.deptName"
v-model=
"queryParams.deptName"
...
...
ruoyi-ui/src/views/system/dict/data.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"字典名称"
prop=
"dictType"
>
<el-form-item
label=
"字典名称"
prop=
"dictType"
>
<el-select
v-model=
"queryParams.dictType"
>
<el-select
v-model=
"queryParams.dictType"
>
<el-option
<el-option
...
...
ruoyi-ui/src/views/system/dict/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"字典名称"
prop=
"dictName"
>
<el-form-item
label=
"字典名称"
prop=
"dictName"
>
<el-input
<el-input
v-model=
"queryParams.dictName"
v-model=
"queryParams.dictName"
...
...
ruoyi-ui/src/views/system/menu/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
>
<el-form-item
label=
"菜单名称"
prop=
"menuName"
>
<el-form-item
label=
"菜单名称"
prop=
"menuName"
>
<el-input
<el-input
v-model=
"queryParams.menuName"
v-model=
"queryParams.menuName"
...
...
ruoyi-ui/src/views/system/notice/index.vue
View file @
6130bebb
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:
inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"公告标题"
prop=
"noticeTitle"
>
<el-form-item
label=
"公告标题"
prop=
"noticeTitle"
>
<el-input
<el-input
v-model=
"queryParams.noticeTitle"
v-model=
"queryParams.noticeTitle"
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment