From fa113f04a917e85af84813487f033fb6bc43a5d7 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期六, 20 九月 2025 15:04:35 +0800
Subject: [PATCH] bug

---
 DevApp/Gs.DevApp/UserControl/UcDictionarySelect.Designer.cs |   30 ++++++++++++---
 DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs          |   55 +++++++++++++++++----------
 DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs                  |    5 +-
 3 files changed, 62 insertions(+), 28 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
index 853e76a..70b698e 100644
--- a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
@@ -121,6 +121,7 @@
                 var dr = gvMx1.GetFocusedDataRow();
                 if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString()))
                 {
+
                 }
                 else
                 {
@@ -138,12 +139,12 @@
                 if (txt_gx.Text.Trim() == fGxTouRu)
                     _type = "宸ュ簭G001:鎶曞叆涓嶈壇鎻忚堪";
                 if (txt_gx.Text.Trim() == fGxDianJian)
-                    _type = "宸ュ簭G002:鐢垫涓嶈壇鎻忚堪"; 
+                    _type = "宸ュ簭G002:鐢垫涓嶈壇鎻忚堪";
                 if (txt_gx.Text.Trim() == fGxShouJian)
                     _type = "宸ュ簭G003:姘存涓嶈壇鎻忚堪";
                 if (txt_gx.Text.Trim() == fGxZhongJian)
                     _type = "宸ュ簭G004:缁堟涓嶈壇鎻忚堪";
-                UcDictionarySelect frm = new UcDictionarySelect(_type, " a.s_type='"+ _type + "' and pid<>'00000000-0000-0000-0000-000000000000'", _msg);
+                UcDictionarySelect frm = new UcDictionarySelect(_type, " a.s_type='" + _type + "' and pid<>'00000000-0000-0000-0000-000000000000'", _msg);
                 frm.UpdateParent += (ss, ee) =>
                 {
                     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
diff --git a/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.Designer.cs b/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.Designer.cs
index bf51627..12d658a 100644
--- a/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.Designer.cs
+++ b/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.Designer.cs
@@ -32,6 +32,7 @@
             this.tlcMenuName = new DevExpress.XtraTreeList.Columns.TreeListColumn();
             this.tlcActions = new DevExpress.XtraTreeList.Columns.TreeListColumn();
             this.panel1 = new System.Windows.Forms.Panel();
+            this.btnOpen = new DevExpress.XtraEditors.SimpleButton();
             this.lbMsg = new DevExpress.XtraEditors.LabelControl();
             this.btnIn = new DevExpress.XtraEditors.SimpleButton();
             ((System.ComponentModel.ISupportInitialize)(this.tlMenu)).BeginInit();
@@ -54,7 +55,7 @@
             this.tlMenu.OptionsView.CheckBoxStyle = DevExpress.XtraTreeList.DefaultNodeCheckBoxStyle.Check;
             this.tlMenu.OptionsView.RootCheckBoxStyle = DevExpress.XtraTreeList.NodeCheckBoxStyle.Check;
             this.tlMenu.OptionsView.TreeLineStyle = DevExpress.XtraTreeList.LineStyle.Solid;
-            this.tlMenu.Size = new System.Drawing.Size(776, 475);
+            this.tlMenu.Size = new System.Drawing.Size(1043, 623);
             this.tlMenu.TabIndex = 5;
             this.tlMenu.TreeLevelWidth = 21;
             // 
@@ -81,13 +82,27 @@
             // 
             // panel1
             // 
+            this.panel1.Controls.Add(this.btnOpen);
             this.panel1.Controls.Add(this.lbMsg);
             this.panel1.Controls.Add(this.btnIn);
             this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panel1.Location = new System.Drawing.Point(0, 475);
+            this.panel1.Location = new System.Drawing.Point(0, 623);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(776, 56);
+            this.panel1.Size = new System.Drawing.Size(1043, 56);
             this.panel1.TabIndex = 6;
+            // 
+            // btnOpen
+            // 
+            this.btnOpen.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Success;
+            this.btnOpen.Appearance.Font = new System.Drawing.Font("Tahoma", 20F);
+            this.btnOpen.Appearance.Options.UseBackColor = true;
+            this.btnOpen.Appearance.Options.UseFont = true;
+            this.btnOpen.Dock = System.Windows.Forms.DockStyle.Right;
+            this.btnOpen.Location = new System.Drawing.Point(729, 0);
+            this.btnOpen.Name = "btnOpen";
+            this.btnOpen.Size = new System.Drawing.Size(157, 56);
+            this.btnOpen.TabIndex = 7;
+            this.btnOpen.Text = "鍏ㄩ儴灞曞紑";
             // 
             // lbMsg
             // 
@@ -105,12 +120,14 @@
             // btnIn
             // 
             this.btnIn.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Primary;
+            this.btnIn.Appearance.Font = new System.Drawing.Font("Tahoma", 20F);
             this.btnIn.Appearance.Options.UseBackColor = true;
+            this.btnIn.Appearance.Options.UseFont = true;
             this.btnIn.Dock = System.Windows.Forms.DockStyle.Right;
             this.btnIn.ImageOptions.Image = global::Gs.DevApp.Properties.Resources.zoom100_16x16;
-            this.btnIn.Location = new System.Drawing.Point(682, 0);
+            this.btnIn.Location = new System.Drawing.Point(886, 0);
             this.btnIn.Name = "btnIn";
-            this.btnIn.Size = new System.Drawing.Size(94, 56);
+            this.btnIn.Size = new System.Drawing.Size(157, 56);
             this.btnIn.TabIndex = 5;
             this.btnIn.Text = "纭畾閫夋嫨";
             // 
@@ -118,7 +135,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(776, 531);
+            this.ClientSize = new System.Drawing.Size(1043, 679);
             this.Controls.Add(this.tlMenu);
             this.Controls.Add(this.panel1);
             this.IconOptions.Image = global::Gs.DevApp.Properties.Resources.logo_png_black;
@@ -142,5 +159,6 @@
         private System.Windows.Forms.Panel panel1;
         private DevExpress.XtraEditors.SimpleButton btnIn;
         private DevExpress.XtraEditors.LabelControl lbMsg;
+        private DevExpress.XtraEditors.SimpleButton btnOpen;
     }
 }
