SVN-Revision: r902
This commit is contained in:
tdx
2025-08-05 07:55:42 +00:00
parent 1c0737e1ae
commit becff23d95
2 changed files with 97 additions and 49 deletions
+34 -1
View File
@@ -30,6 +30,7 @@ using Lskj.Core;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
using DevExpress.XtraGrid.Columns;
namespace Lskj.Control
{
@@ -377,7 +378,11 @@ namespace Lskj.Control
}
else
{
if(this.ModuleGridObj.GridControlObj.CustomGroupBandEx!=null) this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
if (this.ModuleGridObj.GridControlObj.CustomGroupBandEx != null)
{
this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GridView.MouseDown += new MouseEventHandler(GridView_MouseDown);
this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
}
this.ModuleGridObj.GridControlObj.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
//this.ModuleGridObj.GridControlObj.GridView.RowCellClick += new RowCellClickEventHandler(GridView_RowCellClick);
this.ModuleGridObj.GridControlObj.GridView.MouseDown += new MouseEventHandler(GridView_MouseDown);
@@ -892,13 +897,41 @@ namespace Lskj.Control
{
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
}
//sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
DataRow row = this.ModuleGridObj.GridControlObj.GetViewFocusedDataRow();
if (row != null && isLeft)
{
//先替换左侧选中行,在替换主表
sqlValue = ReplaceHelper.ReplaceRowParam(row, sqlValue);
}
// ① 先拿普通 GridView 的焦点列(始终会有)
GridColumn fixColumn = this.ModuleGridObj.GridControlObj.GridView.FocusedColumn;
string columnCaption = fixColumn?.Caption ?? string.Empty;
/* ② 如果启用了多表头(CustomGroupBandEx)
* 尝试用 BandedGridColumn.OwnerBand 获取 Band 标题 */
var bandEx = this.ModuleGridObj.GridControlObj.CustomGroupBandEx;
if (bandEx != null)
{
var bandedView = bandEx.GridView as DevExpress.XtraGrid.Views.BandedGrid.BandedGridView;
if (bandedView != null && bandedView.FocusedColumn != null)
{
// 强转;成功才说明列属于 BandedGridView
var bcol = bandedView.FocusedColumn as DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn;
if (bcol != null && bcol.OwnerBand != null)
{
// 若只想最顶层 Band,循环 ParentBand 至 null
var band = bcol.OwnerBand;
while (band.ParentBand != null) band = band.ParentBand;
columnCaption = band.Caption; // 用 Band 的标题
}
}
}
// ③ 替换占位符(Replace 会返回新字符串)
sqlValue = sqlValue.Replace("{COLUMN_TITLE}", columnCaption);
if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue))
{
string Conditions = string.Empty;