using System; using System.Data; using System.Collections; using BP.DA; using BP.En; using BP.Port; namespace BP.WF.Template { /// /// 显示位置 /// public enum ShowWhere { /// /// 树 /// Tree, /// /// 工具栏 /// Toolbar, /// /// 抄送 /// CC } /// /// 工具栏属性 /// public class NodeToolbarAttr : BP.En.EntityOIDNameAttr { #region 基本属性 /// /// 节点 /// public const string FK_Node = "FK_Node"; /// /// 到达目标 /// public const string Target = "Target"; /// /// 标题 /// public const string Title = "Title"; /// /// url /// public const string UrlExt = "UrlExt"; /// /// 顺序号 /// public const string Idx = "Idx"; /// /// 显示在那里? /// //public const string ShowWhere = "ShowWhere"; /// /// 在工作处理器显示 /// public const string IsMyFlow = "IsMyFlow"; /// /// 在工作查看器显示 /// public const string IsMyView = "IsMyView"; /// /// 在树形表单显示 /// public const string IsMyTree = "IsMyTree"; /// /// 在抄送功能显示 /// public const string IsMyCC = "IsMyCC"; /// /// IconPath 图片附件 /// public const string IconPath = "IconPath"; /// 执行类型 /// public const string ExcType = "ExcType"; #endregion } /// /// 工具栏. /// public class NodeToolbar : EntityOID { #region 基本属性 /// /// UI界面上的访问控制 /// public override UAC HisUAC { get { UAC uac = new UAC(); // uac.OpenForSysAdmin(); uac.OpenForAdmin();// 2020.5.15zsy修改 return uac; } } /// /// 工具栏的事务编号 /// public int FK_Node { get { return this.GetValIntByKey(NodeToolbarAttr.FK_Node); } set { SetValByKey(NodeToolbarAttr.FK_Node, value); } } public string Title { get { return this.GetValStringByKey(NodeToolbarAttr.Title); } set { SetValByKey(NodeToolbarAttr.Title, value); } } public string Url { get { string s= this.GetValStringByKey(NodeToolbarAttr.UrlExt); if (this.ExcType !=1 && s.Contains("?") == false && this.Target.ToLower() != "javascript") s = s+"?1=2"; return s; } set { SetValByKey(NodeToolbarAttr.UrlExt, value); } } public string Target { get { return this.GetValStringByKey(NodeToolbarAttr.Target); } set { SetValByKey(NodeToolbarAttr.Target, value); } } /// /// 执行类型 /// public int ExcType { get { return this.GetValIntByKey(NodeToolbarAttr.ExcType); } set { SetValByKey(NodeToolbarAttr.ExcType, value); } } /// /// 显示在工具栏中 /// public bool IsMyFlow { get { return this.GetValBooleanByKey(NodeToolbarAttr.IsMyFlow); } set { SetValByKey(NodeToolbarAttr.IsMyFlow, value); } } //显示在流程树中 public bool IsMyTree { get { return this.GetValBooleanByKey(NodeToolbarAttr.IsMyTree); } set { SetValByKey(NodeToolbarAttr.IsMyTree, value); } } //显示在工作查看器 public bool IsMyView { get { return this.GetValBooleanByKey(NodeToolbarAttr.IsMyView); } set { SetValByKey(NodeToolbarAttr.IsMyView, value); } } //显示在抄送工具栏中 public bool IsMyCC { get { return this.GetValBooleanByKey(NodeToolbarAttr.IsMyCC); } set { SetValByKey(NodeToolbarAttr.IsMyCC, value); } } //图片附件路径 public string IconPath { get { return this.GetValStringByKey(NodeToolbarAttr.IconPath); } set { SetValByKey(NodeToolbarAttr.IconPath, value); } } #endregion #region 构造函数 /// /// 工具栏 /// public NodeToolbar() { } /// /// 工具栏 /// /// 工具栏ID public NodeToolbar(int oid) { this.OID = oid; this.Retrieve(); } /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("WF_NodeToolbar", "自定义工具栏"); map.AddTBIntPKOID(); map.AddTBInt(NodeToolbarAttr.FK_Node, 0, "节点", false, true); map.AddTBString(NodeToolbarAttr.Title, null, "标题", true, false, 0, 100, 100, true); // 执行类型. map.AddDDLSysEnum(NodeToolbarAttr.ExcType, 0, "执行类型", true, true, "ToobarExcType", "@0=超链接@1=函数"); map.AddTBString(NodeToolbarAttr.UrlExt, null, "连接/函数", true, false, 0, 500, 300, true); map.AddTBString(NodeToolbarAttr.Target, null, "目标", true, false, 0, 100, 100, true); //显示位置. //map.AddDDLSysEnum(NodeToolbarAttr.ShowWhere, 1, "显示位置", false,true, NodeToolbarAttr.ShowWhere, // "@0=树形表单@1=工具栏@2=抄送工具栏"); map.AddBoolean(NodeToolbarAttr.IsMyFlow, false, "工作处理器", true, true); map.AddBoolean(NodeToolbarAttr.IsMyTree, false, "流程树", true, true); map.AddBoolean(NodeToolbarAttr.IsMyView, false, "工作查看器", true, true); map.AddBoolean(NodeToolbarAttr.IsMyCC, false, "抄送工具栏", true, true); map.AddTBString(NodeToolbarAttr.IconPath, null, "ICON路径", true, false, 0, 100, 100, true); string msg = "提示:"; msg += "\t\n 1. 给工具栏按钮设置图标两种方式,上传图标模式与设置指定的Icon的ID模式."; msg += "\t\n 2. 我们优先解决Icon的ID解析模式."; msg += "\t\n 3. 比如: ./Img/Btn/Save.png "; map.SetHelperAlert(NodeToolbarAttr.IconPath, msg); map.AddTBInt(NodeToolbarAttr.Idx, 0, "顺序", true, false); map.AddMyFile("图标"); this._enMap = map; return this._enMap; } } #endregion } /// /// 工具栏集合 /// public class NodeToolbars : EntitiesOID { #region 方法 /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new NodeToolbar(); } } #endregion #region 构造方法 /// /// 工具栏集合 /// public NodeToolbars() { } /// /// 工具栏集合. /// /// public NodeToolbars(string fk_node) { this.Retrieve(NodeToolbarAttr.FK_Node, fk_node); } #endregion #region 为了适应自动翻译成java的需要,把实体转换成List /// /// 转化成 java list,C#不能调用. /// /// List public System.Collections.Generic.IList ToJavaList() { return (System.Collections.Generic.IList)this; } /// /// 转化成list /// /// List public System.Collections.Generic.List Tolist() { System.Collections.Generic.List list = new System.Collections.Generic.List(); for (int i = 0; i < this.Count; i++) { list.Add((NodeToolbar)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }