SVN-Revision: r948
This commit is contained in:
tdx
2025-08-13 07:20:48 +00:00
parent e9edbd4540
commit 648ff1099d
3 changed files with 77 additions and 76 deletions
+57 -69
View File
@@ -455,7 +455,7 @@ namespace Lskj.Control
/// <summary>
/// 附加模块关联主表的树型模式
/// </summary>
public bool AdditionalAssociatedMain=false;
public bool AdditionalAssociatedMain = false;
/// <summary>
@@ -942,7 +942,21 @@ namespace Lskj.Control
this.panelControl1.Controls.Add(this.gcMain);
}
//如果配置了聚合模式则构建多表头覆盖当前表格
if (SysModel.IsCustomGroup == 1)
{
BandedGridControlEx bandedGridControlEx = new BandedGridControlEx();
bandedGridControlEx.moduleModel = this.SysModel;
bandedGridControlEx.Model = this.Model;
bandedGridControlEx.SysModel = this.SysModel;
bandedGridControlEx.Dock = DockStyle.Fill;
// 明确设置禁止自动调整列宽
bandedGridControlEx.BandedView.OptionsView.ColumnAutoWidth = false;
gcMain.CustomGroupBandEx = bandedGridControlEx;
this.panelControl1.Controls.Add(bandedGridControlEx);
bandedGridControlEx.BringToFront();
}
// 报表类型创建只读列
if (this.Model is DynamicReportModel)
{
@@ -992,20 +1006,20 @@ namespace Lskj.Control
this.gcMain.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, null);
}
//如果配置了聚合模式则构建多表头覆盖当前表格
if (SysModel.IsCustomGroup == 1)
{
BandedGridControlEx bandedGridControlEx = new BandedGridControlEx();
bandedGridControlEx.moduleModel = this.SysModel;
bandedGridControlEx.Model = this.Model;
bandedGridControlEx.SysModel = this.SysModel;
bandedGridControlEx.Dock = DockStyle.Fill;
// 明确设置禁止自动调整列宽
bandedGridControlEx.BandedView.OptionsView.ColumnAutoWidth = false;
gcMain.CustomGroupBandEx = bandedGridControlEx;
bandedGridControlEx.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, null);
this.panelControl1.Controls.Add(bandedGridControlEx);
bandedGridControlEx.BringToFront();
}
//if (SysModel.IsCustomGroup == 1)
//{
// BandedGridControlEx bandedGridControlEx = new BandedGridControlEx();
// bandedGridControlEx.moduleModel = this.SysModel;
// bandedGridControlEx.Model = this.Model;
// bandedGridControlEx.SysModel = this.SysModel;
// bandedGridControlEx.Dock = DockStyle.Fill;
// // 明确设置禁止自动调整列宽
// bandedGridControlEx.BandedView.OptionsView.ColumnAutoWidth = false;
// gcMain.CustomGroupBandEx = bandedGridControlEx;
// bandedGridControlEx.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, null);
// this.panelControl1.Controls.Add(bandedGridControlEx);
// bandedGridControlEx.BringToFront();
//}
InitializedragState();
SetGridRowHeightAndFont();
if (Model.IsBaseModule)
@@ -2154,8 +2168,8 @@ namespace Lskj.Control
mLeftFieldId = row[_leftGridField["fieldsqlid"] + ""] + "";
mLeftFieldName = row[_leftGridField["fieldsqlname"] + ""] + "";
mLeftGridData = row.ToJsonObject();
}
else if (row != null && AdditionalAssociatedMain)
}
else if (row != null && AdditionalAssociatedMain)
{
mLeftFieldId = row[ParentKeyField] + "";
mLeftFieldName = row[ParentKeyField] + "";
@@ -3588,7 +3602,7 @@ namespace Lskj.Control
this.gcMain.IgnoreTab = this.SysModel.IgnoreTab;
}
//判断是否隐藏数据导入按钮
string[] authorizedPersonnel = SysModel.ImportPermissions.Split(',');//有导入权限的人员
@@ -4184,24 +4198,27 @@ namespace Lskj.Control
{
try
{
int oldRowHandle = gcMain.GridView.FocusedRowHandle;
if (!(gcMain is TreeGridControlEx) && oldRowHandle < 0) return;
DataTable dt = this.gcMain.GridView.GetGridViewFilteredAndSortedDataToDataTable();
if (gcMain is TreeGridControlEx) dt = (gcMain as TreeGridControlEx).GetGridViewDataSource();
if (dt == null || dt.Rows.Count == 0) return;
DataRow SelectTheLine = gcMain is TreeGridControlEx ? (gcMain as TreeGridControlEx).GetViewFocusedDataRow() : dt.Rows[oldRowHandle];
this.SearchObj.RememberRow = (this.SysModel.AccordingNameSelected == 0);
this.SearchObj.SearchLastGrid();
if (this.SysModel.AccordingNameSelected != 0)//根据主键刷新目标选中行
if (DetailRightGridCallBack == null)//刷新所有页签本身会刷新自己
{
DataRow items = dt.Rows.Cast<DataRow>().FirstOrDefault(x => x[ParmaryKey].Equals(SelectTheLine[ParmaryKey]));
dt = this.gcMain.GridView.GetGridViewFilteredAndSortedDataToDataTable();
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = dt;
int numberOfRows = bindingSource.Find(ParmaryKey, SelectTheLine[ParmaryKey].ToString());
this.gcMain.GridView.ClearSelection();
this.gcMain.GridView.FocusedRowHandle = numberOfRows;
this.gcMain.GridView.SelectRow(numberOfRows);
int oldRowHandle = gcMain.GridView.FocusedRowHandle;
if (!(gcMain is TreeGridControlEx) && oldRowHandle < 0) return;
DataTable dt = this.gcMain.GridView.GetGridViewFilteredAndSortedDataToDataTable();
if (gcMain is TreeGridControlEx) dt = (gcMain as TreeGridControlEx).GetGridViewDataSource();
if (dt == null || dt.Rows.Count == 0) return;
DataRow SelectTheLine = gcMain is TreeGridControlEx ? (gcMain as TreeGridControlEx).GetViewFocusedDataRow() : dt.Rows[oldRowHandle];
this.SearchObj.RememberRow = (this.SysModel.AccordingNameSelected == 0);
this.SearchObj.SearchLastGrid();
if (this.SysModel.AccordingNameSelected != 0)//根据主键刷新目标选中行
{
DataRow items = dt.Rows.Cast<DataRow>().FirstOrDefault(x => x[ParmaryKey].Equals(SelectTheLine[ParmaryKey]));
dt = this.gcMain.GridView.GetGridViewFilteredAndSortedDataToDataTable();
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = dt;
int numberOfRows = bindingSource.Find(ParmaryKey, SelectTheLine[ParmaryKey].ToString());
this.gcMain.GridView.ClearSelection();
this.gcMain.GridView.FocusedRowHandle = numberOfRows;
this.gcMain.GridView.SelectRow(numberOfRows);
}
}
if (this.RightGridCallBack != null) this.RightGridCallBack(sender, e);
if (DetailRightGridCallBack != null) this.DetailRightGridCallBack(sender, e);
@@ -5081,7 +5098,7 @@ namespace Lskj.Control
}
}
}
catch (Exception ex)
{
@@ -5091,7 +5108,7 @@ namespace Lskj.Control
}
/// <summary>
/// <para>说明:粘贴表格后更新树结构关联字段</para>
@@ -5198,7 +5215,7 @@ namespace Lskj.Control
{
List<SimpleButton> buttons = new List<SimpleButton>();//没有隐藏的按钮集合
//刷新按钮
//刷新按钮
//刷新按钮
if (SystemInfo.Instance.FoundationHideTableRefresh)
{
this.btnRefresh.Visible = false;
@@ -5615,33 +5632,4 @@ namespace Lskj.Control
// 获取字体和最大宽度
Document document = richEdit.Document;
Font font = richEdit.Font;
int maxWidth = richEdit.ClientSize.Width - richEdit.Padding.Horizontal;
// 获取前3行文本
string[] lines = richEdit.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
int lineCount = Math.Min(4, lines.Length);
string firstThreeLines = string.Join(Environment.NewLine, lines.Take(lineCount));
// 创建StringFormat
StringFormat format = new StringFormat(StringFormat.GenericTypographic);
format.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
// 测量文本高度
using (Graphics g = richEdit.CreateGraphics())
{
SizeF textSize = g.MeasureString(
firstThreeLines,
font,
maxWidth,
format
);
return (int)Math.Ceiling(textSize.Height);
}
}
}
}
+2
View File
@@ -1283,6 +1283,8 @@ namespace Lskj.Control
tabMultipledetails.ParentControlEx = this.ParentControlEx;
tabMultipledetails.IsDragDetail = this.IsDragDetail;
tabMultipledetails.Model = this.Model;
tabMultipledetails.OnSaveGridCallBack += OnDetailSaveGridCallBack;
tabMultipledetails.DetailRightGridCallBack += OnDetailRightCallback;
tabMultipledetails.DrgaParentPrimaryKey = this.DrgaParentPrimaryKey;
tabMultipledetails.InitTabPages(isMeage);
tabMultipledetails.Dock = DockStyle.Fill;
+18 -7
View File
@@ -80,8 +80,15 @@ namespace Lskj.Control
/// <summary>
/// 左侧表刷新右侧表
/// </summary>
public bool UnioDetail=false;
public bool UnioDetail = false;
/// <summary>
/// Occurs when [on Save Grid call back].
/// </summary>
public event EventHandler OnSaveGridCallBack;
/// <summary>
/// 下面明细表右键执行后回调
/// </summary>
public event EventHandler DetailRightGridCallBack;
#endregion
#region
/// <summary>
@@ -244,6 +251,10 @@ namespace Lskj.Control
gridEx.ParentKeyField = string.IsNullOrEmpty(model.UnionParentField) ? model.SystemModel.ParmaryKey : model.UnionParentField;
gridEx.DetailKeyField = model.UnionValue;
gridEx.GridControlObj.ParentControl = gridEx.SearchObj;
gridEx.OnSaveGridCallBack += OnSaveGridCallBack;
gridEx.DetailRightGridCallBack += DetailRightGridCallBack;
//左侧表设置后,添加事件。行改变时刷新右侧表
if (model.IsUnioDetail)
{
@@ -723,9 +734,9 @@ namespace Lskj.Control
gridEx2.GridControlObj.GridView.SelectRowHandler(oldRowHandle2);
}
}
catch (Exception ex)
catch (Exception ex)
{
}
}
@@ -738,7 +749,7 @@ namespace Lskj.Control
{
try
{
if (this.gridEx1.SearchObj != null)
if (this.gridEx1.SearchObj != null)
{
foreach (ControlModel item in this.gridEx1.SearchObj.ControlModels)
{
@@ -748,7 +759,7 @@ namespace Lskj.Control
}
}
}
if (this.gridEx2.SearchObj != null)
if (this.gridEx2.SearchObj != null)
{
foreach (ControlModel item in this.gridEx2.SearchObj.ControlModels)
{
@@ -758,7 +769,7 @@ namespace Lskj.Control
}
}
}
}
catch (Exception ex)
{