From edd090a0981ad784ce0e160dff910f3f5e0236b1 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 5 Jan 2021 20:59:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/constant/GenConstants.java | 5 ++++- .../java/com/ruoyi/generator/util/GenUtils.java | 7 ++++++- .../src/main/resources/vm/vue/index-tree.vue.vm | 15 +++++++++++++++ .../src/main/resources/vm/vue/index.vue.vm | 16 ++++++++++++++++ ruoyi-ui/src/views/tool/gen/editTable.vue | 3 ++- 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java index 0799a715..b9b92538 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java @@ -76,9 +76,12 @@ public class GenConstants /** 日期控件 */ public static final String HTML_DATETIME = "datetime"; - /** 单图上传 */ + /** 图片上传控件 */ public static final String HTML_IMAGE_UPLOAD = "imageUpload"; + /** 文件上传控件 */ + public static final String HTML_FILE_UPLOAD = "fileUpload"; + /** 富文本控件 */ public static final String HTML_EDITOR = "editor"; diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index f5ba1576..e66a514b 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -112,11 +112,16 @@ public class GenUtils { column.setHtmlType(GenConstants.HTML_SELECT); } - // 图片字段设置单图控件 + // 图片字段设置图片上传控件 else if (StringUtils.endsWithIgnoreCase(columnName, "image")) { column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); } + // 文件字段设置文件上传控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "file")) + { + column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); + } // 内容字段设置富文本控件 else if (StringUtils.endsWithIgnoreCase(columnName, "content")) { diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm index d9b6f4d3..2f954f87 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -157,6 +157,10 @@ +#elseif($column.htmlType == "fileUpload") + + + #elseif($column.htmlType == "editor") @@ -249,6 +253,11 @@ import ImageUpload from '@/components/ImageUpload'; #break #end #end +#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") import Editor from '@/components/Editor'; @@ -266,6 +275,12 @@ export default { #end #end #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") Editor, #break diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index ded7e2d7..32167a28 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -189,6 +189,10 @@ +#elseif($column.htmlType == "fileUpload") + + + #elseif($column.htmlType == "editor") @@ -280,6 +284,12 @@ import ImageUpload from '@/components/ImageUpload'; #end #end #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") import Editor from '@/components/Editor'; #break @@ -296,6 +306,12 @@ export default { #end #end #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") Editor, #break diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue index a9ad5a07..329fce66 100644 --- a/ruoyi-ui/src/views/tool/gen/editTable.vue +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -90,7 +90,8 @@ - + +