From 5b419c5a4fd892b1777e8c5ac584bf2df3cbbb3e Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期五, 28 二月 2025 16:32:12 +0800
Subject: [PATCH] 布局

---
 DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index 0f3d47a..debc890 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -10,6 +10,7 @@
 using System.Net.Http;
 using System.Reflection;
 using System.Resources;
+using System.Runtime.CompilerServices;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
@@ -1614,7 +1615,7 @@
                             btnChkIco.Tag = "鏈鏍�";
                         }
                         btnChkIco.Anchor = AnchorStyles.Top | AnchorStyles.Right; // 闈犲彸
-                        btnChkIco.Location = new Point(fm.ClientSize.Width - btnChkIco.Width - 20,25); // 璺濈椤堕儴10鍍忕礌
+                        btnChkIco.Location = new Point(fm.ClientSize.Width - btnChkIco.Width - 20, 25); // 璺濈椤堕儴10鍍忕礌
                     }
                 }
             }
@@ -2009,8 +2010,58 @@
                             column.Visible = bool.Parse(controlVisible);
                     }
                 }
+               
             }
         }
+
+        public static void getXmlConfig(string namespaceFullName, List<DevExpress.XtraGrid.Views.Grid.GridView> gvList)
+        {
+            // gridView1.ShowCustomization();
+            // gridView1.OptionsMenu.EnableColumnMenu = false;
+            JArray array = new JArray();
+            var _obj = new
+            {
+                formPath = namespaceFullName,
+            };
+            try
+            {
+                string strJson = UtilityHelper.HttpPost("", "Fm/GetModel", JsonConvert.SerializeObject(_obj));
+                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+                if (_rtn.rtnCode > 0)
+                {
+                    JObject _job = JObject.Parse(strJson);
+                    foreach (var a in _job["rtnData"]["list"])
+                    {
+                        //string _id = a["controlId"].ToString();
+                        //string _controlType = a["controlType"].ToString();
+                        //string _controlXml = a["controlXml"].ToString();
+                        //string _splitterPosition = a["splitterPosition"].ToString();
+                        array.Add(a);
+                    }
+                    foreach (GridView gridView1 in gvList)
+                    {
+                        JToken john = array.FirstOrDefault(t => t["controlId"].ToString().ToUpper() == gridView1.Name.ToString().Trim().ToUpper());
+                        if (john != null)
+                        {
+                            string controlId = john["controlId"].ToString();
+                            string controlXml = john["controlXml"].ToString();
+                            byte[] byteArray = Encoding.UTF8.GetBytes(controlXml);
+                            using (var stream = new MemoryStream(byteArray))
+                            {
+                                gridView1.RestoreLayoutFromStream(stream);
+                            }
+                        }
+                    }
+                }
+                else
+                    ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+            }
+            catch (Exception ex)
+            {
+                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+            }
+
+        }
     }
 
     /// <summary>

--
Gitblit v1.9.3