Browse Source

优化点模板

master
xiaxl 2 years ago
parent
commit
59b7e8b7a2
6 changed files with 314 additions and 582 deletions
  1. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java
  2. +98
    -0
      smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_query.ftl
  3. +95
    -0
      smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_table.ftl
  4. +106
    -0
      smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_query_sfilters.ftl
  5. +8
    -292
      smtweb-framework/bpm/src/main/resources/static/template/model_list.ftl
  6. +6
    -290
      smtweb-framework/bpm/src/main/resources/static/template/model_list_card.ftl

+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java View File

@@ -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));


+ 98
- 0
smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_query.ftl View File

@@ -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},
</#if>
"placeholder": "请输入查询内容",
"labelWidth": 100,
"dataset": "${filter.dataset}",
"field": "${filter.id}",
"name": "${filter.name}"
},
"events": {}
},
</#list>
{
"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"
}
}
</#if>
]
},
"layout": {
"col": 1
}
}]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "20",
"backgroundColor": "transparent"
},
"children": []
},

+ 95
- 0
smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_table.ftl View File

@@ -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>,</#if>
</#list>
],
</#if>
"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}"
}
},
</#if>
{
"id": "id${newId()}",
"type": "fx-button",
"props": {
"label": "删除",
"type": "text",
"leftIcon": "delete-themes",
"action": "button:remove",
"preAction": "",
"link": true,
"confirm": ""
}
}
]
},
"events": {}
}
]
},

+ 106
- 0
smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_query_sfilters.ftl View File

@@ -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},
</#if>
"placeholder": "请输入查询内容",
"labelWidth": 100,
"dataset": "${filter.dataset}",
"field": "${filter.id}",
"name": "${filter.name}"
},
"events": {}
}
<#if filter_has_next >,</#if>
</#list>
]
},
{
"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()}"
}
]
}
}
]
}]
}
}

+ 8
- 292
smtweb-framework/bpm/src/main/resources/static/template/model_list.ftl View File

@@ -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},
</#if>
"placeholder": "请输入查询内容",
"labelWidth": 100,
"dataset": "${filter.dataset}",
"field": "${filter.id}",
"name": "${filter.name}"
},
"events": {}
},
</#list>


{
"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()}"
}
</#if>
]
},
"layout": {
"col": 1
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "20",
"backgroundColor": "transparent"
},
"children": []
},
</#if>
<#if (group.cfilters?size>0)>
<#include "incModel/inc_list_query.ftl"/>
</#if>
{
"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>,</#if>
</#list>
],
</#if>
"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},
</#if>
"placeholder": "请输入查询内容",
"labelWidth": 100,
"dataset": "${filter.dataset}",
"field": "${filter.id}",
"name": "${filter.name}"
},
"events": {}
}
<#if filter_has_next>,</#if>
</#list>

]
},
{
"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"/>
</#if>
}
],
</#list>
"model": [


+ 6
- 290
smtweb-framework/bpm/src/main/resources/static/template/model_list_card.ftl View File

@@ -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},
</#if>
"placeholder": "请输入查询内容",
"labelWidth": 100,
"dataset": "${filter.dataset}",
"field": "${filter.id}",
"name": "${filter.name}"
},
"events": {}
},
</#list>


{
"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()}"
}
</#if>
]
},
"layout": {
"col": 1
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "20",
"backgroundColor": "transparent"
},
"children": []
},
<#include "incModel/inc_list_query.ftl"/>
</#if>
{
"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>,</#if>
</#list>
],
</#if>
"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},
</#if>
"placeholder": "请输入查询内容",
"labelWidth": 100,
"dataset": "${filter.dataset}",
"field": "${filter.id}",
"name": "${filter.name}"
},
"events": {}
}
<#if filter_has_next>,</#if>
</#list>

]
},
{
"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>
},
<#if (group.sfilters?size>0)>
<#include "incModel/inc_query_sfilters.ftl"/>
</#if>
<#list layout.c2 as dialog>
{
,{
"page": {
"id": "id${newId()}",
"type": "fx-dialog",


Loading…
Cancel
Save