SVN-Revision: r880
This commit is contained in:
wyf
2025-07-23 01:19:33 +00:00
parent 443703f29c
commit 0d0cc46910
9 changed files with 225 additions and 121 deletions
+119 -26
View File
@@ -186,6 +186,10 @@ namespace Lskj.Main.Control
/// </summary>
private bool isFlowLayout = false;
/// <summary>
///分组时快捷菜单是否显示在内部
/// </summary>
private bool isShowGrallyInTop = false;
/// <summary>
///模式3打开,上一次点击的时间
/// </summary>
public DateTime lastClickTime;
@@ -647,6 +651,12 @@ namespace Lskj.Main.Control
/// </summary>
private void SetMenus()
{
string[] menuFiles = null;
if (Directory.Exists(PubUtil.ModuleDefaultPath))
{
menuFiles = Directory.GetFiles(PubUtil.ModuleDefaultPath);
}
Random rand = new Random();
DataTable gallerys = MainImpl.GetGallerysByUserId();
var baseTable = gallerys.Select("grouptagid=1");
var reportTable = gallerys.Select("grouptagid=2");
@@ -663,7 +673,8 @@ namespace Lskj.Main.Control
{
int buttonTop = Convert.ToInt32(0.05 * DpiY); // 按钮上边距
int menuLeft = Convert.ToInt32(0.05 * DpiY), menuTop = Convert.ToInt32(0.05 * DpiY); // 模块距离左边距,模块距离顶部边距
int menuWidth = Convert.ToInt32(2.92 * DpiX), menuHeight = Convert.ToInt32(0.73 * DpiY); // 模块宽度,模块高度
int menuWidth = Convert.ToInt32(2.5 * DpiX), menuHeight = Convert.ToInt32(0.73 * DpiY); // 模块宽度,模块高度
int buttonWidth = Convert.ToInt32(0.44 * DpiX), buttonHeight = Convert.ToInt32(0.44 * DpiY); // 模块宽度,模块高度
//int centerWidth = pl_center_main.Width - pl_center_main_right.Width; // 内容区域宽度-右侧快捷栏宽度
int centerWidth = pl_center_main_middle.Width; // 内容区域宽度
string defaultParentMenu = string.Empty;
@@ -674,16 +685,28 @@ namespace Lskj.Main.Control
{
pl_center_left.Width = SystemInfo.Instance.MenuBarWidth;
}
if (this._allMenus.Columns.Contains("groupcaption") && !isFlowLayout)
#region
isShowGrallyInTop = SystemInfo.Instance.ShowGrallyInTop;
if (!isShowGrallyInTop)
{
collectPanel.Visible = false;
panelSplit.Visible = false;
botTipsPanel.Visible = false;
}
if (this._allMenus.Columns.Contains("groupcaption") && !isFlowLayout && isShowGrallyInTop)
{
//添加我的收藏快捷菜单
GroupControl baseGroupControl = new GroupControl();
baseGroupControl.TipsLabel.ForeColor = Color.DimGray;
GroupControl reportGroupControl = new GroupControl();
reportGroupControl.TipsLabel.ForeColor = Color.DimGray;
FlowLayoutPanel baseFlowPanel = new FlowLayoutPanel();
FlowLayoutPanel reportFlowPanel = new FlowLayoutPanel();
baseFlowPanel.Padding = new Padding(menuLeft, 0, 0, 0);
baseFlowPanel.Margin = new Padding(0, 0, 0, 0);
reportFlowPanel.Padding = new Padding(menuLeft, 0, 0, 0);
reportFlowPanel.Margin = new Padding(0, 0, 0, 0);
if (baseTable.Count() > 0)
{
baseGroupControl.Dock = DockStyle.Top;
baseFlowPanel.Dock = DockStyle.Fill;
baseFlowPanel.FlowDirection = FlowDirection.LeftToRight;
baseGroupControl.MenuPanel.Controls.Add(baseFlowPanel);
@@ -694,15 +717,29 @@ namespace Lskj.Main.Control
string hoverImg = PubUtil.MainMenuDefaultImage + dataRow["MouseOverImg1"] + "";
string[] menuTag = new string[] { dataRow["DllFileName"] + "", dataRow["PurviewId"] + "", dataRow["LMenuId"] + "", dataRow["UrlParams"] + "", dataRow["LSubSysId"] + "", dataRow["dllShowCaption"] + "" };
Menu_ItemNew menu = new Menu_ItemNew();
menu.Margin = new Padding(0, 0, 20, 0);
menu.Name = groupMenuId;
menu.Size = new Size(menuWidth, menuHeight);
menu.GetLabelTitle().ForeColor = Color.FromArgb(88, 85, 85);
menu.GetButton().Size = new Size(buttonWidth, buttonHeight);
menu.SetMenuCaption(dataRow["dllShowCaption"] + "");
menu.SetSubCaption(dataRow["SubSysName"] + "-" + dataRow["menucaption"]);
menu.SetRoundRadius = 20;
menu.Tag = menuTag;
menu.Click += OnMenuItemClick;
menu.SetMenuImg(File.Exists(defaultImg) ? Image.FromFile(defaultImg) : Resources.default_icon);
menu.SetMenuHoverImg(File.Exists(hoverImg) ? Image.FromFile(hoverImg) : Resources.default_icon);
string randomImage = "";
if (Directory.Exists(PubUtil.ModuleDefaultPath))
{
string[] files = Directory.GetFiles("Images\\Main\\Module\\Default");
if (files.Length > 0)
{
int index = rand.Next(files.Length);
randomImage = files[index];
}
}
menu.SetMenuImg(File.Exists(defaultImg) ? Image.FromFile(defaultImg) : File.Exists(randomImage) ? Image.FromFile(randomImage) : Resources.default_icon);
menu.SetMenuHoverImg(File.Exists(hoverImg) ? Image.FromFile(hoverImg) : File.Exists(PubUtil.ModuleHoverImg) ? Image.FromFile(PubUtil.ModuleHoverImg) : Resources.default_icon);
menu.SetMenuHoverBorderImg(File.Exists(PubUtil.ModuleChooesImg) ? Image.FromFile(PubUtil.ModuleChooesImg) : null);
baseFlowPanel.Controls.Add(menu);
this._menuItemList.Add(menu);
//DataRow modelRow = MainImpl.GetSystemdllTab(item["PurviewId"] + "");
@@ -713,12 +750,12 @@ namespace Lskj.Main.Control
countSqls.Add(groupMenuId, countSql);
}
}
baseGroupControl.Dock = DockStyle.Top;
collectMenuPanel.Controls.Add(baseGroupControl);
baseGroupControl.TipsText = $"快捷操作通道({baseTable.Count()}";
}
if (reportTable.Count() > 0)
{
reportGroupControl.Dock = DockStyle.Top;
reportFlowPanel.Dock = DockStyle.Fill;
reportFlowPanel.FlowDirection = FlowDirection.LeftToRight;
reportGroupControl.MenuPanel.Controls.Add(reportFlowPanel);
@@ -729,15 +766,28 @@ namespace Lskj.Main.Control
string hoverImg = PubUtil.MainMenuDefaultImage + dataRow["MouseOverImg1"] + "";
string[] menuTag = new string[] { dataRow["DllFileName"] + "", dataRow["PurviewId"] + "", dataRow["LMenuId"] + "", dataRow["UrlParams"] + "", dataRow["LSubSysId"] + "", dataRow["dllShowCaption"] + "" };
Menu_ItemNew menu = new Menu_ItemNew();
menu.Margin = new Padding(0, 0, 20, 0);
menu.Name = groupMenuId;
menu.Size = new Size(menuWidth, menuHeight);
menu.GetLabelTitle().ForeColor = Color.FromArgb(88, 85, 85);
menu.GetButton().Size = new Size(buttonWidth, buttonHeight);
menu.SetMenuCaption(dataRow["dllShowCaption"] + "");
menu.SetSubCaption(dataRow["SubSysName"] + "-" + dataRow["menucaption"]);
menu.SetRoundRadius = 20;
menu.Tag = menuTag;
menu.Click += OnMenuItemClick;
menu.SetMenuImg(File.Exists(defaultImg) ? Image.FromFile(defaultImg) : Resources.default_icon);
menu.SetMenuHoverImg(File.Exists(hoverImg) ? Image.FromFile(hoverImg) : Resources.default_icon);
string randomImage = "";
if (Directory.Exists(PubUtil.ModuleDefaultPath))
{
if (menuFiles.Length > 0)
{
int index = rand.Next(menuFiles.Length);
randomImage = menuFiles[index];
}
}
menu.SetMenuImg(File.Exists(defaultImg) ? Image.FromFile(defaultImg) : File.Exists(randomImage) ? Image.FromFile(randomImage) : Resources.default_icon);
menu.SetMenuHoverImg(File.Exists(hoverImg) ? Image.FromFile(hoverImg) : File.Exists(PubUtil.ModuleHoverImg) ? Image.FromFile(PubUtil.ModuleHoverImg) : Resources.default_icon);
menu.SetMenuHoverBorderImg(File.Exists(PubUtil.ModuleChooesImg) ? Image.FromFile(PubUtil.ModuleChooesImg) : null);
reportFlowPanel.Controls.Add(menu);
this._menuItemList.Add(menu);
//DataRow modelRow = MainImpl.GetSystemdllTab(item["PurviewId"] + "");
@@ -748,24 +798,42 @@ namespace Lskj.Main.Control
countSqls.Add(groupMenuId, countSql);
}
}
reportGroupControl.Dock = DockStyle.Top;
collectMenuPanel.Controls.Add(reportGroupControl);
reportGroupControl.TipsText = $"快捷报表通道({reportTable.Count()}";
}
reportGroupControl.Height = reportFlowPanel.Controls[reportFlowPanel.Controls.Count - 1].Location.Y + menuHeight + 28;
baseGroupControl.Height = baseFlowPanel.Controls[baseFlowPanel.Controls.Count - 1].Location.Y + menuHeight + 28;
collectPanel.Height = baseGroupControl.Height + reportGroupControl.Height + 26;
collectPanel.SizeChanged += (s, e) =>
if (reportTable.Count() > 0)
{
reportGroupControl.Height = reportFlowPanel.Controls[reportFlowPanel.Controls.Count - 1].Location.Y + menuHeight + 28;
baseGroupControl.Height = baseFlowPanel.Controls[baseFlowPanel.Controls.Count - 1].Location.Y + menuHeight + 28;
collectPanel.Height = baseGroupControl.Height + reportGroupControl.Height + 26;
};
reportGroupControl.Height = reportFlowPanel.Controls[reportFlowPanel.Controls.Count - 1].Location.Y + menuHeight + 28 + 16;
}
if (baseTable.Count() > 0)
{
baseGroupControl.Height = baseFlowPanel.Controls[baseFlowPanel.Controls.Count - 1].Location.Y + menuHeight + 28 + 16;
}
collectPanel.Height = baseGroupControl.Height + reportGroupControl.Height + 26;
if (reportTable.Count() == 0 && baseTable.Count() == 0)
{
collectPanel.Visible = false;
panelSplit.Visible = false;
}
if (reportTable.Count() > 0 || baseTable.Count() > 0)
{
collectPanel.SizeChanged += (s, e) =>
{
if (reportTable.Count() > 0)
{
reportGroupControl.Height = reportFlowPanel.Controls[reportFlowPanel.Controls.Count - 1].Location.Y + menuHeight + 28 + 16;
}
if (baseTable.Count() > 0)
{
baseGroupControl.Height = baseFlowPanel.Controls[baseFlowPanel.Controls.Count - 1].Location.Y + menuHeight + 28 + 16;
}
collectPanel.Height = baseGroupControl.Height + reportGroupControl.Height + 26;
};
}
this.splitMainControl.Panel2Collapsed = true;
}
#endregion
foreach (DataRow item in rows)
{
string menuStruct = item["menustruct"] + "";
@@ -946,14 +1014,20 @@ namespace Lskj.Main.Control
Panel groupPanel = new Panel();
groupPanel.AutoScroll = true;
groupPanel.Dock = DockStyle.Fill;
int groupControlIndex = 0;
foreach (IGrouping<int, DataRow> groupByDataRow in groupByDataRows)
{
int nowRowCount = 1;//当前行数
int minMenuRow = this._allMenus.Columns.Contains("menuRow") ? groupByDataRow.Min(n => Convert.ToInt32(n["menuRow"])) : 1;
int menuGroupLeft = Convert.ToInt32(0.05 * DpiY);
int menuGroupTop = Convert.ToInt32(0.05 * DpiY); // 模块距离左边距,模块距离顶部边距
int menuGroupTop = 0; // 模块距离左边距,模块距离顶部边距
GroupControl groupControl = new GroupControl();
groupControl.TipsLabel.ForeColor = Color.DimGray;
groupControl.Dock = DockStyle.Top;
if (groupControlIndex == groupByDataRows.Count() - 1 && !isShowGrallyInTop)
{
groupControl.Padding = new Padding(0, 0, 0, 0);
}
groupPanel.Controls.Add(groupControl);
List<DataRow> groupOrderDataRow = groupByDataRow.ToList();
if (this._allMenus.Columns.Contains("menuRow"))
@@ -976,6 +1050,7 @@ namespace Lskj.Main.Control
groupIndex = groupByDataRows.Where(n => !n.Key.Equals(99)).Count() > 0 ? groupByDataRows.Where(n => !n.Key.Equals(99)).Max(n => n.Key) + 1 : 1;
}
Menu_ItemNew menu = new Menu_ItemNew();
menu.GetLabelTitle().ForeColor = Color.FromArgb(88, 85, 85);
menu.menuRow = dataRow.Table.Columns.Contains("menuRow") && !string.IsNullOrEmpty(dataRow["menuRow"] + "") ? Convert.ToInt32(dataRow["menuRow"] + "") : 1;
menu.menuGroup = groupIndex;
if ((menu.menuRow - minMenuRow + 1) > nowRowCount + 1)
@@ -991,14 +1066,25 @@ namespace Lskj.Main.Control
}
menu.Name = groupMenuId;
menu.Size = new Size(menuWidth, menuHeight);
menu.GetButton().Size = new Size(buttonWidth, buttonHeight);
menu.menuNode = (dataRow["menustruct"] + "").Substring(0, 2);
menu.SetMenuCaption(dataRow["menucaption"] + "");
menu.SetSubCaption(dataRow["SubSysName"] + "-" + item["menucaption"]);
menu.SetRoundRadius = 20;
menu.Tag = menuTag;
menu.Click += OnMenuItemClick;
menu.SetMenuImg(File.Exists(defaultImg) ? Image.FromFile(defaultImg) : Resources.default_icon);
menu.SetMenuHoverImg(File.Exists(hoverImg) ? Image.FromFile(hoverImg) : Resources.default_icon);
string randomImage = "";
if (Directory.Exists(PubUtil.ModuleDefaultPath))
{
if (menuFiles.Length > 0)
{
int index = rand.Next(menuFiles.Length);
randomImage = menuFiles[index];
}
}
menu.SetMenuImg(File.Exists(defaultImg) ? Image.FromFile(defaultImg) : File.Exists(randomImage) ? Image.FromFile(randomImage) : Resources.default_icon);
menu.SetMenuHoverImg(File.Exists(hoverImg) ? Image.FromFile(hoverImg) : File.Exists(PubUtil.ModuleHoverImg) ? Image.FromFile(PubUtil.ModuleHoverImg) : Resources.default_icon);
menu.SetMenuHoverBorderImg(File.Exists(PubUtil.ModuleChooesImg) ? Image.FromFile(PubUtil.ModuleChooesImg) : null);
// 116
//menuGroupLeft += Convert.ToInt32(1.20 * DpiX);
//后台配置模块所在行数
@@ -1018,7 +1104,7 @@ namespace Lskj.Main.Control
nowRowCount = (menu.menuRow - minMenuRow + 1);
}
menu.Location = new Point(menuGroupLeft, menuGroupTop);
menuGroupLeft += Convert.ToInt32(2.92 * DpiX);
menuGroupLeft += Convert.ToInt32(2.5 * DpiX) + 20;
//int count = _menuItemList.Where(o => o.menuGroup == menu.menuGroup && o.menuRow == menu.menuRow && o.menuNode == menu.menuNode).Count();
//menuGroupLeft = count == 0 ? 5 : count * Convert.ToInt32(1.20 * DpiX) + 5;
//menuGroupTop = menuHeight * (menu.menuRow - minMenuRow);
@@ -1027,7 +1113,7 @@ namespace Lskj.Main.Control
else
{
menu.Location = new Point(menuGroupLeft, menuGroupTop);
menuGroupLeft += Convert.ToInt32(2.92 * DpiX);
menuGroupLeft += Convert.ToInt32(2.5 * DpiX) + 20;
// 换行显示
if (menuGroupLeft + menuWidth > centerWidth)
{
@@ -1058,8 +1144,9 @@ namespace Lskj.Main.Control
count += 1;
}
}
groupControlIndex += 1;
groupControl.TipsText = $"{groupControl.TipsText}({count})";
groupControl.Height = (int)(menuGroupTop + menuHeight + 28);
groupControl.Height = (int)(menuGroupTop + menuHeight + 28 + 16);
}
if (groupPanel.Controls.Count == 1)
{
@@ -1072,8 +1159,13 @@ namespace Lskj.Main.Control
// 默认显示
if (defaultParentMenu == menuStruct)
{
this.allMenuPanel.Controls.Clear();
this.allMenuPanel.Controls.Add(groupPanel);
groupPanel.Visible = true;
}
else
{
this.allMenuPanel.Controls.Add(groupPanel);
groupPanel.Visible = false;
}
}
#endregion
@@ -2279,6 +2371,7 @@ namespace Lskj.Main.Control
if (this._groupItems.ContainsKey(item_after["menustruct"] + ""))
{
Panel groupPanel = this._groupItems[item_after["menustruct"] + ""];
groupPanel.Visible = true;
allMenuPanel.Controls.Add(groupPanel);
}
}
@@ -4160,7 +4253,7 @@ namespace Lskj.Main.Control
if (SystemInfo.Instance.DesktopFormatShowGallerys)
{
this.splitMainControl.Panel2Collapsed = false;
if (this._allMenus.Columns.Contains("groupcaption") && !isFlowLayout)
if (this._allMenus.Columns.Contains("groupcaption") && !isFlowLayout && isShowGrallyInTop)
{
this.splitMainControl.Panel2Collapsed = true;
}
@@ -4178,7 +4271,7 @@ namespace Lskj.Main.Control
tabPage.Controls.Add(this.FirstMain);
this.webBrowser.Show();
this.webBrowser.BringToFront();
if (this.webBrowser.cefBrowserSettings != null) this.webBrowser.cefBrowserSettings.Reload();
//if (this.webBrowser.cefBrowserSettings != null) this.webBrowser.cefBrowserSettings.Reload();
int MemuEventType = 1;
//左侧二级目录菜单设置为单击切换模式
foreach (System.Windows.Forms.Control item in pl_center_left.Controls)