From 39a388b0f43e350d495bcb68c2bb4bd87741fa05 Mon Sep 17 00:00:00 2001 From: cyf Date: Fri, 27 Jun 2025 07:45:08 +0000 Subject: [PATCH] SVN r800 SVN-Revision: r800 --- 插件库/Lskj.Control/Model/CommonMenu.cs | 5 + 插件库/Lskj.Control/Model/ControlModel.cs | 6 +- 插件库/Lskj.Control/Model/DelegateUtil.cs | 39 +++ 插件库/Lskj.Control/Model/GridColumnModel.cs | 7 +- 插件库/Lskj.Control/Model/GridExtend.cs | 9 + 插件库/Lskj.Control/Model/MyControl.cs | 34 +- 插件库/Lskj.Control/Model/TreeGridDragTree.cs | 290 ++++++++++++++++++ 7 files changed, 386 insertions(+), 4 deletions(-) create mode 100644 插件库/Lskj.Control/Model/TreeGridDragTree.cs diff --git a/插件库/Lskj.Control/Model/CommonMenu.cs b/插件库/Lskj.Control/Model/CommonMenu.cs index 8d6e97f..bbf0a27 100644 --- a/插件库/Lskj.Control/Model/CommonMenu.cs +++ b/插件库/Lskj.Control/Model/CommonMenu.cs @@ -43,6 +43,7 @@ namespace Lskj.Control.Model /// public event CommonToolApplyEventHandler ApplyBefore; public event CommonToolAfterDynamicLinkEventHandler DynamicLinkAfter; + public event StoredProcedureAfterExecute ReturnStoredProcedureValue; /// /// Initializes a new instance of the class. /// @@ -301,6 +302,10 @@ namespace Lskj.Control.Model } break; default: + if (ReturnStoredProcedureValue != null) + { + ReturnStoredProcedureValue(pMsg.Value+""); + } MessageUtil.Show(ResourceKeys.OperSuccess); break; } diff --git a/插件库/Lskj.Control/Model/ControlModel.cs b/插件库/Lskj.Control/Model/ControlModel.cs index 3974ebc..58a57db 100644 --- a/插件库/Lskj.Control/Model/ControlModel.cs +++ b/插件库/Lskj.Control/Model/ControlModel.cs @@ -307,4 +307,8 @@ namespace Lskj.Control.Model /// public bool ConfigureColumnMode { get; set; } /// - ///条件控件回车执行搜索后清空 \ No newline at end of file + ///条件控件回车执行搜索后清空控件值 + /// + public bool ScanAfterEmpty { get; set; } + /// + ///是否为 导入返 \ No newline at end of file diff --git a/插件库/Lskj.Control/Model/DelegateUtil.cs b/插件库/Lskj.Control/Model/DelegateUtil.cs index 9ce53af..2ed76b0 100644 --- a/插件库/Lskj.Control/Model/DelegateUtil.cs +++ b/插件库/Lskj.Control/Model/DelegateUtil.cs @@ -54,6 +54,12 @@ namespace Lskj.Control /// The e. public delegate void TreeGridDragGridCompleteEventHandler(object sender, TreeGridDragGridArgs e); /// + /// 树表格拖拽表格节点完成后调用 + /// + /// The sender. + /// The e. + public delegate void TreeGridDragTreeGridCompleteEventHandler(object sender, TreeGridDragTreeGridArgs e); + /// /// 多表格拖拽表格完成后调用 /// /// The sender. @@ -104,6 +110,12 @@ namespace Lskj.Control /// /// public delegate void BeforeHandleParamsEventHandler(object sender, HandleParamsArgs e); + /// + /// 右键执行存储过程执行成功后返回值 + /// + /// + /// + public delegate void StoredProcedureAfterExecute(string text); #region 总事件委托 @@ -214,6 +226,33 @@ namespace Lskj.Control public DataRow SelectGridRow; } + /// + /// 树表格拖拽表格事件参数 + /// + public class TreeGridDragTreeGridArgs + { + /// + /// 来源树表格 + /// + public TreeList SourceTreeList; + /// + /// 目标树表格 + /// + public TreeList TargetTreeList; + /// + /// 表格拖动选中行数据 + /// + public DataRow[] GridViewSelectRows; + /// + /// 拖动目标选中行 + /// + public DataRow SelectGridRow; + /// + /// 拖动目标树选中节点 + /// + public TreeListNode SelectTreeNode; + } + /// /// 多表格拖拽表格事件参数 /// diff --git a/插件库/Lskj.Control/Model/GridColumnModel.cs b/插件库/Lskj.Control/Model/GridColumnModel.cs index fd480d1..04791cc 100644 --- a/插件库/Lskj.Control/Model/GridColumnModel.cs +++ b/插件库/Lskj.Control/Model/GridColumnModel.cs @@ -359,7 +359,10 @@ namespace Lskj.Control.Model /// 字段操作权限 /// public string PrivilegeOper; - + /// + /// 附加关联(附件模块关联主表树型) + /// + public bool AdditionalAssociations; #endregion /// @@ -449,4 +452,4 @@ namespace Lskj.Control.Model int.TryParse(item["LabPicUrlHeight"] + "", out LabPicUrlHeight); } this.IsCustomGroupPrimary = item.Table.Columns.Contains("IsCustomGroupPrimary") ? "1".Equals(item["IsCustomGroupPrimary"] + "") : false; - this.IsCustomGr \ No newline at end of file + this.IsCustomGroupField = item.Table.Columns.Contains("IsCustomGroupField")&&int.TryParse(item["IsCustomGroupField"] + "",out IsCustomGroupField) ? IsCustomGroupField : 0; \ No newline at end of file diff --git a/插件库/Lskj.Control/Model/GridExtend.cs b/插件库/Lskj.Control/Model/GridExtend.cs index 9c9d7ee..13d5a05 100644 --- a/插件库/Lskj.Control/Model/GridExtend.cs +++ b/插件库/Lskj.Control/Model/GridExtend.cs @@ -2177,6 +2177,15 @@ namespace Lskj.Control.Model } else { + if (model != null && isDirectImport && (model.FieldType == ControlType.LabDate || + model.FieldType == ControlType.LabDateTime || + model.FieldType == ControlType.LabDateTimeShort || + model.FieldType == ControlType.LabTime || + model.FieldType == ControlType.LabShortTime)&& (cell == null || cell.CellType == CellType.Blank||string.IsNullOrWhiteSpace(cell+""))) + { + //日期框如果值是空,就直接跳过。赋空值("")会报错 + continue; + } if (cell.CellType == CellType.Numeric) { diff --git a/插件库/Lskj.Control/Model/MyControl.cs b/插件库/Lskj.Control/Model/MyControl.cs index 2f1d84d..597c16c 100644 --- a/插件库/Lskj.Control/Model/MyControl.cs +++ b/插件库/Lskj.Control/Model/MyControl.cs @@ -1583,11 +1583,16 @@ namespace Lskj.Control.Model { SetControlValue(model, this.ParentKey); } + else if (model.AdditionalAssociations && !string.IsNullOrWhiteSpace(this.ParentKey)) + { + SetControlValue(model, this.ParentKey); + } else if (!string.IsNullOrEmpty(model.DefaultValue)) { string defaultValue = this.SystemModel != null ? ReplaceHelper.ReplaceRowParam(this.SystemModel.maintabFocusedRow, model.DefaultValue) : model.DefaultValue; SetControlValue(model, defaultValue); } + } //智能搜索框第一次加载时手动触发 if (changeLabelAutoGridLooks.Count > 0) @@ -3976,6 +3981,7 @@ namespace Lskj.Control.Model 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"] + "" : ""; + model.AdditionalAssociations = item.Table.Columns.Contains("AdditionalAssociations") && !string.IsNullOrWhiteSpace(item["AdditionalAssociations"] + "") ? "1".Equals(item["AdditionalAssociations"] + "") : false; //为了和工具里和bs里统一 if (model.FieldType == 42) { @@ -5971,4 +5977,30 @@ namespace Lskj.Control.Model LabelDateEdit dateEdit = controlObj as LabelDateEdit; value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd"); } - else if \ No newline at end of file + else if (controlObj is LabelCheckEdit) + { + LabelCheckEdit checkEdit = controlObj as LabelCheckEdit; + value = checkEdit.EditText; + } + else if (controlObj is LabelComboxEdit) + { + LabelComboxEdit autoEdit = controlObj as LabelComboxEdit; + value = autoEdit.EditValue; + } + else if (controlObj is LabelTextEdit) + { + LabelTextEdit textIntEdit = controlObj as LabelTextEdit; + if (textIntEdit != null) value = string.IsNullOrEmpty(textIntEdit.EditText) ? "0" : textIntEdit.EditText; + } + + defaultValue = defaultValue.Replace(item, value); + } + + } + } + return defaultValue; + } + + + } +} \ No newline at end of file diff --git a/插件库/Lskj.Control/Model/TreeGridDragTree.cs b/插件库/Lskj.Control/Model/TreeGridDragTree.cs new file mode 100644 index 0000000..25e6d05 --- /dev/null +++ b/插件库/Lskj.Control/Model/TreeGridDragTree.cs @@ -0,0 +1,290 @@ +//树表格拖拽到树表格 +using DevExpress.Utils; +using DevExpress.XtraGrid; +using DevExpress.XtraGrid.Views.Grid; +using DevExpress.XtraGrid.Views.Grid.ViewInfo; +using DevExpress.XtraTreeList; +using DevExpress.XtraTreeList.Nodes; +using Lskj.Data; +using Lskj.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace Lskj.Control.Model +{ + public class TreeGridDragTree + { + /// + /// 拖拽是否忽视节点 + /// + public bool NeglectingNodes = false; + /// + /// 拖拽条件与目标树选中节点数据进行替换比较 + /// + public string isDragCond; + /// + /// 是否允许拖拽 + /// + public bool isAllowDrag = true; + /// + /// 拖动位置 + /// + private GridHitInfo _hitInfo; + + /// + /// 拖拽时节点 + /// + TreeListHitInfo downHitInfo = null; + + /// + /// 拖动数据源 + /// + private TreeList _sourceTreeList; + /// + /// 拖动目标源 + /// + private TreeList _targetTreeList; + /// + /// 是否正在拖拽 + /// + private bool _draging = false; + /// + /// 是否正在拖拽 + /// + public bool Draging { get { return _draging; } set { _draging = value; } } + public bool CanDragParentNode = false; + public bool isDropColorVisble = false; + /// + /// 表格数据拖动完成 + /// + public event TreeGridDragTreeGridCompleteEventHandler OnDragComplete; + + + public TreeGridDragTree(TreeList sourceTreeList, TreeList targetTreeList) + { + this._sourceTreeList = sourceTreeList; + this._targetTreeList = targetTreeList; + + + if (this._sourceTreeList == null || this._targetTreeList == null) + return; + + this._sourceTreeList.MouseDown += new MouseEventHandler(treeList_MouseDown); + this._sourceTreeList.MouseMove += new MouseEventHandler(treeList_MouseMove); + this._sourceTreeList.MouseUp += new MouseEventHandler(treeList_MouseUp); + //this._sourceTreeList.HideSelection = false; + this._sourceTreeList.AllowDrop = false; + + this._targetTreeList.AllowDrop = true; + this._targetTreeList.DragOver += new DragEventHandler(treeView_DragOver); + this._targetTreeList.DragDrop += new DragEventHandler(treeView_DragDrop); + } + + + + /// + /// 说明:获取选中行数据 + /// 创建人:龚宇超 + /// 创建日期:2019-10-18 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// DataRow[]. + public DataRow[] GetViewFocusedDataRows() + { + var selectNodes = this._sourceTreeList.Selection; + DataRow[] dataRows = new DataRow[selectNodes.Count]; + + for (int i = 0; i < selectNodes.Count; i++) + { + TreeListNode treeNode = selectNodes[i]; + DataRowView dataRowView = this._sourceTreeList.GetDataRecordByNode(treeNode) as DataRowView; + dataRows[i] = dataRowView != null ? dataRowView.Row : null; + } + return dataRows; + } + + + + + + + /// + /// 说明:源表格鼠标放开 + /// 创建人: + /// 创建日期: + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void treeList_MouseUp(object sender, MouseEventArgs e) + { + this._draging = false; + } + + /// 说明:源表格鼠标移动 + /// 创建人: + /// 创建日期: + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void treeList_MouseMove(object sender, MouseEventArgs e) + { + TreeList treelist = sender as TreeList; + if (e.Button == MouseButtons.Left && downHitInfo != null) + { + if (_sourceTreeList.Selection.Count == 0) + return; + Size dragSize = SystemInformation.DragSize; + Rectangle dragRect = new Rectangle(new Point(downHitInfo.MousePoint.X - dragSize.Width / 2, + downHitInfo.MousePoint.Y - dragSize.Height / 2), dragSize); + + if (!dragRect.Contains(new Point(e.X, e.Y))) + { + List node = new List(); + foreach (TreeListNode n in _sourceTreeList.Selection) + { + node.Add(n); + } + treelist.DoDragDrop(node, DragDropEffects.Move); + downHitInfo = null; + DevExpress.Utils.DXMouseEventArgs.GetMouseArgs(e).Handled = true; + } + } + + + } + + /// + /// 说明:源树表格鼠标按下 + /// 创建人: + /// 创建日期:2023-3-20 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void treeList_MouseDown(object sender, MouseEventArgs e) + { + //this._sourceTreeList.AllowDrop = false; + //this._targetGridView.GridControl.AllowDrop = true; + + TreeList treelist = sender as TreeList; + downHitInfo = null; + _hitInfo = null; + TreeListHitInfo hitInfo = treelist.CalcHitInfo(new Point(e.X, e.Y)); + + // if (Control.ModifierKeys != Keys.None) return; + if (e.Button == MouseButtons.Left && hitInfo != null) + { + StaticControl.SourceDragGridView = null; + this._draging = true; + downHitInfo = hitInfo; + } + } + + + /// + /// 说明: + /// 创建人:龚宇超 + /// 创建日期:2017-11-13 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The source of the event. + /// The instance containing the event data. + protected void treeView_DragOver(object sender, DragEventArgs e) + { + if (e.KeyState == (int)Keys.LButton && this._draging) + { + TreeList treeListGrid = sender as TreeList; + treeListGrid.Select(); + Point gcPoint = treeListGrid.PointToScreen((sender as TreeList).Location); + Point pt = new Point(e.X - gcPoint.X, e.Y - gcPoint.Y); + TreeListHitInfo _hitInfo = treeListGrid.CalcHitInfo(pt); + + + if (NeglectingNodes) + { + e.Effect = DragDropEffects.Move; + if (_hitInfo != null && _hitInfo.Node != null) + { + _hitInfo.Node.Expanded = true; + } + } + else + { + if (_hitInfo == null || treeListGrid.GetNodeIndex(_hitInfo.Node) < 0) + { + e.Effect = DragDropEffects.None; + return; + } + DataRowView dataRowView = this._targetTreeList.GetDataRecordByNode(_hitInfo.Node) as DataRowView; + DataRow Row = dataRowView != null ? dataRowView.Row : null; + bool isLastNode = _hitInfo.Node.Nodes.Count == 0; + if (!isLastNode) + { + _hitInfo.Node.Expanded = true; ; + } + //DataRow[] rowItems = this.GetViewFocusedDataRows(); + if (isLastNode || CanDragParentNode) + { + if (ReplaceHelper.ReplaceRowParamCond(Row, this.isDragCond) && isAllowDrag) + { + e.Effect = DragDropEffects.Move; + treeListGrid.FocusedNode = _hitInfo.Node; + } + else + { + e.Effect = DragDropEffects.None; + } + } + else + { + e.Effect = DragDropEffects.None; + } + } + + + } + } + + + + + /// + /// 说明: + /// 创建人:龚宇超 + /// 创建日期:2017-11-13 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The source of the event. + /// The instance containing the event data. + protected void treeView_DragDrop(object sender, DragEventArgs e) + { + if (this.OnDragComplete != null && this._draging) + { + this._draging = false; + TreeList treeListGrid = sender as TreeList; + Point gcPoint = treeListGrid.PointToScreen((sender as TreeList).Location); + Point pt = new Point(e.X - gcPoint.X, e.Y - gcPoint.Y); + TreeListHitInfo _hitInfo = treeListGrid.CalcHitInfo(pt); + TreeListNode treeNode = _hitInfo.Node; + if (!NeglectingNodes) + { +