diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/img/portal_banner.jpg.png b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/img/portal_banner.jpg.png
new file mode 100644
index 00000000..45d6a586
Binary files /dev/null and b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/img/portal_banner.jpg.png differ
diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.framework.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.framework.js
new file mode 100644
index 00000000..a044ab47
--- /dev/null
+++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.framework.js
@@ -0,0 +1,4478 @@
+/**
+ * @author wangyh 与插入链接,属性,关系相关的js内容
+ */
+var selectedShapes = [];
+var linkType; // 链接类型:custom:自定义链接;file:文件链接
+$(document).ready(function() {
+ showPainting();
+ setDivHeight();
+ // awsui.parse();
+ $("#linkto_file").buttonedit({
+ onClick : showLinkTree
+ });
+
+ setTimeout(function() {
+ Designer.hotkey.init();// 解决快捷健绑定不成功
+ // DesignerCopyPaste.checkHasUsedShape();
+// if (window.opener && window.opener.document.getElementById("teamId").value != "") {
+// //如果从“流程团队”中打开设计器,则不进行复制粘贴同步监听
+// } else {
+// DesignerCopyPaste.changeTitleListen();// 复制粘贴形状内容同步的监听
+// }
+ DesignerCopyPaste.changeTitleListen();
+ if (selectedElementId && selectedElementId != "") {
+ Utils.selectShape(selectedElementId);
+ }// 复制粘贴形状内容同步的监听
+ }, 1000);
+
+ //初始化visio导入的fileUpload
+ initVisioImportFileUpload();
+ //初始化更多特性按钮
+ initMoreAttrRight();
+ //初始化节点附件上传事件
+ addShapeFile();
+ //by bzp
+ addPolicyFile();
+});
+
+function initMoreAttrRight() {
+ if($('#moreAttrRight').val() == "false") {
+ $("#showMoreAttrUL").remove();
+ }
+}
+
+/**
+ * 判断是否正在保存
+ */
+function isSavingFile() {
+ if ($("#saving_tip").text() == "已保存成功" || $("#saving_tip").text() == "保存成功" || $("#saving_tip").text() == "您的文件已经成功保存" || $("#saving_tip").text() == "")
+ return true;
+ else
+ return false;
+}
+
+/**
+ * 兼容1024*768画布显示
+ *
+ * @param {}
+ *
+ */
+
+function showPainting() {
+ var width = screen.width;
+ if (width == 1024) {
+ $("#toolbar_wfversion_info").addClass("showPainting");
+ if (parent.getWidthToolbar() > 750) {
+ $(".toolbar").removeClass("heightCssToolbar")
+ .addClass("toolbarExtend");
+ $("#bar_back").removeClass("cssToolbar");
+
+ } else {
+ $(".toolbar").addClass("heightCssToolbar")
+ .removeClass("toolbarExtend");
+ $("#bar_back").addClass("cssToolbar");
+ }
+ }
+}
+
+/**
+ * 重写单击图形时的触发的事件
+ *
+ * @param {}
+ *
+ * @returns {}
+ */
+Designer.op.shapeSelectable = function(a) {
+ var b = $("#designer_canvas");
+ b.bind("mousedown.select", function(d) {
+ Designer.op.changeState("seelcting_shapes");
+ var e = a.id;
+ var c = [];
+ if (d.ctrlKey) {
+ var c = Utils.getSelectedIds();
+ if (Utils.isSelected(e)) {
+ Utils.removeFromArray(c, e);
+ } else {
+ c.push(e);
+ }
+
+ if ($("#dock_content_attribute").is(":visible")) {
+ $("#tagContent1 :focus").blur();
+ }
+
+ Utils.unselect();
+ if (c.length > 0) {
+ Utils.selectShape(c);
+ }
+ } else {
+ if (Utils.selectIds.indexOf(e) < 0) {
+
+ if ($("#dock_content_attribute").is(":visible")) {
+ $("#tagContent1 :focus").blur();
+ }
+
+ Utils.unselect();
+ Utils.selectShape(e);
+ }
+ }
+ $(document).bind("mouseup.select", function() {
+ Designer.op.resetState();
+ b.unbind("mousedown.select");
+ $(document).unbind("mouseup.select");
+ });
+ // selectedShapes
+ DesignerCopyPaste.selectedShapeId = Utils.getSelected()[0].id;
+ if ($("div.dock_view_attribute").is(":visible")) {
+ showShapeRelationTab(null);
+ attributeShowTabContent(null);
+ shapeCopyAndPasteCount(null);
+ showRelevanceShapesContent();
+ }
+ var tmpArray = getTmpArray(isLaneAttrConfig);
+ if (Utils.getSelected()[0].category == "basic") {
+ $("#showMoreAttrUL").hide();
+ } else if ($.inArray(Utils.getSelected()[0].name, tmpArray) != -1) {// 泳池泳道隐藏
+ $('#showMoreAttrUL').hide();
+ } else {
+ if ($("#tabLiContainnerAttribute").hasClass("selectTag")) {
+ $("#dock_content_attribute #showMoreAttrUL").show();
+ } else {
+ $("#dock_content_attribute #showMoreAttrUL").hide();
+ }
+ }
+ });
+};
+//根据isLaneAttrConfig来判断数组的数据
+function getTmpArray(isLaneAttrConfig) {
+ var tmpArray1 = ['verticalPool', 'verticalLane', 'horizontalPool', 'horizontalLane'];
+ var tmpArray2 = ['verticalPool', 'horizontalPool'];
+ if (isLaneAttrConfig) {
+ return tmpArray2;
+ } else {
+ return tmpArray1;
+ }
+}
+// 重写
+Designer.linkClickable = function(a, c) {/*
+ * var b = $("#link_spot"); if
+ * (b.length == 0) { b = $("")
+ * .appendTo("#designer_canvas"); }
+ * if
+ * (a.trim().toLowerCase().indexOf("http") ==
+ * -1) { a = "http://" + a; }
+ * b.show().css({ left : c.x - 50,
+ * top : c.y - 50, "z-index" :
+ * Model.orderList.length + 1 });
+ */
+};
+var myshapeLink = "";
+var linkIndex = 0;
+var selectShape = Utils.getSelected()[0];
+/**
+ * 功能:去除字符串中所有空格 传参:需要处理的字符串 返回值:去除空格后的字符串
+ */
+function trimSpaces(Str) {
+ var ResultStr = "";
+ Temp = Str.split(/\s/);
+ for (i = 0; i < Temp.length; i++) {
+ ResultStr += Temp[i];
+ }
+ return ResultStr;
+}
+
+/**
+ * 重写插入链接事件
+ *
+ * @returns {}
+ */
+UI.showInsertLink = function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.match(/chrome\/([\d.]+)/)) {
+ $("#link_custom_target1").css({"width" : "264px"});
+ $("#link_custom_target1").siblings("span.awsui-select-span").css({"width" : "252px"});
+ $("#link_custom_target2").css({"width" : "262px"});
+ $("#link_custom_target2").siblings("span.awsui-select-span").css({"width" : "250px"});
+ }
+
+ $("#link_dialog").dialog({
+ title: "插入链接",
+ buttons:[
+ {text:'确定',cls:"blue",handler:function(){UI.setLink();}},
+ {text:'关闭',handler:function(){$('#link_dialog').dialog('close');}}
+ ]
+ });
+ $(".awsui-simple-tab").find("a[tit=file]").trigger('click');
+ $("#linksHistory").empty();
+ $("#linksFileHistory").empty();
+ var addr = Utils.getSelected()[0].linksArray;
+ var shape = Utils.getSelected()[0];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.linksArray) {
+ addr = attr.linksArray;
+ break;
+ }
+ }
+ if (!addr) {
+ addr = [];
+ }
+ var links_file = [];
+ var links_custom = [];
+ for (var i = 0; i < addr.length; i++) {
+ var link = addr[i];
+ if (link.type == "file") {
+ links_file.push(link);
+ } else {
+ links_custom.push(link);
+ }
+ }
+
+ if (links_custom.length == 0) {
+ $("#linksHistoryDiv").hide();
+ } else {
+ $("#linksHistoryDiv").show();
+ }
+ if (links_file.length == 0) {
+ $("#linksFileHistoryDiv").hide();
+ } else {
+ $("#linksFileHistoryDiv").show();
+ }
+
+ $("#linkto_addr").val("");
+ $("#linkto_addr_name").val("");
+ $("#linkto_file").val("");
+ $("#linkto_file_name").val("");
+ writeLinksHistory("linksHistory", links_custom);
+ writeLinksHistory("linksFileHistory", links_file);
+
+ $("#linkto_addr").unbind().bind("keydown", function(e) {
+ if (e.keyCode == 13) {
+ UI.setLink();
+ }
+ });
+ setDivHeight();
+};
+
+//风险控制
+UI.showRiskDlg = function(){
+ var shape = Utils.getSelected()[0];
+ var number;
+ if (shape.dataAttributes != undefined) {
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ if (shape.dataAttributes[i].privateAttributeContent != null) {
+ var privateAttributeContent = shape.dataAttributes[i].privateAttributeContent;
+ if (typeof(privateAttributeContent) == "string") {
+ privateAttributeContent = eval("(" + privateAttributeContent + ")");
+ }
+ number = privateAttributeContent.number;
+ }
+ }
+ }
+ if (number == undefined || number == "") {
+ $.simpleAlert("请先维护该节点编号");
+ return;
+ }
+ var riskDlg = FrmDialog.open({
+ width:800,
+ height:700,
+ url:"./w?sid=" + $("#sid").val() + "&cmd=com.actionsoft.apps.coe.pal.risk_pal_designer_risk",
+ data:{"plId":ruuid, "taskId": shape.id, "taskNum": number}
+ });
+}
+
+//流程节点的风险控制不为空,重新渲染shape
+function renderShapeRisks(risk, control) {
+ var shape = Utils.getSelected()[0];
+ if (shape.dataAttributes != undefined) {
+ var riskFlag = false;
+ var controlFlag = false;
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ if (shape.dataAttributes[i].risk != undefined) {
+ shape.dataAttributes[i].risk = risk;
+ riskFlag = true;
+ }
+ if (shape.dataAttributes[i].control != undefined) {
+ shape.dataAttributes[i].control = control;
+ controlFlag = true;
+ }
+ }
+ if (!riskFlag) {
+ var index = shape.dataAttributes.length -1;
+ shape.dataAttributes[index].risk = risk;
+ }
+ if (!controlFlag) {
+ var index = shape.dataAttributes.length -1;
+ shape.dataAttributes[index].control = control;
+ }
+ }
+ Designer.painter.renderShape(shape);
+}
+
+//visio导入-打开dialog
+UI.showImportDlg = function() {
+ if (processOnIsInstall == "false") {
+ $.simpleAlert("[ProcessOn]应用未安装");
+ return;
+ }
+ if (processOnIsActive == "false") {
+ $.simpleAlert("[ProcessOn]应用未启动");
+ return;
+ }
+ $("#visio_import_input").empty();
+ $("#visio_import_input").val("");
+ $("#visio_import_dlg").dialog({
+ width: 400,
+ height: 200,
+ buttons:[
+ {text:'导入',cls:"blue",handler:function(){
+ importVisio();
+ }},
+ {text:'取消',handler:function(){$("#visio_import_dlg").dialog("close");}}
+ ]
+ });
+}
+//初始化visio导入的fileupload组件
+function initVisioImportFileUpload() {
+ $("#visio_import_upfile").upfile({
+ sid:$("#sid").val(),
+ appId:"com.actionsoft.apps.coe.pal",
+ groupValue:"_import",
+ fileValue:"Normal",
+ filesToFilter : [[]],
+ repositoryName:"tmp",
+ numLimit:1,
+ add: function(e, data) {
+ var filename = data['files'][0].name;
+ var suffix = filename.substring(filename.lastIndexOf("."));
+ if (suffix != ".vsd" && suffix != ".vdx" && suffix != ".vsdx") {
+ $.simpleAlert("请上传后缀为vsd、vdx或者vsdx格式的visio文件", "warning");
+ return false;
+ }
+ },
+ done:function(e, data){
+ var filename = data['result']['files']['name'];
+ filename = decodeURI(filename);
+ $("#visio_import_input").val(filename);
+ $.mask();
+ }
+ });
+}
+
+//visio导入-执行导入
+function importVisio() {
+ if ($("#visio_import_input").val() == null || $("#visio_import_input").val() == "") {
+ $.simpleAlert("请先上传文件", "warning");
+ return;
+ }
+ $.simpleAlert("正在处理", "loading");
+ $.ajax({
+ type: "POST",
+ url: "./jd",
+ data : {
+ sid: sid,
+ cmd: "com.actionsoft.apps.coe.pal.processon_designer_import_visio",
+ wsId: $("#wsId").val(),
+ plId: ruuid,
+ fileName: $("#visio_import_input").val()
+ },
+ success: function(msg){
+ if (msg.result == "ok") {
+ $.simpleAlert("close");
+ $.simpleAlert("导入成功", "ok");
+ setTimeout(function(){
+ parent.refresh();
+ $("#visio_import_dlg").dialog("close");
+ window.location.reload();
+ }, 1000);
+
+ } else {
+ $.simpleAlert("close");
+ $.simpleAlert("导入失败," + msg.msg, "error");
+ }
+ }
+ })
+}
+
+function writeLinksHistory(table_id, data) {
+ var html = "";
+ // 列出所有的链接
+ for (var k = 0; k < data.length; k++) {
+ var ele = data[k];
+ var strTarget = "0";
+ var name_qtip = ele.name;
+ var url_qtip = ele.value;
+ var typeBlank = "新窗口";
+ if (ele.target == "_seft") {
+ typeBlank = "当前窗口";
+ } else if (ele.target == "newTab") {
+ typeBlank = "新页签";
+ }
+ var con = '
| '
+ + ' '
+ + ele.name
+ + ' '
+ + ' | '
+ + ' '
+ + ele.value
+ + ' '
+ + ' | '
+ + ''
+ + typeBlank
+ + ' | '
+ + '删除 |
';
+ html += con;
+ }
+ $("#" + table_id).html(html);
+ setDivHeight();
+}
+
+/**
+ * 设置连接
+ *
+ * @param {}
+ * type
+ * @param {}
+ * url
+ * @param {}
+ * target
+ * @param {}
+ * uuid
+ */
+function editLinkTargetType(obj) {
+ var target = $(obj).parent().siblings().find("a").attr("target");
+ $(obj).hide().siblings().show().find("select option[value='" + target
+ + "']").attr("selected", "true");
+}
+
+// 打开链接,如果是自定义链接,直接打开;如果是文件链接,
+function openLinkUrl(type, url, target, uuid, obj) {
+ if (target == "0") {
+ target = $(obj).attr("target");
+ }
+ if (type == "custom") {
+ $("#link-dialog-normal_contextmenu").hide();
+ window.open(url, target);
+ } else {
+ $.ajax({
+ async : false,
+ url : encodeURI("./w?sid=" + sid
+ + "&cmd=com.actionsoft.apps.coe.pal_pl_using_plid_query&uuid=" + uuid),
+ success : function(data) {
+ if (data != "") {
+ url = "./w?sid="
+ + sid
+ + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer&uuid="
+ + data + "&openType=0&perms=" + perms + "&filePerms=" + filePerms;
+ $("#link-dialog-normal_contextmenu").hide();
+ window.open(url, target);
+ } else {
+ $.simpleAlert("链接文件已被删除", "info");
+ //$("#simplealert>.msg").css("top", "15px");
+ }
+ }
+ });
+ }
+}
+
+function openLinkUrlRewrite(type, url, target, uuid, obj, fileName, inspected) {
+ var sid = $("#sid").val();
+ if (target == "0") {
+ target = $(obj).attr("target");
+ }
+ if (type == "custom") {
+ $("#link-dialog-normal_contextmenu").hide();
+ if (target == "newTab" && parent.openTabCustom != undefined) {
+ parent.openTabCustom(uuid, url, fileName);
+ } else if (target == "_seft") {
+ if (parent.changeTabTitle) {
+ parent.changeTabTitle(chartId, fileName, uuid, "custom");
+ }
+ window.location.href = url;
+ } else {
+ window.open(url+sid, target);
+ }
+ } else {
+ if (inspected) { //已经进行过权限判断,不需要再判断
+ openFileLink(uuid, target, fileName);
+ } else {
+ var openerAppId = parent.window.$("#appId").val();
+ var params = {
+ sid : $("#sid").val(),
+ cmd: "com.actionsoft.apps.coe.pal_pl_repository_designer_viewer_link_perm",
+ uuids: uuid,
+ filePerms: filePerms
+ }
+ if (window.opener) {
+ params.modelType = "used";
+ } else if (openerAppId != undefined && openerAppId != "com.actionsoft.apps.coe.pal" && openerAppId != "") {
+ params.modelType = "published";
+ }
+
+ awsui.ajax.request({
+ url : "./jd",
+ method : "POST",
+ data : params,
+ success : function(msg) {
+ if (msg.result == "ok") {
+ var data = msg.data.uuids;
+ if (data.length > 0) {
+ openFileLink(data[0].uuid, target, fileName);
+ } else {
+ $.simpleAlert("链接文件已被删除", "info");
+ //$("#simplealert>.msg").css("top", "15px");
+ }
+ }
+
+ }
+ });
+ }
+ }
+}
+
+function openFileLink(uuid, target, linkModelName) {
+ var cmd = "com.actionsoft.apps.coe.pal_pl_repository_designer";
+ //如果从流程团队中只读打开,则只读打开链接文件
+ if (role == "viewer") {
+ cmd = "com.actionsoft.apps.coe.pal_pl_repository_designer_viewer";
+ }
+ var url = "./w?sid="
+ + sid
+ + "&cmd=" + cmd + "&uuid="
+ + uuid + "&openType=0"
+ + "&perms=" + encodeURIComponent(perms)
+ + "&openAppType=" + openAppType;
+
+ $("#link-dialog-normal_contextmenu").hide();
+ if (target == "newTab" && parent.openDesginerFromAttr != undefined) {
+ parent.openDesginerFromAttr(uuid, 0, linkModelName, '', '', false, '');
+ } else if (target == "_seft") {
+ $("#openNewModelForm").attr("action", url).attr("target", "_self");
+ $("#openNewModelForm").submit();
+ parent.changeTabTitle(chartId, linkModelName, uuid);
+ } else {
+ $("#openNewModelForm").attr("action", url);
+ $("#openNewModelForm").submit();
+ }
+}
+
+/**
+ * 链接确定的鼠标单击事件
+ */
+UI.setLink = function() {
+ var addrName;
+ var addrLink;
+ var newLink;// 121
+ // var linkto_addr_name =document.getElementById("linkto_addr_name").value;
+ var linkType = $("#link_dialog div.awsui-simple-tab").find("a.active").attr("tit");
+ if (linkType == "custom") {
+ addrName = trimSpaces($("#linkto_addr_name")[0].value);
+ addrLink = trimSpaces($("#linkto_addr").val());
+ if (addrName == "") {
+ $.simpleAlert("[链接名称]不允许为空", "info", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ return;
+ }
+ if (addrLink == "") {
+ $.simpleAlert("[链接地址]不允许为空", "info", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ return;
+ }
+ if (addrName.length > 30) {
+ $.simpleAlert("[链接名称]不允许超过30个字符", "info", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ return;
+ }
+ // 判断url是否合法
+ /***********************************************************************
+ * var strRegex = "^((https|http|ftp|rtsp|mms)?://)" +
+ * "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //
+ * ftp的user@ + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL-
+ * 199.194.52.184 + "|" // 允许IP和DOMAIN(域名) + "([0-9a-z_!~*'()-]+\.)*" //
+ * 域名- www. + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 +
+ * "[a-z]{2,6})" // first level domain- .com or .museum +
+ * "(:[0-9]{1,4})?" // 端口- :80 + "((/?)|" // a slash isn't required if
+ * there is no file name + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
+ **********************************************************************/
+ var tomatch = /(http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3})|([A-Za-z0-9\.-]{3,}\.[A-Za-z0-9]{3,})/;
+ // var re = new RegExp(strRegex);
+ newLink = $("#linkto_addr").val();
+ if (addrLink.substring(0, 16) == "./w?sid=@sid&cmd"
+ || addrLink.substring(0, 17) == "./jd?sid=@sid&cmd"
+ || addrLink.substring(0, 17) == "./xd?sid=@sid&cmd"
+ || addrLink.substring(0, 17) == "./df?sid=@sid&cmd"
+ || addrLink.substring(0, 17) == "./uf?sid=@sid&cmd") {
+ if (newLink.indexOf("sid") > 0) {
+ newLink = newLink.replace("@sid", sid);
+ }
+ } else if (!tomatch.test(addrLink)) {
+ $.simpleAlert("链接地址不合法", "info", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ return;
+ } else if (newLink.indexOf("http") == -1
+ && newLink.indexOf("sid") == -1) {
+ newLink = "http://" + newLink;
+ }
+ } else {
+ addrName = trimSpaces($("#linkto_file_name").val());
+ addrLink = trimSpaces($("#linkto_file").val());
+ if (addrName == "") {
+ $.simpleAlert("[链接名称]不允许为空", "info", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ return;
+ }
+ if (addrName.length > 30) {
+ $.simpleAlert("[链接名称]不允许超过30个字符", "info", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ return;
+ }
+ if (addrLink == "") {
+ $.simpleAlert("[链接文件]不允许为空", "info", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ return;
+ }
+ newLink = $("#linkto_file").val();
+ }
+ var shape = Utils.getSelected()[0];
+ if (linkType != "custom") {
+ //选择文件链接时,将节点名称改为所链接的文件名称
+ //shape.text = trimSpaces($("#linkto_file_name").val());
+ }
+ myshapeLink = shape;
+ var linkArr = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.linksArray) {
+ linkArr = attr.linksArray;
+ break;
+ }
+ }
+ if (!isArray(linkArr)) {
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.linksArray) {
+ linkArr = [];
+ break;
+ }
+ }
+ // shape.linksArray = new Array();
+ }
+ var uuid = new Date().getTime() + "";
+ var url = linkType == "custom"
+ ? $("#linkto_addr").val()
+ : $("#linkto_file").attr("url");
+
+ if (!checkLink(url)) {
+ if (linkType == "custom") {
+ $("#linksHistoryDiv").show();
+ shape.link = $("#linkto_addr").val();
+ url = newLink;
+ } else {
+ $("#linksFileHistoryDiv").show();
+ shape.link = $("#linkto_file").val();
+ uuid = $("#linkto_file").attr("uuid");
+ url = $("#linkto_file").attr("url");
+ }
+ var divObj = $("div[tit='" + linkType + "']");
+ var openType = divObj.find("select option:selected").val();
+ linksHistoryShowAndAdd(shape, addrName, newLink, openType, uuid, url);
+ } else {
+ $.simpleAlert("链接已存在 ", "info", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ }
+ Designer.painter.renderShape(shape);
+};
+
+/**
+ * 在插入链接的弹窗中动态增加行信息
+ */
+
+function linksHistoryShowAndAdd(shape, name, value, target, uuid, url) {
+ var linkType = $("#link_dialog div.awsui-simple-tab").find("a.active").attr("tit");
+ var json = setCondVal(name, value, target, linkType, uuid, url);
+ if (!json) {
+ json = JSON.stringify({})
+ }
+ json = JSON.stringify(json);
+ json = eval("(" + json + ")");
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.linksArray) {
+ attr.linksArray.push(json);
+ break;
+ }
+ }
+ Model.update(shape);
+ var name_qtip = name;
+ var url_qtip = value;
+ var typeBlank = "新窗口";
+ if (target == "_seft") {
+ typeBlank = "当前窗口";
+ } else if (target == "newTab") {
+ typeBlank = "新页签";
+ }
+ var strTarget = "0";
+ var con = ''
+ + ' | '
+ + ' '
+ + name
+ + ' '
+ + ' | '
+ + ' '
+ + ' '
+ + ' '
+ + ' '
+ + value
+ + ' '
+ + ' '
+ + ' '
+ + ' | '
+ + ' '
+ + ' ' + typeBlank + ' '
+ + ' | '
+ + ' '
+ + ' 删除'
+ + ' | '
+ + '
';
+
+ if (linkType == "custom") {
+ $("#linksHistory").append(con);
+ } else {
+ $("#linksFileHistory").append(con);
+ }
+ var hieghtH = $("#linksHistory").height();
+ var hieghtHF = $("#linksFileHistory").height();
+ if (hieghtH < 200 || hieghtHF < 200) {
+ $("#linksHistory").css({
+ "overflow-y" : "hidden",
+ "overflow-x" : "hidden"
+ });
+ $("#linksFileHistory").css({
+ "overflow-y" : "hidden",
+ "overflow-x" : "hidden"
+ });
+ }
+ if (myshapeLink.category == "process_bpmn2") {
+ $.simpleAlert("添加成功", "ok", 2000);
+ } else {
+ $.simpleAlert("添加成功", "ok", 2000);
+ }
+ //$("#simplealert>.msg").css("top", "15px");
+ $("#linkto_addr_name").val("");
+ $("#linkto_addr").val("");
+ $("#linkto_file_name").val("");
+ $("#linkto_file").val("");
+ setDivHeight();
+}
+
+function setCondVal(name, value, target, linkType, uuid, url) {
+ var json = {
+ name : name,
+ value : value,
+ target : target,
+ type : linkType,
+ uuid : uuid,
+ url : url
+ };
+ return json
+}
+
+/**
+ * 设置链接打开的方式
+ */
+
+function setLinkTargetType(obj) {
+ var url = $(obj).attr("vl");
+ var value = $(obj).find("option:selected").val();
+ var shape = Utils.getSelected()[0];
+ var linksArray = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.linksArray) {
+ linksArray = attr.linksArray;
+ break;
+ }
+ }
+ var arr = [];
+ for (var a = 0; a < linksArray.length; a++) {
+ var el = linksArray[a];
+ if (el.url == url)
+ el.target = value;
+ arr.push(el);
+ }
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.linksArray) {
+ attr.linksArray = arr;
+ break;
+ }
+ }
+
+ $(obj).parent().parent().prev().find("a").attr("target", value);
+ var els = $(obj).parent().find("a");
+ Model.update(shape);
+ // $(obj).hide();
+ $(obj).parent().hide().siblings().show().text($(obj)
+ .find("option:selected").text());
+}
+// 判断给定的对象是不是数组
+
+function isArray(o) {
+ return Object.prototype.toString.call(o) === '[object Array]';
+}
+
+/**
+ * 链接的单击事件
+ *
+ * @param {}
+ * obj
+ * @returns {}
+ */
+
+function openLink(obj) {
+ var shape = Utils.getSelected()[0];
+ myshapeLink = shape;
+ if (shape != undefined) {
+ var x = shape.props['x'];
+ var y = shape.props['y'];
+ var menu = $("#link-dialog-normal_contextmenu");
+ menu.empty();
+ var linksArr = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.linksArray) {
+ linksArr = attr.linksArray;
+ break;
+ }
+ }
+ if (linksArr.length == 1) {
+ openLinkUrlRewrite(linksArr[0].type, linksArr[0].url,
+ linksArr[0].target, linksArr[0].uuid, '', linksArr[0].name);
+ } else {
+ var tempA = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.linksArray) {
+ tempA = attr.linksArray;
+ break;
+ }
+ }
+ for (var index = 0; index < tempA.length; index++) {
+ linkIndex++;
+ var array_element = tempA[index];
+ var content = '| '
+ + json.fileName
+ + ' ('
+ + json.ver
+ + ') | ' + json.type + ' |
';
+ $("#tagContentTableTitleContent2").append(content);
+ }
+ }
+ }
+ });*/
+}
+
+function showRelevanceShapesContent() {
+ if (!$("#tagContent3").is(":visible")) {
+ return;
+ }
+ $.ajax({
+ type : "POST",
+ url : "./jd?sid="
+ + CLB.sid
+ + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_relation_shape_relevance_show",
+ data : {
+ shapeId : Utils.getSelected()[0].id,
+ fileId: ruuid
+ },
+ success : function(msg) {
+ $("#tagContentTableTitleContent3").empty();
+ if (msg.data.result == "ok") {
+ var shapesObj = msg.data.list;
+ var mouseover = "onmouseout=\"hideRemoveTrAttribute(this);\"";
+ var mouseout = "onmouseover=\"showRemoveTrAttribute(this);\"";
+ if (role == "viewer") {
+ mouseover = "";
+ mouseout = "";
+ }
+ for (var i = 0; i < shapesObj.length; i++) {
+ var style = "";
+ var onclick = "";
+ if (editable || filePerms == "-" || filePerms.indexOf(shapesObj[i].fileVersionId) > -1) {
+ style = "cursor:pointer;color:blue;";
+ if (parent.openDesginerFromAttr) {
+ onclick = 'parent.openDesginerFromAttr(\''
+ + shapesObj[i].fileId
+ + '\',0,\''
+ + shapesObj[i].fileName
+ + '\',\'\',\'\',false,\''
+ + shapesObj[i].shapeId
+ + '\')';
+ } else if (window.opener.openDesginer) {
+ var obj = {
+ id: shapesObj[i].fileId,
+ processDefId: ''
+ }
+ onclick = 'window.opener.openDesginer({id:\'' + shapesObj[i].fileId + '\', processDefId:\'\'})';
+ }else if (parent.openLinkUrl){
+ if (shapesObj[i].url){
+ onclick = 'parent.openLinkUrl(\'custom\',\''
+ + shapesObj[i].url
+ + '\',0,\''
+ + shapesObj[i].fileId
+ + '\',\'this\')';
+ }else {
+ onclick = 'noPermissionMsg()';
+ }
+
+ }
+
+ }
+ var content = '| '
+ + ' '
+ + shapesObj[i].fileName
+ + '(V ' + shapesObj[i].fileVersion + '.0)'
+ + ' '
+ + ' | '
+ + shapesObj[i].shapeText
+ + ' |
';
+
+ $("#tagContentTableTitleContent3").append(content);
+ }
+ }
+ }
+ });
+
+}
+function noPermissionMsg(){
+ $.simpleAlert("暂无该模型权限","warning",1500);
+}
+
+// 属性的动态切换
+
+function attributeShowTabContent(currentShape) {
+
+ // 属性弹出层显示的内容
+ var shape = Utils.getSelected()[0];
+ if (!shape) {
+ return;
+ }
+ if (currentShape) {
+ shape = currentShape
+ }
+ if (shape.name === "linker") {
+ $(".clearfix").hide();
+ } else {
+ $(".clearfix").show();
+ }
+ var attributesJsonArray = "";
+ $("#tagContentTable0").empty();
+ var currentAttributesJsonArray = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ currentAttributesJsonArray = attr.attributesJsonArray;
+ break;
+ }
+ }
+ if (shape && currentAttributesJsonArray) {
+
+ selectShape = shape;
+ // 参见 这个js中的Designer.events.addEventListener("created", function(a)
+ // {}函数,改为图形创建时增加私有属性
+ attributesJsonArray = currentAttributesJsonArray;
+ if (shape.name === "linker") {
+ $("#attribute_name_td_content").html("连线");
+ } else {
+ $("#attribute_name_td_content").html(shape.title);
+ }
+ if (shape.text == "") {
+ $("span[name=attribute_desc_input]").text(shape.title);
+ } else {
+ if (shape.text.length > 15) {
+ var tempText = shape.text;
+ tempText = tempText.substring(0, 15)
+ $("span[name=attribute_desc_input]").text(shape.text).attr(
+ "awsui-qtip", shape.text);
+ } else {
+ $("span[name=attribute_desc_input]").text(shape.text);
+ }
+ }
+ // 此处遍历attributesJsonArray输入 内容
+ if (attributesJsonArray.length != 0) {
+ getPrivateAttributeHtml(attributesJsonArray, "tagContentTable0", shape);
+ }
+ } else {
+ if (shape.name === "linker") {
+ $("#attribute_name_td_content").html("连线");
+ } else {
+ $("#attribute_name_td_content").html(shape.title);
+ }
+ if (shape.text.length > 15) {
+ var tempText = shape.text;
+ tempText = tempText.substring(0, 15)
+ $("span[name=attribute_desc_input]").text(shape.text).attr(
+ "awsui-qtip", shape.text);
+ } else {
+ $("span[name=attribute_desc_input]").text(shape.text);
+ }
+ // $("#attribute_name_td_desc").val(shape.shapeDesc);
+ }
+ $("#dock_content_attribute").show();
+ $("#attr_no_more_attribute_id").hide();
+ $("#dock_view_header_title").html("数据属性");
+}
+
+// var dialogTableList = []
+var tableObj = {}
+var curTableId = ''
+function getPrivateAttributeHtml(attributesJsonArray, tbodyId, shape) {
+ // 属性排序
+ var defaultMoreAttr = $('#defaultMoreAttrSort').val();
+ if (shape.category != undefined) {
+ var category = shape.category.replace("_", ".");
+ if("bpmn"==category) {
+ category = "process.bpmn2";
+ }
+ if (defaultMoreAttr.length == 0) {
+ attributesJsonArray = [];
+ }
+ if(methodId === category) {
+ var arr = defaultMoreAttr.split('|');
+ var tempAttrArray = [];
+ for(var i = 0; i < arr.length; i++) {
+ for(var j = 0; j < attributesJsonArray.length; j++) {
+ if(attributesJsonArray[j] == undefined || attributesJsonArray[j] == null) {
+ continue;
+ }
+ if(arr[i] == attributesJsonArray[j].id) {
+ tempAttrArray.push(attributesJsonArray[j]);
+ }
+ }
+ }
+ attributesJsonArray = tempAttrArray;
+ }
+ }
+ var flag = false;
+ var awsOrg = false;
+ var awsObjIds = [];
+ var objIds = [];
+ var selectFlag = false;
+ var selectValues = [];
+ var booleanFlag = false;
+ var booleanValues = [];
+ var mouseover = "onmouseout=\"hideRemoveTrAttribute(this);\"";
+ var mouseout = "onmouseover=\"showRemoveTrAttribute(this);\"";
+ if (role == "viewer") {
+ mouseover = "";
+ mouseout = "";
+ }
+ $("#" + tbodyId).empty();
+ for (var index = 0; index < attributesJsonArray.length; index++) {
+ var obj = attributesJsonArray[index];
+ if (obj != null && obj != undefined && obj.value != undefined) {
+ var objName = obj.name;
+ var objType = obj.type;
+ var objReadonly = obj.readonly;
+ var objRequired = obj.required;
+ if (attrDefineObj[obj.id]) {
+ var attr = attrDefineObj[obj.id];
+ objName = attr.name;
+ objType = attr.type;
+ objReadonly = attr.readonly;
+ objRequired = attr.readonly;
+ }
+ var requiredSpan = ''
+ if(obj.isRequired !== null && obj.isRequired) {
+ requiredSpan = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ' ' + obj.value + ' '
+ + ' |
';
+ if ((!objReadonly && objType == "string") || (!objReadonly && objType == "list") || (!objReadonly && objType == "link")) {
+ // 目前支持到文本的输入 ,需求定下了再改
+ constr = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ' '
+ + ' |
';
+ } else if (!objReadonly && objType == "number") {
+ constr = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ' '
+ //+ ' '
+ + ' |
';
+ } else if (!objReadonly && objType == "boolean") {
+ booleanFlag = true;
+ var booleanValue = { "objId" : obj.id,
+ "objValue" : obj.value,
+ "objOptions" : obj.ref,
+ "objType": objType};
+ booleanValues.push(booleanValue);
+ constr = ''
+ + ' | ' + objName + ' | '
+ + ' '
+ + ''
+ /*+ ' '*/
+
+ //+ ' '
+ + ' | '
+ + '
';
+ } else if (!objReadonly && objType == "textarea") {
+ constr = ''
+ + '| ' + objName + requiredSpan + ' | '
+ + ''
+ + ''
+ //+ ''
+ + ' | '
+ + '
';
+ } else if (objType == "relation") {
+ flag = true;
+ // 形状的关联
+ objIds.push(obj.id);
+ constr = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ' '
+ + ' '
+ + ' |
';
+
+ } else if (objType == "select" || objType == "select_m") {
+ selectFlag = true;
+ var selectValue = { "objId" : obj.id,
+ "objValue" : obj.value,
+ "objType": objType};
+ selectValues.push(selectValue);
+
+ constr = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ''
+ /*+ ' '*/
+
+ //+ ' '
+ + ' | '
+ + '
';
+ } else if (objType == "awsorg") {// 平台组织架构(部门、岗位、人员、角色)
+ awsOrg = true;
+ awsObjIds.push(obj.id);
+ constr = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ' '
+ + ' '
+ + ' |
';
+ } else if (objReadonly && objType == "hidden") {
+ constr = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ' '
+ //+ ''
+ + ' |
';
+ } else if (!objReadonly && objType == "DateTimePicker") {
+ constr = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ' '
+ + ' |
';
+ } else if (!objReadonly && objType == "table") {
+ let objRef = JSON.parse(obj.ref)
+ let objTableInput = obj.value.table !== undefined && obj.value.table.length > 1 ? '请查看' : '请输入'
+ tableObj[obj.id] = obj.value.table == undefined ? [ { id: Utils.newId() ,name: objRef.firstColumn, desc: objRef.secondColumn} ] : obj.value.table;
+ // dialogTableList = obj.value.table == undefined ? [ { id: Utils.newId() ,name: objRef.firstColumn, desc: objRef.secondColumn} ] : obj.value.table;
+ constr = ''
+ + ' | ' + objName + requiredSpan + ' | '
+ + ' '
+ + ''
+ + ' '
+ + ' '
+ + ' '
+ + ' '
+ + ''
+ + ' |
';
+ }
+ $("#" + tbodyId).append(constr);
+ $("#dateTimePicker_" + obj.id).datepicker({dateFmt:"yyyy-MM-dd HH:mm:ss"});
+ }
+ }
+ if (flag) {
+ getRelevanceShapeNameByShapeId(objIds, shape.id);
+ }
+ if (selectFlag) {
+ getSelectOptions(shape.category, selectValues, shape.id); //处理select类型
+ }
+ if (booleanFlag) {
+ getBooleanSelectOptions(booleanValues, shape.id);
+ }
+ // awsOrg
+ if (awsOrg) {
+ getRelevanceAwsOrgNameByShapeId(awsObjIds, shape.id);
+ }
+}
+
+// 得到关联形状
+function getRelevanceShapes(objId,attributeValue) {
+ $("#attr_dialog_normal_relevance_shapes_div").dialog('close');
+ selectShape = Utils.getSelected()[0];
+ var shape = selectShape;
+ if (!shape) {
+ return;
+ }
+ var relationShapes = attr_content_iframe_relevance_shapes.getRelationShapeInfos();
+
+ var shapeGroupId = "";
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.shapeGroupId != undefined && attr.shapeGroupId != "") {
+ shapeGroupId = attr.shapeGroupId;
+ break;
+ }
+ }
+ shape = getAttributeByAttrId(shape, objId, relationShapes);
+ saveRelevanceShapesTODB(relationShapes, shape.id, shape.text, $("title").text(), shapeGroupId, objId, shape,attributeValue);
+}
+
+Array.prototype.unique = function(){
+ var res = [];
+ var json = {};
+ for(var i = 0; i < this.length; i++){
+ if(!json[this[i]]){
+ res.push(this[i]);
+ json[this[i]] = 1;
+ }
+ }
+ return res;
+}
+
+
+// 得到不同属性值关联的形状
+function getAttributeByAttrId(shape, objId, relationShapes) {
+ //objId 属性的key值
+ var exitAttributesJsonArray = [];
+ var attrArr = []; //修改后的属性值
+
+ for (var i = 0; i < relationShapes.length; i++) {
+ var shapeObjT = relationShapes[i];
+ attrArr.push(shapeObjT.relationShapeId);
+ }
+ attrArr = attrArr.unique(); //属性值去重
+ if (attrArr.length > 0) {
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ exitAttributesJsonArray = attr.attributesJsonArray;
+ break;
+ }
+ }
+ for (var c = 0; c < exitAttributesJsonArray.length; c++) {
+ var el = exitAttributesJsonArray[c];
+ if(el == null) continue;
+ if (el.id == objId) {
+ el.value = attrArr.join(",");
+ break;
+ }
+ }
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ attr.attributesJsonArray = exitAttributesJsonArray;
+ break;
+ }
+ }
+ for (var j = 0, len = attrArr.length; j < len; j++) {
+ var attrShapeId = attrArr[j];
+ relationShapesObject[attrShapeId] = {"relationShapeId" : attrShapeId};
+ }
+ $("input[objid_shapeId='" + objId + "']").val(attrArr.join(","));
+ } else {
+ $("input[objid_shapeId='" + objId + "']").val("");
+ }
+
+ return shape;
+}
+Array.prototype.notDistinct = function() {
+ var newArr = [], obj = {};
+ for (var i = 0, len = this.length; i < len; i++) {
+ if (!obj[this[i]]) {
+ newArr.push(this[i]);
+ obj[this[i]] = 'new';
+ }
+ }
+ return newArr;
+}
+
+// 删除掉关联形状
+function removeTrRelevanceShapes(obj) {
+ var options = {
+ title : "提示",
+ content : "确定删除吗?",
+ model : false,
+ onConfirm : function() {
+ // 确定删除
+ var shape = Utils.getSelected()[0];
+ var tempArray = [];
+ var count = 0;
+ if (shape) {
+ var relevanceShapes = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.relevanceShapes) {
+ relevanceShapes = attr.relevanceShapes;
+ break;
+ }
+ }
+ for (var index = 0; index < relevanceShapes.length; index++) {
+ var tempObj = relevanceShapes[index];
+ if (tempObj.id == $(obj).attr("objid")) {
+ continue;
+ }
+ tempArray[count++] = tempObj;
+ }
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.relevanceShapes) {
+ attr.relevanceShapes = tempArray;
+ break;
+ }
+ }
+ Model.update(shape);
+ }
+ $(obj).hide();
+ $(obj).parent().parent().remove();
+ $.ajax({
+ type : "POST",
+ url : "./jd?sid="
+ + CLB.sid
+ + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_relation_shape_relevance_remove",
+ data : {
+ uuid : $(obj).attr("objid"),
+ },
+ success : function(msg) {
+ }
+ });
+ }
+ };
+ window.top.$.confirm(options);
+}
+
+// 过虑 掉重复的图形
+function filterRepeatShapes(arr1, shape) {
+ var arr2 = [];
+ var arr = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.relevanceShapes) {
+ arr2 = attr.relevanceShapes;
+ break;
+ }
+ }
+ var flag = false;
+ for (var a = 0; a < arr1.length; a++) {
+ var arrEle1 = arr1[a];
+ for (var b = 0; b < arr2.length; b++) {
+ var arrEle2 = arr2[b];
+ if (arrEle1.id == arrEle2.id) {
+ flag = true;
+ break;
+ }
+ }
+ if (flag) {
+ flag = false;
+ continue;
+ }
+ arr2.push(arrEle1);
+ }
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.relevanceShapes) {
+ attr.relevanceShapes = arr2;
+ break;
+ }
+ }
+
+ return shape;
+}
+
+function updateModelElementsAttribute(selectedShape, nodes) {
+ var shapes = Model.define.elements;
+ for (var shapeId in shapes) {
+ var obj = nodes;
+ var shape = shapes[shapeId];
+ if(shape.name != "linker" && shape.id != selectedShape.id && shape.name == selectedShape.name){
+ var exitAttributesJsonArray = [];
+ var attrIndex = 0;
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ exitAttributesJsonArray = attr.attributesJsonArray;
+ attrIndex = i;
+ break;
+ }
+ }
+ var arrJsontemp = [];
+ for (var t = 0; t < exitAttributesJsonArray.length; t++) {
+ if(exitAttributesJsonArray[t] == null) {
+ continue;
+ }
+ arrJsontemp.push(exitAttributesJsonArray[t]);
+ }
+ obj = filterRepeatAttribute(obj, exitAttributesJsonArray, shape.dataAttributes[attrIndex].attributesJsonArray);
+ for (var a = 0; a < obj.length; a++) {
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ attr.attributesJsonArray.push(obj[a]);
+ break;
+ }
+ }
+ }
+ if (arrJsontemp.length != 0) {
+ var tempArr = removeShepeAttributeAndReturnDifferent(arrJsontemp, filterNotCheckedAttribute(nodes, arrJsontemp));
+ var tempArray = [];
+ for (var e = 0; e < tempArr.length; e++) {
+ if (tempArr[e] != 0 && tempArr[e] != "0") {
+ removeNotCheckedAttribute(shape, tempArr[e]);
+ }
+ }
+ if (tempArray.length != 0) {
+ shape.attributesJsonArray = tempArray;
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ attr.attributesJsonArray = tempArray;
+ break;
+ }
+ }
+ }
+ }
+ Model.update(shape);
+ //修改属性时,后台查询是否有关联属性,如果删除的属性有关联属性,需要删除关联表中的数据
+ var attrIds = ",";
+ if (nodes != undefined) {
+ for (var i = 0; i < nodes.length; i++) {
+ if (nodes[i].type) {
+ attrIds += nodes[i].id + ",";
+ }
+ }
+ awsui.ajax.request({
+ url : "./jd",
+ method : "POST",
+ data : {
+ sid:sid,
+ cmd:"com.actionsoft.apps.coe.pal_pl_repository_designer_relation_shape_relevance_check",
+ fileId: ruuid,
+ shapeId: shape.id,
+ attrIds: attrIds
+ },
+ ok : function(r) {
+ },
+ err:function(r){
+ }
+ });
+ }
+ }
+ }
+}
+
+// 过虑出当在节点上不选中时的属性
+
+function filterNotCheckedAttribute(checkedObj, exitObj) {
+ var result1 = [];
+ if (checkedObj.length == 0) {
+ return [];
+ } else {
+ var flag = false;
+ for (var b = 0; b < checkedObj.length; b++) {
+ var checkedArr1 = checkedObj[b];
+ for (var a = 0; a < exitObj.length; a++) {
+ var exitArr1 = exitObj[a];
+ if (exitArr1.id == checkedArr1.id) {
+ result1.push(checkedArr1);
+ break;
+ }
+ }
+ }
+ return result1;
+ }
+}
+
+// 移除图形属性中部分已存在的元素并返回不同元素
+
+function removeShepeAttributeAndReturnDifferent(exitObj, newObj1) {
+ var result1 = [];
+ for (var a = 0; a < newObj1.length; a++) {
+ var obj1 = newObj1[a];
+ for (var i = 0, n = 0; i < exitObj.length; i++) {
+ if (exitObj[i].id == obj1.id) {
+ result1.push(i);
+ break;
+ }
+ }
+ }
+ for (var i = 0; i < result1.length; i++) {
+ exitObj[result1[i]] = 0;
+ }
+ return exitObj;
+}
+// 删除没有选中的元素
+
+function removeNotCheckedAttribute(shape, obj1) {
+ var tempArray = [];
+ var attributesJsonArray1 = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ attributesJsonArray1 = attr.attributesJsonArray;
+ break;
+ }
+ }
+ for (var index = 0; index < attributesJsonArray1.length; index++) {
+ if(attributesJsonArray1[index] == null) {
+ continue;
+ }
+ var tempObj1 = attributesJsonArray1[index];
+ if (tempObj1.id == obj1.id) {
+ continue;
+ }
+ tempArray.push(tempObj1);
+ }
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ attr.attributesJsonArray = tempArray;
+ break;
+ }
+ }
+ // shape.attributesJsonArray = tempArray;
+ // Model.update(shape);
+ $("#tagContentTable0 tr[objid='" + obj1.id + "']").remove();
+}
+// 过滤掉重复的属性生成新的数组
+
+function filterRepeatAttribute(arr1, arr2, shape) {
+ var result = [];
+ var flag = false;
+ for (var a = 0; a < arr1.length; a++) {
+ var arrEle1 = arr1[a];
+ for (var b = 0; b < arr2.length; b++) {
+ var arrEle2 = arr2[b];
+ if(arrEle2 == null) {
+ continue;
+ }
+ if (arrEle1.id == arrEle2.id) {
+ shape[b].name = arrEle1.name;
+ flag = true;
+ break;
+ }
+ }
+ if (flag) {
+ flag = false;
+ continue;
+ }
+ result.push(arrEle1);
+ }
+
+ return result;
+}
+
+// 当属性为可编辑时,编辑时自动保存
+
+function showEditButton(obj) {
+ // $(obj).siblings("span::contains('...')").show();
+}
+
+var inputUpdate = false;
+function saveInputContent(obj,value) {
+ // 按钮
+ // $(obj).siblings("span::contains('...')").hide();
+ inputUpdate = true;
+ var objValue = $(obj).val();
+ if (objValue.indexOf("") > -1) {
+ $(obj).val("");
+ $.simpleAlert("禁止输入js脚本!", "warning");
+ return;
+ }
+ if(value !== undefined && value.isRequired && objValue == '') {
+ $(obj).attr('placeholder',value.name + '不能为空')
+ $(obj).addClass("required_input_css");
+ return;
+ }
+ if ($(obj).attr("inputType") == "number") {
+ var val = $(obj).val();
+ if (/\D/.test(val)) {
+ $.simpleAlert("此处只能输入数字", "warning", 2000);
+ //$("#simplealert>.msg").css("top", "15px");
+ return;
+ }
+ }
+ updateAttributeById($(obj).attr("objid"), objValue, $(obj).attr('data-shapeId'));
+ inputUpdate = false;
+}
+
+function saveSelectContent(objAttr,objValue, shapeId){
+ updateAttributeById(objAttr, objValue, shapeId);
+}
+
+// 显示select下拉框
+
+function showSelectOption(obj) {
+ var str = $(obj).attr("ty");
+ if (str == "td") {
+ $(obj).children("select").show();
+ $(obj).children("span").hide();
+ } else {
+ updateAttributeById($(obj).attr("objid"), $(obj)
+ .find("option:selected").text());
+ $(obj).hide();
+ $(obj).siblings("span").text($(obj).find("option:selected").text())
+ .show();
+ }
+}
+
+// 属性编辑打开窗口
+
+function showAttributedEditWindow(obj) {
+ var objId = $(obj).attr("objid");
+ var shape = Utils.getSelected()[0];
+ var windowTitle = '提示';
+ let objValue = {}
+ if (shape) {
+ var attributesJsonArray = [];
+ for (var i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ attributesJsonArray = attr.attributesJsonArray;
+ break;
+ }
+ }
+ for (var index = 0; index < attributesJsonArray.length; index++) {
+ var tempObj = attributesJsonArray[index];
+ if (tempObj.id == objId) {
+ objValue = tempObj
+ windowTitle = tempObj.name;
+ // $("#attribute-edit-title").text(tempObj.name);
+ $("#attribute-edit-content").val(tempObj.value);
+ break;
+ }
+ }
+ }
+ $("#attribute-edit-window").dialog({
+ title: windowTitle,
+ draggable: true,
+ buttons : [{
+ text : '确定',
+ cls : "blue",
+ handler : function() {
+ var str = $("#attribute-edit-content").val();
+ if (str.indexOf("") > -1) {
+ $("#attribute-edit-content").val("");
+ $.simpleAlert("禁止输入js脚本!", "warning");
+ return;
+ }
+ if(objValue.isRequired && str == '') {
+ $("#attribute-edit-content").attr('placeholder',objValue.name + '不能为空')
+ $("#attribute-edit-content").addClass("required_input_css");
+ return
+ }
+ updateAttributeById($(obj).attr("objid"), str);
+ $(obj).val(str);
+ $("#attribute-edit-window").dialog('close');
+ }
+ }, {
+ text : '取消',
+ handler : function() {
+ $("#attribute-edit-window").dialog('close');
+ }
+ }]
+ });
+ $("#attribute-edit-content").focus();
+}
+
+// table表格
+function openTableDialog(obj,value) {
+ let tableName = '提示'
+ let objId = $(obj).attr("objid");
+ curTableId = objId
+ let dialogTableList = tableObj[objId]
+ let shape = Utils.getSelected()[0];
+ if (shape) {
+ let attributesJsonArray = [];
+ for (let i = 0; i < shape.dataAttributes.length; i++) {
+ var attr = shape.dataAttributes[i];
+ if (attr.attributesJsonArray) {
+ attributesJsonArray = attr.attributesJsonArray;
+ break;
+ }
+ }
+ for (let index = 0; index < attributesJsonArray.length; index++) {
+ var tempObj = attributesJsonArray[index];
+ if (tempObj.id == objId) {
+ tableName = tempObj.name;
+ break;
+ }
+ }
+ }
+ $('#attribute-table-content').empty()
+ $('#attribute-add-content').empty()
+ var thead =
+ '