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 |   54 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 34 insertions(+), 20 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 ebe63cb..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
@@ -21,8 +10,8 @@
             InitializeComponent();
             this.treeList1.InitialMultiColSettings();
             this.PageTitle.Caption = "瑙掕壊鑿滃崟绠$悊";
-             this.PageTitle.SvgImageSize = new Size(24, 24);
-             this.roleTreeListCtrl1.FocusedChangedEvent += RoleTreeListCtrl1_FocusedChangedEvent;
+            this.PageTitle.SvgImageSize = new Size(24, 24);
+            this.roleTreeListCtrl1.FocusedChangedEvent += RoleTreeListCtrl1_FocusedChangedEvent;
         }
 
         public override void InitialDataSource()
@@ -32,15 +21,14 @@
 
         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(GlobalParas._GlobalParas.ProjectID, obj.ID);
             foreach (var item in allList)
@@ -62,9 +50,9 @@
                     menuList.Add(item.ID);
                 }
             }
-            var vmo = new Yw.Vmo.SetRoleProjectMenu();
+            var vmo = new Yw.Vmo.SetRoleProjectMenuVmo();
             vmo.ProjectID = GlobalParas._GlobalParas.ProjectID;
-            vmo.RoleID = _roleID;
+            vmo.RoleID = _lastRole.ID;
             vmo.MenuIds = menuList;
             var bol = await BLLFactory<Yw.BLL.RoleProjectMenuMapping>.Instance.Set(vmo);
             if (bol)
@@ -81,5 +69,31 @@
         {
             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