二开案例.附件控件必录校验
保存时,校验附件是否已上传。
using Kingdee.BOS.Core.DynamicForm.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.JSON; using System.Collections.Generic; namespace Test24.PlugIns.BL { [Kingdee.BOS.Util.HotUpdate] public class 文件上传控件必录 : AbstractDynamicFormPlugIn { bool fileUploaded = false; public override void CustomEvents(CustomEventsArgs e) { var attachmentFieldKey = "FAttachment"; //附件控件ID if (e.EventName == "FileChanged" && e.Key == attachmentFieldKey) { fileUploaded = false; var postData = KDObjectConverter.DeserializeObject<JSONObject>(e.EventArgs); if (postData != null) { var uploadInfo = new JSONArray(postData["NewValue"].ToString()); if (uploadInfo.Count > 0) { var fileInfo = uploadInfo[0] as Dictionary<string, object>; if (fileInfo != null) { var fileName = fileInfo["ServerFileName"].ToString(); fileUploaded = true; //附件已上传 } } } } } public override void BeforeDoOperation(BeforeDoOperationEventArgs e) { if (e.Operation.FormOperation.Operation == "Save") { if (!fileUploaded) { this.View.ShowErrMessage("请先上传附件"); e.Cancel = true; } } } } }
二开案例.附件控件必录校验
保存时,校验附件是否已上传。using Kingdee.BOS.Core.DynamicForm.PlugIn;using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;using Kingdee...
点击下载文档
本文2024-09-16 18:27:30发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-22271.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章