diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java index 104eda5..076c8a0 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java @@ -28,6 +28,9 @@ public class DynPageListHandler extends AbstractListHandler { //对应的数据集定义 protected PageDataset pageDataSet; + public DynPageListHandler() { + } + public DynPageListHandler(long pageId, SwMap filter, PageDataset pageDataSet) { this.pageId = pageId; this.filter = filter; diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelListHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelListHandler.java new file mode 100644 index 0000000..00ef78a --- /dev/null +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelListHandler.java @@ -0,0 +1,48 @@ +package cc.smtweb.system.bpm.web.engine.model.listcard.abshandler; + +import cc.smtweb.framework.core.common.R; +import cc.smtweb.framework.core.common.SwMap; +import cc.smtweb.framework.core.exception.BizException; +import cc.smtweb.framework.core.session.UserSession; +import cc.smtweb.system.bpm.web.design.form.ModelForm; +import cc.smtweb.system.bpm.web.design.form.ModelFormHelper; +import cc.smtweb.system.bpm.web.design.form.define.PageDataset; +import cc.smtweb.system.bpm.web.design.form.define.PageDatasets; +import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler; +import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; + +/** + * Created by Akmm at 2022-09-15 15:01 + * 列表类服务handler + */ +public class ModelListHandler extends DynPageListHandler { + protected String dsName; + private ModelListHandler(long pageId, SwMap filter, PageDataset pageDataSet) { + super(pageId, filter, pageDataSet); + } + + public ModelListHandler(String dsName) { + this.dsName = dsName; + } + + @Override + public void init(SwMap params, UserSession us) { + super.init(params, us); + String pId = params.readString("pageId"); + ModelForm form = ModelFormHelper.getFromCache(pId); + if (form == null) throw new BizException("没有找到页面定义数据(" + pageId + ")!"); + pageId = form.getId(); + PageDatasets datasets = form.getDatasets(); + if (datasets == null || datasets.list == null) throw new BizException("没有找到页面定义的数据集数据(" + pageId + ")!"); + + filter = params.readMap("filter"); + pageDataSet = datasets.findByName(dsName); + } + + @Override + public R data() { + DynRetBean bean = DynRetBean.createList(buildListData()); + return R.success(bean); + } + +} diff --git a/smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl b/smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl index 2b7efe8..b0097a1 100644 --- a/smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl +++ b/smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl @@ -1,7 +1,5 @@ -<#--<#assign group_num =layout.flow[0].fields?size / param.group_num>--> { "version": 6, -<#-- "group_num":${group_num?ceiling},--> "form": [ { "page": { @@ -85,7 +83,7 @@ ] }, { - "id": "18306e14164", + "id": "${newId()}", "type": "fx-form-panel", "shape": "panel", "props": { @@ -125,247 +123,357 @@ "shape": "panel", "props": { "size": "", - "horizontal": false, - "scroll": true, - "name": "s12" + "horizontal": true, + "scroll": true }, "children": [ - <#list layout.card as group> - <#assign field = group.fields> { "id": "${newId()}", - "type": "fx-form-panel", + "type": "fx-split-panel", "shape": "panel", "props": { - "size": "16", - "backgroundColor": "--color-transparent" - }, - "children": [] - }, - { - "id": "${newId()}", - "type": "fx-form-panel", - "shape": "panel", - "props": { - "size": "0", - <#if param.col lte 1> - "gridTemplateColumns": "1fr 2fr", - <#elseif param.col gte 2> - "gridTemplateColumns": "1fr 1fr 1fr", - - "paddingTop": 32 + "size": "", + "horizontal": false, + "scroll": true, + "name": "s12" }, "children": [ - <#list group.fields as fields> - <#-- <#list num..(group.fields?size?number)!0 as i>--> - { - "id": "id${newId()}", - <#if (fields.readonly = true)> - "type": "fx-text", - <#else> - "type": "${fields.editor}", - - "props": { - "label": "${fields.label}", - "dataset": "${fields.dataset}", - "required": "${fields.required}", - "field": "${fields.id}", - <#if fields.maxlength gt 0> - "maxlength": ${fields.maxlength}, - - <#if fields.lookup??> - "lookup": { - <#list fields.lookup as k, v> - "${k}": "${v}" <#if k_has_next>, - - }, - - "placeholder": "请输入内容", - <#if (param.col = 2)> - "tips": "${fields.desc}", - - "labelWidth": 100, - <#if (fields.readonly = true)> - "readonly": true, - <#else> - "readonly": false, - - "affixError": true - }, - "events": {} - } - <#if fields_has_next> - <#if (param.col lte 1 )> - <#if (fields.desc != "")> - ,{ - "id": "id181d83cdb41", - "type": "fx-label", - "props": { - "label": "${fields.desc}", - "labelWidth": 0, - "affixError": true, - "labelAlign": "left" - } - } - <#else> - ,{ - "id": "id${newId()}", - "type": "fx-placeholder", - "props": { - "label": "占位" - }, - "layout": { - "row": 1 - } - } - - - <#if (param.col = 2 && ((fields_index+1) % 2 = 0 ) )> - ,{ - "id": "id${newId()}", - "type": "fx-placeholder", - "props": { - "label": "占位" - }, - "layout": { - "row": 1 - } - } - - , - - - ] + <#list layout.card as group> + <#assign field = group.fields> + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "16", + "backgroundColor": "--color-transparent" + }, + "children": [] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "0", + <#if param.col lte 1> + "gridTemplateColumns": "1fr 2fr", + <#elseif param.col gte 2> + "gridTemplateColumns": "1fr 1fr 1fr", + + "paddingTop": 32 + }, + "children": [ + <#list group.fields as fields> + <#-- <#list num..(group.fields?size?number)!0 as i>--> + { + "id": "id${newId()}", + <#if (fields.readonly = true)> + "type": "fx-text", + <#else> + "type": "${fields.editor}", + + "props": { + "label": "${fields.label}", + "dataset": "${fields.dataset}", + "required": "${fields.required}", + "field": "${fields.id}", + <#if fields.maxlength gt 0> + "maxlength": ${fields.maxlength}, + + <#if fields.lookup??> + "lookup": { + <#list fields.lookup as k, v> + "${k}": "${v}" <#if k_has_next>, + + }, + + "placeholder": "请输入内容", + <#if (param.col = 2)> + "tips": "${fields.desc}", + + "labelWidth": 100, + <#if (fields.readonly = true)> + "readonly": true, + <#else> + "readonly": false, + + "affixError": true + }, + "events": {} + } + <#if fields_has_next> + <#if (param.col lte 1 )> + <#if (fields.desc != "")> + ,{ + "id": "id181d83cdb41", + "type": "fx-label", + "props": { + "label": "${fields.desc}", + "labelWidth": 0, + "affixError": true, + "labelAlign": "left" + } + } + <#else> + ,{ + "id": "id${newId()}", + "type": "fx-placeholder", + "props": { + "label": "占位" + }, + "layout": { + "row": 1 + } + } + + + <#if (param.col = 2 && ((fields_index+1) % 2 = 0 ) )> + ,{ + "id": "id${newId()}", + "type": "fx-placeholder", + "props": { + "label": "占位" + }, + "layout": { + "row": 1 + } + } + + , + + + ] - }, -<#-- <#if i+1 lt param.group_num?number>--> -<#-- ,--> -<#-- --> -<#-- --> - - <#list layout.flow as group> - <#assign field = group.fields> - { - "id": "${newId()}", - "type": "fx-form-panel", - "shape": "panel", - "props": { - "size": "16", - "backgroundColor": "--color-transparent" - }, - "children": [] + }, + + <#list layout.flow as group> + <#assign field = group.fields> + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "16", + "backgroundColor": "--color-transparent" + }, + "children": [] + }, + { + + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "0", + <#if param.col lte 1> + "gridTemplateColumns": "1fr 2fr", + <#elseif param.col gte 2> + "gridTemplateColumns": "1fr 1fr 1fr", + + "paddingTop": 32 + }, + "children": [ + <#list group.fields as fields> + { + "id": "id${newId()}", + <#if (fields.readonly = true)> + "type": "fx-text", + <#else> + "type": "${fields.editor}", + + "props": { + "label": "${fields.label}", + "dataset": "${fields.dataset}", + "required": "${fields.required}", + "field": "${fields.id}", + <#if fields.maxlength gt 0> + "maxlength": ${fields.maxlength}, + + <#if fields.lookup??> + "lookup": { + <#list fields.lookup as k, v> + "${k}": "${v}" <#if k_has_next>, + + }, + + "placeholder": "请输入内容", + <#if (param.col = 2)> + "tips": "${fields.desc}", + + "labelWidth": 100, + <#if (fields.readonly = true)> + "readonly": true, + <#else> + "readonly": false, + + "affixError": true + }, + "events": {} + } + <#if fields_has_next> + <#if (param.col lte 1 )> + <#if (fields.desc != "")> + ,{ + "id": "id181d83cdb41", + "type": "fx-label", + "props": { + "label": "${fields.desc}", + "labelWidth": 0, + "affixError": true, + "labelAlign": "left" + } + } + <#else> + ,{ + "id": "id${newId()}", + "type": "fx-placeholder", + "props": { + "label": "占位" + }, + "layout": { + "row": 1 + } + } + + + <#if (param.col = 2 && ((fields_index+1) % 2 = 0 ) )> + ,{ + "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", + "type": "fx-split-panel", "shape": "panel", "props": { - "size": "0", - <#if param.col lte 1> - "gridTemplateColumns": "1fr 2fr", - <#elseif param.col gte 2> - "gridTemplateColumns": "1fr 1fr 1fr", - - "paddingTop": 32 + "horizontal": false, + "size": "250" }, "children": [ - <#list group.fields as fields> -<#-- <#list num..(group.fields?size?number)!0 as i>--> { - "id": "id${newId()}", - <#if (fields.readonly = true)> - "type": "fx-text", - <#else> - "type": "${fields.editor}", - - "props": { - "label": "${fields.label}", - "dataset": "${fields.dataset}", - "required": "${fields.required}", - "field": "${fields.id}", - <#if fields.maxlength gt 0> - "maxlength": ${fields.maxlength}, - - <#if fields.lookup??> - "lookup": { - <#list fields.lookup as k, v> - "${k}": "${v}" <#if k_has_next>, - - }, - - "placeholder": "请输入内容", - <#if (param.col = 2)> - "tips": "${fields.desc}", - - "labelWidth": 100, - <#if (fields.readonly = true)> - "readonly": true, - <#else> - "readonly": false, - - "affixError": true - }, - "events": {} - } - <#if fields_has_next> - <#if (param.col lte 1 )> - <#if (fields.desc != "")> - ,{ - "id": "id181d83cdb41", - "type": "fx-label", - "props": { - "label": "${fields.desc}", - "labelWidth": 0, - "affixError": true, - "labelAlign": "left" - } - } - <#else> - ,{ - "id": "id${newId()}", - "type": "fx-placeholder", + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", "props": { - "label": "占位" + "size": "16", + "backgroundColor": "--color-transparent" }, - "layout": { - "row": 1 - } - } - - - <#if (param.col = 2 && ((fields_index+1) % 2 = 0 ) )> - ,{ - "id": "id${newId()}", - "type": "fx-placeholder", + "children": [] + }, + { + "id": "${newId()}", + "type": "fx-split-panel", + "shape": "panel", "props": { - "label": "占位" + "horizontal": true }, - "layout": { - "row": 1 - } + "children": [ + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "16", + "backgroundColor": "--color-transparent" + }, + "children": [] + }, + { + "id": "${newId()}", + "type": "fx-split-panel", + "shape": "panel", + "props": { + "size": "", + "horizontal": false + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "alignX": "center", + "alignY": "center", + "paddingTop": 36, + "paddingBottom": 36, + "size": "", + "scroll": false + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-steps", + "w": 3, + "h": 2, + "props": { + "active": 1, + "direction": "vertical" + }, + "slots": { + "default": [ + { + "type": "fx-step", + "props": { + "label": "步骤一", + "description": "我是一段描述" + }, + "id": "${newId()}" + }, + { + "type": "fx-step", + "props": { + "label": "步骤二", + "description": "我也是一段描述" + }, + "id": "${newId()}" + }, + { + "type": "fx-step", + "props": { + "label": "步骤三", + "description": "我也也是一段描述" + }, + "id": "${newId()}" + } + ] + }, + "events": {} + } + ] + } + ] + } + ] } - - , - - ] - } -<#-- <#if i+1 lt param.group_num?number>--> -<#-- ,--> -<#-- --> -<#-- --> - -,{ -"id": "182fcdafb28", -"type": "fx-form-panel", -"shape": "panel", -"props": {}, -"children": [] -} ] }, + { "id": "${newId()}", "type": "fx-form-panel", @@ -703,7 +811,7 @@ ] } }, -{ + { "page": { "id": "${newId()}", "type": "fx-dialog",