本次提交 生成代码模块 只读 默认字段

This commit is contained in:
lin 2020-12-15 08:56:02 +08:00
parent e93f093885
commit 02e2d3d4ca
7 changed files with 364 additions and 24 deletions

View File

@ -215,7 +215,7 @@
<version>${ruoyi.version}</version>
</dependency>
<!-- 平台配置 -->
<!-- 平台基础信息 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>province-platform</artifactId>

View File

@ -13,7 +13,7 @@
<description>
平台模块
平台基础资料模块
</description>
<dependencies>

View File

@ -79,13 +79,12 @@
<artifactId>ruoyi-generator</artifactId>
</dependency>
<!-- 平台配置 -->
<!-- 平台基础信息 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>province-platform</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -51,10 +51,10 @@
</div>
<label class="col-sm-2 control-label is-required">制单时间:</label>
<label class="col-sm-2 control-label is-required">制单A时间:</label>
<div class="col-sm-3">
<div class="input-group date">
<input name="createTime" class="form-control" placeholder="yyyy-MM-dd" readonly="readonly" type="text" required>
<input name="createTime" class="form-control" enabled="false" placeholder="yyyy-MM-dd hh:ii:ss" type="text" required>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>

View File

@ -27,43 +27,50 @@
#if($table.sub)
<h4 class="form-header h4">${functionName}信息</h4>
#end
<fieldset>
#set($cumvar=0)
#set($field=$column.javaField)
#set($colcount=$effectivecols.size())
#foreach($column in $effectivecols)
#set($field=$column.javaField)
#if($column.edit && !$column.pk)
#if(($column.usableColumn) || (!$column.superColumn))
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else
#set($comment=$column.columnComment)
#set($comment=$column.columnComment)
#end
#set($field=$column.javaField)
#set($dictType=$column.dictType)
#set($cumvar=$cumvar+1)
#if($column.htmlType == "textarea")
#if($cumvar%2==0)
</div>
</div>
</div>
#end
<div class="form-group">
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}</label>
<div class="col-sm-8">
<textarea name="${field}" class="form-control"#if($column.required) required#end></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label#if($column.required) is-required#end">${comment}_${cumvar}</label>
<div class="col-sm-8">
<textarea name="${field}" class="form-control"#if($column.required) required#end></textarea>
</div>
</div>
</div>
</div>
#else
#if($cumvar%2==1)
<div class="form-group">
<div class="row">
<div class="col-sm-6">
#end
#parse("\vm\html\col2\formtpl.vm")
#parse("\vm\html\col2\formedittpl.vm")
#if($cumvar%2==0 || ($cumvar>=$colcount))
</div>
</div>
</div>
#end
#end
#end
</fieldset>
#end
#end
#*
<div class="row"> ## col-md-6
#foreach($column in $effectivecols)

View File

