From 0f99680aff09e91f521b5909aab42811c1c3e6f1 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期三, 09 四月 2025 15:28:16 +0800
Subject: [PATCH] 优化Revit=>HydroModelInfo转换方法

---
 WinFrmUI/HStation.WinFrmUI.Auth.Core/00-core/PageAuthExtensions.cs |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Auth.Core/00-core/PageAuthExtensions.cs b/WinFrmUI/HStation.WinFrmUI.Auth.Core/00-core/PageAuthExtensions.cs
index 6bb3f20..8e33e34 100644
--- a/WinFrmUI/HStation.WinFrmUI.Auth.Core/00-core/PageAuthExtensions.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Auth.Core/00-core/PageAuthExtensions.cs
@@ -1,10 +1,57 @@
-锘縰sing DevExpress.XtraBars.Docking2010;
-using DevExpress.XtraEditors.ButtonPanel;
-using System.Collections.Generic;
+锘縰sing DevExpress.XtraBars.Ribbon;
+using Yw.Dto;
+using Yw.WinFrmUI;
+using Yw.WinFrmUI.Page;
 
 namespace HStation.WinFrmUI
 {
     public static class PageAuthExtensions
     {
+        /// <summary>
+        /// 楠岃瘉鏉冮檺
+        /// </summary>
+        public static void VerifyAuth(this PageAuthHaveTree auth, RibbonControl panel)
+        {
+            if (auth == null || auth.Children == null || auth.Children.Count < 1)
+                return;
+            if (panel == null || panel.Items == null || panel.Items.Count < 1)
+                return;
+
+            for (int i = 0; i < panel.Items.Count; i++)
+            {
+                var item = panel.Items[i];
+                if (item.Tag != null && !string.IsNullOrEmpty(item.Tag.ToString()))
+                {
+                    var authItem = auth.Children.Find(x => x.Permission == item.Tag.ToString());
+                    if (authItem != null)
+                    {
+                        item.Visibility = authItem.Have ? DevExpress.XtraBars.BarItemVisibility.Always : DevExpress.XtraBars.BarItemVisibility.Never;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 楠岃瘉鏉冮檺
+        /// </summary>
+        public static void VerifyPeekForm(this MenuAuthorityHaveTreeDto auth, List<TilePeekItem> peekItems)
+        {
+            if (auth == null || auth.Children == null || auth.Children.Count < 1)
+                return;
+            if (peekItems == null || peekItems.Count < 1)
+                return;
+
+            peekItems.ForEach(item =>
+            {
+                if (item.Tag != null && !string.IsNullOrEmpty(item.Tag.ToString()))
+                {
+                    var authItem = auth.Children.Find(x => x.Permission == item.Tag.ToString());
+                    if (item != null)
+                    {
+                        item.Visibility = authItem.Have;
+                    }
+                }
+            });
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3