SVN-Revision: r801
This commit is contained in:
cyf
2025-06-27 07:49:43 +00:00
parent 39a388b0f4
commit 13f2022d1a
9 changed files with 466 additions and 47 deletions
+53 -1
View File
@@ -1252,11 +1252,22 @@ namespace Lskj.Control
string nextSelectStepOper = string.Empty;
try
{
List<string> Documents = new List<string>();
foreach (DataRow item in rowItems)
{
string stepCode = item[this.BaseAccraditModelObj.TmpStepField] + "";
string tmpParmaryField = this.isBill ? this.BaseAccraditModelObj.TmpParmaryField : this.BaseAccraditModelObj.KeyField;
string BillDocumentId = item[tmpParmaryField] + "";
if (Documents.Contains(BillDocumentId))
{
continue;
}
else
{
Documents.Add(BillDocumentId);
}
//DataRow _baseRowData = BaseAuditImpl.GetCurrentControlData(ReplaceHelper.ReplaceWhereCond(ReplaceHelper.ReplaceUserInfo(this.AuditComModelObj.MenuSql)), this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue);
// 判断主表数据是否有未保存列
DataRow _baseRowData = BaseAuditImpl.GetCurrentFlowRowData(this.BaseAccraditModelObj.BillTable, tmpParmaryField, item[tmpParmaryField] + "");
@@ -1409,6 +1420,7 @@ namespace Lskj.Control
try
{
int ret = 0;
List<string> Documents = new List<string>();
foreach (DataRow item in rowItems)
{
//AccraditationModel AccditModelObj = AuditComModelObj.Moduletype == "bill" ? new AccraditationModel(BillAuditImpl.GetBillFlowData(this.SysModel.ModuleCode, item[this.BaseAccraditModelObj.TmpStepField] + "")) : new AccraditationModel(BaseAuditImpl.GetCurrentStepFlow(this.SysModel.ModuleCode, item[this.BaseAccraditModelObj.TmpStepField] + ""));
@@ -1419,6 +1431,16 @@ namespace Lskj.Control
int beforeId = 0;
string stepCode = item[this.BaseAccraditModelObj.TmpStepField] + "";
string billDocumentId = item[tmpParmaryField] + "";
if (Documents.Contains(billDocumentId))
{
continue;
}
else
{
Documents.Add(billDocumentId);
}
//string billDocumentId = item[this.BaseAccraditModelObj.TmpParmaryField] + "";
bool isBack = string.IsNullOrEmpty(this.BaseAccraditModelObj.MenuCond) ||
this.SectionAccradit == null ||
@@ -1758,4 +1780,34 @@ namespace Lskj.Control
/// <summary>
/// <para>说明:设置分割条位置</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期
/// <para>创建日期2018-02-01 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
protected void InitlizeSpiltLocation()
{
try
{
if (splitBelow.PanelVisibility == SplitPanelVisibility.Both)
{
string width = IniHelper.Read(string.Format("BelowDetai_width_{0}", this.SysModel.ModuleCode));//通过Key获取Value值
if (!string.IsNullOrEmpty(width))
{
this.splitBelow.SplitterPosition = Convert.ToInt32(width);
}
}
}
catch (Exception ex)
{
LogHelper.Instance.WriteError(ex);
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
}
}
@@ -311,7 +311,7 @@ namespace Lskj.Control
public void ShowPopup()
{
if (!this.Properties.ReadOnly && this.Enabled && !this.IsShowPopup && this.ContainsFocus)
{
{
if (AutoShowPopup && this._popup != null)
{
this.IsShowPopup = true;
@@ -493,8 +493,8 @@ namespace Lskj.Control
if (this.ControlObj != null)
sqlValue = this.ControlObj.ReplaceControlValue(sqlValue);
sqlValue = ProcessingSql(sqlValue);
sqlValue = MainImpl.GetDefaultValue(SourceSQL);
sqlValue = ReplaceHelper.ReplaceParam(SourceSQL);
sqlValue = MainImpl.GetDefaultValue(sqlValue);
sqlValue = ReplaceHelper.ReplaceParam(sqlValue);
}
else
{
+50
View File
@@ -65,6 +65,56 @@ namespace Lskj.Control
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
}
public FrmComboxPopup(GridColumnModel model)
{
try
{
InitializeComponent();
this.mControlModel = new ControlModel();
this.mControlModel.SourceSql = model.SqlSource;
this.mControlModel.ValueMember = model.ValueMember;
this.mControlModel.TextMember = model.TextMember;
this.Text = model.FieldText + "选择";
if (this.ListBoxFontSize > 0)
{
foreach (System.Windows.Forms.Control ctrol in this.panel3.Controls)
{
if (ctrol is SimpleButton)
{
SimpleButton simpleButton = ctrol as SimpleButton;
Font oldFont = simpleButton.Font;
simpleButton.Font = new Font(oldFont.Name, ListBoxFontSize);
}
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
public void OnLoadnew(string sql)
{
this.mSourceTable = BaseImpl.GetDataTableResult(sql);
this.InitControl();
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
}
public void VisableControl()
{
for (int i = 0; i < this.plContainer.Controls.Count; i++)
+55 -35
View File
@@ -82,6 +82,60 @@ namespace Lskj.Control
}
}
public FrmGridSelectPopup(GridColumnModel model)
{
try
{
InitializeComponent();
this.Model = new ControlModel();
this.Model.SourceSql = model.SqlSource;
this.Model.ValueMember = model.ValueMember;
this.Model.TextMember = model.TextMember;
this.Model.FieldType = model.FieldType;
this.gridView.BestFitColumns();//设置根据内容填充列宽
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
public void InitNew(string sql, string ShowText, string ShowValue)
{
this.ShowText = ShowText;
this.ShowValue = ShowValue;
if (string.IsNullOrEmpty(sql))
{
MessageUtil.Show("请先配置数据源");
}
else
{
this.mSourceTable = BaseImpl.GetDataTableResult(sql);
if (this.Model.FieldType == ControlType.LabGridPopupMutilText || this.Model.FieldType == ControlType.LabGridPopupMutilValue)
{
this.simpleButton5.Visible = true;
this.mSourceTable.Columns.Add(_checkFieldName, typeof(bool));
this.mSourceTable.Columns[_checkFieldName].SetOrdinal(0);
for (int i = 0; i < mSourceTable.Rows.Count; i++)
{
mSourceTable.Rows[i][_checkFieldName] = 0;
}
}
this.InitColumn();
this.InitControl();
this.gridView.RowClick += new DevExpress.XtraGrid.Views.Grid.RowClickEventHandler(gridView_RowClick);
}
}
void gridView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
try
@@ -226,38 +280,4 @@ namespace Lskj.Control
{
try
{
if (this.mPage == this.mMaxPage) return;
this.mPage = this.mMaxPage;
this.InitControl();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
private void simpleButton5_Click(object sender, EventArgs e)
{
try
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.ShowText = this.ShowText.TrimStart(',');
this.ShowValue = this.ShowValue.TrimStart(',');
this.Close();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
private void simpleButton6_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
if (this.mPage == this.mMaxPage) return;
+144
View File
@@ -381,6 +381,10 @@ namespace Lskj.Control
/// 导出名不包含日期
/// </summary>
public bool ExportNameWithoutDate = false;
/// <summary>
/// 导出名不包含日期
/// </summary>
public bool IgnoreTab = false;
public GridControlEx()
{
@@ -956,6 +960,16 @@ namespace Lskj.Control
case ControlType.LabRightlink:
InitRightlink(column, model);
break;
case ControlType.LabComboxPopupValue:
case ControlType.LabComboxPopupText:
InitComboxPopup(column, model);
break;
case ControlType.LabGridPopupValue:
case ControlType.LabGridPopupText:
//case ControlType.LabGridPopupMutilValue:
//case ControlType.LabGridPopupMutilText:
InitGridPopup(column, model);
break;
default:
break;
}
@@ -4111,6 +4125,119 @@ namespace Lskj.Control
}
/// <summary>
/// 创建下拉列表框弹出框
/// </summary>
/// <param name="gridColumn"></param>
/// <param name="model"></param>
public void InitComboxPopup(GridColumn gridColumn, GridColumnModel model)
{
FrmComboxPopup mutilLookUp = new FrmComboxPopup(model);
mutilLookUp.Tag = model;
RepositoryItemCheckedComboBoxEdit btnEdit = new RepositoryItemCheckedComboBoxEdit();
btnEdit.NullText = "";
btnEdit.PopupBorderStyle = PopupBorderStyles.Flat;
btnEdit.AllowNullInput = DefaultBoolean.False;
btnEdit.DisplayMember = model.TextMember;
btnEdit.SeparatorChar = ',';
btnEdit.ValueMember = model.FieldType == ControlType.LabComboxPopupValue ? model.ValueMember : model.TextMember;
if (model.FieldType == ControlType.LabComboxPopupValue)
{
btnEdit.DataSource = MainImpl.GetDataTableResult(model.SqlSource);
}
btnEdit.Buttons[0].Visible = false; // 不能移除,移除后事件不起作用.
btnEdit.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis) });
btnEdit.Tag = model;
btnEdit.Buttons[1].Tag = mutilLookUp;
btnEdit.ButtonClick += new ButtonPressedEventHandler(OnComboxPopupClick);
gridControl.RepositoryItems.Add(btnEdit);
gridColumn.OptionsColumn.ReadOnly = true;
gridColumn.ColumnEdit = btnEdit;
this.mControlList.Add(model);
}
/// <summary>
/// 下拉列表框弹出框点击
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnComboxPopupClick(object sender, ButtonPressedEventArgs e)
{
CheckedComboBoxEdit btnEdit = (CheckedComboBoxEdit)sender;
FrmComboxPopup comboxPopup = e.Button.Tag as FrmComboxPopup;
GridColumnModel model = comboxPopup.Tag as GridColumnModel;
string sql = ReplaceHelper.ReplaceRowParam(this.GridView.GetFocusedDataRow(), model.SqlSource);
comboxPopup.OnLoadnew(sql);
DialogResult result = comboxPopup.ShowDialog();
if (result == DialogResult.OK)
{
btnEdit.EditValue = comboxPopup.ShowValue;
}
}
/// <summary>
/// 创建下拉表格框弹出框
/// </summary>
/// <param name="gridColumn"></param>
/// <param name="model"></param>
public void InitGridPopup(GridColumn gridColumn, GridColumnModel model)
{
FrmGridSelectPopup mutilLookUp = new FrmGridSelectPopup(model);
mutilLookUp.Tag = model;
RepositoryItemCheckedComboBoxEdit btnEdit = new RepositoryItemCheckedComboBoxEdit();
btnEdit.NullText = "";
btnEdit.PopupBorderStyle = PopupBorderStyles.Flat;
btnEdit.AllowNullInput = DefaultBoolean.False;
btnEdit.DisplayMember = model.TextMember;
btnEdit.SeparatorChar = ',';
btnEdit.ValueMember = model.FieldType == ControlType.LabGridPopupValue || model.FieldType == ControlType.LabGridPopupMutilValue ? model.ValueMember : model.TextMember;
if (model.FieldType == ControlType.LabGridPopupValue || model.FieldType == ControlType.LabGridPopupMutilValue)
{
btnEdit.DataSource = MainImpl.GetDataTableResult(model.SqlSource);
}
btnEdit.Buttons[0].Visible = false; // 不能移除,移除后事件不起作用.
btnEdit.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis) });
btnEdit.Tag = model;
btnEdit.Buttons[1].Tag = mutilLookUp;
btnEdit.ButtonClick += new ButtonPressedEventHandler(OnGridPopupClick);
gridControl.RepositoryItems.Add(btnEdit);
gridColumn.OptionsColumn.ReadOnly = true;
gridColumn.ColumnEdit = btnEdit;
this.mControlList.Add(model);
}
/// <summary>
/// 下拉列表表格点击
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnGridPopupClick(object sender, ButtonPressedEventArgs e)
{
CheckedComboBoxEdit btnEdit = (CheckedComboBoxEdit)sender;
FrmGridSelectPopup frmGridSelectPopup = e.Button.Tag as FrmGridSelectPopup;
GridColumnModel model = frmGridSelectPopup.Tag as GridColumnModel;
string sql = ReplaceHelper.ReplaceRowParam(this.GridView.GetFocusedDataRow(), model.SqlSource);
frmGridSelectPopup.InitNew(sql, btnEdit.Text, btnEdit.EditValue+"");
DialogResult result = frmGridSelectPopup.ShowDialog();
if (result == DialogResult.OK)
{
btnEdit.EditValue = frmGridSelectPopup.ShowValue;
}
}
/// <summary>
/// <para>说明:超链接</para>
/// <para>创建人:曹屹峰</para>
@@ -4204,6 +4331,12 @@ namespace Lskj.Control
}
}
}
/// <summary>
/// 点击超链接
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void HyperLinkEdit_Click(object sender, EventArgs e)
{
string urlName = string.Empty;
@@ -5171,6 +5304,11 @@ namespace Lskj.Control
for (int i = 0; i < _pasteRowCount; i++)
{
string[] _arrayStr2 = _arrayRowStr[i].Split('\t');
if (IgnoreTab)
{
_arrayStr2 = new string[] { _arrayRowStr[i] };
}
if ((i == _pasteRowCount - 1 && _arrayRowStr[_pasteRowCount - 1].Replace("\r\n", "").Trim() == ""))
continue;
DataRow newRow = null;
@@ -5367,6 +5505,12 @@ namespace Lskj.Control
for (int i = 0; i < _pasteRowCount; i++)
{
string[] _arrayStr2 = _arrayRowStr[i].Split('\t');
if (IgnoreTab)
{
_arrayStr2 = new string[] { _arrayRowStr[i] };
}
if ((i == _pasteRowCount - 1 && _arrayRowStr[_pasteRowCount - 1].Replace("\r\n", "").Trim() == ""))
continue;
+31
View File
@@ -951,8 +951,11 @@ namespace Lskj.Control
this.treeGridLeft.SetReadOnlyColumns(dtTable, GridCustomColumnStruct.BaseLeftGridView + this.Model.ModuleCode);
//主键字段名称
this.treeGridLeft.TreeListObj.KeyFieldName = this.LeftRowObj["fieldsqlid"] + "";
if (!string.IsNullOrWhiteSpace(this.SysModel.LeftTreeKeyFieldName)) this.treeGridLeft.TreeListObj.KeyFieldName = this.SysModel.LeftTreeKeyFieldName;
//父级字段名称
this.treeGridLeft.TreeListObj.ParentFieldName = "Pid";
}
@@ -1814,6 +1817,8 @@ namespace Lskj.Control
foreach (DataRow item in table.Rows)
{
DataRow modelRow = MainImpl.GetSystemdllTab(item["unionModule"] + "");
//DataRow LeftRow = BaseModuleImpl.GetBaseLeftTreeField(item["unionModule"] + "");//获取表格左侧树字段
//modelRow = MainImpl.GetSystemdllTab ("mps001");
if (modelRow == null) continue;
ModuleModel addModel = new ModuleModel(modelRow);
@@ -1834,6 +1839,32 @@ namespace Lskj.Control
{
GridDragGrid.GridAddCheckBox(modegridEx.ModuleGridObj.GridControlObj.GridView);
}
string association = item["unionvalue"]+"";
if (!string.IsNullOrWhiteSpace(association))
{
//配置了树节点关联的页签,就绑定主表的左侧控件
switch (this.SysModel.MenuType)
{
case 1:
case 4: // 左侧为树节点
modegridEx.ModuleGridObj.LeftTreeViewEx = this.treeLeft;
modegridEx.ModuleGridObj.ParentKeyField = association;
modegridEx.ModuleGridObj.AdditionalAssociatedMain = true;
//modegridEx.ModuleGridObj.ParentKeyField = LeftRow["fieldsqlid"] + "";
//modegridEx.ModuleGridObj.ParentUnionField LeftRow["fieldname"] + "";
break;
case 2:
case 5: // 左侧为表格
modegridEx.ModuleGridObj.LeftGridEx = this.SysModel.IsTreeTable ? this.treeGridLeft : this.gridLeft;
modegridEx.ModuleGridObj.ParentKeyField = association;
modegridEx.ModuleGridObj.AdditionalAssociatedMain = true;
//modegridEx.ModuleGridObj.ParentKeyField = LeftRow["fieldsqlid"] + "";
//modegridEx.ModuleGridObj.ParentUnionField = LeftRow["fieldname"] + "";
break;
}
}
page.Controls.Add(modegridEx);
modegridEx.Tag = item;
page.Tag = modegridEx;
+32 -6
View File
@@ -443,6 +443,11 @@ namespace Lskj.Control
/// 上方高度
/// </summary>
public int TopHeight = 0;
/// <summary>
/// 附加模块关联主表的树型模式
/// </summary>
public bool AdditionalAssociatedMain=false;
/// <summary>
/// 点击搜索时,判断当前表的明细是否有修改或新增状态的行
@@ -514,6 +519,11 @@ namespace Lskj.Control
this.SearchObj.InitDefaultSearchControl(table, this.pl_top_fix_search, false);
else
this.SearchObj.InitDefaultSearchControl(table, this.pl_top_fix_search);
//固定条件不显示的话,隐藏上方。(只显示表格)
if (!this.pl_top_fix_search.Visible)
{
this.pl_top.Visible = false;
}
}
else
{
@@ -862,7 +872,7 @@ namespace Lskj.Control
this.gcMain = new TreeBandedGridControlEx() { Expansion = SysModel.TreeTableExpand };
this.gcMain.Model = this.Model;
this.gcMain.Dock = DockStyle.Fill;
if (this._gridColumns.Rows.Count == 0&&!string.IsNullOrWhiteSpace(SysModel.TreeKeyFieldName) && !string.IsNullOrWhiteSpace(SysModel.TreeParentFieldName))
if (this._gridColumns.Rows.Count == 0 && !string.IsNullOrWhiteSpace(SysModel.TreeKeyFieldName) && !string.IsNullOrWhiteSpace(SysModel.TreeParentFieldName))
{
//节点编号
(this.gcMain as TreeBandedGridControlEx).TreeListObj.KeyFieldName = SysModel.TreeKeyFieldName;
@@ -1546,6 +1556,7 @@ namespace Lskj.Control
validateExport = ValidateCond(this.SysModel.ExportCond, rowItem, "P_SystemDllTab", "exportCond");
}
this.btnAdd.Enabled = this.SysModel.AddEnable && validateAdd; // 判断添加权限
//this.btnAdd.Enabled = true;
this.btnDel.Enabled = this.SysModel.DeleteEnable && validateDel; // 判断删除权限
this.btnSave.Enabled = this.SysModel.ModifyEnable && validateSave; // 判断修改权限
this.btnImport.Enabled = this.SysModel.ImportEnable && validateImport; // 判断导入权限
@@ -1718,6 +1729,11 @@ namespace Lskj.Control
// 设置树节点关联值
view.SetRowCellValue(view.FocusedRowHandle, column, parentValue);
}
else if (model.AdditionalAssociations && model.ValueMember.Equals(parentKey, StringComparison.OrdinalIgnoreCase) && AdditionalAssociatedMain)
{
// 设置树节点关联值
view.SetRowCellValue(view.FocusedRowHandle, column, parentValue);
}
else if (model.FieldName.Equals(UnionKey, StringComparison.OrdinalIgnoreCase))
{
// 设置关联模块关联值
@@ -1877,11 +1893,11 @@ namespace Lskj.Control
{
string unioright = sender + "";
DataRow rowItem = this.GridControlObj.GetViewFocusedDataRow();
DataRow rightrowitem = this.GridControlObj.gridViewRightMenu.MenuTable.Rows.Cast<DataRow>().FirstOrDefault(x=>(x["orderid"]+"").Equals(unioright));
DataRow rightrowitem = this.GridControlObj.gridViewRightMenu.MenuTable.Rows.Cast<DataRow>().FirstOrDefault(x => (x["orderid"] + "").Equals(unioright));
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj, this.gcMain);
menu.Apply(rightrowitem);
}
/// <summary>
/// <para>说明:</para>
@@ -2097,11 +2113,17 @@ namespace Lskj.Control
{
DataRow row = LeftGridEx.GridView.GetFocusedDataRow();
if (LeftGridEx is TreeGridControlEx) row = LeftGridEx.GetViewFocusedDataRow();
if (row != null)
if (row != null && _leftGridField != null)
{
mLeftFieldId = row[_leftGridField["fieldsqlid"] + ""] + "";
mLeftFieldName = row[_leftGridField["fieldsqlname"] + ""] + "";
mLeftGridData = row.ToJsonObject();
}
else if (row != null && AdditionalAssociatedMain)
{
mLeftFieldId = row[ParentKeyField] + "";
mLeftFieldName = row[ParentKeyField] + "";
mLeftGridData = row.ToJsonObject();
}
}
@@ -3519,6 +3541,10 @@ namespace Lskj.Control
//this.gcMain.GridView.CustomColumnDisplayText += GridView_CustomColumnDisplayText;
this.gcMain.GridView.CustomDrawCell += OnGridViewCustomDrawCell;
}
if (this.SysModel.IgnoreTab)
{
this.gcMain.IgnoreTab = this.SysModel.IgnoreTab;
}
//判断是否隐藏数据导入按钮
string[] authorizedPersonnel = SysModel.ImportPermissions.Split(',');//有导入权限的人员
@@ -4346,7 +4372,7 @@ namespace Lskj.Control
{
goto IsApi;
}
else
else
{
int result = this.GridControlObj.AdapterObj.Update(treeList.TreeListObj.DataSource as DataTable);
if (result > 0)
@@ -4359,7 +4385,7 @@ namespace Lskj.Control
}
}
}
}
}
catch (Exception)
@@ -74,6 +74,10 @@ namespace Lskj.Control
/// 按初始顺序保存全部gridBand对应的二级列名
/// </summary>
public Dictionary<TreeListBand, string> saveGridBandColumn = new Dictionary<TreeListBand, string>();
/// <summary>
/// 日期类型控件名称
/// </summary>
private List<string> DateColumnNames = new List<string>();
public TreeBandedGridControlEx()
@@ -84,6 +88,7 @@ namespace Lskj.Control
this.gcMain.CustomDrawNodeIndicator += TreeListObj_CustomDrawNodeIndicator;//显示行号
this.gcMain.SelectionChanged += new EventHandler(gcMain_SelectionChanged);
this.gcMain.CustomDrawNodeCell += new CustomDrawNodeCellEventHandler(OnCustomDrawNodeCell);
this.gcMain.ColumnFilterChanged += TreeList1_ColumnFilterChanged;
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{
this.SetGridRowHeightAndFont();
@@ -93,6 +98,44 @@ namespace Lskj.Control
//this.gcMain.OptionsFind.AlwaysVisible = true;
}
/// <summary>
/// 修改筛选框筛选日期类型列的条件(日期=xxx 替换wei 日期>=xxx && 日期<xxx+1
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TreeList1_ColumnFilterChanged(object sender, EventArgs e)
{
TreeList treeList = sender as TreeList;
string filter = treeList.ActiveFilterString;
if (string.IsNullOrEmpty(filter))
return;
// 配置需要处理的日期列列表(不含方括号)
//string[] dateColumns = new[] { "mrp_hb_operatedate", "wms_lout_tagiddate", "wms_lout_takedate" };
string[] dateColumns = DateColumnNames.ToArray();
string newFilter = filter;
// 遍历所有日期列,替换精确匹配为范围匹配
foreach (string column in dateColumns)
{
string columnPattern = $@"\[{column}\] = #(\d{{4}}-\d{{2}}-\d{{2}})#";
newFilter = Regex.Replace(newFilter, columnPattern, match =>
{
if (DateTime.TryParse(match.Groups[1].Value, out DateTime date))
{
return $"([{column}] >= #{date:yyyy-MM-dd}# And [{column}] < #{date.AddDays(1):yyyy-MM-dd}#)";
}
return match.Value; // 解析失败则保持原样
});
}
// 应用修改后的筛选表达式
if (newFilter != filter)
{
treeList.ActiveFilterString = newFilter;
}
}
private void TreeListObj_CustomDrawNodeIndicator(object sender, CustomDrawNodeIndicatorEventArgs e)
{
@@ -533,6 +576,7 @@ namespace Lskj.Control
case ControlType.LabDateTime:
case ControlType.LabDateTimeShort:
case ControlType.LabShortDate:
DateColumnNames.Add(model.FieldName);
InitDateTimeEdit(column, model.FieldType);
break;
case ControlType.LabTime:
+54 -2
View File
@@ -73,6 +73,11 @@ namespace Lskj.Control
/// </summary>
private int lastNodeIndex;
/// <summary>
/// 日期类型控件名称
/// </summary>
private List<string> DateColumnNames=new List<string>();
/// <summary>
/// 下拉框数据源绑定完成后执行
@@ -88,6 +93,10 @@ namespace Lskj.Control
this.TreeListObj.CustomDrawNodeIndicator += TreeListObj_CustomDrawNodeIndicator;//显示行号
this.gcMain.CellValueChanged += GcMain_CellValueChanged;
this.gcMain.NodesReloaded += OnNodesReloaded;
this.gcMain.ColumnFilterChanged += TreeList1_ColumnFilterChanged;
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{
this.SetGridRowHeightAndFont();
@@ -101,6 +110,47 @@ namespace Lskj.Control
//this.gcMain.OptionsFind.AlwaysVisible = true;
}
/// <summary>
/// 修改筛选框筛选日期类型列的条件(日期=xxx 替换wei 日期>=xxx && 日期<xxx+1
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TreeList1_ColumnFilterChanged(object sender, EventArgs e)
{
TreeList treeList = sender as TreeList;
string filter = treeList.ActiveFilterString;
if (string.IsNullOrEmpty(filter))
return;
// 配置需要处理的日期列列表(不含方括号)
//string[] dateColumns = new[] { "mrp_hb_operatedate", "wms_lout_tagiddate", "wms_lout_takedate" };
string[] dateColumns = DateColumnNames.ToArray();
string newFilter = filter;
// 遍历所有日期列,替换精确匹配为范围匹配
foreach (string column in dateColumns)
{
string columnPattern = $@"\[{column}\] = #(\d{{4}}-\d{{2}}-\d{{2}})#";
newFilter = Regex.Replace(newFilter, columnPattern, match =>
{
if (DateTime.TryParse(match.Groups[1].Value, out DateTime date))
{
return $"([{column}] >= #{date:yyyy-MM-dd}# And [{column}] < #{date.AddDays(1):yyyy-MM-dd}#)";
}
return match.Value; // 解析失败则保持原样
});
}
// 应用修改后的筛选表达式
if (newFilter != filter)
{
treeList.ActiveFilterString = newFilter;
}
}
void gcMain_SelectionChanged(object sender, EventArgs e)
{
//try
@@ -443,6 +493,7 @@ namespace Lskj.Control
case ControlType.LabDateTime:
case ControlType.LabDateTimeShort:
case ControlType.LabShortDate:
DateColumnNames.Add(model.FieldName);
InitDateTimeEdit(column, model.FieldType);
break;
case ControlType.LabTime:
@@ -769,7 +820,6 @@ namespace Lskj.Control
dateEdit.Properties.VistaCalendarViewStyle = DevExpress.XtraEditors.VistaCalendarViewStyle.YearView;
}
//dateEdit.Closed += new ClosedEventHandler(dateEdit_Closed);
gridControl.RepositoryItems.Add(dateEdit);
gridColumn.ColumnEdit = dateEdit;
}
@@ -3182,11 +3232,13 @@ namespace Lskj.Control
}
else
{
DataRow[] AlreadyExistsRow = table.Rows.Cast<DataRow>().Where(x => !string.IsNullOrWhiteSpace(x[TreeListObj.KeyFieldName] + "")).ToArray();
int maxid = int.Parse(AlreadyExistsRow.Cast<DataRow>().Max(n => n[TreeListObj.KeyFieldName]) + "") + 1;
//没有节点id的行赋值当前最大id
foreach (DataRow item in dataRows)
{
int maxid = int.Parse(table.Rows.Cast<DataRow>().Max(n => n[TreeListObj.KeyFieldName]) + "") + 1;
item[TreeListObj.KeyFieldName] = maxid + "";
maxid++;
}
this.SetGridViewDataSource(table);
}