lu
2025-03-22 09b9f82bc99868fe0ea90525d0b732618c5495cb
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs
@@ -7,9 +7,11 @@
using System.Net;
using System.Text;
using System.Windows.Forms;
using DevExpress.Utils.Text.Internal;
using DevExpress.XtraBars;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraLayout;
using Gs.DevApp.DevFrm.Rpt;
@@ -59,7 +61,7 @@
            var lst = new List<string>();
            foreach (BarItem item in barManager1.Items)
                if (item is BarLargeButtonItem largeButtonItem)
                    if (!string.IsNullOrEmpty(item.Caption) && item.Caption != "保存" && item.Caption != "刷新")
                    if (!string.IsNullOrEmpty(item.Caption) && item.Caption != "保存" && item.Caption != "刷新" && item.Caption != "帮助" && item.Caption != "保存版面" && item.Caption != "取消")
                        lst.Add(item.Caption);
            actions = lst;
        }
@@ -714,6 +716,20 @@
                    JsonConvert.SerializeObject(_obj));
                var dd = UtilityHelper.ReturnToList(strReturn);
                var dt = dd.rtnData;
                if (!string.IsNullOrEmpty(defaultActions) && defaultActions.Contains("查询"))
                {
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        dt.Columns.Add("guid", typeof(string));
                        dt.Columns.Add("name", typeof(string));
                    }
                    DataRow newRow = dt.NewRow();
                    newRow["guid"] = Guid.NewGuid().ToString();
                    newRow["name"] = "查询";
                    dt.Rows.Add(newRow);
                }
                var _enabledList = new List<string>();
                foreach (BarItem item in barManager1.Items)
                {
@@ -839,7 +855,7 @@
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                return true;
                return false;
            }
            return false;
        }
@@ -1032,6 +1048,8 @@
        /// 当前状态
        /// </summary>
        public string currentAction { get; set; }
        public string defaultActions { get; set; }
        #endregion
@@ -1042,7 +1060,11 @@
        /// <returns></returns>
        private List<DevExpress.XtraGrid.Views.Grid.GridView> getGvList()
        {
            Form parentForm = this.Parent as Form;
            Form parentForm;
            if (this.Parent is Form)
                parentForm = this.Parent as Form;
            else
                parentForm = this.Parent.Parent as Form;
            List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
            //查找gridview,主页面
            GridControl gcMain = parentForm.Controls.Find("gcMain1", true).OfType<GridControl>().FirstOrDefault();
@@ -1080,7 +1102,11 @@
        /// <returns></returns>
        private List<DevExpress.XtraLayout.LayoutControl> getLayList()
        {
            Form parentForm = this.Parent as Form;
            Form parentForm;
            if (this.Parent is Form)
                parentForm = this.Parent as Form;
            else
                parentForm = this.Parent.Parent as Form;
            List<DevExpress.XtraLayout.LayoutControl> layList = new List<DevExpress.XtraLayout.LayoutControl>();
            DevExpress.XtraLayout.LayoutControl lay2 = parentForm.Controls.Find("layoutMx1", true).OfType<DevExpress.XtraLayout.LayoutControl>().FirstOrDefault();
            if (lay2 != null)
@@ -1096,7 +1122,11 @@
        /// <returns></returns>
        private List<DevExpress.XtraEditors.SplitContainerControl> getSpcList()
        {
            Form parentForm = this.Parent as Form;
            Form parentForm;
            if (this.Parent is Form)
                parentForm = this.Parent as Form;
            else
                parentForm = this.Parent.Parent as Form;
            List<DevExpress.XtraEditors.SplitContainerControl> spcList = new List<DevExpress.XtraEditors.SplitContainerControl>();
            DevExpress.XtraEditors.SplitContainerControl spc1 = parentForm.Controls.Find("split1", true).OfType<DevExpress.XtraEditors.SplitContainerControl>().FirstOrDefault();
            DevExpress.XtraEditors.SplitContainerControl spc2 = parentForm.Controls.Find("splitMx1", true).OfType<DevExpress.XtraEditors.SplitContainerControl>().FirstOrDefault();
@@ -1111,9 +1141,17 @@
            return spcList;
        }
        /// <summary>
        /// 读取xml配置,目前配置gcMain1,layoutMx1,加查询条件
        /// </summary>
        public void getXmlConfig()
        {
            Form parentForm = this.Parent as Form;
            Form parentForm;
            if (this.Parent is Form)
                parentForm = this.Parent as Form;
            else
                parentForm = this.Parent.Parent as Form;
            string _formNamespace = parentForm.GetType().FullName;
            List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = getGvList();
            List<DevExpress.XtraLayout.LayoutControl> layList = getLayList();
@@ -1192,6 +1230,27 @@
                        }
                    }
                    //设置查询条件beg
                    GridControl gcMain = parentForm.Controls.Find("gcMain1", true).OfType<GridControl>().FirstOrDefault();
                    if (gcMain != null)
                    {
                        GridView gv1 = gcMain.MainView as GridView;
                        if (gv1 != null)
                        {
                            foreach (var a in _job["rtnData"]["list2"])
                            {
                                string _gvColName = a["gvColName"].ToString();
                                string _sqlField = a["sqlField"].ToString();
                                var column = gv1.Columns.Cast<DevExpress.XtraGrid.Columns.GridColumn>()
                                                .FirstOrDefault(c => c.Name == _gvColName);
                                if (column != null)
                                {
                                    column.Tag = _sqlField;
                                }
                            }
                        }
                    }
                    //设置查询条件end
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);