From 28dd8a0deed99b8441803ee83e10606b4be8b4de Mon Sep 17 00:00:00 2001 From: cyf783 Date: Fri, 27 Jul 2018 23:16:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0treetable=EF=BC=8C=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E7=9A=84=E6=96=B9=E6=A1=88=E6=95=B0=E6=8D=AE=E9=87=8F?= =?UTF-8?q?=E5=A4=A7=E6=80=A7=E8=83=BD=E5=A4=AA=E5=B7=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bootstrap-treetable.css | 12 + .../bootstrap-treetable.js | 322 +++++++++ .../ajax/libs/jqTreeGrid/jquery.treegrid.css | 16 - .../jqTreeGrid/jquery.treegrid.extension.js | 258 -------- .../ajax/libs/jqTreeGrid/jquery.treegrid.js | 619 ------------------ .../libs/jqTreeGrid/jquery.treegrid.min.js | 2 - src/main/resources/templates/include.html | 5 +- .../resources/templates/system/dept/dept.html | 4 +- .../resources/templates/system/menu/menu.html | 8 +- 9 files changed, 342 insertions(+), 904 deletions(-) create mode 100644 src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css create mode 100644 src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js delete mode 100644 src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.css delete mode 100644 src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.extension.js delete mode 100644 src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.js delete mode 100644 src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.min.js diff --git a/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css b/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css new file mode 100644 index 000000000..c6091d4cc --- /dev/null +++ b/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css @@ -0,0 +1,12 @@ +.bootstrap-tree-table .treetable-indent {width:16px; height: 16px; display: inline-block; position: relative;} +.bootstrap-tree-table .treetable-expander {width:16px; height: 16px; display: inline-block; position: relative; cursor: pointer;} +.bootstrap-tree-table .treetable-expander-expanded{background-image: url(img/collapse.png); } +.bootstrap-tree-table .treetable-expander-collapsed{background-image: url(img/expand.png);} +.bootstrap-tree-table .treetable-selected{background: #f5f5f5 !important;} +.bootstrap-tree-table .treetable-table{border:0 !important;margin-bottom:0} +.bootstrap-tree-table .treetable-table tbody {display:block;height:auto;overflow-y:auto;} +.bootstrap-tree-table .treetable-table thead, .treetable-table tbody tr {display:table;width:100%;table-layout:fixed;} +.bootstrap-tree-table .treetable-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;} +.bootstrap-tree-table .treetable-thead tr :first-child{border-left:0 !important} +.bootstrap-tree-table .treetable-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;} +.bootstrap-tree-table .treetable-tbody tr :first-child{border-left:0 !important} \ No newline at end of file diff --git a/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js b/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js new file mode 100644 index 000000000..82e791a2a --- /dev/null +++ b/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js @@ -0,0 +1,322 @@ +/** + * bootstrapTreeTable + * + * @author swifly + */ +(function($) { + "use strict"; + + $.fn.bootstrapTreeTable = function(options, param) { + var allData = null;//用于存放格式化后的数据 + // 如果是调用方法 + if (typeof options == 'string') { + return $.fn.bootstrapTreeTable.methods[options](this, param); + } + // 如果是初始化组件 + options = $.extend({}, $.fn.bootstrapTreeTable.defaults, options || {}); + // 是否有radio或checkbox + var hasSelectItem = false; + var target = $(this); + // 在外层包装一下div,样式用的bootstrap-table的 + var _main_div = $("
"); + target.before(_main_div); + _main_div.append(target); + target.addClass("table table-hover treetable-table table-bordered"); + if (options.striped) { + target.addClass('table-striped'); + } + // 工具条在外层包装一下div,样式用的bootstrap-table的 + if(options.toolbar){ + var _tool_div = $("
"); + var _tool_left_div = $("
"); + _tool_left_div.append($(options.toolbar)); + _tool_div.append(_tool_left_div); + _main_div.before(_tool_div); + } + // 格式化数据,优化性能 + target.formatData=function(data){ + var _root = options.rootCodeValue?options.rootCodeValue:null + $.each(data, function(index, item) { + // 添加一个默认属性,用来判断当前节点有没有被显示 + item.isShow = false; + // 这里兼容几种常见Root节点写法 + // 默认的几种判断 + var _defaultRootFlag = item[options.parentCode] == '0' + || item[options.parentCode] == 0 + || item[options.parentCode] == null + || item[options.parentCode] == ''; + if (!item[options.parentCode] || (_root?(item[options.parentCode] == options.rootCodeValue):_defaultRootFlag)){ + if(!allData["_root_"]){allData["_root_"]=[];} + allData["_root_"].push(item); + }else{ + if(!allData["_n_"+item[options.parentCode]]){allData["_n_"+item[options.parentCode]]=[];} + allData["_n_"+item[options.parentCode]].push(item); + } + }); + data=null;//回收 + } + // 得到根节点 + target.getRootNodes = function() { + return allData["_root_"]; + }; + // 递归获取子节点并且设置子节点 + target.handleNode = function(parentNode, lv, row_id, p_id, tbody) { + var _ls = allData["_n_"+parentNode[options.code]]; + var tr = target.renderRow(parentNode,_ls?true:false,lv,row_id,p_id); + tbody.append(tr); + if(_ls){ + $.each(_ls, function(i, item) { + var _row_id = row_id+"_"+i + target.handleNode(item, (lv + 1), _row_id,row_id, tbody) + }); + } + }; + // 绘制行 + target.renderRow = function(item,isP,lv,row_id,p_id){ + // 标记已显示 + item.isShow = true; + var tr = $(''); + var _icon = options.expanderCollapsedClass; + if(options.expandAll){ + tr.css("display","table"); + _icon = options.expanderExpandedClass; + }else if(options.expandFirst&&lv<=2){ + tr.css("display","table"); + _icon=(lv==1)?options.expanderExpandedClass:options.expanderCollapsedClass; + }else{ + tr.css("display","none"); + _icon = options.expanderCollapsedClass; + } + $.each(options.columns, function(index, column) { + // 判断有没有选择列 + if(column.field=='selectItem'){ + hasSelectItem = true; + var td = $(''); + if(column.radio){ + var _ipt = $(''); + td.append(_ipt); + } + if(column.checkbox){ + var _ipt = $(''); + td.append(_ipt); + } + tr.append(td); + }else{ + var td = $(''); + // 增加formatter渲染 + if (column.formatter) { + td.html(column.formatter.call(this, item[column.field], item, index)); + } else { + td.text(item[column.field]); + } + if(options.expandColumn==index){ + if(!isP){ + td.prepend('') + }else{ + td.prepend('') + } + for (var int = 0; int < (lv-1); int++) { + td.prepend('') + } + } + tr.append(td); + } + }); + return tr; + } + // 加载数据 + target.load = function(parms){ + // 加载数据前先清空 + allData = {}; + // 加载数据前先清空 + target.html(""); + // 构造表头 + var thr = $(''); + $.each(options.columns, function(i, item) { + var th = null; + // 判断有没有选择列 + if(i==0&&item.field=='selectItem'){ + hasSelectItem = true; + th = $(''); + }else{ + th = $(''); + } + th.text(item.title); + thr.append(th); + }); + var thead = $(''); + thead.append(thr); + target.append(thead); + // 构造表体 + var tbody = $(''); + target.append(tbody); + // 添加加载loading + var _loading = '
正在努力地加载数据中,请稍候……
' + tbody.html(_loading); + // 默认高度 + if(options.height){ + tbody.css("height",options.height); + } + $.ajax({ + type : options.type, + url : options.url, + data : parms?parms:options.ajaxParams, + dataType : "JSON", + success : function(data, textStatus, jqXHR) { + // 加载完数据先清空 + tbody.html(""); + if(!data||data.length<=0){ + var _empty = '
没有找到匹配的记录
' + tbody.html(_empty); + return; + } + // 格式化数据 + target.formatData(data); + // 开始绘制 + var rootNode = target.getRootNodes(); + if(rootNode){ + $.each(rootNode, function(i, item) { + var _row_id = "row_id_"+i + target.handleNode(item, 1, _row_id,"row_root", tbody); + }); + } + // 下边的操作主要是为了查询时让一些没有根节点的节点显示 + $.each(data, function(i, item) { + if(!item.isShow){ + var tr = target.renderRow(item,false,1); + tbody.append(tr); + } + }); + target.append(tbody); + //动态设置表头宽度 + thead.css("width", tbody.children(":first").css("width")); + // 行点击选中事件 + target.find("tbody").find("tr").click(function(){ + if(hasSelectItem){ + var _ipt = $(this).find("input[name='select_item']"); + if(_ipt.attr("type")=="radio"){ + _ipt.prop('checked',true); + target.find("tbody").find("tr").removeClass("treetable-selected"); + $(this).addClass("treetable-selected"); + }else{ + if(_ipt.prop('checked')){ + _ipt.prop('checked',false); + $(this).removeClass("treetable-selected"); + }else{ + _ipt.prop('checked',true); + $(this).addClass("treetable-selected"); + } + } + } + }); + // 小图标点击事件--展开缩起 + target.find("tbody").find("tr").find(".treetable-expander").click(function(){ + var _flag = $(this).hasClass(options.expanderExpandedClass); + var tr = $(this).parent().parent(); + var row_id = tr.attr("id"); + if(_flag){ + var _ls = target.find("tbody").find("tr[id^='"+row_id+"_']");//下所有 + if(_ls&&_ls.length>0){ + $.each(_ls, function(index, item) { + $(item).css("display","none"); + var _icon = $(item).children().eq(options.expandColumn).find(".treetable-expander"); + if(_icon.hasClass(options.expanderExpandedClass)){ + _icon.removeClass(options.expanderExpandedClass) + _icon.addClass(options.expanderCollapsedClass) + } + }); + } + $(this).removeClass(options.expanderExpandedClass) + $(this).addClass(options.expanderCollapsedClass) + }else{ + var _ls = target.find("tbody").find("tr[pid='"+row_id+"']");//下一级 + if(_ls&&_ls.length>0){ + $.each(_ls, function(index, item) { + $(item).css("display","table"); + }); + } + $(this).removeClass(options.expanderCollapsedClass) + $(this).addClass(options.expanderExpandedClass) + } + }); + }, + error:function(xhr,textStatus){ + var _errorMsg = '
'+xhr.responseText+'
' + tbody.html(_errorMsg); + debugger; + }, + }); + } + if (options.url) { + target.load(); + } else { + // 也可以通过defaults里面的data属性通过传递一个数据集合进来对组件进行初始化....有兴趣可以自己实现,思路和上述类似 + } + + return target; + }; + + // 组件方法封装........ + $.fn.bootstrapTreeTable.methods = { + // 返回选中记录的id(返回的id由配置中的id属性指定) + // 为了兼容bootstrap-table的写法,统一返回数组,这里只返回了指定的id + getSelections : function(target, data) { + // 所有被选中的记录input + var _ipt = target.find("tbody").find("tr").find("input[name='select_item']:checked"); + var chk_value =[]; + // 如果是radio + if(_ipt.attr("type")=="radio"){ + var _data = {id:_ipt.val()}; + var _tds = _ipt.parent().parent().find("td"); + _tds.each(function(_i,_item){ + if(_i!=0){ + _data[$(_item).attr("name")]=$(_item).attr("title"); + } + }); + chk_value.push(_data); + }else{ + _ipt.each(function(_i,_item){ + var _data = {id:$(_item).val()}; + var _tds = $(_item).parent().parent().find("td"); + _tds.each(function(_ii,_iitem){ + if(_ii!=0){ + _data[$(_iitem).attr("name")]=$(_iitem).attr("title"); + } + }); + chk_value.push(_data); + }); + } + return chk_value; + }, + // 刷新记录 + refresh : function(target, parms) { + if(parms){ + target.load(parms); + }else{ + target.load(); + } + }, + // 组件的其他方法也可以进行类似封装........ + }; + + $.fn.bootstrapTreeTable.defaults = { + id : 'id',// 选取记录返回的值 + code : 'id',// 用于设置父子关系 + parentCode : 'parentId',// 用于设置父子关系 + rootCodeValue: null,//设置根节点code值----可指定根节点,默认为null,"",0,"0" + data : [], // 构造table的数据集合 + type : "GET", // 请求数据的ajax类型 + url : null, // 请求数据的ajax的url + ajaxParams : {}, // 请求数据的ajax的data属性 + expandColumn : 1,// 在哪一列上面显示展开按钮 + expandAll : false, // 是否全部展开 + expandFirst : true, // 是否默认第一级展开--expandAll为false时生效 + striped : false, // 是否各行渐变色 + columns : [], + toolbar: null,//顶部工具条 + height: 0, + expanderExpandedClass : 'glyphicon glyphicon-chevron-down',// 展开的按钮的图标 + expanderCollapsedClass : 'glyphicon glyphicon-chevron-right'// 缩起的按钮的图标 + + }; +})(jQuery); \ No newline at end of file diff --git a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.css b/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.css deleted file mode 100644 index a1d7965b3..000000000 --- a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.css +++ /dev/null @@ -1,16 +0,0 @@ -.treegrid-indent {width:16px; height: 16px; display: inline-block; position: relative;} - -.treegrid-expander {width:16px; height: 16px; display: inline-block; position: relative; cursor: pointer;} - -.treegrid-expander-expanded{background-image: url(img/collapse.png); } -.treegrid-expander-collapsed{background-image: url(img/expand.png);} -.treegrid-selected{background: #f5f5f5 !important;} -.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: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: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 deleted file mode 100644 index ba5bc85c1..000000000 --- a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.extension.js +++ /dev/null @@ -1,258 +0,0 @@ -(function($) { - "use strict"; - - $.fn.bootstrapTreeTable = function(options, param) { - // 如果是调用方法 - if (typeof options == 'string') { - return $.fn.bootstrapTreeTable.methods[options](this, param); - } - - // 如果是初始化组件 - options = $.extend({}, $.fn.bootstrapTreeTable.defaults, options || {}); - // 是否有radio或checkbox - var hasSelectItem = false; - var target = $(this); - // 在外层包装一下div,样式用的bootstrap-table的 - var _main_div = $("
"); - target.before(_main_div); - _main_div.append(target); - target.addClass("table table-hover treegrid-table"); - if (options.striped) { - target.addClass('table-striped'); - } - // 工具条在外层包装一下div,样式用的bootstrap-table的 - if(options.toolbar){ - var _tool_div = $("
"); - var _tool_left_div = $("
"); - _tool_left_div.append($(options.toolbar)); - _tool_div.append(_tool_left_div); - _main_div.before(_tool_div); - } - // 得到根节点 - target.getRootNodes = function(data) { - // 指定Root节点值 - var _root = options.rootCodeValue?options.rootCodeValue:null - var result = []; - $.each(data, function(index, item) { - // 这里兼容几种常见Root节点写法 - // 默认的几种判断 - var _defaultRootFlag = item[options.parentCode] == '0' - || item[options.parentCode] == 0 - || item[options.parentCode] == null - || item[options.parentCode] == ''; - if (!item[options.parentCode] || (_root?(item[options.parentCode] == options.rootCodeValue):_defaultRootFlag)){ - result.push(item); - } - // 添加一个默认属性,用来判断当前节点有没有被显示 - item.isShow = false; - }); - return result; - }; - var j = 0; - // 递归获取子节点并且设置子节点 - target.getChildNodes = function(data, parentNode, parentIndex, tbody) { - $.each(data, function(i, item) { - if (item[options.parentCode] == parentNode[options.code]) { - var tr = $(''); - var nowParentIndex = (parentIndex + (j++) + 1); - tr.addClass('treegrid-' + nowParentIndex); - tr.addClass('treegrid-parent-' + parentIndex); - target.renderRow(tr,item); - item.isShow = true; - tbody.append(tr); - target.getChildNodes(data, item, nowParentIndex, tbody) - - } - }); - }; - // 绘制行 - target.renderRow = function(tr,item){ - $.each(options.columns, function(index, column) { - // 判断有没有选择列 - if(index==0&&column.field=='selectItem'){ - hasSelectItem = true; - var td = $(''); - if(column.radio){ - var _ipt = $(''); - td.append(_ipt); - } - if(column.checkbox){ - var _ipt = $(''); - td.append(_ipt); - } - tr.append(td); - }else{ - var td = $(''); - // 增加formatter渲染 - if (column.formatter) { - td.html(column.formatter.call(this, item, index)); - } else { - td.text(item[column.field]); - } - tr.append(td); - } - }); - } - // 加载数据 - target.load = function(parms){ - // 加载数据前先清空 - target.html(""); - // 构造表头 - var thr = $(''); - $.each(options.columns, function(i, item) { - var th = null; - // 判断有没有选择列 - if(i==0&&item.field=='selectItem'){ - hasSelectItem = true; - th = $(''); - }else{ - th = $(''); - } - th.text(item.title); - thr.append(th); - }); - var thead = $(''); - thead.append(thr); - target.append(thead); - // 构造表体 - var tbody = $(''); - target.append(tbody); - // 添加加载loading - var _loading = '
正在努力地加载数据中,请稍候……
' - tbody.html(_loading); - // 默认高度 - if(options.height){ - tbody.css("height",options.height); - } - $.ajax({ - type : options.type, - url : options.url, - data : parms?parms:options.ajaxParams, - dataType : "JSON", - success : function(data, textStatus, jqXHR) { - // 加载完数据先清空 - tbody.html(""); - if(!data||data.length<=0){ - var _empty = '
没有记录
' - tbody.html(_empty); - return; - } - var rootNode = target.getRootNodes(data); - $.each(rootNode, function(i, item) { - var tr = $(''); - tr.addClass('treegrid-' + (j + "_" + i)); - target.renderRow(tr,item); - item.isShow = true; - tbody.append(tr); - target.getChildNodes(data, item, (j + "_" + i), tbody); - }); - // 下边的操作主要是为了查询时让一些没有根节点的节点显示 - $.each(data, function(i, item) { - if(!item.isShow){ - var tr = $(''); - tr.addClass('treegrid-' + (j + "_" + i)); - target.renderRow(tr,item); - tbody.append(tr); - } - }); - target.append(tbody); - // 初始化treegrid - target.treegrid({ - treeColumn: options.expandColumn?options.expandColumn:(hasSelectItem?1:0),//如果有radio或checkbox默认第二列层级显示,当前是在用户未设置的提前下 - expanderExpandedClass : options.expanderExpandedClass, - expanderCollapsedClass : options.expanderCollapsedClass - }); - if (!options.expandAll) { - target.treegrid('collapseAll'); - } - //动态设置表头宽度 - //thead.css("width", tbody.children(":first").css("width")); - // 行点击选中事件 - target.find("tbody").find("tr").click(function(){ - if(hasSelectItem){ - var _ipt = $(this).find("input[name='select_item']"); - if(_ipt.attr("type")=="radio"){ - _ipt.prop('checked',true); - target.find("tbody").find("tr").removeClass("treegrid-selected"); - $(this).addClass("treegrid-selected"); - }else{ - if(_ipt.prop('checked')){ - _ipt.prop('checked',false); - $(this).removeClass("treegrid-selected"); - }else{ - _ipt.prop('checked',true); - $(this).addClass("treegrid-selected"); - } - } - } - }); - }, - error:function(xhr,textStatus){ - var _errorMsg = '
'+xhr.responseText+'
' - tbody.html(_errorMsg); - debugger; - }, - }); - } - if (options.url) { - target.load(); - } else { - // 也可以通过defaults里面的data属性通过传递一个数据集合进来对组件进行初始化....有兴趣可以自己实现,思路和上述类似 - } - - return target; - }; - - // 组件方法封装........ - $.fn.bootstrapTreeTable.methods = { - // 返回选中记录的id(返回的id由配置中的id属性指定) - // 为了兼容bootstrap-table的写法,统一返回数组,这里只返回了指定的id - getSelections : function(target, data) { - // 所有被选中的记录input - var _ipt = target.find("tbody").find("tr").find("input[name='select_item']:checked"); - var chk_value =[]; - // 如果是radio - if(_ipt.attr("type")=="radio"){ - chk_value.push({id:_ipt.val()}); - }else{ - _ipt.each(function(_i,_item){ - chk_value.push({id:$(_item).val()}); - }); - } - return chk_value; - }, - // 刷新记录 - refresh : function(target, parms) { - if(parms){ - target.load(parms); - }else{ - target.load(); - } - }, - // 重置表格视图 - resetHeight : function(target, height) { - target.find("tbody").css("height", height + 'px'); - } - // 组件的其他方法也可以进行类似封装........ - }; - - $.fn.bootstrapTreeTable.defaults = { - id : 'menuId',// 选取记录返回的值 - code : 'menuId',// 用于设置父子关系 - parentCode : 'parentId',// 用于设置父子关系 - rootCodeValue: null,//设置根节点code值----可指定根节点,默认为null,"",0,"0" - data : [], // 构造table的数据集合 - type : "GET", // 请求数据的ajax类型 - url : null, // 请求数据的ajax的url - ajaxParams : {}, // 请求数据的ajax的data属性 - expandColumn : null,// 在哪一列上面显示展开按钮 - expandAll : true, // 是否全部展开 - striped : false, // 是否各行渐变色 - columns : [], - toolbar: '#toolbar',//顶部工具条 - height: 0, - expanderExpandedClass : 'glyphicon glyphicon-chevron-down',// 展开的按钮的图标 - expanderCollapsedClass : 'glyphicon glyphicon-chevron-right'// 缩起的按钮的图标 - - }; -})(jQuery); \ No newline at end of file diff --git a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.js b/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.js deleted file mode 100644 index 1785e531a..000000000 --- a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.js +++ /dev/null @@ -1,619 +0,0 @@ -/* - * jQuery treegrid Plugin 0.2.0 - * https://github.com/maxazan/jquery-treegrid - * - * Copyright 2013, Pomazan Max - * Licensed under the MIT licenses. - */ -(function($) { - - var methods = { - /** - * Initialize tree - * - * @param {Object} options - * @returns {Object[]} - */ - initTree: function(options) { - var settings = $.extend({}, this.treegrid.defaults, options); - return this.each(function() { - var $this = $(this); - $this.treegrid('setTreeContainer', $(this)); - $this.treegrid('setSettings', settings); - settings.getRootNodes.apply(this, [$(this)]).treegrid('initNode', settings); - }); - }, - /** - * Initialize node - * - * @param {Object} settings - * @returns {Object[]} - */ - initNode: function(settings) { - return this.each(function() { - var $this = $(this); - $this.treegrid('setTreeContainer', settings.getTreeGridContainer.apply(this)); - $this.treegrid('getChildNodes').treegrid('initNode', settings); - $this.treegrid('initExpander').treegrid('initIndent').treegrid('initEvents').treegrid('initState').treegrid("initSettingsEvents"); - }); - }, - /** - * Initialize node events - * - * @returns {Node} - */ - initEvents: function() { - var $this = $(this); - //Save state on change - $this.on("change", function() { - var $this = $(this); - $this.treegrid('render'); - if ($this.treegrid('getSetting', 'saveState')) { - $this.treegrid('saveState'); - } - }); - //Default behavior on collapse - $this.on("collapse", function() { - var $this = $(this); - $this.removeClass('treegrid-expanded'); - $this.addClass('treegrid-collapsed'); - }); - //Default behavior on expand - $this.on("expand", function() { - var $this = $(this); - $this.removeClass('treegrid-collapsed'); - $this.addClass('treegrid-expanded'); - }); - - return $this; - }, - /** - * Initialize events from settings - * - * @returns {Node} - */ - initSettingsEvents: function() { - var $this = $(this); - //Save state on change - $this.on("change", function() { - var $this = $(this); - if (typeof ($this.treegrid('getSetting', 'onChange')) === "function") { - $this.treegrid('getSetting', 'onChange').apply($this); - } - }); - //Default behavior on collapse - $this.on("collapse", function() { - var $this = $(this); - if (typeof ($this.treegrid('getSetting', 'onCollapse')) === "function") { - $this.treegrid('getSetting', 'onCollapse').apply($this); - } - }); - //Default behavior on expand - $this.on("expand", function() { - var $this = $(this); - if (typeof ($this.treegrid('getSetting', 'onExpand')) === "function") { - $this.treegrid('getSetting', 'onExpand').apply($this); - } - - }); - - return $this; - }, - /** - * Initialize expander for node - * - * @returns {Node} - */ - initExpander: function() { - var $this = $(this); - var cell = $this.find('td').get($this.treegrid('getSetting', 'treeColumn')); - var tpl = $this.treegrid('getSetting', 'expanderTemplate'); - var expander = $this.treegrid('getSetting', 'getExpander').apply(this); - if (expander) { - expander.remove(); - } - $(tpl).prependTo(cell).click(function() { - $($(this).closest('tr')).treegrid('toggle'); - }); - return $this; - }, - /** - * Initialize indent for node - * - * @returns {Node} - */ - initIndent: function() { - var $this = $(this); - $this.find('.treegrid-indent').remove(); - for (var i = 0; i < $(this).treegrid('getDepth'); i++) { - $($this.treegrid('getSetting', 'indentTemplate')).insertBefore($this.find('.treegrid-expander')); - } - return $this; - }, - /** - * Initialise state of node - * - * @returns {Node} - */ - initState: function() { - var $this = $(this); - if ($this.treegrid('getSetting', 'saveState') && !$this.treegrid('isFirstInit')) { - $this.treegrid('restoreState'); - } else { - if ($this.treegrid('getSetting', 'initialState') === "expanded") { - $this.treegrid('expand'); - } else { - $this.treegrid('collapse'); - } - } - return $this; - }, - /** - * Return true if this tree was never been initialised - * - * @returns {Boolean} - */ - isFirstInit: function() { - var tree = $(this).treegrid('getTreeContainer'); - if (tree.data('first_init') === undefined) { - tree.data('first_init', $.cookie(tree.treegrid('getSetting', 'saveStateName')) === undefined); - } - return tree.data('first_init'); - }, - /** - * Save state of current node - * - * @returns {Node} - */ - saveState: function() { - var $this = $(this); - if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') { - - var stateArrayString = $.cookie($this.treegrid('getSetting', 'saveStateName')) || ''; - var stateArray = (stateArrayString === '' ? [] : stateArrayString.split(',')); - var nodeId = $this.treegrid('getNodeId'); - - if ($this.treegrid('isExpanded')) { - if ($.inArray(nodeId, stateArray) === -1) { - stateArray.push(nodeId); - } - } else if ($this.treegrid('isCollapsed')) { - if ($.inArray(nodeId, stateArray) !== -1) { - stateArray.splice($.inArray(nodeId, stateArray), 1); - } - } - $.cookie($this.treegrid('getSetting', 'saveStateName'), stateArray.join(',')); - } - return $this; - }, - /** - * Restore state of current node. - * - * @returns {Node} - */ - restoreState: function() { - var $this = $(this); - if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') { - var stateArray = $.cookie($this.treegrid('getSetting', 'saveStateName')).split(','); - if ($.inArray($this.treegrid('getNodeId'), stateArray) !== -1) { - $this.treegrid('expand'); - } else { - $this.treegrid('collapse'); - } - - } - return $this; - }, - /** - * Method return setting by name - * - * @param {type} name - * @returns {unresolved} - */ - getSetting: function(name) { - if (!$(this).treegrid('getTreeContainer')) { - return null; - } - return $(this).treegrid('getTreeContainer').data('settings')[name]; - }, - /** - * Add new settings - * - * @param {Object} settings - */ - setSettings: function(settings) { - $(this).treegrid('getTreeContainer').data('settings', settings); - }, - /** - * Return tree container - * - * @returns {HtmlElement} - */ - getTreeContainer: function() { - return $(this).data('treegrid'); - }, - /** - * Set tree container - * - * @param {HtmlE;ement} container - */ - setTreeContainer: function(container) { - return $(this).data('treegrid', container); - }, - /** - * Method return all root nodes of tree. - * - * Start init all child nodes from it. - * - * @returns {Array} - */ - getRootNodes: function() { - return $(this).treegrid('getSetting', 'getRootNodes').apply(this, [$(this).treegrid('getTreeContainer')]); - }, - /** - * Method return all nodes of tree. - * - * @returns {Array} - */ - getAllNodes: function() { - return $(this).treegrid('getSetting', 'getAllNodes').apply(this, [$(this).treegrid('getTreeContainer')]); - }, - /** - * Mthod return true if element is Node - * - * @returns {String} - */ - isNode: function() { - return $(this).treegrid('getNodeId') !== null; - }, - /** - * Mthod return id of node - * - * @returns {String} - */ - getNodeId: function() { - if ($(this).treegrid('getSetting', 'getNodeId') === null) { - return null; - } else { - return $(this).treegrid('getSetting', 'getNodeId').apply(this); - } - }, - /** - * Method return parent id of node or null if root node - * - * @returns {String} - */ - getParentNodeId: function() { - return $(this).treegrid('getSetting', 'getParentNodeId').apply(this); - }, - /** - * Method return parent node or null if root node - * - * @returns {Object[]} - */ - getParentNode: function() { - if ($(this).treegrid('getParentNodeId') === null) { - return null; - } else { - return $(this).treegrid('getSetting', 'getNodeById').apply(this, [$(this).treegrid('getParentNodeId'), $(this).treegrid('getTreeContainer')]); - } - }, - /** - * Method return array of child nodes or null if node is leaf - * - * @returns {Object[]} - */ - getChildNodes: function() { - return $(this).treegrid('getSetting', 'getChildNodes').apply(this, [$(this).treegrid('getNodeId'), $(this).treegrid('getTreeContainer')]); - }, - /** - * Method return depth of tree. - * - * This method is needs for calculate indent - * - * @returns {Number} - */ - getDepth: function() { - if ($(this).treegrid('getParentNode') === null) { - return 0; - } - return $(this).treegrid('getParentNode').treegrid('getDepth') + 1; - }, - /** - * Method return true if node is root - * - * @returns {Boolean} - */ - isRoot: function() { - return $(this).treegrid('getDepth') === 0; - }, - /** - * Method return true if node has no child nodes - * - * @returns {Boolean} - */ - isLeaf: function() { - return $(this).treegrid('getChildNodes').length === 0; - }, - /** - * Method return true if node last in branch - * - * @returns {Boolean} - */ - isLast: function() { - if ($(this).treegrid('isNode')) { - var parentNode = $(this).treegrid('getParentNode'); - if (parentNode === null) { - if ($(this).treegrid('getNodeId') === $(this).treegrid('getRootNodes').last().treegrid('getNodeId')) { - return true; - } - } else { - if ($(this).treegrid('getNodeId') === parentNode.treegrid('getChildNodes').last().treegrid('getNodeId')) { - return true; - } - } - } - return false; - }, - /** - * Method return true if node first in branch - * - * @returns {Boolean} - */ - isFirst: function() { - if ($(this).treegrid('isNode')) { - var parentNode = $(this).treegrid('getParentNode'); - if (parentNode === null) { - if ($(this).treegrid('getNodeId') === $(this).treegrid('getRootNodes').first().treegrid('getNodeId')) { - return true; - } - } else { - if ($(this).treegrid('getNodeId') === parentNode.treegrid('getChildNodes').first().treegrid('getNodeId')) { - return true; - } - } - } - return false; - }, - /** - * Return true if node expanded - * - * @returns {Boolean} - */ - isExpanded: function() { - return $(this).hasClass('treegrid-expanded'); - }, - /** - * Return true if node collapsed - * - * @returns {Boolean} - */ - isCollapsed: function() { - return $(this).hasClass('treegrid-collapsed'); - }, - /** - * Return true if at least one of parent node is collapsed - * - * @returns {Boolean} - */ - isOneOfParentsCollapsed: function() { - var $this = $(this); - if ($this.treegrid('isRoot')) { - return false; - } else { - if ($this.treegrid('getParentNode').treegrid('isCollapsed')) { - return true; - } else { - return $this.treegrid('getParentNode').treegrid('isOneOfParentsCollapsed'); - } - } - }, - /** - * Expand node - * - * @returns {Node} - */ - expand: function() { - return $(this).each(function() { - var $this = $(this); - if (!$this.treegrid('isLeaf') && !$this.treegrid("isExpanded")) { - $this.trigger("expand"); - $this.trigger("change"); - } - }); - }, - /** - * Expand all nodes - * - * @returns {Node} - */ - expandAll: function() { - var $this = $(this); - $this.treegrid('getRootNodes').treegrid('expandRecursive'); - return $this; - }, - /** - * Expand current node and all child nodes begin from current - * - * @returns {Node} - */ - expandRecursive: function() { - return $(this).each(function() { - var $this = $(this); - $this.treegrid('expand'); - if (!$this.treegrid('isLeaf')) { - $this.treegrid('getChildNodes').treegrid('expandRecursive'); - } - }); - }, - /** - * Collapse node - * - * @returns {Node} - */ - collapse: function() { - return $(this).each(function() { - var $this = $(this); - if (!$this.treegrid('isLeaf') && !$this.treegrid("isCollapsed")) { - $this.trigger("collapse"); - $this.trigger("change"); - } - }); - }, - /** - * Collapse all nodes - * - * @returns {Node} - */ - collapseAll: function() { - var $this = $(this); - $this.treegrid('getRootNodes').treegrid('collapseRecursive'); - return $this; - }, - /** - * Collapse current node and all child nodes begin from current - * - * @returns {Node} - */ - collapseRecursive: function() { - return $(this).each(function() { - var $this = $(this); - $this.treegrid('collapse'); - if (!$this.treegrid('isLeaf')) { - $this.treegrid('getChildNodes').treegrid('collapseRecursive'); - } - }); - }, - /** - * Expand if collapsed, Collapse if expanded - * - * @returns {Node} - */ - toggle: function() { - var $this = $(this); - if ($this.treegrid('isExpanded')) { - $this.treegrid('collapse'); - } else { - $this.treegrid('expand'); - } - return $this; - }, - /** - * Rendering node - * - * @returns {Node} - */ - render: function() { - return $(this).each(function() { - var $this = $(this); - - if ($this.treegrid('isOneOfParentsCollapsed')) { - $this.hide(); - } else { - $this.show(); - } - if (!$this.treegrid('isLeaf')) { - $this.treegrid('renderExpander'); - $this.treegrid('getChildNodes').treegrid('render'); - } - }); - }, - /** - * Rendering expander depends on node state - * - * @returns {Node} - */ - renderExpander: function() { - return $(this).each(function() { - var $this = $(this); - var expander = $this.treegrid('getSetting', 'getExpander').apply(this); - if (expander) { - - if (!$this.treegrid('isCollapsed')) { - expander.removeClass($this.treegrid('getSetting', 'expanderCollapsedClass')); - expander.addClass($this.treegrid('getSetting', 'expanderExpandedClass')); - } else { - expander.removeClass($this.treegrid('getSetting', 'expanderExpandedClass')); - expander.addClass($this.treegrid('getSetting', 'expanderCollapsedClass')); - } - } else { - $this.treegrid('initExpander'); - $this.treegrid('renderExpander'); - } - }); - } - }; - $.fn.treegrid = function(method) { - if (methods[method]) { - return methods[ method ].apply(this, Array.prototype.slice.call(arguments, 1)); - } else if (typeof method === 'object' || !method) { - return methods.initTree.apply(this, arguments); - } else { - $.error('Method with name ' + method + ' does not exists for jQuery.treegrid'); - } - }; - /** - * Plugin's default options - */ - $.fn.treegrid.defaults = { - initialState: 'expanded', - saveState: false, - saveStateMethod: 'cookie', - saveStateName: 'tree-grid-state', - expanderTemplate: '', - indentTemplate: '', - expanderExpandedClass: 'treegrid-expander-expanded', - expanderCollapsedClass: 'treegrid-expander-collapsed', - treeColumn: 0, - getExpander: function() { - return $(this).find('.treegrid-expander'); - }, - getNodeId: function() { - var template = /treegrid-([A-Za-z0-9_-]+)/; - if (template.test($(this).attr('class'))) { - return template.exec($(this).attr('class'))[1]; - } - return null; - }, - getParentNodeId: function() { - var template = /treegrid-parent-([A-Za-z0-9_-]+)/; - if (template.test($(this).attr('class'))) { - return template.exec($(this).attr('class'))[1]; - } - return null; - }, - getNodeById: function(id, treegridContainer) { - var templateClass = "treegrid-" + id; - return treegridContainer.find('tr.' + templateClass); - }, - getChildNodes: function(id, treegridContainer) { - var templateClass = "treegrid-parent-" + id; - return treegridContainer.find('tr.' + templateClass); - }, - getTreeGridContainer: function() { - return $(this).closest('table'); - }, - getRootNodes: function(treegridContainer) { - var result = $.grep(treegridContainer.find('tr'), function(element) { - var classNames = $(element).attr('class'); - var templateClass = /treegrid-([A-Za-z0-9_-]+)/; - var templateParentClass = /treegrid-parent-([A-Za-z0-9_-]+)/; - return templateClass.test(classNames) && !templateParentClass.test(classNames); - }); - return $(result); - }, - getAllNodes: function(treegridContainer) { - var result = $.grep(treegridContainer.find('tr'), function(element) { - var classNames = $(element).attr('class'); - var templateClass = /treegrid-([A-Za-z0-9_-]+)/; - return templateClass.test(classNames); - }); - return $(result); - }, - //Events - onCollapse: null, - onExpand: null, - onChange: null - - }; -})(jQuery); \ No newline at end of file diff --git a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.min.js b/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.min.js deleted file mode 100644 index eacd2fd02..000000000 --- a/src/main/resources/static/ajax/libs/jqTreeGrid/jquery.treegrid.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jquery-treegrid 0.3.0 */ -!function(a){var b={initTree:function(b){var c=a.extend({},this.treegrid.defaults,b);return this.each(function(){var b=a(this);b.treegrid("setTreeContainer",a(this)),b.treegrid("setSettings",c),c.getRootNodes.apply(this,[a(this)]).treegrid("initNode",c),b.treegrid("getRootNodes").treegrid("render")})},initNode:function(b){return this.each(function(){var c=a(this);c.treegrid("setTreeContainer",b.getTreeGridContainer.apply(this)),c.treegrid("getChildNodes").treegrid("initNode",b),c.treegrid("initExpander").treegrid("initIndent").treegrid("initEvents").treegrid("initState").treegrid("initChangeEvent").treegrid("initSettingsEvents")})},initChangeEvent:function(){var b=a(this);return b.on("change",function(){var b=a(this);b.treegrid("render"),b.treegrid("getSetting","saveState")&&b.treegrid("saveState")}),b},initEvents:function(){var b=a(this);return b.on("collapse",function(){var b=a(this);b.removeClass("treegrid-expanded"),b.addClass("treegrid-collapsed")}),b.on("expand",function(){var b=a(this);b.removeClass("treegrid-collapsed"),b.addClass("treegrid-expanded")}),b},initSettingsEvents:function(){var b=a(this);return b.on("change",function(){var b=a(this);"function"==typeof b.treegrid("getSetting","onChange")&&b.treegrid("getSetting","onChange").apply(b)}),b.on("collapse",function(){var b=a(this);"function"==typeof b.treegrid("getSetting","onCollapse")&&b.treegrid("getSetting","onCollapse").apply(b)}),b.on("expand",function(){var b=a(this);"function"==typeof b.treegrid("getSetting","onExpand")&&b.treegrid("getSetting","onExpand").apply(b)}),b},initExpander:function(){var b=a(this),c=b.find("td").get(b.treegrid("getSetting","treeColumn")),d=b.treegrid("getSetting","expanderTemplate"),e=b.treegrid("getSetting","getExpander").apply(this);return e&&e.remove(),a(d).prependTo(c).click(function(){a(a(this).closest("tr")).treegrid("toggle")}),b},initIndent:function(){var b=a(this);b.find(".treegrid-indent").remove();for(var c=b.treegrid("getSetting","indentTemplate"),d=b.find(".treegrid-expander"),e=b.treegrid("getDepth"),f=0;e>f;f++)a(c).insertBefore(d);return b},initState:function(){var b=a(this);return b.treegrid(b.treegrid("getSetting","saveState")&&!b.treegrid("isFirstInit")?"restoreState":"expanded"===b.treegrid("getSetting","initialState")?"expand":"collapse"),b},isFirstInit:function(){var b=a(this).treegrid("getTreeContainer");return void 0===b.data("first_init")&&b.data("first_init",void 0===a.cookie(b.treegrid("getSetting","saveStateName"))),b.data("first_init")},saveState:function(){var b=a(this);if("cookie"===b.treegrid("getSetting","saveStateMethod")){var c=a.cookie(b.treegrid("getSetting","saveStateName"))||"",d=""===c?[]:c.split(","),e=b.treegrid("getNodeId");b.treegrid("isExpanded")?-1===a.inArray(e,d)&&d.push(e):b.treegrid("isCollapsed")&&-1!==a.inArray(e,d)&&d.splice(a.inArray(e,d),1),a.cookie(b.treegrid("getSetting","saveStateName"),d.join(","))}return b},restoreState:function(){var b=a(this);if("cookie"===b.treegrid("getSetting","saveStateMethod")){var c=a.cookie(b.treegrid("getSetting","saveStateName")).split(",");b.treegrid(-1!==a.inArray(b.treegrid("getNodeId"),c)?"expand":"collapse")}return b},getSetting:function(b){return a(this).treegrid("getTreeContainer")?a(this).treegrid("getTreeContainer").data("settings")[b]:null},setSettings:function(b){a(this).treegrid("getTreeContainer").data("settings",b)},getTreeContainer:function(){return a(this).data("treegrid")},setTreeContainer:function(b){return a(this).data("treegrid",b)},getRootNodes:function(){return a(this).treegrid("getSetting","getRootNodes").apply(this,[a(this).treegrid("getTreeContainer")])},getAllNodes:function(){return a(this).treegrid("getSetting","getAllNodes").apply(this,[a(this).treegrid("getTreeContainer")])},isNode:function(){return null!==a(this).treegrid("getNodeId")},getNodeId:function(){return null===a(this).treegrid("getSetting","getNodeId")?null:a(this).treegrid("getSetting","getNodeId").apply(this)},getParentNodeId:function(){return a(this).treegrid("getSetting","getParentNodeId").apply(this)},getParentNode:function(){return null===a(this).treegrid("getParentNodeId")?null:a(this).treegrid("getSetting","getNodeById").apply(this,[a(this).treegrid("getParentNodeId"),a(this).treegrid("getTreeContainer")])},getChildNodes:function(){return a(this).treegrid("getSetting","getChildNodes").apply(this,[a(this).treegrid("getNodeId"),a(this).treegrid("getTreeContainer")])},getDepth:function(){return null===a(this).treegrid("getParentNode")?0:a(this).treegrid("getParentNode").treegrid("getDepth")+1},isRoot:function(){return 0===a(this).treegrid("getDepth")},isLeaf:function(){return 0===a(this).treegrid("getChildNodes").length},isLast:function(){if(a(this).treegrid("isNode")){var b=a(this).treegrid("getParentNode");if(null===b){if(a(this).treegrid("getNodeId")===a(this).treegrid("getRootNodes").last().treegrid("getNodeId"))return!0}else if(a(this).treegrid("getNodeId")===b.treegrid("getChildNodes").last().treegrid("getNodeId"))return!0}return!1},isFirst:function(){if(a(this).treegrid("isNode")){var b=a(this).treegrid("getParentNode");if(null===b){if(a(this).treegrid("getNodeId")===a(this).treegrid("getRootNodes").first().treegrid("getNodeId"))return!0}else if(a(this).treegrid("getNodeId")===b.treegrid("getChildNodes").first().treegrid("getNodeId"))return!0}return!1},isExpanded:function(){return a(this).hasClass("treegrid-expanded")},isCollapsed:function(){return a(this).hasClass("treegrid-collapsed")},isOneOfParentsCollapsed:function(){var b=a(this);return b.treegrid("isRoot")?!1:b.treegrid("getParentNode").treegrid("isCollapsed")?!0:b.treegrid("getParentNode").treegrid("isOneOfParentsCollapsed")},expand:function(){return this.treegrid("isLeaf")||this.treegrid("isExpanded")?this:(this.trigger("expand"),this.trigger("change"),this)},expandAll:function(){var b=a(this);return b.treegrid("getRootNodes").treegrid("expandRecursive"),b},expandRecursive:function(){return a(this).each(function(){var b=a(this);b.treegrid("expand"),b.treegrid("isLeaf")||b.treegrid("getChildNodes").treegrid("expandRecursive")})},collapse:function(){return a(this).each(function(){var b=a(this);b.treegrid("isLeaf")||b.treegrid("isCollapsed")||(b.trigger("collapse"),b.trigger("change"))})},collapseAll:function(){var b=a(this);return b.treegrid("getRootNodes").treegrid("collapseRecursive"),b},collapseRecursive:function(){return a(this).each(function(){var b=a(this);b.treegrid("collapse"),b.treegrid("isLeaf")||b.treegrid("getChildNodes").treegrid("collapseRecursive")})},toggle:function(){var b=a(this);return b.treegrid(b.treegrid("isExpanded")?"collapse":"expand"),b},render:function(){return a(this).each(function(){var b=a(this);b.treegrid("isOneOfParentsCollapsed")?b.hide():b.show(),b.treegrid("isLeaf")||(b.treegrid("renderExpander"),b.treegrid("getChildNodes").treegrid("render"))})},renderExpander:function(){return a(this).each(function(){var b=a(this),c=b.treegrid("getSetting","getExpander").apply(this);c?b.treegrid("isCollapsed")?(c.removeClass(b.treegrid("getSetting","expanderExpandedClass")),c.addClass(b.treegrid("getSetting","expanderCollapsedClass"))):(c.removeClass(b.treegrid("getSetting","expanderCollapsedClass")),c.addClass(b.treegrid("getSetting","expanderExpandedClass"))):(b.treegrid("initExpander"),b.treegrid("renderExpander"))})}};a.fn.treegrid=function(c){return b[c]?b[c].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof c&&c?void a.error("Method with name "+c+" does not exists for jQuery.treegrid"):b.initTree.apply(this,arguments)},a.fn.treegrid.defaults={initialState:"expanded",saveState:!1,saveStateMethod:"cookie",saveStateName:"tree-grid-state",expanderTemplate:'',indentTemplate:'',expanderExpandedClass:"treegrid-expander-expanded",expanderCollapsedClass:"treegrid-expander-collapsed",treeColumn:0,getExpander:function(){return a(this).find(".treegrid-expander")},getNodeId:function(){var b=/treegrid-([A-Za-z0-9_-]+)/;return b.test(a(this).attr("class"))?b.exec(a(this).attr("class"))[1]:null},getParentNodeId:function(){var b=/treegrid-parent-([A-Za-z0-9_-]+)/;return b.test(a(this).attr("class"))?b.exec(a(this).attr("class"))[1]:null},getNodeById:function(a,b){var c="treegrid-"+a;return b.find("tr."+c)},getChildNodes:function(a,b){var c="treegrid-parent-"+a;return b.find("tr."+c)},getTreeGridContainer:function(){return a(this).closest("table")},getRootNodes:function(b){var c=a.grep(b.find("tr"),function(b){var c=a(b).attr("class"),d=/treegrid-([A-Za-z0-9_-]+)/,e=/treegrid-parent-([A-Za-z0-9_-]+)/;return d.test(c)&&!e.test(c)});return a(c)},getAllNodes:function(b){var c=a.grep(b.find("tr"),function(b){var c=a(b).attr("class"),d=/treegrid-([A-Za-z0-9_-]+)/;return d.test(c)});return a(c)},onCollapse:null,onExpand:null,onChange:null}}(jQuery); \ No newline at end of file diff --git a/src/main/resources/templates/include.html b/src/main/resources/templates/include.html index 305a0f71d..1a0059d6c 100644 --- a/src/main/resources/templates/include.html +++ b/src/main/resources/templates/include.html @@ -10,7 +10,7 @@ - + @@ -31,8 +31,7 @@ - - + diff --git a/src/main/resources/templates/system/dept/dept.html b/src/main/resources/templates/system/dept/dept.html index 6cefb8082..cd95d68a5 100644 --- a/src/main/resources/templates/system/dept/dept.html +++ b/src/main/resources/templates/system/dept/dept.html @@ -67,7 +67,7 @@ field: 'status', title: '状态', align: "center", - formatter: function(item, index) { + formatter: function(value, item, index) { return $.table.selectDictLabel(datas, item.status); } }, @@ -79,7 +79,7 @@ { title: '操作', align: 'center', - formatter: function(row, index) { + formatter: function(value, row, index) { if (row.parentId != 0) { var actions = []; actions.push('编辑 '); diff --git a/src/main/resources/templates/system/menu/menu.html b/src/main/resources/templates/system/menu/menu.html index 0229cc156..654cf06ee 100644 --- a/src/main/resources/templates/system/menu/menu.html +++ b/src/main/resources/templates/system/menu/menu.html @@ -60,7 +60,7 @@ title: '菜单名称', field: 'menuName', width: '20%', - formatter: function(row, index) { + formatter: function(value, row, index) { if (row.icon == null || row == "") { return row.menuName; } else { @@ -85,7 +85,7 @@ field: 'menuType', width: '10%', align: "center", - formatter: function(item, index) { + formatter: function(value, item, index) { if (item.menuType == 'M') { return '目录'; } @@ -102,7 +102,7 @@ title: '可见', width: '10%', align: "center", - formatter: function(row, index) { + formatter: function(value, row, index) { return $.table.selectDictLabel(datas, row.visible); } }, @@ -116,7 +116,7 @@ title: '操作', width: '20%', align: "center", - formatter: function(row, index) { + formatter: function(value, row, index) { var actions = []; actions.push('编辑 '); actions.push('新增 ');