From 75d26623652d4813643cea9a7c3f821e44edc885 Mon Sep 17 00:00:00 2001 From: luoqiz Date: Thu, 12 Dec 2024 19:20:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(generator):=20=E5=89=8D=E7=AB=AF=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=94=9F=E6=88=90=E8=A1=A8=E5=8D=95=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=20(#110)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/generator/enums/FormTypeEnum.java | 13 +++++++++---- .../src/main/resources/templates/backend/Req.ftl | 2 +- .../main/resources/templates/frontend/AddModal.ftl | 12 ++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/enums/FormTypeEnum.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/enums/FormTypeEnum.java index e7b2ed4b6..82faaab23 100644 --- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/enums/FormTypeEnum.java +++ b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/enums/FormTypeEnum.java @@ -18,7 +18,6 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; - import top.continew.starter.core.enums.BaseEnum; /** @@ -72,9 +71,9 @@ public enum FormTypeEnum implements BaseEnum { TEXT_AREA(8, "文本域"), /** - * 日期时间框 + * 时间框 */ - DATE_TIME(9, "日期时间框"), + TIME(9, "时间框"), /** * 日期框 @@ -84,7 +83,13 @@ public enum FormTypeEnum implements BaseEnum { /** * 树形选择 */ - TREE_SELECT(11, "树选择"),; + TREE_SELECT(11, "树选择"), + + /** + * 时间框 + */ + DATE_TIME(12, "日期时间框"), + ; private final Integer value; private final String description; diff --git a/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/Req.ftl b/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/Req.ftl index 72111f18f..74f8cce5e 100644 --- a/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/Req.ftl +++ b/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/Req.ftl @@ -48,7 +48,7 @@ public class ${className} extends BaseReq { <#if fieldConfig.fieldType = 'String' && fieldConfig.columnSize??> - @Length(max = ${fieldConfig.columnSize}, message = "${fieldConfig.comment}长度不能超过 {max} 个字符") + @Length(max = ${fieldConfig.columnSize?c}, message = "${fieldConfig.comment}长度不能超过 {max} 个字符") private ${fieldConfig.fieldType} ${fieldConfig.fieldName}; diff --git a/continew-plugin/continew-plugin-generator/src/main/resources/templates/frontend/AddModal.ftl b/continew-plugin/continew-plugin-generator/src/main/resources/templates/frontend/AddModal.ftl index 92c0e24d9..de1744ffa 100644 --- a/continew-plugin/continew-plugin-generator/src/main/resources/templates/frontend/AddModal.ftl +++ b/continew-plugin/continew-plugin-generator/src/main/resources/templates/frontend/AddModal.ftl @@ -45,7 +45,7 @@ const [form, resetForm] = useResetReactive({ // todo 待补充 }) -const columns: Columns = reactive([ +const columns: Columns = reactive([ <#list fieldConfigs as fieldConfig> <#if fieldConfig.showInForm> { @@ -55,9 +55,17 @@ const columns: Columns = reactive([ type: 'input', <#elseif fieldConfig.formType = 'TEXT_AREA'> type: 'textarea', + props: { + autoSize: true + }, <#elseif fieldConfig.formType = 'DATE'> type: 'date-picker', <#elseif fieldConfig.formType = 'DATE_TIME'> + type: 'date-picker', + props: { + showTime: true, + }, + <#elseif fieldConfig.formType = 'TIME'> type: 'time-picker', <#elseif fieldConfig.formType = 'INPUT_NUMBER'> type: 'input-number', @@ -66,7 +74,7 @@ const columns: Columns = reactive([ <#elseif fieldConfig.formType = 'SWITCH'> type: 'switch', <#elseif fieldConfig.formType = 'CHECK_BOX'> - type: 'check-group', + type: 'checkbox-group', <#elseif fieldConfig.formType = 'TREE_SELECT'> type: 'tree-select', <#elseif fieldConfig.formType = 'SELECT'>