From 6fa1ed8eada23ef1fd1642d5fd0bfb02e9fc6f97 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Wed, 15 May 2024 18:18:58 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=84=E7=90=86=E5=99=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?getSimpleValue()=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1157294325202944]表单组件处理器增加getSimpleValue()方法 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1157294325202944 --- .../core/IFormAttributeDataConversionHandler.java | 9 +++++++++ .../form/attribute/handler/CheckboxHandler.java | 6 ++++++ .../framework/form/attribute/handler/RadioHandler.java | 6 ++++++ .../framework/form/attribute/handler/SelectHandler.java | 6 ++++++ 4 files changed, 27 insertions(+) diff --git a/src/main/java/neatlogic/framework/form/attribute/core/IFormAttributeDataConversionHandler.java b/src/main/java/neatlogic/framework/form/attribute/core/IFormAttributeDataConversionHandler.java index 0498014fc..736992130 100644 --- a/src/main/java/neatlogic/framework/form/attribute/core/IFormAttributeDataConversionHandler.java +++ b/src/main/java/neatlogic/framework/form/attribute/core/IFormAttributeDataConversionHandler.java @@ -42,6 +42,15 @@ public interface IFormAttributeDataConversionHandler { */ Object valueConversionText(AttributeDataVo attributeDataVo, JSONObject configObj); + /** + * 获取简单值,例如下拉框值为{"value":"a", "text":"A"},返回值为a + * @param originalValue + * @return + */ + default Object getSimpleValue(Object originalValue) { + return originalValue; + } + /** * 数据转换,用于邮件模板展示表单信息 * diff --git a/src/main/java/neatlogic/module/framework/form/attribute/handler/CheckboxHandler.java b/src/main/java/neatlogic/module/framework/form/attribute/handler/CheckboxHandler.java index 63d42b256..d6f24f7b3 100644 --- a/src/main/java/neatlogic/module/framework/form/attribute/handler/CheckboxHandler.java +++ b/src/main/java/neatlogic/module/framework/form/attribute/handler/CheckboxHandler.java @@ -24,6 +24,7 @@ import neatlogic.framework.form.constvalue.FormHandler; import neatlogic.framework.form.dto.AttributeDataVo; import neatlogic.framework.form.dto.FormAttributeVo; import neatlogic.framework.form.exception.AttributeValidException; +import neatlogic.framework.util.FormUtil; import neatlogic.module.framework.form.service.FormService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; @@ -77,6 +78,11 @@ public class CheckboxHandler extends FormHandlerBase { return resultObj.getJSONArray("valueList"); } + @Override + public Object getSimpleValue(Object originalValue) { + return FormUtil.getFormSelectAttributeValueByOriginalValue(originalValue); + } + @Override public Object dataTransformationForEmail(AttributeDataVo attributeDataVo, JSONObject configObj) { JSONObject resultObj = getMyDetailedData(attributeDataVo, configObj); diff --git a/src/main/java/neatlogic/module/framework/form/attribute/handler/RadioHandler.java b/src/main/java/neatlogic/module/framework/form/attribute/handler/RadioHandler.java index 32b9b447c..3dc91b2ba 100644 --- a/src/main/java/neatlogic/module/framework/form/attribute/handler/RadioHandler.java +++ b/src/main/java/neatlogic/module/framework/form/attribute/handler/RadioHandler.java @@ -24,6 +24,7 @@ import neatlogic.framework.form.constvalue.FormHandler; import neatlogic.framework.form.dto.AttributeDataVo; import neatlogic.framework.form.dto.FormAttributeVo; import neatlogic.framework.form.exception.AttributeValidException; +import neatlogic.framework.util.FormUtil; import neatlogic.module.framework.form.service.FormService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; @@ -94,6 +95,11 @@ public class RadioHandler extends FormHandlerBase { return resultObj.getJSONArray("valueList"); } + @Override + public Object getSimpleValue(Object originalValue) { + return FormUtil.getFormSelectAttributeValueByOriginalValue(originalValue); + } + @Override public Object dataTransformationForEmail(AttributeDataVo attributeDataVo, JSONObject configObj) { JSONObject resultObj = getMyDetailedData(attributeDataVo, configObj); diff --git a/src/main/java/neatlogic/module/framework/form/attribute/handler/SelectHandler.java b/src/main/java/neatlogic/module/framework/form/attribute/handler/SelectHandler.java index 608bea3cc..d6def83bc 100644 --- a/src/main/java/neatlogic/module/framework/form/attribute/handler/SelectHandler.java +++ b/src/main/java/neatlogic/module/framework/form/attribute/handler/SelectHandler.java @@ -24,6 +24,7 @@ import neatlogic.framework.form.constvalue.FormHandler; import neatlogic.framework.form.dto.AttributeDataVo; import neatlogic.framework.form.dto.FormAttributeVo; import neatlogic.framework.form.exception.AttributeValidException; +import neatlogic.framework.util.FormUtil; import neatlogic.module.framework.form.service.FormService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; @@ -188,6 +189,11 @@ public class SelectHandler extends FormHandlerBase { // return dataObj; } + @Override + public Object getSimpleValue(Object originalValue) { + return FormUtil.getFormSelectAttributeValueByOriginalValue(originalValue); + } + @Override public Object dataTransformationForEmail(AttributeDataVo attributeDataVo, JSONObject configObj) { JSONObject resultObj = getMyDetailedData(attributeDataVo, configObj); -- Gitee