关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、3102411850 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 9073|回复: 3

[环境搭建] 关于菜单部分编辑后菜单层级变化

[复制链接]
发表于 2015-4-4 22:06:22 | 显示全部楼层 |阅读模式
本帖最后由 jianxia612 于 2015-4-19 20:17 编辑

目前的菜单层级只能选择一级菜单,和下级菜单(默认存为1);实际上可能是二级菜单的情况;还有就是在编辑时候没有选中当前菜单的父亲节点;实际设计流程应该是如果有父菜单;应该默认选中的下级菜单;并且根据当前父菜单的level 获得下级菜单的level 这样导致的后果就是 你保存或者编辑了1级菜单下的二级菜单 可能二级菜单就显示不出来了!
注意:默认像系统管理菜单是0级别菜单


就是说整个菜单的设计思路:只有0、1、2三个等级 0级菜单表示为导航菜单 1级菜单(可以是功能菜单 也可以是功能分组菜单) 2级菜单只能是功能菜单。于是在添加和保存功能菜单时候需要根据具体情况 选择下级菜单时候,起父菜单 只能是0级或者1级菜单。 否则原来存储可能本来是2级菜单的永远就存为了1级了
发表于 2015-4-7 17:32:16 | 显示全部楼层
你这个问题,可能跟我碰到过的一样,需要修改相应的处理类
 楼主| 发表于 2015-4-19 19:58:54 | 显示全部楼层
yyy3295022 发表于 2015-4-7 17:32
你这个问题,可能跟我碰到过的一样,需要修改相应的处理类

已经找到相应的解决方案;必须修改function.jsp; 还是选择层级父菜单需要过滤只显示0,1级别;要不然会乱套了!
funtion.jsp
$("#functionId").val(node.id);
                                var functionLevel=node.attributes.functionLevel;
                                //alert("functionLevel: "+functionLevel);   
                                //判断当前选择菜单等级是否为 下级菜单 如果是则设置选择等级为父亲节点functionLevel+1
                                var selectedLevelText=$("#functionLevel").find("option:selected").text();
                                if(selectedLevelText=="下级菜单"){
                                         $("#functionLevel").val(functionLevel+1);            
                                }else{
                                        $("#functionLevel").val(0);
                                }
if(parseInt($('#functionLevel').val())>=1){
                        $('#pfun').show();
                }else{
                        $('#pfun').hide();
                }

               
                $('#functionLevel').change(function(){
                        //yejianjun 2015-04-07 修改 原来为=='1'
                        if(parseInt($(this).val())>=1){
                                $('#pfun').show();
                                var t = $('#cc').combotree('tree');
                                var nodes = t.tree('getRoots');
                                if(nodes.length>0){
                                        $('#cc').combotree('setValue', nodes[0].id);
                                        $("#functionId").val(nodes[0].id);
                                }
                        }else{
                                var t = $('#cc').combotree('tree');
                                var node = t.tree('getSelected');
                                if(node){
                                        $('#cc').combotree('setValue', null);
                                }
                                $('#pfun').hide();
                        }
                });
        });

  /**
         * 父级权限下拉菜单
         */
        @RequestMapping(params = "setPFunction")
        @ResponseBody
        public List<ComboTree> setPFunction(HttpServletRequest request,
                        ComboTree comboTree) {
                CriteriaQuery cq = new CriteriaQuery(TSFunction.class);
                cq.in("functionLevel",new Short[]{0,1});
                if(null != request.getParameter("selfId")){
                        cq.notEq("id", request.getParameter("selfId"));
                }
                if (comboTree.getId() != null) {
                        cq.eq("TSFunction.id", comboTree.getId());
                }
                if (comboTree.getId() == null) {
                        cq.isNull("TSFunction");
                }
                cq.add();
                List<TSFunction> functionList = systemService.getListByCriteriaQuery(
                                cq, false);
                List<ComboTree> comboTrees = new ArrayList<ComboTree>();
                追加
                ComboTreeModel comboTreeModel = new ComboTreeModel("id",
                                "functionName","TSFunctions","functionLevel",0);
                comboTrees = systemService
                                .ComboTree(functionList, comboTreeModel, null);
                return comboTrees;
        }

  public class ComboTreeModel implements java.io.Serializable {
        private String idField;
        private String levelField;
        private String textField;
        private String iconCls;// 前面的小图标样式
        private String childField;// 子节点
        private String srcField;//地址字段
       
        public ComboTreeModel(String idField, String textField, String childField) {
                this.idField = idField;
                this.textField = textField;
                this.childField = childField;
        }
       
        public ComboTreeModel(String idField, String textField,String childField,String levelField,int flag) {
                this.idField = idField;
                this.textField = textField;
                this.childField = childField;
                this.levelField=levelField;
        }
 楼主| 发表于 2015-4-19 20:19:27 | 显示全部楼层
yyy3295022 发表于 2015-4-7 17:32
你这个问题,可能跟我碰到过的一样,需要修改相应的处理类

首先表示感谢;不知道你的处理方式怎么处理的!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表