| | |
| | | { |
| | | colmn.Visible = true; |
| | | colmn.OptionsColumn.ReadOnly = false; |
| | | }; |
| | | } |
| | | ; |
| | | if (colmn.Name.ToString().Contains("gvMxDel") || colmn.Name.ToString().Contains("gvMxTui")) |
| | | { |
| | | colmn.Visible = !isEdt; |
| | |
| | | public delegate void DelegateGetModel(string guid); |
| | | public delegate void DelegateGetList(int currentPage); |
| | | /// <summary> |
| | | /// 设置主表的样式 |
| | | /// |
| | | /// </summary> |
| | | /// <param name="gridView1">gridview</param> |
| | | /// <param name="picCheckBox">图标按钮</param> |
| | | /// <param name="fm"></param> |
| | | /// <param name="fm">窗体</param> |
| | | /// <param name="fileName">字段</param> |
| | | /// <param name="icoName">图标路径</param> |
| | | /// <param name="action"></param> |
| | | public static void SetGridViewParameter(GridView gridView1, PictureBox picCheckBox = null, Form fm = null, string fileName = "checkStatus", string icoName = "", DelegateGetModel action = null, DevExpress.Utils.ToolTipController tips = null, bool isPostSearch = true) |
| | | /// <param name="action">委托1</param> |
| | | /// <param name="tips">鸟嘴提示</param> |
| | | /// <param name="isPostSearch"></param> |
| | | /// <param name="action2">委托2(列表显示明细)</param> |
| | | public static void SetGridViewParameter(GridView gridView1, PictureBox picCheckBox = null, Form fm = null, string fileName = "checkStatus", string icoName = "", DelegateGetModel action = null, DevExpress.Utils.ToolTipController tips = null, bool isPostSearch = true, DelegateGetModel action2 = null) |
| | | { |
| | | gridView1.PopupMenuShowing += (s, e) => |
| | | { |
| | |
| | | } |
| | | }; |
| | | gridView1.OptionsView.ColumnAutoWidth = false;//自动调整列宽 |
| | | |
| | | if (isPostSearch == true) |
| | | { |
| | | gridView1.OptionsView.ShowGroupPanel = false; |
| | |
| | | //是否显示底部的过滤条 |
| | | // gridView1.OptionsView.ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode.Never; |
| | | } |
| | | |
| | | // gridView1.Appearance.HeaderPanel.ForeColor = DevExpress.LookAndFeel.DXSkinColors.ForeColors.ControlText; |
| | | foreach (GridColumn column in gridView1.Columns) |
| | | { |
| | |
| | | column.OptionsFilter.AllowAutoFilter = false; |
| | | } |
| | | } |
| | | |
| | | gridView1.IndicatorWidth = 60; |
| | | gridView1.CustomDrawRowIndicator += (s, e) => |
| | | { |
| | |
| | | }; |
| | | if (view.ActiveEditor is TextEdit) |
| | | view.ActiveEditor.MouseUp += ActiveEditor_MouseUp; |
| | | }; |
| | | } |
| | | if (action2 != null) |
| | | { |
| | | gridView1.FocusedRowChanged += (s, e) => |
| | | { |
| | | int _handle = gridView1.FocusedRowHandle; |
| | | if (_handle == -1) |
| | | return; |
| | | DataRow row = gridView1.GetDataRow(_handle); |
| | | if (row == null) |
| | | return; |
| | | string _guid = row["guid"].ToString(); |
| | | if (string.IsNullOrEmpty(_guid)) |
| | | return; |
| | | action2(_guid); |
| | | }; |
| | | } |
| | | gridView1.RowStyle += (s, e) => |
| | |
| | | }; |
| | | } |
| | | } |
| | | |
| | | private static void ActiveEditor_MouseUp(object sender, MouseEventArgs e) |
| | | { |
| | | BaseEdit edit = sender as BaseEdit; |
| | |
| | | { |
| | | int _handle = gridView1.FocusedRowHandle; |
| | | bool _bl = xtraTabControl1.TabPages[0].PageEnabled; |
| | | if (_bl == false) { return; }; |
| | | if (_bl == false) { return; } |
| | | ; |
| | | if (_handle < 0) |
| | | { |
| | | xtraTabControl1.SelectedTabPageIndex = -1; |
| | |
| | | #endregion |
| | | |
| | | |
| | | //读取默认组织 |
| | | public static string GetFirstOrg(UserControl.UcLookOrg txt_erpSczz) |
| | | { |
| | | string userGuid = LoginInfoModel.CurrentUser.LoginUserGuid; |
| | | var pgq = new PageQueryModel(1, 999999, "FID", "asc", userGuid, " and IS_STATUS=1"); |
| | | var json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", "Organization/GetListPage", json); |
| | | var _obj = UtilityHelper.ReturnToDynamic(strReturn); |
| | | string _extendText = _obj.rtnData.extendText; |
| | | string[] _dftOrg = _extendText.Split(','); |
| | | if (_dftOrg.Length > 0) |
| | | { |
| | | txt_erpSczz.SetIdOrCode(_dftOrg[0].Trim()); |
| | | return _dftOrg[0].Trim(); |
| | | } |
| | | return ""; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ""; |
| | | } |
| | | } |
| | | //读取默认组织 |
| | | public static string GetFirstOrg(UserControl.UcLookOrg txt_erpSczz) |
| | | { |
| | | string userGuid = LoginInfoModel.CurrentUser.LoginUserGuid; |
| | | var pgq = new PageQueryModel(1, 999999, "FID", "asc", userGuid, " and IS_STATUS=1"); |
| | | var json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", "Organization/GetListPage", json); |
| | | var _obj = UtilityHelper.ReturnToDynamic(strReturn); |
| | | string _extendText = _obj.rtnData.extendText; |
| | | string[] _dftOrg = _extendText.Split(','); |
| | | if (_dftOrg.Length > 0) |
| | | { |
| | | txt_erpSczz.SetIdOrCode(_dftOrg[0].Trim()); |
| | | return _dftOrg[0].Trim(); |
| | | } |
| | | return ""; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | #region GridView汇总配置工具方法 |
| | | /// <summary> |
| | | /// 2025-08-14 kyy 快速配置GridView底部汇总(启用汇总行+设置列求和汇总) |
| | | /// </summary> |
| | | /// <param name="gridView">目标GridView控件</param> |
| | | /// <param name="summaryColumns">需要进行求和汇总的列名数组</param> |
| | | public static void SetupGridSummary(DevExpress.XtraGrid.Views.Grid.GridView gridView, params string[] summaryColumns) |
| | | { |
| | | // 启用底部汇总行 |
| | | gridView.OptionsView.ShowFooter = true; |
| | | |
| | | // 为每个指定列设置求和汇总 |
| | | foreach (var columnName in summaryColumns) |
| | | { |
| | | // 验证列是否存在(避免异常) |
| | | if (gridView.Columns[columnName] != null) |
| | | { |
| | | gridView.Columns[columnName].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; |
| | | gridView.Columns[columnName].SummaryItem.DisplayFormat = "合计: {0}"; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |