From 46f64905a3c309a50c0f245b3350cdeb8dd699c6 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期三, 22 一月 2025 17:29:02 +0800 Subject: [PATCH] 计算优化 --- WinFrmUI/HStation.WinFrmUI.Auth.Core/04-role-projcet-menu/RoleProjectMenuPage.cs | 62 +++++++++++++++++++++--------- 1 files changed, 43 insertions(+), 19 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Auth.Core/04-role-projcet-menu/RoleProjectMenuPage.cs b/WinFrmUI/HStation.WinFrmUI.Auth.Core/04-role-projcet-menu/RoleProjectMenuPage.cs index f71b4bc..3f7fc53 100644 --- a/WinFrmUI/HStation.WinFrmUI.Auth.Core/04-role-projcet-menu/RoleProjectMenuPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Auth.Core/04-role-projcet-menu/RoleProjectMenuPage.cs @@ -1,15 +1,4 @@ -锘縰sing DevExpress.XtraEditors; -using NetTaste; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using Yw; +锘縰sing Yw; using Yw.WinFrmUI; namespace HStation.WinFrmUI @@ -20,7 +9,8 @@ { InitializeComponent(); this.treeList1.InitialMultiColSettings(); - + this.PageTitle.Caption = "瑙掕壊鑿滃崟绠$悊"; + this.PageTitle.SvgImageSize = new Size(24, 24); this.roleTreeListCtrl1.FocusedChangedEvent += RoleTreeListCtrl1_FocusedChangedEvent; } @@ -31,17 +21,16 @@ private List<RoleProjcetMenuViewModel> _allBindingList; - private long _roleID; + private Yw.Vmo.RoleVmo _lastRole; /// <summary> /// 鑱氱劍鏀瑰彉浜嬩欢 /// </summary> - private async void RoleTreeListCtrl1_FocusedChangedEvent(Yw.Vmo.Role obj) + private async void RoleTreeListCtrl1_FocusedChangedEvent(Yw.Vmo.RoleVmo obj) { - _roleID = obj.ID; - + _lastRole = obj; _allBindingList = new List<RoleProjcetMenuViewModel>(); - var allList = await BLLFactory<Yw.BLL.RoleProjectMenuMapping>.Instance.GetAuthorizeMenuList(1, obj.ID); + var allList = await BLLFactory<Yw.BLL.RoleProjectMenuMapping>.Instance.GetAuthorizeMenuList(GlobalParas._GlobalParas.ProjectID, obj.ID); foreach (var item in allList) { _allBindingList.Add(new RoleProjcetMenuViewModel(item)); @@ -61,7 +50,11 @@ menuList.Add(item.ID); } } - var bol = await BLLFactory<Yw.BLL.RoleProjectMenuMapping>.Instance.Set(1, _roleID, menuList); + var vmo = new Yw.Vmo.SetRoleProjectMenuVmo(); + vmo.ProjectID = GlobalParas._GlobalParas.ProjectID; + vmo.RoleID = _lastRole.ID; + vmo.MenuIds = menuList; + var bol = await BLLFactory<Yw.BLL.RoleProjectMenuMapping>.Instance.Set(vmo); if (bol) { TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛!"); @@ -71,5 +64,36 @@ TipFormHelper.ShowError("淇濆瓨澶辫触!"); } } + + private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + this.treeList1.OptionsFind.AlwaysVisible = !this.treeList1.OptionsFind.AlwaysVisible; + } + + private void treeList1_AfterCheckNode(object sender, DevExpress.XtraTreeList.NodeEventArgs e) + { + // 鑾峰彇鐖惰妭鐐� + var parentNode = e.Node.ParentNode; + if (parentNode != null) + { + parentNode.Checked = _isCheck; + } + } + + private bool _isCheck = false; + + private void treeList1_BeforeCheckNode(object sender, DevExpress.XtraTreeList.CheckNodeEventArgs e) + { + var parentNode = e.Node.ParentNode; + if (parentNode != null) + { + _isCheck = parentNode.Checked; + } + } + + private void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + RoleTreeListCtrl1_FocusedChangedEvent(_lastRole); + } } } \ No newline at end of file -- Gitblit v1.9.3