Browse Source

REPORT-140564 【数据集替换】参数面板所有控件的数据字典的数据集,都没有替换

release/11.0
Destiny.Lin 1 week ago
parent
commit
70084fb9e4
  1. 39
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java

39
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<TableReplacementEntity> 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<TableReplacementEntity> 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<TableReplacementEntity> entity) {
List<JavaScript> javaScripts = SearchJSManager.getInstance().getTemplateJSDependenceTables(template);
@ -457,28 +470,26 @@ public class ReplaceUtils {
private static void replacePresentAndDictionary(CellElement cell, List<TableReplacementEntity> 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<TableReplacementEntity> 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<TableReplacementEntity> 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);
}
}
}

Loading…
Cancel
Save