SVN-Revision: r916
This commit is contained in:
wyf
2025-08-07 03:29:11 +00:00
parent d38343fca0
commit b79fd5bd5e
2 changed files with 120 additions and 19 deletions
+9 -11
View File
@@ -390,6 +390,10 @@ namespace Lskj.Control
/// 导出名不包含日期
/// </summary>
public bool IgnoreTab = false;
/// <summary>
/// 创建动态分组列控件回调
/// </summary>
public event EventHandler OnBuildGroupedColumnCallBack;
public GridControlEx()
{
@@ -411,7 +415,7 @@ namespace Lskj.Control
this.gridView.CellMerge += new CellMergeEventHandler(OnGridViewCellMerge);
this.gridView.CustomSummaryCalculate += new CustomSummaryEventHandler(OnGridViewSummaryCalculate);
this.gridView.OptionsNavigation.EnterMoveNextColumn = true;
this.gridView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused;
this.gridView.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDownFocused;
this.SetGridRowHeightAndFont();
this.gridView.ShowFilterPopupCheckedListBox += new FilterPopupCheckedListBoxEventHandler(OnShowFilterPopupCheckedListBox);//(修复筛选条件)
//this.gridView.ValidateRow += OnGridView_ValidateRow;
@@ -442,7 +446,6 @@ namespace Lskj.Control
#endregion
}
/// <summary>
/// 保存前反写多表头数据源
/// </summary>
@@ -4265,8 +4268,6 @@ namespace Lskj.Control
hyperLinkEdit.LinkColor = System.Drawing.Color.Blue;
hyperLinkEdit.NullText = "";
hyperLinkEdit.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
// 设置超链接点击事件
hyperLinkEdit.Click += HyperLinkEdit_Click;
hyperLinkEdit.SingleClick = true;
hyperLinkEdit.Tag = model;
@@ -4292,8 +4293,6 @@ namespace Lskj.Control
hyperLinkEdit.LinkColor = System.Drawing.Color.Blue;
hyperLinkEdit.NullText = "";
hyperLinkEdit.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
// 设置超链接点击事件
hyperLinkEdit.Click += OnRightClick;
hyperLinkEdit.SingleClick = true;
hyperLinkEdit.Tag = model;
@@ -4331,7 +4330,6 @@ namespace Lskj.Control
{
this.OnAfterLinkCilk(unionright, null);//直接调用新增行方法,添加关联数据
}
}
}
}
@@ -7221,6 +7219,10 @@ namespace Lskj.Control
dynamicHeaders);
bandedGridControlEx.gridControl.DataSource = dynamicDataTable;
if (OnBuildGroupedColumnCallBack != null)
{
OnBuildGroupedColumnCallBack(bandedGridControlEx.BandedView, null);
}
}
@@ -8403,11 +8405,9 @@ namespace Lskj.Control
}
}
/// <summary>
/// 清空url图片列缓存
/// </summary>
private void ClearImage()
{
GridColumnCollection gridColumns = this.GridView.Columns;
@@ -8765,8 +8765,6 @@ namespace Lskj.Control
}
#endregion
/// <summary>
/// 新建汇总
/// </summary>
+106 -3
View File
@@ -27,6 +27,7 @@ using Lskj.Business;
using DevExpress.XtraGrid.Views.Grid;
using System.Threading.Tasks;
using System.Collections;
using DevExpress.XtraGrid.Views.BandedGrid;
namespace Lskj.Control
{
@@ -388,9 +389,14 @@ namespace Lskj.Control
/// <param name="isGridmerge"></param>
/// <param name="isAddPages"></param>
public void InitTabPages(List<GridDetailModel> gridDetail,
bool isGridmerge = true, bool isAddPages = false)
public void InitTabPages(List<GridDetailModel> gridDetail, bool isGridmerge = true, bool isAddPages = false)
{
if (ParentGridEx != null && ParentGridEx.CustomGroupBandEx != null)
{
ParentGridEx.CustomGroupBandEx.BandedView.LeftCoordChanged += OnBandedViewLeftCoordChanged;
ParentGridEx.CustomGroupBandEx.BandedView.ColumnWidthChanged += OnBandedViewColumnWidthChanged;
ParentGridEx.OnBuildGroupedColumnCallBack += OnBandedViewColumnWidthChanged;
}
this._gridDetail = gridDetail;
if (!isAddPages) this.xtc_container.TabPages.Clear();
@@ -828,6 +834,10 @@ namespace Lskj.Control
: model.UnionParentField;
gridEx.DetailKeyField = model.UnionValue;
gridEx.GridControlObj.ParentControl = gridEx.SearchObj;
if (gridEx.GridControlObj.CustomGroupBandEx != null)
{
gridEx.GridControlObj.CustomGroupBandEx.BandedView.LeftCoordChanged += OnBandedViewLeftCoordChanged;
}
gridEx.Tag = model;
if (model.IsCheck == 1)
{
@@ -2392,4 +2402,97 @@ namespace Lskj.Control
{
Object moduleObject = tabPage.Controls.Cast<Object>().FirstOrDefault();
if (moduleObject is ModuleGridEx)
{
ModuleGridEx moduleGridEx = moduleObject as ModuleGridEx;
bool SaveResults = moduleGridEx.SaveWhenSwitching();
if (!SaveResults) return false;
}
}
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
LogHelper.Instance.WriteError(ex);
return false;
}
return true;
}
/// <summary>
/// 控件注销时
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnTabControlExDisposed(object sender, EventArgs e)
{
PageControlsDic?.Clear();
DetailTabPagesDic?.Clear();
}
/// <summary>
/// 水平滚动条改变时
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnBandedViewLeftCoordChanged(object sender, EventArgs e)
{
BandedGridControlEx childBandView = null;
if (this.TabControlObj.SelectedTabPage != null && this.TabControlObj.SelectedTabPage.Controls.Count > 0)
{
foreach (System.Windows.Forms.Control item in this.TabControlObj.SelectedTabPage.Controls)
{
if (item is ModuleGridEx moduleGridEx && moduleGridEx.GridControlObj.CustomGroupBandEx != null)
{
childBandView = moduleGridEx.GridControlObj.CustomGroupBandEx;
break;
}
}
}
if (childBandView != null && ParentGridEx != null && ParentGridEx.CustomGroupBandEx != null)
{
if (sender == ParentGridEx.CustomGroupBandEx.BandedView)
{
childBandView.BandedView.LeftCoord = ParentGridEx.CustomGroupBandEx.BandedView.LeftCoord;
}
else if (sender == childBandView.BandedView)
{
ParentGridEx.CustomGroupBandEx.BandedView.LeftCoord = childBandView.BandedView.LeftCoord;
}
}
}
/// <summary>
/// 宽度改变事件处理,兼容BandedGridView和TreeList
/// </summary>
public void OnBandedViewColumnWidthChanged(object sender, EventArgs e)
{
BandedGridControlEx childBandView = null;
if (this.TabControlObj.SelectedTabPage != null && this.TabControlObj.SelectedTabPage.Controls.Count > 0)
{
foreach (System.Windows.Forms.Control item in this.TabControlObj.SelectedTabPage.Controls)
{
if (item is ModuleGridEx moduleGridEx && moduleGridEx.GridControlObj.CustomGroupBandEx != null)
{
childBandView = moduleGridEx.GridControlObj.CustomGroupBandEx;
break;
}
}
}
if (childBandView != null && ParentGridEx != null && ParentGridEx.CustomGroupBandEx != null)
{
int allWidth = 0;
// 如果sender为原有的BandedView类型
if (sender == ParentGridEx.CustomGroupBandEx.BandedView)
{
foreach (GridBand gridBand in ParentGridEx.CustomGroupBandEx.BandedView.Bands)
{
if (gridBand.Caption.Equals("基本信息"))
{
allWidth += gridBand.Width;
break;
}
}
}
else
{
return; // 非