From be65218617cab71a90a9a05cf488fbb6e206b5c5 Mon Sep 17 00:00:00 2001
From: duheng <2286773002@qq.com>
Date: 星期一, 31 三月 2025 15:47:00 +0800
Subject: [PATCH] 下拉选项增加逻辑分组

---
 WinFrmUI/PBS.WinFrmUI/02-facility/FacilityMgrPage.cs |   51 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/WinFrmUI/PBS.WinFrmUI/02-facility/FacilityMgrPage.cs b/WinFrmUI/PBS.WinFrmUI/02-facility/FacilityMgrPage.cs
index cbaf361..c7fdec9 100644
--- a/WinFrmUI/PBS.WinFrmUI/02-facility/FacilityMgrPage.cs
+++ b/WinFrmUI/PBS.WinFrmUI/02-facility/FacilityMgrPage.cs
@@ -1,5 +1,6 @@
 锘縰sing DevExpress.Utils.DragDrop;
 using DevExpress.XtraEditors;
+using HStation.WinFrmUI;
 using Yw;
 using Yw.WinFrmUI;
 
@@ -11,6 +12,9 @@
         {
             InitializeComponent();
             this.gridView1.SetNormalView(30);
+            this.gridView1.Columns["PlaceID"].GroupIndex = 0;
+            this.gridView1.GroupFormat = "{1}";
+            behaviorManager1.Detach<DragDropBehavior>(gridView1);
         }
 
         private List<FacilityViewModel> _allBindingList;
@@ -121,14 +125,14 @@
 
         private void barCkDrag_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-            SetDragEnable(this.barCkDrag.Checked);
-        }
-
-        //璁剧疆鎷栨嫿鍙敤鎬�
-        private void SetDragEnable(bool allowArag)
-        {
-            var be = this.behaviorManager1.GetBehavior<DevExpress.Utils.DragDrop.DragDropBehavior>(this.gridView1);
-            be.Properties.AllowDrag = allowArag;
+            if (barCkDrag.Checked)
+            {
+                behaviorManager1.Attach<DragDropBehavior>(this.gridView1);
+            }
+            else
+            {
+                behaviorManager1.Detach<DragDropBehavior>(gridView1);
+            }
         }
 
         private async void dragDropEvents1_DragDrop(object sender, DevExpress.Utils.DragDrop.DragDropEventArgs e)
@@ -233,13 +237,13 @@
                 TipFormHelper.ShowWarn("涓婄Щ澶辫触锛�");
                 return;
             }
-            var current = this.gridView1.GetRow(rowHandle) as PlaceViewModel;
+            var current = this.gridView1.GetRow(rowHandle) as FacilityViewModel;
             if (current == null)
             {
                 return;
             }
             var prevHandle = rowHandle - 1;
-            var prev = this.gridView1.GetRow(prevHandle) as PlaceViewModel;
+            var prev = this.gridView1.GetRow(prevHandle) as FacilityViewModel;
             if (prev == null)
             {
                 return;
@@ -281,13 +285,13 @@
                 TipFormHelper.ShowWarn("涓嬬Щ澶辫触锛�");
                 return;
             }
-            var current = this.gridView1.GetRow(rowHandle) as PlaceViewModel;
+            var current = this.gridView1.GetRow(rowHandle) as FacilityViewModel;
             if (current == null)
             {
                 return;
             }
             var nextHandle = rowHandle + 1;
-            var next = this.gridView1.GetRow(nextHandle) as PlaceViewModel;
+            var next = this.gridView1.GetRow(nextHandle) as FacilityViewModel;
             if (next == null)
             {
                 return;
@@ -309,5 +313,28 @@
             this.facilityViewModelBindingSource.ResetBindings(false);
             this.gridView1.FocusedRowHandle = nextHandle;
         }
+
+        private void barBtnUpdateUseStatus_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var vm = this.gridView1.GetCurrentViewModel(_allBindingList);
+            if (vm == null)
+            {
+                return;
+            }
+            var dlg = new SetUseStatusDlg();
+            dlg.SetBindingData((Yw.Model.eUseStatus)vm.UseStatus);
+            dlg.ReloadDataEvent += async (status) =>
+            {
+                var bol = await new PBS.BLL.Facility().UpdateUseStatus(vm.ID, status);
+                if (bol)
+                {
+                    vm.UseStatus = (Yw.Vmo.eUseStatus)(int)status;
+                    this.gridView1.RefreshRow(this.gridView1.FocusedRowHandle);
+                    return true;
+                }
+                return false;
+            };
+            dlg.ShowDialog();
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3