From 59abbe4785268a10ec9390b8373cce3939c1d24b Mon Sep 17 00:00:00 2001
From: lg <999544862qq.com>
Date: 星期一, 02 九月 2024 15:42:22 +0800
Subject: [PATCH] 打印测试
---
DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs | 129 +++++++++++++++++++++++++++++++++++--------
1 files changed, 105 insertions(+), 24 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs b/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs
index 278b0ae..e9effcb 100644
--- a/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs
+++ b/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs
@@ -1,14 +1,7 @@
锘縰sing DevExpress.XtraEditors;
using Newtonsoft.Json;
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
using Gs.DevApp.ToolBox;
using Gs.DevApp.Models;
using DevExpress.XtraTreeList.Nodes;
@@ -16,12 +9,32 @@
{
public partial class SysMenuAdd : DevExpress.XtraEditors.XtraForm
{
- public SysMenuAdd()
+ public event EventHandler<UpdateParentEventArgs> UpdateParent;
+
+ public SysMenuAdd(string guid)
{
InitializeComponent();
btnSave.Click += BtnSave_Click;
btnEsc.Click += BtnEsc_Click;
+ txtMenuType.TextChanged += TxtMenuType_TextChanged;
getTree();
+ lbGuid.Text = guid;
+ getModel();
+ }
+ private void TxtMenuType_TextChanged(object sender, EventArgs e)
+ {
+ if (txtMenuType.SelectedIndex == 1)
+ {
+ this.txtFormNamespace.Enabled = true;
+ this.txtMenuIco.Enabled = true;
+ }
+ else
+ {
+ this.txtFormNamespace.Enabled = false;
+ this.txtMenuIco.Enabled = false;
+ this.txtFormNamespace.Text = "";
+ this.txtMenuIco.Text = "";
+ }
}
private void BtnEsc_Click(object sender, EventArgs e)
@@ -31,6 +44,24 @@
private void BtnSave_Click(object sender, EventArgs e)
{
+ if (string.IsNullOrEmpty(txtMenuType.Text.Trim()) || txtMenuType.SelectedIndex == 0)
+ {
+ Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟绫诲瀷涓嶈兘涓虹┖锛�");
+ txtMenuType.Focus();
+ return;
+ }
+ if (string.IsNullOrEmpty(txtMenuName.Text.Trim()))
+ {
+ Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟鍚嶇О涓嶈兘涓虹┖锛�");
+ txtMenuName.Focus();
+ return;
+ }
+ if (string.IsNullOrEmpty(txtStatus.Text.Trim()) || txtStatus.SelectedIndex == 0)
+ {
+ Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟鐘舵�佷笉鑳戒负绌猴紒");
+ txtStatus.Focus();
+ return;
+ }
string _upGuid = "";
TreeListNode focusedNode = txtParentMenuName.Properties.TreeList.FocusedNode;
if (focusedNode != null)
@@ -39,50 +70,100 @@
}
var _obj = new
{
- guid = "",//涓诲缓
+ guid = lbGuid.Text.Trim(),//涓诲缓
upGuid = _upGuid,//涓婄骇鐨勪富寤�
name = txtMenuName.Text.Trim(),//鍚嶇О
- serialNumber = "",//缂栧彿
icon = txtMenuIco.Text,//鑿滃崟鍥炬爣
status = txtStatus.SelectedIndex,//鐘舵��
- fromPath = txtFormNamespace.Text.Trim(),//绐椾綋璺緞
+ formPath = txtFormNamespace.Text.Trim(),//绐椾綋璺緞
idx = int.Parse(txtIdx.Value.ToString()),//鎺掑簭
category = txtMenuType.SelectedIndex,//绫诲瀷
};
- string json = JsonConvert.SerializeObject(_obj);
+ string strJson = "";
try
{
- Utility.HttpPost("", "MenuAction/EditModel", json);
+ strJson = UtilityHelper.HttpPost("", "MenuAction/EditModel", JsonConvert.SerializeObject(_obj));
+ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
+ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+ if (_rtn.rtnCode > 0)
+ {
+ UpdateParent?.Invoke(this, new UpdateParentEventArgs { Data = "" });
+ }
}
catch (Exception ex)
{
- throw ex;
+ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
}
}
private void getTree()
{
- Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "idx", "desc", "", "");
+ Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "idx", "asc", "", " and category=1");
string json = JsonConvert.SerializeObject(pgq);
string strReturn = "";
try
{
-
- strReturn =Utility.HttpPost("", "MenuAction/GetListPage", json);
- ReturnModel<PageListModel> dd = Utility.GetTableByJson(strReturn);
+ strReturn = UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
+ ReturnModel<PageListModel> dd = UtilityHelper.GetTableByJson(strReturn);
DataTable dt = dd.rtnData.list;
- txtParentMenuName.Properties.DataSource = dt;
- txtParentMenuName.Properties.DisplayMember = "name";
- txtParentMenuName.Properties.DataSource = dt;
- txtParentMenuName.Properties.DisplayMember = "name";
txtParentMenuName.Properties.TreeList.KeyFieldName = "guid";
txtParentMenuName.Properties.TreeList.ParentFieldName = "upGuid";
+ //txtParentMenuName.Properties.ValueMember = "guid";
+ txtParentMenuName.Properties.DisplayMember = "name";
+ txtParentMenuName.Properties.DataSource = dt;
}
catch (Exception ex)
{
- throw ex;
+ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
}
-
}
+
+ private void getModel()
+ {
+ if (lbGuid.Text.Length <= 0) return;
+ var _obj = new
+ {
+ guid = lbGuid.Text.Trim(),//涓诲缓
+ };
+ string strJson = "";
+ try
+ {
+ strJson = UtilityHelper.HttpPost("", "MenuAction/GetModel", JsonConvert.SerializeObject(_obj));
+ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
+ if (_rtn.rtnCode > 0)
+ {
+ txtMenuName.Text = _rtn.rtnData.name;
+ txtMenuIco.Text = _rtn.rtnData.icon;
+ txtFormNamespace.Text = _rtn.rtnData.formPath;
+ txtStatus.SelectedIndex = _rtn.rtnData.status;
+ txtMenuType.SelectedIndex = _rtn.rtnData.category;
+ txtIdx.Value = _rtn.rtnData.idx;
+ // txtParentMenuName.Text = "";
+ }
+ else
+ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+ }
+ catch (Exception ex)
+ {
+ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+ }
+ }
+
+ private void cleanTxt()
+ {
+ //guid = lbGuid.Text.Trim(),//涓诲缓
+ // upGuid = _upGuid,//涓婄骇鐨勪富寤�
+ // name = txtMenuName.Text.Trim(),//鍚嶇О
+ // icon = txtMenuIco.Text,//鑿滃崟鍥炬爣
+ // status = txtStatus.SelectedIndex,//鐘舵��
+ // formPath = txtFormNamespace.Text.Trim(),//绐椾綋璺緞
+ // idx = int.Parse(txtIdx.Value.ToString()),//鎺掑簭
+ // category = txtMenuType.SelectedIndex,//绫诲瀷
+
+ //if(lbGuid.Text)
+ }
+
+
+
}
}
\ No newline at end of file
--
Gitblit v1.9.3