Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
edd090a0
Commit
edd090a0
authored
Jan 05, 2021
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码生成支持文件上传组件
parent
3cd88678
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
3 deletions
+43
-3
GenConstants.java
...src/main/java/com/ruoyi/common/constant/GenConstants.java
+4
-1
GenUtils.java
...ator/src/main/java/com/ruoyi/generator/util/GenUtils.java
+6
-1
index-tree.vue.vm
ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
+15
-0
index.vue.vm
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
+16
-0
editTable.vue
ruoyi-ui/src/views/tool/gen/editTable.vue
+2
-1
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
View file @
edd090a0
...
@@ -76,9 +76,12 @@ public class GenConstants
...
@@ -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"
;
...
...
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
View file @
edd090a0
...
@@ -112,11 +112,16 @@ public class GenUtils
...
@@ -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"
))
{
{
...
...
ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
View file @
edd090a0
...
@@ -157,6 +157,10 @@
...
@@ -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';
...
@@ -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 {
...
@@ -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
...
...
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
View file @
edd090a0
...
@@ -189,6 +189,10 @@
...
@@ -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';
...
@@ -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 {
...
@@ -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
...
...
ruoyi-ui/src/views/tool/gen/editTable.vue
View file @
edd090a0
...
@@ -90,7 +90,8 @@
...
@@ -90,7 +90,8 @@
<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=
"imageUpload"
/>
<el-option
label=
"图片上传"
value=
"imageUpload"
/>
<el-option
label=
"文件上传"
value=
"fileUpload"
/>
<el-option
label=
"富文本控件"
value=
"editor"
/>
<el-option
label=
"富文本控件"
value=
"editor"
/>
</el-select>
</el-select>
</
template
>
</
template
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment