From 01738c21cdb08fee76aa53ff870a38a00b4f5df4 Mon Sep 17 00:00:00 2001
From: lg <999544862qq.com>
Date: 星期五, 13 九月 2024 12:01:18 +0800
Subject: [PATCH] 基础资料
---
DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs | 110 ++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 72 insertions(+), 38 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs b/DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs
index 4a37e8d..c6c5a7a 100644
--- a/DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs
+++ b/DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs
@@ -1,5 +1,6 @@
-锘縰sing DevExpress.XtraTreeList.Nodes;
-using Gs.DevApp.Models;
+锘縰sing DevExpress.XtraTreeList;
+using DevExpress.XtraTreeList.Nodes;
+using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
@@ -18,16 +19,51 @@
this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
- tlMenu.DoubleClick += TlMenu_DoubleClick;
- GetTree();
- GetDownList();
+ // txt_category.TextChanged += Txt_category_TextChanged;
+ tlMenu.MouseDoubleClick += TlMenu_MouseDoubleClick;
+ getTree();
+ getDownList();
+ getActionList();
}
- private void TlMenu_DoubleClick(object sender, EventArgs e)
+
+ /// <summary>
+ /// 鑿滃崟绫诲瀷鏀瑰彉浜嬩欢
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void Txt_category_TextChanged(object sender, EventArgs e)
{
- TreeListNode clickedNode = this.tlMenu.FocusedNode;
- if (clickedNode.FirstNode == null) {
- string rowGuid = clickedNode.GetValue("guid").ToString();
- GetModel(rowGuid, false, 999);
+ if (txt_category.SelectedIndex == 1)
+ {
+ this.txt_formPath.Enabled = true;
+ this.txt_icon.Enabled = true;
+ }
+ else
+ {
+ this.txt_formPath.Enabled = false;
+ this.txt_icon.Enabled = false;
+ this.txt_formPath.Text = "";
+ this.txt_icon.Text = "";
+ MsgHelper.ShowError(txt_formPath.Enabled.ToString());
+ MsgHelper.ShowError(txt_icon.Enabled.ToString());
+ }
+ }
+ /// <summary>
+ /// 鍙屽嚮琛屼簨浠�
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void TlMenu_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
+ {
+ TreeListHitInfo info = tlMenu.CalcHitInfo(e.Location);
+ if (info.Node != null)
+ {
+ TreeListNode clickedNode = this.tlMenu.FocusedNode;
+ if (clickedNode.FirstNode == null)
+ {
+ string rowGuid = clickedNode.GetValue("guid").ToString();
+ getModel(rowGuid, false, 999);
+ }
}
}
/// <summary>
@@ -61,12 +97,11 @@
{
guid = rowGuid,//涓诲缓
};
- string strJson = "";
try
{
- strJson = UtilityHelper.HttpPost("", "MenuAction/DeleteModel", JsonConvert.SerializeObject(_obj));
+ string strJson = UtilityHelper.HttpPost("", "MenuAction/DeleteModel", JsonConvert.SerializeObject(_obj));
ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
- if (_rtn.rtnCode > 0) { GetTree(); }
+ if (_rtn.rtnCode > 0) { getTree(); }
ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
}
catch (Exception ex)
@@ -83,10 +118,8 @@
private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
{
UtilityHelper.ChangeTab(xtraTabControl1, 0);
- GetTree();
+ getTree();
}
-
-
/// <summary>
/// 淇敼浜嬩欢
/// </summary>
@@ -100,8 +133,7 @@
ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
return;
}
- GetModel(rowGuid, true, 1);
-
+ getModel(rowGuid, true, 1);
}
/// <summary>
/// 鏂板浜嬩欢
@@ -134,28 +166,33 @@
txt_name.Focus();
return;
}
- if (string.IsNullOrEmpty(txt_status.Text.Trim()) || txt_status.SelectedIndex == 0)
+ if (string.IsNullOrEmpty(txt_isStatus.Text.Trim()) || txt_isStatus.SelectedIndex == 0)
{
Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟鐘舵�佷笉鑳戒负绌猴紒");
- txt_status.Focus();
+ txt_isStatus.Focus();
return;
}
string _upGuid = txt_upGuid.EditValue.ToString();
+ if (txt_category.SelectedIndex == 2 && string.IsNullOrEmpty(_upGuid))
+ {
+ Gs.DevApp.ToolBox.MsgHelper.Warning("鎸夐挳绫诲瀷蹇呴』閫夋嫨鐖剁骇鑿滃崟锛�");
+ txt_isStatus.Focus();
+ return;
+ }
var _obj = new
{
guid = lbGuid.Text.Trim(),//涓诲缓
upGuid = _upGuid,//涓婄骇鐨勪富寤�
name = txt_name.Text.Trim(),//鍚嶇О
icon = txt_icon.Text,//鑿滃崟鍥炬爣
- status = txt_status.SelectedIndex,//鐘舵��
+ isStatus = txt_isStatus.SelectedIndex,//鐘舵��
formPath = txt_formPath.Text.Trim(),//绐椾綋璺緞
idx = int.Parse(txt_idx.Value.ToString()),//鎺掑簭
category = txt_category.SelectedIndex,//绫诲瀷
};
- string strJson = "";
try
{
- strJson = UtilityHelper.HttpPost("", "MenuAction/EditModel", JsonConvert.SerializeObject(_obj));
+ string strJson = UtilityHelper.HttpPost("", "MenuAction/EditModel", JsonConvert.SerializeObject(_obj));
ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
if (_rtn.rtnCode > 0)
@@ -171,14 +208,13 @@
}
}
- private void GetTree()
+ private void getTree()
{
- Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "idx", "asc", "", "");
+ PageQueryModel pgq = new PageQueryModel(1, 999999, "idx", "asc", "", "");
string json = JsonConvert.SerializeObject(pgq);
- string strReturn = "";
try
{
- strReturn = UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
+ string strReturn = UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
ReturnModel<PageListModel> dd = UtilityHelper.GetTableByJson(strReturn);
DataTable dt = dd.rtnData.list;
this.tlMenu.DataSource = dt;
@@ -188,10 +224,6 @@
this.tlMenu.EndUpdate();
this.tlMenu.ExpandAll();
tlMenu.OptionsView.CheckBoxStyle = DevExpress.XtraTreeList.DefaultNodeCheckBoxStyle.Default;
- // 璁剧疆涓嶅叧鑱旈�夋嫨
- //tlMenu.OptionsSelection.MultiSelect = true;
- //tlMenu.OptionsSelection.MaintainState = false; // 鍏抽敭璁剧疆
- //this.tlMenu.OptionsBehavior.AllowIndeterminateCheckState = true;
}
catch (Exception ex)
{
@@ -199,7 +231,7 @@
}
}
- private void GetModel(string strGuid, bool isEdit, int tabIdx)
+ private void getModel(string strGuid, bool isEdit, int tabIdx)
{
if (string.IsNullOrEmpty(strGuid))
{
@@ -211,10 +243,9 @@
{
guid = strGuid,//涓诲缓
};
- string strJson = "";
try
{
- strJson = UtilityHelper.HttpPost("", "MenuAction/GetModel", JsonConvert.SerializeObject(_obj));
+ string strJson = UtilityHelper.HttpPost("", "MenuAction/GetModel", JsonConvert.SerializeObject(_obj));
ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
if (_rtn.rtnCode > 0)
{
@@ -232,14 +263,13 @@
}
}
- private void GetDownList()
+ private void getDownList()
{
- Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "idx", "asc", "", " and category=1");
+ PageQueryModel pgq = new PageQueryModel(1, 999999, "idx", "asc", "", " and category=1");
string json = JsonConvert.SerializeObject(pgq);
- string strReturn = "";
try
{
- strReturn = UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
+ string strReturn = UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
ReturnModel<PageListModel> dd = UtilityHelper.GetTableByJson(strReturn);
DataTable dt = dd.rtnData.list;
txt_upGuid.Properties.TreeList.KeyFieldName = "guid";
@@ -253,5 +283,9 @@
ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
}
}
+ private void getActionList()
+ {
+ txt_name.Properties.Items.AddRange(toolBarMenu1.actions);
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.3