diff --git a/smtweb-framework/bpm/src/main/resources/static/template/index.yaml b/smtweb-framework/bpm/src/main/resources/static/template/index.yaml index ec83b62..efdc7f4 100644 --- a/smtweb-framework/bpm/src/main/resources/static/template/index.yaml +++ b/smtweb-framework/bpm/src/main/resources/static/template/index.yaml @@ -33,3 +33,33 @@ model: - name: 'col' type: 'input' + - + name: 'model_list_card' + label: '简单列表(含卡片)' + # list/card/view + type: 'list' + # 布局 + layout: + - + name: 'c1' + label: '简单列表' + type: 'list' + hasGroup: false + - name: 'c2' + label: '编辑卡片' + type: 'card' + hasGroup: false + # 变量 + param: + - + name: 'queryDs' + type: 'ds' + - + name: 'editDs' + type: 'ds' + - + name: 'col' + type: 'input' + - + name: 'editTitle' + type: 'input' diff --git a/smtweb-framework/bpm/src/main/resources/static/template/model_card.ftl b/smtweb-framework/bpm/src/main/resources/static/template/model_card.ftl index 56375ac..806cf58 100644 --- a/smtweb-framework/bpm/src/main/resources/static/template/model_card.ftl +++ b/smtweb-framework/bpm/src/main/resources/static/template/model_card.ftl @@ -182,7 +182,11 @@ <#list fields as field> { "id": "id${newId()}", - "type": "fx-${field.editor}", + <#if (field.readonly = true)> + "type": "fx-text", + <#else> + "type": "fx-${field.editor}", + "props": { "label": "${field.label}", "type": "text", @@ -190,23 +194,44 @@ "maxlength": ${field.maxlength}, "placeholder": "请输入内容", + <#if (param.col = 2)> + "tips": "${field.desc}", + "labelWidth": 150, + <#if (field.readonly = true)> + "readonly": true, + <#else> + "readonly": false, + "affixError": true }, "events": {} } <#if field_has_next> <#if (param.col lte 1 )> - ,{ - "id": "id${newId()}", - "type": "fx-placeholder", - "props": { - "label": "占位" - }, - "layout": { - "row": 1 + <#if (field.desc != "")> + ,{ + "id": "id181d83cdb41", + "type": "fx-label", + "props": { + "label": "${field.desc}", + "labelWidth": 0, + "affixError": true, + "labelAlign": "left" + } } + <#else> + ,{ + "id": "id${newId()}", + "type": "fx-placeholder", + "props": { + "label": "占位" + }, + "layout": { + "row": 1 + } } + <#if (param.col = 2 && ((field_index+1) % 2 = 0 ) )> ,{ @@ -221,7 +246,6 @@ } , - ] 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 c4fc2db..3efc619 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 @@ -75,7 +75,7 @@ "leftIcon": "clear", "type": "", "action": "button:reset", - "dataset": "", + "dataset": "${param.queryDs}", "link": false, "linkType": "" }, @@ -172,7 +172,7 @@ "link": false, "linkType": "", "fxLink": "", - "dataset": "" + "dataset": "${param.queryDs}" }, "id": "id${newId()}" } @@ -230,7 +230,7 @@ "type": "text", "leftIcon": "edit", "action": "button:edit", - "dataset": "", + "dataset": "${group.dataset}", "link": true, "linkType": "", "nextAction": "", 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 new file mode 100644 index 0000000..1bd602e --- /dev/null +++ b/smtweb-framework/bpm/src/main/resources/static/template/model_list_card.ftl @@ -0,0 +1,571 @@ +{ + <#list layout.c1 as group> + "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": "" + }, + "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": [] + }, + + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "68", + "label": "查询条件", + "colNum": 2, + "alignY": "center", + "paddingLeft": 32, + "paddingRight": 32, + "shadow": "" + }, + "children": [ + { + "id": "id${newId()}", + "type": "fx-title", + "props": { + "label": "${title}", + "fontSize": 16, + "color": "#01070D", + "fontWeight": "bold", + "showPrefix": false, + "prefixWidth": 5, + "prefixHeight": 24, + "prefixColor": "#1E90FF" + } + }, + { + "id": "id${newId()}", + "type": "fx-button-group", + "props": { + "menus": [], + "textAlign": "right" + }, + "slots": { + "default": [ + { + "type": "fx-button", + "props": { + "label": "新增", + "leftIcon": "plus", + "type": "primary", + "action": "button:add", + "link": false, + + "linkType": "dialog", + "fxLink": "dialog:editDialog", + "fxLink_text": "${param.editTitle}", + "dataset": "${param.editDs}" + }, + "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", + "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": {} + } + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "24", + "backgroundColor": "transparent" + }, + "children": [] + } + ] + } + }, + { + "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()}" + } + ] + } + } + ] + } + ] + } + + }, + <#list layout.c2 as dialog> + { + "page": { + "id": "id${newId()}", + "type": "fx-dialog", + "props": { + "title": "${param.editTitle}", + "key": "editDialog" + }, + "events": {} + }, + "graph": { + "shape": "panel", + "id": "root_panel", + "type": "fx-split-panel", + "props": { + "horizontal": false, + "shadow": "never" + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-split-panel", + "shape": "panel", + "props": { + "horizontal": false, + "scroll": true + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "0", + "paddingTop": 32, + "colNum": 2 + }, + <#assign dfields = dialog.fields> + "children": [ + <#list dfields as dfield> + { + "id": "id${newId()}", + <#if (dfield.readonly = true)> + "type": "fx-text", + <#else> + "type": "fx-${dfield.editor}", + + "props": { + "label": "${dfield.label}", + "type": "text", + <#if dfield.maxlength gt 0> + "maxlength": ${dfield.maxlength}, + + "placeholder": "请输入内容", + <#if (param.col gte 2)> + "tips": "${dfield.desc}", + + "labelWidth": 150, + <#if (dfield.readonly = true)> + "readonly": true, + <#else> + "readonly": false, + + "affixError": true + }, + "events": {} + } + <#if dfield_has_next> + <#if (param.col lte 1 )> + <#if (dfield.desc != "")> + ,{ + "id": "id${newId()}", + "type": "fx-label", + "props": { + "label": "${dfield.desc}", + "labelWidth": 0, + "affixError": true, + "labelAlign": "left" + } + } + <#else> + ,{ + "id": "id${newId()}", + "type": "fx-placeholder", + "props": { + "label": "占位" + }, + "layout": { + "row": 1 + } + } + + + , + + + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": {}, + "children": [] + } + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "0" + }, + "children": [ + { + "id": "id${newId()}", + "type": "fx-divider", + "props": { + "label": "", + "contentPosition": "center", + "direction": "horizontal" + } + } + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "56", + "alignY": "center", + "paddingRight": 10 + }, + "children": [ + { + "id": "id${newId()}", + "type": "fx-button-group", + "props": { + "menus": [], + "textAlign": "right" + }, + "slots": { + "default": [ + { + "type": "fx-button", + "props": { + "label": "保存", + "leftIcon": "save", + "type": "success", + "action": "button:save", + "dataset": "${param.queryDs}" + }, + "id": "id${newId()}" + }, + { + "type": "fx-button", + "props": { + "label": "关闭", + "leftIcon": "close", + "action": "button:closeDialog" + }, + "id": "id${newId()}" + } + ] + } + } + ] + } + ] + } + } + ], + + "model": [ + <#list datasets as dataset> + <#include "incModel/inc_model.ftl"/><#if dataset_has_next>, + + ], + "option": { + "widgetRef": [${widgetRef}], + "vars": [] + } + +}