Browse Source

REPORT-135233 调整ShareEmbeddedConverter

fbp/merge
Destiny.Lin 3 months ago
parent
commit
b2b7dc484b
  1. 20
      designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java

20
designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java

@ -5,13 +5,13 @@ import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.data.TableDataSource;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.generate.impl.AbstractComponentCreatorProcessor;
import com.fr.form.main.Form;
import com.fr.form.main.WidgetGatherAdapter;
import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.ShareEmbeddedConverter;
import com.fr.form.share.bean.ComponentReuBean;
import com.fr.form.share.editor.DefaultSharableEditor;
import com.fr.form.share.editor.PlainSharableEditor;
@ -21,11 +21,14 @@ import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.IOFileAttrMark;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.entity.tabledata.PreviewSourceBean;
import com.fr.workspace.server.entity.tabledata.TableDataBean;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
@ -112,8 +115,7 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor {
//内置数据集
if (tpl != null) {
ShareEmbeddedConverter embeddedConverter = WorkContext.getCurrent().get(ShareEmbeddedConverter.class);
Map<String, TableData> map = embeddedConverter.convertToEmbeddedTableData(tpl, paraMap);
Map<String, TableData> map = convertToEmbeddedTableData(tpl, paraMap);
Iterator<Map.Entry<String, TableData>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, TableData> entry = iterator.next();
@ -123,6 +125,16 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor {
return tpl;
}
private Map<String, TableData> convertToEmbeddedTableData(TableDataSource tableDataSource, Map parameterMap) throws Exception {
PreviewSourceBean bean = new PreviewSourceBean(tableDataSource, StringUtils.EMPTY, parameterMap , -1, -1 ,new String[0], new int[0]);
List<TableDataBean> beanList = TableDataRepository.getInstance().convertToEmbeddedTableData(bean);
Map<String, TableData> ans = new HashMap<>();
for (TableDataBean tableDataBean : beanList) {
ans.put(tableDataBean.getName(), tableDataBean.getTableData());
}
return ans;
}
@NotNull
protected DefaultSharableEditor createSharableEditor(Form form, Map<String, Object> paraMap, Widget widget, DefaultSharableWidget info) {

Loading…
Cancel
Save