Ejemplo n.º 1
0
 private void GenOrgsManagerTreeOpen(ZtreeNode_ORG tree)
 {
     if (tree.children != null && tree.children.Any(obj => obj.highlight || obj.open))
     {
         tree.open = true;
     }
     foreach (var item in tree.children)
     {
         GenOrgsManagerTreeOpen(item);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取权限树
        /// </summary>
        /// <returns></returns>
        //[UserAuth("AUTH_FUNC_VIW")]
        public ActionResult GetOrgsManagerTree(string id, string check, int?disabled, string searchNam)
        {
            var all = new SYS_USER_DAL().GetUserORG(UserState.UserID);

            foreach (var org in all.Where(obj => obj.PAR_ORG_ID == ""))
            {
                org.PAR_ORG_ID = null;
            }
            bool rootHasAuth = true;

            if (!all.Any(o => o.ORG_LEVEL == 1))//处理没有省权限的数据
            {
                rootHasAuth = false;
                all.Where(o => o.ORG_LEVEL == (all.Min(o2 => o2.ORG_LEVEL)))
                .ToList().ForEach(o => o.PAR_ORG_ID = null);
            }
            var tree = new ZtreeNode_ORG
            {
                id        = "",
                name      = "顶级机构",
                @checked  = check == null,
                open      = true,
                isParent  = true,
                nocheck   = true,
                hasauth   = rootHasAuth,
                highlight = (!string.IsNullOrEmpty(searchNam) && "顶级机构".IndexOf(searchNam) > -1),
                children  = GenOrgsManagerTree(all, null, check, disabled, searchNam)
            };
            var treelist = new List <ZtreeNode_ORG> {
                tree
            };

            if (!string.IsNullOrEmpty(id) || Request.Form["lv"] == "0")
            {
                if (id == "")
                {
                    id = null;
                }
                treelist = GenOrgsManagerTree(all, id, check, disabled, searchNam);
            }
            if (!string.IsNullOrEmpty(searchNam))
            {
                GenOrgsManagerTreeOpen(tree);
                GenOrgsManagerTreeOpen(tree);//递归达不到足够的深度,改为多次调用
                GenOrgsManagerTreeOpen(tree);
            }
            return(Json(treelist, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取权限树
        /// </summary>
        /// <returns></returns>
        //[UserAuth("AUTH_FUNC_VIW")]
        public ActionResult GetOrgsTree(string id, string check, int?disabled, string searchNam)
        {
            var all = dao.FindList();

            foreach (var org in all.Where(obj => obj.PAR_ORG_ID == ""))
            {
                org.PAR_ORG_ID = null;
            }
            var tree = new ZtreeNode_ORG
            {
                id        = "",
                name      = "顶级机构",
                @checked  = check == null,
                open      = true,
                isParent  = true,
                nocheck   = true,
                highlight = (!string.IsNullOrEmpty(searchNam) && "顶级机构".IndexOf(searchNam) > -1),
                children  = GenOrgsTree(all, null, check, disabled, searchNam)
            };
            var treelist = new List <ZtreeNode_ORG> {
                tree
            };

            if (!string.IsNullOrEmpty(id) || Request.Form["lv"] == "0")
            {
                if (id == "")
                {
                    id = null;
                }
                treelist = GenOrgsTree(all, id, check, disabled, searchNam);
            }
            if (!string.IsNullOrEmpty(searchNam))
            {
                GenOrgsTreeOpen(tree);
                GenOrgsTreeOpen(tree);//递归达不到足够的深度,改为多次调用
                GenOrgsTreeOpen(tree);
            }
            return(Json(treelist, JsonRequestBehavior.AllowGet));
        }