From 4d3a6203df1cb2966ca09efbc8125544dba67537 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 21 三月 2025 14:04:35 +0800 Subject: [PATCH] 查询 --- DevApp/Gs.DevApp/UserControl/ShowFilter.cs | 88 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 84 insertions(+), 4 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/ShowFilter.cs b/DevApp/Gs.DevApp/UserControl/ShowFilter.cs index 8d41cfc..c36f003 100644 --- a/DevApp/Gs.DevApp/UserControl/ShowFilter.cs +++ b/DevApp/Gs.DevApp/UserControl/ShowFilter.cs @@ -3,22 +3,34 @@ using System.Data; using System.Text; using System.Windows.Forms; +using DevExpress.Utils.DirectXPaint; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Controls; +using DevExpress.XtraEditors.Repository; using DevExpress.XtraGrid.Columns; +using DevExpress.XtraGrid.Views.Base.ViewInfo; +using FastReport.MSChart; using Gs.DevApp.ToolBox; +using Newtonsoft.Json; namespace Gs.DevApp.UserControl { public partial class ShowFilter : XtraForm { private readonly GridColumnCollection _columns; - + private readonly string _fullName; + /// <summary> + /// + /// </summary> + /// <param name="Columns">鍒楀悕</param> + /// <param name="list">榛樿鍊�</param> + /// <param name="FullName">绫诲悕</param> public ShowFilter(GridColumnCollection Columns, - List<FilterEntity> list = null) + List<FilterEntity> list = null, string FullName = "") { FilterList = list; _columns = Columns; + _fullName = FullName; InitializeComponent(); repositoryItemComboBox1.TextEditStyle = TextEditStyles.DisableTextEditor; @@ -38,6 +50,8 @@ btnEsc.Click += BtnEsc_Click; btnQuery.Click += BtnQuery_Click; getPageList(); + //涓嬮潰涓烘煡璇㈤厤缃� + getPageListQuery(); } /// <summary> @@ -117,7 +131,6 @@ item.Value = kvp.Key; repositoryItemComboBox2.Items.Add(item); } - try { var dt = new DataTable(); @@ -132,7 +145,6 @@ dr["fieldValue"] = _sql.fileValue.Replace("%", ""); dt.Rows.Add(dr); } - gcMain.BindingContext = new BindingContext(); gcMain.DataSource = dt; gcMain.ForceInitialize(); @@ -182,5 +194,73 @@ EventArgs e) { } + + + /// <summary> + /// 绉诲嚭涓�琛� + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void repositoryItemButtonEdit1_ButtonClick(object sender, ButtonPressedEventArgs e) + { + gridView1.CloseEditor(); + gridView1.UpdateCurrentRow(); + var rowhandle = gridView1.FocusedRowHandle; + if (rowhandle < 0) + return; + if (e.Button.Index == 0) + { + var dr = gridView1.GetDataRow(rowhandle); + gridView1.DeleteRow(rowhandle); + return; + } + } + + + #region MyRegion + private void getPageListQuery() + { + //foreach (GridColumn col in _columns) + // if (col.Tag != null && col.Tag.ToString().StartsWith("query")) + // { + // var item = new CboItemEntity(); + // item.Text = col.Tag.ToString().Replace("query_", "") + + // "锛�" + col.Caption + "锛�"; + // //item.Value = col.FieldName; + // item.Value = col.Tag.ToString().Replace("query_", ""); + // repositoryItemComboBox1.Items.Add(item); + // } + repositoryItemComboBoxSql.Items.Clear(); + repositoryItemComboBoxSql.Items.Add("1"); + repositoryItemComboBoxSql.Items.Add("1"); + repositoryItemComboBoxSql.Items.Add("1"); + var _obj = new + { + formPath = this._fullName, + list = new List<dynamic>(), + }; + foreach (GridColumn col in _columns) + { + _obj.list.Add(new { + colName= col.Name.ToString(), + colCap=col.Caption + }); + } + try + { + var strJson = UtilityHelper.HttpPost("", + "Fm/GetQuery", JsonConvert.SerializeObject(_obj)); + var dt = UtilityHelper.ReturnToList(strJson); + DataTable _newTable = dt.rtnData; + gcQuery.BindingContext = new BindingContext(); + gcQuery.DataSource = _newTable; + gcQuery.ForceInitialize(); + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.3