From dd0af4a5532c251fd655024ba475f72eaf9c93a0 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期一, 18 八月 2025 16:20:10 +0800
Subject: [PATCH] 汇总
---
DevApp/Gs.DevApp/DevFrm/User/User.cs | 199 ++++++++++++++++++++++++++++++++-----------------
1 files changed, 128 insertions(+), 71 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/User/User.cs b/DevApp/Gs.DevApp/DevFrm/User/User.cs
index 7242d95..44372c0 100644
--- a/DevApp/Gs.DevApp/DevFrm/User/User.cs
+++ b/DevApp/Gs.DevApp/DevFrm/User/User.cs
@@ -1,16 +1,14 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Data;
-using System.Drawing;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using DevExpress.XtraEditors;
+锘縰sing DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Threading.Tasks;
+using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.User
{
@@ -27,28 +25,26 @@
toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
- gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
- Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1);
+ this.toolBarMenu1.getXmlConfig();
+ Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, "", "", (value) =>
+ {
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
+ }, tips);
+ Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
+ {
+ getModel(value);
+ }, (value) =>
+ {
+ getPageList(this.pageBar1.CurrentPage);
+ }, lbGuid);
getPageList(1);
pageBar1.PagerEvent += PageBar1_PagerEvent;
}
- private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
+ private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
{
- _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
- Task.Delay(100);
+ _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
+ Task.Delay(100);
getPageList(1);
- }
- /// <summary>
- /// 鍙屽嚮浜嬩欢
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- var rowGuid =
- UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
- if (!string.IsNullOrEmpty(rowGuid))
- getModel(rowGuid, false, 999);
}
/// <summary>
@@ -71,7 +67,7 @@
gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
gridView1.ActiveFilter.Clear();
gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
- var frm = new ShowFilter(gridView1.Columns, _filterList);
+ var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName);
frm.UpdateParent += Frm_UpdateParent;
frm.ShowDialog();
}
@@ -94,7 +90,7 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
{
- UtilityHelper.JumpToTab(xtraTabControl1, 0);
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
}
/// <summary>
@@ -109,7 +105,7 @@
lbGuid, txt_userName, gridView1, "userName");
if (string.IsNullOrEmpty(rowGuid))
{
- MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
return;
}
@@ -125,15 +121,20 @@
var _rtn = UtilityHelper.ReturnToDynamic(strJson);
if (_rtn.rtnCode > 0)
{
- UtilityHelper.JumpToTab(xtraTabControl1, 0);
- getPageList(1);
+ MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
+ if (xtraTabControl1.SelectedTabPageIndex == 0)
+ { }
+ else
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
+ getPageList(this.pageBar1.CurrentPage);
}
+ else
- MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+ MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
}
catch (Exception ex)
{
- MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
}
}
@@ -145,7 +146,7 @@
private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
{
if (xtraTabControl1.SelectedTabPageIndex == 1)
- getModel(lbGuid.Text.Trim(), false, 999);
+ getModel(lbGuid.Text.Trim());
else
{
_filterList.Clear();
@@ -166,15 +167,22 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
{
- string rowGuid, rowName;
- (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
- lbGuid, txt_userName, gridView1);
+ string rowGuid = "", rowName = "";
+ (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_userName, gridView1);
if (string.IsNullOrEmpty(rowGuid))
{
- MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
return;
}
- getModel(rowGuid, true, 1);
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
+ if (xtraTabControl1.SelectedTabPageIndex == 1)
+ {
+ getModel(rowGuid);
+ }
+ else
+ {
+ UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true);
+ }
}
/// <summary>
@@ -184,10 +192,10 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
{
- UtilityHelper.JumpToTab(xtraTabControl1, 1);
lbGuid.Text = "";
- UtilityHelper.CleanValueByControl(panel1.Controls, true);
- txt_password.Visible = lbPwd.Visible = true;
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
+ UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true);
+ txt_password.Enabled = true;
txt_account.Enabled = txt_password.Enabled = true;
}
@@ -201,28 +209,28 @@
toolBarMenu1.isSetBtn = false;
if (string.IsNullOrEmpty(txt_account.Text.Trim()))
{
- MsgHelper.Warning("鐧诲綍璐﹀彿涓嶈兘涓虹┖锛�");
+ MsgHelper.ShowError("鐧诲綍璐﹀彿涓嶈兘涓虹┖锛�");
txt_account.Focus();
return;
}
if (string.IsNullOrEmpty(txt_password.Text.Trim()))
{
- MsgHelper.Warning("瀵嗙爜涓嶈兘涓虹┖锛�");
+ MsgHelper.ShowError("瀵嗙爜涓嶈兘涓虹┖锛�");
txt_password.Focus();
return;
}
if (string.IsNullOrEmpty(txt_userName.Text.Trim()))
{
- MsgHelper.Warning("濮撳悕涓嶈兘涓虹┖锛�");
+ MsgHelper.ShowError("濮撳悕涓嶈兘涓虹┖锛�");
txt_userName.Focus();
return;
}
var _obj = new
{
- guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
+ Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
account = txt_account.Text.Trim(),
password = txt_password.Text.Trim(),
userName = txt_userName.Text.Trim(),
@@ -231,24 +239,29 @@
email = txt_email.Text.Trim(),
isStatus = txt_isStatus.Checked,
remark = txt_remark.Text.Trim(),
- isSys = 0
+ isSys = 0,
+ staffId = txt_staffId.GetId()
};
try
{
var strJson = UtilityHelper.HttpPost("", "User/EditModel",
JsonConvert.SerializeObject(_obj));
var _rtn = UtilityHelper.ReturnToDynamic(strJson);
- MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
if (_rtn.rtnCode > 0)
{
+ MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
lbGuid.Text = _rtn.rtnData;
toolBarMenu1.isSetBtn = true;
- UtilityHelper.ChangeEnableByControl(panel1.Controls, false);
+ UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
+ toolBarMenu1.currentAction = "";
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
}
+ else
+ MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
}
catch (Exception ex)
{
- MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
}
}
@@ -256,11 +269,11 @@
/// </summary>
/// <param name="curPage">绗嚑椤�</param>
/// <param name="pageSize">姣忛〉鍑犳潯</param>
- private void getPageList(int curPage)
+ private void getPageList(int curPage)
{
- var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
- var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "CREATE_TIME",
- "asc", "", _sbSqlWhere.ToString());
+ gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
+ var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.ACCOUNT asc ,a.CREATE_TIME",
+ "desc", "", _sbSqlWhere.ToString());
var json = JsonConvert.SerializeObject(pgq);
try
{
@@ -270,15 +283,16 @@
if (dd.rtnCode > 0)
{
DataTable dt = dd.rtnData.list;
- gcMain.BindingContext = new BindingContext();
+ gcMain1.BindingContext = new BindingContext();
gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
if (dt.Rows.Count > 0)
{
- gcMain.DataSource = dt;
- gcMain.ForceInitialize();
+ gcMain1.DataSource = dt;
+ gcMain1.ForceInitialize();
+ gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
}
else
- UtilityHelper.SetDefaultTable(gcMain, gridView1);
+ UtilityHelper.SetDefaultTable(gcMain1, gridView1);
gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉
pageBar1.CurrentPage = curPage;//褰撳墠椤�
@@ -291,19 +305,23 @@
}
catch (Exception ex)
{
- MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
}
-
}
-
- private void getModel(string strGuid, bool isEdit, int tabIdx)
+ /// <summary>
+ /// 璇诲彇瀹炰綋
+ /// </summary>
+ /// <param name="strGuid"></param>
+ 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("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
return;
}
- UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
var _obj = new
{
guid = strGuid //涓诲缓
@@ -317,22 +335,24 @@
{
var dy = _rtn.rtnData;
lbGuid.Text = strGuid;
- UtilityHelper.SetValueByObj(panel1.Controls, dy, isEdit);
- txt_account.Enabled = txt_password.Enabled =
- txt_password.Visible =
- lbPwd.Visible = tipPwd.Visible = false;
+ UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit);
+ txt_account.Enabled = txt_password.Enabled = txt_password.Enabled = false;
}
else
{
- MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+ MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
}
}
catch (Exception ex)
{
- MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
}
}
-
+ /// <summary>
+ /// 瑙掕壊
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
private void repositoryItemButtonEdit1_ButtonClick(object sender,
ButtonPressedEventArgs e)
{
@@ -345,7 +365,11 @@
frm.ShowDialog();
}
}
-
+ /// <summary>
+ /// 瀵嗙爜
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
private void repositoryItemButtonEdit2_ButtonClick(object sender,
ButtonPressedEventArgs e)
{
@@ -358,5 +382,38 @@
frm.ShowDialog();
}
}
+ /// <summary>
+ /// 寮瑰嚭閰嶇疆鏉冮檺涓汉鏉冮檺
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void repositoryItemButtonEdit3_ButtonClick(object sender, ButtonPressedEventArgs e)
+ {
+ if (e.Button.Index == 0)
+ {
+ var rowhandle = gridView1.FocusedRowHandle;
+ var dr = gridView1.GetDataRow(rowhandle);
+ var userGuid = dr["guid"].ToString();
+ var frm = new RoleSelectAction(userGuid, "璁剧疆涓汉鏉冮檺");
+ frm.ShowDialog();
+ }
+ }
+
+ /// <summary>
+ /// 鏉冮檺闆嗗悎
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void repositoryItemButtonEdit4_ButtonClick(object sender, ButtonPressedEventArgs e)
+ {
+ if (e.Button.Index == 0)
+ {
+ var rowhandle = gridView1.FocusedRowHandle;
+ var dr = gridView1.GetDataRow(rowhandle);
+ var userGuid = dr["guid"].ToString();
+ var frm = new ViewRole(userGuid);
+ frm.ShowDialog();
+ }
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.3