From d70880a3d9ae6c9f99ec380ccd16f5524bb622e6 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期六, 05 四月 2025 09:06:31 +0800
Subject: [PATCH] 修改按钮状态

---
 DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs |   82 +++++++++++++++++++++++++++--------------
 1 files changed, 54 insertions(+), 28 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs b/DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs
index 84eec46..171c1f7 100644
--- a/DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs
@@ -85,7 +85,7 @@
         {
             var rowGuid = UtilityHelper.GetCurrentDoubleRow(tlMenu, e, "guid");
             if (!string.IsNullOrEmpty(rowGuid))
-                getModel(rowGuid, false, 999);
+                getModel(rowGuid);
         }
 
         /// <summary>
@@ -95,7 +95,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>
@@ -113,7 +113,6 @@
                 MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵")) return;
             var lst = new List<string>();
             lst.Add(rowGuid);
@@ -126,7 +125,10 @@
                 var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
-                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
+                    if (xtraTabControl1.SelectedTabPageIndex == 0)
+                    { }
+                    else
+                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
                     getTree();
                 }
 
@@ -145,8 +147,21 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 0);
-            getTree();
+            if (xtraTabControl1.SelectedTabPageIndex == 1)
+                getModel(lbGuid.Text.Trim());
+            else
+            {
+                //_filterList.Clear();
+                //if (gridView1.ActiveFilter.Count > 0)
+                //{
+                //    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+                //    gridView1.ActiveFilter.Clear();
+                //    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+                //}
+                //getPageList(1);
+                getTree();
+            }
+        
         }
 
         /// <summary>
@@ -156,26 +171,35 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
         {
-            string rowGuid, rowName;
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
-                lbGuid, txt_name, tlMenu);
+
+            string rowGuid = "", rowName = "";
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_name, tlMenu);
             if (string.IsNullOrEmpty(rowGuid))
             {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-
-            getModel(rowGuid, true, 1);
-            if (txt_category.SelectedIndex == 1)
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
+            if (xtraTabControl1.SelectedTabPageIndex == 1)
             {
-                txt_formPath.Enabled = true;
-                txt_icon.Enabled = true;
+                getModel(rowGuid);
+                if (txt_category.SelectedIndex == 1)
+                {
+                    txt_formPath.Enabled = true;
+                    txt_icon.Enabled = true;
+                }
+                else
+                {
+                    txt_formPath.Enabled = false;
+                    txt_icon.Enabled = false;
+                }
             }
             else
             {
-                txt_formPath.Enabled = false;
-                txt_icon.Enabled = false;
+                UtilityHelper.ChangeEnableByControl(this.panel1.Controls, true);
             }
+
+         
         }
 
         /// <summary>
@@ -185,9 +209,10 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 1);
             lbGuid.Text = "";
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
             UtilityHelper.CleanValueByControl(panel1.Controls, true);
+           
         }
 
         /// <summary>
@@ -221,10 +246,9 @@
                 txt_upGuid.Focus();
                 return;
             }
-
             var _obj = new
             {
-                guid = lbGuid.Text.Trim(), //涓诲缓
+                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
                 upGuid = _upGuid, //涓婄骇鐨勪富寤�
                 name = txt_name.Text.Trim(), //鍚嶇О
                 icon = txt_icon.Text, //鑿滃崟鍥炬爣
@@ -244,6 +268,8 @@
                     lbGuid.Text = _rtn.rtnData;
                     toolBarMenu1.isSetBtn = true;
                     UtilityHelper.ChangeEnableByControl(panel1.Controls, false);
+                    toolBarMenu1.currentAction = "";
+                    Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                 }
             }
             catch (Exception ex)
@@ -257,7 +283,7 @@
         /// </summary>
         private void getTree()
         {
-            var pgq = new PageQueryModel(1, 999999, "idx");
+            var pgq = new PageQueryModel(1, 999999, "a.idx");
             var json = JsonConvert.SerializeObject(pgq);
             try
             {
@@ -270,7 +296,7 @@
                 tlMenu.ParentFieldName = "upGuid";
                 tlMenu.Tag = "name";
                 tlMenu.EndUpdate();
-                // this.tlMenu.ExpandAll();
+                this.tlMenu.CollapseAll();
                 tlMenu.OptionsView.CheckBoxStyle =
                     DefaultNodeCheckBoxStyle.Default;
             }
@@ -280,15 +306,16 @@
             }
         }
 
-        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))
             {
                 MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-
-            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
             var _obj = new
             {
                 guid = strGuid //涓诲缓
@@ -321,8 +348,8 @@
         /// </summary>
         private void getDownList()
         {
-            var pgq = new PageQueryModel(1, 999999, "idx", "asc", "",
-                " and category=1");
+            var pgq = new PageQueryModel(1, 999999, "a.idx", "asc", "",
+                " and a.category=1");
             var json = JsonConvert.SerializeObject(pgq);
             try
             {
@@ -376,7 +403,6 @@
                         i++;
                     }
                 }
-
             txt_icon.Properties.LargeImages = dicImg;
             txt_icon.Properties.SmallImages = dicImg;
         }

--
Gitblit v1.9.3