apps/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/publish.search.home.js
2022-07-19 16:11:03 +08:00

150 lines
4.1 KiB
JavaScript

var plParentid = 0;
var processLevel = 0;
var isLeaf = true;
var parentNodeId;
var orderIndexs = new Array();
var repositoryTree;
var copeFileNode = "";
var drpParentId;
var drpSourceParentId;
var isOpenMainIfranme = false;
var repositoryTree;
$(document).ready(function() {
initTree();
repositoryTree.expandNode($("a[tbindex=process]"), true);
$("a[tbindex=process]").click();
});
function initTree() {
$("#repositoryTree").empty();
var wsId = $("#wsId").val();
if (wsId) {
var setting = getSetings();
repositoryTree = awsui.tree.init($("#repositoryTree"), setting);
$("#repositoryTree").css("height", "auto");
} else {
window.top.$.simpleAlert("请选择流程资产", "info", 2000);
}
if (repositoryTree.getSelectedNode() == undefined) {
repositoryTree.selectNode(repositoryTree.config.data[0].id, true);
}
}
function getSetings() {
var setting = {
sort : true,
dblClickToExpand : true,
event : {
onClick : clickNode
},
data : {
keep : {
parent : true
}
}
};
setting.dataModel = {
data : data
};
return setting;
}
function clickNode(treeNode) {
if (treeNode.id.length == 36) {
openDesginer(treeNode.id, 0, treeNode.name, "", treeNode.versionId, false, "1");
} else {
if (processRootId != "") {
openDesginer(processRootId, 0, treeNode.name, "", "", false, "1");
}
}
}
function openDesginer(uuid, openType, plName, appId, processVersionId,
isOpenDialog, collaboration) {
if(collaboration == undefined || collaboration == null) {
collaboration = "0";
}
var params = {
sid : encodeURIComponent(jQuery('#sid').val()),
cmd : "com.actionsoft.apps.coe.pal_pl_repository_designer_viewer",
uuid : uuid,
openType : openType,
processDefId : processVersionId,
collaboration : collaboration,
teamId : "",
perms: "v",
filePerms: filePerms
}, url, options;
if (typeof (isOpenDialog) == "boolean" && isOpenDialog) {// 打开与bpmn关联的多个版本
params = {
sid : encodeURIComponent(jQuery('#sid').val()),
cmd : "com.actionsoft.apps.coe.pal_pl_repository_version",
uuid : uuid,
appId : appId,
processVersionId : processVersionId
};
url = "./w?" + connectParams(params);
options = {
buttons : [ // 按钮组
{
text : '关闭',
handler : function() {
window.top.closeAwsDialog();
}
} ]
}
window.top.openAwsDialog(url, plName, 770, 415, options);
return;
}
url = "./w?" + connectParams(params);
$("#disignerIframe").attr("src", url).attr("uuid", uuid);
}
function connectParams(params) {
var connParms = "";
if (typeof (params) == "object") {
for ( var i in params) {
connParms += i + "=" + params[i] + "&";
}
}
return connParms.substring(0, connParms.length - 1);
}
// 展开所有节点
function expandNodes(zTree, nodes) {
if (!nodes)
return;
for (var i = 0, l = nodes.length; i < l; i++) {
zTree.expandNode(nodes[i], true, false, false);
if (nodes[i].isParent) {
expandNodes(nodes[i].children);
}
}
}
// 自动展开两级节点
function expandNodesFirst(zTree, nodes) {
if (!nodes)
return;
for (var i = 0, l = 1; i < l; i++) {
zTree.expandNode(nodes[i], true, false, false);
if (nodes[i].isParent && nodes[i].zAsync) {
expandNodesFirst(nodes[i].children);
}
}
}
// 自动展开n级节点
function expandNodesN(zTree, nodes, n) {
if (!nodes)
return;
for (var i = 0, l = n; i < l; i++) {
zTree.expandNode(nodes[i], true, false, false);
if (nodes[i].isParent) {
expandNodesN(zTree, nodes[i].children, n);
}
}
}