郑根木 2 лет назад
Родитель
Сommit
e58ae00787
3 измененных файлов: 16 добавлений и 8 удалений
  1. +12
    -4
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/JsonUtil.java
  2. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java
  3. +3
    -3
      smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_model.ftl

+ 12
- 4
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/JsonUtil.java Просмотреть файл

@@ -24,10 +24,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.*;

import static org.springframework.beans.BeanUtils.getPropertyDescriptors;

@@ -285,4 +282,15 @@ public class JsonUtil {
throw new JsonParseException("can't convert type " + obj.getClass() + " to json string", e);
}
}

public static SwMap bean2Map(Object obj) {
return parse(encodeString(obj), SwMap.class);
}

public static List<SwMap> bean2MapList(Object obj) {
List<SwMap> list = new ArrayList<>();
SwMap[] arr = parse(encodeString(obj), SwMap[].class);
Collections.addAll(list, arr);
return list;
}
}

+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java Просмотреть файл

@@ -374,7 +374,7 @@ public class ModelFormHelper {
PageDatasets datasets = form.getDatasets();
SwMap tmplModel = JsonUtil.parse(form.getTmpl(), SwMap.class);
tmplModel.put("title", form.getTitle());
tmplModel.put("datasets", form.getDatasets());
tmplModel.put("datasets", JsonUtil.bean2MapList(form.getDatasets().list));
SwMap layout = tmplModel.readMap("layout");
//用到的自定义控件
Set<Long> setWidget = new HashSet<>();


+ 3
- 3
smtweb-system/sw-system-bpm/src/main/resources/static/template/incModel/inc_model.ftl Просмотреть файл

@@ -2,12 +2,12 @@
"dataset": "${dataset.id}",
"label": "${dataset.label}",
"fields": [
<#list fields as field>
<#list dataset.fields as field>
{
"id": "${field.id}",
"field": "${field.field}"<#if field.widget gt 0>,
"lookup": {
"widgetId": "${field.widget}",
"widgetId": "${field.widget?c}",
"widgetId_text": "${field.widgetText}",
"filters": []
}
@@ -16,7 +16,7 @@
</#list>
],
"filters": [
<#list filters as field>
<#list dataset.filters as field>
{
"id": "${field.field}",
"field": "${field.field}",


Загрузка…
Отмена
Сохранить