@ -0,0 +1,312 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增${functionName}')" />
#foreach($column in $columns)
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
<th:block th:include="include :: datetimepicker-css" />
#break
#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
#foreach($column in $columns)
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
<th:block th:include="include :: summernote-css" />
#break
#end
#end
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-${businessName}-add">
#if($table.sub)
<h4 class="form-header h4">${functionName}信息</h4>
#end
<fieldset>
#set($cumvar=0)
#set($field=$column.javaField)
#set($colcount=$effectivecols.size())
#foreach($column in $effectivecols)
#set($field=$column.javaField)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else
#set($comment=$column.columnComment)
#end
#set($dictType=$column.dictType)
#set($cumvar=$cumvar+1)
#if($column.htmlType == "textarea")
#if($cumvar%2==0)
</div>
#end
<div class="form-group">
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}</label>
<div class="col-sm-8">
<textarea name="${field}" class="form-control"#if($column.required) required#end></textarea>
</div>
</div>
#else
#if($cumvar%2==1)
<div class="form-group">
#end
#parse("\vm\html\col2\formtpl.vm")
#if($cumvar%2==0 || ($cumvar>=$colcount))
</div>
#end
#end
#end
</fieldset>
#*
<div class="row"> ## col-md-6
#foreach($column in $effectivecols)
#set($field=$column.javaField)
##if($column.insert && !$column.pk)
##if(($column.usableColumn) || (!$column.superColumn))
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else
#set($comment=$column.columnComment)
#end
#set($dictType=$column.dictType)
##set($cumvar=$cumvar+1)
##if($cumvar%2==1)
#parse("vm/html/formtpl.vm")
##end
##end
##end
#end
*#
#if($table.sub)
<h4 class="form-header h4">${subTable.functionName}信息</h4>
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
#end
</form>
</div>
<th:block th:include="include :: footer" />
#foreach($column in $columns)
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
<th:block th:include="include :: datetimepicker-js" />
#break
#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
#foreach($column in $columns)
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
<th:block th:include="include :: summernote-js" />
#break
#end
#end
<script th:inline="javascript">
var prefix = ctx + "${moduleName}/${businessName}"
#if($table.sub)
#foreach($column in $subTable.columns)
#if(${column.dictType} != '')
var ${column.javaField}Datas = [[${@dict.getType('${column.dictType}')}]];
#end
#end
#end
$("#form-${businessName}-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-${businessName}-add').serialize());
}
}
#foreach($column in $columns)
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
$("input[name='$column.javaField']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
#end
#end
#foreach($column in $columns)
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
$(".file-upload").fileinput({
uploadUrl: ctx + '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
#foreach($column in $columns)
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
$(function() {
$('.summernote').summernote({
lang: 'zh-CN',
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
});
#break
#end
#end
#if($table.tree)
/*${functionName}-新增-选择父部门树*/
function select${BusinessName}Tree() {
var options = {
title: '${functionName}选择',
width: "380",
url: prefix + "/select${BusinessName}Tree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
#end
#if($table.sub)
$(function() {
var options = {
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
sidePagination: "client",
columns: [{
checkbox: true
},
{
field: 'index',
align: 'center',
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
#foreach($column in $subTable.columns)
#set($dictType=$column.dictType)
#set($javaField=$column.javaField)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else
#set($comment=$column.columnComment)
#end
#if($column.pk || $javaField == ${subTableFkclassName})
#elseif($column.list && "" != $dictType)
{
field: '${javaField}',
align: 'center',
title: '${comment}',
formatter: function(value, row, index) {
var name = $.common.sprintf("${subclassName}List[%s].${javaField}", index);
return $.common.dictToSelect(${javaField}Datas, value, name);
}
#if($velocityCount != $subTable.columns.size())},#end
#else
{
field: '${javaField}',
align: 'center',
title: '${comment}',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='${subclassName}List[%s].${javaField}' value='%s'>", index, value);
return html;
}
#if($velocityCount != $subTable.columns.size())},#end
#end
#end
}]
};
$.table.init(options);
});
function addColumn() {
var count = $("#" + table.options.id).bootstrapTable('getData').length;
sub.editColumn();
$("#" + table.options.id).bootstrapTable('insertRow', {
index: count,
row: {
index: $.table.serialNumber(count),
#foreach($column in $subTable.columns)
#set($javaField=$column.javaField)
#if($column.pk || $javaField == ${subTableFkclassName})
#else
${javaField}: ""#if($velocityCount != $subTable.columns.size()),#end
#end
#end
}
});
}
#end
</script>
</body>
</html>

View File

@ -0,0 +1,22 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('单据号迭代信息', '3', '1', '/config/no', 'C', '0', 'config:no:view', '#', 'admin', sysdate(), '', null, '单据号迭代信息菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('单据号迭代信息查询', @parentId, '1', '#', 'F', '0', 'config:no:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('单据号迭代信息新增', @parentId, '2', '#', 'F', '0', 'config:no:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('单据号迭代信息修改', @parentId, '3', '#', 'F', '0', 'config:no:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('单据号迭代信息删除', @parentId, '4', '#', 'F', '0', 'config:no:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('单据号迭代信息导出', @parentId, '5', '#', 'F', '0', 'config:no:export', '#', 'admin', sysdate(), '', null, '');