@@ -71,6 +71,7 @@ public interface SwEnum { | |||
public static StrEnumBean INPUT = instance.addEnum("text", "文本"); | |||
public static StrEnumBean TEXT = instance.addEnum("textarea", "长文本"); | |||
public static StrEnumBean NUMBER = instance.addEnum("number", "数字"); | |||
public static StrEnumBean SWITCH = instance.addEnum("switch", "布尔型"); | |||
public static StrEnumBean DATE = instance.addEnum("date", "日期"); | |||
public static StrEnumBean TIME = instance.addEnum("time", "时间"); | |||
public static StrEnumBean DATETIME = instance.addEnum("datetime", "日期时间"); | |||
@@ -122,7 +123,7 @@ public interface SwEnum { | |||
public static DataTypeBean TEXT = instance.addEnum("text", "大文本", "text", 0, "string", Types.CLOB, "", EditorType.TEXT.value); | |||
public static DataTypeBean INT = instance.addEnum("int", "整型", "int", 0, "int", Types.INTEGER, "0", EditorType.NUMBER.value); | |||
public static DataTypeBean SHORT = instance.addEnum("short", "短整型", "smallint", 0, "short", Types.SMALLINT, "0", EditorType.NUMBER.value); | |||
public static DataTypeBean BOOL = instance.addEnum("bool", "布尔型", "tinyint", 0, "boolean", Types.TINYINT, "0", EditorType.COMBO.value); | |||
public static DataTypeBean BOOL = instance.addEnum("bool", "布尔型", "tinyint", 0, "boolean", Types.TINYINT, "0", EditorType.SWITCH.value); | |||
public static DataTypeBean CURRENCY = instance.addEnum("currency", "金额型", "bigint", 0, "long", Types.BIGINT, "0", EditorType.NUMBER.value); | |||
public static DataTypeBean DATE = instance.addEnum("date", "日期型", "bigint", 0, "long", Types.BIGINT, "0", EditorType.DATE.value); | |||
public static DataTypeBean TIME = instance.addEnum("time", "时间型", "bigint", 0, "long", Types.BIGINT, "0", EditorType.TIME.value); | |||
@@ -164,7 +164,7 @@ public class CodeGenerator { | |||
map.put("title", "thisIsATest!"); | |||
map.put("newId", new PKGenerator()); | |||
CodeGenerator.getInstance().generate(map, "model_simple.ftl", out); | |||
CodeGenerator.getInstance().generate(map, "model_card.ftl", out); | |||
System.out.println(out.getBuffer().toString()); | |||
} | |||
} |
@@ -11,7 +11,7 @@ public class PageDatasetField { | |||
public long table; | |||
public String table_text; | |||
//字段 | |||
public String field; | |||
public String field = ""; | |||
//有别名取别名,无别名同字段名 | |||
public String name; | |||
public String label; | |||
@@ -13,5 +13,5 @@ public class PageDatasetFilter extends PageDatasetField { | |||
public String linkField; | |||
//type为const时,常量值 | |||
public String value; | |||
public boolean required; | |||
public boolean required = false; | |||
} |
@@ -18,9 +18,9 @@ | |||
"filters": [ | |||
<#list dataset.filters as field> | |||
{ | |||
"id": "${field.field}", | |||
"field": "${field.field}", | |||
"required": ${field.required}, | |||
"id": "${field.id}", | |||
"field": "${field.field!0}", | |||
"required": ${field.required?string ("true","false")}, | |||
"type": "input" | |||
}<#if field_has_next>,</#if> | |||
</#list> | |||
@@ -1,7 +1,9 @@ | |||
model: | |||
- | |||
name: 'model_simple' | |||
label: '简单页面' | |||
name: 'model_list' | |||
label: '简单列表' | |||
# list/card/view | |||
type: 'list' | |||
# 布局 | |||
layout: | |||
- | |||
@@ -10,7 +12,24 @@ model: | |||
type: 'list' | |||
hasGroup: false | |||
# 变量 | |||
param: | |||
# param: | |||
# - | |||
# name: 'p1' | |||
# type: 'ds' | |||
- | |||
name: 'model_card' | |||
label: '简单卡片' | |||
# list/card/view | |||
type: 'card' | |||
# 布局 | |||
layout: | |||
- | |||
name: 'p1' | |||
type: 'ds' | |||
name: 'c1' | |||
label: '客户区' | |||
type: 'card' | |||
hasGroup: false | |||
# 变量 | |||
# param: | |||
# - | |||
# name: 'p1' | |||
# type: 'ds' |
@@ -0,0 +1,116 @@ | |||
{ | |||
"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> | |||
{ | |||
"id": "${newId()}", | |||
"type": "fx-form-panel", | |||
"shape": "panel", | |||
"props": { | |||
"paddingY": 3, | |||
"paddingX": 10, | |||
"size": 20 | |||
}, | |||
"children": [ | |||
{ | |||
"id": "id${newId()}", | |||
"type": "fx-button-group", | |||
"props": { | |||
"menus": [], | |||
"textAlign": "center" | |||
}, | |||
"slots": { | |||
"default": [ | |||
{ | |||
"type": "fx-button", | |||
"props": { | |||
"label": "新增", | |||
"leftIcon": "plus", | |||
"type": "primary", | |||
"action": "button:add" | |||
}, | |||
"id": "id${newId()}" | |||
}, | |||
{ | |||
"type": "fx-button", | |||
"props": { | |||
"label": "保存并新增", | |||
"type": "primary", | |||
"action": "button:saveAndAdd" | |||
}, | |||
"id": "id${newId()}" | |||
}, | |||
{ | |||
"type": "fx-button", | |||
"props": { | |||
"label": "保存", | |||
"leftIcon": "save", | |||
"type": "success", | |||
"action": "button:save" | |||
}, | |||
"id": "id${newId()}" | |||
}, | |||
{ | |||
"type": "fx-button", | |||
"props": { | |||
"label": "删除", | |||
"leftIcon": "delete", | |||
"type": "danger", | |||
"action": "button:remove" | |||
}, | |||
"id": "id${newId()}" | |||
}, | |||
{ | |||
"type": "fx-button", | |||
"props": { | |||
"label": "返回", | |||
"leftIcon": "return", | |||
"action": "button:return" | |||
}, | |||
"id": "id${newId()}" | |||
} | |||
] | |||
} | |||
} | |||
] | |||
} | |||
] | |||
} | |||
} | |||
], | |||
"model": [ | |||
<#list datasets as dataset> | |||
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if> | |||
</#list> | |||
], | |||
"option": { | |||
"widgetRef": [${widgetRef}], | |||
"vars": [] | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
{ | |||
"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 "incModel/inc_filter.ftl"/> | |||
</#if> | |||
<#include "incModel/inc_grid_opt.ftl"/> | |||
<#if group_has_next>,</#if> | |||
</#list> | |||
] | |||
} | |||
} | |||
], | |||
"model": [ | |||
<#list datasets as dataset> | |||
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if> | |||
</#list> | |||
], | |||
"option": { | |||
"widgetRef": [${widgetRef}], | |||
"vars": [] | |||
} | |||
} |