From 3c9f5a8a84d7630aa0c5a007507f436da194eab7 Mon Sep 17 00:00:00 2001 From: qinoy Date: Tue, 6 Jun 2023 15:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=AF=E5=88=B0=E7=AB=AF=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20=E8=8A=82=E7=82=B9=E5=B1=95=E5=BC=80=20=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E6=A0=87=E8=AF=86=E6=A1=86=E9=99=90=E5=88=B6=E5=86=85=E9=83=A8?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=B4=BB=E5=8A=A8=E8=8C=83=E5=9B=B4=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/diagraming/designer.core.debug.js | 24 +++++++++++ .../diagraming/designer.method.subprocess.js | 42 ++++++++++++++++--- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.core.debug.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.core.debug.js index 2e12adbd..451d96cb 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.core.debug.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.core.debug.js @@ -1163,6 +1163,30 @@ var Designer = { if (g.x == 0 && g.y == 0) { return } + // 端到端功能 如果移动的元素是子流程节点展开后 范围框中的元素 则进行移动范围限制校验 + let rang = window.subProcess.scopeRang; + let movingEle = window.subProcess.movingEle; + if (movingEle != null && rang != null){ + let flag = false; + for (let k = 0; k < u.length; k++) { + if (u[k].name == "linker") continue; + if (u[k].id == movingEle.id) flag = true; + } + if (flag){ + let movingEleBound = { + x: movingEle.props.x, + y: movingEle.props.y, + w: movingEle.props.w, + h: movingEle.props.h + } + if (movingEleBound.x + g.x <= rang.x1 || movingEleBound.x + movingEleBound.w + g.x >= rang.x2 || movingEleBound.y + g.y <= rang.y1 || movingEleBound.y + movingEleBound.h + g.y >= rang.y2){ + $.simpleAlert("子流程内部节点只能在范围标识框内部移动", "warning"); + d.unbind("mousemove.drag"); + c.unbind("mousedown.drag"); + return; + } + } + } Designer.op.moveShape(u, g); x = f; $(document).unbind("mouseup.drop").bind("mouseup.drop", diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.method.subprocess.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.method.subprocess.js index ef2244b6..5989b045 100644 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.method.subprocess.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.method.subprocess.js @@ -25,7 +25,9 @@ class SubProcess { this.Model = Model; this.repositoryId = ruuid; this.sid = sid; - this.scopeEle = {}; + this.scopeEle = {}; // 范围框元素以及其内部元素 + this.movingEle = null; // 范围框内移动中的元素 + this.scopeRang = null; // 范围限制框左右两边以及上下两边的坐标 x1 x2 y1 y2 } init(){ @@ -80,6 +82,7 @@ class SubProcess { h: j.shape.props.h }; let e = Utils.getShapesByRange(range); + // 将当前范围选择框元素以及范围内的元素 存储到subProcess中 方便后续 范围框内的元素移动时做范围框限制 window.subProcess.scopeEle[j.shape.id] = e; $('#'+j.shape.id).off("mousedown").on("mousedown", function (f) { Utils.unselect(); @@ -90,14 +93,30 @@ class SubProcess { // console.log('范围标注框的图形是否存了下来', window.subProcess.scopeEle); let scopeEle = window.subProcess.scopeEle; for (const scopeShapeId in scopeEle) { - let eles = scopeEle[scopeShapeId]; - if (eles.indexOf(j.shape.id) != -1){ - console.log("范围选择框内的元素发生移动") - // 移动的范围 + let inRangeEles = scopeEle[scopeShapeId]; + if (inRangeEles.indexOf(j.shape.id) != -1){ + let currentScopeEle = Model.getShapeById(scopeShapeId); // 获取当前范围选择框 + let bound = { + x: currentScopeEle.props.x, + y: currentScopeEle.props.y, + w: currentScopeEle.props.w, + h: currentScopeEle.props.h + }; + let rang = { + x1: bound.x, + y1: bound.y, + x2: bound.x + bound.w, + y2: bound.y + bound.h + }; + window.subProcess.scopeRang = rang; + window.subProcess.movingEle = Model.getShapeById(j.shape.id); } } } + }else { + window.subProcess.movingEle = null; + window.subProcess.scopeRang = null; } }); } @@ -132,6 +151,8 @@ class SubProcess { Designer.open(definition); // 节点重新渲染 // 针对范围标识框渲染 节点关闭按钮 window.subProcess.shapeIconRender(); + // 提示用户文件已修改 + window.subProcess.fileModifiedTip(); }, err: function(r){ $.simpleAlert(r.msg); @@ -142,7 +163,16 @@ class SubProcess { // 节点关闭事件 shapeClose(event){ - console.log('sss') + console.log('sss'); + let param = event.data; + + } + + fileModifiedTip(){ + if (isAutoSave == "0") { + $("#saving_tip").css("color", "rgb(255, 0, 0)"); + $("#saving_tip").text("文件已修改,未保存"); + } } }