代码生成支持上传控件
This commit is contained in:
parent
566053da0c
commit
823e95667e
|
@ -74,6 +74,9 @@ public class GenConstants
|
||||||
/** 日期控件 */
|
/** 日期控件 */
|
||||||
public static final String HTML_DATETIME = "datetime";
|
public static final String HTML_DATETIME = "datetime";
|
||||||
|
|
||||||
|
/** 上传控件 */
|
||||||
|
public static final String HTML_UPLOAD_IMAGE = "uploadImage";
|
||||||
|
|
||||||
/** 富文本控件 */
|
/** 富文本控件 */
|
||||||
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日期控件、editor富文本控件) */
|
/** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、upload上传控件、editor富文本控件) */
|
||||||
private String htmlType;
|
private String htmlType;
|
||||||
|
|
||||||
/** 字典类型 */
|
/** 字典类型 */
|
||||||
|
|
|
@ -111,6 +111,11 @@ public class GenUtils
|
||||||
{
|
{
|
||||||
column.setHtmlType(GenConstants.HTML_SELECT);
|
column.setHtmlType(GenConstants.HTML_SELECT);
|
||||||
}
|
}
|
||||||
|
// 文件字段设置上传控件
|
||||||
|
else if (StringUtils.endsWithIgnoreCase(columnName, "image"))
|
||||||
|
{
|
||||||
|
column.setHtmlType(GenConstants.HTML_UPLOAD_IMAGE);
|
||||||
|
}
|
||||||
// 内容字段设置富文本控件
|
// 内容字段设置富文本控件
|
||||||
else if (StringUtils.endsWithIgnoreCase(columnName, "content"))
|
else if (StringUtils.endsWithIgnoreCase(columnName, "content"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -139,6 +139,10 @@
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "uploadImage")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<uploadImage 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"/>
|
||||||
|
@ -226,6 +230,12 @@ import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${Busin
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "uploadImage")
|
||||||
|
import UploadImage from '@/components/UploadImage';
|
||||||
|
#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
|
||||||
|
@ -236,6 +246,12 @@ export default {
|
||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
components: {
|
components: {
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "uploadImage")
|
||||||
|
UploadImage,
|
||||||
|
#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
|
||||||
|
|
|
@ -168,6 +168,10 @@
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "uploadImage")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<uploadImage 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"/>
|
||||||
|
@ -253,6 +257,12 @@
|
||||||
<script>
|
<script>
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "uploadImage")
|
||||||
|
import UploadImage from '@/components/UploadImage';
|
||||||
|
#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
|
||||||
|
@ -261,12 +271,20 @@ import Editor from '@/components/Editor';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
|
components: {
|
||||||
#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 == "uploadImage")
|
||||||
components: { Editor },
|
UploadImage,
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor")
|
||||||
|
Editor,
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
|
@ -90,6 +90,7 @@
|
||||||
<el-option label="单选框" value="radio" />
|
<el-option label="单选框" value="radio" />
|
||||||
<el-option label="复选框" value="checkbox" />
|
<el-option label="复选框" value="checkbox" />
|
||||||
<el-option label="日期控件" value="datetime" />
|
<el-option label="日期控件" value="datetime" />
|
||||||
|
<el-option label="上传控件" value="uploadImage" />
|
||||||
<el-option label="富文本控件" value="editor" />
|
<el-option label="富文本控件" value="editor" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue