From 82c87445b34d9a65a073cf5cd05843fea88672c3 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期四, 24 十月 2024 15:56:45 +0800
Subject: [PATCH] QC
---
DevApp/Gs.DevApp/DevFrm/User/User.cs | 164 +++++++++++++++++++++++++++++-------------------------
1 files changed, 87 insertions(+), 77 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/User/User.cs b/DevApp/Gs.DevApp/DevFrm/User/User.cs
index 75a4ae6..0f8eb02 100644
--- a/DevApp/Gs.DevApp/DevFrm/User/User.cs
+++ b/DevApp/Gs.DevApp/DevFrm/User/User.cs
@@ -1,11 +1,9 @@
-锘縰sing DevExpress.XtraEditors;
-using DevExpress.XtraGrid.Views.Base;
-using DevExpress.XtraGrid.Views.Grid;
-using DevExpress.XtraGrid.Views.Grid.ViewInfo;
+锘�
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
+using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
@@ -14,6 +12,7 @@
{
public partial class User : DevExpress.XtraEditors.XtraForm
{
+ List<FilterEntity> _filterList = new List<FilterEntity>();
public User()
{
InitializeComponent();
@@ -23,29 +22,25 @@
this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
- this.toolBarMenu1.btnReportClick += ToolBarMenu1_btnReportClick;
+ this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
- gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
- pageBar1.PagerEvent += PageBar1_PagerEvent;
getPageList(1, UtilityHelper.GetPageSize());
- }
-
- private void ToolBarMenu1_btnReportClick(object sender, EventArgs e)
- {
- Rpt.RptUser frm = new Rpt.RptUser();
- frm.Show();
- }
-
- private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
- {
- //// 鑾峰彇GridView缁勪欢
- //GridView view = sender as GridView;
- //// 纭繚view涓嶄负null
- //if (view == null) return;
- //// 鑾峰彇搴旂敤鐨勭瓫閫夊櫒淇℃伅
- //string filter = view.ActiveFilterString;
- //MessageBox.Show(filter);
- //getPageList(1, UtilityHelper.GetPageSize());
+ pageBar1.PagerEvent += PageBar1_PagerEvent;
+ gridView1.IndicatorWidth = 50;
+ gridView1.CustomDrawRowIndicator += (s, e) =>
+ {
+ if (e.Info.IsRowIndicator && e.RowHandle >= 0)
+ {
+ e.Info.DisplayText = (e.RowHandle + 1).ToString();
+ }
+ };
+ gridView1.CustomDrawEmptyForeground += (s, e) =>
+ {
+ string str = "鏆傛湭鏌ユ壘鍒板尮閰嶇殑鏁版嵁!";
+ Font f = new Font("寰蒋闆呴粦", 16);
+ Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
+ e.Graphics.DrawString(str, f, Brushes.Gray, r);
+ };
}
/// <summary>
@@ -55,20 +50,9 @@
/// <param name="e"></param>
private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
{
- GridHitInfo info = gridView1.CalcHitInfo(e.Location);
- if (info.InRow)
- {
- GridView view = info.View as GridView;
- if (view != null)
- {
- DataRow row = view.GetDataRow(info.RowHandle);
- if (row != null)
- {
- string rowGuid = (row["guid"].ToString());
- getModel(rowGuid, false, 999);
- }
- }
- }
+ string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
+ if (!string.IsNullOrEmpty(rowGuid))
+ getModel(rowGuid, false, 999);
}
/// <summary>
/// 鍒嗛〉浜嬩欢
@@ -79,6 +63,27 @@
{
getPageList(curPage, pageSize);
}
+ /// <summary>
+ /// 鏌ヨ浜嬩欢
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
+ {
+ Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList);
+ frm.UpdateParent += Frm_UpdateParent;
+ frm.ShowDialog();
+ }
+ /// <summary>
+ /// 鏌ヨ鍥炶皟
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e)
+ {
+ _filterList = e.FilterList;
+ getPageList(1, pageBar1.RowsCount);
+ }
/// <summary>
/// 鍙栨秷浜嬩欢
@@ -87,7 +92,7 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
{
- UtilityHelper.ChangeTab(xtraTabControl1, 0);
+ UtilityHelper.JumpToTab(xtraTabControl1, 0);
}
/// <summary>
@@ -97,26 +102,25 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
{
- DataRow dr = gridView1.GetFocusedDataRow();
- if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString()))
+ string rowGuid, rowName;
+ (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_userName, gridView1);
+ if (string.IsNullOrEmpty(rowGuid))
{
ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
return;
}
- if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + dr["userName"].ToString() + "銆戯紝纭畾鍒犻櫎鍚楋紵"))
+ if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵"))
return;
- var _obj = new
- {
- guidList = dr["guid"].ToString(),//涓诲缓
- };
- string strJson = "";
+ List<string> lst = new List<string>();
+ lst.Add(rowGuid);
+ var _obj = lst;
try
{
- strJson = UtilityHelper.HttpPost("", "User/DeleteModel", JsonConvert.SerializeObject(_obj));
- ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
+ string strJson = UtilityHelper.HttpPost("", "User/DeleteModel", JsonConvert.SerializeObject(_obj));
+ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
if (_rtn.rtnCode > 0)
{
- UtilityHelper.ChangeTab(xtraTabControl1, 0);
+ UtilityHelper.JumpToTab(xtraTabControl1, 0);
getPageList(1, UtilityHelper.GetPageSize());
}
ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
@@ -134,7 +138,7 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
{
- UtilityHelper.ChangeTab(xtraTabControl1, 0);
+ UtilityHelper.JumpToTab(xtraTabControl1, 0);
getPageList(1, UtilityHelper.GetPageSize());
}
/// <summary>
@@ -144,13 +148,14 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
{
- DataRow dr = gridView1.GetFocusedDataRow();
- if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString()))
+ string rowGuid, rowName;
+ (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_userName, gridView1);
+ if (string.IsNullOrEmpty(rowGuid))
{
ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
return;
}
- getModel(dr["guid"].ToString(), true, 1);
+ getModel(rowGuid, true, 1);
}
/// <summary>
/// 鏂板浜嬩欢
@@ -159,10 +164,11 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
{
- UtilityHelper.ChangeTab(xtraTabControl1, 1);
+ UtilityHelper.JumpToTab(xtraTabControl1, 1);
lbGuid.Text = "";
- UtilityHelper.CleanValue(this.panel1.Controls, true);
+ UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
txt_password.Visible = lbPwd.Visible = true;
+ txt_account.Enabled = txt_password.Enabled = true;
}
/// <summary>
/// 淇濆瓨浜嬩欢
@@ -190,12 +196,6 @@
txt_userName.Focus();
return;
}
- if (txt_isLocked.SelectedIndex <= 0)
- {
- Gs.DevApp.ToolBox.MsgHelper.Warning("鐘舵�佷笉鑳戒负绌猴紒");
- txt_isLocked.Focus();
- return;
- }
var _obj = new
{
guid = lbGuid.Text.Trim(),//涓诲缓
@@ -205,25 +205,20 @@
address = txt_address.Text.Trim(),
tel = txt_tel.Text.Trim(),
email = txt_email.Text.Trim(),
- isLocked = txt_isLocked.SelectedIndex,
- flagAdmin = 0,
- flagOnline = 0,
- loginCounter = 0,
- workerID = "",
+ isStatus = txt_isStatus.Checked,
remark = txt_remark.Text.Trim(),
- departGuid = "",
isSys = 0
};
try
{
string strJson = UtilityHelper.HttpPost("", "User/EditModel", JsonConvert.SerializeObject(_obj));
- ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
+ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
if (_rtn.rtnCode > 0)
{
lbGuid.Text = _rtn.rtnData;
toolBarMenu1.isSetBtn = true;
- UtilityHelper.ChangeEnable(this.panel1.Controls, false);
+ UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
}
}
catch (Exception ex)
@@ -239,12 +234,17 @@
/// <param name="pageSize">姣忛〉鍑犳潯</param>
private void getPageList(int curPage, int pageSize)
{
- PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "createTime", "asc", "", "");
+ System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+ foreach (FilterEntity itm in _filterList)
+ {
+ _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'");
+ }
+ PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "CREATE_TIME", "asc", "", _sbSqlWhere.ToString());
string json = JsonConvert.SerializeObject(pgq);
try
{
string strReturn = UtilityHelper.HttpPost("", "User/GetListPage", json);
- ReturnModel<PageListModel> dd = UtilityHelper.GetTableByJson(strReturn);
+ ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
DataTable dt = dd.rtnData.list;
gcMain.BindingContext = new BindingContext();
gcMain.DataSource = dt;
@@ -268,7 +268,7 @@
ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
return;
}
- UtilityHelper.ChangeTab(xtraTabControl1, tabIdx);
+ UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
var _obj = new
{
guid = strGuid,//涓诲缓
@@ -276,14 +276,13 @@
try
{
string strJson = UtilityHelper.HttpPost("", "User/GetModel", JsonConvert.SerializeObject(_obj));
- ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
+ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
if (_rtn.rtnCode > 0)
{
dynamic dy = _rtn.rtnData;
lbGuid.Text = strGuid;
UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit);
- txt_account.Enabled = false;
- txt_password.Enabled = txt_password.Visible = lbPwd.Visible = tipPwd.Visible = false;
+ txt_account.Enabled = txt_password.Enabled = txt_password.Visible = lbPwd.Visible = tipPwd.Visible = false;
}
else
ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
@@ -304,6 +303,17 @@
frm.ShowDialog();
}
}
+ private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
+ {
+ if (e.Button.Index == 0)
+ {
+ int rowhandle = gridView1.FocusedRowHandle;
+ DataRow dr = gridView1.GetDataRow(rowhandle);
+ string userGuid = dr["guid"].ToString();
+ Gs.DevApp.DevFrm.User.UserSetPwd frm = new Gs.DevApp.DevFrm.User.UserSetPwd(userGuid);
+ frm.ShowDialog();
+ }
+ }
}
}
--
Gitblit v1.9.3