From 34e30e2261a057fc9f46f67a3d216e3d9a9e67be Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期二, 03 六月 2025 17:17:21 +0800 Subject: [PATCH] 上线梳理 --- DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs | 126 +++++++++++------------------------------- 1 files changed, 33 insertions(+), 93 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs b/DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs index 70c2c2a..fc7e1ff 100644 --- a/DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs +++ b/DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs @@ -1,26 +1,25 @@ -锘縰sing System; +锘縰sing DevExpress.XtraEditors; +using Gs.DevApp.Entity; +using Gs.DevApp.ToolBox; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Data; using System.Windows.Forms; -using DevExpress.XtraEditors; -using Gs.DevApp.Entity; -using Gs.DevApp.Properties; -using Gs.DevApp.ToolBox; -using Newtonsoft.Json; namespace Gs.DevApp.DevFrm.User { public partial class Organization : XtraForm { - List<FilterEntity> _filterList = new List<FilterEntity>(); + private List<FilterEntity> _filterList = new List<FilterEntity>(); public Organization() { - InitializeComponent(); - this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; + toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; - tlMenu.DoubleClick += TlMenu_DoubleClick; - getTree(); + this.toolBarMenu1.getXmlConfig(); + getPageList(1); + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1); } /// <summary> /// 鏌ヨ浜嬩欢 @@ -32,105 +31,46 @@ Gs.DevApp.ToolBox.MsgHelper.ShowInformation("璇ョ獥浣撲笉鏀寔鏌ヨ锛岃嫢鎯虫洿鏂伴〉闈紝璇风偣鍑� 鍒锋柊"); } /// <summary> - /// 鍒锋柊浜嬩欢 + /// 鍒锋柊浜嬩欢 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { - if (xtraTabControl1.SelectedTabPageIndex == 1) - getModel(lbGuid.Text.Trim(), false, 999); - else - getTree(); + _filterList.Clear(); + getPageList(1); } - private void TlMenu_DoubleClick(object sender, EventArgs e) + + /// <summary> + /// </summary> + /// <param name="curPage">绗嚑椤�</param> + /// <param name="pageSize">姣忛〉鍑犳潯</param> + private void getPageList(int curPage) { - var clickedNode = tlMenu.SelectedNode; - if (clickedNode == null) return; - if (clickedNode.FirstNode == null) - { - var rowGuid = clickedNode.Name; - getModel(rowGuid, false, 999); - } - } - private void getTree() - { - tlMenu.Nodes.Clear(); - var imageList = new ImageList(); - imageList.Images.Add("icon1", Resources.publicfix_32x32); - imageList.Images.Add("icon2", Resources.user_16x16); - tlMenu.ImageList = imageList; - var pgq = new PageQueryModel(1, 999999, "FID"); + gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(curPage, 999999, "fNumber", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", - "Organization/GetListPage", json); + var strReturn = + UtilityHelper.HttpPost("", "Organization/GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); - var dt = dd.rtnData.list; - var drGrp = dt.Select("FID=1"); - var dtComList = new DataTable(); - dtComList.Columns.Add("guid", typeof(string)); - dtComList.Columns.Add("name", typeof(string)); - foreach (var _dy in drGrp) + if (dd.rtnCode > 0) { - dtComList.Rows.Add(_dy["guid"].ToString(), - _dy["name"].ToString()); - var node = new TreeNode(); //瀹氫箟缁撶偣 - node.Text = - "(" + _dy["FNumber"] + ")" + _dy["name"]; //涓虹粨鐐硅祴鍊� - node.Name = _dy["guid"].ToString(); - node.ImageIndex = 0; - var drItem = dt.Select("FParentlD='" + _dy["FID"] + "'"); - foreach (var _dy2 in drItem) + DataTable dt = dd.rtnData.list; + gcMain1.BindingContext = new BindingContext(); + if (dt.Rows.Count > 0) { - var node22 = new TreeNode(); //瀹氫箟缁撶偣 - node22.Text = - "(" + _dy2["FNumber"] + ")" + _dy2["name"]; //涓虹粨鐐硅祴鍊� - node22.Name = _dy2["guid"].ToString(); - node22.ImageIndex = 1; - node.Nodes.Add(node22); + gcMain1.DataSource = dt; + gcMain1.ForceInitialize(); + gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } - node.ExpandAll(); - tlMenu.Nodes.Add(node); - } - txt_upGuid.DataSource = dtComList; - txt_upGuid.DisplayMember = "name"; - txt_upGuid.ValueMember = "guid"; - getModel(dtComList.Rows[0]["guid"].ToString(),false,0); - } - catch (Exception ex) - { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - } - private void getModel(string strGuid, bool isEdit, int tabIdx) - { - if (string.IsNullOrEmpty(strGuid)) - { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); - return; - } - - UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); - var _obj = new - { - guid = strGuid //涓诲缓 - }; - try - { - var strJson = UtilityHelper.HttpPost("", - "Organization/GetModel", JsonConvert.SerializeObject(_obj)); - var _rtn = UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) - { - var dy = _rtn.rtnData; - lbGuid.Text = strGuid; - UtilityHelper.SetValueByObj(panel1.Controls, dy, isEdit); + else + UtilityHelper.SetDefaultTable(gcMain1, gridView1); } else { - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg); } } catch (Exception ex) -- Gitblit v1.9.3