支持查询&统一样式(菜单管理,部门管理)

dep_wangsr
RuoYi 6 years ago committed by Limy
parent a8712494fe
commit 61303871be

@ -42,9 +42,9 @@ public class DeptController extends BaseController
@RequiresPermissions("system:dept:list")
@GetMapping("/list")
@ResponseBody
public List<Dept> list()
public List<Dept> list(Dept dept)
{
List<Dept> deptList = deptService.selectDeptAll();
List<Dept> deptList = deptService.selectDeptList(dept);
return deptList;
}

@ -27,9 +27,16 @@ public interface DeptMapper
public int checkDeptExistUser(Long deptId);
/**
*
*
*
* @return
* @return
*/
public List<Dept> selectDeptList(Dept dept);
/**
*
*
* @return
*/
public List<Dept> selectDeptAll();

@ -24,9 +24,20 @@ public class DeptServiceImpl implements IDeptService
private DeptMapper deptMapper;
/**
*
*
*
* @return
* @return
*/
@Override
public List<Dept> selectDeptList(Dept dept)
{
return deptMapper.selectDeptList(dept);
}
/**
*
*
* @return
*/
@Override
public List<Dept> selectDeptAll()

@ -13,9 +13,16 @@ import com.ruoyi.project.system.dept.domain.Dept;
public interface IDeptService
{
/**
*
*
*
* @return
* @return
*/
public List<Dept> selectDeptList(Dept dept);
/**
*
*
* @return
*/
public List<Dept> selectDeptAll();

@ -44,9 +44,9 @@ public class MenuController extends BaseController
@RequiresPermissions("system:menu:list")
@GetMapping("/list")
@ResponseBody
public List<Menu> list()
public List<Menu> list(Menu menu)
{
List<Menu> menuList = menuService.selectMenuAll();
List<Menu> menuList = menuService.selectMenuList(menu);
return menuList;
}

@ -27,7 +27,7 @@ public class Menu extends BaseEntity
/** 类型:0目录,1菜单,2按钮 */
private String menuType;
/** 菜单状态:0显示,1隐藏 */
private int visible;
private Integer visible;
/** 权限字符串 */
private String perms;
/** 菜单图标 */
@ -105,12 +105,12 @@ public class Menu extends BaseEntity
this.menuType = menuType;
}
public int getVisible()
public Integer getVisible()
{
return visible;
}
public void setVisible(int visible)
public void setVisible(Integer visible)
{
this.visible = visible;
}

