diff --git a/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar b/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar
index b0e77704..26df336a 100644
Binary files a/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar and b/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar differ
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java
index a776663e..3b0afd57 100644
--- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java
@@ -130,9 +130,9 @@ public class SubProcessController {
}
@Mapping("com.actionsoft.apps.coe.method.process.subprocess.shape_expand")
- public String shapeExpand(UserContext uc, String repositoryId, String shapeId, String direction){
+ public String shapeExpand(UserContext uc, String repositoryId, String shapeId){
SubProcessWeb processWeb = new SubProcessWeb(uc);
- return processWeb.shapeNodeExpand(repositoryId, shapeId, direction);
+ return processWeb.shapeNodeExpand(repositoryId, shapeId);
}
}
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphNodeExpandHandle.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphNodeExpandHandle.java
index 51dd9b8a..76286a0b 100644
--- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphNodeExpandHandle.java
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphNodeExpandHandle.java
@@ -146,7 +146,7 @@ public class GraphNodeExpandHandle {
* @throws Exception
* @return 节点展开后的模型存储信息
*/
- public String handleNodeExpand(String direction) throws Exception{
+ public String handleNodeExpand() throws Exception{
// Thread t1 = new Thread(() -> {
// // 1、总图节点以及连线处理
@@ -164,7 +164,7 @@ public class GraphNodeExpandHandle {
// t2.join();
// 1、总图节点以及连线处理
- handleEndToEndGraphNodeAndLinker(direction);
+ handleEndToEndGraphNodeAndLinker();
// 2、子流程节点内部元素处理
handleRelationModelNodePosition();
@@ -187,7 +187,7 @@ public class GraphNodeExpandHandle {
* 6、删除旧有连线关系
* 7、构建新的连线关系
*/
- private void handleEndToEndGraphNodeAndLinker(String direction){
+ private void handleEndToEndGraphNodeAndLinker(){
// 1、删除当前要展开的节点
removeEndToEndGraphElements(shapeId);
@@ -200,18 +200,30 @@ public class GraphNodeExpandHandle {
// 4、构建邻接矩阵
NodeExpandAdjMatrix expandAdjMatrix = buildEndToEndGraphAdjMatrix();
expandAdjMatrix.buildAdjMatrix();
+ // expandAdjMatrix.printAdjMatrix();
// 5、删除节点展开前的连线
removeEndToEndGraphOldLinker();
// 6、获取所有节点坐标
JSONObject elements = endToEndProcessDefine.getJSONObject("elements");
double[][] vertexPosition = expandAdjMatrix.getVertexPosition(elements);
// 7、构建新的连线
+ JSONObject processProperties = endToEndProcessDefine.getJSONObject("processProperties");
+ String direction = processProperties.getString("direction");
NodeExpandLinkerRender linkerRender = new NodeExpandLinkerRender(vertexPosition, expandAdjMatrix, scopeLimitationShape);
JSONArray linkers = linkerRender.toAssembleLinker(direction, shapeId);
for (Object o : linkers) {
JSONObject linker = (JSONObject) o;
addEndToEndGraphElements(linker);
}
+
+ // 8、更新画布的大小
+ // 确定画布的宽度与高度
+ double w = Arrays.stream(vertexPosition).mapToDouble(position -> position[0]).max().orElse(0.0);
+ double h = Arrays.stream(vertexPosition).mapToDouble(position -> position[1]).max().orElse(0.0);
+
+ JSONObject page = endToEndProcessDefine.getJSONObject("page");
+ page.put("width", w + 300);
+ page.put("height", h + 300);
}
/**
@@ -544,7 +556,7 @@ class NodeExpandLinkerRender{
private double[][] calculationLinkerPointInVertLayOut(double[] fromPoi, double[] toPoi, boolean currentExpandNodeIsStart, boolean currentExpandNodeIsEnd) {
double fromX = fromPoi[0],fromY = fromPoi[1],toX = toPoi[0],toY = toPoi[1];
- double scopeShapeW = scopeLimitationShape.getDoubleValue("w"), scopeShapeH = scopeLimitationShape.getDoubleValue("h");
+ double scopeShapeW = scopeLimitationShape.getJSONObject("props").getDoubleValue("w"), scopeShapeH = scopeLimitationShape.getJSONObject("props").getDoubleValue("h");
if (fromY == toY){ // 水平 分析可知 水平方向上不会出现 从左到右直连的情况 只有 右边节点右侧锚点出 向上走 左折 连到左侧节点上方锚点
double[] startPoi = new double[]{fromX + (currentExpandNodeIsStart ? scopeShapeW : SubProcessConst.SUB_PROCESS_SHAPE_W), fromY + (currentExpandNodeIsStart ? scopeShapeH : SubProcessConst.SUB_PROCESS_SHAPE_H) / 2};
double[] turnPoi1 = new double[]{fromX + (currentExpandNodeIsStart ? scopeShapeW : SubProcessConst.SUB_PROCESS_SHAPE_W) + SubProcessConst.SHAPE_HORIZ_INTERVAL / 2, fromY + (currentExpandNodeIsStart ? scopeShapeH : SubProcessConst.SUB_PROCESS_SHAPE_H) / 2};
@@ -612,7 +624,7 @@ class NodeExpandLinkerRender{
private double[][] calculationLinkerPointInHorizLayOut(double[] fromPoi, double[] toPoi, boolean currentExpandNodeIsStart, boolean currentExpandNodeIsEnd) {
double fromX = fromPoi[0],fromY = fromPoi[1],toX = toPoi[0],toY = toPoi[1];
- double scopeShapeW = scopeLimitationShape.getDoubleValue("w"), scopeShapeH = scopeLimitationShape.getDoubleValue("h");
+ double scopeShapeW = scopeLimitationShape.getJSONObject("props").getDoubleValue("w"), scopeShapeH = scopeLimitationShape.getJSONObject("props").getDoubleValue("h");
if (fromY == toY) { // 水平 方向上 存在从左向右直连的情况 但不存在从右向左直连的情况 水平方向上 从左向右 应是 右出 向上 左折 向下
return fromX < toX
? new double[][]
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphRender.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphRender.java
index 3dd6593a..10665d35 100644
--- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphRender.java
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphRender.java
@@ -150,4 +150,15 @@ public class GraphRender {
CoeDesignerAPIManager.getInstance().storeDefinition(this.baseModel);
}
}
+
+ /**
+ * 布局方向添加到流程属性中
+ * 方便后续节点展开时用到
+ * @param direction
+ */
+ public void addDirectionToProcessProperties(String direction){
+ JSONObject defineJsonObj = JSONObject.parseObject(this.baseModel.getDefinition());
+ JSONObject processProperties = defineJsonObj.getJSONObject("processProperties");
+ processProperties.put("direction", direction);
+ }
}
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java
index d80a478c..2b65b890 100644
--- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java
@@ -309,10 +309,10 @@ public class SubProcessWeb extends ActionWeb {
* @param shapeId 待展开的子流程节点ID
* @param direction 布局方向
*/
- public String shapeNodeExpand(String repositoryId, String shapeId, String direction){
+ public String shapeNodeExpand(String repositoryId, String shapeId){
try {
GraphNodeExpandHandle nodeExpandHandle = new GraphNodeExpandHandle(repositoryId, shapeId);
- String define = nodeExpandHandle.handleNodeExpand(direction);
+ String define = nodeExpandHandle.handleNodeExpand();
ResponseObject ro = ResponseObject.newOkResponse("展开成功");
ro.setData(define);
return ro.toString();
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 c8878d59..e560570a 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
@@ -6,6 +6,7 @@ $(function(){
(function (Model, ruuid, sid) {
const subProcess = new SubProcess(Model, ruuid, sid);
subProcess.shapeIconRender();
+ window.subProcess = subProcess;
// 连线框 鼠标指针样式设置 防止因为连线z-index层级较高 会导致节点展开图标点击不到
$('.shape_box.linker_box').css({
@@ -29,14 +30,16 @@ class SubProcess {
for (let shapeId in elements) {
let shape = elements[shapeId];
if (shape.name == 'linker') continue; // 当前元素为连线的话 直接略过
- if (shape.name == 'subProcess') { // 当前元素为子流程节点 渲染展开图标 并绑定展开事件
- let expandIcon = "";
- $('#'+shapeId).append(expandIcon);
- $('#icon_'+shapeId).on('click', '', {shapeId: shapeId, Model: this.Model, repositoryId: this.repositoryId, sid: this.sid}, this.shapeExpand);
- }else { // 当前元素为虚线范围限制框的话 渲染关闭图标 并绑定关闭事件
- let closeIcon = "";
- $('#'+shapeId).append(closeIcon);
- $('#icon_'+shapeId).on('click', '', {shapeId: shapeId, Model: this.Model, repositoryId: this.repositoryId, sid: this.sid}, this.shapeClose);
+ if (shape.name == 'scopeLimitation' || shape.name == 'subProcess'){ // 只有子流程或者范围选择框才有对应的图标渲染
+ if (shape.name == 'subProcess') { // 当前元素为子流程节点 渲染展开图标 并绑定展开事件
+ let expandIcon = "";
+ $('#'+shapeId).append(expandIcon);
+ $('#icon_'+shapeId).on('click', '', {shapeId: shapeId, Model: this.Model, repositoryId: this.repositoryId, sid: this.sid}, this.shapeExpand);
+ }else { // 当前元素为虚线范围限制框的话 渲染关闭图标 并绑定关闭事件
+ let closeIcon = "";
+ $('#'+shapeId).append(closeIcon);
+ $('#icon_'+shapeId).on('click', '', {shapeId: shapeId, Model: this.Model, repositoryId: this.repositoryId, sid: this.sid}, this.shapeClose);
+ }
}
}
}
@@ -66,9 +69,11 @@ class SubProcess {
shapeId: param.shapeId
},
ok: function(r){
- console.log(JSON.stringify(r.data));
+ // console.log(JSON.stringify(r.data));
definition = JSON.stringify(r.data);
- Designer.open(definition);
+ Designer.open(definition); // 节点重新渲染
+ // 针对范围标识框渲染 节点关闭按钮
+ window.subProcess.shapeIconRender();
},
err: function(r){
$.simpleAlert(r.msg);