SVN r1104
SVN-Revision: r1104
This commit is contained in:
@@ -152,7 +152,10 @@ namespace Lskj.Control
|
||||
/// 按钮形式展示的右键
|
||||
/// </summary>
|
||||
private List<SimpleButton> RightButtons = new List<SimpleButton>();
|
||||
|
||||
/// <summary>
|
||||
/// 附加右键菜单集合
|
||||
/// </summary>
|
||||
public List<SimpleButton> itemCommonList = new List<SimpleButton>();
|
||||
|
||||
/// <summary>
|
||||
/// 排序关联值
|
||||
@@ -382,6 +385,12 @@ namespace Lskj.Control
|
||||
/// 左侧表格
|
||||
/// </summary>
|
||||
public GridControlEx LeftGridEx;
|
||||
/// <summary>
|
||||
///特殊左侧表
|
||||
/// </summary>
|
||||
public GridControlEx SpecialLeftTable;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 主表查询时,左侧树表格是否为精确查询(like改成=)
|
||||
/// </summary>
|
||||
@@ -490,6 +499,7 @@ namespace Lskj.Control
|
||||
if (!Model.DataCaches.GetValue(this, "SearchObj", out MyControl searchObj))
|
||||
{
|
||||
searchObj = new MyControl(ReplaceBmpField(this.SysModel.MenuSql), gcMain, LeftTreeViewEx, LeftGridEx, _leftGridSearchObj);//替换sql语句中的bmp字段
|
||||
searchObj.SpecialLeftTable = this.SpecialLeftTable;
|
||||
searchObj.Model = Model;
|
||||
}
|
||||
this.SearchObj = searchObj;
|
||||
@@ -670,14 +680,58 @@ namespace Lskj.Control
|
||||
itemCommon.Location = new Point(x + 6, 6);
|
||||
x += itemCommon.Width + 6;
|
||||
pl_buttom.Controls.Add(itemCommon);
|
||||
itemCommonList.Add(itemCommon);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(tableCommon.Rows.Count>0) this.pl_buttom.Visible = true;
|
||||
this.dpbTools.Visible = tableCommon != null && pm_common.ItemLinks.Count > 0;
|
||||
this.dpbTools.Click += DpbTools_Click;
|
||||
//this.dpbTools.Location = new Point(x + 6, 6);
|
||||
}
|
||||
|
||||
private void DpbTools_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (BarItemLink itemLink in this.pm_common.ItemLinks)
|
||||
{
|
||||
DataRow rowItem = itemLink.Item.Tag as DataRow;
|
||||
if (rowItem != null && rowItem.Table.Columns.Contains("MenuCond"))
|
||||
{
|
||||
string menuCond = rowItem["MenuCond"] + "";
|
||||
string menuCaption = itemLink.Caption;
|
||||
|
||||
if (!string.IsNullOrEmpty(menuCond))
|
||||
{
|
||||
try
|
||||
{
|
||||
bool result = true;
|
||||
DataRow parentitem = this.gcMain.GridView.GetFocusedDataRow();
|
||||
menuCond = ReplaceHelper.ReplaceRowParam(parentitem, menuCond) + "";
|
||||
|
||||
if (menuCond.StartsWith("@") || menuCond.StartsWith("!"))
|
||||
{
|
||||
result = "1".Equals(BaseImpl.GetDefaultValue(menuCond));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ReplaceHelper.EvalCond(menuCond);
|
||||
}
|
||||
itemLink.Item.Enabled = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show("[" + menuCaption + "] " + ResourceKeys.SetRightMenuCondFault);
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
LogUtil.WriteError("验证可操作条件出错!", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:常用工具点击</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -695,7 +749,7 @@ namespace Lskj.Control
|
||||
{
|
||||
DataRow rowItem = e.Item.Tag as DataRow;
|
||||
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj);
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj, this.GridControlObj);
|
||||
menu.Apply(rowItem);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -722,13 +776,41 @@ namespace Lskj.Control
|
||||
{
|
||||
SimpleButton btn = sender as SimpleButton;
|
||||
DataRow rowItem = btn.Tag as DataRow;
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj);
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj,this.GridControlObj);
|
||||
StaticControl.RightMenuGridView = gcMain.GridView;
|
||||
StaticControl.Comprefix = this.SysModel.PrefixKey;
|
||||
menu.Apply(rowItem);
|
||||
|
||||
if (StaticControl.ReturnRowLisy.Count > 0)
|
||||
{
|
||||
DataRow[] dataRows = StaticControl.ReturnRowLisy.ToArray();
|
||||
GridColumnCollection gridColumns = this.gcMain.GridView.Columns;
|
||||
foreach (DataRow item in dataRows)
|
||||
{
|
||||
DataTable table = gcMain.GridControl.DataSourceTable();
|
||||
int rowNumber = table.Rows.Count;
|
||||
//新增一行
|
||||
this.AddGridViewRecord();
|
||||
if (this.gcMain.GridView.FocusedRowHandle == rowNumber)
|
||||
{
|
||||
//成功新增行,把网页返回的行赋值
|
||||
foreach (GridColumn col in gridColumns)
|
||||
{
|
||||
if (item.Table.Columns.Contains(col.FieldName))
|
||||
{
|
||||
// 来源列中是否包含对应字段,包含则使用值
|
||||
gcMain.GridView.SetRowCellValue(this.gcMain.GridView.FocusedRowHandle, col.FieldName, item[col.FieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GridRightMenuModel model = new GridRightMenuModel(rowItem);
|
||||
if (model != null && model.Refresh)
|
||||
{
|
||||
this.ParentGridEx.gridControl.DataSource = SqlHelper.ExecuteDataTable(this.ParentGridEx.LastSearchSql);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1000,21 +1082,21 @@ namespace Lskj.Control
|
||||
dtGridRowColors = BaseModuleImpl.GetBaseGridRowColors(this.Model.ModuleCode);
|
||||
}
|
||||
this.gcMain.SetGridRowColors(dtGridRowColors);
|
||||
|
||||
if (!dataCaches.GetValue(this, "BaseGridRightMenus", out DataTable dt))
|
||||
{
|
||||
dt = BaseModuleImpl.GetBaseGridRightMenus(this.Model.ModuleCode);
|
||||
}
|
||||
if (this.gcMain is TreeGridControlEx)
|
||||
{
|
||||
(this.gcMain as TreeGridControlEx).SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, (this.gcMain as TreeGridControlEx).MenuStrip);
|
||||
}
|
||||
|
||||
//获取要以上方按钮形式加载的按钮
|
||||
if (dt.Columns.Contains("ButtonMode"))
|
||||
{
|
||||
ButtonModeRightMenus = dt.Rows.Cast<DataRow>().Where(x => "1".Equals(x["ButtonMode"] + "")).ToList();
|
||||
}
|
||||
|
||||
if (this.gcMain is TreeGridControlEx)
|
||||
{
|
||||
(this.gcMain as TreeGridControlEx).SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, (this.gcMain as TreeGridControlEx).MenuStrip);
|
||||
}
|
||||
if (this.gcMain is BandedGridControlEx)
|
||||
{
|
||||
BandedGridControlEx banGridControlEx = (this.gcMain as BandedGridControlEx);
|
||||
@@ -1026,6 +1108,22 @@ namespace Lskj.Control
|
||||
{
|
||||
this.gcMain.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, null);
|
||||
}
|
||||
|
||||
|
||||
if (gcMain.CustomGroupBandEx != null)
|
||||
{
|
||||
gcMain.CustomGroupBandEx.SetGridRowColors(dtGridRowColors);
|
||||
gcMain.CustomGroupBandEx.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, null);
|
||||
gcMain.CustomGroupBandEx.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
|
||||
gcMain.CustomGroupBandEx.GridView.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor);
|
||||
}
|
||||
if (gcMain.CustomGroupTreeBandEx != null)
|
||||
{
|
||||
gcMain.CustomGroupTreeBandEx.SetGridRowColors(dtGridRowColors);
|
||||
gcMain.CustomGroupTreeBandEx.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, (this.gcMain as TreeGridControlEx).MenuStrip);
|
||||
}
|
||||
|
||||
|
||||
//如果配置了聚合模式则构建多表头覆盖当前表格
|
||||
//if (SysModel.IsCustomGroup == 1)
|
||||
//{
|
||||
@@ -1451,6 +1549,7 @@ namespace Lskj.Control
|
||||
this.bbi_export.Enabled = this.SysModel.ExportEnable;
|
||||
this.pl_top_fix_search.Enabled = this.pl_top_search.Enabled = this.SysModel.SearchEnable;
|
||||
this.pl_buttom.Visible = this.VisibleOperPanel && (this.SysModel.AddEnable || this.SysModel.DeleteEnable || (this.SysModel.ModifyEnable && this.SysModel.CanEdit));
|
||||
|
||||
this.gcMain.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
|
||||
if (this.LeftGridEx != null) this.LeftGridEx.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
|
||||
this.gcMain.GridView.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor);
|
||||
@@ -1979,10 +2078,11 @@ namespace Lskj.Control
|
||||
private void OnAfterLinkCilkCall(object sender, EventArgs e)
|
||||
{
|
||||
string unioright = sender + "";
|
||||
DataRow rowItem = this.GridControlObj.GetViewFocusedDataRow();
|
||||
|
||||
DataRow rightrowitem = this.GridControlObj.gridViewRightMenu.MenuTable.Rows.Cast<DataRow>().FirstOrDefault(x => (x["orderid"] + "").Equals(unioright));
|
||||
GridRightMenuModel model = new GridRightMenuModel(rightrowitem);
|
||||
if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
||||
DataRow rowItem = this.GridControlObj.GetViewFocusedDataRow();
|
||||
if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
||||
{
|
||||
//判断条件
|
||||
DataRow row = this.gcMain.GridView.GetFocusedDataRow();
|
||||
@@ -3254,11 +3354,6 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
}
|
||||
else if (this.ParentGridEx != null && this.ParentGridEx.DataRowCount() > 0)
|
||||
{
|
||||
leftValue = this.ParentGridEx.GridView.GetDataRow(ParentGridEx.GridView.FocusedRowHandle)[ParentKeyField] + "";
|
||||
leftField = this.DetailKeyField;
|
||||
}
|
||||
else if (this.ParentGridEx != null && this.ParentGridEx is TreeGridControlEx)
|
||||
{
|
||||
TreeGridControlEx treeGridControlEx = this.ParentGridEx as TreeGridControlEx;
|
||||
@@ -3268,6 +3363,11 @@ namespace Lskj.Control
|
||||
leftField = this.DetailKeyField;
|
||||
}
|
||||
}
|
||||
else if (this.ParentGridEx != null && this.ParentGridEx.DataRowCount() > 0)
|
||||
{
|
||||
leftValue = this.ParentGridEx.GridView.GetDataRow(ParentGridEx.GridView.FocusedRowHandle)[ParentKeyField] + "";
|
||||
leftField = this.DetailKeyField;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.ParentKeyValue))
|
||||
{
|
||||
leftField = this.ParentKeyField;
|
||||
@@ -3782,6 +3882,7 @@ namespace Lskj.Control
|
||||
bool fixedQuery = queryTable == null || queryTable.Rows.Count == 0;
|
||||
MyControl myControl = new MyControl(sysModel.MenuSql, gcMain, LeftTreeViewEx, LeftGridEx, _leftGridSearchObj)
|
||||
{
|
||||
SpecialLeftTable = this.SpecialLeftTable,
|
||||
Model = dynamicModel
|
||||
};
|
||||
if (!fixedQuery)
|
||||
@@ -4350,11 +4451,12 @@ namespace Lskj.Control
|
||||
try
|
||||
{
|
||||
GridColumn gridColumn = this.gcMain.GridView.FocusedColumn;
|
||||
if (gridColumn != null)
|
||||
if (gridColumn != null&&!gridColumn.FieldName.Equals("DX$CheckboxSelectorColumn"))
|
||||
{
|
||||
//双击的是url图片框就不打开修改界面(会打开图片框)
|
||||
GridColumnModel columnModel = gridColumn.Tag as GridColumnModel;
|
||||
if (columnModel.FieldType == ControlType.LabPicUrl) return;
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.PreSQL))//如果配置预新增界面则弹出
|
||||
@@ -5057,7 +5159,15 @@ namespace Lskj.Control
|
||||
{
|
||||
WaitForm.ShowForm();
|
||||
//刷新当前表格
|
||||
this.gcMain.RefreshDataSource();
|
||||
if (this.gcMain is TreeGridControlEx)
|
||||
{
|
||||
(this.gcMain as TreeGridControlEx).RefreshDataSource();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gcMain.RefreshDataSource();
|
||||
}
|
||||
|
||||
//刷新子模块表格
|
||||
if (AfterRefreshingCallBack != null) AfterRefreshingCallBack(sender, e);
|
||||
}
|
||||
@@ -5517,6 +5627,18 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
//辅助功能按钮
|
||||
foreach (SimpleButton item in itemCommonList)
|
||||
{
|
||||
if (item.Visible == true && item.Tag is DataRow rightRow)
|
||||
{
|
||||
GridRightMenuModel model = new GridRightMenuModel(rightRow);
|
||||
if (!string.IsNullOrEmpty(model.MenuCond))
|
||||
{
|
||||
item.Enabled = ValidateCond(model.MenuCond, rowItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user