二开案例.打开【附件图片在线预览】界面原创
2人赞赏了该文章
64次浏览
编辑于2024年11月30日 14:54:51
实现效果:
插件代码:
using Kingdee.BOS.App.Data; using Kingdee.BOS.Core; using Kingdee.BOS.Core.Bill.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.FileServer; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.ServiceHelper; using Kingdee.BOS.ServiceHelper.FileServer; using System.Collections.Generic; using System.Linq; namespace Test202411 { [Kingdee.BOS.Util.HotUpdate] public class 弹出图片预览窗口 : AbstractBillPlugIn { public override void ButtonClick(ButtonClickEventArgs e) { var currentIndex = 0; //打开第几页 var _isCanDownload = true; //是否允许下载 var _isCanOnLinePrint = true; //是否允许打印 //需要预览的文件 var fileInfos = new List<FilePreviewInfo> { }; var fileIds = DBUtils.ExecuteDynamicObject(this.Context, "select top 10 FFILEID from T_BAS_ATTACHMENT where FATTACHMENTNAME like '%.jpg'") .Select(dyo => dyo["FFILEID"].ToString()).ToArray(); foreach (var fileId in fileIds) { fileInfos.Add(new FilePreviewInfo(FilePreviewType.FileId, fileId)); } //生成预览参数 Kingdee.BOS.Core.FileServer.FilePreviewArgs args = new Kingdee.BOS.Core.FileServer.FilePreviewArgs() .SetArgs(this.View, currentIndex, BosPlatformParameter) .SetAuth(_isCanDownload, _isCanOnLinePrint); //弹出预览窗口 FileServerHelper.PreviewFile(args, fileInfos); } private DynamicObject _bosPlatformParameter; /// <summary> /// BOS平台参数设置。 /// </summary> private DynamicObject BosPlatformParameter { get { if (_bosPlatformParameter == null) { _bosPlatformParameter = SystemParameterServiceHelper.Load(this.Context, 0, 0, FormIdConst.BOS_PlatformParameter); } return _bosPlatformParameter; } } } }
赞 2
2人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!