diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/em/plugin/ContractBillExtList.java b/shkd-cosmic-debug/src/main/java/shkd/fi/em/plugin/ContractBillExtList.java index 9a47acd..5cabff5 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/em/plugin/ContractBillExtList.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/em/plugin/ContractBillExtList.java @@ -25,6 +25,7 @@ import kd.bos.form.control.events.UploadEvent; import kd.bos.form.control.events.UploadListener; import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.events.MessageBoxClosedEvent; import kd.bos.form.operate.FormOperate; import kd.bos.list.plugin.AbstractListPlugin; import kd.bos.logging.Log; @@ -54,6 +55,14 @@ public class ContractBillExtList extends AbstractListPlugin implements Plugin, U ListSelectedRowCollection selectedRowCollection = listView.getSelectedRows(); List pks = (List)selectedRowCollection.stream().map(ListSelectedRow::getPrimaryKeyValue).collect(Collectors.toList()); switch (key) { + case "deleteattachment": + if (pks.size() != 1) { + this.getView().showTipNotification("请选择一行数据进行归档附件上传操作。"); + return; + } + this.getView().showConfirm("确认要删除归档附件吗?", MessageBoxOptions.OKCancel, + new ConfirmCallBackListener("deleteAttachmentCallBack", this)); + break; case "newsp2": BillShowParameter parameter3 = new BillShowParameter(); parameter3.setCustomParam("newsp", "newsp"); @@ -98,6 +107,24 @@ public class ContractBillExtList extends AbstractListPlugin implements Plugin, U } } + @Override + public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) { + // super.confirmCallBack(messageBoxClosedEvent); + if(messageBoxClosedEvent.getResult() == MessageBoxResult.Yes + && "deleteAttachmentCallBack".equals(messageBoxClosedEvent.getCallBackId())){ + ListSelectedRowCollection selectedRowCollection = ((ListView) this.getView()).getSelectedRows(); + Object pk = selectedRowCollection.get(0).getPrimaryKeyValue(); + List> templist = AttachmentServiceHelper.getAttachments("er_contractbill", + pk + "", "shkd_attachmentpanelap"); + for(Map tempMap : templist) { + System.out.println(tempMap); + AttachmentServiceHelper.remove("er_contractbill", pk, tempMap.get("uid")); + } + this.getView().showConfirm("删除归档附件成功!", MessageBoxOptions.OK, + new ConfirmCallBackListener("upload_success", this)); + } + } + @Override public void itemClick(ItemClickEvent evt) { System.out.println(evt);