SVN-Revision: r723
This commit is contained in:
cyf
2025-06-13 07:22:08 +00:00
parent 5c211d66d9
commit 3b1e09ea1e
9 changed files with 142 additions and 41 deletions
@@ -269,6 +269,11 @@ namespace Lskj.Control
this.EditValue = "";
this.Text = "";
}
if (string.IsNullOrWhiteSpace(this.EditValue)&& string.IsNullOrWhiteSpace(this.Text)&& this.Popup.TreeViewExObj.TreeView.SelectedNode != null)
{
// 树型下拉框要清空选中节点,否则下次再选相同的节点就选不上
this.Popup.TreeViewExObj.TreeView.SelectedNode = null;
}
}
}
/// <summary>
@@ -360,12 +365,18 @@ namespace Lskj.Control
this.LostFocus += new EventHandler(OnAutoGridLookUpLostFocus);
this.KeyUp += new KeyEventHandler(OnAutoGridLookUpKeyUp);
//禁用右键(右键中的粘贴,撤回等不会触发处理事件,如KeyUp等)
ContextMenuStrip emptyMenu = new ContextMenuStrip();
this.Properties.ContextMenuStrip = emptyMenu;
this._popup.TreeViewObj.LostFocus += new EventHandler(OnAutoGridLookUpPopupLostFocus);
if (isMultiClick) this._popup.TreeViewExObj.OnGridViewEnter += new KeyEventHandler(OnPopupGridViewEnter);
//if (!isMultiClick) this._popup.TreeViewExObj.OnTreeNodeMouseClick += new TreeNodeMouseClickEventHandler(OnPopupNodeMouseClick);
if (!isMultiClick) this._popup.TreeViewExObj.TreeNodeSelectAfter += new TreeViewEventHandler(OnPopupNodeSelectAfter);
}
@@ -470,7 +481,7 @@ namespace Lskj.Control
else
{
bool result = !string.IsNullOrEmpty(searchText);
if (result == isRefresh&& string.IsNullOrEmpty(searchText)) return;//连续2次都是空值,就不执行
if (result == isRefresh&& string.IsNullOrEmpty(searchText)) return;//连续2次搜索都是空值,就不执行
isRefresh = !string.IsNullOrEmpty(searchText);
// 数据库搜索
string sqlValue = string.Format("select * from ({0}\r\n) temp where {1} like '%{3}%' or {2} like '%{3}%' or dbo.P_getpy({2}) like '%{3}%'", string.IsNullOrEmpty(sourceParamSql) ? SourceSQL : sourceParamSql, ValueField, TextMember, searchText);
@@ -635,7 +646,6 @@ namespace Lskj.Control
}
//_popup.TreeViewObj.Focus();//给了焦点后就不能在文本框中做搜索或者删除操作了
}
}
/// <summary>
/// <para>说明:</para>
@@ -729,6 +739,9 @@ namespace Lskj.Control
{
this.HidePopup();
}
/*还是觉得该放到下面注释的位置 目前有一个节点名称为 abc 的,删除了bc后。 控件里只显示了a,但是选中节点依旧是abc,
* 下次如果不切换节点的话,在单击这个相同的节点。控件上的显示值不会刷新(显示a,但隐藏值是正确的)
*/
if (isRootNode) return;
//if (isRefresh) this.RefreshPopupDataSource("");
string text = string.Empty;
@@ -750,7 +763,9 @@ namespace Lskj.Control
{
this.EditText = this.Text;
}
TreeNode[] nodes = _popup.TreeViewObj.Nodes.Find(keyValue, true);
//if (isRootNode) return;
TreeNode[] nodes = _popup.TreeViewObj.Nodes.Find(this.EditValue + "", true);
if (nodes.Length > 0 && nodes[0].Nodes.Count > 0)
{
this.EditText = string.Empty;
@@ -794,7 +809,8 @@ namespace Lskj.Control
{
this.EditText = this.Text;
}
TreeNode[] nodes = _popup.TreeViewObj.Nodes.Find(keyValue, true);
//if (isRootNode) return;
TreeNode[] nodes = _popup.TreeViewObj.Nodes.Find(this.EditValue + "", true);
if (nodes.Length > 0 && nodes[0].Nodes.Count > 0)
{
this.EditText = string.Empty;
@@ -809,4 +825,6 @@ namespace Lskj.Control
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The so
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="KeyEvnentArgs"/> instance containing the event data.</param>
prot
@@ -1297,16 +1297,17 @@ namespace Lskj.Control
if (visible)
{
isShowFooter = true;
col.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Sum, col.FieldName, "{0:}") });
string dataFormat = colparame.Length > 3? colparame[3]:"";
col.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Sum, col.FieldName, "{0:" + dataFormat + "}") });
if (SystemInfo.Instance.GroupSpecialMode)
{
bandedGridView.GroupSummary.Add(new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Sum, col.FieldName, col, "{0:}"));
bandedGridView.GroupSummary.Add(new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Sum, col.FieldName, col, "{0:" + dataFormat + "}"));
bandedGridView.OptionsView.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways;
}
else
{
GridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(SummaryItemType.Sum, col.FieldName, null, "{0:}") });
GridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(SummaryItemType.Sum, col.FieldName, null, "{0:" + dataFormat + "}") });
}
}
if (colparame.Length > 3)
+85 -4
View File
@@ -946,6 +946,9 @@ namespace Lskj.Control
case ControlType.BarCode128B:
InitBarCode128BEdit(column, model);
break;
case ControlType.LabHyperlink:
InitHyperlink(column, model);
break;
default:
break;
}
@@ -2320,16 +2323,17 @@ namespace Lskj.Control
if (visible)
{
isShowFooter = true;
col.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Sum, col.FieldName, "{0:}") });
string dataFormat = colSplit.Length > 3 ? colSplit[3] : "";
col.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Sum, col.FieldName, "{0:" + dataFormat + "}") });
if (SystemInfo.Instance.GroupSpecialMode)
{
gridView.GroupSummary.Add(new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Sum, col.FieldName, col, "{0:}"));
gridView.GroupSummary.Add(new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Sum, col.FieldName, col, "{0:" + dataFormat + "}"));
gridView.OptionsView.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways;
}
else
{
gridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(SummaryItemType.Sum, col.FieldName, null, "{0:}") });
gridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(SummaryItemType.Sum, col.FieldName, null, "{0:" + dataFormat + "}") });
}
}
}
@@ -3353,6 +3357,8 @@ namespace Lskj.Control
timeEdit.DisplayFormat.FormatString = timeEdit.EditFormat.FormatString = timeEdit.Mask.EditMask = DateFormat.Format(fieldType);
timeEdit.DisplayFormat.FormatType = timeEdit.EditFormat.FormatType = DevExpress.Utils.FormatType.Custom;
gridControl.RepositoryItems.Add(timeEdit);
gridColumn.ColumnEdit = timeEdit;
}
@@ -4097,6 +4103,63 @@ namespace Lskj.Control
//this.mControlList.Add(model);
}
/// <summary>
/// <para>说明:超链接</para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2025-06-13 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void InitHyperlink(GridColumn gridColumn, GridColumnModel model)
{
// 创建超链接编辑器
RepositoryItemHyperLinkEdit hyperLinkEdit = new RepositoryItemHyperLinkEdit();
hyperLinkEdit.LinkColor = System.Drawing.Color.Blue;
hyperLinkEdit.NullText = "";
hyperLinkEdit.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
// 设置超链接点击事件
hyperLinkEdit.Click += HyperLinkEdit_Click;
hyperLinkEdit.Tag = model;
// 注册编辑器
gridControl.RepositoryItems.Add(hyperLinkEdit);
gridColumn.OptionsColumn.ReadOnly = true;
gridColumn.ColumnEdit = hyperLinkEdit;
}
private void HyperLinkEdit_Click(object sender, EventArgs e)
{
string urlName = string.Empty;
// 获取点击的 HyperLinkEdit 实例
DevExpress.XtraEditors.HyperLinkEdit linkEdit = sender as DevExpress.XtraEditors.HyperLinkEdit;
if (linkEdit != null)
{
// 获取对应的 RepositoryItem
RepositoryItemHyperLinkEdit repositoryItem = linkEdit.Properties as RepositoryItemHyperLinkEdit;
if (repositoryItem != null)
{
GridColumnModel model = repositoryItem.Tag as GridColumnModel;
urlName = model.ValueMember;
}
}
if (string.IsNullOrWhiteSpace(urlName)) return;
// 获取当前选中的行和列
int rowHandle = this.gridView.FocusedRowHandle;
string url = this.gridView.GetRowCellValue(rowHandle, urlName) as string;
if (!string.IsNullOrEmpty(url))
{
// 打开默认浏览器访问URL
System.Diagnostics.Process.Start(url);
}
}
private void InitRightMenuBtnEdit()
{
GridColumn gridColumn = new GridColumn();
@@ -7722,7 +7785,7 @@ namespace Lskj.Control
/// </summary>
/// <param name="ModifyFields">修改字段</param>
/// <param name="RequiredFields">必填字段</param>
public virtual void SetFieldStatus(string ModifyFields, string RequiredFields)
public virtual void SetFieldStatus(string ModifyFields, string RequiredFields,DataTable AuthorityTable=null)
{
GridColumnCollection gc = this.GridView.Columns;
@@ -7747,6 +7810,24 @@ namespace Lskj.Control
//修改
if (Modify && ModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1)
{
if (!string.IsNullOrWhiteSpace(model.PrivilegeOper)&& AuthorityTable!=null)
{
List<int> targetPrivTypeIds = new List<int>();
foreach (string permission in model.PrivilegeOper.Split(','))
{
targetPrivTypeIds.Add(int.Parse(permission));
}
//获取权限对应的人员名称
string userString = string.Join(",", AuthorityTable.AsEnumerable()
.Where(row => targetPrivTypeIds.Contains(row.Field<int>("privTypeId")))
.Select(row => row.Field<string>("userList"))
.Where(value => value != null)
.ToList());
if (!userString.Split(',').Contains(ERPInfo.Instance.UserName)) continue;
}
item.OptionsColumn.AllowEdit = ModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1;
item.OptionsColumn.ReadOnly = !item.OptionsColumn.AllowEdit;
+6 -1
View File
@@ -302,4 +302,9 @@ namespace Lskj.Control.Model
///模块选择返回框,是否单选模式
/// </summary>
public bool IsRadio { get; set; }
/
/// <summary>
///模块选择返回框,配置列加载模式(默认根据sql动态加载列)
/// </summary>
public bool ConfigureColumnMode { get; set; }
/// <summary>
///条件控件回车执行搜索后清空
@@ -441,6 +441,10 @@ namespace Lskj.Control.Model
/// 称重控件
/// </summary>
public const int LabApiBtuton = 163;
/// <summary>
///超链接
/// </summary>
public const int LabHyperlink = 164;
/// <summary>
@@ -351,6 +351,14 @@ namespace Lskj.Control.Model
/// 导入时转格式
/// </summary>
public string ImportConversionFormat;
/// <summary>
/// 字段浏览权限
/// </summary>
public string PrivilegeView;
/// <summary>
/// 字段操作权限
/// </summary>
public string PrivilegeOper;
#endregion
@@ -438,4 +446,7 @@ namespace Lskj.Control.Model
this.isVislble = item.Table.Columns.Contains("vislble") && !string.IsNullOrWhiteSpace(item["vislble"] + "") ? "1".Equals(item["vislble"] + "") : false;
if (item.Table.Columns.Contains("LabPicUrlHeight"))
{
int.TryParse
int.TryParse(item["LabPicUrlHeight"] + "", out LabPicUrlHeight);
}
this.IsCustomGroupPrimary = item.Table.Columns.Contains("IsCustomGroupPrimary") ? "1".Equals(item["IsCustomGroupPrimary"] + "") : false;
this.IsCustomGr
@@ -508,7 +508,7 @@ namespace Lskj.Control.Model
switch (model.ActionType)
{
case 1: // 执行存储过程
if (i == rows.Length - 1 || (execOnlyOne && i > 0))
if (i == rows.Length - 1 || execOnlyOne )
{
//执行最后一条
FinallySucceeded = true;
@@ -1792,28 +1792,4 @@ namespace Lskj.Control.Model
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
if (dataRows.Length == 0)
{
string addColSql = string.Format("alter table P_PrivateDllTab add {0} {1}", colunmField.Key, colunmField.Value);
SqlHelper.ExecuteNonQuery(addColSql);//添加列
}
}
}
else
{
string createTabSql = "create table P_PrivateDllTab(id int IDENTITY(1,1) NOT NULL,{0})";
string createCol = string.Empty;
foreach (KeyValuePair<string, string> colunmField in colDic)
{
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
}
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
}
return true;
}
catch (Exception)
{
return false;
}
}
}
}
string a
@@ -2492,6 +2492,8 @@ namespace Lskj.Control.Model
SerSearchBoxDataSource(control, controlValue + "");
}
}
// 树结构节点不清空数据
if (control != null && model.FieldType != ControlType.LabTreeType)
{
@@ -3956,6 +3958,8 @@ namespace Lskj.Control.Model
model.ImportCurrentValue = item.Table.Columns.Contains("ImportCurrentValue") && !string.IsNullOrWhiteSpace(item["ImportCurrentValue"] + "") ? "1".Equals(item["ImportCurrentValue"] + "") : false;
model.SchedStartDataControl = item.Table.Columns.Contains("SchedStartDataControl") && !string.IsNullOrWhiteSpace(item["SchedStartDataControl"] + "") ? "1".Equals(item["SchedStartDataControl"] + "") : false;
model.ListBoxFontSize = item.Table.Columns.Contains("ListBoxFontSize") && !string.IsNullOrEmpty(item["ListBoxFontSize"] + "") ? Convert.ToInt32(item["ListBoxFontSize"] + "") : 0;
model.PrivilegeView = item.Table.Columns.Contains("PrivilegeView") ? item["PrivilegeView"] + "" : "";
model.PrivilegeOper = item.Table.Columns.Contains("PrivilegeOper") ? item["PrivilegeOper"] + "" : "";
//为了和工具里和bs里统一
if (model.FieldType == 42)
{
@@ -4116,6 +4120,7 @@ namespace Lskj.Control.Model
autoTreeEdit.ValueMember = ControlType.LabMultiComTreeboxValueParam == model.FieldType || ControlType.LabMultiComTreeboxValue == model.FieldType || ControlType.LabMulitTreeValue == model.FieldType || ControlType.LabMulitTreeValueParam == model.FieldType || ControlType.LabTreeLookValue == model.FieldType || ControlType.LabCheckTreeLookValue == model.FieldType || ControlType.LabTreeLastlevelValue == model.FieldType || ControlType.LabCheckTreeLastlevelValue == model.FieldType ? model.ValueMember : model.TextMember;
autoTreeEdit.ValueField = model.ValueMember;
autoTreeEdit.TextField = model.TextMember;
//工具中和bs里 122-123只能选末级
if (ControlType.LabTreeLastlevelValue == model.FieldType || ControlType.LabTreeLastlevelText == model.FieldType || ControlType.LabCheckTreeLastlevelValue == model.FieldType || ControlType.LabCheckTreeLastlevelText == model.FieldType) autoTreeEdit.isRootNode = false;
//工具中和bs里 132-135都是只能选末级,136-139可以选中全部
+1 -1
View File
@@ -4181,7 +4181,7 @@ namespace Lskj.Control
/// </summary>
/// <param name="ModifyFields">修改字段</param>
/// <param name="RequiredFields">必填字段</param>
public override void SetFieldStatus(string ModifyFields, string RequiredFields)
public override void SetFieldStatus(string ModifyFields, string RequiredFields, DataTable AuthorityTable = null)
{
TreeListColumnCollection gc = this.gcMain.Columns;