feat: 优化主界面及控件功能
This commit is contained in:
@@ -255,9 +255,10 @@ namespace Lskj.Control
|
||||
|
||||
/// <summary>
|
||||
/// 设置当前页签内 ModuleGridEx 底部操作栏是否可交互。
|
||||
/// 只处理左右结构右侧页签里直接承载的 ModuleGridEx,不影响普通页签和左侧表。
|
||||
/// 左右结构中,右侧明细是否允许操作由左侧主表是否有数据决定,
|
||||
/// 不能使用右侧明细查询结果判断,否则右侧为空时无法新增第一行。
|
||||
/// </summary>
|
||||
private void SetModuleGridBottomPanelEnabled(XtraTabPage tabPage, bool enabled)
|
||||
private void SetModuleGridBottomPanelEnabled(XtraTabPage tabPage, GridControlEx leftGrid)
|
||||
{
|
||||
if (tabPage == null) return;
|
||||
if (!_rightSideTabPages.Contains(tabPage)) return;
|
||||
@@ -265,7 +266,7 @@ namespace Lskj.Control
|
||||
ModuleGridEx moduleGrid = tabPage.Controls.OfType<ModuleGridEx>().FirstOrDefault();
|
||||
if (moduleGrid != null && moduleGrid.ObjPanel != null)
|
||||
{
|
||||
moduleGrid.ObjPanel.Enabled = enabled;
|
||||
moduleGrid.ObjPanel.Enabled = leftGrid != null && leftGrid.DataRowCount() > 0;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -286,7 +287,7 @@ namespace Lskj.Control
|
||||
if (model == null)
|
||||
{
|
||||
BindTableToPage(tabPage, new DataTable());
|
||||
SetModuleGridBottomPanelEnabled(tabPage, false);
|
||||
SetModuleGridBottomPanelEnabled(tabPage, leftGrid);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -311,12 +312,12 @@ namespace Lskj.Control
|
||||
sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue);
|
||||
DataTable dt = MainImpl.GetDataTableResult(sqlValue);
|
||||
BindTableToPage(tabPage, dt);
|
||||
SetModuleGridBottomPanelEnabled(tabPage, dt != null && dt.Rows.Count > 0);
|
||||
SetModuleGridBottomPanelEnabled(tabPage, leftGrid);
|
||||
}
|
||||
else
|
||||
{
|
||||
BindTableToPage(tabPage, new DataTable());
|
||||
SetModuleGridBottomPanelEnabled(tabPage, false);
|
||||
SetModuleGridBottomPanelEnabled(tabPage, leftGrid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -335,7 +336,7 @@ namespace Lskj.Control
|
||||
if (!visible)
|
||||
{
|
||||
BindTableToPage(tabPage, new DataTable());
|
||||
SetModuleGridBottomPanelEnabled(tabPage, false);
|
||||
SetModuleGridBottomPanelEnabled(tabPage, leftGrid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -418,7 +419,7 @@ namespace Lskj.Control
|
||||
|
||||
DataTable table = MainImpl.GetDataTableResult(finalSql);
|
||||
BindTableToPage(tabPage, table, finalSql);
|
||||
SetModuleGridBottomPanelEnabled(tabPage, table != null && table.Rows.Count > 0);
|
||||
SetModuleGridBottomPanelEnabled(tabPage, leftGrid);
|
||||
tabPage.Text = $"{model.DetailName}({table.Rows.Count}条)";
|
||||
tabPage.Appearance.Header.ForeColor = table.Rows.Count > 0 ? Color.Red : Color.FromArgb(0, 0, 0);
|
||||
// 首次加载自动查询
|
||||
|
||||
Reference in New Issue
Block a user