From a948affb2d96178c4a79369f1f0a271c0d59aa32 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 15 Sep 2020 15:53:27 +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=E5=AF=8C=E6=96=87=E6=9C=AC=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/constant/GenConstants.java | 3 +++ .../generator/domain/GenTableColumn.java | 2 +- .../com/ruoyi/generator/util/GenUtils.java | 5 +++++ .../main/resources/vm/vue/index-tree.vue.vm | 20 ++++++++++++++++++- .../src/main/resources/vm/vue/index.vue.vm | 16 +++++++++++++++ ruoyi-ui/src/views/tool/gen/editTable.vue | 1 + 6 files changed, 45 insertions(+), 2 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 04b6b7dc..52485cf4 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 @@ -74,6 +74,9 @@ public class GenConstants /** 日期控件 */ public static final String HTML_DATETIME = "datetime"; + /** 富文本控件 */ + public static final String HTML_EDITOR = "editor"; + /** 字符串类型 */ public static final String TYPE_STRING = "String"; diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java index 86cc4cff..69cf4962 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java @@ -59,7 +59,7 @@ public class GenTableColumn extends BaseEntity /** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */ private String queryType; - /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件) */ + /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、editor富文本控件) */ private String htmlType; /** 字典类型 */ 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 dfb8058d..9dfbae69 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 @@ -111,6 +111,11 @@ public class GenUtils { column.setHtmlType(GenConstants.HTML_SELECT); } + // 内容字段设置富文本控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "content")) + { + column.setHtmlType(GenConstants.HTML_EDITOR); + } } /** 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 ba7dd18c..10a98625 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 @@ -139,6 +139,10 @@ +#elseif($column.htmlType == "editor") + + + #elseif($column.htmlType == "select" && "" != $dictType) @@ -221,10 +225,24 @@ import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; +#foreach($column in $columns) +#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor") +import Editor from '@/components/Editor'; +#break +#end +#end export default { name: "${BusinessName}", - components: { Treeselect }, + components: { +#foreach($column in $columns) +#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor") + Editor, +#break +#end +#end + Treeselect + }, data() { return { // 遮罩层 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 b5e45f5c..e37e1125 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -168,6 +168,10 @@ +#elseif($column.htmlType == "editor") + + + #elseif($column.htmlType == "select" && "" != $dictType) @@ -248,9 +252,21 @@