From 04ef5d66b53eff9175c2cb6dafda8b65872b9f52 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期三, 15 一月 2025 22:52:27 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/HStation.WinFrmUI.Auth.Core/00-core/PageAuthExtensions.cs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 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..6637407 100644 --- a/WinFrmUI/HStation.WinFrmUI.Auth.Core/00-core/PageAuthExtensions.cs +++ b/WinFrmUI/HStation.WinFrmUI.Auth.Core/00-core/PageAuthExtensions.cs @@ -1,10 +1,60 @@ 锘縰sing DevExpress.XtraBars.Docking2010; +using DevExpress.XtraBars.Ribbon; using DevExpress.XtraEditors.ButtonPanel; using System.Collections.Generic; +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