/* * @Copyright (c) 2018 缪聪(mcg-helper@qq.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* 在body中创建Modal的html元素 * id 流程节点id * param json对象参数 * */ function createHtmlModal(id, param) { removePopover(); var modalId = createModalId(id); var url = null; if(param == null) param = {}; var option = {}; if($("#"+id).attr("eletype") != null && $("#"+id).attr("eletype") != undefined) { if($("#"+id).attr("eletype") == "json") { url = "/html/flowJsonModal"; option["title"] = "json控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "sqlQuery") { url = "/html/flowSqlQueryModal"; option["title"] = "sql查询"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "sqlExecute") { url = "/html/flowSqlExecuteModal"; option["title"] = "sql执行"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "data") { url = "/html/flowDataModal"; option["title"] = "data控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "start") { url = "/html/flowStartModal"; option["title"] = "开始控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "text"){ url = "/html/flowTextModal"; option["title"] = "文本控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "script") { url = "/html/flowScriptModal"; option["title"] = "js控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "java") { url = "/html/flowJavaModal"; option["title"] = "java控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "python") { url = "/html/flowPythonModal"; option["title"] = "python控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "linux") { url = "/html/flowLinuxModal"; option["title"] = "linux控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "wonton") { url = "/html/flowWontonModal"; option["title"] = "混沌控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "process") { url = "/html/flowProcessModal"; option["title"] = "子流程控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "loop") { url = "/html/flowLoopModal"; option["title"] = "循环控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "git") { url = "/html/flowGitModal"; option["title"] = "GIT控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "sftp") { url = "/html/flowSftpModal"; option["title"] = "SFTP控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "end") { url = "/html/flowEndModal"; option["title"] = "结束控件"; option["width"] = 1100; } else if($("#"+id).attr("eletype") == "demo") { url = "/html/flowDemoModal"; option["title"] = "示例控件"; option["width"] = 1100; } param["modalId"] = modalId.replace(/_Modal/g, ""); param["eletype"] = $("#"+id).attr("eletype"); param["option"] = option; if(url != null) common.showAjaxDialog(url, setDialogBtns(param), createModalCallBack, null, param); } } /** * 拖拽出的控件保存时, * 1、将name(控件名称),sign(控件是否保存)字段,同步到elementMap中对应的控件基本数据 * 2、将拖拽控件下面的显示名称同步 * @param elementId * @param name * @returns */ function saveElementUpdateCache(elementId, name) { var element = elementMap.get(elementId); element.setName(name); element.setSign("true"); $("#name_" + elementId).html(name); } /** * 设置控件弹出框按钮及功能绑定 * @param param * @returns 按钮集合 */ function setDialogBtns(param) { var buttons = []; if(param.eletype == "start") { buttons = [ { class: "btn btn-default", text: "增加", click: function() { var tableData = $("#" + param.modalId + "_flowStartTable").bootstrapTable('getData'); for(var i=0; i请选择')); for(var i=0; i' + data[i].tableName + '')); } $("#" + param.modalId + "_tableNameSelect").selectpicker('refresh'); }); } }); $("#" + param.modalId + "_tableNameSelect").change(function () { if($("#" + param.modalId + "_dataSourceId").val() != null && $("#" + param.modalId + "_dataSourceId").val() != "" && $("#" + param.modalId + "_tableNameSelect").val() != null && $("#" + param.modalId + "_tableNameSelect").val() != "" ) { common.ajax({ url : "/common/getTableInfo", type : "POST", data : "tableName=" + $("#" + param.modalId + "_tableNameSelect").val() + "&dataSourceId=" + $("#" + param.modalId + "_dataSourceId").val(), }, function(data) { $("#" + param.modalId + "_flowDataTable").bootstrapTable('removeAll'); for(var i=0; i"); $("#" + modalFlowTreeId + "_flowId").val(treeNode.id); } /* 设置ace编辑器全屏功能 */ function editorScreen(id, editor) { editor.commands.addCommand({ name: "fullscreen", bindKey: { win: "Ctrl-Enter", mac: "Command-Enter" }, exec: function(editor) { if(editor.isFullScreen == undefined) { editor.isFullScreen = false; } if(editor.isFullScreen) { $( "#dialog" + id ).dialog( "option", "resizable", true); $("#" + id + "_editor").height(acePropertyMap.get(id+"_height")); $( "#dialog" + id ).dialog( "option", "width", acePropertyMap.get(id+"_width") ); $( "#dialog" + id ).dialog( "option", "height", acePropertyMap.get("#dialog" + id+"_width") ); $( "#dialog" + id ).dialog( "option", "position", acePropertyMap.get(id+"_position") ); editor.resize(); editor.isFullScreen = false; } else { $( "#dialog" + id ).dialog( "option", "resizable", false); var oldWidth = $( "#dialog" + id ).dialog("option", "width"); var oldHeight = $( "#dialog" + id ).dialog("option", "height"); var position = $( "#dialog" + id ).dialog("option", "position"); acePropertyMap.put(id+"_position", position); $( "#dialog" + id ).dialog( "option", "width", (screenMaxWidth - 50) ); $( "#dialog" + id ).dialog( "option", "position", {      my: "center",        at: "center",        of: window,        using: function( pos ) {    $(this).css({          "position":"fix",          "top":"5px",          "left": "10px"        });        }      } ); acePropertyMap.put(id+"_height", $("#" + id + "_editor").height()); acePropertyMap.put(id+"_width", oldWidth); acePropertyMap.put("#dialog" + id+"_width", oldHeight); $( "#dialog" + id ).dialog( "option", "height", (screenMaxHeight - 15) ); $("#" + id + "_editor").height(screenMaxHeight - 260); editor.resize(); editor.isFullScreen = true; } } }); }