From 458cded6d5de23cf672e5c788d12f766a42a6455 Mon Sep 17 00:00:00 2001 From: wyf Date: Wed, 9 Jul 2025 01:34:25 +0000 Subject: [PATCH] SVN r846 SVN-Revision: r846 --- 插件库/Lskj.Control/GridControlEx.cs | 46 ++++++---------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/插件库/Lskj.Control/GridControlEx.cs b/插件库/Lskj.Control/GridControlEx.cs index 5f6d718..ba5b5bc 100644 --- a/插件库/Lskj.Control/GridControlEx.cs +++ b/插件库/Lskj.Control/GridControlEx.cs @@ -226,7 +226,7 @@ namespace Lskj.Control /// 系统模块实体对象 /// /// The system model. - public ModuleModel SysModel { get; set; } + public ModuleModel SysModel { get; set; } /// /// 合计弹出浮窗 /// @@ -5572,7 +5572,7 @@ namespace Lskj.Control GridColumn col = gridView.VisibleColumns[_colNumber]; GridColumnModel model = col.Tag as GridColumnModel; - if (model != null&& !model.ProhibitPaste && (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]; @@ -6293,7 +6293,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|| this.ParentControl != null)) + if (model != null && (rowItem != null || this.ParentControl != null)) { string sqlValue = model.SqlSource; @@ -6301,15 +6301,15 @@ namespace Lskj.Control sqlValue = this.ParentControl.ReplaceParentControlValue(sqlValue); sqlValue = sqlValue.Replace("#", ""); - if (rowItem != null) + 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) @@ -7127,7 +7127,7 @@ namespace Lskj.Control bandedGridControlEx.BandedView.Columns.Clear(); // 保留其他非聚合列 - List normalColumns = ColumnList.Where(o => o.IsCustomGroupField == 0|| o.IsCustomGroupField == 3).ToList(); + List normalColumns = ColumnList.Where(o => o.IsCustomGroupField == 0 || o.IsCustomGroupField == 3).ToList(); // 创建正常列的Band GridBand normalBand = new GridBand() { Caption = "基本信息" }; @@ -7169,7 +7169,7 @@ namespace Lskj.Control var dynamicHeaders = originalDataSource.AsEnumerable() .Select(r => r.Field(GroupFieldprimary.FieldName)) .Distinct().Where(x => !string.IsNullOrEmpty(x)).ToList(); - + // 为每个动态表头生成GridBand,并添加子列 foreach (string headerName in dynamicHeaders) { @@ -7254,7 +7254,7 @@ namespace Lskj.Control // 动态列:统一 string foreach (string h in headers) foreach (var s in subCols) - dt.Columns.Add($"{h}_{s.FieldName}", typeof(string)); + dt.Columns.Add($"{h}_{s.FieldName}", original.Columns[s.FieldName].DataType); /* ============ 2. 分组聚合 ============ */ foreach (var grp in original.AsEnumerable().GroupBy(r => r[keyCol.FieldName])) @@ -8823,30 +8823,4 @@ namespace Lskj.Control { // 只处理列名可解析成日期的列 if (!DateTime.TryParse(col.FieldName, out _)) - continue; - - // 取 “Sum” 合计 - var sumItem = col.Summary - .OfType() - .FirstOrDefault(s => s.SummaryType == SummaryItemType.Sum); - - bool needRed = false; - - if (sumItem?.SummaryValue != null && - decimal.TryParse(sumItem.SummaryValue.ToString(), out var colSum) && - jhrowitem.Table.Columns.Contains(col.FieldName) && - decimal.TryParse(jhrowitem[col.FieldName].ToString(), out var planVal)) - { - needRed = (colSum != planVal); - } - - // 只改表头文字颜色 - col.AppearanceHeader.ForeColor = needRed ? Color.Red : Color.Black; - col.AppearanceHeader.Options.UseForeColor = true; - } - // 立刻刷新表头 - gridView.Invalidate(); - } - - } -} \ No newline at end of file + \ No newline at end of file