@ -35,6 +35,13 @@ public interface MenuMapper
*/
public List<String> selectMenuTree(Long roleId);
/**
*
*
* @return
*/
public List<Menu> selectMenuList(Menu menu);
/**
*
*

@ -23,6 +23,13 @@ public interface IMenuService
*/
public List<Menu> selectMenusByUserId(Long userId);
/**
*
*
* @return
*/
public List<Menu> selectMenuList(Menu menu);
/**
*
*

@ -49,6 +49,17 @@ public class MenuServiceImpl implements IMenuService
return TreeUtils.getChildPerms(menus, 0);
}
/**
*
*
* @return
*/
@Override
public List<Menu> selectMenuList(Menu menu)
{
return menuMapper.selectMenuList(menu);
}
/**
*
*

@ -28,6 +28,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDeptVo"/>
</select>
<select id="selectDeptList" parameterType="Dept" resultMap="DeptResult">
<include refid="selectDeptVo"/>
<where>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(*) from sys_user where dept_id = #{deptId}
</select>

@ -51,6 +51,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by m.parent_id, m.order_num
</select>
<select id="selectMenuList" parameterType="Menu" resultMap="MenuResult">
<include refid="selectMenuVo"/>
<where>
<if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND visible = #{visible}
</if>
</where>
</select>
<select id="selectMenuAll" resultMap="MenuResult">
<include refid="selectMenuVo"/>
</select>

@ -8,9 +8,9 @@
.treegrid-table{border:0 !important;margin-bottom:0}
.treegrid-table tbody {display:block;height:auto;overflow-y:auto;}
.treegrid-table thead, .treegrid-table tbody tr {display:table;width:100%;table-layout:fixed;}
.treegrid-thead th{line-height:40px;border: 0 !important;background:#f3f3f4 !important;border-radius: 4px;border-left:1px solid #e7eaec !important;border-bottom:2px solid #e7eaec !important;text-align: center;}
.treegrid-thead th{line-height:40px;border: 0 !important;background:#f3f3f4 !important;border-radius: 4px;border-left:0px solid #e7eaec !important;border-bottom:2px solid #e7eaec !important;text-align: center;}
.treegrid-thead tr :first-child{border-left:0 !important}
.treegrid-tbody td{border: 0 !important;border-left:1px solid #e7eaec !important;border-bottom:1px solid #e7eaec !important;overflow: hidden;
.treegrid-tbody td{border: 0 !important;border-left:0px solid #e7eaec !important;border-bottom:1px solid #e7eaec !important;overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;}
.treegrid-tbody tr :first-child{border-left:0 !important}

@ -22,7 +22,7 @@
}
// 工具条在外层包装一下div样式用的bootstrap-table的
if(options.toolbar){
var _tool_div = $("<div class='fixed-table-toolbar' style='display:none;'></div>");
var _tool_div = $("<div class='fixed-table-toolbar'></div>");
var _tool_left_div = $("<div class='bs-bars pull-left'></div>");
_tool_left_div.append($(options.toolbar));
_tool_div.append(_tool_left_div);
@ -249,7 +249,7 @@
expandAll : true, // 是否全部展开
striped : false, // 是否各行渐变色
columns : [],
toolbar: null,//顶部工具条
toolbar: '#toolbar',//顶部工具条
height: 0,
expanderExpandedClass : 'glyphicon glyphicon-chevron-down',// 展开的按钮的图标
expanderCollapsedClass : 'glyphicon glyphicon-chevron-right'// 缩起的按钮的图标

@ -1,152 +0,0 @@
/**
* 初始化 Tree Table 的封装
*/
(function () {
var TreeTable = function (tableId, url, columns) {
this.btInstance = null; //jquery和bootstrapTreeTable绑定的对象
this.bstableId = tableId;
this.url = url;
this.method = "GET";
this.columns = columns;
this.data = {};// ajax的参数
this.expandColumn = null;// 展开显示的列
this.id = 'menuId';// 选取记录返回的值
this.code = 'menuId';// 用于设置父子关系
this.parentCode = 'parentId';// 用于设置父子关系
this.expandAll = false;// 是否默认全部展开
this.toolbarId = tableId + "Toolbar";
this.height = 430;
};
TreeTable.prototype = {
/**
* 初始化bootstrap table
*/
init: function () {
var tableId = this.bstableId;
this.btInstance =
$('#'+tableId).bootstrapTreeTable({
id: this.id,// 选取记录返回的值
code: this.code,// 用于设置父子关系
parentCode: this.parentCode,// 用于设置父子关系
rootCodeValue: this.rootCodeValue,//设置根节点code值----可指定根节点默认为null,"",0,"0"
type: this.method, //请求数据的ajax类型
url: this.url, //请求数据的ajax的url
ajaxParams: this.data, //请求数据的ajax的data属性
expandColumn: this.expandColumn,//在哪一列上面显示展开按钮,从0开始
striped: true, //是否各行渐变色
expandAll: this.expandAll, //是否全部展开
columns: this.columns, //列数组
toolbar: "#" + this.toolbarId,//顶部工具条
height: this.height,
});
return this;
},
/**
* 设置在哪一列上面显示展开按钮,从0开始
*/
setExpandColumn: function (expandColumn) {
this.expandColumn = expandColumn;
},
/**
* 设置记录返回的id值
*/
setIdField: function (id) {
this.id = id;
},
/**
* 设置记录分级的字段
*/
setCodeField: function (code) {
this.code = code;
},
/**
* 设置记录分级的父级字段
*/
setParentCodeField: function (parentCode) {
this.parentCode = parentCode;
},
/**
* 设置根节点code值----可指定根节点默认为null,"",0,"0"
*/
setRootCodeValue: function (rootCodeValue) {
this.rootCodeValue = rootCodeValue;
},
/**
* 设置是否默认全部展开
*/
setExpandAll: function (expandAll) {
this.expandAll = expandAll;
},
/**
* 设置表格高度
*/
setHeight: function (height) {
this.height = height;
},
/**
* 设置ajax post请求时候附带的参数
*/
set: function (key, value) {
if (typeof key == "object") {
for (var i in key) {
if (typeof i == "function")
continue;
this.data[i] = key[i];
}
} else {
this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
}
return this;
},
/**
* 设置ajax get请求时候附带的参数
*/
setData: function (data) {
this.data = data;
return this;
},
/**
* 清空ajax post请求参数
*/
clear: function () {
this.data = {};
return this;
},
/**
* 刷新表格
*/
refresh: function (parms) {
if (typeof parms != "undefined") {
this.btInstance.bootstrapTreeTable('refresh', parms.query);// 为了兼容bootstrap-table的写法
} else {
this.btInstance.bootstrapTreeTable('refresh');
}
},
/**
* 设置高度
*/
resetHeight: function(parms) {
if (typeof parms != "undefined") {
this.btInstance.bootstrapTreeTable('resetHeight', parms.height);// 为了兼容bootstrap-table的写法
} else {
this.btInstance.bootstrapTreeTable('resetHeight');
}
},
/**
* 获取选中行
*/
getSelectedRow: function() {
return this.btInstance.bootstrapTreeTable('getSelections');
}
};
window.TreeTable = TreeTable;
}());

