diff --git a/main/java/shkd/repc/repmd/template/AreaDataImportPlugin.java b/main/java/shkd/repc/repmd/template/AreaDataImportPlugin.java new file mode 100644 index 0000000..15b2f14 --- /dev/null +++ b/main/java/shkd/repc/repmd/template/AreaDataImportPlugin.java @@ -0,0 +1,91 @@ +package shkd.repc.repmd.template; + + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.utils.StringUtils; +import kd.bos.form.CloseCallBack; +import kd.bos.form.FormShowParameter; +import kd.bos.form.ShowType; +import kd.bos.form.StyleCss; +import kd.bos.form.control.Control; +import kd.bos.form.control.events.ItemClickEvent; +import kd.bos.form.events.ClosedCallBackEvent; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.list.ListShowParameter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.sdk.plugin.Plugin; +import shkd.repc.repmd.template.util.ExportTemplateUtil; + +import java.util.EventObject; +import java.util.HashMap; +import java.util.List; + + +public class AreaDataImportPlugin extends AbstractFormPlugin implements Plugin { + + @Override + public void registerListener(EventObject e) { + super.registerListener(e); + this.addItemClickListeners("qeug_advcontoolbarap"); + } + + @Override + public void itemClick(ItemClickEvent evt) { + super.itemClick(evt); + if (StringUtils.equals("qeug_templatedownload", evt.getItemKey())) { + FormShowParameter showParameter = createFormParameter(); + this.getView().showForm(showParameter); + } + } + + private FormShowParameter createFormParameter() { + HashMap map = new HashMap<>(2); + map.put("logotype", "areaTemplate"); + FormShowParameter showParameter = new FormShowParameter(); + showParameter.setFormId("qeug_dynamicbill"); + showParameter.setCaption("面积数据模板列表"); + StyleCss inlineStyleCss = new StyleCss(); + inlineStyleCss.setHeight("580"); + inlineStyleCss.setWidth("960"); + showParameter.getOpenStyle().setInlineStyleCss(inlineStyleCss); + showParameter.getOpenStyle().setShowType(ShowType.Modal); + showParameter.setCustomParams(map); + showParameter.setCloseCallBack(new CloseCallBack(this, "template")); + return showParameter; + } + + @Override + public void closedCallBack(ClosedCallBackEvent e) { + super.closedCallBack(e); + String callBackId = e.getActionId(); + if ("template".equals(callBackId)) { + DynamicObjectCollection returnData = (DynamicObjectCollection) e.getReturnData(); + if (null != returnData && returnData.size() != 0) { + for (int i = 0; i < returnData.size(); i++) { + Long id = Long.parseLong(returnData.get(i).getString("qeug_id")); + DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(id, "qeug_areatemplate"); + if (null!=dynamicObject){ + DynamicObjectCollection areaEntry = dynamicObject.getDynamicObjectCollection("qeug_entryentity"); + Control productView= this.getView().getControl("productentry"); + Control areaView= this.getView().getControl("qeug_subentryentity"); + StringBuilder message =new StringBuilder(); + String url; + if (areaEntry.size()!=0){ + //导出自定义模板 + url = ExportTemplateUtil.exportTemplate(areaEntry, message, productView, areaView); + }else { + //导出默认模板 + url = ExportTemplateUtil.exportTemplate(message, productView, areaView); + } + if (null!=url){ + this.getView().openUrl(url); + } + } + } + } + + } + } + +} diff --git a/main/java/shkd/repc/repmd/template/AreaTemplateFromPlugin.java b/main/java/shkd/repc/repmd/template/AreaTemplateFromPlugin.java new file mode 100644 index 0000000..8dcf18f --- /dev/null +++ b/main/java/shkd/repc/repmd/template/AreaTemplateFromPlugin.java @@ -0,0 +1,77 @@ +package shkd.repc.repmd.template; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.utils.StringUtils; +import kd.bos.form.control.Button; +import kd.bos.form.control.Control; +import kd.bos.form.control.EntryGrid; +import kd.bos.form.events.BeforeClosedEvent; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.servicehelper.QueryServiceHelper; +import kd.sdk.plugin.Plugin; +import shkd.repc.repmd.template.util.Template; + +import java.util.ArrayList; +import java.util.EventObject; +import java.util.List; + +public class AreaTemplateFromPlugin extends AbstractFormPlugin implements Plugin { + + private static final List