代码生成支持文件上传组件
This commit is contained in:
parent
16e1198aea
commit
8aabeff3e5
@ -76,9 +76,12 @@ public class GenConstants
|
|||||||
/** 日期控件 */
|
/** 日期控件 */
|
||||||
public static final String HTML_DATETIME = "datetime";
|
public static final String HTML_DATETIME = "datetime";
|
||||||
|
|
||||||
/** 上传控件 */
|
/** 图片上传控件 */
|
||||||
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
||||||
|
|
||||||
|
/** 文件上传控件 */
|
||||||
|
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
||||||
|
|
||||||
/** 富文本控件 */
|
/** 富文本控件 */
|
||||||
public static final String HTML_EDITOR = "editor";
|
public static final String HTML_EDITOR = "editor";
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class GenTableColumn extends BaseEntity
|
|||||||
/** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */
|
/** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */
|
||||||
private String queryType;
|
private String queryType;
|
||||||
|
|
||||||
/** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、upload上传控件、editor富文本控件) */
|
/** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */
|
||||||
private String htmlType;
|
private String htmlType;
|
||||||
|
|
||||||
/** 字典类型 */
|
/** 字典类型 */
|
||||||
|
@ -112,11 +112,16 @@ public class GenUtils
|
|||||||
{
|
{
|
||||||
column.setHtmlType(GenConstants.HTML_SELECT);
|
column.setHtmlType(GenConstants.HTML_SELECT);
|
||||||
}
|
}
|
||||||
// 图片字段设置单图控件
|
// 图片字段设置图片上传控件
|
||||||
else if (StringUtils.endsWithIgnoreCase(columnName, "image"))
|
else if (StringUtils.endsWithIgnoreCase(columnName, "image"))
|
||||||
{
|
{
|
||||||
column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD);
|
column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD);
|
||||||
}
|
}
|
||||||
|
// 文件字段设置文件上传控件
|
||||||
|
else if (StringUtils.endsWithIgnoreCase(columnName, "file"))
|
||||||
|
{
|
||||||
|
column.setHtmlType(GenConstants.HTML_FILE_UPLOAD);
|
||||||
|
}
|
||||||
// 内容字段设置富文本控件
|
// 内容字段设置富文本控件
|
||||||
else if (StringUtils.endsWithIgnoreCase(columnName, "content"))
|
else if (StringUtils.endsWithIgnoreCase(columnName, "content"))
|
||||||
{
|
{
|
||||||
|
@ -157,6 +157,10 @@
|
|||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<imageUpload v-model="form.${field}"/>
|
<imageUpload v-model="form.${field}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "fileUpload")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<imageUpload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<editor v-model="form.${field}" :min-height="192"/>
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
@ -249,6 +253,11 @@ import ImageUpload from '@/components/ImageUpload';
|
|||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload")
|
||||||
|
import FileUpload from '@/components/FileUpload';
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
||||||
import Editor from '@/components/Editor';
|
import Editor from '@/components/Editor';
|
||||||
@ -266,6 +275,12 @@ export default {
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload")
|
||||||
|
FileUpload,
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
||||||
Editor,
|
Editor,
|
||||||
#break
|
#break
|
||||||
|
@ -189,6 +189,10 @@
|
|||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<imageUpload v-model="form.${field}"/>
|
<imageUpload v-model="form.${field}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "fileUpload")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<fileUpload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<editor v-model="form.${field}" :min-height="192"/>
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
@ -280,6 +284,12 @@ import ImageUpload from '@/components/ImageUpload';
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload")
|
||||||
|
import FileUpload from '@/components/FileUpload';
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
||||||
import Editor from '@/components/Editor';
|
import Editor from '@/components/Editor';
|
||||||
#break
|
#break
|
||||||
@ -296,6 +306,12 @@ export default {
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload")
|
||||||
|
FileUpload,
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
||||||
Editor,
|
Editor,
|
||||||
#break
|
#break
|
||||||
|
Loading…
Reference in New Issue
Block a user