From ed0b4e519536024b762397645a1defeac30ff785 Mon Sep 17 00:00:00 2001 From: cyf Date: Tue, 1 Jul 2025 09:39:16 +0000 Subject: [PATCH] SVN r823 SVN-Revision: r823 --- .../AutoGridLookUp/AutoGridLookUp.cs | 4 +- 插件库/Lskj.Control/GridControlEx.cs | 69 +++++++++++++++++-- 插件库/Lskj.Control/Model/GridColumnModel.cs | 7 +- 插件库/Lskj.Control/ModuleEx.cs | 8 +++ 插件库/Lskj.Control/ModuleGridDetailEx.cs | 20 +++--- 插件库/Lskj.Control/ModuleGridEx.cs | 47 ++++++++++++- 插件库/Lskj.Control/ModulePanelEx.cs | 2 +- 7 files changed, 137 insertions(+), 20 deletions(-) diff --git a/插件库/Lskj.Control/AutoGridLookUp/AutoGridLookUp.cs b/插件库/Lskj.Control/AutoGridLookUp/AutoGridLookUp.cs index 9fc0474..f7b2e24 100644 --- a/插件库/Lskj.Control/AutoGridLookUp/AutoGridLookUp.cs +++ b/插件库/Lskj.Control/AutoGridLookUp/AutoGridLookUp.cs @@ -1422,8 +1422,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 { diff --git a/插件库/Lskj.Control/GridControlEx.cs b/插件库/Lskj.Control/GridControlEx.cs index 152e1ae..4324806 100644 --- a/插件库/Lskj.Control/GridControlEx.cs +++ b/插件库/Lskj.Control/GridControlEx.cs @@ -3565,7 +3565,8 @@ namespace Lskj.Control comboxEdit.DisplayMember = model.TextMember; comboxEdit.ValueMember = ControlType.LabComboxText == model.FieldType || ControlType.LabComboxTextParam == model.FieldType ? model.TextMember : model.ValueMember; //comboxEdit.DataSource = MainImpl.GetDataTableResult(model.SqlSource); - + comboxEdit.Tag = model; + comboxEdit.QueryPopUp += ComboxEdit_QueryPopUp; LookUpColumnInfo valueColumn = new LookUpColumnInfo(); valueColumn.Caption = "编码"; @@ -3593,6 +3594,10 @@ namespace Lskj.Control this.mControlList.Add(model); } + + + + /// /// 说明:创建树节点自动搜索框 /// 创建人:王一帆 @@ -5354,7 +5359,7 @@ namespace Lskj.Control GridColumn col = gridView.VisibleColumns[_colNumber]; GridColumnModel model = col.Tag as GridColumnModel; - if (model != null && (model.CanCopy || ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit)))) + if (model != null && !model.ProhibitPaste && (model.CanCopy || ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit)))) { // 返回ID类型特殊处理 string cellValue = _arrayStr2[j]; @@ -5568,7 +5573,7 @@ namespace Lskj.Control GridColumn col = gridView.VisibleColumns[_colNumber]; GridColumnModel model = col.Tag as GridColumnModel; - if (model != null && (model.CanCopy || ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit)))) //if ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit)) + if (model != null&& !model.ProhibitPaste && (model.CanCopy || ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit)))) //if ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit)) { // 返回ID类型特殊处理 string cellValue = _arrayStr2[j]; @@ -6289,7 +6294,7 @@ namespace Lskj.Control DataRow rowItem = dataRows.Count() > 0 ? dataRows[0] : this.gridView.GetFocusedDataRow(); if (model.FieldType == ControlType.LabAutoGridValueParam || model.FieldType == ControlType.LabAutoGridTextParam || model.FieldType == ControlType.LabAutoCompleteTextParam || model.FieldType == ControlType.LabAutoCompleteValueParam) { - if (model != null && rowItem != null) + if (model != null && (rowItem != null|| this.ParentControl != null)) { string sqlValue = model.SqlSource; @@ -6297,9 +6302,16 @@ namespace Lskj.Control sqlValue = this.ParentControl.ReplaceParentControlValue(sqlValue); sqlValue = sqlValue.Replace("#", ""); - sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue); + if (rowItem != null) + { + sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue); + } + DataTable table = MainImpl.GetDataTableResult(sqlValue); edit.Properties.DataSource = table; + + + string[] columnsWidth = model != null ? model.LookUpFieldsWidth.Trim().TrimEnd(',').Split(',') : null; if (model != null && !string.IsNullOrWhiteSpace(model.LookUpFieldsWidth) && columnsWidth.Length > 0) { @@ -6448,6 +6460,53 @@ namespace Lskj.Control } } } + + + /// + /// 下拉列表框(带参数)。打开时更新下拉框数据 + /// + /// + /// + private void ComboxEdit_QueryPopUp(object sender, CancelEventArgs e) + { + if (sender is LookUpEdit) + { + try + { + int popWidth = 0; + LookUpEdit edit = (sender as LookUpEdit); + GridColumnModel model = edit.Properties.Tag as GridColumnModel; + CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName; + CurrentOperModel = model; + DataRow[] dataRows = this.GetViewFocusedDataRows(); + DataRow rowItem = dataRows.Count() > 0 ? dataRows[0] : this.gridView.GetFocusedDataRow(); + if (model.FieldType == ControlType.LabComboxValueParam || model.FieldType == ControlType.LabComboxTextParam) + { + if (model != null && (rowItem != null || this.ParentControl != null)) + { + string sqlValue = model.SqlSource; + + if (this.ParentControl != null) + sqlValue = this.ParentControl.ReplaceParentControlValue(sqlValue); + sqlValue = sqlValue.Replace("#", ""); + if (rowItem != null) + { + sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue); + } + DataTable table = MainImpl.GetDataTableResult(sqlValue); + edit.Properties.DataSource = table; + } + } + + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode); + MessageUtil.Show(Message, ex.Message); + } + } + } + /// /// 说明:打开多选控件 /// 创建人:龚宇超 diff --git a/插件库/Lskj.Control/Model/GridColumnModel.cs b/插件库/Lskj.Control/Model/GridColumnModel.cs index 04791cc..f72aa2e 100644 --- a/插件库/Lskj.Control/Model/GridColumnModel.cs +++ b/插件库/Lskj.Control/Model/GridColumnModel.cs @@ -363,6 +363,10 @@ namespace Lskj.Control.Model /// 附加关联(附件模块关联主表树型) /// public bool AdditionalAssociations; + /// + /// 禁止粘贴 + /// + public bool ProhibitPaste; #endregion /// @@ -452,4 +456,5 @@ namespace Lskj.Control.Model int.TryParse(item["LabPicUrlHeight"] + "", out LabPicUrlHeight); } this.IsCustomGroupPrimary = item.Table.Columns.Contains("IsCustomGroupPrimary") ? "1".Equals(item["IsCustomGroupPrimary"] + "") : false; - this.IsCustomGroupField = item.Table.Columns.Contains("IsCustomGroupField")&&int.TryParse(item["IsCustomGroupField"] + "",out IsCustomGroupField) ? IsCustomGroupField : 0; \ No newline at end of file + this.IsCustomGroupField = item.Table.Columns.Contains("IsCustomGroupField")&&int.TryParse(item["IsCustomGroupField"] + "",out IsCustomGroupField) ? IsCustomGroupField : 0; + this.ImportConversionFormat = item.Table.Columns.Contains("ImportConversionFormat") ? item["ImportConversionFormat \ No newline at end of file diff --git a/插件库/Lskj.Control/ModuleEx.cs b/插件库/Lskj.Control/ModuleEx.cs index 7ca3dab..93637c6 100644 --- a/插件库/Lskj.Control/ModuleEx.cs +++ b/插件库/Lskj.Control/ModuleEx.cs @@ -1047,6 +1047,14 @@ namespace Lskj.Control try { this._leftGridSearchObj.SearchGrid(); + + if (this.SysModel.DefaultClickLeft) + { + this.OnGridViewRowClick(null, null); + } + + + } catch (Exception ex) { diff --git a/插件库/Lskj.Control/ModuleGridDetailEx.cs b/插件库/Lskj.Control/ModuleGridDetailEx.cs index 8172b85..d34f613 100644 --- a/插件库/Lskj.Control/ModuleGridDetailEx.cs +++ b/插件库/Lskj.Control/ModuleGridDetailEx.cs @@ -357,6 +357,10 @@ namespace Lskj.Control { (this.ModuleGridObj.GridControlObj as TreeGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; } + if (this.ModuleGridObj.GridControlObj is TreeBandedGridControlEx) + { + (this.ModuleGridObj.GridControlObj as TreeBandedGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; + } if (this.SysModel.DoubleClickDetail) { //双击刷新的话,和行改变事件冲突。 @@ -390,6 +394,10 @@ namespace Lskj.Control { (this.ModuleGridObj.GridControlObj as TreeGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; } + if (this.ModuleGridObj.GridControlObj is TreeBandedGridControlEx) + { + (this.ModuleGridObj.GridControlObj as TreeBandedGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; + } if (SystemInfo.Instance.ReportMainTabClickRefresh) { if (this.SysModel.DoubleClickDetail) @@ -614,11 +622,11 @@ namespace Lskj.Control GridDetailModel model = this.tcButtom.GetGridDetailModel(tabPage); if (isNull) { - DataRow leftrow = _leftGridSearchObj!=null?_leftGridSearchObj.MainGridEx.GetViewFocusedDataRow():null; - if (model.IsUnionleft&& leftrow!=null)//为空状态下若明细关联左侧则去替换数据源 + DataRow leftrow = _leftGridSearchObj != null ? _leftGridSearchObj.MainGridEx.GetViewFocusedDataRow() : null; + if (model != null && model.IsUnionleft && leftrow != null)//为空状态下若明细关联左侧则去替换数据源 { string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql; - + if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue)) { string Conditions = string.Empty; @@ -866,7 +874,7 @@ namespace Lskj.Control { string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : ModuleGridObj.ParmaryKey; string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql; - if (model.IsUnionleft&& _leftGridSearchObj!=null) + if (model.IsUnionleft && _leftGridSearchObj != null) { DataRow leftrow = _leftGridSearchObj.MainGridEx.GetViewFocusedDataRow(); sqlValue = ReplaceHelper.ReplaceRowParam(leftrow, sqlValue); @@ -1087,10 +1095,6 @@ namespace Lskj.Control } - - - - } diff --git a/插件库/Lskj.Control/ModuleGridEx.cs b/插件库/Lskj.Control/ModuleGridEx.cs index 81075d1..ba8d14b 100644 --- a/插件库/Lskj.Control/ModuleGridEx.cs +++ b/插件库/Lskj.Control/ModuleGridEx.cs @@ -192,6 +192,10 @@ namespace Lskj.Control /// 拖拽模式 /// public bool isDrag = false; + /// + /// 是否保存成功(Lskj.PubBillSpecial点击保存后,先执行右上方表格保存) + /// + public bool isSuccessfullySaved; #endregion #region public set property @@ -214,6 +218,11 @@ namespace Lskj.Control get { return this.TipsPanel; } } + public SimpleButton BtnSave + { + get { return this.btnSave; } + } + /// /// 搜索界面 /// @@ -519,8 +528,8 @@ 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) + //固定条件不显示,隐藏上方。(只显示表格) + if (SystemInfo.Instance.HideFixedConditions) { this.pl_top.Visible = false; } @@ -2568,6 +2577,7 @@ namespace Lskj.Control public void SaveGridRecord(bool isErrorTips = true) { this.SaveResults = false; + this.isSuccessfullySaved = false; string tableName = this.SysModel.MenuTable; string Autogrowcolumn = BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", tableName)) + ""; DataTable DatabasePropertySheet = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", tableName));//数据库属性表 @@ -2769,6 +2779,7 @@ namespace Lskj.Control else { this.SaveResults = true; + this.isSuccessfullySaved = true; (gcMain.GridControl.DataSource as DataTable).AcceptChanges(); if (this.SearchObj != null) { @@ -4351,6 +4362,7 @@ namespace Lskj.Control /// The instance containing the event data. protected void OnSaveClick(object sender, EventArgs e) { + this.isSuccessfullySaved = false; if (this.GridControlObj.CustomGroupBandEx != null)//保存前若存在虚拟多表头则反写修改 { this.GridControlObj.callbackUpdData(); @@ -4386,6 +4398,7 @@ namespace Lskj.Control int result = this.GridControlObj.AdapterObj.Update(treeList.TreeListObj.DataSource as DataTable); if (result > 0) { + this.isSuccessfullySaved = true; isExec = false; MessageUtil.Show(ResourceKeys.SaveSuccess); if (OnSaveGridCallBack != null) @@ -4443,6 +4456,7 @@ namespace Lskj.Control int result = this.GridControlObj.AdapterObj.Update(this.gcMain.GridControl.DataSource as DataTable); if (result > 0) { + this.isSuccessfullySaved = true; isExec = false; MessageUtil.Show(ResourceKeys.SaveSuccess); if (this.SearchObj != null) @@ -5561,4 +5575,31 @@ namespace Lskj.Control // 获取字体和最大宽度 Document document = richEdit.Document; - \ No newline at end of file + 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); + } + } + + + } +} diff --git a/插件库/Lskj.Control/ModulePanelEx.cs b/插件库/Lskj.Control/ModulePanelEx.cs index c328cf1..0a2d333 100644 --- a/插件库/Lskj.Control/ModulePanelEx.cs +++ b/插件库/Lskj.Control/ModulePanelEx.cs @@ -954,7 +954,7 @@ namespace Lskj.Control gridEx.Tag = detailModel; gridEx.Parent = plMain; gridEx.Model = this.Model; - gcMain.SysModel = this.SysModel; + gridEx.SysModel = this.SysModel; gridEx.SetReadOnlyColumns(detailModel.GridColumns, detailModel.GridCustomColumnKey); gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(detailModel.FormKey), this.Model);