diff --git a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java index ddd5931e..695fbab4 100644 --- a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java +++ b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java @@ -42,9 +42,9 @@ public class DeptController extends BaseController @RequiresPermissions("system:dept:list") @GetMapping("/list") @ResponseBody - public List list() + public List list(Dept dept) { - List deptList = deptService.selectDeptAll(); + List deptList = deptService.selectDeptList(dept); return deptList; } diff --git a/src/main/java/com/ruoyi/project/system/dept/mapper/DeptMapper.java b/src/main/java/com/ruoyi/project/system/dept/mapper/DeptMapper.java index 4e79171c..8eba3140 100644 --- a/src/main/java/com/ruoyi/project/system/dept/mapper/DeptMapper.java +++ b/src/main/java/com/ruoyi/project/system/dept/mapper/DeptMapper.java @@ -27,9 +27,16 @@ public interface DeptMapper public int checkDeptExistUser(Long deptId); /** - * 查询部门管理集合 + * 查询部门管理数据 * - * @return 所有部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(Dept dept); + + /** + * 查询部门所有数据 + * + * @return 部门信息集合 */ public List selectDeptAll(); diff --git a/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java b/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java index f684a225..416b8bcb 100644 --- a/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java @@ -24,9 +24,20 @@ public class DeptServiceImpl implements IDeptService private DeptMapper deptMapper; /** - * 查询部门管理集合 + * 查询部门管理数据 * - * @return 所有部门信息 + * @return 部门信息集合 + */ + @Override + public List selectDeptList(Dept dept) + { + return deptMapper.selectDeptList(dept); + } + + /** + * 查询部门所有数据 + * + * @return 部门信息集合 */ @Override public List selectDeptAll() diff --git a/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java b/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java index b8d83330..3b40d267 100644 --- a/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java +++ b/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java @@ -13,12 +13,19 @@ import com.ruoyi.project.system.dept.domain.Dept; public interface IDeptService { /** - * 查询部门管理集合 + * 查询部门管理数据 * - * @return 所有部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(Dept dept); + + /** + * 查询部门所有数据 + * + * @return 部门信息集合 */ public List selectDeptAll(); - + /** * 查询部门管理树 * @@ -65,7 +72,7 @@ public interface IDeptService * @return 部门信息 */ public Dept selectDeptById(Long deptId); - + /** * 校验部门名称是否唯一 * diff --git a/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java b/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java index a9fc4ffb..b90e38b7 100644 --- a/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java +++ b/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java @@ -44,9 +44,9 @@ public class MenuController extends BaseController @RequiresPermissions("system:menu:list") @GetMapping("/list") @ResponseBody - public List list() + public List list(Menu menu) { - List menuList = menuService.selectMenuAll(); + List menuList = menuService.selectMenuList(menu); return menuList; } diff --git a/src/main/java/com/ruoyi/project/system/menu/domain/Menu.java b/src/main/java/com/ruoyi/project/system/menu/domain/Menu.java index d0569bb4..dec62f4d 100644 --- a/src/main/java/com/ruoyi/project/system/menu/domain/Menu.java +++ b/src/main/java/com/ruoyi/project/system/menu/domain/Menu.java @@ -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; } diff --git a/src/main/java/com/ruoyi/project/system/menu/mapper/MenuMapper.java b/src/main/java/com/ruoyi/project/system/menu/mapper/MenuMapper.java index f6f80bdd..0f27bafd 100644 --- a/src/main/java/com/ruoyi/project/system/menu/mapper/MenuMapper.java +++ b/src/main/java/com/ruoyi/project/system/menu/mapper/MenuMapper.java @@ -34,6 +34,13 @@ public interface MenuMapper * @return 菜单列表 */ public List selectMenuTree(Long roleId); + + /** + * 查询系统菜单列表 + * + * @return 菜单列表 + */ + public List selectMenuList(Menu menu); /** * 查询系统所有菜单 diff --git a/src/main/java/com/ruoyi/project/system/menu/service/IMenuService.java b/src/main/java/com/ruoyi/project/system/menu/service/IMenuService.java index c3f120e8..0f91cd49 100644 --- a/src/main/java/com/ruoyi/project/system/menu/service/IMenuService.java +++ b/src/main/java/com/ruoyi/project/system/menu/service/IMenuService.java @@ -23,6 +23,13 @@ public interface IMenuService */ public List selectMenusByUserId(Long userId); + /** + * 查询系统菜单列表 + * + * @return 菜单列表 + */ + public List selectMenuList(Menu menu); + /** * 查询菜单集合 * diff --git a/src/main/java/com/ruoyi/project/system/menu/service/MenuServiceImpl.java b/src/main/java/com/ruoyi/project/system/menu/service/MenuServiceImpl.java index b68fecdc..28e69218 100644 --- a/src/main/java/com/ruoyi/project/system/menu/service/MenuServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/menu/service/MenuServiceImpl.java @@ -49,6 +49,17 @@ public class MenuServiceImpl implements IMenuService return TreeUtils.getChildPerms(menus, 0); } + /** + * 查询菜单集合 + * + * @return 所有菜单信息 + */ + @Override + public List selectMenuList(Menu menu) + { + return menuMapper.selectMenuList(menu); + } + /** * 查询菜单集合 * diff --git a/src/main/resources/mybatis/system/DeptMapper.xml b/src/main/resources/mybatis/system/DeptMapper.xml index 35f81dbe..e015f61a 100644 --- a/src/main/resources/mybatis/system/DeptMapper.xml +++ b/src/main/resources/mybatis/system/DeptMapper.xml @@ -28,6 +28,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + diff --git a/src/main/resources/mybatis/system/MenuMapper.xml b/src/main/resources/mybatis/system/MenuMapper.xml index d03c3bbb..0f70aa7b 100644 --- a/src/main/resources/mybatis/system/MenuMapper.xml +++ b/src/main/resources/mybatis/system/MenuMapper.xml @@ -51,6 +51,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by m.parent_id, m.order_num + + diff --git a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.css b/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.css index 8fcc128b..a1d7965b 100644 --- a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.css +++ b/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.css @@ -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} \ No newline at end of file diff --git a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.extension.js b/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.extension.js index 9f7369ae..ba5bc85c 100644 --- a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.extension.js +++ b/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.extension.js @@ -22,7 +22,7 @@ } // 工具条在外层包装一下div,样式用的bootstrap-table的 if(options.toolbar){ - var _tool_div = $(""); + var _tool_div = $("
"); var _tool_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'// 缩起的按钮的图标 diff --git a/src/main/resources/static/ajax/libs/jqTreeGrid/tree.table.js b/src/main/resources/static/ajax/libs/jqTreeGrid/tree.table.js deleted file mode 100644 index eddad0d7..00000000 --- a/src/main/resources/static/ajax/libs/jqTreeGrid/tree.table.js +++ /dev/null @@ -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; - -}()); \ No newline at end of file diff --git a/src/main/resources/static/ruoyi/js/ry-ui.js b/src/main/resources/static/ruoyi/js/ry-ui.js index 4793bf04..5fd60243 100644 --- a/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/src/main/resources/static/ruoyi/js/ry-ui.js @@ -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: { diff --git a/src/main/resources/static/ruoyi/js/ry-ui.min.js b/src/main/resources/static/ruoyi/js/ry-ui.min.js index 0d567554..3b56a0b5 100644 --- a/src/main/resources/static/ruoyi/js/ry-ui.min.js +++ b/src/main/resources/static/ruoyi/js/ry-ui.min.js @@ -1 +1,5 @@ -(function($){$.extend({table:{_option:{},_params:{},init:function(options){$.table._option=options;$.table._params=$.common.isEmpty(options.queryParams)?$.table.queryParams:options.queryParams;_sortOrder=$.common.isEmpty(options.sortOrder)?"asc":options.sortOrder;_sortName=$.common.isEmpty(options.sortName)?"":options.sortName;$("#bootstrap-table").bootstrapTable({url:options.url,contentType:"application/x-www-form-urlencoded",method:"post",cache:false,sortable:true,sortStable:true,sortName:_sortName,sortOrder:_sortOrder,pagination:true,pageNumber:1,pageSize:10,pageList:[10,25,50],iconSize:"outline",toolbar:"#toolbar",sidePagination:"server",search:$.common.visible(options.search),showRefresh:$.common.visible(options.showRefresh),showColumns:$.common.visible(options.showColumns),showToggle:$.common.visible(options.showToggle),showExport:$.common.visible(options.showExport),queryParams:$.table._params,columns:options.columns})},queryParams:function(params){return{pageSize:params.limit,pageNum:params.offset/params.limit+1,searchValue:params.search,orderByColumn:params.sort,isAsc:params.order}},search:function(form){var params=$("#bootstrap-table").bootstrapTable("getOptions");params.queryParams=function(params){var search={};$.each($("#"+form).serializeArray(),function(i,field){search[field.name]=field.value});search.pageSize=params.limit;search.pageNum=params.offset/params.limit+1;search.searchValue=params.search;search.orderByColumn=params.sort;search.isAsc=params.order;return search};$("#bootstrap-table").bootstrapTable("refresh",params)},exportExcel:function(form){$.post($.table._option.exportUrl,$("#"+form).serializeArray(),function(result){if(result.code==web_status.SUCCESS){window.location.href=ctx+"common/download?fileName="+result.msg+"&delete="+true}else{$.modal.alertError(result.msg)}})},refresh:function(){$("#bootstrap-table").bootstrapTable("refresh",{url:$.table._option.url,silent:true})},selectColumns:function(column){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[column]})},selectFirstColumns:function(){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[$.table._option.columns[1].field]})}},treeTable:{_option:{},init:function(options){$.table._option=options;$("#bootstrap-table").bootstrapTreeTable({code:options.id,parentCode:options.parentId,type:"get",url:options.url,ajaxParams:{},expandColumn:"0",striped:false,bordered:true,expandAll:$.common.visible(options.expandAll),columns:options.columns})}},form:{selectCheckeds:function(name){var checkeds="";$('input:checkbox[name="'+name+'"]:checked').each(function(i){if(0==i){checkeds=$(this).val()}else{checkeds+=(","+$(this).val())}});return checkeds},selectSelects:function(name){var selects="";$("#"+name+" option:selected").each(function(i){if(0==i){selects=$(this).val()}else{selects+=(","+$(this).val())}});return selects}},modal:{icon:function(type){var icon="";if(type==modal_status.WARNING){icon=0}else{if(type==modal_status.SUCCESS){icon=1}else{if(type==modal_status.FAIL){icon=2}else{icon=3}}}return icon},msg:function(content,type){if(type!=undefined){layer.msg(content,{icon:$.modal.icon(type),time:1000,shift:5})}else{layer.msg(content)}},msgError:function(content){$.modal.msg(content,modal_status.FAIL)},msgSuccess:function(content){$.modal.msg(content,modal_status.SUCCESS)},msgWarning:function(content){$.modal.msg(content,modal_status.WARNING)},alert:function(content,type){layer.alert(content,{icon:$.modal.icon(type),title:"系统提示",btn:["确认"],btnclass:["btn btn-primary"],})},msgReload:function(msg,type){layer.msg(msg,{icon:$.modal.icon(type),time:500,shade:[0.1,"#8F8F8F"]},function(){$.modal.reload()})},alertError:function(content){$.modal.alert(content,modal_status.FAIL)},alertSuccess:function(content){$.modal.alert(content,modal_status.SUCCESS)},alertWarning:function(content){$.modal.alert(content,modal_status.WARNING)},close:function(){var index=parent.layer.getFrameIndex(window.name);parent.layer.close(index)},confirm:function(content,callBack){layer.confirm(content,{icon:3,title:"系统提示",btn:["确认","取消"],btnclass:["btn btn-primary","btn btn-danger"],},function(index){layer.close(index);callBack(true)})},open:function(title,url,width,height){if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url})},openFull:function(title,url,width,height){if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}var index=layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url});layer.full(index)},loading:function(message){$.blockUI({message:'
'+message+"
"})},closeLoading:function(){setTimeout(function(){$.unblockUI()},50)},reload:function(){parent.location.reload()}},operate:{submit:function(url,type,dataType,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:type,dataType:dataType,data:data,success:function(result){$.operate.ajaxSuccess(result)}};$.ajax(config)},post:function(url,data){$.operate.submit(url,"post","json",data)},remove:function(id){$.modal.confirm("确定删除该条"+$.table._option.modalName+"信息吗?",function(){var url=$.common.isEmpty(id)?$.table._option.removeUrl:$.table._option.removeUrl.replace("{id}",id);var data={"ids":id};$.operate.submit(url,"post","json",data)})},batRemove:function(){var rows=$.common.isEmpty($.table._option.id)?$.table.selectFirstColumns():$.table.selectColumns($.table._option.id);if(rows.length==0){$.modal.alertWarning("请至少选择一条记录");return}$.modal.confirm("确认要删除选中的"+rows.length+"条数据吗?",function(){var url=$.table._option.removeUrl;var data={"ids":rows.join()};$.operate.submit(url,"post","json",data)})},add:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.open("添加"+$.table._option.modalName,url)},edit:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.open("修改"+$.table._option.modalName,url)},addFull:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.openFull("添加"+$.table._option.modalName,url)},editFull:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.openFull("修改"+$.table._option.modalName,url)},save:function(url,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:"post",dataType:"json",data:data,success:function(result){$.operate.saveSuccess(result)}};$.ajax(config)},ajaxSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgSuccess(result.msg);$.table.refresh()}else{$.modal.alertError(result.msg)}$.modal.closeLoading()},saveSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgReload("保存成功,正在刷新数据请稍后……",modal_status.SUCCESS)}else{$.modal.alertError(result.msg)}$.modal.closeLoading()}},common:{isEmpty:function(value){if(value==null||this.trim(value)==""){return true}return false},visible:function(value){if($.common.isEmpty(value)||value==true){return true}return false},trim:function(value){if(value==null){return""}return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g,"")},random:function(min,max){return Math.floor((Math.random()*max)+min)}}})})(jQuery);web_status={SUCCESS:0,FAIL:500};modal_status={SUCCESS:"success",FAIL:"error",WARNING:"warning"}; \ No newline at end of file +/*! + * ruoyi.js + * Author: Ruoyi + */ +(function($){$.extend({table:{_option:{},_params:{},init:function(options){$.table._option=options;$.table._params=$.common.isEmpty(options.queryParams)?$.table.queryParams:options.queryParams;_sortOrder=$.common.isEmpty(options.sortOrder)?"asc":options.sortOrder;_sortName=$.common.isEmpty(options.sortName)?"":options.sortName;$("#bootstrap-table").bootstrapTable({url:options.url,contentType:"application/x-www-form-urlencoded",method:"post",cache:false,sortable:true,sortStable:true,sortName:_sortName,sortOrder:_sortOrder,pagination:true,pageNumber:1,pageSize:10,pageList:[10,25,50],iconSize:"outline",toolbar:"#toolbar",sidePagination:"server",search:$.common.visible(options.search),showRefresh:$.common.visible(options.showRefresh),showColumns:$.common.visible(options.showColumns),showToggle:$.common.visible(options.showToggle),showExport:$.common.visible(options.showExport),queryParams:$.table._params,columns:options.columns})},queryParams:function(params){return{pageSize:params.limit,pageNum:params.offset/params.limit+1,searchValue:params.search,orderByColumn:params.sort,isAsc:params.order}},search:function(form){var params=$("#bootstrap-table").bootstrapTable("getOptions");params.queryParams=function(params){var search={};$.each($("#"+form).serializeArray(),function(i,field){search[field.name]=field.value});search.pageSize=params.limit;search.pageNum=params.offset/params.limit+1;search.searchValue=params.search;search.orderByColumn=params.sort;search.isAsc=params.order;return search};$("#bootstrap-table").bootstrapTable("refresh",params)},exportExcel:function(form){$.post($.table._option.exportUrl,$("#"+form).serializeArray(),function(result){if(result.code==web_status.SUCCESS){window.location.href=ctx+"common/download?fileName="+result.msg+"&delete="+true}else{$.modal.alertError(result.msg)}})},refresh:function(){$("#bootstrap-table").bootstrapTable("refresh",{url:$.table._option.url,silent:true})},selectColumns:function(column){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[column]})},selectFirstColumns:function(){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[$.table._option.columns[1].field]})}},treeTable:{_option:{},_treeTable:{},init:function(options){$.table._option=options;var treeTable=$("#bootstrap-table").bootstrapTreeTable({code:options.id,parentCode:options.parentId,type:"get",url:options.url,ajaxParams:{},expandColumn:"0",striped:false,bordered:true,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:{selectCheckeds:function(name){var checkeds="";$('input:checkbox[name="'+name+'"]:checked').each(function(i){if(0==i){checkeds=$(this).val()}else{checkeds+=(","+$(this).val())}});return checkeds},selectSelects:function(name){var selects="";$("#"+name+" option:selected").each(function(i){if(0==i){selects=$(this).val()}else{selects+=(","+$(this).val())}});return selects}},modal:{icon:function(type){var icon="";if(type==modal_status.WARNING){icon=0}else{if(type==modal_status.SUCCESS){icon=1}else{if(type==modal_status.FAIL){icon=2}else{icon=3}}}return icon},msg:function(content,type){if(type!=undefined){layer.msg(content,{icon:$.modal.icon(type),time:1000,shift:5})}else{layer.msg(content)}},msgError:function(content){$.modal.msg(content,modal_status.FAIL)},msgSuccess:function(content){$.modal.msg(content,modal_status.SUCCESS)},msgWarning:function(content){$.modal.msg(content,modal_status.WARNING)},alert:function(content,type){layer.alert(content,{icon:$.modal.icon(type),title:"系统提示",btn:["确认"],btnclass:["btn btn-primary"],})},msgReload:function(msg,type){layer.msg(msg,{icon:$.modal.icon(type),time:500,shade:[0.1,"#8F8F8F"]},function(){$.modal.reload()})},alertError:function(content){$.modal.alert(content,modal_status.FAIL)},alertSuccess:function(content){$.modal.alert(content,modal_status.SUCCESS)},alertWarning:function(content){$.modal.alert(content,modal_status.WARNING)},close:function(){var index=parent.layer.getFrameIndex(window.name);parent.layer.close(index)},confirm:function(content,callBack){layer.confirm(content,{icon:3,title:"系统提示",btn:["确认","取消"],btnclass:["btn btn-primary","btn btn-danger"],},function(index){layer.close(index);callBack(true)})},open:function(title,url,width,height){if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url})},openFull:function(title,url,width,height){if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}var index=layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url});layer.full(index)},loading:function(message){$.blockUI({message:'
'+message+"
"})},closeLoading:function(){setTimeout(function(){$.unblockUI()},50)},reload:function(){parent.location.reload()}},operate:{submit:function(url,type,dataType,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:type,dataType:dataType,data:data,success:function(result){$.operate.ajaxSuccess(result)}};$.ajax(config)},post:function(url,data){$.operate.submit(url,"post","json",data)},remove:function(id){$.modal.confirm("确定删除该条"+$.table._option.modalName+"信息吗?",function(){var url=$.common.isEmpty(id)?$.table._option.removeUrl:$.table._option.removeUrl.replace("{id}",id);var data={"ids":id};$.operate.submit(url,"post","json",data)})},batRemove:function(){var rows=$.common.isEmpty($.table._option.id)?$.table.selectFirstColumns():$.table.selectColumns($.table._option.id);if(rows.length==0){$.modal.alertWarning("请至少选择一条记录");return}$.modal.confirm("确认要删除选中的"+rows.length+"条数据吗?",function(){var url=$.table._option.removeUrl;var data={"ids":rows.join()};$.operate.submit(url,"post","json",data)})},add:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.open("添加"+$.table._option.modalName,url)},edit:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.open("修改"+$.table._option.modalName,url)},addFull:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.openFull("添加"+$.table._option.modalName,url)},editFull:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.openFull("修改"+$.table._option.modalName,url)},save:function(url,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:"post",dataType:"json",data:data,success:function(result){$.operate.saveSuccess(result)}};$.ajax(config)},ajaxSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgSuccess(result.msg);$.table.refresh()}else{$.modal.alertError(result.msg)}$.modal.closeLoading()},saveSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgReload("保存成功,正在刷新数据请稍后……",modal_status.SUCCESS)}else{$.modal.alertError(result.msg)}$.modal.closeLoading()}},common:{isEmpty:function(value){if(value==null||this.trim(value)==""){return true}return false},visible:function(value){if($.common.isEmpty(value)||value==true){return true}return false},trim:function(value){if(value==null){return""}return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g,"")},random:function(min,max){return Math.floor((Math.random()*max)+min)}}})})(jQuery);web_status={SUCCESS:0,FAIL:500};modal_status={SUCCESS:"success",FAIL:"error",WARNING:"warning"}; \ No newline at end of file diff --git a/src/main/resources/templates/system/dept/dept.html b/src/main/resources/templates/system/dept/dept.html index 6d85c3ab..82ef9c76 100644 --- a/src/main/resources/templates/system/dept/dept.html +++ b/src/main/resources/templates/system/dept/dept.html @@ -3,20 +3,39 @@ xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> - -
-
\ No newline at end of file diff --git a/src/main/resources/templates/system/menu/menu.html b/src/main/resources/templates/system/menu/menu.html index d6b3ac9e..b5c15a42 100644 --- a/src/main/resources/templates/system/menu/menu.html +++ b/src/main/resources/templates/system/menu/menu.html @@ -2,21 +2,42 @@ - -
- +