@ -100,10 +100,11 @@
// 表格树封装处理
treeTable: {
_option: {},
_treeTable: {},
// 初始化表格
init: function(options) {
$.table._option = options;
$('#bootstrap-table').bootstrapTreeTable({
var treeTable = $('#bootstrap-table').bootstrapTreeTable({
code : options.id, // 用于设置父子关系
parentCode : options.parentId, // 用于设置父子关系
type: 'get', // 请求方式(*
@ -115,7 +116,20 @@
expandAll : $.common.visible(options.expandAll), // 是否全部展开
columns: options.columns
});
}
$.treeTable._treeTable = treeTable;
},
// 条件查询
search: function(form) {
var params = {};
$.each($("#" + form).serializeArray(), function(i, field) {
params[field.name] = field.value;
});
$.treeTable._treeTable.bootstrapTreeTable('refresh', params);
},
// 刷新
refresh: function() {
$.treeTable._treeTable.bootstrapTreeTable('refresh');
},
},
// 表单封装处理
form: {

File diff suppressed because one or more lines are too long

@ -3,20 +3,39 @@
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style type="text/css">
.fixed-table-container{position:relative;clear:both;border:1px solid #ddd;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
<div class="btn-group hidden-xs" id="toolbar" role="group">
<div class="form-group">
<a type="button" class="btn btn-outline btn-default" onclick="$.operate.add(100)" shiro:hasPermission="system:dept:add">
<i class="fa fa-plus"></i> 新增
</a>
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-info">
<form id="operlog-form">
<div class="select-list gd">
<ul>
<li>
部门名称:<input type="text" name="deptName"/>
</li>
<li>
部门状态:<select name="status" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search($('form').attr('id'))"><i class="fa fa-search"></i>&nbsp;搜索</a>
</li>
</ul>
</div>
</form>
</div>
</div>
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<div class="btn-group hidden-xs" id="toolbar" role="group">
<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add(100)" shiro:hasPermission="system:dept:add">
<i class="fa fa-plus"></i> 新增
</a>
</div>
<div class="col-sm-12 select-info order-table">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
@ -91,7 +110,7 @@
success : function(result) {
if (result.code == web_status.SUCCESS) {
$.modal.alertSuccess(result.msg);
loading();
$.treeTable.refresh();
} else {
$.modal.alertError(result.msg);
}
@ -99,6 +118,7 @@
});
});
}
</script>
</body>
</html>

@ -2,21 +2,42 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style type="text/css">
.fixed-table-container{position:relative;clear:both;border:1px solid #ddd;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
<div class="btn-group hidden-xs" id="toolbar" role="group">
<div class="form-group">
<a type="button" class="btn btn-outline btn-default" onclick="$.operate.add(0)" shiro:hasPermission="system:menu:add">
<i class="fa fa-plus"></i> 新增
</a>
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-info">
<form id="operlog-form">
<div class="select-list gd">
<ul>
<li>
菜单名称:<input type="text" name="menuName"/>
</li>
<li>
菜单状态:<select name="visible" th:with="type=${@dictService.selectDictData('sys_show_hide')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search($('form').attr('id'))"><i class="fa fa-search"></i>&nbsp;搜索</a>
</li>
</ul>
</div>
</form>
</div>
</div>
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<div class="btn-group hidden-xs" id="toolbar" role="group">
<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add(0)" shiro:hasPermission="system:menu:add">
<i class="fa fa-plus"></i> 新增
</a>
</div>
<div class="col-sm-12 select-info order-table">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var addFlag = [[${@permissionService.hasPermi('system:menu:add')}]];

Loading…
Cancel
Save