/// <summary> /// 加载窗体 /// </summary> public override void FormOnLoad() { // 获得组织机构数据 this.DTOrganize = this.GetOrganizeScope(this.PermissionItemScopeCode, true); if (!UserInfo.IsAdministrator) { // 查找 ParentId 字段的值是否在 Id字段 里 BaseInterfaceLogic.CheckTreeParentId(this.DTOrganize, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId); } // 加载树 this.BindData(true); // 加载角色列表的主键 this.GetRoleList(); }
/// <summary> /// 加载窗体 /// </summary> public override void FormOnLoad() { this.splUser.SplitterDistance = 0; // 获取部门数据,这里按管理范围进行获取数据 this.DTOrganize = this.GetOrganizeScope(this.PermissionItemScopeCode, true); // 内部组织机构必须要检查父亲节点的逻辑关系 BaseInterfaceLogic.CheckTreeParentId(this.DTOrganize, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId); this.LoadTreeOrganize(); // 表格显示序号的处理部分 this.DataGridViewOnLoad(grdUser); // 加载窗体,检查是否配置为默认加载用户列表,就怕用户数量太多了。 FormOnLoad(BaseSystemInfo.LoadAllUser); this.SetRowFilter(); }
/// <summary> /// 加载窗体 /// </summary> public override void FormOnLoad() { this.isUserClick = false; // 获取部门数据 this.DTOrganize = this.GetOrganizeScope(this.PermissionItemScopeCode, true); if (!UserInfo.IsAdministrator) { // 查找 ParentId 字段的值是否在 ID字段 里 BaseInterfaceLogic.CheckTreeParentId(this.DTOrganize, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId); } BaseBusinessLogic.SetFilter(this.DTOrganize, BaseOrganizeEntity.FieldEnabled, "1"); this.RoleIds = DotNetService.Instance.UserService.GetUserRoleIds(UserInfo, this.TargetStaffId); // 加载树 this.BindData(true); this.isUserClick = true; }
/// <summary> /// 获取组织机构权限域数据 /// </summary> public DataTable GetOrganizeDTByPermission(string permissionCode = "Resource.ManagePermission", bool isInnerOrganize = true) { // 获取部门数据,不启用权限域 DataTable dt = new DataTable(BaseOrganizeEntity.TableName); if (isInnerOrganize || UserInfo.IsAdministrator || !BaseSystemInfo.UsePermissionScope || String.IsNullOrEmpty(permissionCode)) { dt = ClientCache.Instance.GetInnerOrganizeDT(UserInfo); if (isInnerOrganize) { // BaseBusinessLogic.SetFilter(dt, BaseOrganizeEntity.FieldIsInnerOrganize, "1"); // BaseInterfaceLogic.CheckTreeParentId(dt, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId); } dt.DefaultView.Sort = BaseOrganizeEntity.FieldSortCode; } else { DotNetService dotNetService = new DotNetService(); dt = dotNetService.PermissionService.GetOrganizeDTByPermission(UserInfo, UserInfo.Id, permissionCode); if (dotNetService.PermissionService is ICommunicationObject) { ((ICommunicationObject)dotNetService.PermissionService).Close(); } if (isInnerOrganize) { BaseBusinessLogic.SetFilter(dt, BaseOrganizeEntity.FieldIsInnerOrganize, "1"); BaseInterfaceLogic.CheckTreeParentId(dt, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId); } if (dt.Columns.Contains(BaseOrganizeEntity.FieldSortCode)) { dt.DefaultView.Sort = BaseOrganizeEntity.FieldSortCode; } } return(dt); }
/// <summary> /// 绑定屏幕数据 /// </summary> /// <param name="reloadTree">重新加部门载树</param> private void BindData(bool reloadTree) { // 加载树 if (reloadTree) { // 查找 ParentId 字段的值是否在 ID字段 里 BaseInterfaceLogic.CheckTreeParentId(this.DTOrganize, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId); this.LoadTree(); } if (this.tvOrganize.SelectedNode == null) { if (this.tvOrganize.Nodes.Count > 0) { if (this.CurrentEntityId.Length == 0) { this.tvOrganize.SelectedNode = this.tvOrganize.Nodes[0]; } else { BaseInterfaceLogic.FindTreeNode(this.tvOrganize, this.CurrentEntityId); if (BaseInterfaceLogic.TargetNode != null) { this.tvOrganize.SelectedNode = BaseInterfaceLogic.TargetNode; // 展开当前选中节点的所有父节点 BaseInterfaceLogic.ExpandTreeNode(this.tvOrganize); } } if (this.tvOrganize.SelectedNode != null) { // 让选中的节点可视,并用展开方式 this.tvOrganize.SelectedNode.Expand(); this.tvOrganize.SelectedNode.EnsureVisible(); } } } }
/// <summary> /// 加载组织机构树的主键 /// </summary> /// <param name="TreeNode">当前节点</param> private void LoadTreeOrganize(TreeNode treeNode) { BaseInterfaceLogic.CheckTreeParentId(this.DTOrganize, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId); BaseInterfaceLogic.LoadTreeNodes(this.DTOrganize, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId, BaseOrganizeEntity.FieldFullName, this.tvOrganize, treeNode); }