Toggle navigation
Toggle navigation
This project
Loading...
Sign in
monitor_v3
/
hg-monitor-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
XuHaoJie
4 years ago
Commit
c4e651413de1e06f160e5c11e4d8c59e9f053f52
1 parent
95819ca1
通用-用户管理、角色管理-配置首页问题解决
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
8 deletions
hg-monitor-web-base/src/main/resources/static/src/controller/common.js
hg-monitor-web-base/src/main/resources/static/src/controller/roleIndex.js
hg-monitor-web-base/src/main/resources/static/src/controller/userIndex.js
hg-monitor-web-base/src/main/resources/static/src/controller/common.js
View file @
c4e6514
...
...
@@ -350,16 +350,20 @@ layui.define(['xmSelect', 'md5'], function (exports) {
}
});
},
menuXmSelect
:
function
(
xmSelectParams
,
done
)
{
menuXmSelect
:
function
(
xmSelectParams
,
done
,
username_
,
roleId_
)
{
var
username
=
username_
?
username_
:
''
;
var
roleId
=
roleId_
?
roleId_
:
''
;
admin
.
req
({
url
:
`
$
{
obj
.
domainName
}
/api-user/m
enus
/
findMenus
`
,
url
:
`
$
{
obj
.
domainName
}
/api-user/m
enus
/
findMenus
?
username
=
`
+
username
+
'&roleIds='
+
roleId
,
success
:
function
(
res
)
{
// 菜单下拉框
var
menuList
=
res
.
data
;
menuList
.
forEach
(
item
=>
{
item
.
disabled
=
item
.
isLeaf
!==
'Y'
;
});
// menuList.forEach(item => {
// item.disabled = item.isLeaf !== 'Y';
// });
var
menuTree
=
obj
.
pidToChildren
(
menuList
,
"id"
,
"parentId"
);
//XuHaoJie 2021/10/21 添加是否是父节点
addProperty
(
menuTree
);
var
menuSelect
=
xmSelect
.
render
(
Object
.
assign
({
el
:
'#'
,
tips
:
'=菜单='
,
...
...
@@ -392,6 +396,19 @@ layui.define(['xmSelect', 'md5'], function (exports) {
}
}
});
//添加是否是父节点的删除
function
addProperty
(
list
)
{
list
.
forEach
(
item
=>
{
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
item
[
'isParent'
]
=
1
;
addProperty
(
item
.
children
);
}
else
{
item
[
'isParent'
]
=
0
;
}
return
item
;
})
}
},
relationTypeXmSelect
:
function
(
xmSelectParams
,
done
)
{
admin
.
req
({
...
...
hg-monitor-web-base/src/main/resources/static/src/controller/roleIndex.js
View file @
c4e6514
...
...
@@ -110,7 +110,7 @@ layui.define(['table', 'form', 'laydate','treeTable', 'admin', 'layer', 'laytpl'
' <button role-data-menu="'
+
d
.
id
+
'" lay-tips="菜单授权" type="button" class="layui-btn layui-btn-xs layui-btn-normal delete-org-btn"><i class="layui-icon layui-icon-menu-fill"></i></button>'
+
// ' <button role-data-query-menus="'+d.id+'" role-data-name="'+d.name+'" lay-tips="角色菜单查看" type="button" class="layui-btn layui-btn-xs layui-btn-normal delete-org-btn"><i class="layui-icon layui-icon-search"></i></button>'+
' <button role-data-oneKey="'
+
d
.
id
+
'" lay-tips="'
+
tips
+
'" type="button" class="layui-btn layui-btn-xs layui-btn-normal delete-org-btn"><i class="layui-icon layui-icon-auz"></i></button>'
+
' <button data-code="'
+
d
.
code
+
'" lay-tips="配置默认首页" type="button" class="layui-btn layui-btn-xs layui-btn-normal config-default-index"><i class="layui-icon layui-icon-website"></i></button>'
+
' <button data-code="'
+
d
.
code
+
'"
data-id="'
+
d
.
id
+
'"
lay-tips="配置默认首页" type="button" class="layui-btn layui-btn-xs layui-btn-normal config-default-index"><i class="layui-icon layui-icon-website"></i></button>'
+
'</div>'
;
}}
]],
...
...
@@ -176,6 +176,7 @@ layui.define(['table', 'form', 'laydate','treeTable', 'admin', 'layer', 'laytpl'
// 配置默认首页
$
(
'.config-default-index'
).
unbind
(
'click'
).
on
(
'click'
,
function
()
{
var
roleCode
=
$
(
this
).
data
(
'code'
);
var
roleId
=
$
(
this
).
data
(
'id'
);
layer
.
load
(
2
);
admin
.
req
({
url
:
domainName
+
'/api-web/defaultIndex/getDefaultIndex'
,
...
...
@@ -231,8 +232,25 @@ layui.define(['table', 'form', 'laydate','treeTable', 'admin', 'layer', 'laytpl'
common
.
menuXmSelect
({
el
:
'#slt-menu-tree'
,
radio
:
true
,
prop
:
{
name
:
'name'
,
value
:
'id'
,
isParent
:
'isParent'
,
},
clickClose
:
true
,
on
(
data
)
{
//XuHaoJie 2021/10/21 添加是否是父节点
//arr: 当前多选已选中的数据
var
arr
=
data
.
arr
;
if
(
arr
&&
arr
.
length
>
0
)
{
if
(
arr
[
0
].
isParent
==
1
)
{
layer
.
msg
(
'父节点不能选'
,
{
icon
:
7
});
setTimeout
(
function
()
{
xmSelect
.
get
(
'#slt-menu-tree'
,
true
).
setValue
([]);
},
1000
);
return
false
;
}
}
if
(
data
.
arr
.
length
)
{
switch
(
data
.
arr
[
0
].
moduleid
)
{
case
'index-topo'
:
{
...
...
@@ -285,7 +303,7 @@ layui.define(['table', 'form', 'laydate','treeTable', 'admin', 'layer', 'laytpl'
}
},
function
(
select
)
{
select
.
setValue
([
defaultIndex
],
null
,
true
);
});
}
,
null
,
roleId
);
function
reSetForm
()
{
...
...
hg-monitor-web-base/src/main/resources/static/src/controller/userIndex.js
View file @
c4e6514
...
...
@@ -341,8 +341,25 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
common
.
menuXmSelect
({
el
:
'#slt-menu-tree'
,
radio
:
true
,
prop
:
{
name
:
'name'
,
value
:
'id'
,
isParent
:
'isParent'
,
},
clickClose
:
true
,
on
(
data
)
{
//XuHaoJie 2021/10/21 添加是否是父节点
//arr: 当前多选已选中的数据
var
arr
=
data
.
arr
;
if
(
arr
&&
arr
.
length
>
0
)
{
if
(
arr
[
0
].
isParent
==
1
)
{
layer
.
msg
(
'父节点不能选'
,
{
icon
:
7
});
setTimeout
(
function
()
{
xmSelect
.
get
(
'#slt-menu-tree'
,
true
).
setValue
([]);
},
1000
);
return
false
;
}
}
if
(
data
.
arr
.
length
)
{
switch
(
data
.
arr
[
0
].
moduleid
)
{
case
'index-topo'
:
{
...
...
@@ -395,7 +412,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
}
},
function
(
select
)
{
select
.
setValue
([
defaultIndex
],
null
,
true
);
});
}
,
username
);
function
reSetForm
()
{
...
...
Please
register
or
login
to post a comment