1167 lines
53 KiB
C#
1167 lines
53 KiB
C#
using DevExpress.Data;
|
|
using DevExpress.XtraEditors;
|
|
using DevExpress.XtraEditors.Controls;
|
|
using DevExpress.XtraEditors.Repository;
|
|
using DevExpress.XtraGrid.Columns;
|
|
using DevExpress.XtraGrid.Views.Base;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using DevExpress.XtraTab;
|
|
using DevExpress.XtraTreeList;
|
|
using DevExpress.XtraTreeList.Nodes;
|
|
using Lskj.Business;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Control;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Core;
|
|
using Lskj.Model;
|
|
using Lskj.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.PubArtworkPreview
|
|
{
|
|
public partial class ArtworkPreview : UserControl
|
|
{
|
|
#region 共有变量
|
|
/// <summary>
|
|
/// 父窗体
|
|
/// </summary>
|
|
public Form BaseForm;
|
|
/// <summary>
|
|
/// mrp动态链接库
|
|
/// </summary>
|
|
public DynamicArtworkModel Model;
|
|
/// <summary>
|
|
/// 主程序的基础模型
|
|
/// </summary>
|
|
public ModuleModel MoudleMainObj;
|
|
/// <summary>
|
|
/// 主程序的基础模型
|
|
/// </summary>
|
|
public ModuleModel MoudleDetailObj;
|
|
/// <summary>
|
|
///主表条件控件
|
|
/// </summary>
|
|
public MyControl SearchMainObj;
|
|
/// <summary>
|
|
/// 左侧树数据
|
|
/// </summary>
|
|
public DataRow LeftRowObj;
|
|
/// <summary>
|
|
/// 主表关联左侧树字段
|
|
/// </summary>
|
|
public string ParentUnionField;
|
|
/// <summary>
|
|
/// 主表关联左侧树id
|
|
/// </summary>
|
|
public string ParentKeyField;
|
|
/// <summary>
|
|
/// 右侧审核界面
|
|
/// </summary>
|
|
public Accraditation FrmAccraditation;
|
|
/// <summary>
|
|
/// 关联流转模块
|
|
/// </summary>
|
|
public ModuleModel accraditationModel;
|
|
#endregion
|
|
#region 私有
|
|
/// <summary>
|
|
/// 主表明细key值
|
|
/// </summary>
|
|
private string _primaryMainKey;
|
|
/// <summary>
|
|
/// 左侧模块右键
|
|
/// </summary>
|
|
private BaseRightMenu baseRightMenu = new BaseRightMenu();
|
|
/// <summary>
|
|
/// 文件大小
|
|
/// </summary>
|
|
private static readonly string[] suffixes = new string[] { " B", " KB", " MB", " GB", " TB", " PB" };
|
|
/// <summary>
|
|
/// 设置明细模块
|
|
/// </summary>
|
|
//private static GridDetailModel gridDetailModel;
|
|
/// <summary>
|
|
/// 等待区数据表结构
|
|
/// </summary>
|
|
private DataTable upperTable = new DataTable();
|
|
/// <summary>
|
|
/// 之前选中节点
|
|
/// </summary>
|
|
private TreeListNode lastNode;
|
|
/// <summary>
|
|
/// 之前选中节点
|
|
/// </summary>
|
|
private Dictionary<string, byte[]> IconBytesList = new Dictionary<string, byte[]>();
|
|
/// <summary>
|
|
/// 左侧节点主键
|
|
/// </summary>
|
|
private string leftTreeGridIdValue
|
|
{
|
|
get { return this.treeLeft.GetGridViewDataSource().Rows[0]["产品代码"] + ""; }
|
|
}
|
|
/// <summary>
|
|
/// 上方拖拽类
|
|
/// </summary>
|
|
private GridDragTreeGrid dragGrid;
|
|
/// <summary>
|
|
/// 下方拖拽类
|
|
/// </summary>
|
|
private GridDragTreeGrid nDragGrid;
|
|
/// <summary>
|
|
/// 底部多标签控件
|
|
/// </summary>
|
|
public XtraTabControl TabObj { get { return this.tcButtom.TabControlObj; } }
|
|
/// <summary>
|
|
/// 左上方第一个条件
|
|
/// </summary>
|
|
public string firstCondition = string.Empty;
|
|
/// <summary>
|
|
/// tif查看控件
|
|
/// </summary>
|
|
private PictureBoxEx pictureBoxEx = new PictureBoxEx();
|
|
/// <summary>
|
|
/// 主要明细表格
|
|
/// </summary>
|
|
//private GridControlEx gm_Control = new GridControlEx();
|
|
|
|
/// <summary>
|
|
/// 固定页签
|
|
/// </summary>
|
|
private List<XtraTabPage> FixedTabs = new List<XtraTabPage>();
|
|
/// <summary>
|
|
/// 配置页签
|
|
/// </summary>
|
|
//private GridControlEx CustomTab = new GridControlEx();
|
|
/// <summary>
|
|
/// 底部表格数据
|
|
/// </summary>
|
|
public List<GridDetailModel> Details;
|
|
|
|
#endregion
|
|
|
|
public ArtworkPreview()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
#region 方法
|
|
/// <summary>
|
|
/// <para>说明:窗口加载</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2022-12-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
public void OnLoad(DynamicArtworkModel _model)
|
|
{
|
|
WaitForm.ShowForm();
|
|
try
|
|
{
|
|
this.Model = _model;//共有动态库赋值
|
|
this.MoudleMainObj = new ModuleModel(MainImpl.GetSystemdllTab(Model.ModuleCode));//获取主模块构建类
|
|
this.MoudleMainObj.ParmaryKey = _primaryMainKey = BaseImpl.GetBasePrimaryKey(Model.ModuleCode);//构建主表主键值
|
|
this.InitializeSplitPosition();//初始化分隔条位置
|
|
this.InitializeControl();//初始化主表数据
|
|
this.InitializeDetail();//初始化明细数据
|
|
this.InitializeOperateGrid();//初始化上面操作页
|
|
if (!string.IsNullOrWhiteSpace(firstCondition) && !string.IsNullOrWhiteSpace(Model.Params[0]))
|
|
{
|
|
splitRightControl.PanelVisibility = SplitPanelVisibility.Both;
|
|
this.InitializeAccraditation();//初始化右侧审核界面
|
|
this.SearchMainObj.OnDataSourceBindCallBack += SearchMainObj_OnDataSourceBindCallBack;
|
|
}
|
|
else
|
|
{
|
|
splitRightControl.PanelVisibility = SplitPanelVisibility.Panel1;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine(ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
}
|
|
WaitForm.HideForm();
|
|
}
|
|
/// <summary>
|
|
/// 审核页面进入后执行
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void SearchMainObj_OnDataSourceBindCallBack(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(firstCondition) && !string.IsNullOrWhiteSpace(Model.Params[0]))
|
|
{
|
|
this.SearchMainObj.SetControlValue(firstCondition, Model.Params[0]);
|
|
BaseUserControl control = this.SearchMainObj.FindControl(firstCondition);
|
|
if (control != null && control is LabelAutoTextRevEdit)
|
|
{
|
|
LabelAutoTextRevEdit labelAutoTextRevEdit = control as LabelAutoTextRevEdit;
|
|
labelAutoTextRevEdit.TextEdit.Enabled = false;
|
|
labelAutoTextRevEdit.TextEdit.SearchCallBack();
|
|
}
|
|
this.plm_top_cond.Enabled = false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化上面附件上传操作表格</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2023-1-31 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void InitializeOperateGrid()
|
|
{
|
|
//this.gm_Control.GridView.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
|
|
}
|
|
/// <summary>
|
|
/// 初始化分隔条
|
|
/// </summary>
|
|
private void InitializeSplitPosition()
|
|
{
|
|
this.splitLeftControl.SplitterPositionChanged += new EventHandler(OnSplitterPositionChanged);
|
|
this.splitMainControl.SplitterPositionChanged += new EventHandler(OnSplitterPositionChanged);
|
|
this.splitRightControl.SplitterPositionChanged += new EventHandler(OnSplitterPositionChanged);
|
|
string leftSpliterPosition = IniHelper.Read(string.Format("Step_spliterPositionLeft_{0}", this.Model.ModuleCode));
|
|
if (!string.IsNullOrEmpty(leftSpliterPosition)) this.splitLeftControl.SplitterPosition = Convert.ToInt32(leftSpliterPosition);
|
|
string mainSpliterPosition = IniHelper.Read(string.Format("Step_spliterPositionMain_{0}", this.Model.ModuleCode));
|
|
if (!string.IsNullOrEmpty(mainSpliterPosition)) this.splitMainControl.SplitterPosition = Convert.ToInt32(mainSpliterPosition);
|
|
string rightSpliterPosition = IniHelper.Read(string.Format("Step_spliterPositionRight_{0}", this.Model.ModuleCode));
|
|
if (!string.IsNullOrEmpty(rightSpliterPosition)) this.splitRightControl.SplitterPosition = Convert.ToInt32(rightSpliterPosition);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化明细表格构建</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2023-1-31 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void InitializeDetail()
|
|
{
|
|
treeLeft.TreeListObj.OptionsView.ShowHorzLines = false; //隐藏水平表格线
|
|
treeLeft.TreeListObj.OptionsView.ShowVertLines = false; //隐藏垂直表格线
|
|
treeLeft.TreeListObj.OptionsView.ShowIndentAsRowStyle = false; //隐藏格式
|
|
string queryTableCacheKey = this.MoudleMainObj.CondKey + "_queryTable";
|
|
//DataTable moduleDetailTable = BaseModuleImpl.GetBaseDetailPages(this.Model.ModuleCode);//获取所有主表配置明细
|
|
this.Details = this.GetDetails();
|
|
if (Details == null || Details.Count == 0) return;
|
|
|
|
this.Details[0].AssociateRight = true;//第一个明细默认关联右侧,此模块的第一个明细为右侧模块
|
|
|
|
List<GridDetailModel> FixedList = this.Details.Cast<GridDetailModel>().Where(x => x.AssociateRight).ToList();//固定加载,和右侧关联
|
|
List<GridDetailModel> NormalList = this.Details.Cast<GridDetailModel>().Where(x => !x.AssociateRight).ToList();//正常加载,不和右侧关联
|
|
this.Tab_Bottom.TabControlObj.SelectedPageChanged += TabControlObj_SelectedPageChanged;
|
|
|
|
//正常加载,程序通用加载页签明细操作,不和右侧关联
|
|
if (Details != null || NormalList.Count > 1)
|
|
{
|
|
|
|
this.Tab_Bottom.Model = this.Model;
|
|
this.Tab_Bottom.InitTabPages(NormalList);
|
|
}
|
|
|
|
int index = 0;
|
|
//固定加载,默认添加图标列,默认添加行改变刷新右侧事件
|
|
foreach (GridDetailModel gridDetailModel in FixedList)
|
|
{
|
|
gridDetailModel.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(gridDetailModel.UnionModule));//获取主模块构建类
|
|
this.MoudleDetailObj = new ModuleModel(MainImpl.GetSystemdllTab(gridDetailModel.UnionModule));//获取明细模块构建类
|
|
gridDetailModel.SystemModel = MoudleDetailObj;
|
|
DataTable gridColumns = BaseModuleImpl.GetBaseGridColumns(gridDetailModel.UnionModule);
|
|
//默认添加图标列
|
|
GridColumn iconColumn = new GridColumn();
|
|
iconColumn.Caption = "图标";
|
|
iconColumn.FieldName = "icon";
|
|
iconColumn.UnboundType = UnboundColumnType.Object;
|
|
RepositoryItemPictureEdit picEdit = new RepositoryItemPictureEdit();
|
|
picEdit.AutoHeight = true;
|
|
picEdit.SizeMode = PictureSizeMode.Zoom;
|
|
picEdit.BestFitWidth = 16;
|
|
picEdit.CustomHeight = 16;
|
|
iconColumn.ColumnEdit = picEdit;
|
|
iconColumn.Visible = true;
|
|
iconColumn.VisibleIndex = 0;
|
|
iconColumn.OptionsColumn.AllowEdit = false;
|
|
|
|
GridControlEx gm_Control = new GridControlEx();
|
|
gm_Control.Dock = DockStyle.Fill;
|
|
gm_Control.GridView.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;//默认选中一整行
|
|
gm_Control.SetReadOnlyColumns(gridColumns, GridCustomColumnStruct.BaseMainGridView + this.MoudleDetailObj.FormKey);//明细
|
|
gm_Control.GridView.Columns.Insert(0, iconColumn);
|
|
DynamicModel dyncModel = new DynamicModuleModel(new string[] { gridDetailModel.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.Model.Privilege, gridDetailModel.UnionModule, "0" });
|
|
gm_Control.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(MoudleDetailObj.ModeCode), dyncModel, OnRightMenuCallBack, this.SearchMainObj);
|
|
gm_Control.GridView.FocusedRowObjectChanged += GridView_FocusedRowObjectChanged;
|
|
if (index == 0)
|
|
{
|
|
//右侧明细
|
|
DataTable RightDetailTable = BaseModuleImpl.GetBaseDetailPages(gridDetailModel.UnionModule);//获取左侧明细表配置明细
|
|
if (RightDetailTable == null || RightDetailTable.Rows.Count == 0) return;
|
|
List<GridDetailModel> details = new List<GridDetailModel>();//表格明细对象的集合
|
|
GridDetailModel RightDetailModel = new GridDetailModel(RightDetailTable.Rows[0]);
|
|
details.Add(RightDetailModel);
|
|
this.tcButtom.InitTabPages(details);
|
|
}
|
|
|
|
|
|
XtraTabPage page = new XtraTabPage();
|
|
page.Text = gridDetailModel.DetailName;
|
|
page.Controls.Add(gm_Control);
|
|
page.Tag = gm_Control;
|
|
this.Tab_Bottom.TabControlObj.TabPages.Insert(index, page);
|
|
index++;
|
|
FixedTabs.Add(page);
|
|
}
|
|
this.Tab_Bottom.TabControlObj.SelectedTabPageIndex = 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:初始化主表树表格构建</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2023-1-31 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void InitializeControl()
|
|
{
|
|
DataTable mainGridColumns = BaseModuleImpl.GetBaseGridColumns(Model.ModuleCode);//主表配置列数据构建
|
|
//this.treeLeft.expansion = false;
|
|
this.treeLeft.TreeListObj.KeyFieldName = "id";
|
|
this.treeLeft.TreeListObj.ParentFieldName = "parentId";
|
|
this.treeLeft.SetReadOnlyColumns(mainGridColumns, GridCustomColumnStruct.BaseMainGridView + this.MoudleMainObj.FormKey);//主表列配置
|
|
this.treeLeft.TreeListObj.CustomDrawNodeCell += new DevExpress.XtraTreeList.CustomDrawNodeCellEventHandler(OnCustomDrawNodeCell);//选中行颜色
|
|
this.treeLeft.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(this.MoudleMainObj.ModeCode));
|
|
this.treeLeft.TreeListObj.OptionsSelection.MultiSelect = false;
|
|
this.treeLeft.TreeListObj.OptionsSelection.MultiSelectMode = TreeListMultiSelectMode.RowSelect;
|
|
this.treeLeft.TreeListObj.Click += new EventHandler(OnTreeListObjClick);
|
|
this.treeLeft.GridView.BestFitColumns();
|
|
this.treeLeft.TreeListObj.AfterExpand += OnTreeListObjAfterExpand;
|
|
this.SearchMainObj = new MyControl(this.MoudleMainObj.MenuSql, treeLeft, null, null, null);//构建主表mycontrol
|
|
this.SearchMainObj.isRevTextEdit = true;
|
|
this.SearchMainObj.OnSearchBeforeCallBack += new SearchEventHandler(OnSearchBeforeCallBack);//搜索前记录选中
|
|
this.SearchMainObj.OnSearchAfterCallBack += new EventHandler(OnRefLeftTree);//执行后展开节点
|
|
DataTable queryTable = BaseModuleImpl.GetCustomQueryFields(this.MoudleMainObj.CondKey);//获取主模块构建的条件
|
|
if (queryTable != null && queryTable.Rows.Count > 0)
|
|
{
|
|
// 加载自定义查询条件
|
|
this.plm_top_cond.Controls.Clear();
|
|
this.SearchMainObj.InitSearchControl(queryTable, this.plm_top_cond, null, null, this.MoudleMainObj.ConditionRefresh);
|
|
firstCondition = queryTable.Rows[0]["fieldName"] + "";
|
|
if (this.SearchMainObj.ControlModels.Where(n => n.FieldType == 5 || n.FieldType == 6 || n.FieldType == 15 || n.FieldType == 16).Count() > 0)
|
|
{
|
|
this.SearchMainObj.ButtonObj.Visible = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// 加载固定查询条件
|
|
DataTable table = BaseModuleImpl.GetFixedQueryFields(this.Model.ModuleCode);//加载固定查询条件
|
|
this.plm_top_cbField.DisplayMember = "fieldText";
|
|
this.plm_top_cbField.ValueMember = "fieldName";
|
|
this.plm_top_cbField.DataSource = table;
|
|
this.SearchMainObj.InitDefaultSearchControl(table, this.plm_top_cond, this.plm_top_cbField.Name, this.plm_top_txtFixKey.Name, this.plm_top_btnFixSearch.Name);
|
|
}
|
|
if (this.SearchMainObj.ButtonObj != null)
|
|
{
|
|
this.SearchMainObj.ButtonObj.Focus();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化右侧数据源</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2023-3-01 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void InitializeAccraditation(DynamicBaseAccraditionPopModel dyncModel = null)
|
|
{
|
|
this.splitRightControl.Panel2.Controls.Clear();
|
|
this.FrmAccraditation = new Accraditation();
|
|
this.FrmAccraditation.BaseForm = this.BaseForm;
|
|
this.FrmAccraditation.Dock = DockStyle.Fill;
|
|
this.FrmAccraditation.Parent = this.splitRightControl.Panel2;
|
|
if (dyncModel == null)
|
|
{
|
|
this.accraditationModel = new ModuleModel(MainImpl.GetSystemdllTab(this.MoudleMainObj.UnionAccraditationDllCoid));//获取关联流转构建类
|
|
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, accraditationModel.MenuName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.Model.Privilege, accraditationModel.ModeCode).Split('~');
|
|
//模块Id/stepcode/点击数据键值/权限
|
|
string[] menuArgs = { "", accraditationModel.ModeCode + "", "", "", "", "0" };
|
|
string[] args = defaultArgs.Concat(menuArgs).ToArray();
|
|
dyncModel = new DynamicBaseAccraditionPopModel(args);
|
|
if (!string.IsNullOrWhiteSpace(Model.Params[1]) && "1".Equals(Model.Params[1]))
|
|
{
|
|
dyncModel.StepOver = "1";
|
|
}
|
|
}
|
|
this.FrmAccraditation.InitaMain(dyncModel);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:行改变刷新当前审核参数</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2023-3-01 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void AuditFlushed()
|
|
{
|
|
try
|
|
{
|
|
//string selectSql = this.accraditationModel.MenuSql + " and billno = '{0}'";
|
|
//selectSql = string.Format(selectSql, this.leftTreeGridIdValue);
|
|
//DataRow dataRow = MainImpl.GetDataRowResult(selectSql);
|
|
|
|
string selectSql = this.accraditationModel.MenuSql + " and {0} = '{1}'";
|
|
string key = BaseImpl.GetBasePrimaryKey(this.FrmAccraditation.SysModel.ModuleCode);
|
|
selectSql = string.Format(selectSql, key, Model.Params[0] + "");
|
|
DataRow dataRow = MainImpl.GetDataRowResult(selectSql);
|
|
if (dataRow != null && dataRow.Table.Columns.Contains("stepcode"))
|
|
{
|
|
//string stepcode = dataRow["stepcode"] + "";
|
|
this.FrmAccraditation.SysModel.PrimaryValue = Model.Params[0]; //this.leftTreeGridIdValue;
|
|
this.FrmAccraditation.SysModel.StepCode = Model.StepCode;
|
|
this.InitializeAccraditation(this.FrmAccraditation.SysModel);
|
|
}
|
|
else
|
|
{
|
|
this.InitializeAccraditation();
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
this.InitializeAccraditation();
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 节点切换时候触发事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnTreeListObjClick(object sender, EventArgs e)
|
|
{
|
|
TreeList treeListGrid = sender as TreeList;
|
|
Point gcPoint = treeListGrid.PointToScreen((sender as TreeList).Location);
|
|
Point mousePoint = System.Windows.Forms.Control.MousePosition;
|
|
Point pt = new Point(mousePoint.X - gcPoint.X, mousePoint.Y - gcPoint.Y);
|
|
TreeListHitInfo _hitInfo = treeListGrid.CalcHitInfo(pt);
|
|
if (_hitInfo != null && _hitInfo.Node != null)
|
|
{
|
|
OnFocusedNodeChanged(null, null);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取查询条件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-22 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <param name="rowItem">The row item.</param>
|
|
/// <returns>System.String.</returns>
|
|
protected string GetSearchSql(GridDetailModel model, DataRow rowItem)
|
|
{
|
|
string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : MoudleMainObj.ParmaryKey;
|
|
string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql;
|
|
|
|
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
|
|
|
|
if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue))
|
|
{
|
|
sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + string.Format(" and {0}='{1}'", model.UnionValue, rowItem[fieldName] + "");
|
|
}
|
|
if (!string.IsNullOrEmpty(model.UnionCond))
|
|
{
|
|
string UnionCond = ReplaceHelper.ReplaceRowParam(rowItem, model.UnionCond);
|
|
sqlValue += UnionCond;
|
|
}
|
|
return sqlValue;
|
|
}
|
|
/// <summary>
|
|
/// 刷新左边选中的明细信息
|
|
/// </summary>
|
|
public void RefurbishDetail()
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.treeLeft.GetViewFocusedDataRow();
|
|
//配置的格外明细,不和右侧关联。 点击主表时刷新(主要为了页签名字后的数量)
|
|
for (int i = 0; i <= this.Tab_Bottom.TabControlObj.TabPages.Count - 1; i++)
|
|
{
|
|
XtraTabPage tabPage = this.Tab_Bottom.TabControlObj.TabPages[i];
|
|
if (!FixedTabs.Contains(tabPage)) this.SetDetailDataSource(tabPage);
|
|
|
|
}
|
|
if (rowItem == null)
|
|
{
|
|
//固定明细,和右侧关联
|
|
for (int i = 0; i <= this.Tab_Bottom.TabControlObj.TabPages.Count - 1; i++)
|
|
{
|
|
XtraTabPage tabPage = this.Tab_Bottom.TabControlObj.TabPages[i];
|
|
if (FixedTabs.Contains(tabPage) && tabPage.Tag != null && tabPage.Tag is GridControlEx)
|
|
{
|
|
GridControlEx gridControlEx = tabPage.Tag as GridControlEx;
|
|
gridControlEx.gridControl.DataSource = null;
|
|
}
|
|
}
|
|
//this.GridView_FocusedRowObjectChanged(null, null);
|
|
this.tipsLabel.Visible = true;
|
|
this.tifSeePanel.Visible = false;
|
|
this.tcButtom.Visible = false;
|
|
this.WebBrowser.Visible = false;
|
|
return;
|
|
}
|
|
|
|
|
|
for (int i = 0; i <= this.Tab_Bottom.TabControlObj.TabPages.Count - 1; i++)
|
|
{
|
|
XtraTabPage tabPage = this.Tab_Bottom.TabControlObj.TabPages[i];
|
|
if (FixedTabs.Contains(tabPage) && tabPage.Tag != null && tabPage.Tag is GridControlEx)
|
|
{
|
|
GridControlEx gm_Control = tabPage.Tag as GridControlEx;
|
|
|
|
GridDetailModel gridDetailModel = this.Details.Cast<GridDetailModel>().Where(x => tabPage.Text.Equals(x.DetailName)).ToList()[0];//固定加载
|
|
|
|
string sqlValue = this.GetSearchSql(gridDetailModel, rowItem);
|
|
|
|
DataTable dataTable = SqlHelper.ExecuteDataTable(sqlValue);
|
|
//设置图标
|
|
dataTable.Columns.Add("icon", System.Type.GetType("System.Byte[]"));
|
|
foreach (DataRow dataRow in dataTable.Rows)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(dataRow["icon"] + ""))
|
|
{
|
|
string[] suffixs = dataRow.Table.Columns.Contains("name") ? (dataRow["name"] + "").Split('.') : (dataRow[0] + "").Split('.');
|
|
string suffix = "." + suffixs[suffixs.Length - 1];
|
|
//文件图标
|
|
byte[] imgBytes;
|
|
if (IconBytesList.ContainsKey(suffix))
|
|
{
|
|
imgBytes = IconBytesList[suffix];
|
|
}
|
|
else
|
|
{
|
|
imgBytes = picture.GetFileBytes(suffix, false);
|
|
IconBytesList.Add(suffix, imgBytes);
|
|
}
|
|
dataRow["icon"] = imgBytes;
|
|
}
|
|
}
|
|
gm_Control.SetGridViewDataSource(dataTable, true);
|
|
gm_Control.LastSearchSql = sqlValue;
|
|
gm_Control.GridView.BestFitColumns();
|
|
|
|
if (dataTable == null || dataTable.Rows.Count < 1)
|
|
{
|
|
XtraTabPage RefreshPage = this.TabObj.SelectedTabPage;
|
|
if (RefreshPage.Tag is FrmWebBrowser)
|
|
{
|
|
FrmWebBrowser webView = RefreshPage.Tag as FrmWebBrowser;
|
|
this.tipsLabel.Visible = true;
|
|
this.tcButtom.Visible = false;
|
|
this.tifSeePanel.Visible = false;
|
|
this.WebBrowser.Visible = false;
|
|
}
|
|
else if (RefreshPage.Tag is FrmWebBrowser2)
|
|
{
|
|
FrmWebBrowser2 webView = RefreshPage.Tag as FrmWebBrowser2;
|
|
this.tipsLabel.Visible = true;
|
|
this.tcButtom.Visible = false;
|
|
this.tifSeePanel.Visible = false;
|
|
this.WebBrowser.Visible = false;
|
|
|
|
}
|
|
else if (RefreshPage.Tag is FrmMiniBlink)
|
|
{
|
|
FrmMiniBlink webView = RefreshPage.Tag as FrmMiniBlink;
|
|
this.tipsLabel.Visible = true;
|
|
this.tcButtom.Visible = false;
|
|
this.tifSeePanel.Visible = false;
|
|
this.WebBrowser.Visible = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
//string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
//MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 判断文件是否传输完成
|
|
/// </summary>
|
|
/// <param name="source"></param>
|
|
/// <param name="e"></param>
|
|
private bool OnComplete(string filePath)
|
|
{
|
|
bool ready = false;
|
|
int count = 0;
|
|
while (!ready && count <= 6)
|
|
{
|
|
try
|
|
{
|
|
using (FileStream fs = new FileStream(filePath, FileMode.Open))
|
|
{
|
|
}
|
|
ready = true;
|
|
}
|
|
catch (IOException)
|
|
{
|
|
ready = false;
|
|
}
|
|
finally
|
|
{
|
|
count++;
|
|
System.Threading.Thread.Sleep(1000);
|
|
}
|
|
}
|
|
return ready;
|
|
}
|
|
#endregion
|
|
/// <summary>
|
|
/// 搜索前记录选中行
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnSearchBeforeCallBack(object sender, SearchArgs e)
|
|
{
|
|
this.lastNode = this.treeLeft.TreeListObj.FocusedNode;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 节点展开后去设置图片
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnTreeListObjAfterExpand(object sender, NodeEventArgs e)
|
|
{
|
|
//TreeListNode Nodes && e.Node.ImageIndex
|
|
if (this.treeLeft.TreeListObj.SelectImageList != null)
|
|
{
|
|
SettingIcon(this.treeLeft.TreeListObj.SelectImageList as ImageList, e.Node, true);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 搜索后重新绑定数结构
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnRefLeftTree(object sender, EventArgs e)
|
|
{
|
|
//this.treeLeft.TreeListObj.ExpandAll();//全部展开
|
|
this.treeLeft.TreeListObj.BestFitColumns();
|
|
InitListViewSelectImage();
|
|
this.treeLeft.TreeListObj.CollapseAll();//全部折叠
|
|
if (this.lastNode != null)
|
|
{
|
|
this.treeLeft.TreeListObj.FocusedNode = this.lastNode;
|
|
}
|
|
OnFocusedNodeChanged(null, null);
|
|
if (!string.IsNullOrWhiteSpace(firstCondition) && !string.IsNullOrWhiteSpace(Model.Params[0]))
|
|
{
|
|
this.AuditFlushed();//刷新审核界面
|
|
}
|
|
this.ClearPopup();
|
|
//this.SearchMainObj.ResetControlValue();
|
|
if (this.SearchMainObj.ButtonObj != null) this.SearchMainObj.ButtonObj.Focus();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 右键菜单回调
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnRightMenuCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (FixedTabs.Contains(this.Tab_Bottom.TabControlObj.SelectedTabPage))
|
|
{
|
|
|
|
XtraTabPage tabPage = this.Tab_Bottom.TabControlObj.SelectedTabPage;
|
|
GridControlEx gm_Control = tabPage.Tag as GridControlEx;
|
|
DataTable dataTable = BaseImpl.GetDataTableResult(gm_Control.LastSearchSql);
|
|
//设置图标
|
|
dataTable.Columns.Add("icon", System.Type.GetType("System.Byte[]"));
|
|
foreach (DataRow dataRow in dataTable.Rows)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(dataRow["icon"] + ""))
|
|
{
|
|
string[] suffixs = dataRow.Table.Columns.Contains("name") ? (dataRow["name"] + "").Split('.') : (dataRow[0] + "").Split('.');
|
|
string suffix = "." + suffixs[suffixs.Length - 1];
|
|
//文件图标
|
|
byte[] imgBytes;
|
|
if (IconBytesList.ContainsKey(suffix))
|
|
{
|
|
imgBytes = IconBytesList[suffix];
|
|
}
|
|
else
|
|
{
|
|
imgBytes = picture.GetFileBytes(suffix, false);
|
|
IconBytesList.Add(suffix, imgBytes);
|
|
}
|
|
dataRow["icon"] = imgBytes;
|
|
}
|
|
}
|
|
gm_Control.SetGridViewDataSource(dataTable, true);
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageUtil.Show(ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:点击左侧明细,加载右侧明细/para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2023-2-6 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void GridView_FocusedRowObjectChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventArgs e)
|
|
{
|
|
XtraTabPage tabPage = this.Tab_Bottom.TabControlObj.SelectedTabPage;
|
|
GridControlEx gm_Control = tabPage.Tag as GridControlEx;
|
|
|
|
DataRow rowItem = gm_Control.GetViewFocusedDataRow();
|
|
|
|
XtraTabPage RefreshPage = this.TabObj.SelectedTabPage;
|
|
if (rowItem != null && RefreshPage != null)
|
|
{
|
|
this.SetTabPageDataSource(RefreshPage);
|
|
}
|
|
else
|
|
{
|
|
SetTabPageDataSource(RefreshPage, true);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置表格数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-29 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="tabPage">The tab page.</param>
|
|
/// <param name="gridControl">The grid control.</param>
|
|
protected void SetTabPageDataSource(XtraTabPage tabPage, bool isNull = false)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage detailTabPage = this.Tab_Bottom.TabControlObj.SelectedTabPage;
|
|
if (!FixedTabs.Contains(detailTabPage)) isNull = true;
|
|
GridControlEx gm_Control = detailTabPage.Tag as GridControlEx;
|
|
|
|
if (isNull)
|
|
{
|
|
this.tipsLabel.Visible = true;
|
|
this.tifSeePanel.Visible = false;
|
|
this.tcButtom.Visible = false;
|
|
this.WebBrowser.Visible = false;
|
|
this.tcButtom.SetGridDataSource(tabPage, new DataTable());
|
|
return;
|
|
}
|
|
GridDetailModel model = this.tcButtom.GetGridDetailModel(tabPage);
|
|
|
|
|
|
DataRow rowItem = gm_Control.GetViewFocusedDataRow();
|
|
string fileName = rowItem["name"] + "";
|
|
if (rowItem != null && model != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(model.UnionModule) && (string.IsNullOrEmpty(model.UnionValue) && string.IsNullOrEmpty(model.UnionCond))) return;
|
|
if (tabPage.Tag is FrmWebBrowser2 || tabPage.Tag is FrmWebBrowser || tabPage.Tag is FrmMiniBlink)
|
|
{
|
|
this.tipsLabel.Visible = false;
|
|
this.tifSeePanel.Visible = false;
|
|
this.WebBrowser.Visible = false;
|
|
string url = ReplaceHelper.ReplaceRowParam(rowItem, ReplaceHelper.ReplaceUserInfo(model.DetailSql));
|
|
url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url;
|
|
//string extension = Path.GetExtension(rowItem["sName"] + "");
|
|
|
|
if (false&&url.EndsWith(".dwg", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
tcButtom.Visible = false;
|
|
this.WebBrowser.Navigate(url);
|
|
this.WebBrowser.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
if (tabPage.Tag is FrmWebBrowser)
|
|
{
|
|
FrmWebBrowser webView = tabPage.Tag as FrmWebBrowser;
|
|
webView.Show();
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = model;
|
|
webView.LoadUrl(url);
|
|
}
|
|
else if (tabPage.Tag is FrmWebBrowser2)
|
|
{
|
|
FrmWebBrowser2 webView = tabPage.Tag as FrmWebBrowser2;
|
|
webView.Show();
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = model;
|
|
webView.LoadUrl(url);
|
|
}
|
|
else if (tabPage.Tag is FrmMiniBlink)
|
|
{
|
|
FrmMiniBlink webView = tabPage.Tag as FrmMiniBlink;
|
|
webView.Show();
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = model;
|
|
webView.LoadUrl(url);
|
|
}
|
|
tcButtom.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 根据左侧数据重新构建节点图标
|
|
/// </summary>
|
|
private void InitListViewSelectImage()
|
|
{
|
|
//this.treeLeft.TreeView.CheckBoxes = false;
|
|
DataTable sourceTable = this.treeLeft.GridControl.DataSourceTable();
|
|
ImageList imageList = new ImageList();
|
|
string[] files = null;
|
|
try
|
|
{
|
|
files = Directory.GetFiles(PubUtil.TreeViewImagePath, "*.png");
|
|
imageList.Images.Add("treeViewDefault", global::Lskj.PubArtworkPreview.Properties.Resources.treeViewDefault);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
if (files != null && files.Length > 0)
|
|
{
|
|
foreach (string file in files)
|
|
{
|
|
imageList.Images.Add(Path.GetFileNameWithoutExtension(file), Image.FromFile(file));
|
|
}
|
|
}
|
|
this.treeLeft.TreeListObj.SelectImageList = imageList;
|
|
foreach (TreeListNode node in this.treeLeft.TreeListObj.Nodes)
|
|
{
|
|
SettingIcon(imageList, node);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 设置节点图标
|
|
/// </summary>
|
|
/// <param name="imageList">图片集</param>
|
|
/// <param name="node">节点</param>
|
|
private void SettingIcon(ImageList imageList, TreeListNode Nodes, bool recursion = false)
|
|
{
|
|
try
|
|
{
|
|
//当前节点
|
|
DataRowView dataRowView = this.treeLeft.TreeListObj.GetDataRecordByNode(Nodes) as DataRowView;
|
|
DataRow Row = dataRowView != null ? dataRowView.Row : null;
|
|
string imageNameNew = string.Empty;
|
|
if (Row != null && Row.Table.Columns.Contains("pic"))
|
|
{
|
|
imageNameNew = Row["pic"] + "";
|
|
//imageNameNew = "aaa.png";
|
|
}
|
|
if (imageList.Images.ContainsKey(Path.GetFileNameWithoutExtension(imageNameNew + "")))
|
|
{
|
|
int subscript = imageList.Images.IndexOfKey(Path.GetFileNameWithoutExtension(imageNameNew + ""));
|
|
Nodes.ImageIndex = subscript; //未选中状态图标
|
|
Nodes.SelectImageIndex = subscript;//选中状态图标
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
if (imageList.Images.ContainsKey("treeViewDefault"))
|
|
{
|
|
int subscript = imageList.Images.IndexOfKey("treeViewDefault");
|
|
Nodes.ImageIndex = subscript; //未选中状态图标
|
|
Nodes.SelectImageIndex = subscript;//选中状态图标
|
|
}
|
|
}
|
|
if (recursion)
|
|
{
|
|
//当前节点的子节点
|
|
foreach (TreeListNode node in Nodes.Nodes)
|
|
{
|
|
if (node.ImageIndex != 0 || node.SelectImageIndex != 0) break;
|
|
SettingIcon(imageList, node);
|
|
}
|
|
}
|
|
}
|
|
#region
|
|
/// <summary>
|
|
/// 树节点改变时
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnFocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
|
|
{
|
|
this.RefurbishDetail();
|
|
}
|
|
/// <summary>
|
|
/// 选中行颜色
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnCustomDrawNodeCell(object sender, DevExpress.XtraTreeList.CustomDrawNodeCellEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.Node == this.treeLeft.TreeListObj.FocusedNode)
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml("#9feb6a");
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 分隔条位置改变
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnSplitterPositionChanged(object sender, EventArgs e)
|
|
{
|
|
// if (string.IsNullOrWhiteSpace(Model.Params[0])) return;//如果没有传参数就不会显示右边审核,记录改分割条位置
|
|
if (sender == this.splitLeftControl)
|
|
{
|
|
IniHelper.Write(string.Format("Step_spliterPositionLeft_{0}", this.Model.ModuleCode), this.splitLeftControl.SplitterPosition + "");
|
|
}
|
|
else if (sender == this.splitMainControl)
|
|
{
|
|
IniHelper.Write(string.Format("Step_spliterPositionMain_{0}", this.Model.ModuleCode), this.splitMainControl.SplitterPosition + "");
|
|
}
|
|
else if (sender == this.splitRightControl && !string.IsNullOrWhiteSpace(Model.Params[0]))
|
|
{
|
|
IniHelper.Write(string.Format("Step_spliterPositionRight_{0}", this.Model.ModuleCode), this.splitRightControl.SplitterPosition + "");
|
|
}
|
|
}
|
|
protected override void OnHandleDestroyed(EventArgs e)
|
|
{
|
|
if (this.tifSeePanel.Controls.Count > 0)
|
|
{
|
|
this.tifSeePanel.Controls.Clear();
|
|
}
|
|
base.OnHandleDestroyed(e);
|
|
}
|
|
#endregion
|
|
/// <summary>
|
|
/// 左下方明细表切换页签后刷新
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void TabControlObj_SelectedPageChanged(object sender, TabPageChangedEventArgs e)
|
|
{
|
|
if (!FixedTabs.Contains(this.Tab_Bottom.TabControlObj.SelectedTabPage))
|
|
{
|
|
for (int i = 0; i <= this.Tab_Bottom.TabControlObj.TabPages.Count - 1; i++)
|
|
{
|
|
XtraTabPage tabPage = this.Tab_Bottom.TabControlObj.TabPages[i];
|
|
|
|
if (this.Tab_Bottom.TabControlObj.SelectedTabPage == tabPage)
|
|
{
|
|
this.SetDetailDataSource(tabPage);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.GridView_FocusedRowObjectChanged(null, null);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置表格数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-29 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="tabPage">The tab page.</param>
|
|
/// <param name="gridControl">The grid control.</param>
|
|
protected void SetDetailDataSource(XtraTabPage tabPage, bool isNull = false)
|
|
{
|
|
if (isNull)
|
|
{
|
|
this.tcButtom.SetGridDataSource(tabPage, new DataTable());
|
|
return;
|
|
}
|
|
GridDetailModel model = this.tcButtom.GetGridDetailModel(tabPage);
|
|
DataRow rowItem = this.treeLeft.GetViewFocusedDataRow();
|
|
|
|
Object moduleObject = tabPage.Controls.Cast<Object>().FirstOrDefault();
|
|
ModuleGridEx moduleGridEx = null;
|
|
if (rowItem != null && model != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(model.UnionModule) && (string.IsNullOrEmpty(model.UnionValue) && string.IsNullOrEmpty(model.UnionCond))) return;
|
|
if (tabPage.Tag is FrmWebBrowser)
|
|
{
|
|
// 加载网页
|
|
string url = ReplaceHelper.ReplaceRowParam(rowItem, ReplaceHelper.ReplaceUserInfo(model.DetailSql));
|
|
url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url;
|
|
FrmWebBrowser webView = tabPage.Tag as FrmWebBrowser;
|
|
webView.FrmLoad(url);
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = model;
|
|
}
|
|
else if (tabPage.Tag is FrmWebBrowser2)
|
|
{
|
|
// 加载网页
|
|
string url = ReplaceHelper.ReplaceRowParam(rowItem, ReplaceHelper.ReplaceUserInfo(model.DetailSql));
|
|
url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url;
|
|
FrmWebBrowser2 webView = tabPage.Tag as FrmWebBrowser2;
|
|
webView.FrmLoad(url);
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = model;
|
|
}
|
|
else if (tabPage.Tag is FrmMiniBlink)
|
|
{
|
|
// 加载网页
|
|
string url = ReplaceHelper.ReplaceRowParam(rowItem, ReplaceHelper.ReplaceUserInfo(model.DetailSql));
|
|
url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url;
|
|
FrmMiniBlink webView = tabPage.Tag as FrmMiniBlink;
|
|
webView.LoadUrl(url);
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = model;
|
|
}
|
|
else
|
|
{
|
|
string searchSql = this.GetSearchSql(model, rowItem);
|
|
|
|
if (tabPage.Tag is GridControlEx)
|
|
{
|
|
(tabPage.Tag as GridControlEx).LastSearchSql = searchSql;
|
|
}
|
|
GridView view = this.treeLeft.GridView;
|
|
//DataTable dataTable = MainImpl.GetDataTableResult(searchSql);//明细数据源
|
|
this.tcButtom.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(searchSql), view);
|
|
if (tabPage.Tag is GridControlEx && (tabPage.Tag as GridControlEx).ParentControl != null)
|
|
(tabPage.Tag as GridControlEx).ParentControl.SetAllControlValue(rowItem);
|
|
//配置明细直接根据条件加载
|
|
if (model.SystemModel != null && 1 == model.SystemModel.isFirstLoad)
|
|
{
|
|
(tabPage.Tag as GridControlEx).ParentControl.SearchGrid();
|
|
tabPage.Text = model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + "条)";
|
|
}
|
|
}
|
|
if (moduleGridEx != null) moduleGridEx.ParentButtonState(rowItem);
|
|
}
|
|
else if (rowItem != null && tabPage.Tag is TabMultipledetails)
|
|
{
|
|
TabMultipledetails tabMultipledetails = tabPage.Tag as TabMultipledetails;
|
|
GridControlEx grdExMain = (tabMultipledetails.SplitMain.Panel1.Tag as GridControlEx);
|
|
GridControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as GridControlEx);
|
|
GridDetailModel MainModel = grdExMain.Tag as GridDetailModel;
|
|
GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel;
|
|
string searchMainSql = this.GetSearchSql(MainModel, rowItem);
|
|
string searchAddSql = this.GetSearchSql(AdditionalModel, rowItem);
|
|
DataTable firstTable = MainImpl.GetDataTableResult(searchMainSql);
|
|
grdExMain.LastSearchSql = searchMainSql;
|
|
grdExAdditional.LastSearchSql = searchAddSql;
|
|
grdExMain.SetGridViewDataSource(firstTable);
|
|
tabPage.Text = MainModel.DetailName + "(" + firstTable.Rows.Count + "条)";
|
|
if (!MainModel.IsUnioDetail) grdExAdditional.SetGridViewDataSource(MainImpl.GetDataTableResult(searchAddSql));
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 清除左侧表条件弹窗
|
|
/// </summary>
|
|
public void ClearPopup()
|
|
{
|
|
foreach (ControlModel model in this.SearchMainObj.ControlModels)
|
|
{
|
|
BaseUserControl control = this.SearchMainObj.FindControl(model);
|
|
if (control != null && model.FieldType != ControlType.LabTreeType)
|
|
{
|
|
control.EditText = string.Empty;
|
|
control.Model.Text = string.Empty;
|
|
switch (model.FieldType)
|
|
{
|
|
case ControlType.LabAutoCompleteValue:
|
|
case ControlType.LabAutoCompleteText:
|
|
case ControlType.LabAutoCompleteValueParam:
|
|
case ControlType.LabAutoCompleteTextParam:
|
|
if (!this.SearchMainObj.isRevTextEdit)
|
|
{
|
|
LabelAutoTextEdit autoTextEdit = control as LabelAutoTextEdit;
|
|
autoTextEdit.TextEdit.HidePopup();
|
|
}
|
|
else
|
|
{
|
|
LabelAutoTextRevEdit autoTextEdit = control as LabelAutoTextRevEdit;
|
|
autoTextEdit.TextEdit.HidePopup();
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:拿到底部表格数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-21 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>List<GridDetailModel>.</returns>
|
|
private List<GridDetailModel> GetDetails()
|
|
{
|
|
List<GridDetailModel> details = new List<GridDetailModel>();//表格明细对象的集合
|
|
DataTable table = BaseModuleImpl.GetBaseDetailPages(Model.ModuleCode);// 根据传入的模块编号获得基础档案底部标签的数据
|
|
foreach (DataRow item in table.Rows)
|
|
{
|
|
DataTable gridColumns = BaseModuleImpl.GetBaseGridColumns(item["UnionModule"] + "");
|
|
details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView));
|
|
}
|
|
return details;
|
|
}
|
|
}
|
|
}
|