\ No newline at end of file
diff --git a/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs b/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs
index 5c20efc..87cea74 100644
--- a/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs
+++ b/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs
@@ -7,6 +7,7 @@
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
+using System.Threading.Tasks;
 using System.Windows.Forms;
 
 
@@ -20,11 +21,20 @@
         public UcDictionarySelect(string _strTitle, string _strWhere, string _strMsg = "")
         {
             InitializeComponent();
-
             lbMsg.Text = _strMsg;
             this.strTitle = _strTitle;
             this.strWhere = _strWhere;
             this.Text = _strTitle;
+            tlMenu.IndicatorWidth = 50;
+            tlMenu.CustomDrawNodeIndicator += (s, ee) =>
+            {
+                if (ee.IsNodeIndicator)
+                {
+                    var index = ee.Node.TreeList.GetVisibleIndexByNode(ee.Node);
+                    ee.Info.DisplayText = (index + 1).ToString();
+                }
+            };
+            getTreeAsync();
             tlMenu.MouseDown += (s, e) =>
             {
                 TreeListHitInfo hitInfo = tlMenu.CalcHitInfo(new Point(e.X, e.Y));
@@ -36,16 +46,20 @@
                         if (node.HasChildren) // 鍙湁褰撹妭鐐规湁瀛愯妭鐐规椂鎵嶈�冭檻灞曞紑鎴栨姌鍙�
                         {
                             if (node.Expanded)
+                            {
                                 node.Collapse();
+                                btnOpen.Text = "鍏ㄩ儴灞曞紑";
+                            }
                             else
+                            {
                                 node.Expand();
+                                btnOpen.Text = "鍏ㄩ儴鏀舵嫝";
+                            }
                         }
                     }
                 }
             };
-            getTree();
             tlMenu.CustomDrawNodeCheckBox += TreeList1_CustomDrawNodeCheckBox;
-            tlMenu.OptionsSelection.EnableAppearanceFocusedCell = false;
             btnIn.Click += (s, e) =>
             {
                 findOrigin(tlMenu);
@@ -62,13 +76,20 @@
                 UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list });
                 Close();
             };
-            tlMenu.IndicatorWidth = 50;
-            tlMenu.CustomDrawNodeIndicator += (s, ee) =>
-            {
-                if (ee.IsNodeIndicator)
+            btnOpen.Click += (s, e) => {
+
+                if (btnOpen.Text == "鍏ㄩ儴灞曞紑")
                 {
-                    var index = ee.Node.TreeList.GetVisibleIndexByNode(ee.Node);
-                    ee.Info.DisplayText = (index + 1).ToString();
+                    tlMenu.ExpandAll();
+                    btnOpen.Text = "鍏ㄩ儴鏀舵嫝";
+                    return;
+                }
+
+                if (btnOpen.Text == "鍏ㄩ儴鏀舵嫝")
+                {
+                    tlMenu.CollapseAll();
+                    btnOpen.Text = "鍏ㄩ儴灞曞紑";
+                    return;
                 }
             };
         }
@@ -90,17 +111,10 @@
                 e.Handled = true;
             }
         }
-
-        // 鍙�夛細澶勭悊鑺傜偣灞曞紑浜嬩欢锛岀‘淇濆姩鎬佸姞杞界殑瀛愯妭鐐圭敓鏁�
-        private void treeList1_BeforeExpand(object sender, BeforeExpandEventArgs e)
-        {
-            // 鑻ュ瓙鑺傜偣鏄姩鎬佸姞杞界殑锛屽湪姝ゅ鍔犺浇鏁版嵁
-            // LoadChildNodes(e.Node);
-        }
         /// <summary>
         ///     璇诲彇鍒楄〃
         /// </summary>
-        private void getTree()
+        private async Task getTreeAsync()
         {
             string _where = " and 1=1 and a.type1=1 and " + this.strWhere;
             var pgq = new PageQueryModel(1, 999999, "a.defect_name", "asc", "", _where);
@@ -116,18 +130,17 @@
                 tlMenu.ParentFieldName = "pid";
                 tlMenu.Tag = "defectName";
                 tlMenu.EndUpdate();
-                //  tlMenu.OptionsBehavior.Editable = true;
                 tlMenu.OptionsBehavior.AllowRecursiveNodeChecking = false;
                 tlMenu.BestFitColumns();
-                tlMenu.ExpandAll();
                 tlMenu.CollapseAll();
             }
             catch (Exception ex)
             {
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
+            await Task.Delay(500); // 绛夊緟1000姣锛�1绉掞級
+            tlMenu.CollapseAll();
         }
-
 
         #region MyRegion
 
@@ -190,5 +203,7 @@
             }
         }
         #endregion
+
+      
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3