From b084bd77d01a94c8f0a2d20c86a1f45ba7c8a23c Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期六, 19 四月 2025 14:08:05 +0800
Subject: [PATCH] 页面跳转

---
 DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs |   52 ++++++++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs b/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs
index e0aefaa..7b4f02a 100644
--- a/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs
+++ b/DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs
@@ -6,7 +6,6 @@
 using System;
 using System.Collections.Generic;
 using System.Data;
-using System.Text;
 using System.Windows.Forms;
 
 
@@ -14,35 +13,34 @@
 {
     public partial class UcDictionarySelect : DevExpress.XtraEditors.XtraForm
     {
-        private List<string> lstCheckedKeyID = new List<string>();//閫夋嫨灞�ID闆嗗悎
+        private List<dynamic> lstCheckedKeyID = new List<dynamic>();//閫夋嫨闆嗗悎
         string strTitle = "";
         string strWhere = "";
         public UcDictionarySelect(string _strTitle, string _strWhere)
         {
             InitializeComponent();
-            tlMenu.CustomDrawNodeCheckBox += TreeList1_CustomDrawNodeCheckBox;
-            getTree();
-            tlMenu.OptionsBehavior.Editable = true;
-            tlMenu.OptionsSelection.EnableAppearanceFocusedCell = false;
-            tlMenu.OptionsSelection.MultiSelect = true;
-            tlMenu.OptionsSelection.MultiSelectMode = TreeListMultiSelectMode.CellSelect;
             this.strTitle = _strTitle;
             this.strWhere = _strWhere;
             this.Text = _strTitle;
+            getTree();
+            tlMenu.CustomDrawNodeCheckBox += TreeList1_CustomDrawNodeCheckBox;
+            //  tlMenu.OptionsBehavior.Editable = true;
+            tlMenu.OptionsSelection.EnableAppearanceFocusedCell = false;
+            //  tlMenu.OptionsSelection.MultiSelect = true;
+            // tlMenu.OptionsSelection.MultiSelectMode = TreeListMultiSelectMode.CellSelect;
             btnIn.Click += (s, e) =>
             {
                 findOrigin(tlMenu);
                 var list = new List<dynamic>();
-                foreach (string key in lstCheckedKeyID)
+                foreach (dynamic key in lstCheckedKeyID)
                 {
                     list.Add(new
                     {
-                      //  dicCode = "001",
-                        dicTxt = key
+                        dicCode = key.dicCode,
+                        dicTxt = key.dicTxt
                     });
                 };
-                UpdateParent?.Invoke(this,
-                    new UpdateParentEventArgs { DynamicList = list });
+                UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list });
                 Close();
             };
             tlMenu.IndicatorWidth = 50;
@@ -85,7 +83,8 @@
         /// </summary>
         private void getTree()
         {
-            var pgq = new PageQueryModel(1, 999999, "a.defect_name");
+            string _where = " and 1=1 and " + this.strWhere;
+            var pgq = new PageQueryModel(1, 999999, "a.defect_name", "asc", "", _where);
             var json = JsonConvert.SerializeObject(pgq);
             try
             {
@@ -120,17 +119,36 @@
         {
             if (parentNode.Nodes.Count == 0)
             {
+                if (parentNode.CheckState == CheckState.Checked)
+                {
+                    DataRowView drv = tlMenu.GetDataRecordByNode(parentNode) as DataRowView;//鍏抽敭浠g爜锛屽氨鏄笉鐭ラ亾鏄繖鏍疯幏鍙栨暟鎹�岀籂缁撲簡寰堜箙(楝肩煡閬撳彲浠ヨ浆鎹负DataRowView鍟�)
+                    if (drv != null)
+                    {
+                        string KeyFieldName = (string)drv["defectName"];
+                        string dicCode = (string)drv["defectCode"];
+                        lstCheckedKeyID.Add(new
+                        {
+                            dicCode = dicCode,
+                            dicTxt = KeyFieldName
+                        });
+                    }
+                }
                 return;//閫掑綊缁堟
             }
             foreach (TreeListNode node in parentNode.Nodes)
             {
-                if (node.CheckState == CheckState.Checked)
+                if (node.CheckState == CheckState.Checked && parentNode.Nodes.Count == 0)
                 {
                     DataRowView drv = tlMenu.GetDataRecordByNode(node) as DataRowView;//鍏抽敭浠g爜锛屽氨鏄笉鐭ラ亾鏄繖鏍疯幏鍙栨暟鎹�岀籂缁撲簡寰堜箙(楝肩煡閬撳彲浠ヨ浆鎹负DataRowView鍟�)
                     if (drv != null)
                     {
                         string KeyFieldName = (string)drv["defectName"];
-                        lstCheckedKeyID.Add(KeyFieldName);
+                        string dicCode = (string)drv["defectCode"];
+                        lstCheckedKeyID.Add(new
+                        {
+                            dicCode = dicCode,
+                            dicTxt = KeyFieldName
+                        });
                     }
                 }
                 GetCheckedKeyID(node);
@@ -143,7 +161,6 @@
         private void findOrigin(DevExpress.XtraTreeList.TreeList tree)
         {
             this.lstCheckedKeyID.Clear();
-
             if (tree.Nodes.Count > 0)
             {
                 foreach (TreeListNode root in tree.Nodes)
@@ -152,7 +169,6 @@
                 }
             }
         }
-
         #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3