增加了菜单创建接口
This commit is contained in:
parent
186b525816
commit
40c11f84f4
@ -25,6 +25,16 @@ public interface IMenuBaseService {
|
|||||||
*/
|
*/
|
||||||
String MENU_UNIFIED_USER = "unified-user";
|
String MENU_UNIFIED_USER = "unified-user";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存菜单
|
||||||
|
*
|
||||||
|
* @param menuParentId
|
||||||
|
* @param menuName
|
||||||
|
* @param menuUrl
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String saveAndReturnIdByParentIdAndNameAndUrl(String menuParentId, String menuName, String menuUrl);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单详情
|
* 菜单详情
|
||||||
*
|
*
|
||||||
|
@ -32,6 +32,11 @@ public class MenuRouteController {
|
|||||||
return new ModelAndView("menu/list-tree-root");
|
return new ModelAndView("menu/list-tree-root");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("list-tree-select")
|
||||||
|
public ModelAndView listTreeSelect() {
|
||||||
|
return new ModelAndView("menu/list-tree-select");
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
public ModelAndView list() {
|
public ModelAndView list() {
|
||||||
return new ModelAndView("menu/list");
|
return new ModelAndView("menu/list");
|
||||||
|
@ -35,6 +35,21 @@ public class MenuServiceImpl extends DefaultBaseService implements IMenuService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IMenuDao menuDao;
|
private IMenuDao menuDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String saveAndReturnIdByParentIdAndNameAndUrl(String menuParentId, String menuName, String menuUrl) {
|
||||||
|
MenuVO menuVO = new MenuVO();
|
||||||
|
menuVO.setMenuParentId(menuParentId);
|
||||||
|
menuVO.setMenuName(menuName);
|
||||||
|
menuVO.setMenuSummary(menuName);
|
||||||
|
menuVO.setMenuUrl(menuUrl);
|
||||||
|
menuVO.setMenuType(1);
|
||||||
|
menuVO.setMenuStatus(0);
|
||||||
|
menuVO.setMenuIcon("fa fa-list");
|
||||||
|
menuVO.setOpenType(1);
|
||||||
|
menuVO.setMenuOrder("1000");
|
||||||
|
return saveAndReturnId(menuVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MenuDTO get(Map<String, Object> params) {
|
public MenuDTO get(Map<String, Object> params) {
|
||||||
return menuDao.get(params);
|
return menuDao.get(params);
|
||||||
|
@ -0,0 +1,122 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<base th:href="${#request.getContextPath() + '/'}">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||||
|
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||||
|
<link rel="stylesheet" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/common.css" media="all">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-anim layui-anim-fadein">
|
||||||
|
<div class="layui-row" style="padding-right: 0px;">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body left-tree-wrap">
|
||||||
|
<div id="treeBox">
|
||||||
|
<ul id="tree" class="ztree"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item layui-layout-admin">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div class="layui-footer" style="padding: 0px;">
|
||||||
|
<div class="layui-btn-group">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm submit">确定</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary close">返回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
var common;
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layuiadmin/'
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index'
|
||||||
|
}).use(['index', 'ztree', 'common'], function() {
|
||||||
|
common = layui.common;
|
||||||
|
var $ = layui.$;
|
||||||
|
var $win = $(window);
|
||||||
|
var resizeTimeout = null;
|
||||||
|
var selectedNodes = [];
|
||||||
|
|
||||||
|
top.dialog.dialogData.selectedNodes = [];
|
||||||
|
|
||||||
|
function closeBox() {
|
||||||
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化大小
|
||||||
|
function initSize() {
|
||||||
|
$('#treeBox').css({
|
||||||
|
height: $win.height() - 52,
|
||||||
|
overflow: 'auto'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 初始化树
|
||||||
|
function initThree() {
|
||||||
|
var setting = {
|
||||||
|
async: {
|
||||||
|
enable: true,
|
||||||
|
autoLoad: true,
|
||||||
|
type: 'get',
|
||||||
|
url: top.restAjax.path('api/menu/listztree', []),
|
||||||
|
autoParam: ['id'],
|
||||||
|
otherParam: {},
|
||||||
|
dataFilter: function (treeId, parentNode, childNodes) {
|
||||||
|
if (!childNodes) return null;
|
||||||
|
for (var i = 0, l = childNodes.length; i < l; i++) {
|
||||||
|
childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
|
||||||
|
}
|
||||||
|
return childNodes;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: function (event, treeId, treeNode) {
|
||||||
|
var node = {
|
||||||
|
id: treeNode.id,
|
||||||
|
pId: treeNode.pId,
|
||||||
|
name: treeNode.name
|
||||||
|
};
|
||||||
|
if(selectedNodes.length == 0) {
|
||||||
|
selectedNodes.push(node)
|
||||||
|
} else {
|
||||||
|
selectedNodes[0] = node;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
var zTree = $.fn.zTree.init($("#tree"), setting);
|
||||||
|
}
|
||||||
|
initSize();
|
||||||
|
initThree();
|
||||||
|
|
||||||
|
// 事件 - 页面变化
|
||||||
|
$win.on('resize', function() {
|
||||||
|
clearTimeout(resizeTimeout);
|
||||||
|
resizeTimeout = setTimeout(function() {
|
||||||
|
initSize();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.close').on('click', function() {
|
||||||
|
closeBox();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.submit').on('click', function() {
|
||||||
|
top.dialog.dialogData.selectedNodes = selectedNodes;
|
||||||
|
closeBox();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user