/// <summary> /// 初始化树 默认找出顶级菜单 /// add by lpl /// 2019-1-2 /// </summary> /// <returns></returns> public List <MenuModels> InitTree() { var user = CurrentUser.CrmUser; //根据权限加载用户树 bool isAdmin = new CrmUserMenuBll().GetAuthorizationByUserId("System", "Admin", user.Id); var TreeList = new ComMenuBll().GetAllMenu(new ComMenuEntity() { IsMenu = 1 }, isAdmin); List <MenuModels> rootNode = new List <MenuModels>(); foreach (var plist in TreeList.Where(t => t.ParentMenuId == "00001")) { MenuModels jt = new MenuModels(); jt.id = plist.Id; jt.text = plist.MenuName; jt.parentid = plist.ParentMenuId; jt.icon = ""; jt.url = plist.MenuUrl; jt.attributes = CreateUrl(TreeList, jt); jt.menus = CreateChildTree(TreeList, jt); rootNode.Add(jt); } return(rootNode); }
/// <summary> /// 新增公告 /// </summary> /// <returns></returns> public ActionResult GongWenAdd() { var user = CurrentUser.CrmUser; //公文管理权限 bool isMangerGongWen = new CrmUserMenuBll().GetAuthorizationByUserId("OA", "MangerAuthorization", user.Id); ViewBag.isMangerGongWen = false; ViewBag.Id = Guid.NewGuid().ToString(); if (isMangerGongWen) { ViewBag.isMangerGongWen = true; } return(View()); }
/// <summary> /// 公文管理展示 /// </summary> /// <param name="limit"></param>每页显示数量 /// <param name="page"></param>当前页码 /// <returns></returns> public string GongWenIndex(string limit, string page) { var user = CurrentUser.CrmUser; //公文管理权限 bool isMangerGongWen = new CrmUserMenuBll().GetAuthorizationByUserId("OA", "MangerAuthorization", user.Id); if (isMangerGongWen) { //用Linq分页,用ORM自身的非常慢,后面研究为什么这么慢 var data = new GongGaoMangerBll().QueryList(); var pagecount = data.Count; data = data.Skip((Convert.ToInt32(page) - 1) * Convert.ToInt32(limit)).Take(Convert.ToInt32(limit)).ToList(); var result = new LayTableModel <GongGaoMangerEntity> { code = 0, msg = "成功", count = pagecount, data = data }; return(JsonConvert.SerializeObject(result)); } else { //非管理权限,查询公文详情表 var data = new GongGaoDetialBll().QueryList(user.Id); var pagecount = data.Count; data = data.Skip((Convert.ToInt32(page) - 1) * Convert.ToInt32(limit)).Take(Convert.ToInt32(limit)).ToList(); var result = new LayTableModel <GongGaoDetialEntity> { code = 0, msg = "成功", count = pagecount, data = data }; return(JsonConvert.SerializeObject(result)); } }