| | |
| | | using DevExpress.Utils.DirectXPaint; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraGrid; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using DevExpress.XtraLayout; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.UserControl; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | |
| | | public UcRptCgdhd() |
| | | { |
| | | InitializeComponent(); |
| | | //this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; |
| | | //this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; |
| | | //this.toolBarMenu1.getXmlConfig(); |
| | | } |
| | | public bool isInitialize = false; |
| | | /// <summary> |
| | | /// 这和普通页不一样 |
| | | /// </summary> |
| | | public void Initialize() |
| | | { |
| | | if (isInitialize) |
| | | return; |
| | | string _formNamespace = this.GetType().FullName; |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<GridView>(); |
| | | gvList.Add(gridView1Report); |
| | | GridControl gcMain = this.Controls.Find("gcMain1Report", true).OfType<GridControl>().FirstOrDefault(); |
| | | UtilityHelper.GetUcXmlConfig(_formNamespace, gvList, gcMain); |
| | | Form parentForm = this.FindForm(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, parentForm, "", "", (value) => |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1Report, null, parentForm, "", "", (value) => |
| | | { |
| | | // Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); |
| | | }); |
| | | // Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); |
| | | }, tips); |
| | | //Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => |
| | | //{ |
| | | // getModel(value); |
| | |
| | | //}, lbGuid); |
| | | getPageList(1); |
| | | pageBar1.PagerEvent += PageBar1_PagerEvent; |
| | | this.isInitialize=true; |
| | | } |
| | | |
| | | |
| | | private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | | { |
| | | _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); |
| | | _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1Report.Columns, gridView1Report); |
| | | await Task.Delay(100); |
| | | getPageList(1); |
| | | } |
| | |
| | | /// <param name="e"></param> |
| | | public void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) |
| | | { |
| | | gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; |
| | | gridView1.ActiveFilter.Clear(); |
| | | gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; |
| | | var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName); |
| | | gridView1Report.ColumnFilterChanged -= GridView1_ColumnFilterChanged; |
| | | gridView1Report.ActiveFilter.Clear(); |
| | | gridView1Report.ColumnFilterChanged += GridView1_ColumnFilterChanged; |
| | | var frm = new ShowFilter(gridView1Report.Columns, _filterList, this.GetType().FullName); |
| | | frm.UpdateParent += Frm_UpdateParent; |
| | | frm.ShowDialog(); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) |
| | | public void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) |
| | | { |
| | | getPageList(this.pageBar1.CurrentPage); |
| | | } |
| | |
| | | /// <param name="pageSize">每页几条</param> |
| | | private void getPageList(int curPage) |
| | | { |
| | | gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | gcMain1Report.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.INDEP_DATE", "asc", "", _sbSqlWhere.ToString()); |
| | | string json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | |
| | | if (dd.rtnCode > 0) |
| | | { |
| | | DataTable dt = dd.rtnData.list; |
| | | gcMain1.BindingContext = new BindingContext(); |
| | | gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; |
| | | gcMain1Report.BindingContext = new BindingContext(); |
| | | gridView1Report.ColumnFilterChanged -= GridView1_ColumnFilterChanged; |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | gcMain1.DataSource = dt; |
| | | gcMain1.ForceInitialize(); |
| | | gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); |
| | | gcMain1Report.DataSource = dt; |
| | | gcMain1Report.ForceInitialize(); |
| | | gridView1Report.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1Report); |
| | | } |
| | | else |
| | | UtilityHelper.SetDefaultTable(gcMain1, gridView1); |
| | | gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; |
| | | UtilityHelper.SetDefaultTable(gcMain1Report, gridView1Report); |
| | | gridView1Report.ColumnFilterChanged += GridView1_ColumnFilterChanged; |
| | | pageBar1.TotalPages = dd.rtnData.pages;//总页 |
| | | pageBar1.CurrentPage = curPage;//当前页 |
| | | pageBar1.RecordCount = dd.rtnData.total;//总记录数 |
| | |
| | | ToolBox.MsgHelper.ShowError("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |