feat: vue3 vben 代码生成支持创建和更新两种表单

This commit is contained in:
xingyu 2023-04-27 13:17:03 +08:00
parent 1df0fd1bf8
commit c88794f212

View File

@ -154,68 +154,68 @@ export const updateFormSchema: FormSchema[] = [
show: false, show: false,
component: 'Input' component: 'Input'
}, },
#foreach($column in $columns) #foreach($column in $columns)
#if ($column.updateOperation) #if ($column.updateOperation)
#set ($dictType = $column.dictType) #set ($dictType = $column.dictType)
#set ($javaField = $column.javaField) #set ($javaField = $column.javaField)
#set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set ($comment = $column.columnComment) #set ($comment = $column.columnComment)
#if (!$column.primaryKey)## 忽略主键,不用在表单里 #if (!$column.primaryKey)## 忽略主键,不用在表单里
{ {
label: '${comment}', label: '${comment}',
field: '${javaField}', field: '${javaField}',
#if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键 #if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
required: true, required: true,
#end
#if ($column.htmlType == "input")
component: 'Input'
#elseif($column.htmlType == "imageUpload")## 图片上传
component: 'Upload'
#elseif($column.htmlType == "fileUpload")## 文件上传
component: 'Upload'
#elseif($column.htmlType == "editor")## 文本编辑器
component: 'InputTextArea'
#elseif($column.htmlType == "select")## 下拉框
component: 'Select',
componentProps: {
#if ("" != $dictType)## 有数据字典
#if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")
#set ($dictMethod = "getIntDictOptions")
#elseif ($javaType == "String")
#set ($dictMethod = "getStrDictOptions")
#elseif ($javaType == "Boolean")
#set ($dictMethod = "getBoolDictOptions")
#end
options: $dictMethod(DICT_TYPE.$dictType.toUpperCase())
#else##没数据字典
options:[]
#end
}
#elseif($column.htmlType == "checkbox")## 多选框
component: 'Checkbox',
componentProps: {
#if ("" != $dictType)## 有数据字典
options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
#else##没数据字典
options:[]
#end
}
#elseif($column.htmlType == "radio")## 单选框
component: 'Radio',
componentProps: {
#if ("" != $dictType)## 有数据字典
options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
#else##没数据字典
options:[]
#end
}
#elseif($column.htmlType == "datetime")## 时间框
component: 'DatePicker'
#elseif($column.htmlType == "textarea")## 文本域
component: 'InputTextArea'
#end
},
#end
#end #end
#end #if ($column.htmlType == "input")
component: 'Input'
#elseif($column.htmlType == "imageUpload")## 图片上传
component: 'Upload'
#elseif($column.htmlType == "fileUpload")## 文件上传
component: 'Upload'
#elseif($column.htmlType == "editor")## 文本编辑器
component: 'InputTextArea'
#elseif($column.htmlType == "select")## 下拉框
component: 'Select',
componentProps: {
#if ("" != $dictType)## 有数据字典
#if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")
#set ($dictMethod = "getIntDictOptions")
#elseif ($javaType == "String")
#set ($dictMethod = "getStrDictOptions")
#elseif ($javaType == "Boolean")
#set ($dictMethod = "getBoolDictOptions")
#end
options: $dictMethod(DICT_TYPE.$dictType.toUpperCase())
#else##没数据字典
options:[]
#end
}
#elseif($column.htmlType == "checkbox")## 多选框
component: 'Checkbox',
componentProps: {
#if ("" != $dictType)## 有数据字典
options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
#else##没数据字典
options:[]
#end
}
#elseif($column.htmlType == "radio")## 单选框
component: 'Radio',
componentProps: {
#if ("" != $dictType)## 有数据字典
options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
#else##没数据字典
options:[]
#end
}
#elseif($column.htmlType == "datetime")## 时间框
component: 'DatePicker'
#elseif($column.htmlType == "textarea")## 文本域
component: 'InputTextArea'
#end
},
#end
#end
#end
] ]