郑根木 2 роки тому
джерело
коміт
b844ce8f6f
16 змінених файлів з 324 додано та 212 видалено
  1. +5
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwMap.java
  2. +6
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/MapUtil.java
  3. +37
    -12
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java
  4. +8
    -0
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java
  5. +62
    -0
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java
  6. +35
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java
  7. +16
    -0
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormService.java
  8. +22
    -0
      smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_dataset.ftl
  9. +3
    -3
      smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_filter.ftl
  10. +31
    -0
      smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_form.ftl
  11. +1
    -1
      smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_grid_opt.ftl
  12. +0
    -74
      smtweb-system/sw-system-bpm/src/main/resources/static/template/inc_form.ftl
  13. +16
    -14
      smtweb-system/sw-system-bpm/src/main/resources/static/template/index.yaml
  14. +44
    -0
      smtweb-system/sw-system-bpm/src/main/resources/static/template/model_simple.ftl
  15. +0
    -107
      smtweb-system/sw-system-bpm/src/main/resources/static/template/simple.ftl
  16. +38
    -0
      smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/ModelFormTest.java

+ 5
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwMap.java Переглянути файл

@@ -3,6 +3,7 @@ package cc.smtweb.framework.core.common;
import cc.smtweb.framework.core.util.MapUtil;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

@@ -37,6 +38,10 @@ public class SwMap extends HashMap<String, Object> {
throw new SwException("不是合法的Map对象!" + v.getClass().getName());
}

public List<Map<String, Object>> readListMap(String name) {
return MapUtil.readListMap(this, name);
}

public String readString(String name, String defaultValue) {
return MapUtil.readString(this, name, defaultValue);
}


+ 6
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/MapUtil.java Переглянути файл

@@ -212,4 +212,10 @@ public class MapUtil {

return null;
}

public static List<Map<String, Object>> readListMap(Map map, String name) {
Object v = map.get(name);
if (v == null) return null;
return (List<Map<String, Object>>)v;
}
}

smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/resolver/CodeResolver.java → smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java Переглянути файл

@@ -1,4 +1,4 @@
package cc.smtweb.system.bpm.resolver;
package cc.smtweb.system.bpm.util;

