From 4bc7030c4cea5b3deed0c938ec388ae94e33c51c Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 25 十月 2024 09:42:36 +0800 Subject: [PATCH] 修改会页 --- DevApp/Gs.DevApp/DevFrm/User/Role.cs | 80 ++++++++++++++++++++-------------------- 1 files changed, 40 insertions(+), 40 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/User/Role.cs b/DevApp/Gs.DevApp/DevFrm/User/Role.cs index 1d8b7f9..b663200 100644 --- a/DevApp/Gs.DevApp/DevFrm/User/Role.cs +++ b/DevApp/Gs.DevApp/DevFrm/User/Role.cs @@ -1,18 +1,19 @@ 锘縰sing DevExpress.XtraGrid.Views.Base; -using DevExpress.XtraGrid.Views.Grid; -using DevExpress.XtraGrid.Views.Grid.ViewInfo; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; +using System.Collections.Generic; using System.Data; +using System.Drawing; using System.Windows.Forms; namespace Gs.DevApp.DevFrm.User { public partial class Role : DevExpress.XtraEditors.XtraForm { - System.Text.StringBuilder actionLst = new System.Text.StringBuilder(); + System.Text.StringBuilder _actionLst = new System.Text.StringBuilder(); + List<FilterEntity> _filterList = new List<FilterEntity>(); public Role() { InitializeComponent(); @@ -26,8 +27,8 @@ this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; gridView1.FocusedRowChanged += GridView1_FocusedRowChanged; - pageBar1.PagerEvent += PageBar1_PagerEvent; getPageList(1, UtilityHelper.GetPageSize()); + pageBar1.PagerEvent += PageBar1_PagerEvent; trv.AfterCheck += Trv_AfterCheck; gridView1.IndicatorWidth = 50; gridView1.CustomDrawRowIndicator += (s, e) => @@ -36,6 +37,13 @@ { e.Info.DisplayText = (e.RowHandle + 1).ToString(); } + }; + gridView1.CustomDrawEmptyForeground += (s, e) => + { + string str = "鏆傛湭鏌ユ壘鍒板尮閰嶇殑鏁版嵁!"; + Font f = new Font("寰蒋闆呴粦", 16); + Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); + e.Graphics.DrawString(str, f, Brushes.Gray, r); }; } /// <summary> @@ -47,6 +55,7 @@ { string rowGuid = ""; DataRow myDataRow = gridView1.GetDataRow(e.FocusedRowHandle); + if (myDataRow == null) return; rowGuid = myDataRow["guid"].ToString(); getTree(rowGuid); groupBox1.Text = "璇峰嬀閫夈��" + myDataRow["roleName"].ToString() + "銆戠殑鏉冮檺"; @@ -58,20 +67,10 @@ /// <param name="e"></param> private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e) { - GridHitInfo info = gridView1.CalcHitInfo(e.Location); - if (info.InRow) - { - GridView view = info.View as GridView; - if (view != null) - { - DataRow row = view.GetDataRow(info.RowHandle); - if (row != null) - { - string rowGuid = (row["guid"].ToString()); - getModel(rowGuid, false, 999); - } - } - } + string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid"); + if (!string.IsNullOrEmpty(rowGuid)) + getModel(rowGuid, false, 999); + } /// <summary> /// 鍒嗛〉浜嬩欢 @@ -89,7 +88,7 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { - Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns); + Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } @@ -100,8 +99,8 @@ /// <param name="e"></param> private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { - string strWhere = e.Data; - MessageBox.Show(strWhere); + _filterList = e.FilterList; + getPageList(1, pageBar1.RowsCount); } /// <summary> @@ -121,7 +120,7 @@ private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e) { string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_roleName, gridView1); + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_roleName, gridView1, 2); if (string.IsNullOrEmpty(rowGuid)) { ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); @@ -129,10 +128,9 @@ } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵\n璇ユ搷浣滃皢浼氭竻绌虹浉搴旂殑鐢ㄦ埛鏉冮檺")) return; - var _obj = new - { - guid = rowGuid,//涓诲缓 - }; + List<string> lst = new List<string>(); + lst.Add(rowGuid); + var _obj = lst; try { string strJson = UtilityHelper.HttpPost("", "Role/DeleteModel", JsonConvert.SerializeObject(_obj)); @@ -200,24 +198,18 @@ txt_roleName.Focus(); return; } - if (string.IsNullOrEmpty(txt_rolRemark.Text.Trim())) + if (string.IsNullOrEmpty(txt_roleRemark.Text.Trim())) { Gs.DevApp.ToolBox.MsgHelper.Warning("瑙掕壊澶囨敞涓嶈兘涓虹┖锛�"); - txt_rolRemark.Focus(); - return; - } - if (txt_isStatus.SelectedIndex <= 0) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("瑙掕壊鐘舵�佷笉鑳戒负绌猴紒"); - txt_isStatus.Focus(); + txt_roleRemark.Focus(); return; } var _obj = new { guid = lbGuid.Text.Trim(), roleName = txt_roleName.Text.Trim(), - rolRemark = txt_rolRemark.Text.Trim(), - isStatus = txt_isStatus.SelectedIndex,//鐘舵�� + roleRemark = txt_roleRemark.Text.Trim(), + isStatus = txt_isStatus.Checked,//鐘舵�� }; try { @@ -229,6 +221,7 @@ lbGuid.Text = _rtn.rtnData; toolBarMenu1.isSetBtn = true; UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false); + } } catch (Exception ex) @@ -253,12 +246,12 @@ } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾璁剧疆鏉冮檺鍚楋紵")) return; - actionLst = new System.Text.StringBuilder(); + _actionLst = new System.Text.StringBuilder(); TraverseTreeViewNodes(trv.Nodes); var _obj = new { roleGuid = rowGuid, - actionLst = actionLst.ToString(), + actionLst = _actionLst.ToString(), }; try { @@ -279,7 +272,12 @@ /// <param name="pageSize">姣忛〉鍑犳潯</param> private void getPageList(int curPage, int pageSize) { - PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "edtTime", "desc", "", ""); + System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); + foreach (FilterEntity itm in _filterList) + { + _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); + } + PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "CREATE_TIME", "desc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { @@ -403,7 +401,9 @@ { try { + trv.AfterCheck -= Trv_AfterCheck; UtilityHelper.TreeViewCheck(e); + trv.AfterCheck += Trv_AfterCheck; } catch (Exception ex) { @@ -416,7 +416,7 @@ foreach (TreeNode node in nodes) { if (node.Checked) - actionLst.Append(node.Name + "~"); + _actionLst.Append(node.Name + "~"); // 閫掑綊閬嶅巻瀛愯妭鐐� if (node.Nodes.Count > 0) { -- Gitblit v1.9.3