Skip to content

Commit

Permalink
fix(generator): 前端页面生成表单类型 (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
luoqiz authored Dec 12, 2024
1 parent 9ebecdc commit 75d2662
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import top.continew.starter.core.enums.BaseEnum;

/**
Expand Down Expand Up @@ -72,9 +71,9 @@ public enum FormTypeEnum implements BaseEnum<Integer> {
TEXT_AREA(8, "文本域"),

/**
* 日期时间框
* 时间框
*/
DATE_TIME(9, "日期时间框"),
TIME(9, "时间框"),

/**
* 日期框
Expand All @@ -84,7 +83,13 @@ public enum FormTypeEnum implements BaseEnum<Integer> {
/**
* 树形选择
*/
TREE_SELECT(11, "树选择"),;
TREE_SELECT(11, "树选择"),

/**
* 时间框
*/
DATE_TIME(12, "日期时间框"),
;

private final Integer value;
private final String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class ${className} extends BaseReq {
</#if>
</#if>
<#if fieldConfig.fieldType = 'String' && fieldConfig.columnSize??>
@Length(max = ${fieldConfig.columnSize}, message = "${fieldConfig.comment}长度不能超过 {max} 个字符")
@Length(max = ${fieldConfig.columnSize?c}, message = "${fieldConfig.comment}长度不能超过 {max} 个字符")
</#if>
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
</#if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const [form, resetForm] = useResetReactive({
// todo 待补充
})
const columns: Columns = reactive([
const columns: Columns = reactive<Columns>([
<#list fieldConfigs as fieldConfig>
<#if fieldConfig.showInForm>
{
Expand All @@ -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',
Expand All @@ -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'>
Expand Down

0 comments on commit 75d2662

Please sign in to comment.