import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.common.SwMap;
@@ -11,22 +11,30 @@ import freemarker.template.TemplateModelException;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
*
* Created by Akmm at 2022/6/8 15:36
* 模板生成代码
*/
public class CodeResolver {
private static CodeResolver instance = null;
public class CodeGenerator {
private final static String KEY_MODEL = "model";
private static CodeGenerator instance = null;

private Configuration configuration = null;

private final String encode = org.apache.commons.codec.CharEncoding.UTF_8;
//模板文件所在目录
private String templatesDir;

protected CodeResolver() {
//模板信息
private SwMap mapTemplate;

protected CodeGenerator() {
templatesDir = this.getClass().getResource("/static/template").getPath();
mapTemplate = YamlUtil.readValue(this.getClass().getResourceAsStream("/static/template/index.yaml"), SwMap.class);
configuration = new Configuration(Configuration.VERSION_2_3_31);
try {
configuration.setDirectoryForTemplateLoading(new File(templatesDir));
@@ -39,8 +47,18 @@ public class CodeResolver {
}
}

public void create(Map<String, Object> model, String templateName, Writer writer) {
//页面设计的模板信息
public Collection<Map<String, Object>> getModelTemplates() {
return ((Map)mapTemplate.get(KEY_MODEL)).values();
}

private void initModel(Map<String, Object> model) {
model.put("newId", new PKGenerator());
}

public void generate(Map<String, Object> model, String templateName, Writer writer) {
try {
initModel(model);
Template template = configuration.getTemplate(templateName, encode);
template.setOutputEncoding(encode);
template.process(model, writer);
@@ -51,8 +69,9 @@ public class CodeResolver {
}
}

public void create(Map<String, Object> model, String templateName, OutputStream out) {
public void generate(Map<String, Object> model, String templateName, OutputStream out) {
try {
initModel(model);
Template template = configuration.getTemplate(templateName, StandardCharsets.UTF_8.toString());
template.setOutputEncoding(encode);
template.process(model, new OutputStreamWriter(out, encode));
@@ -63,15 +82,21 @@ public class CodeResolver {
}
}

public String generate(Map<String, Object> model, String templateName) {
StringWriter out = new StringWriter();
generate(model, templateName + ".ftl", out);
return out.getBuffer().toString();
}

/**
* 获取单实例
*
* @return
*/
public static CodeResolver getInstance() {
public static CodeGenerator getInstance() {
if (instance == null) {
synchronized (CodeResolver.class) {
instance = new CodeResolver();
synchronized (CodeGenerator.class) {
instance = new CodeGenerator();
}
}
return instance;
@@ -80,7 +105,7 @@ public class CodeResolver {
static class PKGenerator implements TemplateMethodModelEx {
@Override
public Object exec(List list) throws TemplateModelException {
return "asd";
return DbEngine.getInstance().nextId();
// return DbEngine.getInstance().nextId();
}
}
@@ -139,7 +164,7 @@ public class CodeResolver {

map.put("title", "thisIsATest!");
map.put("newId", new PKGenerator());
CodeResolver.getInstance().create(map, "simple.ftl", out);
CodeGenerator.getInstance().generate(map, "model_simple.ftl", out);
System.out.println(out.getBuffer().toString());
}
}

+ 8
- 0
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java Переглянути файл

@@ -86,6 +86,14 @@ public class ModelForm extends DefaultEntity {
put("mf_option", mf_option);
}

public String getTmpl() {
return getStr("mf_tmpl");
}

public void setTmpl(String mf_tmpl) {
put("mf_tmpl", mf_tmpl);
}

public String getDataset() {
return getStr("mf_dataset");
}


+ 62
- 0
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java Переглянути файл

@@ -12,6 +12,7 @@ import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.framework.core.util.MapUtil;
import cc.smtweb.system.bpm.util.CodeGenerator;
import cc.smtweb.system.bpm.web.design.db.ModelCatalogCache;
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache;
import cc.smtweb.system.bpm.web.design.form.define.*;
@@ -28,6 +29,12 @@ import java.util.Map;
*/
public class ModelFormHelper {
public static final String KEY_EVENT_PATH = "eventPath";
//分组类别-list
public static final String PAGE_TYPE_LIST = "list";
//分组类别-card
public static final String PAGE_TYPE_CARD = "card";
//分组类别-view
public static final String PAGE_TYPE_VIEW = "view";
/**
* 从缓存获取Form对象
*
@@ -119,6 +126,60 @@ public class ModelFormHelper {
}
}

public static void buildSaveModelByTmpl(ModelForm form, String tmplId) {
PageDatasets datasets = parsePageDataset(form.getDataset());
SwMap tmplModel = JsonUtil.parse(form.getTmpl(), SwMap.class);
tmplModel.put("title", form.getTitle());
tmplModel.put("datasets", parsePageDataset(form.getDataset()));
SwMap layout = tmplModel.readMap("layout");
for (String key: layout.keySet()) {
List<Map<String, Object>> groups = layout.readListMap(key);
for (Map<String, Object> group: groups) {
String type = MapUtil.readString(group, "type");
switch (type) {
case PAGE_TYPE_CARD:
buildTmplFields(MapUtil.readListMap(group, "fields"), datasets, true);
break;
case PAGE_TYPE_LIST:
buildTmplFields(MapUtil.readListMap(group, "fields"), datasets, true);
buildTmplFields(MapUtil.readListMap(group, "cfilters"), datasets, false);
buildTmplFields(MapUtil.readListMap(group, "sfilters"), datasets, false);
break;
}
}
}

form.setContent(CodeGenerator.getInstance().generate(tmplModel, tmplId));
// form.setContent(buildSaveModel(form));
}

private static void buildTmplFields(List<Map<String, Object>> fields, PageDatasets datasets, boolean isField) {
if (fields == null) return;
PageDataset dataset = null;
for (Map<String, Object> field: fields) {
final String dsId = MapUtil.readString(field, "dataset");
if (dataset == null || !dataset.id.equals(dsId)) {
dataset = datasets.findById(dsId);
if (dataset == null) throw new SwException("没有找到指定数据集:" + dsId);
}
String fn = MapUtil.readString(field, "field");
PageDatasetField pdf;
if (!isField) {
pdf = dataset.getFilter(fn);
} else {
pdf = dataset.getField(fn);
if (pdf == null) pdf = dataset.getFilter(fn);
}
if (pdf == null) throw new SwException("model[" + dsId + "]未找到定义的数据集字段(" + fn + "),无法解析!");
field.put("label", pdf.label);
field.put("required", pdf.isFieldNotNull());
final SwEnum.DataTypeBean dtb = SwEnum.DataType.instance.getByValue(pdf.dataType);
if (dtb != null && dtb.dataLength > 0) {
field.put("maxlength", dtb.dataLength);
}
}
}

/**
* 保存的数据集,删除掉一些不必要的字段信息
* @param jsonStr
@@ -356,4 +417,5 @@ public class ModelFormHelper {
opts.put(KEY_EVENT_PATH, ep + "." + bean.getName());
}
}

}

+ 35
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java Переглянути файл

@@ -31,7 +31,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
bean.setOption(JsonUtil.encodeString(opts));
}

dao.updateEntityEx(bean, "mf_content", "mf_dataset");
dao.updateEntityEx(bean, "mf_content", "mf_dataset", "mf_tmpl");
}

public R saveDataset() {
@@ -98,4 +98,38 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
});
return R.success();
}

public R saveModelByTmpl() {
long id = params.readLong("pageId");
String templateId = params.readString("templateId");
String data = params.readString("data");
bean = loadComp(id);
if (StringUtils.isEmpty(data)) {
throw new SwException("没有待保存的数据!");
}
bean.setTmpl(data);
ModelFormHelper.buildSaveModelByTmpl(bean, templateId);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(tableName);

ModelTable table = ModelTableCache.getInstance().getByName(tableName);
ModelField field = table.findFieldByType(SwEnum.FieldType.UPDATE_USER.value);
if (field != null) bean.put(field.getName(), us.getUserId());
dao.updateEntity(bean, "mf_content", "mf_tmpl");
}

@Override
public void doAfterDbCommit() {
saveSuccess();
}

@Override
public void doAfterDbRollback() {
saveFailed();
}
});
return R.success(ModelFormHelper.buildReqModel(bean));
}
}

+ 16
- 0
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormService.java Переглянути файл

@@ -12,6 +12,7 @@ import cc.smtweb.framework.core.mvc.service.DefaultDelHandler;
import cc.smtweb.framework.core.mvc.service.DefaultListHandler;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.SqlUtil;
import cc.smtweb.system.bpm.util.CodeGenerator;
import org.apache.commons.lang3.StringUtils;

import java.sql.ResultSetMetaData;
@@ -69,6 +70,16 @@ public class ModelFormService extends AbstractCompService {
}
}

//根据模板保存页面定义
public R saveModelByTmpl(@SwBody SwMap params, UserSession us) {
try {
ModelFormSaveHandler handler = (ModelFormSaveHandler) getHandler(params, us, TYPE_SAVE);
return handler.saveModelByTmpl();
} catch (Exception e) {
return R.error("操作失败!", e);
}
}

//加载页面模型
public R loadModel(@SwBody SwMap params, UserSession us) {
try {
@@ -126,4 +137,9 @@ public class ModelFormService extends AbstractCompService {
return R.error("操作失败!", e);
}
}

//加载模板定义
public R loadTmpls(@SwBody SwMap params, UserSession us) {
return R.success(CodeGenerator.getInstance().getModelTemplates());
}
}

+ 22
- 0
smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_dataset.ftl Переглянути файл

@@ -0,0 +1,22 @@
{
"dataset": "${dataset.id}",
"label": "${dataset.label}",
"fields": [
<#list fields as field>
{
"id": "${field.id}",
"field": "${field.field}"
},
</#list>
],
"filters": [
<#list filters as field>
{
"id": "${field.id}",
"field": "${field.field}"
"required": ${field.required},
"type": "input"
},
</#list>
]
},

smtweb-system/sw-system-bpm/src/main/resources/static/template/inc_filter.ftl → smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_filter.ftl Переглянути файл

@@ -1,5 +1,4 @@
<#assign fields = group.cfilters>
<#list fields as filter>
{
"id": "${newId()}",
"type": "fx-form-panel",
@@ -11,6 +10,7 @@
"colNum": 2
},
"children": [
<#list fields as filter>
{
"id": "id${newId()}",
"type": "fx-text",
@@ -25,8 +25,8 @@
"name": "${filter.name}"
},
"events": {}
}
</#list>,
},
</#list>
{
"id": "id${newId()}",
"type": "fx-button-group",

+ 31
- 0
smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_form.ftl Переглянути файл

@@ -0,0 +1,31 @@
<#assign fields = group.fields>
{
"shape": "panel",
"id": "form_panel",
"type": "fx-form-panel",
"props": {
"colNum": 2,
"paddingX": 5,
"paddingY": 5,
"size": "0"
},
"children": [
<#list fields as field>
{
"id": "id${newId()}",
"type": "fx-text",
"props": {
"label": "${field.label}",
"type": "text",
"maxlength": ${field.maxlength},
"placeholder": "请输入内容",
"labelWidth": 100,
"dataset": "${field.dataset}",
"field": "${field.field}",
"name": "${field.name}"
},
"events": {}
},
</#list>
]
}

smtweb-system/sw-system-bpm/src/main/resources/static/template/inc_grid_opt.ftl → smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_grid_opt.ftl Переглянути файл

@@ -32,7 +32,7 @@
"field": "${col.field}",
"label": "${col.label}"
}
}
},
</#list>
],
"button": [

+ 0
- 74
smtweb-system/sw-system-bpm/src/main/resources/static/template/inc_form.ftl Переглянути файл

@@ -1,74 +0,0 @@
<#assign fields = group.cfilters>
<#list fields as filter>
{
"shape": "panel",
"id": "form_panel",
"type": "fx-form-panel",
"props": {
"colNum": 2,
"paddingX": 5,
"paddingY": 5,
"size": "0"
},
"children": [
{
"id": "id1813718bf71",
"type": "fx-text",
"props": {
"label": "编码",
"type": "text",
"maxlength": 50,
"placeholder": "请输入内容",
"labelWidth": 100,
"dataset": "ds_1813718bf61",
"field": "id_1813718bf67",
"name": "pt_code"
},
"events": {}
},
{
"id": "id1813718bf74",
"type": "fx-label",
"props": {
"label": "标签",
"labelWidth": 100
}
},
{
"id": "id1813718bf77",
"type": "fx-text",
"props": {
"label": "名称",
"type": "text",
"maxlength": 50,
"placeholder": "请输入内容",
"labelWidth": 100,
"dataset": "ds_1813718bf61",
"field": "id_1813718bf68",
"name": "pt_name"
},
"events": {}
},
{
"id": "id1813718bf7a",
"type": "fx-label",
"props": {
"label": "标签",
"labelWidth": 100
}
},
{
"id": "id1813718bf9b",
"type": "fx-select",
"props": {
"label": "行政区划",
"clearable": true,
"labelWidth": 100,
"dataset": "ds_1813718bf61",
"field": "id_1813718bf66",
"name": "pt_area_id"
},
"events": {}
}
]
}

+ 16
- 14
smtweb-system/sw-system-bpm/src/main/resources/static/template/index.yaml Переглянути файл

@@ -1,14 +1,16 @@
simple:
label: 简单页面
type: list/scard/ccard
# 布局
layout:
c1:
name: '客户区'
type: 'list'
hasGroup: false
# 变量
param:
p1:
name: ''
type: 'ds/...'
model:
-
name: 'model_simple'
label: '简单页面'
# 布局
layout:
-
name: 'c1'
label: '客户区'
type: 'list'
hasGroup: false
# 变量
param:
-
name: 'p1'
type: 'ds/...'

+ 44
- 0
smtweb-system/sw-system-bpm/src/main/resources/static/template/model_simple.ftl Переглянути файл

@@ -0,0 +1,44 @@
{
"form": [
{
"page": {
"id": "p${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}"
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "never"
},
"children": [
<#list layout.c1 as group>
<#if (group.type == "list")>
<#if (group.cfilters?size>0)>
<#include "incModel/inc_filter.ftl"/>
</#if>
<#include "incModel/inc_grid_opt.ftl"/>
<#elseif (group.type == "card")>
<#include "incModel/inc_form.ftl"/>
</#if>
</#list>
]
}
}
],
"model": [
<#list datasets as dataset>
<#include "incModel/inc_dataset.ftl"/>
</#list>
],
"option": {
"widgetRef": [],
"vars": []
}
}

+ 0
- 107
smtweb-system/sw-system-bpm/src/main/resources/static/template/simple.ftl Переглянути файл

@@ -1,107 +0,0 @@
{
"form": [
{
"page": {
"id": "p${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}"
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "never"
},
"children": [
<#list layout.c1 as group>
<#if (group.cfilters?size>0)>
<#include "inc_filter.ftl"/>
</#if>
<#include "inc_grid_opt.ftl"/>
</#list>
]
}
}
],
"model": [
{
"dataset": "ds_1813718bf0c",
"label": "机构列表",
"fields": [
{
"id": "id_1813718bf0e",
"field": "pt_id"
},
{
"id": "id_1813718bf0f",
"field": "pt_parent_id"
},
{
"id": "id_1813718bf10",
"field": "pt_level_code"
},
{
"id": "id_1813718bf11",
"field": "pt_area_id"
},
{
"id": "id_1813718bf12",
"field": "pt_code"
},
{
"id": "id_1813718bf13",
"field": "pt_name"
},
{
"id": "id_1813718bf14",
"field": "pt_type"
},
{
"id": "id_1813718bf15",
"field": "pt_statu"
},
{
"id": "id_1813718bf16",
"field": "pt_linker"
},
{
"id": "id_1813718bf17",
"field": "pt_tel"
},
{
"id": "id_1813718bf18",
"field": "pt_addr"
},
{
"id": "id_1813718bf19",
"field": "pt_lon"
},
{
"id": "id_1813718bf1a",
"field": "pt_lat"
},
{
"id": "id_1813718bf1b",
"field": "pt_remark"
}
],
"filters": [
{
"id": "id_1813718bf21",
"field": "pt_code",
"required": false,
"type": "input"
}
]
}
],
"option": {
"widgetRef": [],
"vars": []
}
}

+ 38
- 0
smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/ModelFormTest.java Переглянути файл

@@ -3,6 +3,8 @@ package cc.smtweb.system.bpm.test;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.system.bpm.spring.BpmApplication;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -60,4 +62,40 @@ public class ModelFormTest {
R r = service.del(params, null);
System.out.println(r.readSuccess());
}

@Test
public void testBuildModelByTmpl() {
ModelForm form = new ModelForm();
form.setTitle("测试呀");
form.setDataset("[{\"id\":\"ds_1813718bf0c\",\"name\":\"master\",\"label\":\"机构列表\",\"type\":\"list\",\"masterTable\":\"718391823709507584\",\"masterTable_text\":\"机构表\",\"idField\":\"pt_id\",\"lazy\":false,\"canEdit\":false,\"fields\":[{\"id\":\"id_1813718bf0e\",\"table\":\"718391823709507584\",\"field\":\"pt_id\",\"name\":\"pt_id\",\"fieldType\":1,\"notNull\":1,\"link\":\"0\"},{\"id\":\"id_1813718bf0f\",\"table\":\"718391823709507584\",\"field\":\"pt_parent_id\",\"name\":\"pt_parent_id\",\"fieldType\":4,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf10\",\"table\":\"718391823709507584\",\"field\":\"pt_level_code\",\"name\":\"pt_level_code\",\"fieldType\":5,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf11\",\"table\":\"718391823709507584\",\"field\":\"pt_area_id\",\"name\":\"pt_area_id\",\"fieldType\":0,\"notNull\":0,\"link\":\"718410950209703936\"},{\"id\":\"id_1813718bf12\",\"table\":\"718391823709507584\",\"field\":\"pt_code\",\"name\":\"pt_code\",\"fieldType\":2,\"notNull\":1,\"link\":\"0\"},{\"id\":\"id_1813718bf13\",\"table\":\"718391823709507584\",\"field\":\"pt_name\",\"name\":\"pt_name\",\"fieldType\":3,\"notNull\":1,\"link\":\"0\"},{\"id\":\"id_1813718bf14\",\"table\":\"718391823709507584\",\"field\":\"pt_type\",\"name\":\"pt_type\",\"fieldType\":0,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf15\",\"table\":\"718391823709507584\",\"field\":\"pt_statu\",\"name\":\"pt_statu\",\"fieldType\":0,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf16\",\"table\":\"718391823709507584\",\"field\":\"pt_linker\",\"name\":\"pt_linker\",\"fieldType\":0,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf17\",\"table\":\"718391823709507584\",\"field\":\"pt_tel\",\"name\":\"pt_tel\",\"fieldType\":0,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf18\",\"table\":\"718391823709507584\",\"field\":\"pt_addr\",\"name\":\"pt_addr\",\"fieldType\":0,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf19\",\"table\":\"718391823709507584\",\"field\":\"pt_lon\",\"name\":\"pt_lon\",\"fieldType\":0,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf1a\",\"table\":\"718391823709507584\",\"field\":\"pt_lat\",\"name\":\"pt_lat\",\"fieldType\":0,\"notNull\":0,\"link\":\"0\"},{\"id\":\"id_1813718bf1b\",\"table\":\"718391823709507584\",\"field\":\"pt_remark\",\"name\":\"pt_remark\",\"fieldType\":0,\"notNull\":0,\"link\":\"0\"}],\"filters\":[{\"id\":\"id_1813718bf21\",\"table\":\"718391823709507584\",\"field\":\"pt_name\",\"name\":\"pt_code\",\"fieldType\":3,\"notNull\":1,\"link\":\"0\",\"type\":\"input\",\"sqlName\":\"pt_name\",\"required\":false}],\"data\":[],\"dynCond\":{\"opt\":\"or\",\"children\":[{\"param\":\"pt_code\",\"opt\":\"like\"},{\"param\":\"pt_code\",\"opt\":\"like\"}]},\"sortFields\":[{\"field\":\"pt_code\",\"type\":\"asc\"}]}]");
form.setTmpl("{\n" +
" \"param\": {\n" +
" \"p1\": \"pp1\"\n" +
" },\n" +
" \"layout\": {\n" +
" \"c1\": [\n" +
" {\n" +
" \"name\": \"group2\",\n" +
" \"label\": \"分组2\",\n" +
" \"type\": \"list\",\n" +
" \"dataset\": \"ds_1813718bf0c\",\n" +
" \"fields\": [\n" +
" {\n" +
" \"field\": \"pt_parent_id\",\n" +
" \"dataset\": \"ds_1813718bf0c\"\n" +
" }\n" +
" ],\n" +
" \"cfilters\": [\n" +
" {\n" +
" \"field\": \"pt_code\",\n" +
" \"dataset\": \"ds_1813718bf0c\"\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" }\n" +
" }");
ModelFormHelper.buildSaveModelByTmpl(form, "model_simple");
System.out.println(form.getContent());
}
}

Завантаження…
Відмінити
Зберегти