From 8366fcbfed5c66fa1fab4f6dba964a3451c24091 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期五, 12 九月 2025 16:26:05 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs | 103 ++++++++------------------------------------------- 1 files changed, 16 insertions(+), 87 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs index 5922664..f59d888 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs @@ -1,17 +1,15 @@ -锘縰sing DevExpress.DataAccess.Native.Json; +锘縰sing System; +using System.Collections.Generic; +using System.Data; +using System.Threading.Tasks; +using System.Windows.Forms; using DevExpress.XtraEditors; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Gs.DevApp.UserControl; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Data; -using System.Threading.Tasks; -using System.Windows.Forms; -namespace Gs.DevApp.DevFrm +namespace Gs.DevApp.DevFrm.BasicData { public partial class Frm_Staff : XtraForm { @@ -149,42 +147,6 @@ } } - //private void getModel(string strGuid) - //{ - // bool isEdit = false; - // if (toolBarMenu1.currentAction == "add") return; - // if (toolBarMenu1.currentAction == "edit") isEdit = true; - // if (string.IsNullOrEmpty(strGuid)) - // { - // MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); - // return; - // } - // var _obj = new - // { - // guid = strGuid //涓诲缓 - // }; - // try - // { - // var strJson = UtilityHelper.HttpPost("", - // _webServiceName + "GetModel", - // JsonConvert.SerializeObject(_obj)); - // var _rtn = UtilityHelper.ReturnToDynamic(strJson); - // if (_rtn.rtnCode > 0) - // { - // var dy = _rtn.rtnData; - // lbGuid.Text = strGuid; - // UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit); - // } - // else - // { - // MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - // } - // } - // catch (Exception ex) - // { - // MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - // } - //} private void getModel(string strGuid) { bool isEdit = false; @@ -192,67 +154,34 @@ if (toolBarMenu1.currentAction == "edit") isEdit = true; if (string.IsNullOrEmpty(strGuid)) { - ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - - // 鏋勯�犺姹傚弬鏁板璞� var _obj = new { - guid = strGuid, // 涓婚敭 + guid = strGuid //涓诲缓 }; - try { - // 鍙戦�丠TTP璇锋眰鑾峰彇鏁版嵁 - string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); - ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); - + var strJson = UtilityHelper.HttpPost("", + _webServiceName + "GetModel", + JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { - dynamic dy = _rtn.rtnData; + var dy = _rtn.rtnData; lbGuid.Text = strGuid; - - // 缁戝畾涓昏〃鏁版嵁鍒扮晫闈㈡帶浠� - List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); - - gvList.Add(gvMx1); - UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); - - // ================== 绗竴涓槑缁嗚〃锛坙ist锛夊鐞嗛�昏緫 ================== - // 鏄惧紡鎸囧畾Newtonsoft.Json.Linq.JObject - Newtonsoft.Json.Linq.JObject _job = Newtonsoft.Json.Linq.JObject.Parse(strJson); - Newtonsoft.Json.Linq.JArray array = new Newtonsoft.Json.Linq.JArray(); - foreach (var a in _job["rtnData"]["list"]) - { - array.Add(a); - } - DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); - - if (dt.Rows.Count > 0) - { - gcMx1.BindingContext = new BindingContext(); - gcMx1.DataSource = dt; - gcMx1.ForceInitialize(); - gvMx1.BestFitColumns(); - Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); - } - else - { - Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); - } - + UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit); } else { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } - } } \ No newline at end of file -- Gitblit v1.9.3