beforeUpload取消上传插件示例介绍

栏目:云苍穹知识作者:金蝶来源:金蝶云社区发布:2024-09-23浏览:1

beforeUpload取消上传插件示例介绍

# 1 业务场景 适用于需要取消附件上传的场景 # 2 解决方案 可以通过附件上传前事件 BeforeAttachmentUploadListener 取消附件的上传 # 3 操作步骤 代码示例如下 ```java public class AttachmentDemand_BeforeUpload extends AbstractFormPlugin implements BeforeAttachmentUploadListener { private static final String BOS_ATTACHMENT = "bos-attachment"; //附件字段 private final static String KEY_ATTACHMENTFILED = "my_attfield"; //附件面板 private final static String KEY_ATTACHMENTPANEL = "attachmentpanel"; @Override public void registerListener(EventObject e) { AttachmentEdit attachmentEdit = this.getView().getControl(KEY_ATTACHMENTFILED); AttachmentPanel attachmentPanel = this.getView().getControl(KEY_ATTACHMENTPANEL); //监听上传前事件 attachmentEdit.addBeforeUploadListener(this); attachmentPanel.addBeforeUploadListener(this); } @Override public void beforeAttachmentUpload(BeforeAttachmentUploadEvent evt) { //取消上传之前的附件 List<Map<String, Object>> sourceAttachments = evt.getSourceAttachments(); //设置需要取消上传的附件集合 evt.getCancelAttachments().add(sourceAttachments.get(0)); //是否取消 evt.setCancel(true); //取消成功的提示语 evt.setMsg(ResManager.loadKDString( "取消上传第一个文件成功。", "AttachmentDemand_BeforeUpload_1", BOS_ATTACHMENT)); } } ```

beforeUpload取消上传插件示例介绍

# 1 业务场景 适用于需要取消附件上传的场景# 2 解决方案 可以通过附件上传前事件 BeforeAttachmentUploadListener 取消附件的上传...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息