新增菜单根节点选择页面
This commit is contained in:
parent
1e4087bb35
commit
62c4a26567
@ -122,6 +122,16 @@ public class MenuController extends DefaultBaseController {
|
||||
return menuService.listAllByParentId(menuParentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "菜单列表", notes = "菜单列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "menuParentId", value = "菜单父ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list/{menuParentId}")
|
||||
public List<MenuDTO> list(@PathVariable("menuParentId") String menuParentId) {
|
||||
return menuService.listByParentId(menuParentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "菜单zTree列表", notes = "菜单zTree列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||
|
@ -27,6 +27,11 @@ public class MenuRouteController {
|
||||
return new ModelAndView("menu/list-tree");
|
||||
}
|
||||
|
||||
@GetMapping("list-tree-root")
|
||||
public ModelAndView listTreeRoot() {
|
||||
return new ModelAndView("menu/list-tree-root");
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
return new ModelAndView("menu/list");
|
||||
|
@ -46,28 +46,4 @@ public interface IMenuService extends IMenuBaseService {
|
||||
*/
|
||||
void remove(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过clientId获取菜单
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
// SuccessResultData<List<MenuDTO>> listMenuByClientId(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 菜单ID列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
// List<String> listUserMenuId();
|
||||
|
||||
/**
|
||||
* 通过clientId和userId获取菜单
|
||||
*
|
||||
* @param clientId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
// SuccessResultData<List<MenuDTO>> listMenuByClientIdAndUserId(String clientId, String userId);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
<!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/js/vendor/zTree3/css/metroStyle/metroStyle.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/layuiadmin/style/common.css" media="all">
|
||||
<style>
|
||||
.active {border-left: 5px;border-right: 5px;border-top: 0px;border-bottom: 0px;border-style: solid;border-color: #009688;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<table id="tableTemplateBox" class="layui-table" style="margin: 0;"></table>
|
||||
<script id="tableTemplate" type="text/html">
|
||||
<tbody style="text-align: center;">
|
||||
{{# for(var i = 0, item; item = d.data[i++];) { }}
|
||||
<tr>
|
||||
{{# if(item.menuId === d.selectedMenuId) { }}
|
||||
<td><div id="{{item.menuId}}Box" class="active"><a id="{{item.menuId}}" class="menu-name" href="javascript:void(0);">{{i}}.{{item.menuName}}</a></div></td>
|
||||
{{# } }}
|
||||
{{# if(item.menuId != d.selectedMenuId) { }}
|
||||
<td><div id="{{item.menuId}}Box"><a id="{{item.menuId}}" class="menu-name" href="javascript:void(0);">{{i}}.{{item.menuName}}</a></div></td>
|
||||
{{# } }}
|
||||
</tr>
|
||||
{{# } }}
|
||||
</tbody>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
var common;
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'laytpl', 'ztree', 'common'], function() {
|
||||
common = layui.common;
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var laytpl = layui.laytpl;
|
||||
var selectedMenuId = top.restAjax.params(window.location.href).menuId;
|
||||
top.dialog.dialogData.menuId = selectedMenuId;
|
||||
|
||||
// 初始化IFrame
|
||||
function initData() {
|
||||
top.restAjax.get(top.restAjax.path('api/menu/list/0', []), {}, null, function(code, data) {
|
||||
laytpl(document.getElementById('tableTemplate').innerHTML).render({
|
||||
selectedMenuId: selectedMenuId,
|
||||
data: data
|
||||
}, function(html){
|
||||
document.getElementById('tableTemplateBox').innerHTML = html;
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
})
|
||||
}
|
||||
// 初始化大小
|
||||
function initSize() {
|
||||
$('#leftTreeWrap').css({
|
||||
height: $win.height() - 30,
|
||||
overflow: 'auto'
|
||||
});
|
||||
$('#listContentWrap').css({
|
||||
height: $win.height() - 50,
|
||||
});
|
||||
}
|
||||
|
||||
initSize();
|
||||
initData();
|
||||
|
||||
$(document).on('click', '.menu-name', function() {
|
||||
$('.active').removeClass('active');
|
||||
if(top.dialog.dialogData.menuId == this.id) {
|
||||
top.dialog.dialogData.menuId = null;
|
||||
} else {
|
||||
$('#'+ this.id +'Box').addClass('active');
|
||||
top.dialog.dialogData.menuId = this.id;
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user