From 9f5f4cf65c0dc2f63777c3a1e55fbc058a8f3233 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期五, 29 八月 2025 16:52:00 +0800
Subject: [PATCH] bug
---
DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs | 94 +++++++++++++++++++++++++++++++++++++++-------
1 files changed, 79 insertions(+), 15 deletions(-)
diff --git a/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs b/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs
index 68187f0..2f42c04 100644
--- a/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs
+++ b/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs
@@ -1,8 +1,12 @@
锘縰sing Gs.DevApp.DevFrm.Rpt;
+using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
+using System.Data;
+using System.Drawing;
using System.Windows.Forms;
+
namespace Gs.DevApp.UserControl
{
@@ -17,7 +21,6 @@
btnPrintClick(this, e);
else
return;
-
if (rptParameter == "return false")
return;
if (string.IsNullOrEmpty(rptParameter))
@@ -25,24 +28,44 @@
MsgHelper.ShowError("娌℃湁鎸囧畾鎶ヨ〃鍙傛暟锛岃鑱旂郴鎶�鏈紑鍙戜汉鍛橈紒");
return;
}
- var _bl = false;
- _bl = _ckRptService();
- if (_bl)
+ #region 濡傛灉鏄鎴风殑鍚庣洊鐮�
+ if (rptParameter.Contains("rpt_hgm"))
{
+ var _obj = new
+ {
+ keyType = "瀹㈡埛妯℃澘"
+ };
+ var json = JsonConvert.SerializeObject(_obj);
try
{
- using (Form frm = new RptPreview(guidKey, rptParameter))
+ var strReturn =
+ UtilityHelper.HttpPost("", "Report/GetTemplateList", json);
+ ReturnModel<DataTable> dd = UtilityHelper.ReturnToList(strReturn);
+ DataTable dt = dd.rtnData;
+ if (dd.rtnCode > 0)
{
- frm.ShowDialog();
+ // 鍒涘缓鎴栬幏鍙栦竴涓狢ontextMenu瀵硅薄锛堜緥濡備娇鐢–ontextMenuStrip锛�
+ ContextMenu contextMenu = new ContextMenu();
+ foreach (DataRow dr in dt.Rows)
+ {
+ MenuItem menuItem1 = new MenuItem(dr["reportType"].ToString() + "銆�" + dr["reportName"].ToString() + "銆�");
+ menuItem1.Click += (ss, ee) =>
+ {
+ rptParameter = rptParameter.Replace("rpt_hgm", dr["reportType"].ToString());
+ _print();
+ };
+ contextMenu.MenuItems.Add(menuItem1);
+ }
+ // 鏄剧ず鑿滃崟鍦ㄦ寜閽殑浣嶇疆
+ contextMenu.Show(btnPrint, new Point(0, btnPrint.Height)); // 璋冩暣绗簩涓弬鏁颁互璋冩暣鑿滃崟鐨勬樉绀轰綅缃�
+ return;
}
}
- catch (Exception)
- {
- }
- return;
+ catch (Exception ex)
+ { }
}
-
- MsgHelper.ShowError("娌℃湁璁捐妯℃澘锛岃鍏堣璁℃ā鏉匡紒");
+ #endregion
+ _print();
};
this.btnAll.Click += (s, e) =>
{
@@ -104,11 +127,52 @@
}
- public void SetPlButton( bool blPiLiang) {
+ /// <summary>
+ /// 璁剧疆鎵归噺鎸夐挳鍙鎬�
+ /// </summary>
+ /// <param name="blPiLiang"></param>
+ public void SetPlButton(bool blPiLiang)
+ {
if (blPiLiang == true)
- this.layoutControlItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
+ this.lay3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
else
- this.layoutControlItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+ this.lay3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+ }
+
+ /// <summary>
+ /// 璁剧疆纭畾鎸夐挳鍙鎬�
+ /// </summary>
+ /// <param name="blPiLiang"></param>
+ public void SetPrintButton(bool blPiLiang)
+ {
+ if (blPiLiang == true)
+ this.lay1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
+ else
+ this.lay1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private void _print()
+ {
+ var _bl = false;
+ _bl = _ckRptService();
+ if (_bl)
+ {
+ try
+ {
+ using (Form frm = new RptPreview(guidKey, rptParameter))
+ {
+ frm.ShowDialog();
+ }
+ }
+ catch (Exception)
+ {
+ }
+ return;
+ }
+ MsgHelper.ShowError("娌℃湁璁捐妯℃澘锛岃鍏堣璁℃ā鏉匡紒");
}
}
}
--
Gitblit v1.9.3