|
本帖最后由 zhey 于 2017-3-24 17:15 编辑
修改ListtoMenu类,替换getACESubMenu、getHplusSubMenu和getLeafOfHplusTree三个函数:- private static String getACESubMenu(TSFunction parent,int level,Map<Integer, List<TSFunction>> map){
- StringBuffer menuString = new StringBuffer();
- List<TSFunction> list = map.get(level);
- for (TSFunction function : list) {
- if (function.getTSFunction().getId().equals(parent.getId())){
- if(!function.hasSubFunction(map)){
- menuString.append(getLeafOfACETree(function,map));
- }else {
- /* 20160830 wangkun TASK #1330 【改造】ace首页风格,菜单不支持三级菜单,改造支持三级*/
- menuString.append("<li>");
- if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
- menuString.append("<a href="#" class="dropdown-toggle" ><i class=""+function.getFunctionIconStyle()+""></i>");
- }else{
- menuString.append("<a href="#" class="dropdown-toggle" ><i class=""+SysACEIconEnum.toEnum(function.getTSIcon().getIconClas()).getThemes()+""></i>");
- }
- menuString.append("<span class="menu-text">");
- menuString.append(getMutiLang(function.getFunctionName()));
- menuString.append("</span>");
- menuString.append("<b class="arrow icon-angle-down"></b></a><ul class="submenu" >");
- menuString.append(getACESubMenu(function,level+1,map));
- menuString.append("</ul></li>");
- /* 20160830 wangkun TASK #1330 【改造】ace首页风格,菜单不支持三级菜单,改造支持三级*/
- }
- }
- }
- return menuString.toString();
- }
- private static String getHplusSubMenu(TSFunction parent, int level, Map<Integer, List<TSFunction>> map) {
- StringBuffer menuString = new StringBuffer();
- String icon = "folder";
- List<TSFunction> list = map.get(level);
- for (TSFunction function : list) {
- if (function.getTSFunction().getId().equals(parent.getId())){
- if(function.hasSubFunction(map)){
- if (function.getTSIcon() != null) {
- icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
- }
- String name = getMutiLang(function.getFunctionName()) ;
- menuString.append("<li> <a class="J_menuItem" href="").append(function.getFunctionUrl()).append("">");
- if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
- menuString.append("<i class="fa "+function.getFunctionIconStyle()+""></i>");
- }else{
- menuString.append("<i class="fa fa-columns"></i>");
- }
- menuString.append("<span class="menu-text">");
- menuString.append(name);
- menuString.append("</span>");
- menuString.append("<span class="fa arrow">");
- menuString.append("</span>");
- menuString.append("</a>");
- menuString.append("<ul class="nav nav-third-level" >");
- menuString.append(getHplusSubMenu(function,level+1,map));
- menuString.append("</ul></li>");
- }else{
- menuString.append(getLeafOfHplusTree(function,map));
- }
- }
- }
- return menuString.toString();
- }
- private static String getLeafOfHplusTree(TSFunction function,Map<Integer, List<TSFunction>> map) {
- StringBuffer menuString = new StringBuffer();
- String icon = "folder";
- if (function.getTSIcon() != null) {
- icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
- }
- //addTabs({id:'home',title:'首页',close: false,url: 'loginController.do?home'});
- String name = getMutiLang(function.getFunctionName()) ;
- menuString.append("<li> <a class="J_menuItem" href="").append(function.getFunctionUrl()).append("">");
- if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
- menuString.append("<i class="fa "+function.getFunctionIconStyle()+""></i>");
- }
- menuString.append("<span class="menu-text">");
- menuString.append(name);
- menuString.append("</span>");
- menuString.append("</a>");
- menuString.append("</li>");
- return menuString.toString();
- }
复制代码 |
|