Exemplo n.º 1
0
        /// <summary>
        /// 【系统表单】模块目录
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            List <BaseModule> list     = new BaseModuleBll().GetList();
            List <TreeEntity> TreeList = new List <TreeEntity>();

            foreach (BaseModule item in list)
            {
                string ModuleId    = item.ModuleId;
                bool   hasChildren = false;
                List <Carlzhu.Iooin.Entity.CommonModule.BaseModule> childnode = list.FindAll(t => t.ParentId == ModuleId);
                if (childnode.Count > 0)
                {
                    hasChildren = true;
                }
                else
                {
                    if (item.Category == "目录")
                    {
                        continue;
                    }
                }
                if (item.Category == "页面")
                {
                    if (item.AllowForm != 1)
                    {
                        continue;
                    }
                }
                TreeEntity tree = new TreeEntity();
                tree.id          = ModuleId;
                tree.text        = item.FullName;
                tree.value       = ModuleId;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.parentId    = item.ParentId;
                tree.img         = item.Icon != null ? "/Content/Images/Icon16/" + item.Icon : item.Icon;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }