diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java index d92acb6..7d23cd1 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java @@ -428,6 +428,7 @@ public class ModelFormHelper { widgetRef = widgetRef.substring(1); } tmplModel.put("widgetRef", widgetRef); + tmplModel.put("tmplType", tmplId); final String model = CodeGenerator.getInstance().generate(tmplModel, tmplId); form.setContent(model); // form.setContent(buildSaveModel(form)); diff --git a/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_query.ftl b/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_query.ftl new file mode 100644 index 0000000..65df06e --- /dev/null +++ b/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_query.ftl @@ -0,0 +1,98 @@ +{ + "shape": "panel", + "id": "form_panel", + "type": "fx-form-panel", + "props": { + "colNum": 3, + "name": "query", + "label": "按钮区", + "size": "80", + "shadow": "", + "alignY": "center", + "paddingRight": 10 + }, + "children": [ + <#assign fields = group.cfilters> + <#list fields as filter> + { + "id": "id${newId()}", + "type": "fx-${filter.editor}", + "props": { + "label": "${filter.label}", + "type": "text", + <#if filter.maxlength gt 0> + "maxlength": ${filter.maxlength}, + + "placeholder": "请输入查询内容", + "labelWidth": 100, + "dataset": "${filter.dataset}", + "field": "${filter.id}", + "name": "${filter.name}" + }, + "events": {} + }, + + { + "id": "id${newId()}", + "type": "fx-button-group", + "props": { + "menus": [], + "textAlign": "left" + }, + "slots": { + "default": [ + { + "id": "id${newId()}", + "type": "fx-button", + "props": { + "label": "重置", + "leftIcon": "clear", + "type": "", + "action": "button:reset", + "dataset": "${param.queryDs}", + "link": false, + "linkType": "" + } + }, + { + "id": "id${newId()}", + "type": "fx-button", + "props": { + "label": "查询", + "leftIcon": "search", + "type": "primary", + "action": "button:search", + "dataset": "${param.queryDs}" + } + } + <#if (group.sfilters?size>0)> + ,{ + "id": "id${newId()}", + "type": "fx-button", + "props": { + "label": "高级筛选", + "leftIcon": "hamburger-button", + "action": "button:link", + "link": true, + "linkType": "drawer", + "fxLink": "dialog:qrueydialog" + } + } + + ] + }, + "layout": { + "col": 1 + } +}] +}, +{ + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "20", + "backgroundColor": "transparent" + }, + "children": [] +}, \ No newline at end of file diff --git a/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_table.ftl b/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_table.ftl new file mode 100644 index 0000000..c9e1eb3 --- /dev/null +++ b/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_table.ftl @@ -0,0 +1,95 @@ +<#assign tmpl_Type = tmplType> +{ + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "", + "label": "列表", + "colNum": 0, + "paddingLeft": 32, + "paddingRight": 32, + "shadow": "" + }, + "children": [{ + "id": "id${newId()}", + "type": "fx-table", + "props": { + "label": "表格", + + "border": true, + "stripe": true, + "showHeader": true, + "fit": true, + "dataset": "${param.queryDs}", + "actionWidth": 150 + }, + "slots": { + <#if (group.fields?size>0)> + <#assign fields = group.fields> + "default": [ + <#list fields as col> + { + "id": "id${newId()}", + "type": "fx-table-column", + "props": { + "field": "${col.id}", + "label": "${col.label}" + } + }<#if col_has_next>, + + ], + + "button": [ + <#if (tmpl_Type == "model_list")> + { + "id": "id${newId()}", + "type": "fx-button", + "props": { + "label": "编辑", + "type": "text", + "leftIcon": "edit", + "action": "button:edit", + "dataset": "${group.dataset}", + "link": true, + "linkType": "", + "nextAction": "", + "fxLink": "" + } + }, + <#elseif (tmpl_Type == "model_list_card")> + { + "id": "id${newId()}", + "type": "fx-button", + "props": { + "label": "编辑", + "type": "text", + "leftIcon": "edit", + "action": "button:edit", + "link": true, + "linkType": "dialog", + "fxLink": "dialog:editDialog", + "fxLink_text": "${param.editTitle}", + "dataset": "${param.editDs}" + } + }, + + { + "id": "id${newId()}", + "type": "fx-button", + "props": { + "label": "删除", + "type": "text", + "leftIcon": "delete-themes", + "action": "button:remove", + "preAction": "", + "link": true, + "confirm": "" + } + } + ] +}, +"events": {} +} +] +}, \ No newline at end of file diff --git a/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_query_sfilters.ftl b/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_query_sfilters.ftl new file mode 100644 index 0000000..da691f8 --- /dev/null +++ b/smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_query_sfilters.ftl @@ -0,0 +1,106 @@ +, +{ + "page": { + "id": "id${newId()}", + "type":"fx-dialog", + "props": { + "title": "查询条件", + "key": "qrueydialog", + "destroyOnClose": true, + "closeOnClickModal": true, + "width": "20%", + "height": "" + }, + "events": {} + }, + "graph": { + "shape": "panel", + "id": "root_panel", + "type": "fx-split-panel", + "props": { + "horizontal": false, + "shadow":"never" + }, + "children":[ + { + "shape": "panel", + "id": "form_panel", + "type": "fx-form-panel", + "props": { + "colNum": 1, + "name": "query", + "label": "查询条件", + "size": "", + "paddingTop": 20, + "scroll": true + }, + "children": [ + <#assign fields = group.sfilters > + <#list fields as filter > + { + "id": "id${newId()}", + "type": "fx-${filter.editor}", + "props": { + "label": "${filter.label}", + "type": "text", + <#if filter.maxlength gt 0 > + "maxlength": ${filter.maxlength}, + + "placeholder": "请输入查询内容", + "labelWidth": 100, + "dataset": "${filter.dataset}", + "field": "${filter.id}", + "name": "${filter.name}" + }, + "events": {} + } + <#if filter_has_next >, + + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size":"56", + "alignY": "center" + }, + "children": + [ + { + "id": "id${newId()}", + "type": "fx-button-group", + "props": { + "menus": [], + "textAlign": "center" + }, + "slots": { + "default": [ + { + "type": "fx-button", + "props": { + "label": "重置", + "leftIcon": "clear", + "action": "button:return" + }, + "id": "id${newId()}" + }, + { + "type": "fx-button", + "props": { + "label": "查询", + "leftIcon": "save", + "type": "success", + "action": "button:search", + "dataset": "${param.queryDs}" + }, + "id": "id${newId()}" + } + ] + } + } + ] + }] + } +} \ No newline at end of file diff --git a/smtweb-framework/bpm/src/main/resources/static/template/model_list.ftl b/smtweb-framework/bpm/src/main/resources/static/template/model_list.ftl index 3efc619..96ef401 100644 --- a/smtweb-framework/bpm/src/main/resources/static/template/model_list.ftl +++ b/smtweb-framework/bpm/src/main/resources/static/template/model_list.ftl @@ -20,111 +20,9 @@ "shadow": "" }, "children": [ - <#if (group.cfilters?size>0)> - { - "shape": "panel", - "id": "form_panel", - "type": "fx-form-panel", - "props": { - "colNum": 3, - "name": "query", - "label": "按钮区", - "size": "80", - "shadow": "", - "alignY": "center", - "paddingRight": 10 - }, - "children": [ - - - <#assign fields = group.cfilters> - <#list fields as filter> - { - "id": "id${newId()}", - "type": "fx-${filter.editor}", - "props": { - "label": "${filter.label}", - "type": "text", - <#if filter.maxlength gt 0> - "maxlength": ${filter.maxlength}, - - "placeholder": "请输入查询内容", - "labelWidth": 100, - "dataset": "${filter.dataset}", - "field": "${filter.id}", - "name": "${filter.name}" - }, - "events": {} - }, - - - - { - "id": "id${newId()}", - "type": "fx-button-group", - "props": { - "menus": [], - "textAlign": "right" - }, - "slots": { - "default": [ - { - "type": "fx-button", - "props": { - "label": "重置", - "leftIcon": "clear", - "type": "", - "action": "button:reset", - "dataset": "${param.queryDs}", - "link": false, - "linkType": "" - }, - "id": "id${newId()}" - }, - { - "type": "fx-button", - "props": { - "label": "查询", - "leftIcon": "search", - "type": "primary", - "action": "button:search", - "dataset": "${param.queryDs}" - }, - "id": "id${newId()}" - } - <#if (group.sfilters?size>0)> - ,{ - "type": "fx-button", - "props": { - "label": "高级筛选", - "leftIcon": "hamburger-button", - "action": "button:link", - "link": true, - "linkType": "drawer", - "fxLink": "dialog:qrueydialog" - }, - "id": "id${newId()}" - } - - ] - }, - "layout": { - "col": 1 - } - } - ] - }, - { - "id": "${newId()}", - "type": "fx-form-panel", - "shape": "panel", - "props": { - "size": "20", - "backgroundColor": "transparent" - }, - "children": [] - }, - + <#if (group.cfilters?size>0)> + <#include "incModel/inc_list_query.ftl"/> + { "id": "${newId()}", "type": "fx-form-panel", @@ -163,6 +61,7 @@ "slots": { "default": [ { + "id": "id${newId()}", "type": "fx-button", "props": { "label": "新增", @@ -173,90 +72,14 @@ "linkType": "", "fxLink": "", "dataset": "${param.queryDs}" - }, - "id": "id${newId()}" + } } ] } } ] }, - { - "id": "${newId()}", - "type": "fx-form-panel", - "shape": "panel", - "props": { - "size": "", - "label": "列表", - "colNum": 0, - "paddingLeft": 32, - "paddingRight": 32, - "shadow": "" - }, - "children": [ - { - "id": "id${newId()}", - "type": "fx-table", - "props": { - "label": "表格", - "border": true, - "stripe": true, - "showHeader": true, - "fit": true, - "dataset": "${group.dataset}", - "actionWidth": 150 - }, - "slots": { - <#if (group.fields?size>0)> - <#assign fields = group.fields> - "default": [ - <#list fields as col> - { - "id": "id${newId()}", - "type": "fx-table-column", - "props": { - "field": "${col.id}", - "label": "${col.label}" - } - }<#if col_has_next>, - - ], - - "button": [ - { - "type": "fx-button", - "props": { - "label": "编辑", - "type": "text", - "leftIcon": "edit", - "action": "button:edit", - "dataset": "${group.dataset}", - "link": true, - "linkType": "", - "nextAction": "", - "fxLink": "" - }, - "id": "id${newId()}" - }, - { - "type": "fx-button", - "props": { - "label": "删除", - "type": "text", - "leftIcon": "delete-themes", - "action": "button:remove", - "preAction": "", - "link": true, - "confirm": "" - }, - "id": "id${newId()}" - } - ] - }, - "events": {} - } - ] - }, + <#include "incModel/inc_list_table.ftl"/> { "id": "${newId()}", "type": "fx-form-panel", @@ -269,117 +92,10 @@ } ] } - }, - { - "page": { - "id": "id${newId()}", - "type": "fx-dialog", - "props": { - "title": "查询条件", - "key": "qrueydialog", - "destroyOnClose": true, - "closeOnClickModal": true, - "width": "20%", - "height": "" - }, - "events": { - } - } + } <#if (group.sfilters?size>0)> - ,"graph": { - "shape": "panel", - "id": "root_panel", - "type": "fx-split-panel", - "props": { - "horizontal": false, - "shadow": "never" - }, - "children": [ - { - "shape": "panel", - "id": "form_panel", - "type": "fx-form-panel", - "props": { - "colNum": 1, - "name": "query", - "label": "查询条件", - "size": "", - "paddingTop": 20, - "scroll": true - }, - "children": [ - - <#assign fields = group.sfilters> - <#list fields as filter> - { - "id": "id${newId()}", - "type": "fx-${filter.editor}", - "props": { - "label": "${filter.label}", - "type": "text", - <#if filter.maxlength gt 0> - "maxlength": ${filter.maxlength}, - - "placeholder": "请输入查询内容", - "labelWidth": 100, - "dataset": "${filter.dataset}", - "field": "${filter.id}", - "name": "${filter.name}" - }, - "events": {} - } - <#if filter_has_next>, - - - ] - }, - { - "id": "${newId()}", - "type": "fx-form-panel", - "shape": "panel", - "props": { - "size": "56", - "alignY": "center" - }, - "children": [ - { - "id": "id${newId()}", - "type": "fx-button-group", - "props": { - "menus": [], - "textAlign": "center" - }, - "slots": { - "default": [ - { - "type": "fx-button", - "props": { - "label": "重置", - "leftIcon": "clear", - "action": "button:return" - }, - "id": "id${newId()}" - }, - { - "type": "fx-button", - "props": { - "label": "查询", - "leftIcon": "save", - "type": "success", - "action": "button:search", - "dataset": "${param.queryDs}" - }, - "id": "id${newId()}" - } - ] - } - } - ] - } - ] - } + <#include "incModel/inc_query_sfilters.ftl"/> - } ], "model": [ diff --git a/smtweb-framework/bpm/src/main/resources/static/template/model_list_card.ftl b/smtweb-framework/bpm/src/main/resources/static/template/model_list_card.ftl index b4af313..5e4f41f 100644 --- a/smtweb-framework/bpm/src/main/resources/static/template/model_list_card.ftl +++ b/smtweb-framework/bpm/src/main/resources/static/template/model_list_card.ftl @@ -21,109 +21,7 @@ }, "children": [ <#if (group.cfilters?size>0)> - { - "shape": "panel", - "id": "form_panel", - "type": "fx-form-panel", - "props": { - "colNum": 3, - "name": "query", - "label": "按钮区", - "size": "80", - "shadow": "", - "alignY": "center", - "paddingRight": 10 - }, - "children": [ - - - <#assign fields = group.cfilters> - <#list fields as filter> - { - "id": "id${newId()}", - "type": "fx-${filter.editor}", - "props": { - "label": "${filter.label}", - "type": "text", - <#if filter.maxlength gt 0> - "maxlength": ${filter.maxlength}, - - "placeholder": "请输入查询内容", - "labelWidth": 100, - "dataset": "${filter.dataset}", - "field": "${filter.id}", - "name": "${filter.name}" - }, - "events": {} - }, - - - - { - "id": "id${newId()}", - "type": "fx-button-group", - "props": { - "menus": [], - "textAlign": "right" - }, - "slots": { - "default": [ - { - "type": "fx-button", - "props": { - "label": "重置", - "leftIcon": "clear", - "type": "", - "action": "button:reset", - "dataset": "${param.queryDs}", - "link": false, - "linkType": "" - }, - "id": "id${newId()}" - }, - { - "type": "fx-button", - "props": { - "label": "查询", - "leftIcon": "search", - "type": "primary", - "action": "button:search", - "dataset": "${param.queryDs}" - }, - "id": "id${newId()}" - } - <#if (group.sfilters?size>0)> - ,{ - "type": "fx-button", - "props": { - "label": "高级筛选", - "leftIcon": "hamburger-button", - "action": "button:link", - "link": true, - "linkType": "drawer", - "fxLink": "dialog:qrueydialog" - }, - "id": "id${newId()}" - } - - ] - }, - "layout": { - "col": 1 - } - } - ] - }, - { - "id": "${newId()}", - "type": "fx-form-panel", - "shape": "panel", - "props": { - "size": "20", - "backgroundColor": "transparent" - }, - "children": [] - }, + <#include "incModel/inc_list_query.ftl"/> { "id": "${newId()}", @@ -183,82 +81,7 @@ } ] }, - { - "id": "${newId()}", - "type": "fx-form-panel", - "shape": "panel", - "props": { - "size": "", - "label": "列表", - "colNum": 0, - "paddingLeft": 32, - "paddingRight": 32, - "shadow": "" - }, - "children": [ - { - "id": "id${newId()}", - "type": "fx-table", - "props": { - "label": "表格", - "border": true, - "stripe": true, - "showHeader": true, - "fit": true, - "dataset": "${group.dataset}", - "actionWidth": 150 - }, - "slots": { - <#if (group.fields?size>0)> - <#assign fields = group.fields> - "default": [ - <#list fields as col> - { - "id": "id${newId()}", - "type": "fx-table-column", - "props": { - "field": "${col.id}", - "label": "${col.label}" - } - }<#if col_has_next>, - - ], - - "button": [ - { - "type": "fx-button", - "props": { - "label": "编辑", - "type": "text", - "leftIcon": "edit", - "action": "button:edit", - "link": true, - "linkType": "dialog", - "fxLink": "dialog:editDialog", - "fxLink_text": "${param.editTitle}", - "dataset": "${param.editDs}" - }, - "id": "id${newId()}" - }, - { - "type": "fx-button", - "props": { - "label": "删除", - "type": "text", - "leftIcon": "delete-themes", - "action": "button:remove", - "preAction": "", - "link": true, - "confirm": "" - }, - "id": "id${newId()}" - } - ] - }, - "events": {} - } - ] - }, + <#include "incModel/inc_list_table.ftl"/> { "id": "${newId()}", "type": "fx-form-panel", @@ -271,119 +94,12 @@ } ] } - }, - { - "page": { - "id": "id${newId()}", - "type": "fx-dialog", - "props": { - "title": "查询条件", - "key": "qrueydialog", - "destroyOnClose": true, - "closeOnClickModal": true, - "width": "20%", - "height": "" - }, - "events": { - } - } - <#if (group.sfilters?size>0)> - ,"graph": { - "shape": "panel", - "id": "root_panel", - "type": "fx-split-panel", - "props": { - "horizontal": false, - "shadow": "never" - }, - "children": [ - { - "shape": "panel", - "id": "form_panel", - "type": "fx-form-panel", - "props": { - "colNum": 1, - "name": "query", - "label": "查询条件", - "size": "", - "paddingTop": 20, - "scroll": true - }, - "children": [ - - <#assign fields = group.sfilters> - <#list fields as filter> - { - "id": "id${newId()}", - "type": "fx-${filter.editor}", - "props": { - "label": "${filter.label}", - "type": "text", - <#if filter.maxlength gt 0> - "maxlength": ${filter.maxlength}, - - "placeholder": "请输入查询内容", - "labelWidth": 100, - "dataset": "${filter.dataset}", - "field": "${filter.id}", - "name": "${filter.name}" - }, - "events": {} - } - <#if filter_has_next>, - - - ] - }, - { - "id": "${newId()}", - "type": "fx-form-panel", - "shape": "panel", - "props": { - "size": "56", - "alignY": "center" - }, - "children": [ - { - "id": "id${newId()}", - "type": "fx-button-group", - "props": { - "menus": [], - "textAlign": "center" - }, - "slots": { - "default": [ - { - "type": "fx-button", - "props": { - "label": "重置", - "leftIcon": "clear", - "action": "button:return" - }, - "id": "id${newId()}" - }, - { - "type": "fx-button", - "props": { - "label": "查询", - "leftIcon": "save", - "type": "success", - "action": "button:search", - "dataset": "${param.queryDs}" - }, - "id": "id${newId()}" - } - ] - } - } - ] - } - ] } - - }, + <#if (group.sfilters?size>0)> + <#include "incModel/inc_query_sfilters.ftl"/> + <#list layout.c2 as dialog> - { + ,{ "page": { "id": "id${newId()}", "type": "fx-dialog",