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 | 42 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 36 insertions(+), 6 deletions(-) diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs index faebd02..c610dde 100644 --- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs +++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs @@ -409,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": @@ -425,8 +432,8 @@ txt.Checked = false; break; } + } - txt.ReadOnly = isEdt; continue; } //鍗曢�� @@ -452,6 +459,7 @@ txt.Enabled = !isEdt; continue; } + //鏃堕棿 if (colType is DateTimePicker) { @@ -797,7 +805,6 @@ else txt.ReadOnly = isEdt; continue; - } //鑷畾涔変粨搴� if (ctrl is UcLookCk) @@ -1374,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 @@ -1595,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) @@ -1719,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> @@ -1757,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")) @@ -1766,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; @@ -1863,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) => @@ -2053,7 +2083,7 @@ column.Visible = bool.Parse(controlVisible); } } - + } } } -- Gitblit v1.9.3