From 63abe29fadcb71ba0a67ca7b5c7fa46739b65cee Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Mon, 11 Apr 2022 16:35:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8?= =?UTF-8?q?=E6=95=B4=E4=BD=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/js/codemodel/codemodellist.js | 7 +- .../js/codemodelgroup/addcontenttohtmlorjs.js | 210 ---------------- .../js/codemodelgroup/codemodelgrouplist.js | 6 +- .../js/codemodelgroup/usemodelgroup.js | 226 +++++------------- .../template/tpl/codemodel/codemodeladd.html | 7 +- .../tpl/codemodel/codemodeleditTemplate.tpl | 7 +- .../codemodelgroup/addcontenttohtmlorjs.html | 82 ------- .../tpl/codemodelgroup/codeModelListItem.tpl | 17 ++ .../tpl/codemodelgroup/usemodelgroup.html | 57 +---- .../tpl/codemodelgroup/usemodelgroupmodel.tpl | 22 -- .../usemodelgrouptableparameter.tpl | 14 -- .../js/exexplain/exexplaintocodemodel.js | 3 - .../tpl/exexplain/exexplaintocodemodel.html | 2 +- .../template/assets/lib/layui/custom.js | 18 +- .../assets/lib/layui/customer/codeDocUtil.js | 29 +++ .../template/assets/lib/winui/css/winui.css | 2 +- 16 files changed, 135 insertions(+), 574 deletions(-) delete mode 100644 code-doc/src/main/resources/template/js/codemodelgroup/addcontenttohtmlorjs.js delete mode 100644 code-doc/src/main/resources/template/tpl/codemodelgroup/addcontenttohtmlorjs.html create mode 100644 code-doc/src/main/resources/template/tpl/codemodelgroup/codeModelListItem.tpl delete mode 100644 code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgroupmodel.tpl delete mode 100644 code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgrouptableparameter.tpl create mode 100644 web/src/main/resources/template/assets/lib/layui/customer/codeDocUtil.js diff --git a/code-doc/src/main/resources/template/js/codemodel/codemodellist.js b/code-doc/src/main/resources/template/js/codemodel/codemodellist.js index 6bbf664e8..234a459a6 100644 --- a/code-doc/src/main/resources/template/js/codemodel/codemodellist.js +++ b/code-doc/src/main/resources/template/js/codemodel/codemodellist.js @@ -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 ''; @@ -73,7 +72,7 @@ layui.config({ type: 1, title: '模板内容', shade: 0.3, - area: ['1200px', '600px'], + area: ['90vw', '90vh'], content: $("#modelContentDiv").html(), }); } diff --git a/code-doc/src/main/resources/template/js/codemodelgroup/addcontenttohtmlorjs.js b/code-doc/src/main/resources/template/js/codemodelgroup/addcontenttohtmlorjs.js deleted file mode 100644 index 1e0375c6f..000000000 --- a/code-doc/src/main/resources/template/js/codemodelgroup/addcontenttohtmlorjs.js +++ /dev/null @@ -1,210 +0,0 @@ - -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 diff --git a/code-doc/src/main/resources/template/js/codemodelgroup/codemodelgrouplist.js b/code-doc/src/main/resources/template/js/codemodelgroup/codemodelgrouplist.js index 73a01b3c2..b8883f9f5 100644 --- a/code-doc/src/main/resources/template/js/codemodelgroup/codemodelgrouplist.js +++ b/code-doc/src/main/resources/template/js/codemodelgroup/codemodelgrouplist.js @@ -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" }); } diff --git a/code-doc/src/main/resources/template/js/codemodelgroup/usemodelgroup.js b/code-doc/src/main/resources/template/js/codemodelgroup/usemodelgroup.js index 4db3aacb4..5c355be1a 100644 --- a/code-doc/src/main/resources/template/js/codemodelgroup/usemodelgroup.js +++ b/code-doc/src/main/resources/template/js/codemodelgroup/usemodelgroup.js @@ -1,8 +1,4 @@ -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); + }); + } /** * 向集合中添加新元素 diff --git a/code-doc/src/main/resources/template/tpl/codemodel/codemodeladd.html b/code-doc/src/main/resources/template/tpl/codemodel/codemodeladd.html index a5fd3746c..5d3836dca 100644 --- a/code-doc/src/main/resources/template/tpl/codemodel/codemodeladd.html +++ b/code-doc/src/main/resources/template/tpl/codemodel/codemodeladd.html @@ -16,12 +16,13 @@
- 模板内容
+ 基本信息
- +
- + +
例如:想要生成BossPersonRequireDao.java文件,只需要填写 Dao 即可
diff --git a/code-doc/src/main/resources/template/tpl/codemodel/codemodeleditTemplate.tpl b/code-doc/src/main/resources/template/tpl/codemodel/codemodeleditTemplate.tpl index 5f9ad1574..680d8cd10 100644 --- a/code-doc/src/main/resources/template/tpl/codemodel/codemodeleditTemplate.tpl +++ b/code-doc/src/main/resources/template/tpl/codemodel/codemodeleditTemplate.tpl @@ -5,12 +5,13 @@
- 模板内容
+ 基本信息
- +
- + +
例如:想要生成BossPersonRequireDao.java文件,只需要填写 Dao 即可
diff --git a/code-doc/src/main/resources/template/tpl/codemodelgroup/addcontenttohtmlorjs.html b/code-doc/src/main/resources/template/tpl/codemodelgroup/addcontenttohtmlorjs.html deleted file mode 100644 index 67772d730..000000000 --- a/code-doc/src/main/resources/template/tpl/codemodelgroup/addcontenttohtmlorjs.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- - -
-
-
-
- - - - - \ No newline at end of file diff --git a/code-doc/src/main/resources/template/tpl/codemodelgroup/codeModelListItem.tpl b/code-doc/src/main/resources/template/tpl/codemodelgroup/codeModelListItem.tpl new file mode 100644 index 000000000..f43aad3a5 --- /dev/null +++ b/code-doc/src/main/resources/template/tpl/codemodelgroup/codeModelListItem.tpl @@ -0,0 +1,17 @@ +{{#each rows}} +
  • +
    + +
    +
    +
    + 类型:{{modelType}} +
    +
    + + +
    +
    +
  • +{{/each}} \ No newline at end of file diff --git a/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgroup.html b/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgroup.html index bcb3d0b55..5c2169356 100644 --- a/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgroup.html +++ b/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgroup.html @@ -7,9 +7,9 @@ - +
    -
    +
    @@ -19,7 +19,7 @@
    - +
    @@ -80,66 +80,27 @@
    -
    -
    +
    +
    模板
    -
    +
    -
    -
    -
    参数设置(最终保存内容)
    -
    -
    +
    +
    -
    -
    -
    表参数
    -
    - - - - -
    -
    -
    -
    -
    -
    -
    限制条件
    -
    -
    - -
    -
    -
    -
    -
    html代码
    -
    -
    - -
    -
    -
    -
    -
    js代码
    -
    -
    - -
    -
    - +
    diff --git a/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgroupmodel.tpl b/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgroupmodel.tpl deleted file mode 100644 index 4a4c610be..000000000 --- a/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgroupmodel.tpl +++ /dev/null @@ -1,22 +0,0 @@ -{{#each rows}} -
  • -
    -
    - -
    - -
    -
    -
    -
    -
    - 类型:{{modelType}} -
    -
    - - - -
    -
    -
  • -{{/each}} \ No newline at end of file diff --git a/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgrouptableparameter.tpl b/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgrouptableparameter.tpl deleted file mode 100644 index 2b53ad84e..000000000 --- a/code-doc/src/main/resources/template/tpl/codemodelgroup/usemodelgrouptableparameter.tpl +++ /dev/null @@ -1,14 +0,0 @@ - - 字段名 - 字段类型 - 允许非空 - 备注 - -{{#each rows}} - - {{columnName}} - {{columnType}} - {{isNullable}} - {{columnComment}} - -{{/each}} \ No newline at end of file diff --git a/userauth/src/main/resources/template/js/exexplain/exexplaintocodemodel.js b/userauth/src/main/resources/template/js/exexplain/exexplaintocodemodel.js index 1b7323635..f58747337 100644 --- a/userauth/src/main/resources/template/js/exexplain/exexplaintocodemodel.js +++ b/userauth/src/main/resources/template/js/exexplain/exexplaintocodemodel.js @@ -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 diff --git a/userauth/src/main/resources/template/tpl/exexplain/exexplaintocodemodel.html b/userauth/src/main/resources/template/tpl/exexplain/exexplaintocodemodel.html index 78711bfe2..63a0d484c 100644 --- a/userauth/src/main/resources/template/tpl/exexplain/exexplaintocodemodel.html +++ b/userauth/src/main/resources/template/tpl/exexplain/exexplaintocodemodel.html @@ -7,7 +7,7 @@ -
    +
    diff --git a/web/src/main/resources/template/assets/lib/layui/custom.js b/web/src/main/resources/template/assets/lib/layui/custom.js index 8403dc467..882b5ad3f 100644 --- a/web/src/main/resources/template/assets/lib/layui/custom.js +++ b/web/src/main/resources/template/assets/lib/layui/custom.js @@ -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); diff --git a/web/src/main/resources/template/assets/lib/layui/customer/codeDocUtil.js b/web/src/main/resources/template/assets/lib/layui/customer/codeDocUtil.js new file mode 100644 index 000000000..9e2ef84e8 --- /dev/null +++ b/web/src/main/resources/template/assets/lib/layui/customer/codeDocUtil.js @@ -0,0 +1,29 @@ + +// 代码生成器相关工具类 +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; + } + +} diff --git a/web/src/main/resources/template/assets/lib/winui/css/winui.css b/web/src/main/resources/template/assets/lib/winui/css/winui.css index bb3f02c0d..0f49ced42 100644 --- a/web/src/main/resources/template/assets/lib/winui/css/winui.css +++ b/web/src/main/resources/template/assets/lib/winui/css/winui.css @@ -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; -- GitLab