阅读:1717
回复:9
|
怎么获取岗位图片:微信截图_20190306114840.png 如题,我在表头要有个岗位的信息,请问大神们怎么根据用户取得岗位 |
2楼#
发布于:2019-03-11 09:48
我猜你是不是想使用用户“称谓”这个属性?
|
|
3楼#
发布于:2019-03-11 09:49
|
|
4楼#
发布于:2019-03-11 10:19
/// <summary>
/// 获取用户对应的所有角色 /// </summary> /// <param name="userID"></param> /// <returns></returns> public JsonResult GetUserRoleList(string userID) { return ExecuteFunctionRun(() => { List<string> lstPosts = this.Engine.Organization.GetParents(userID, UnitType.Post, true, State.Active); List<RoleUserViewModel> lstRoleUsers = new List<RoleUserViewModel>(); if (lstPosts != null && lstPosts.Count > 0) { foreach (string postid in lstPosts) { OThinker.Organization.OrgPost post = this.Engine.Organization.GetUnit(postid) as OThinker.Organization.OrgPost; foreach (OrgStaff staff in post.ChildList) { if (staff.UserID == userID) { string userid = staff.UserID; string _userCode = ((OThinker.Organization.User)this.Engine.Organization.GetUnit(userid)).Code; string _userName = this.Engine.Organization.GetUnit(userid).Name; //范围组织名称 string[] scopeids = staff.OUScope; Dictionary<string, string> dicNames = this.Engine.Organization.GetNames(scopeids); string scopeNames = ""; foreach (string key in dicNames.Keys) { scopeNames += dicNames[key] + ";"; } lstRoleUsers.Add(new RoleUserViewModel { ObjectID = staff.ObjectID, RoleID = post.ObjectID, RoleCode = post.Code, RoleName = post.Name, UserID = staff.UserID, UserCode = _userCode, UserName = _userName, Sortkey = staff.ParentIndex, ManagerScope = scopeNames, ManagerScopeIds = string.Join(";", staff.OUScope), Description = staff.Description }); } } } var gridData = CreateLigerUIGridData(lstRoleUsers.ToArray()); return Json(gridData, JsonRequestBehavior.AllowGet); } return Json(new { Rows = "", Total = 0 }, JsonRequestBehavior.AllowGet); }); } |
|
5楼#
发布于:2019-03-11 10:20
上面的是源代码,可以通过OrgUser/GetUserRoleList?id=去调用
|
|
6楼#
发布于:2019-03-11 13:43
|
|
8楼#
发布于:2019-03-11 14:40
|
|
9楼#
发布于:2019-03-14 13:57
|
|