From 70084fb9e44a3a3c821ffc75fea338e7f2fbff99 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 14 Nov 2024 10:26:27 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-140564=20=E3=80=90=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=9B=BF=E6=8D=A2=E3=80=91=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=89=80=E6=9C=89=E6=8E=A7=E4=BB=B6=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AD=97=E5=85=B8=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=EF=BC=8C=E9=83=BD=E6=B2=A1=E6=9C=89=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/replace/utils/ReplaceUtils.java | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java index 56a38c4f6d..f5445542d8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java @@ -28,12 +28,14 @@ import com.fr.design.mainframe.JTemplate; import com.fr.form.FormElementCaseProvider; import com.fr.form.ui.DictionaryContainer; import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; import com.fr.general.data.Condition; import com.fr.general.data.TableDataColumn; import com.fr.js.JavaScript; import com.fr.js.NameJavaScript; import com.fr.main.impl.WorkBook; +import com.fr.main.parameter.ReportParameterAttr; import com.fr.report.cell.CellElement; import com.fr.report.cell.FloatElement; import com.fr.report.cell.TemplateCellElement; @@ -230,7 +232,9 @@ public class ReplaceUtils { public static void replaceCpt(JTemplate template, List entity) { if (template.getTarget() instanceof WorkBook) { WorkBook workBook = (WorkBook) template.getTarget(); - // 非公式部分替换 + // 参数面板 + replaceWorkBookPara(workBook, entity); + // 主体非公式部分替换 replaceWorkBook(workBook, entity); // 公式部分 SearchFormulaManager.getInstance().search4Infos(template); @@ -246,7 +250,16 @@ public class ReplaceUtils { /** * ----------------------------------------------private-------------------------------------------------- */ + private static void replaceWorkBookPara(WorkBook workBook, List entity) { + ReportParameterAttr attr = workBook.getReportParameterAttr(); + if (attr != null && attr.getParameterUI() != null) { + Widget[] widgets = attr.getParameterUI().getAllWidgets(); + for (Widget widget : widgets) { + replaceWidget(widget, entity); + } + } + } private static void replaceTemplateJs(JTemplate template, List entity) { List javaScripts = SearchJSManager.getInstance().getTemplateJSDependenceTables(template); @@ -457,28 +470,26 @@ public class ReplaceUtils { private static void replacePresentAndDictionary(CellElement cell, List entities) { TemplateCellElement cellElement = (TemplateCellElement) cell; // 处理单元格的控件 - replaceCellWidget(cellElement, entities); + replaceWidget(cellElement.getWidget(), entities); // 处理形态 ElementCaseHelper.replacePresent(cellElement.getPresent(), entities); } /** - * 处理单元格控件 + * 处理控件 * - * @param cellElement 单元格 + * @param widget 控件 * @param entities 替换信息 */ - private static void replaceCellWidget(TemplateCellElement cellElement, List entities) { - if (cellElement.getWidget() instanceof DictionaryContainer) { - DictionaryContainer db = (DictionaryContainer) (cellElement.getWidget()); - if (db != null) { - if (db.getDictionary() instanceof TableDataDictionary) { - TableDataDictionary tdd = (TableDataDictionary) db.getDictionary(); - NameTableData ndd = (NameTableData) tdd.getTableData(); - // 控件持有的数据字典也得处理 - ElementCaseHelper.replaceTableDataDictionary(tdd, ndd, entities); - } + private static void replaceWidget(Widget widget, List entities) { + if (widget instanceof DictionaryContainer) { + DictionaryContainer db = (DictionaryContainer) widget; + if (db.getDictionary() instanceof TableDataDictionary) { + TableDataDictionary tdd = (TableDataDictionary) db.getDictionary(); + NameTableData ndd = (NameTableData) tdd.getTableData(); + // 控件持有的数据字典也得处理 + ElementCaseHelper.replaceTableDataDictionary(tdd, ndd, entities); } } }