mirror of https://gitee.com/y_project/RuoYi.git
代码生成支持上传控件
parent
23b98a3ef8
commit
44df8c4c8b
|
@ -1829,6 +1829,10 @@ table.dataTable thead .sorting:after {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-control.kv-fileinput-caption {
|
||||||
|
height: 34px!important;
|
||||||
|
}
|
||||||
|
|
||||||
.form-control:focus, .single-line:focus {
|
.form-control:focus, .single-line:focus {
|
||||||
border-color: #3c8dbc !important;
|
border-color: #3c8dbc !important;
|
||||||
}
|
}
|
||||||
|
@ -4917,14 +4921,13 @@ dd.project-people {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Chat view */
|
/* Chat view */
|
||||||
.message-input {
|
.message-input {
|
||||||
height: 90px !important;
|
height: 90px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-avatar {
|
.chat-avatar {
|
||||||
width: 36px;
|
white: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
|
@ -4952,9 +4955,8 @@ dd.project-people {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media ( max-width : 992px) {
|
@media ( max-width : 992px) {
|
||||||
.chat-users,
|
.chat-users, .chat-statistic {
|
||||||
.chat-statistic {
|
margin-left: 0px;
|
||||||
margin-left: 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4974,12 +4976,12 @@ dd.project-people {
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-discussion .chat-message.left .message-avatar {
|
.chat-discussion .chat-message:nth-child(2n+1) .message-avatar {
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-discussion .chat-message.right .message-avatar {
|
.chat-discussion .chat-message:nth-child(2n) .message-avatar {
|
||||||
float: right;
|
float: right;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
@ -4994,20 +4996,20 @@ dd.project-people {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-discussion .chat-message.left .message-date {
|
.chat-discussion .chat-message:nth-child(2n+1) .message-date {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-discussion .chat-message.right .message-date {
|
.chat-discussion .chat-message:nth-child(2n) .message-date {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-discussion .chat-message.left .message {
|
.chat-discussion .chat-message:nth-child(2n+1) .message {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin-left: 55px;
|
margin-left: 55px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-discussion .chat-message.right .message {
|
.chat-discussion .chat-message:nth-child(2n) .message {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
margin-right: 55px;
|
margin-right: 55px;
|
||||||
}
|
}
|
||||||
|
@ -5036,7 +5038,6 @@ dd.project-people {
|
||||||
.chat-message-form .form-group {
|
.chat-message-form .form-group {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jsTree */
|
/* jsTree */
|
||||||
.jstree-open>.jstree-anchor>.fa-folder:before {
|
.jstree-open>.jstree-anchor>.fa-folder:before {
|
||||||
content: "\f07c";
|
content: "\f07c";
|
||||||
|
|
|
@ -71,6 +71,9 @@ public class GenConstants
|
||||||
/** 日期控件 */
|
/** 日期控件 */
|
||||||
public static final String HTML_DATETIME = "datetime";
|
public static final String HTML_DATETIME = "datetime";
|
||||||
|
|
||||||
|
/** 上传控件 */
|
||||||
|
public static final String HTML_UPLOAD = "upload";
|
||||||
|
|
||||||
/** 字符串类型 */
|
/** 字符串类型 */
|
||||||
public static final String TYPE_STRING = "String";
|
public static final String TYPE_STRING = "String";
|
||||||
|
|
||||||
|
|
|
@ -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日期控件) */
|
/** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、upload上传控件) */
|
||||||
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, "file"))
|
||||||
|
{
|
||||||
|
column.setHtmlType(GenConstants.HTML_UPLOAD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -520,6 +520,7 @@
|
||||||
<option value="radio" {{if htmlType==="radio"}}selected{{/if}}>单选框</option>
|
<option value="radio" {{if htmlType==="radio"}}selected{{/if}}>单选框</option>
|
||||||
<option value="checkbox" {{if htmlType==="checkbox"}}selected{{/if}}>复选框</option>
|
<option value="checkbox" {{if htmlType==="checkbox"}}selected{{/if}}>复选框</option>
|
||||||
<option value="datetime" {{if htmlType==="datetime"}}selected{{/if}}>日期控件</option>
|
<option value="datetime" {{if htmlType==="datetime"}}selected{{/if}}>日期控件</option>
|
||||||
|
<option value="upload" {{if htmlType==="upload"}}selected{{/if}}>上传控件</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
</head>
|
</head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
@ -46,6 +52,16 @@
|
||||||
<input name="${field}" class="form-control" type="text"#if($column.required) required#end>
|
<input name="${field}" class="form-control" type="text"#if($column.required) required#end>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
#elseif($column.htmlType == "upload")
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="hidden" name="${field}">
|
||||||
|
<div class="file-loading">
|
||||||
|
<input class="form-control file-upload" id="${field}" name="file" type="file">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">${comment}:</label>
|
<label class="col-sm-3 control-label">${comment}:</label>
|
||||||
|
@ -146,6 +162,12 @@
|
||||||
<th:block th:include="include :: datetimepicker-js" />
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
|
#break
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var prefix = ctx + "${moduleName}/${businessName}"
|
var prefix = ctx + "${moduleName}/${businessName}"
|
||||||
|
@ -175,6 +197,21 @@
|
||||||
});
|
});
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
|
||||||
|
$(".file-upload").fileinput({
|
||||||
|
uploadUrl: '/common/upload',
|
||||||
|
maxFileCount: 1,
|
||||||
|
autoReplace: true
|
||||||
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||||
|
}).on('fileremoved', function (event, id, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||||
|
})
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#if($table.tree)
|
#if($table.tree)
|
||||||
|
|
||||||
/*${functionName}-新增-选择父部门树*/
|
/*${functionName}-新增-选择父部门树*/
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
</head>
|
</head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
@ -46,6 +52,16 @@
|
||||||
<input name="${field}" th:field="*{${field}}" class="form-control" type="text"#if($column.required) required#end>
|
<input name="${field}" th:field="*{${field}}" class="form-control" type="text"#if($column.required) required#end>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
#elseif($column.htmlType == "upload")
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="hidden" name="${field}" th:field="*{${field}}">
|
||||||
|
<div class="file-loading">
|
||||||
|
<input class="form-control file-upload" id="${field}" name="file" type="file">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">${comment}:</label>
|
<label class="col-sm-3 control-label">${comment}:</label>
|
||||||
|
@ -146,6 +162,12 @@
|
||||||
<th:block th:include="include :: datetimepicker-js" />
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
|
#break
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var prefix = ctx + "${moduleName}/${businessName}";
|
var prefix = ctx + "${moduleName}/${businessName}";
|
||||||
|
@ -175,6 +197,27 @@
|
||||||
});
|
});
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
|
||||||
|
$(".file-upload").each(function (i) {
|
||||||
|
var val = $("input[name='" + this.id + "']").val()
|
||||||
|
$(this).fileinput({
|
||||||
|
'uploadUrl': '/common/upload',
|
||||||
|
initialPreviewAsData: true,
|
||||||
|
initialPreview: [val],
|
||||||
|
maxFileCount: 1,
|
||||||
|
autoReplace: true
|
||||||
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||||
|
}).on('fileremoved', function (event, id, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||||
|
})
|
||||||
|
$(this).fileinput('_initFileActions');
|
||||||
|
});
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#if($table.tree)
|
#if($table.tree)
|
||||||
|
|
||||||
/*${functionName}-新增-选择父部门树*/
|
/*${functionName}-新增-选择父部门树*/
|
||||||
|
|
Loading…
Reference in New Issue