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 0498014fcefe81086d909346944871c45456b73b..736992130531788f5e6516e820d0479e90aca724 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 63d42b256263a341fc6dbfea80edc9296cf6afa4..d6f24f7b35097e1898011ad7994a9eb96187e006 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 32b9b447c4b24f6a38b65f1d572117fe0ec8cbcb..3dc91b2ba8fd23d00bd28331068bd5270a103a8c 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 608bea3cc739cf74a1a8a155702c699fcb05ae8d..d6def83bc7c2d44b89af1462702f4104a8bad5c5 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);