Files
RuoYi/src/main/resources/static/ruoyi/tool/gen/gen.js

54 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-04-28 21:39:42 +08:00
var prefix = ctx + "tool/gen"
2018-04-23 00:00:29 +08:00
$(function() {
var columns = [{
checkbox: true
},
{
field: 'tableName',
title: '表名称'
},
{
field: 'tableComment',
title: '表描述'
},
{
2018-05-13 15:10:15 +08:00
field: 'createDateTimeStr',
2018-04-23 00:00:29 +08:00
title: '创建时间'
},
{
2018-05-13 15:10:15 +08:00
field: 'updateDateTimeStr',
2018-04-23 00:00:29 +08:00
title: '更新时间'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var msg = '<a class="btn btn-primary btn-sm" href="#" title="生成" onclick="genCode(\'' + row.tableName + '\')"><i class="fa fa-bug"></i></a> ';
return msg;
}
}];
var url = prefix + "/list";
$.initTable(columns, url);
});
// 生成代码
function genCode(tableName) {
2018-04-25 22:16:41 +08:00
$.modalConfirm("确定要生成" + tableName + "表代码吗?", function() {
2018-04-23 00:00:29 +08:00
location.href = prefix + "/genCode/" + tableName;
2018-04-25 22:16:41 +08:00
layer.msg('执行成功,正在生成代码请稍后…', {icon: 1});
2018-04-23 00:00:29 +08:00
})
}
//批量生成代码
function batchGenCode() {
var rows = $.getSelections("tableName");
if (rows.length == 0) {
$.modalMsg("请选择要生成的数据", "warning");
return;
}
2018-04-25 22:16:41 +08:00
$.modalConfirm("确认要生成选中的" + rows.length + "条数据吗?", function() {
2018-04-23 00:00:29 +08:00
location.href = prefix + "/batchGenCode?tables=" + JSON.stringify(rows);
});
}