Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doc_wei
Skyeye
提交
0755a3d7
S
Skyeye
项目概览
doc_wei
/
Skyeye
通知
1195
Star
154
Fork
127
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Skyeye
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0755a3d7
编写于
8月 30, 2018
作者:
doc_wei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
树插件更新,添加角色加载树完成
上级
b14382d1
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
157 addition
and
145 deletion
+157
-145
skyeye-dao/src/main/java/com/skyeye/authority/dao/SysEveRoleDao.java
...src/main/java/com/skyeye/authority/dao/SysEveRoleDao.java
+2
-0
skyeye-service/src/main/java/com/skyeye/authority/service/SysEveRoleService.java
.../java/com/skyeye/authority/service/SysEveRoleService.java
+2
-0
skyeye-service/src/main/java/com/skyeye/authority/service/impl/SysEveRoleServiceImpl.java
.../skyeye/authority/service/impl/SysEveRoleServiceImpl.java
+21
-0
skyeye-web/src/main/java/com/skyeye/authority/controller/SysEveRoleController.java
...com/skyeye/authority/controller/SysEveRoleController.java
+16
-0
skyeye-web/src/main/resources/dbmapper/SysEveMenuMapper.xml
skyeye-web/src/main/resources/dbmapper/SysEveMenuMapper.xml
+2
-1
skyeye-web/src/main/resources/dbmapper/SysEveRoleMapper.xml
skyeye-web/src/main/resources/dbmapper/SysEveRoleMapper.xml
+11
-0
skyeye-web/src/main/resources/mapping/reqmapping.xml
skyeye-web/src/main/resources/mapping/reqmapping.xml
+2
-0
skyeye-web/src/main/webapp/assets/lib/layui/lay/modules/ztree/js/fsCommon.js
.../webapp/assets/lib/layui/lay/modules/ztree/js/fsCommon.js
+0
-1
skyeye-web/src/main/webapp/assets/lib/layui/lay/modules/ztree/js/fsTree.js
...in/webapp/assets/lib/layui/lay/modules/ztree/js/fsTree.js
+25
-4
skyeye-web/src/main/webapp/js/sysevemenu/sysevemenulist.js
skyeye-web/src/main/webapp/js/sysevemenu/sysevemenulist.js
+1
-24
skyeye-web/src/main/webapp/js/syseverole/syseveroleadd.js
skyeye-web/src/main/webapp/js/syseverole/syseveroleadd.js
+69
-114
skyeye-web/src/main/webapp/tpl/syseverole/syseveroleadd.html
skyeye-web/src/main/webapp/tpl/syseverole/syseveroleadd.html
+6
-1
未找到文件。
skyeye-dao/src/main/java/com/skyeye/authority/dao/SysEveRoleDao.java
浏览文件 @
0755a3d7
...
...
@@ -9,4 +9,6 @@ public interface SysEveRoleDao {
public
List
<
Map
<
String
,
Object
>>
querySysRoleList
(
Map
<
String
,
Object
>
map
,
PageBounds
pageBounds
)
throws
Exception
;
public
List
<
Map
<
String
,
Object
>>
querySysRoleBandMenuList
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
}
skyeye-service/src/main/java/com/skyeye/authority/service/SysEveRoleService.java
浏览文件 @
0755a3d7
...
...
@@ -7,4 +7,6 @@ public interface SysEveRoleService {
public
void
querySysRoleList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
public
void
querySysRoleBandMenuList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
}
skyeye-service/src/main/java/com/skyeye/authority/service/impl/SysEveRoleServiceImpl.java
浏览文件 @
0755a3d7
...
...
@@ -39,5 +39,26 @@ public class SysEveRoleServiceImpl implements SysEveRoleService{
outputObject
.
setBeans
(
beans
);
outputObject
.
settotal
(
total
);
}
/**
*
* @Title: querySysRoleBandMenuList
* @Description: 获取角色需要绑定的菜单列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public
void
querySysRoleBandMenuList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
List
<
Map
<
String
,
Object
>>
beans
=
sysEveRoleDao
.
querySysRoleBandMenuList
(
map
);
for
(
Map
<
String
,
Object
>
bean
:
beans
){
String
[]
str
=
bean
.
get
(
"pId"
).
toString
().
split
(
","
);
bean
.
put
(
"pId"
,
str
[
str
.
length
-
1
]);
}
outputObject
.
setBeans
(
beans
);
}
}
skyeye-web/src/main/java/com/skyeye/authority/controller/SysEveRoleController.java
浏览文件 @
0755a3d7
...
...
@@ -31,4 +31,20 @@ public class SysEveRoleController {
sysEveRoleService
.
querySysRoleList
(
inputObject
,
outputObject
);
}
/**
*
* @Title: querySysRoleBandMenuList
* @Description: 获取角色需要绑定的菜单列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping
(
"/post/SysEveRoleController/querySysRoleBandMenuList"
)
@ResponseBody
public
void
querySysRoleBandMenuList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
sysEveRoleService
.
querySysRoleBandMenuList
(
inputObject
,
outputObject
);
}
}
skyeye-web/src/main/resources/dbmapper/SysEveMenuMapper.xml
浏览文件 @
0755a3d7
...
...
@@ -128,7 +128,8 @@
SELECT
a.id,
a.menu_name name,
a.menu_parent_id pId
a.menu_parent_id pId,
'true' isParent
FROM
sys_eve_menu a
<if
test=
"parentId != "0""
>
...
...
skyeye-web/src/main/resources/dbmapper/SysEveRoleMapper.xml
浏览文件 @
0755a3d7
...
...
@@ -21,4 +21,15 @@
ORDER BY a.create_time DESC
</select>
<select
id=
"querySysRoleBandMenuList"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
a.id,
a.menu_name name,
a.menu_parent_id pId,
'true' isParent,
(a.menu_level + 1) type
FROM
sys_eve_menu a
</select>
</mapper>
\ No newline at end of file
skyeye-web/src/main/resources/mapping/reqmapping.xml
浏览文件 @
0755a3d7
...
...
@@ -75,5 +75,7 @@
<property
id=
"page"
name=
"page"
ref=
"required"
var=
"分页参数,第几页"
/>
<property
id=
"roleName"
name=
"roleName"
ref=
""
var=
"角色名称"
/>
</url>
<url
id=
"sys014"
path=
"/post/SysEveRoleController/querySysRoleBandMenuList"
val=
"获取角色需要绑定的菜单列表"
>
</url>
</controller>
\ No newline at end of file
skyeye-web/src/main/webapp/assets/lib/layui/lay/modules/ztree/js/fsCommon.js
浏览文件 @
0755a3d7
layui
.
define
([
'
layer
'
,
'
form
'
,
'
fsButtonCommon
'
],
function
(
exports
)
{
var
form
=
layui
.
form
,
layer
=
layui
.
layer
,
fsButtonCommon
=
layui
.
fsButtonCommon
;
...
...
skyeye-web/src/main/webapp/assets/lib/layui/lay/modules/ztree/js/fsTree.js
浏览文件 @
0755a3d7
...
...
@@ -7,9 +7,12 @@ layui.define(['layer', "fsCommon"], function(exports) {
funcNo
:
undefined
,
//功能号
url
:
undefined
,
//请求url地址
id
:
""
,
isRoot
:
true
,
//是否显示
更
目录,默认显示
isRoot
:
true
,
//是否显示
根
目录,默认显示
clickCallback
:
undefined
,
//点击回调函数
onDblClick
:
undefined
,
//双击之后的回调函数
enable
:
true
,
//异步还是同步加载,默认同步
checkEnable
:
false
,
//是否显示复选框,默认为否
loadEnable
:
true
,
//数据是否异步加载,默认为是
}
};
...
...
@@ -129,15 +132,34 @@ layui.define(['layer', "fsCommon"], function(exports) {
data
:
{
key
:
{
name
:
_this
.
config
.
treeName
,
isParent
:
true
},
simpleData
:
{
enable
:
tru
e
,
enable
:
_this
.
config
.
enabl
e
,
idKey
:
_this
.
config
.
treeIdKey
,
pIdKey
:
_this
.
config
.
treePIdKey
,
rootPId
:
0
}
},
async
:
{
//异步加载
type
:
"
get
"
,
enable
:
_this
.
config
.
loadEnable
,
url
:
reqBasePath
+
_this
.
config
.
url
,
autoParam
:
[
"
id=parentId
"
],
//异步加载时需要自动提交父节点属性的参数
dataType
:
"
json
"
,
dataFilter
:
function
(
treeId
,
treeNode
,
responseData
)
{
if
(
responseData
.
rows
.
length
>
0
)
{
$
.
fn
.
zTree
.
getZTreeObj
(
treeId
).
addNodes
(
treeNode
,
responseData
.
rows
);
}
},
},
check
:
{
enable
:
_this
.
config
.
checkEnable
,
chkStyle
:
"
checkbox
"
,
//复选框
chkboxType
:
{
"
Y
"
:
"
ps
"
,
"
N
"
:
"
ps
"
}
},
edit
:
edit
,
callback
:
{
onClick
:
_this
.
config
.
clickCallback
,
...
...
@@ -177,7 +199,6 @@ layui.define(['layer', "fsCommon"], function(exports) {
setting
[
"
edit
"
]
=
edit
;
}
$
.
fn
.
zTree
.
init
(
$
(
"
#
"
+
_this
.
config
.
id
),
setting
,
data
);
};
...
...
skyeye-web/src/main/webapp/js/sysevemenu/sysevemenulist.js
浏览文件 @
0755a3d7
...
...
@@ -155,35 +155,12 @@ layui.config({
//异步加载的方法
function
onClickTree
(
event
,
treeId
,
treeNode
)
{
var
url
=
reqBasePath
+
"
sys012?parentId=
"
;
if
(
treeNode
==
undefined
)
{
url
+=
"
0
"
;
//默认ID是1.
parentId
=
""
;
}
else
{
url
+=
treeNode
.
id
;
//动态获取选中节点的ID
parentId
=
treeNode
.
id
;
}
AjaxPostUtil
.
request
({
url
:
url
,
params
:
""
,
type
:
'
json
'
,
callback
:
function
(
jsonData
){
if
(
jsonData
.
returnCode
==
0
){
var
tree
=
$
.
fn
.
zTree
.
getZTreeObj
(
treeId
);
if
(
!
isNull
(
treeNode
.
children
)){
while
(
treeNode
.
children
.
length
>
0
){
tree
.
removeNode
(
treeNode
.
children
[
0
]);
}
}
if
(
jsonData
.
total
!=
0
)
{
if
(
treeNode
==
undefined
)
{
$
.
fn
.
zTree
.
getZTreeObj
(
treeId
).
addNodes
(
null
,
jsonData
.
rows
,
true
);
}
else
{
$
.
fn
.
zTree
.
getZTreeObj
(
treeId
).
addNodes
(
treeNode
,
jsonData
.
rows
,
true
);
//这里注意,不要添加#
}
}
$
.
fn
.
zTree
.
getZTreeObj
(
treeId
).
expandAll
(
true
);
loadTable
();
}
else
{
top
.
winui
.
window
.
msg
(
jsonData
.
returnMessage
,
{
icon
:
2
,
time
:
2000
});
}
}});
loadTable
();
}
/********* tree 处理 end *************/
...
...
skyeye-web/src/main/webapp/js/syseverole/syseveroleadd.js
浏览文件 @
0755a3d7
layui
.
config
({
base
:
basePath
,
version
:
skyeyeVersion
}).
define
([
'
table
'
,
'
jquery
'
,
'
winui
'
],
function
(
exports
)
{
}).
define
([
'
table
'
,
'
jquery
'
,
'
winui
'
,
'
fsCommon
'
,
'
fsTree
'
],
function
(
exports
)
{
winui
.
renderColor
();
layui
.
use
([
'
form
'
],
function
(
form
)
{
var
index
=
parent
.
layer
.
getFrameIndex
(
window
.
name
);
//获取窗口索引
var
$
=
layui
.
$
;
var
parentId
=
"
0
"
;
form
.
render
();
//菜单级别变化事件
form
.
on
(
'
radio(menuLevel)
'
,
function
(
data
)
{
var
val
=
data
.
value
;
if
(
val
==
'
1
'
){
//创世菜单
$
(
"
#parentIdBox
"
).
addClass
(
"
layui-hide
"
);
}
else
if
(
val
==
'
2
'
){
parentId
=
"
0
"
;
$
(
"
#lockParentSel
"
).
html
(
""
);
$
(
"
#parentIdBox
"
).
removeClass
(
"
layui-hide
"
);
loadChildMenu
();
}
else
{
top
.
winui
.
window
.
msg
(
'
状态值错误
'
,
{
icon
:
2
,
time
:
2000
});
}
});
//系统菜单同步
form
.
on
(
'
switch(isNecessary)
'
,
function
(
data
)
{
//同步开关值
$
(
data
.
elem
).
val
(
data
.
elem
.
checked
);
});
form
.
on
(
'
select(selectParent)
'
,
function
(
data
){
if
(
data
.
value
!=
parentId
){
if
(
isNull
(
data
.
value
)
||
data
.
value
==
'
请选择
'
){
layui
.
$
(
data
.
elem
).
parent
(
'
dd
'
).
nextAll
().
remove
();
if
(
layui
.
$
(
data
.
elem
).
parent
(
'
dd
'
).
prev
().
children
(
'
select[class=menuParent]
'
).
length
>
0
){
parentId
=
layui
.
$
(
data
.
elem
).
parent
(
'
dd
'
).
prev
().
children
(
'
select[class=menuParent]
'
)[
0
].
value
;
}
else
{
parentId
=
"
0
"
;
}
}
else
{
layui
.
$
(
data
.
elem
).
parent
(
'
dd
'
).
nextAll
().
remove
();
parentId
=
data
.
value
;
loadChildMenu
();
}
}
});
form
.
on
(
'
submit(formAddMenu)
'
,
function
(
data
)
{
//表单验证
if
(
winui
.
verifyForm
(
data
.
elem
))
{
var
params
=
{
menuName
:
$
(
"
#menuName
"
).
val
(),
titleName
:
$
(
"
#menuTitle
"
).
val
(),
menuIcon
:
$
(
"
#menuIcon
"
).
val
(),
menuUrl
:
$
(
"
#menuUrl
"
).
val
(),
menuType
:
data
.
field
.
menuType
};
if
(
data
.
field
.
menuLevel
==
'
1
'
){
//创世菜单
params
.
parentId
=
'
0
'
;
}
else
if
(
data
.
field
.
menuLevel
==
'
2
'
){
//子菜单
var
$menu
=
layui
.
$
(
'
.menuParent
'
);
var
str
=
""
;
for
(
var
i
=
0
;
i
<
$menu
.
length
;
i
++
){
if
(
!
isNull
(
$menu
[
i
].
value
)
&&
$menu
[
i
].
value
!=
'
请选择
'
){
str
+=
$menu
[
i
].
value
+
"
,
"
;
}
}
if
(
isNull
(
str
)){
//父菜单为空
top
.
winui
.
window
.
msg
(
"
请至少选择一级父菜单
"
,
{
icon
:
2
,
time
:
2000
});
return
false
;
}
else
{
params
.
parentId
=
str
;
}
}
else
{
top
.
winui
.
window
.
msg
(
'
状态值错误
'
,
{
icon
:
2
,
time
:
2000
});
}
if
(
$
(
"
#menuSysType
"
).
val
()
==
'
true
'
){
params
.
menuSysType
=
'
1
'
;
}
else
{
params
.
menuSysType
=
'
2
'
;
}
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys007
"
,
params
:
params
,
type
:
'
json
'
,
callback
:
function
(
json
){
var
$
=
layui
.
$
,
form
=
layui
.
form
,
fsTree
=
layui
.
fsTree
,
fsCommon
=
layui
.
fsCommon
;
form
.
render
();
form
.
on
(
'
submit(formAddMenu)
'
,
function
(
data
)
{
//表单验证
if
(
winui
.
verifyForm
(
data
.
elem
))
{
var
params
=
{
menuName
:
$
(
"
#menuName
"
).
val
(),
titleName
:
$
(
"
#menuTitle
"
).
val
(),
menuIcon
:
$
(
"
#menuIcon
"
).
val
(),
menuUrl
:
$
(
"
#menuUrl
"
).
val
(),
menuType
:
data
.
field
.
menuType
};
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys007
"
,
params
:
params
,
type
:
'
json
'
,
callback
:
function
(
json
){
if
(
json
.
returnCode
==
0
){
parent
.
layer
.
close
(
index
);
parent
.
refreshCode
=
'
0
'
;
...
...
@@ -91,43 +33,56 @@ layui.config({
top
.
winui
.
window
.
msg
(
json
.
returnMessage
,
{
icon
:
2
,
time
:
2000
});
}
}});
}
return
false
;
});
//加载同级菜单
function
loadChildMenu
(){
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys009
"
,
params
:{
parentId
:
parentId
},
type
:
'
json
'
,
callback
:
function
(
json
){
if
(
json
.
returnCode
==
0
){
var
str
=
'
<dd><select class="menuParent" lay-filter="selectParent" lay-search=""><option value="">请选择</option>
'
;
for
(
var
i
=
0
;
i
<
json
.
rows
.
length
;
i
++
){
str
+=
'
<option value="
'
+
json
.
rows
[
i
].
id
+
'
">
'
+
json
.
rows
[
i
].
menuName
+
'
---------
'
+
getMenuLevelName
(
json
.
rows
[
i
].
menuLevel
)
+
'
</option>
'
;
}
str
+=
'
</select></dd>
'
;
$
(
"
#lockParentSel
"
).
append
(
str
);
form
.
render
(
'
select
'
);
}
else
{
top
.
winui
.
window
.
msg
(
json
.
returnMessage
,
{
icon
:
2
,
time
:
2000
});
}
}});
}
//获取菜单级别
function
getMenuLevelName
(
level
){
if
(
level
==
'
0
'
){
return
"
创世菜单
"
;
}
else
{
return
level
+
"
级子菜单
"
;
}
}
//初始化加载隐藏创世菜单
$
(
"
#parentIdBox
"
).
addClass
(
"
layui-hide
"
);
}
return
false
;
});
//取消
/********* tree 处理 start *************/
var
trees
=
{};
var
treeDoms
=
$
(
"
ul.fsTree
"
);
if
(
treeDoms
.
length
>
0
)
{
$
(
treeDoms
).
each
(
function
(
i
)
{
var
treeId
=
$
(
this
).
attr
(
"
id
"
);
var
funcNo
=
$
(
this
).
attr
(
"
funcNo
"
);
var
url
=
$
(
this
).
attr
(
"
url
"
);
var
tree
=
fsTree
.
render
({
id
:
treeId
,
funcNo
:
funcNo
,
url
:
url
,
getTree
:
getTree
,
checkEnable
:
true
,
loadEnable
:
false
});
if
(
treeDoms
.
length
==
1
)
{
trees
[
treeId
]
=
tree
;
}
else
{
//深度拷贝对象
trees
[
treeId
]
=
$
.
extend
(
true
,
{},
tree
);
}
});
//绑定按钮事件
fsCommon
.
buttonEvent
(
"
tree
"
,
getTree
);
}
function
getTree
(
treeId
)
{
if
(
$
.
isEmpty
(
trees
))
{
fsCommon
.
warnMsg
(
"
未配置tree!
"
);
return
;
}
if
(
$
.
isEmpty
(
treeId
))
{
treeId
=
"
treeDemo
"
;
}
return
trees
[
treeId
];
}
/********* tree 处理 end *************/
//取消
$
(
"
body
"
).
on
(
"
click
"
,
"
#cancle
"
,
function
(){
parent
.
layer
.
close
(
index
);
});
});
});
\ No newline at end of file
skyeye-web/src/main/webapp/tpl/syseverole/syseveroleadd.html
浏览文件 @
0755a3d7
...
...
@@ -6,6 +6,8 @@
<link
href=
"../../assets/lib/layui/css/layui.css"
rel=
"stylesheet"
/>
<link
href=
"../../assets/lib/font-awesome-4.7.0/css/font-awesome.css"
rel=
"stylesheet"
/>
<link
href=
"../../assets/lib/winui/css/winui.css"
rel=
"stylesheet"
/>
<link
href=
"../../assets/lib/layui/lay/modules/ztree/css/zTreeStyle/zTreeStyle.css"
rel=
"stylesheet"
/>
<link
href=
"../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.css"
rel=
"stylesheet"
/>
</head>
<body>
<div
style=
"width:600px;margin:0 auto;padding-top:20px;"
>
...
...
@@ -25,7 +27,7 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
权限分配
</label>
<div
class=
"layui-input-block winui-radio"
>
<ul
id=
"treeDemo"
class=
"ztree fsTree"
method=
"get"
isRoot=
"1"
url=
"sys01
2
"
<ul
id=
"treeDemo"
class=
"ztree fsTree"
method=
"get"
isRoot=
"1"
url=
"sys01
4
"
treeIdKey=
"id"
inputs=
"parentId"
treePIdKey=
"pId"
clickCallbackInputs=
"parentId:$id"
treeName=
"name"
></ul>
</div>
</div>
...
...
@@ -39,6 +41,9 @@
</div>
<script
src=
"../../assets/lib/layui/layui.js"
></script>
<script
src=
"../../assets/lib/layui/custom.js"
></script>
<script
type=
"text/javascript"
src=
"../../assets/lib/layui/lay/modules/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.js"
></script>
<script
type=
"text/javascript"
src=
"../../assets/lib/layui/lay/modules/ztree/js/jquery.ztree.all.min.js"
></script>
<script
type=
"text/javascript"
>
layui
.
config
({
base
:
'
../../js/syseverole/
'
}).
use
(
'
syseveroleadd
'
);
</script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录