From 7a79a925742bac1c873f76c0a86443859771bee5 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 21 三月 2025 22:53:56 +0800 Subject: [PATCH] 过滤 --- DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 39 insertions(+), 10 deletions(-) diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs index 2ccb088..c610dde 100644 --- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs +++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs @@ -10,7 +10,6 @@ using System.Net.Http; using System.Reflection; using System.Resources; -using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -410,7 +409,14 @@ if (colType is CheckEdit) { var txt = colType as CheckEdit; + if (_isRead(txt.Tag)) + { + txt.ReadOnly = true; + } + else + txt.ReadOnly = isEdt; if (txt != null) + { switch (strVal) { case "True": @@ -426,8 +432,8 @@ txt.Checked = false; break; } + } - txt.ReadOnly = isEdt; continue; } //鍗曢�� @@ -453,6 +459,7 @@ txt.Enabled = !isEdt; continue; } + //鏃堕棿 if (colType is DateTimePicker) { @@ -791,13 +798,12 @@ if (ctrl is CheckEdit) { var txt = ctrl as CheckEdit; - txt.ReadOnly = isEdt; - if (txt.Tag != null && txt.Tag.ToString().Length > 0 && txt.Tag.ToString().StartsWith("moren")) + if (_isRead(txt.Tag)) { - txt.Checked = bool.Parse(txt.Tag.ToString().Replace("moren.", "")); + txt.ReadOnly = true; } else - txt.Checked = false; + txt.ReadOnly = isEdt; continue; } //鑷畾涔変粨搴� @@ -1375,6 +1381,11 @@ return 0; } } + public static decimal? GetDecimal(string s) + { + if (string.IsNullOrEmpty(s)) return null; + return decimal.Parse(s); + } public static int ToInt(string str) { try @@ -1596,7 +1607,7 @@ GridView dgv = s as GridView; if (dgv != null) { - if (dgv.GetSelectedRows() != null) + if (dgv.GetSelectedRows() != null && dgv.GetSelectedRows().Count() > 0) { var selectedRow = dgv.GetSelectedRows()[0]; // 鑾峰彇绗竴涓�変腑琛岀殑绱㈠紩 if (selectedRow >= 0) @@ -1720,7 +1731,7 @@ public delegate void DelegateGetModel(string guid); public delegate void DelegateGetList(int currentPage); /// <summary> - /// + /// 璁剧疆涓昏〃鐨勬牱寮� /// </summary> /// <param name="gridView1">gridview</param> /// <param name="picCheckBox">鍥炬爣鎸夐挳</param> @@ -1758,7 +1769,7 @@ { column.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; column.OptionsColumn.AllowEdit = true; - column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains; + // column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains; column.OptionsFilter.AutoFilterCondition = DevExpress.XtraGrid.Columns.AutoFilterCondition.Contains; column.OptionsFilter.ImmediateUpdateAutoFilter = false; if (column.Tag == null || column.Tag.ToString().EndsWith("edit")) @@ -1767,6 +1778,7 @@ column.OptionsColumn.ReadOnly = true; if (column.Tag == null || column.Tag.ToString().Length <= 0) column.OptionsFilter.AllowAutoFilter = false; + } gridView1.OptionsFilter.AllowAutoFilterConditionChange = DevExpress.Utils.DefaultBoolean.False; gridView1.OptionsView.ShowAutoFilterRow = true; @@ -1864,6 +1876,23 @@ edit.SelectAll(); } + public static void SetGridLayout(GridView gridView1) + { + foreach (GridColumn column in gridView1.Columns) + { + if (column.Width > 500) + column.Width = 500; + } + } + + /// <summary> + /// 璁剧疆閫夐」鍗� + /// </summary> + /// <param name="gridView1"></param> + /// <param name="xtraTabControl1"></param> + /// <param name="pageBar1"></param> + /// <param name="action"></param> + /// <param name="page"></param> public static void SetTabParameter(GridView gridView1, DevExpress.XtraTab.XtraTabControl xtraTabControl1, UcPageBar pageBar1, DelegateGetModel action = null, DelegateGetList page = null) { xtraTabControl1.SelectedPageChanged += (s, e) => @@ -2054,7 +2083,7 @@ column.Visible = bool.Parse(controlVisible); } } - + } } } -- Gitblit v1.9.3