提交 63abe29f 编写于 作者: doc_wei's avatar doc_wei

代码生成器整体修改

上级 43a2e751
......@@ -6,7 +6,7 @@ layui.config({
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form', 'codemirror', 'xml', 'clike', 'css', 'htmlmixed', 'javascript', 'nginx',
'solr', 'sql', 'vue'], function (exports) {
'solr', 'sql', 'vue'], function (exports) {
winui.renderColor();
//模板分组ID
groupId = parent.rowId;
......@@ -15,7 +15,6 @@ layui.config({
table = layui.table;
authBtn('1560217136068');
table.render({
id: 'messageTable',
elem: '#messageTable',
......@@ -28,7 +27,7 @@ layui.config({
limit: 8,
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
{ field: 'modelName', title: '模板别名', width: 120 },
{ field: 'modelName', title: '模板后缀', width: 120 },
{ field: 'modelType', title: '模板类型', width: 120 },
{ field: 'id', title: '模板内容', width: 120, templet: function(d){
return '<i class="fa fa-fw fa-html5 cursor" lay-event="modelContent"></i>';
......@@ -73,7 +72,7 @@ layui.config({
type: 1,
title: '模板内容',
shade: 0.3,
area: ['1200px', '600px'],
area: ['90vw', '90vh'],
content: $("#modelContentDiv").html(),
});
}
......
var params = '';
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form', 'codemirror', 'xml', 'clike', 'css', 'htmlmixed', 'javascript', 'nginx',
'solr', 'sql', 'vue'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$,
form = layui.form;
matchingLanguage();
form.render();
showDataUseHandlebars("tableColumn", getFileContent('tpl/template/table-column.tpl'), parent.tableColumn);
form.render('select');
form.on('select(tableColumn)', function(data){
returnResult();
});
form.on('select(showModel)', function(data){
AjaxPostUtil.request({url: flowableBasePath + "dsform007", params:{rowId: data.value}, type: 'json', callback: function(json){
if(json.returnCode == 0){
var mode = returnModel(json.bean.htmlType);
if (!isNull(mode.length)) {
htmlModelEditor.setOption('mode', mode);
htmlSuccessEditor.setOption('mode', mode);
}
htmlModelEditor.setValue(json.bean.htmlContent);
mode = returnModel(json.bean.jsType);
if (!isNull(mode.length)) {
jsModelEditor.setOption('mode', mode);
jsSuccessEditor.setOption('mode', mode);
}
jsModelEditor.setValue(json.bean.jsContent);
returnResult();
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
form.on('checkbox(checkboxLimit)', function(data){
returnResult();
});
//展现形式
showGrid({
id: "showModel",
url: flowableBasePath + "dsform006",
params: {},
pagination: false,
template: getFileContent('tpl/template/select-option.tpl'),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
form.render('select');
//限制条件
showGrid({
id: "limitRequire",
url: flowableBasePath + "dsformlimitrequirement006",
params: {},
pagination: false,
template: getFileContent('tpl/template/checkbox-limit.tpl'),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
form.render('checkbox');
}
});
}
});
var htmlModelEditor = CodeMirror.fromTextArea(document.getElementById("htmlModelEditor"), {
mode : "text/x-java", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 4, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : true, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
var jsModelEditor = CodeMirror.fromTextArea(document.getElementById("jsModelEditor"), {
mode : "text/x-java", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 4, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : true, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
var htmlSuccessEditor = CodeMirror.fromTextArea(document.getElementById("htmlSuccessEditor"), {
mode : "text/x-java", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 4, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
var jsSuccessEditor = CodeMirror.fromTextArea(document.getElementById("jsSuccessEditor"), {
mode : "text/x-java", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 4, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var result = {
formermation: params.require,
aftermation: params.aftermation,
htmlContent: htmlSuccessEditor.getValue(),
jsContent: jsSuccessEditor.getValue(),
};
parent.result = result;
parent.layer.close(index);
parent.refreshCode = '0';
}
return false;
});
$("body").on("keyup", "#placeholderName", function(e){
returnResult();
});
$("body").on("keyup", "#valueName", function(e){
returnResult();
})
function returnResult(){
var tableColumn = $("#tableColumn").val();
var labelName = "", id = "", name = "", formermation = "", aftermation = "";
if(!isNull(tableColumn)){
labelName = tableColumn.split('--')[0];
id = replaceUnderLineAndUpperCase(tableColumn.split('--')[1]);
name = replaceUnderLineAndUpperCase(tableColumn.split('--')[1]);
}
if(!isNull(htmlModelEditor.getValue())){
$.each($('input:checkbox:checked'),function(){
formermation = formermation + $(this).attr("formermation") + "|";
aftermation = aftermation + $(this).attr("aftermation") + ",";
});
params = {
labelContent: labelName,
id: id,
name: name,
require: formermation,
aftermation: aftermation,
value: $("#valueName").val(),
placeholder: $("#placeholderName").val(),
};
htmlSuccessEditor.setValue(getDataUseHandlebars(htmlModelEditor.getValue(), params));
if(!isNull(jsModelEditor.getValue())){
jsSuccessEditor.setValue(getDataUseHandlebars(jsModelEditor.getValue(), params));
}
}
}
//取消
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
/**
* 将字段转为Java经常使用的名字,如code_model转codeModel
*/
function replaceUnderLineAndUpperCase(str){
str = str.split("");
var count = str.indexOf("_");
while (count != 0) {
var num = str.indexOf("_", count);
count = num + 1;
if (num != -1) {
var ss = str[count];
var ia = ss.toUpperCase();
str.splice(count, 1, ia);
}
}
return str.join("").replace(/[_]/g, "");
}
});
});
\ No newline at end of file
......@@ -112,7 +112,7 @@ layui.config({
_openNewWindows({
url: "../../tpl/codemodel/codemodellist.html",
title: "模板管理",
maxmin: true,
area: ['100vw', '100vh'],
pageId: "codemodelgroupmodelconcle"
});
}
......@@ -123,7 +123,7 @@ layui.config({
_openNewWindows({
url: "../../tpl/codemodelhistory/codemodelhistorylist.html",
title: "生成历史",
maxmin: true,
area: ['100vw', '100vh'],
pageId: "codemodelhistorylist"
});
}
......@@ -134,7 +134,7 @@ layui.config({
_openNewWindows({
url: "../../tpl/codemodelgroup/usemodelgroup.html",
title: "代码生成",
maxmin: true,
area: ['100vw', '100vh'],
pageId: "usemodelgroup"
});
}
......
var tableColumn = '';//数据库表中的列
var result = '';//html/xml/js添加的内容项
layui.config({
base: basePath,
version: skyeyeVersion
......@@ -12,7 +8,6 @@ layui.config({
'solr', 'sql', 'vue'], function (exports) {
var index = parent.layer.getFrameIndex(window.name);
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
......@@ -21,11 +16,9 @@ layui.config({
var editId = "";//当前编辑的模板id
$("#addContentToHTMLorJS").hide();
var list = [];//存储模板生成集合
//集合内容
//var s = {
//{
// modelId:模板id,
// content:当前内容,
// tableName:表名,
......@@ -48,7 +41,10 @@ layui.config({
}else{
for(var i = 0; i < subData.length; i++){
subData[i].modelContent = "";
subData[i].content = subData[i].content.replace(/\+/g, "%2B").replace(/\&/g, "%26").replace(/\%/g, "%25");
subData[i].content = subData[i].content
.replace(/\+/g, "%2B")
.replace(/\&/g, "%26")
.replace(/\%/g, "%25");
}
AjaxPostUtil.request({url:reqBasePath + "codemodel014", params:{jsonData: JSON.stringify(subData)}, type: 'json', callback: function(json){
if(json.returnCode == 0){
......@@ -64,7 +60,8 @@ layui.config({
}
return false;
});
// 展示模板内容的对象
var editor = CodeMirror.fromTextArea(document.getElementById("modelContent"), {
mode : "text/x-java", // 模式
theme : "eclipse", // CSS样式选择
......@@ -91,62 +88,14 @@ layui.config({
matchBrackets: true,
});
textEditor.on("change",function(){
for(var i = 0; i < list.length; i++){
if(list[i].modelId == editId){
list[i].content = textEditor.getValue();
break;
}
}
});
var showCreateHtmlMation = CodeMirror.fromTextArea(document.getElementById("showCreateHtmlMation"), {
mode : "xml", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 2, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
var showCreateRequireMation = CodeMirror.fromTextArea(document.getElementById("showCreateRequireMation"), {
mode : "xml", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 2, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
var showCreateJsMation = CodeMirror.fromTextArea(document.getElementById("showCreateJsMation"), {
mode : "text/javascript", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 2, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
//加载模块
// 加载模块
showGrid({
id: "modelList",
url: reqBasePath + "codemodel013",
params: {groupId: parent.rowId},
pagination: false,
template: getFileContent('tpl/codemodelgroup/usemodelgroupmodel.tpl'),
ajaxSendLoadBefore: function(hdb){
template: getFileContent('tpl/codemodelgroup/codeModelListItem.tpl'),
ajaxSendLoadBefore: function(hdb, json){
},
options: {
'click .selModel':function(index, row){//查看模板
......@@ -160,7 +109,7 @@ layui.config({
type: 1,
title: '模板内容',
shade: 0.3,
area: ['1200px', '600px'],
area: ['90vw', '90vh'],
content: $("#modelContentDiv").html(),
});
},
......@@ -170,50 +119,24 @@ layui.config({
if(isNull(s)){
winui.window.msg('请先转换模板', {icon: 2,time: 2000});
}else{
if(row.modelType == 'xml' || row.modelType == 'javascript' || row.modelType == 'html'){
$("#addContentToHTMLorJS").show();
}else{
$("#addContentToHTMLorJS").hide();
}
editId = row.id;
var mode = returnModel(row.modelType);
if (!isNull(mode.length)) {
textEditor.setOption('mode', mode);
}
textEditor.setOption('readOnly', false);
textEditor.setValue(s.content);
}
}else{
winui.window.msg('请先选择数据库表名检索生成', {icon: 2,time: 2000});
}
},
'click .createResult':function(index, row){//转换结果
if(jsCreateClick){
var content = replaceModelContent(row.modelContent, $("#ControllerPackageName").val(), $("#ServicePackageName").val(),
$("#ServiceImplPackageName").val(), $("#DaoPackageName").val(), $("#tableZhName").val(),
$("#tableFirstISlowerName").val(), $("#tableISlowerName").val(), $("#tableBzName").val());
var s = {
modelId: row.id,
content: content,
tableName: $("#tableName").val(),
groupId: parent.rowId,
modelName: row.modelName,
modelContent: row.modelContent,
fileName: $("#tableZhName").val() + row.modelName,
modelType: row.modelType,
};
insertListIn(list, s);
winui.window.msg('转换成功', {icon: 1,time: 2000});
}else{
winui.window.msg('请先选择数据库表名检索生成', {icon: 2,time: 2000});
}
}
},
ajaxSendAfter:function(json){
list = [].concat(json.rows);
}
});
//加载数据库表列表
// 加载数据库表列表
showGrid({
id: "tableName",
url: reqBasePath + "database002",
......@@ -227,96 +150,73 @@ layui.config({
}
});
//转换结果效果切换
$("body").on("click", ".createResult", function(e){
if(jsCreateClick){
$(this).addClass("layui-btn-normal");
}
});
//给html、xml或者js添加内容
$("body").on("click", "#addContentToHTMLorJS", function(e){
_openNewWindows({
url: "../../tpl/codemodelgroup/addcontenttohtmlorjs.html",
title: "添加内容",
pageId: "addcontenttohtmlorjs",
callBack: function(refreshCode){
if (refreshCode == '0') {
showCreateHtmlMation.setValue(result.htmlContent);
showCreateRequireMation.setValue("前端限制参数:" + result.formermation + "\n后端限制参数:" + result.aftermation);
showCreateJsMation.setValue(result.jsContent);
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}});
});
//txtcenter DIV内的输入框内容变化事件
// txtcenter DIV内的输入框内容变化事件
$("body").on("keyup", ".txtcenter input", function(e){
for(var i = 0; i < list.length; i++){
list[i].content = replaceModelContent(list[i].modelContent, $("#ControllerPackageName").val(), $("#ServicePackageName").val(),
$("#ServiceImplPackageName").val(), $("#DaoPackageName").val(), $("#tableZhName").val(),
$("#tableFirstISlowerName").val(), $("#tableISlowerName").val(), $("#tableBzName").val());
list[i].content = codeDocUtil.replaceModelContent(list[i].modelContent);
list[i].fileName = $("#tableZhName").val() + list[i].modelName;
if(list[i].modelId == editId){
textEditor.setOption('readOnly', false);
textEditor.setValue(list[i].content);
}
}
});
//检索生成
// 检索数据
$("body").on("click", "#jsCreate", function(e){
showGrid({
id: "tableParameterBody",
url: reqBasePath + "codemodel011",
params: {tableName: $("#tableName").val()},
pagination: false,
template: getFileContent('tpl/codemodelgroup/usemodelgrouptableparameter.tpl'),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
tableColumn = json;
AjaxPostUtil.request({url:reqBasePath + "codemodel012", params:{tableName: $("#tableName").val()}, type: 'json', callback: function(json){
if(json.returnCode == 0){
$(".createResult").removeClass("layui-btn-normal");
jsCreateClick = true;
list = [];
editId = "";
textEditor.setOption('readOnly', true);
textEditor.setValue('');
$("#tableZhName").val(json.bean.tableName);
$("#tableFirstISlowerName").val(json.bean.tableFirstISlowerName);
$("#ControllerPackageName").val(json.bean.ControllerPackageName);
$("#ServicePackageName").val(json.bean.ServicePackageName);
$("#ServiceImplPackageName").val(json.bean.ServiceImplPackageName);
$("#DaoPackageName").val(json.bean.DaoPackageName);
$("#tableISlowerName").val(json.bean.tableISlowerName);
$("#tableBzName").val(json.bean.tableBzName);
//遍历模板
AjaxPostUtil.request({url: reqBasePath + "codemodel011", params: {tableName: $("#tableName").val()}, type: 'json', callback: function(data){
if(data.returnCode == 0) {
console.log(data)
AjaxPostUtil.request({url: reqBasePath + "codemodel012", params: {tableName: $("#tableName").val()}, type: 'json', callback: function(json){
if(json.returnCode == 0) {
jsCreateClick = true;
editId = "";
textEditor.setValue('');
$("#tableZhName").val(json.bean.tableName);
$("#tableFirstISlowerName").val(json.bean.tableFirstISlowerName);
$("#ControllerPackageName").val(json.bean.ControllerPackageName);
$("#ServicePackageName").val(json.bean.ServicePackageName);
$("#ServiceImplPackageName").val(json.bean.ServiceImplPackageName);
$("#DaoPackageName").val(json.bean.DaoPackageName);
$("#tableISlowerName").val(json.bean.tableISlowerName);
$("#tableBzName").val(json.bean.tableBzName);
// 遍历模板赋值文件名
$('#modelList').find('li').each(function() {
var label = $(this).find("label");
if(($("#" + label.attr("relation")).attr('modeltype') == 'javascript'
|| $("#" + label.attr("relation")).attr('modeltype') == 'xml'
|| $("#" + label.attr("relation")).attr('modeltype') == 'html') && $("#" + label.attr("relation")).attr('modelname') != 'Mapper'){
$("#" + label.attr("relation")).val(json.bean.tableISlowerName + label.attr("thiscontent"));
var modleType = label.attr('modeltype');
if(modleType == 'Java' || modleType == 'xml') {
label.html(json.bean.tableName + label.attr("thiscontent"));
}else{
$("#" + label.attr("relation")).val(json.bean.tableName + label.attr("thiscontent"));
label.html(json.bean.tableFirstISlowerName + label.attr("thiscontent"));
}
});
//模板内容转换
var createResultList = $("#modelList").find(".code-model-li").find(".createResult");//获取所有模板中的转换按钮
$.each(createResultList, function(i, item){
$(item).click();
});
transformResult();
winui.window.msg('检索成功', {icon: 1,time: 2000});
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
});
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}else{
winui.window.msg(data.returnMessage, {icon: 2,time: 2000});
}
}});
});
function transformResult() {
$.each(list, function (i, row){
var content = codeDocUtil.replaceModelContent(row.modelContent);
var s = {
modelId: row.id,
content: content,
tableName: $("#tableName").val(),
groupId: parent.rowId,
modelName: row.modelName,
modelContent: row.modelContent,
fileName: $("#tableZhName").val() + row.modelName,
modelType: row.modelType,
};
insertListIn(list, s);
});
}
/**
* 向集合中添加新元素
......
......@@ -16,12 +16,13 @@
<div class="layui-form-item layui-col-xs12" id="exexplaintocodemodelContent" style="padding: 0px 15px; font-size: 12px; color: grey; display: contents;">
</div>
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">模板内容</span><hr>
<span class="hr-title">基本信息</span><hr>
</div>
<div class="layui-form-item">
<label class="layui-form-label">模板别名<i class="red">*</i></label>
<label class="layui-form-label">模板后缀<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="modelName" name="modelName" win-verify="required" placeholder="请输入模板别名" class="layui-input" maxlength="20"/>
<input type="text" id="modelName" name="modelName" win-verify="required" placeholder="请输入模板后缀" class="layui-input" maxlength="20"/>
<div class="layui-form-mid layui-word-aux">例如:想要生成BossPersonRequireDao.java文件,只需要填写 Dao 即可</div>
</div>
</div>
<div class="layui-form-item">
......
......@@ -5,12 +5,13 @@
<div class="layui-form-item layui-col-xs12" id="exexplaintocodemodelContent" style="padding: 0px 15px; font-size: 12px; color: grey; display: contents;">
</div>
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">模板内容</span><hr>
<span class="hr-title">基本信息</span><hr>
</div>
<div class="layui-form-item">
<label class="layui-form-label">模板别名<i class="red">*</i></label>
<label class="layui-form-label">模板后缀<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="modelName" name="modelName" win-verify="required" placeholder="请输入模板别名" class="layui-input" maxlength="20" value="{{modelName}}"/>
<input type="text" id="modelName" name="modelName" win-verify="required" placeholder="请输入模板后缀" class="layui-input" maxlength="20" value="{{modelName}}"/>
<div class="layui-form-mid layui-word-aux">例如:想要生成BossPersonRequireDao.java文件,只需要填写 Dao 即可</div>
</div>
</div>
<div class="layui-form-item">
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/css/codemirror.css" rel="stylesheet" />
</head>
<body>
<div style="width:600px;margin:0 auto;padding-top:20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
<div class="layui-form-item">
<label class="layui-form-label">表参数<i class="red">*</i></label>
<div class="layui-input-block">
<select id="tableColumn" name="tableColumn" class="layui-input" win-verify="required" lay-filter="tableColumn">
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">展现形式<i class="red">*</i></label>
<div class="layui-input-block">
<select id="showModel" name="showModel" class="layui-input" win-verify="required" lay-filter="showModel">
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">限制条件</label>
<div class="layui-input-block" id="limitRequire">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文本提示<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="placeholderName" name="placeholderName" placeholder="请输入文本提示" class="layui-input" maxlength="20"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">默认值</label>
<div class="layui-input-block">
<input type="text" id="valueName" name="valueName" placeholder="请输入默认值" class="layui-input" maxlength="20"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">HTML模板展示</label>
<div class="layui-input-block">
<textarea id="htmlModelEditor" name="htmlModelEditor"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">HTML模板展示</label>
<div class="layui-input-block">
<textarea id="jsModelEditor" name="jsModelEditor"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">HTML最终结果</label>
<div class="layui-input-block">
<textarea id="htmlSuccessEditor" name="htmlSuccessEditor"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">JS最终结果</label>
<div class="layui-input-block">
<textarea id="jsSuccessEditor" name="jsSuccessEditor"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button>
<button class="winui-btn" lay-submit lay-filter="formAddBean">加入模板</button>
</div>
</div>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/codemodelgroup/'}).use('addcontenttohtmlorjs');
</script>
</body>
</html>
\ No newline at end of file
{{#each rows}}
<li class="code-model-li">
<div style="margin: 0px 5px; width: calc(100% - 10px); padding-top: 5px">
<label class="layui-form-label" relation="{{id}}" thiscontent="{{modelName}}" style="width: 100%; text-align: left;"
modeltype="{{modelType}}">{{modelName}}</label>
</div>
<div style="margin: 0px 5px; width: calc(100% - 10px);">
<div class="layui-col-xs5 padd-le-ri">
类型:{{modelType}}
</div>
<div class="layui-col-xs7 padd-le-ri right">
<button class="layui-btn layui-btn-xs tab-btn-mar-left-3 selModel" title="查看模板" type="button"><i class="fa fa-files-o"></i></button>
<button class="layui-btn layui-btn-xs tab-btn-mar-left-3 selResult" title="查看转换结果" type="button"><i class="fa fa-pencil-square-o"></i></button>
</div>
</div>
</li>
{{/each}}
\ No newline at end of file
......@@ -7,9 +7,9 @@
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/css/codemirror.css" rel="stylesheet" />
</head>
<body>
<body style="overflow: hidden">
<form class="layui-form layui-form-pane" action="" autocomplete="off">
<div class="txtcenter" style="margin:0 auto;padding-top:20px;">
<div class="txtcenter" style="margin: 0 auto; padding-top: 10px;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">数据库表</label>
......@@ -19,7 +19,7 @@
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<button class="layui-btn" id="jsCreate" type="button">检索数据</button>
<button class="layui-btn layui-btn-sm" id="jsCreate" type="button">检索数据</button>
</div>
</div>
</div>
......@@ -80,66 +80,27 @@
</div>
</div>
</div>
<div class="layui-row smpro">
<div class="layui-col-xs3 left-menu">
<div class="layui-row" style="height: calc(100vh - 165px)">
<div class="layui-col-xs3 left-menu" style="border: 0px">
<div class="winui-toolbar">
<div class="winui-tool">模板</div>
</div>
<div class="layui-row" style="height: calc(100vh - 75px);">
<div class="layui-row" style="height: calc(100% - 20px); overflow-y: auto">
<ul style="overflow-y: scroll;height: 100%;" id="modelList">
</ul>
</div>
</div>
<div class="layui-col-xs6 center-content">
<div class="winui-toolbar">
<div class="winui-tool">参数设置(最终保存内容)<button type="button" class="layui-btn layui-btn-xs" style="float: right;" id="addContentToHTMLorJS">添加参数</button></div>
</div>
<div class="layui-row" style="height: calc(100vh - 75px);">
<div class="layui-col-xs9 center-content">
<div class="layui-row" style="height: 100%;">
<textarea id="textContent"></textarea>
</div>
</div>
<div class="layui-col-xs3 right-menu">
<div class="winui-toolbar">
<div class="winui-tool">表参数</div>
</div>
<table class="layui-table">
<tbody id="tableParameterBody" style="height: calc(100vh - 85px);overflow-y: auto;position: absolute;">
</tbody>
</table>
</div>
</div>
<div class="layui-row" style="height: 150px">
<div class="layui-col-xs3 left-menu">
<div class="winui-toolbar">
<div class="winui-tool">限制条件</div>
</div>
<div class="layui-row" style="height: calc(42vh - 85px);">
<textarea id="showCreateRequireMation"></textarea>
</div>
</div>
<div class="layui-col-xs6 center-content">
<div class="winui-toolbar">
<div class="winui-tool">html代码</div>
</div>
<div class="layui-row" style="height: calc(42vh - 85px);">
<textarea id="showCreateHtmlMation"></textarea>
</div>
</div>
<div class="layui-col-xs3 right-menu">
<div class="winui-toolbar">
<div class="winui-tool">js代码</div>
</div>
<div class="layui-row" style="height: calc(42vh - 85px);">
<textarea id="showCreateJsMation"></textarea>
</div>
</div>
</div>
<div class="layui-row" style="height: 50px;text-align: center;">
<div class="layui-inline">
<div class="layui-input-inline">
<button class="layui-btn" lay-submit lay-filter="formSearch">保存结果</button>
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="formSearch">保存结果</button>
</div>
</div>
</div>
......
{{#each rows}}
<li class="code-model-li">
<div class="weui-flex js_category layui-col-xs10 padd-le-ri layui-col-xs-offset1">
<div>
<label class="layui-form-label" relation="{{id}}" thiscontent="{{modelName}}">{{modelName}}<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="{{id}}" name="{{id}}" modeltype="{{modelType}}" modelname="{{modelName}}" win-verify="required" placeholder="请选择数据库表检所生成" class="layui-input" maxlength="50"/>
</div>
</div>
</div>
<div class="weui-flex js_category layui-col-xs10 padd-le-ri layui-col-xs-offset1">
<div class="weui-flex js_category layui-col-xs5 padd-le-ri">
类型:{{modelType}}
</div>
<div class="weui-flex js_category layui-col-xs7 padd-le-ri right">
<button class="layui-btn layui-btn-sm tab-btn-mar-left-3 selModel" title="查看模板" type="button"><i class="fa fa-files-o"></i></button>
<button class="layui-btn layui-btn-sm tab-btn-mar-left-3 selResult" title="查看转换结果" type="button"><i class="fa fa-pencil-square-o"></i></button>
<button class="layui-btn layui-btn-sm tab-btn-mar-left-3 createResult" title="转换结果" type="button"><i class="fa fa-clipboard"></i></button>
</div>
</div>
</li>
{{/each}}
\ No newline at end of file
<tr style="background-color: ghostwhite;">
<th style="width: 70px; padding: 5px;">字段名</th>
<th style="width: 100px; padding: 5px;">字段类型</th>
<th style="width: 100px; padding: 5px;">允许非空</th>
<th style="width: 100px; padding: 5px;">备注</th>
</tr>
{{#each rows}}
<tr>
<td style="width: 70px; padding: 5px;">{{columnName}}</td>
<td style="width: 100px; padding: 5px;">{{columnType}}</td>
<td style="width: 100px; padding: 5px;">{{isNullable}}</td>
<td style="width: 100px; padding: 5px;">{{columnComment}}</td>
</tr>
{{/each}}
\ No newline at end of file
......@@ -17,7 +17,6 @@ layui.config({
layedit = layui.layedit;
var layContent;
AjaxPostUtil.request({url:reqBasePath + "exexplain002", params: {type: type}, type: 'json', callback: function(json){
if(json.returnCode == 0){
if(!isNull(json.bean)){
......@@ -47,7 +46,6 @@ layui.config({
}});
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
if(isNull(layedit.getContent(layContent))){
......@@ -83,5 +81,4 @@ layui.config({
});
});
});
\ No newline at end of file
......@@ -7,7 +7,7 @@
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div style="width:600px;margin:0 auto;padding-top:20px;">
<div style="margin: 0 auto; padding-top: 20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
<div class="layui-form-item">
<label class="layui-form-label">标题<i class="red">*</i></label>
......
......@@ -28,6 +28,7 @@ var customerJS = {
"indexMenu": "../../assets/lib/layui/customer/indexMenu.js", // 菜单按钮模块相关工具
"proUtil": "../../assets/lib/layui/customer/proUtil.js", // 项目管理模块相关工具
"adminAssistantUtil": "../../assets/lib/layui/customer/adminAssistantUtil.js", // 行政管理模块相关工具
"codeDocUtil": "../../assets/lib/layui/customer/codeDocUtil.js", // 代码生成器相关工具类
};
//系统基础信息
......@@ -858,23 +859,6 @@ function returnModel(lang){
return type[lang];
}
/**
* 替换代码生成器模板内容
* @param str
*/
function replaceModelContent(str, ControllerPackageName, ServicePackageName, ServiceImplPackageName,
DaoPackageName, tableZhName, tableFirstISlowerName, tableISlowerName, tableBzName){
str = str.replace(/[$]{{controllerPackage}}/g, ControllerPackageName);
str = str.replace(/[$]{{servicePackage}}/g, ServicePackageName);
str = str.replace(/[$]{{serviceImplPackage}}/g, ServiceImplPackageName);
str = str.replace(/[$]{{daoPackage}}/g, DaoPackageName);
str = str.replace(/[$]{{tableName}}/g, tableZhName);
str = str.replace(/[$]{{objectName}}/g, tableFirstISlowerName);
str = str.replace(/[$]{{urlName}}/g, tableISlowerName);
str = str.replace(/[$]{{notesName}}/g, tableBzName);
return str;
}
function show(_object, url) {
if (imageType.indexOf(url.substring(url.lastIndexOf(".") + 1).toLowerCase()) < 0) {
window.open(url);
......
// 代码生成器相关工具类
var codeDocUtil = {
// 替换代码生成器模板对应关系
replaceModelRelationship: {
'ControllerPackageName': /[$]{{controllerPackage}}/g,
'ServicePackageName': /[$]{{servicePackage}}/g,
'ServiceImplPackageName': /[$]{{serviceImplPackage}}/g,
'DaoPackageName': /[$]{{daoPackage}}/g,
'tableZhName': /[$]{{tableName}}/g,
'tableFirstISlowerName': /[$]{{objectName}}/g,
'tableISlowerName': /[$]{{urlName}}/g,
'tableBzName': /[$]{{notesName}}/g,
},
/**
* 替换代码生成器模板内容
*
* @param str
*/
replaceModelContent: function (str){
$.each(codeDocUtil.replaceModelRelationship, function (key, value){
str = str.replace(value, $("#" + key).val());
});
return str;
}
}
......@@ -1731,7 +1731,7 @@ body .layer-ext-winconfirm .layui-layer-content {
.code-model-li{
width: 100%;
height: 105px;
height: 75px;
line-height: 25px;
background-color: ghostwhite;
margin-top: 10px;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册