Files
RuoYi/ruoyi-generator/src/main/resources/templates/tool/gen/gen.html

183 lines
7.0 KiB
HTML
Raw Normal View History

2018-07-09 08:44:52 +08:00
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
2019-03-31 12:56:04 +08:00
<head>
<th:block th:include="include :: header('代码生成列表')" />
</head>
2018-07-09 08:44:52 +08:00
<body class="gray-bg">
<div class="container-div">
<div class="row">
2018-10-01 21:32:01 +08:00
<div class="col-sm-12 search-collapse">
2018-07-15 20:39:59 +08:00
<form id="gen-form">
2018-08-01 10:07:28 +08:00
<div class="select-list">
2018-07-09 08:44:52 +08:00
<ul>
<li>
表名称:<input type="text" name="tableName"/>
</li>
<li>
表描述:<input type="text" name="tableComment"/>
</li>
2018-08-23 17:06:31 +08:00
<li class="select-time">
2018-07-20 17:21:43 +08:00
<label>表时间: </label>
2018-08-01 10:12:34 +08:00
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
2018-07-19 21:17:17 +08:00
<span>-</span>
2018-08-01 10:12:34 +08:00
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
2018-07-19 21:17:17 +08:00
</li>
2018-07-09 08:44:52 +08:00
<li>
2018-07-27 21:56:08 +08:00
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
2018-08-25 10:42:10 +08:00
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
2018-07-09 08:44:52 +08:00
</li>
</ul>
</div>
</form>
</div>
2019-02-28 20:52:07 +08:00
<div class="btn-group-sm" id="toolbar" role="group">
2019-08-08 08:53:12 +08:00
<a class="btn btn-success multiple disabled" onclick="javascript:batchGenCode()" shiro:hasPermission="tool:gen:code">
<i class="fa fa-download"></i> 生成
2018-07-09 08:44:52 +08:00
</a>
2019-08-08 08:53:12 +08:00
<a class="btn btn-info" onclick="importTable()">
<i class="fa fa-upload"></i> 导入
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="tool:gen:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="tool:gen:remove">
<i class="fa fa-remove"></i> 删除
</a>
2018-07-09 08:44:52 +08:00
</div>
2018-08-23 17:06:31 +08:00
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
2018-07-09 08:44:52 +08:00
</div>
</div>
</div>
2019-03-31 12:56:04 +08:00
<th:block th:include="include :: footer" />
2019-08-08 08:53:12 +08:00
<script th:inline="javascript">
2018-10-05 19:27:24 +08:00
var prefix = ctx + "tool/gen";
2019-08-08 08:53:12 +08:00
var editFlag = [[${@permission.hasPermi('tool:gen:edit')}]];
var removeFlag = [[${@permission.hasPermi('tool:gen:remove')}]];
var previewFlag = [[${@permission.hasPermi('tool:gen:preview')}]];
var codeFlag = [[${@permission.hasPermi('tool:gen:code')}]];
2018-07-09 08:44:52 +08:00
$(function() {
var options = {
url: prefix + "/list",
2019-08-08 08:53:12 +08:00
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
2018-07-09 08:44:52 +08:00
sortName: "createTime",
sortOrder: "desc",
showExport: true,
2019-08-08 08:53:12 +08:00
modalName: "生成配置",
2018-07-09 08:44:52 +08:00
columns: [{
checkbox: true
},
2019-08-08 08:53:12 +08:00
{
field: 'tableId',
title: '编号',
visible: false
},
2018-12-28 17:33:15 +08:00
{
title: "序号",
formatter: function (value, row, index) {
return $.table.serialNumber(index);
}
},
2018-07-09 08:44:52 +08:00
{
field: 'tableName',
2018-07-19 21:17:17 +08:00
title: '表名称',
sortable: true
2018-07-09 08:44:52 +08:00
},
{
field: 'tableComment',
2018-07-19 21:17:17 +08:00
title: '表描述',
2019-08-08 08:53:12 +08:00
sortable: true
},
{
field: 'className',
title: '实体类名称',
2018-07-19 21:17:17 +08:00
sortable: true
2018-07-09 08:44:52 +08:00
},
{
2018-07-19 21:17:17 +08:00
field: 'createTime',
title: '创建时间',
sortable: true
2018-07-09 08:44:52 +08:00
},
{
2018-07-19 21:17:17 +08:00
field: 'updateTime',
title: '更新时间',
sortable: true
2018-07-09 08:44:52 +08:00
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
2019-08-08 08:53:12 +08:00
var actions = [];
actions.push('<a class="btn btn-info btn-xs ' + previewFlag + '" href="javascript:void(0)" onclick="preview(\'' + row.tableId + '\')"><i class="fa fa-search"></i>预览</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.tableId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.tableId + '\')"><i class="fa fa-remove"></i>删除</a> ');
actions.push('<a class="btn btn-primary btn-xs ' + codeFlag + '" href="javascript:void(0)" onclick="genCode(\'' + row.tableName + '\')"><i class="fa fa-bug"></i>生成代码</a> ');
return actions.join('');
2018-07-09 08:44:52 +08:00
}
}]
};
$.table.init(options);
});
2019-08-08 08:53:12 +08:00
// 预览代码
function preview(tableId) {
var preViewUrl = prefix + "/preview/" + tableId;
$.modal.loading("正在加载数据,请稍后...");
$.get(preViewUrl, function(result) {
if (result.code == web_status.SUCCESS) {
var items = [];
$.each(result.data, function(index, value) {
value = value.replace(/</g, "&lt;");
value = value.replace(/>/g, "&gt;");
var templateName = index.substring(index.lastIndexOf("/") + 1, index.length).replace(/\.vm/g, "");
if(!$.common.equals("sql", templateName) && !$.common.equals("tree.html", templateName)){
items.push({
title: templateName , content: "<pre class=\"layui-code\">" + value + "</pre>"
})
}
});
top.layer.tab({
area: ['90%', '90%'],
shadeClose: true,
tab: items
});
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
}
2018-07-09 08:44:52 +08:00
// 生成代码
function genCode(tableName) {
$.modal.confirm("确定要生成" + tableName + "表代码吗?", function() {
2019-08-08 08:53:12 +08:00
location.href = prefix + "/genCode/" + tableName;
2018-07-09 08:44:52 +08:00
layer.msg('执行成功,正在生成代码请稍后…', { icon: 1 });
})
}
//批量生成代码
function batchGenCode() {
var rows = $.table.selectColumns("tableName");
if (rows.length == 0) {
$.modal.alertWarning("请选择要生成的数据");
return;
}
$.modal.confirm("确认要生成选中的" + rows.length + "条数据吗?", function() {
2019-08-08 08:53:12 +08:00
location.href = prefix + "/batchGenCode?tables=" + rows;
2018-07-09 08:44:52 +08:00
layer.msg('执行成功,正在生成代码请稍后…', { icon: 1 });
});
}
2019-08-08 08:53:12 +08:00
// 导入表结构
function importTable() {
var importTableUrl = prefix + "/importTable";
$.modal.open("导入表结构", importTableUrl);
}
2018-07-09 08:44:52 +08:00
</script>
</body>
</html>