From ccc1b0d541d8f3bdd2bcb72dd0b5533e68b886d5 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期一, 09 六月 2025 09:53:37 +0800
Subject: [PATCH] 采购明细报表

---
 DevApp/Gs.DevApp/DevFrm/Sys/Frm_MesSysPageview.cs |  115 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 68 insertions(+), 47 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/Frm_MesSysPageview.cs b/DevApp/Gs.DevApp/DevFrm/Sys/Frm_MesSysPageview.cs
index 45256b0..4a2f8c9 100644
--- a/DevApp/Gs.DevApp/DevFrm/Sys/Frm_MesSysPageview.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Sys/Frm_MesSysPageview.cs
@@ -1,11 +1,9 @@
-using DevExpress.XtraBars.Docking2010.Views.WindowsUI;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
 using System.Data;
-using System.Drawing;
 using System.Windows.Forms;
 
 namespace Gs.DevApp.DevFrm
@@ -13,7 +11,6 @@
     public partial class Frm_MesSysPageview : DevExpress.XtraEditors.XtraForm
     {
         string _webServiceName = "MesSysPageviewManager/";
-        List<FilterEntity> _filterList = new List<FilterEntity>();
         public Frm_MesSysPageview()
         {
             InitializeComponent();
@@ -23,23 +20,23 @@
             this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
             this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
             this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
-            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
-            getPageList(1, UtilityHelper.GetPageSize());
+            this.toolBarMenu1.getXmlConfig();
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, "", "", (value) =>
+            {
+                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
+            }, tips);
+            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
+            {
+                getModel(value);
+            }, (value) =>
+            {
+                getPageList(this.pageBar1.CurrentPage);
+            }, lbGuid);
+            getPageList(1);
             pageBar1.PagerEvent += PageBar1_PagerEvent;
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1);
         }
 
-        /// <summary>
-        /// 鍙屽嚮浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
-        {
-            string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
-            if (!string.IsNullOrEmpty(rowGuid))
-                getModel(rowGuid, false, 999);
-        }
+
         /// <summary>
         /// 鍒嗛〉浜嬩欢
         /// </summary>
@@ -47,7 +44,7 @@
         /// <param name="pageSize"></param>
         private void PageBar1_PagerEvent(int curPage, int pageSize)
         {
-            getPageList(curPage, pageSize);
+            getPageList(curPage);
         }
         /// <summary>
         /// 鍙栨秷浜嬩欢
@@ -56,7 +53,7 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 0);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
         }
 
         /// <summary>
@@ -84,8 +81,11 @@
                 ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
-                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
-                    getPageList(1, UtilityHelper.GetPageSize());
+                    if (xtraTabControl1.SelectedTabPageIndex == 0)
+                    { }
+                    else
+                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
+                    getPageList(this.pageBar1.CurrentPage);
                 }
                 ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
             }
@@ -103,9 +103,19 @@
         private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
         {
             if (xtraTabControl1.SelectedTabPageIndex == 1)
-                getModel(lbGuid.Text.Trim(), false, 999);
+                getModel(lbGuid.Text.Trim());
             else
-                getPageList(1, UtilityHelper.GetPageSize());
+            {
+                //_filterList.Clear();
+                //if (gridView1.ActiveFilter.Count > 0)
+                //{
+                //    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+                //    gridView1.ActiveFilter.Clear();
+                //    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+                //}
+                //getPageList(1);
+                getPageList(this.pageBar1.CurrentPage);
+            }
         }
         /// <summary>
         /// 淇敼浜嬩欢
@@ -121,7 +131,15 @@
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            getModel(rowGuid, true, 1);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
+            if (xtraTabControl1.SelectedTabPageIndex == 1)
+            {
+                getModel(rowGuid);
+            }
+            else
+            {
+                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true);
+            }
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -130,10 +148,9 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 1);
             lbGuid.Text = "";
-            UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
-
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
+            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true);
         }
         /// <summary>
         /// 淇濆瓨浜嬩欢
@@ -142,7 +159,6 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
         {
-            
             toolBarMenu1.isSetBtn = false;
             if (string.IsNullOrEmpty(txt_pageView.Text.Trim()))
             {
@@ -167,10 +183,9 @@
                 guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
                 PageView = txt_pageView.Text.Trim(),
                 Path = txt_path.Text.Trim(),
-                Icoimg=txt_icoimg.Text.Trim(),
-                PageGroup=txt_pageGroup.Text.Trim(),
-                PageIdx=txt_pageIdx.Text.Trim(),
-                PageStatus=txt_pageStatus.Checked
+                PageGroup = txt_pageGroup.Text.Trim(),
+                PageIdx = txt_pageIdx.Text.Trim(),
+                PageStatus = txt_pageStatus.Checked
             };
             try
             {
@@ -181,7 +196,9 @@
                 {
                     lbGuid.Text = _rtn.rtnData;
                     toolBarMenu1.isSetBtn = true;
-                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
+                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
+                    toolBarMenu1.currentAction = "";
+                    Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                 }
             }
             catch (Exception ex)
@@ -195,14 +212,10 @@
         /// </summary>
         /// <param name="curPage">绗嚑椤�</param>
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
-        private void getPageList(int curPage, int pageSize)
+        private void getPageList(int curPage)
         {
-            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
-            foreach (FilterEntity itm in _filterList)
-            {
-                _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'");
-            }
-            PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "PAGE_IDX", "asc", "", _sbSqlWhere.ToString());
+            var _sbSqlWhere = "";
+            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.PAGE_GROUP", "desc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
             try
             {
@@ -211,13 +224,14 @@
                 if (dd.rtnCode > 0)
                 {
                     DataTable dt = dd.rtnData.list;
-                    gcMain.BindingContext = new BindingContext();
-                    gcMain.DataSource = dt;
-                    gcMain.ForceInitialize();
+                    gcMain1.BindingContext = new BindingContext();
+                    gcMain1.DataSource = dt;
+                    gcMain1.ForceInitialize();
                     int dddd = dd.rtnData.pages;//鎬婚〉
                     pageBar1.TotalPages = dddd;
                     pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟
                     pageBar1.CurrentPage = curPage;//褰撳墠椤�
+                    gridView1.BestFitColumns();
                 }
                 else
                 {
@@ -235,14 +249,16 @@
         /// <param name="strGuid">涓婚敭</param>
         /// <param name="isEdit">鏄惁鍙紪杈�</param>
         /// <param name="tabIdx">閫夐」鍗″簭鍙�</param>
-        private void getModel(string strGuid, bool isEdit, int tabIdx)
+        private void getModel(string strGuid)
         {
+            bool isEdit = false;
+            if (toolBarMenu1.currentAction == "add") return;
+            if (toolBarMenu1.currentAction == "edit") isEdit = true;
             if (string.IsNullOrEmpty(strGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
             var _obj = new
             {
                 guid = strGuid,//涓诲缓
@@ -255,7 +271,7 @@
                 {
                     dynamic dy = _rtn.rtnData;
                     lbGuid.Text = strGuid;
-                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit);
+                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit);
                 }
                 else
                     ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
@@ -266,6 +282,11 @@
             }
         }
 
+        /// <summary>
+        /// 涓婁紶鎸夐挳
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
         private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
         {
             var rowhandle = gridView1.FocusedRowHandle;
@@ -279,7 +300,7 @@
                 frm.UpdateParent += (ss, ee) =>
                 {
                     Gs.DevApp.ToolBox.MsgHelper.ShowInformation("涓婁紶鎴愬姛锛�");
-                    getPageList(1, UtilityHelper.GetPageSize());
+                    getPageList(this.pageBar1.CurrentPage);
                 };
                 frm.ShowDialog();
             }

--
Gitblit v1.9.3