端到端功能 节点展开与闭合拆分成 流程层级与活动层级两类

This commit is contained in:
ouyang 2023-07-29 22:18:49 +08:00
parent ebf4a754de
commit 04c7ca4ccf
37 changed files with 186 additions and 170 deletions

View File

@ -536,7 +536,7 @@ Schema.addShape({name:"method_service_node4", title:"人工任务", text:"人工
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:{ref:"round"}}
]});
Schema.addShape({name:"subProcess", title:"子流程", text:"子流程", category:"process_subprocess", groupName:"", props:{w:100, h:70},
Schema.addShape({name:"subProcess", title:"子流程", text:"子流程", category:"process_subprocess", groupName:"", props:{w:150, h:66},
fillStyle:{color:"153,255,255"},textBlock:{x:"Math.min(w/6,20)", y:"0", w:"w-Math.min(w/6,20)*2", h:"h"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"},
path:[
{actions:[

View File

@ -123,9 +123,9 @@ public class SubProcessController {
* @return
*/
@Mapping("com.actionsoft.apps.coe.method.process.subprocess.generator_end_to_end_model")
public String generatorEndToEndModel(UserContext uc, String processIdJsonArr, String locationId, String direction, String modelName, String excludeProcessIdArr){
public String generatorEndToEndModel(UserContext uc, String processIdJsonArr, String locationId, String direction, String level, String modelName, String excludeProcessIdArr){
SubProcessWeb processWeb = new SubProcessWeb(uc);
processWeb.generatorEndToEndModel(processIdJsonArr, locationId, direction, modelName, excludeProcessIdArr);
processWeb.generatorEndToEndModel(processIdJsonArr, locationId, direction, level, modelName, excludeProcessIdArr);
return ResponseObject.newOkResponse().toString();
}

View File

@ -0,0 +1,128 @@
package com.actionsoft.apps.coe.method.process.subprocess.graph;
import com.actionsoft.apps.coe.method.process.subprocess.constant.SubProcessConst;
import com.actionsoft.apps.coe.method.process.subprocess.graph.util.SubProcessNodeDefineUtil;
import com.actionsoft.apps.coe.method.process.subprocess.mode.Node;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.exception.AWSException;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author oYang
* @create 2023-07-29 14:13
*/
public class GraphGeneratorHandle {
private String processIdJsonArr; // 选择的子流程
private String excludeProcessIdArr; // 过滤的子流程
private String direction; // 排布方向
private String locationId; // 位置
private String modelName; // 总图名称
private UserContext uc;
private String graphModelId; // 生成总图的模型ID
public GraphGeneratorHandle(String processIdJsonArr, String excludeProcessIdArr, String direction, String locationId, String modelName, UserContext uc) {
this.processIdJsonArr = processIdJsonArr;
this.excludeProcessIdArr = excludeProcessIdArr;
this.direction = direction;
this.locationId = locationId;
this.modelName = modelName;
this.uc = uc;
}
public void processLevelGraphGenerator(){
// 忽略独立的节点
List<String> processIdList = JSONArray.parseArray(processIdJsonArr, String.class);
List<String> excludeProcessIdList = JSONArray.parseArray(excludeProcessIdArr, String.class);
if (excludeProcessIdList != null && excludeProcessIdList.size() > 0) {
processIdList = processIdList.stream().filter(id -> !excludeProcessIdList.contains(id)).collect(Collectors.toList());
}
// 节点预处理
VertexPreHandle vertexPreHandle = new VertexPreHandle();
Map<String, Integer> nodeIndexMap = new HashMap<>();
List<Node> nodeList = vertexPreHandle.excludeLearAndRearNode(processIdList, nodeIndexMap);
// 构建有向图邻接矩阵
GraphAdjMatrix graphAdjMatrix = new GraphAdjMatrix(nodeList);
graphAdjMatrix.buildAdjMatrix();
// graphAdjMatrix.printAdjMatrix();
// 获取节点分布
GraphLayout graphLayout = new GraphLayout(graphAdjMatrix.getAdjMatrix(), nodeList);
double[][] position = "horizontal".equals(direction) ? graphLayout.horizLayOut() : graphLayout.vertLayOut();
// 组装连线
GraphLinkerRender linkerRender = new GraphLinkerRender(nodeList, position, graphAdjMatrix);
JSONArray linkers = linkerRender.toAssembleLinker(direction);
// 新建模型
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(locationId);
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
int orderIndex = coeProcessLevel.getChildrenMaxOrderIndexByPidAndWsId(parentModel.getId(), parentModel.getWsId()) + 1;
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, parentModel.getWsId(), modelName, "", orderIndex, parentModel.getVersionId(),
SubProcessConst.SUB_PROCESS_CATEGORY, true, 1, id, false, SubProcessConst.SUB_PROCESS_METHOD_ID, "0", parentModel.getLevel() + 1, null, null,
uc.getUID(), uc.getUID(), nowTime, null, null, null, null, null, null, null, null, null,0);
CoeProcessLevelDaoFacotory.createCoeProcessLevel().insert(model);
GraphRender graphRender = new GraphRender(model, nodeList, graphLayout.getCanvasWidth(), graphLayout.getCanvasHeight());
// 节点渲染
graphRender.handleShapeNodeRender(position);
// 连线渲染
graphRender.handShapeLinkerRender(linkers);
// 流程属性中加入布局方向
graphRender.addDirectionToProcessProperties(direction);
graphRender.addLeadAndRearInfoToElements();
graphModelId = model.getId();
}
public void activityLevelGraphGenerator(){
processLevelGraphGenerator();
BaseModel baseModel = CoeDesignerAPIManager.getInstance().getDefinition(graphModelId, 0);
String define = baseModel.getDefinition();
JSONObject defineObj = JSONObject.parseObject(define);
JSONObject elements = defineObj.getJSONObject("elements");
Set<String> shapeKey = elements.keySet().stream().filter(key -> "subProcess".equals(elements.getJSONObject(key).getString("name"))).collect(Collectors.toSet());
Set<String> filterKey = new HashSet<>();
for (String key : shapeKey) {
try {
SubProcessNodeDefineUtil.readSubProcessNodeDefine(graphModelId, key);
filterKey.add(key);
} catch (AWSException e) {
continue;
}
}
for (String key : filterKey) {
GraphNodeExpandHandle expandHandle = new GraphNodeExpandHandle(graphModelId, key, define);
define = expandHandle.handleNodeExpand();
}
baseModel.setDefinition(define);
CoeDesignerAPIManager.getInstance().storeDefinition(baseModel);
}
}

View File

@ -255,59 +255,15 @@ public class SubProcessWeb extends ActionWeb {
* @param excludeProcessIdArr 过滤的子流程
* @throws AWSException
*/
public void generatorEndToEndModel(String processIdJsonArr, String locationId, String direction, String modelName, String excludeProcessIdArr) throws AWSException{
public void generatorEndToEndModel(String processIdJsonArr, String locationId, String direction, String level, String modelName, String excludeProcessIdArr) throws AWSException{
// 忽略独立的节点
List<String> processIdList = JSONArray.parseArray(processIdJsonArr, String.class);
List<String> excludeProcessIdList = JSONArray.parseArray(excludeProcessIdArr, String.class);
if (excludeProcessIdList != null && excludeProcessIdList.size() > 0) {
processIdList = processIdList.stream().filter(id -> !excludeProcessIdList.contains(id)).collect(Collectors.toList());
GraphGeneratorHandle generatorHandle = new GraphGeneratorHandle(processIdJsonArr, excludeProcessIdArr, direction, locationId, modelName, uc);
if ("process".equals(level)){
generatorHandle.processLevelGraphGenerator();
}else {
generatorHandle.activityLevelGraphGenerator();
}
// 节点预处理
VertexPreHandle vertexPreHandle = new VertexPreHandle();
Map<String, Integer> nodeIndexMap = new HashMap<>();
List<Node> nodeList = vertexPreHandle.excludeLearAndRearNode(processIdList, nodeIndexMap);
// 构建有向图邻接矩阵
GraphAdjMatrix graphAdjMatrix = new GraphAdjMatrix(nodeList);
graphAdjMatrix.buildAdjMatrix();
// graphAdjMatrix.printAdjMatrix();
// 获取节点分布
GraphLayout graphLayout = new GraphLayout(graphAdjMatrix.getAdjMatrix(), nodeList);
double[][] position = "horizontal".equals(direction) ? graphLayout.horizLayOut() : graphLayout.vertLayOut();
// 组装连线
GraphLinkerRender linkerRender = new GraphLinkerRender(nodeList, position, graphAdjMatrix);
JSONArray linkers = linkerRender.toAssembleLinker(direction);
// 新建模型
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(locationId);
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
int orderIndex = coeProcessLevel.getChildrenMaxOrderIndexByPidAndWsId(parentModel.getId(), parentModel.getWsId()) + 1;
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, parentModel.getWsId(), modelName, "", orderIndex, parentModel.getVersionId(),
SubProcessConst.SUB_PROCESS_CATEGORY, true, 1, id, false, SubProcessConst.SUB_PROCESS_METHOD_ID, "0", parentModel.getLevel() + 1, null, null,
uc.getUID(), uc.getUID(), nowTime, null, null, null, null, null, null, null, null, null,0);
CoeProcessLevelDaoFacotory.createCoeProcessLevel().insert(model);
GraphRender graphRender = new GraphRender(model, nodeList, graphLayout.getCanvasWidth(), graphLayout.getCanvasHeight());
// 节点渲染
graphRender.handleShapeNodeRender(position);
// 连线渲染
graphRender.handShapeLinkerRender(linkers);
// 流程属性中加入布局方向
graphRender.addDirectionToProcessProperties(direction);
graphRender.addLeadAndRearInfoToElements();
}

View File

@ -24,6 +24,7 @@
<param name="processIdJsonArr"/>
<param name="locationId"/>
<param name="direction"/>
<param name="level"/>
<param name="modelName"/>
<param name="excludeProcessIdArr"/>
</cmd-bean>

View File

@ -6117,83 +6117,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
}
// 维护节点连线信息
List<JSONObject> personLinkers = elements.keySet()
.stream()
.filter(key -> "linker".equals(elements.getJSONObject(key).getString("name")))
.filter(key -> "person".equals(elements.getJSONObject(key).getString("creator")))
.map(key -> {
JSONObject linker = elements.getJSONObject(key);
JSONObject fromNode = linker.getJSONObject("from");
String fromNodeId = fromNode.getString("id");
String fromElementType = UtilString.isNotEmpty(fromNodeId) ? elements.getJSONObject(fromNodeId).getString("elementType") : "";
JSONObject toNode = linker.getJSONObject("to");
String toNodeId = toNode.getString("id");
String toElementType = UtilString.isNotEmpty(toNodeId) ? elements.getJSONObject(toNodeId).getString("elementType") : "";
JSONObject personLinker = new JSONObject();
personLinker.put("linkerId", linker.getString("id"));
personLinker.put("fromId", fromNodeId);
personLinker.put("fromProps", UtilString.isNotEmpty(fromNodeId) ? JSONObject.parse(elements.getJSONObject(fromNodeId).getJSONObject("props").toString()) : "");
personLinker.put("fromElementType", fromElementType);
personLinker.put("toId", toNodeId);
personLinker.put("toProps", UtilString.isNotEmpty(toNodeId) ? JSONObject.parse(elements.getJSONObject(toNodeId).getJSONObject("props").toString()) : "");
personLinker.put("toElementType", toElementType);
personLinker.put("creator", linker.getString("creator"));
personLinker.put("linker", JSONObject.parse(linker.toString()));
personLinker.put("linkerElementType", linker.getString("elementType"));
return personLinker;
})
.filter(personLinker -> {
boolean flag = true;
String fromId = personLinker.getString("fromId");
String toId = personLinker.getString("toId");
JSONObject fromNode = elements.getJSONObject(fromId);
JSONObject toNode = elements.getJSONObject(toId);
if ("INNER_NODE".equals(personLinker.getString("fromElementType")) && "INNER_NODE".equals(personLinker.getString("toElementType"))){
if (fromNode.getString("scopeShapeId").equals(toNode.getString("scopeShapeId"))){ // 说明同属于 同一个范围框 的内部连线 过滤掉
flag = false;
}
}
return flag;
})
.collect(Collectors.toList());
JSONObject nodeLinkerRecord = new JSONObject();
if (definition.containsKey("nodeLinkerRecord")){
nodeLinkerRecord = definition.getJSONObject("nodeLinkerRecord");
}
if (personLinkers.size() > 0){
List<String> toDeleteKeys = new ArrayList<>();
for (String key : nodeLinkerRecord.keySet()) {
JSONObject linkerRecord = nodeLinkerRecord.getJSONObject(key);
List<JSONObject> tempLinkers = personLinkers.stream()
.filter(personLinker -> linkerRecord.getString("fromElementType").equals(personLinker.getString("fromElementType"))
&& linkerRecord.getString("fromId").equals(personLinker.getString("fromId"))
&& linkerRecord.getString("linkerElementType").equals(personLinker.getString("linkerElementType"))
&& linkerRecord.getString("toElementType").equals(personLinker.getString("toElementType"))
&& linkerRecord.getString("toId").equals(personLinker.getString("toId")))
.collect(Collectors.toList());
if (tempLinkers.size() > 0){
toDeleteKeys.add(key);
}
}
if (toDeleteKeys.size() > 0){
for (String toDeleteKey : toDeleteKeys) {
nodeLinkerRecord.remove(toDeleteKey);
}
}
for (JSONObject personLinker : personLinkers) {
String linkerId = personLinker.getString("linkerId");
nodeLinkerRecord.put(linkerId, personLinker);
}
}
definition.put("nodeLinkerRecord", nodeLinkerRecord);
}else if (repositoryModel.getMethodId().equals("process.epc") || repositoryModel.getMethodId().equals("process.flowchart")){
// 判断当前模型是否被某一个总图引用
DesignerShapeRelationDao shapeRelationDao = new DesignerShapeRelationDao();

View File

@ -13,4 +13,4 @@
var mainType = "<#mainType>";
var uid = "<#uid>";
var wHref = "./w";
var jdHref = "./jd";</script><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-06cb15ec.785953e9.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-08487bf0.283a9f57.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-1abee27b.c5c7126f.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-2933a75e.38619268.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-4cc17289.6298c290.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-591a3298.d3570084.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-6fb6e04f.adde4cab.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-9c63e2da.ef0a5aa8.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-cd54d348.e55cad48.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-06cb15ec.f55a8df3.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-08487bf0.e4c990c1.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-1abee27b.363afc6a.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2933a75e.506b1a8f.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d0ab156.869862df.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d0f078a.5bbabbc4.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d212b99.89ae9070.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d216d3a.8dd1b225.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d224b23.82ff272a.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d224ef1.94519e00.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-3178e2bf.9637346c.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-3a9b7577.aa0dfa28.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-4cc17289.51100115.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-591a3298.b7e78e78.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-6fb6e04f.d8dee91f.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-9c63e2da.ed551f3a.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-cd54d348.72327634.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/app.20eb2063.css rel=preload as=style><link href=../apps/com.actionsoft.apps.coe.pal/main/js/app.87cbf318.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-vendors.cecfe522.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal/main/css/app.20eb2063.css rel=stylesheet></head><body style=margin:0;><div id=app></div><script src=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-vendors.cecfe522.js></script><script src=../apps/com.actionsoft.apps.coe.pal/main/js/app.87cbf318.js></script></body></html>
var jdHref = "./jd";</script><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-08487bf0.283a9f57.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-1abee27b.c5c7126f.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-2933a75e.38619268.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-480b7580.53f41558.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-4cc17289.6298c290.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-591a3298.d3570084.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-6fb6e04f.adde4cab.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-9c63e2da.ef0a5aa8.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/chunk-cd54d348.e55cad48.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-08487bf0.f2d21617.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-1abee27b.b80e6063.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2933a75e.1e77fa38.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d0ab156.fa4db24d.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d0f078a.99efbc15.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d212b99.89ae9070.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d216d3a.74924585.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d224b23.0c24bb7f.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-2d224ef1.fd7162ac.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-3178e2bf.ca905c87.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-3a9b7577.aa0dfa28.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-480b7580.e2852da7.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-4cc17289.7698c7f2.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-591a3298.8f5c1020.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-6fb6e04f.297d7f10.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-9c63e2da.26936c6a.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-cd54d348.1f56b602.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal/main/css/app.20eb2063.css rel=preload as=style><link href=../apps/com.actionsoft.apps.coe.pal/main/js/app.11731e9b.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-vendors.cecfe522.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal/main/css/app.20eb2063.css rel=stylesheet></head><body style=margin:0;><div id=app></div><script src=../apps/com.actionsoft.apps.coe.pal/main/js/chunk-vendors.cecfe522.js></script><script src=../apps/com.actionsoft.apps.coe.pal/main/js/app.11731e9b.js></script></body></html>

View File

@ -1180,13 +1180,6 @@
<div class="ico linkertype_normal"></div>创建连线
<div class="extend">L</div>
</li>
<li class="devider devi_selectall"></li>
<li ac="oneClickExpand">一键展开
<div class="extend"></div>
</li>
<li ac="oneClickClose">一键闭合
<div class="extend"></div>
</li>
<li class="devider devi_custom"></li>
<li ac="customdefine">自定义模板
<div class="extend"></div>

View File

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 3589612 */
src: url('iconfont.woff2?t=1684980356184') format('woff2'),
url('iconfont.woff?t=1684980356184') format('woff'),
url('iconfont.ttf?t=1684980356184') format('truetype');
src: url('iconfont.woff2?t=1690614368540') format('woff2'),
url('iconfont.woff?t=1690614368540') format('woff'),
url('iconfont.ttf?t=1690614368540') format('truetype');
}
.iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-lianjietiaozhuan:before {
content: "\e73e";
}
.icon-zhankaishousuo:before {
content: "\e6cb";
}

View File

@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "14663206",
"name": "链接跳转",
"font_class": "lianjietiaozhuan",
"unicode": "e73e",
"unicode_decimal": 59198
},
{
"icon_id": "1057312",
"name": "展开收缩",

View File

@ -14,9 +14,7 @@ Designer.contextMenu.show = function(x, y) {
menu.children("li[ac=drawline]").show();
menu.children("li[ac=processAttribute]").show();
var clipLen = Designer.clipboard.elements.length;
if (methodId == 'process.subprocess') { // 当前建模为端到端
window.subProcess.oneClickExpandAndCloseIconShow();
}
if (currentFocus == null) {
// 画布
if (clipLen > 0) {
@ -182,10 +180,6 @@ Designer.contextMenu.execAction = function(item) {
showLeadAndRearProcessDlg('lead');
} else if (action == 'addRearProcess') {// 关联至后置流程
showLeadAndRearProcessDlg('rear');
}else if (action == 'oneClickExpand'){ // 子流程节点一键展开
window.subProcess.oneClickOperate('expand');
}else if (action == 'oneClickClose'){ // 子流程节点一键闭合
window.subProcess.oneClickOperate('close');
}
};

View File

@ -1422,19 +1422,26 @@ var Designer = {
let currentEleIsScope = false; // 当前元素是否为范围框
let eleInRange = []; // 存储当前范围框内部元素
let currentScopeRange = {};
let eleInRangeXArr = []; // 存放范围内元素x排完序的所有结果 升序
let eleInRangeYArr = []; // 存放范围内元素y排完序的所有结果 升序
if (methodId == 'process.subprocess'){ // 当前建模类型为端到端
let index = W.findIndex(ele => ele.elementType == "SCOPE_NODE");
if (index != -1){
if (index != -1){ // 当前调整大小的图形为范围框
currentEleIsScope = true;
let scopeShape = W[index];
currentScopeRange = { // 获取范围框初始范围大小
x: scopeShape.minRange.x1,
y: scopeShape.minRange.y1,
w: scopeShape.minRange.x2 - scopeShape.minRange.x1,
h: scopeShape.minRange.y2 - scopeShape.minRange.y1
};
eleInRange = Utils.getShapesByRange(currentScopeRange);
eleInRange = Utils.getShapesByRange(scopeShape.props);
eleInRange = eleInRange.filter(id => id != scopeShape.id); // 过滤掉范围框本身
// 计算范围框 最小范围
eleInRangeXArr = eleInRange.map(shapeId => Model.getShapeById(shapeId)).sort((s1, s2) => s1.props.x - s2.props.x);
eleInRangeYArr = eleInRange.map(shapeId => Model.getShapeById(shapeId)).sort((s1, s2) => s1.props.y - s2.props.y);
currentScopeRange = {
x: eleInRangeXArr[0].props.x - 50,
y: eleInRangeYArr[0].props.y - 50,
w: eleInRangeXArr[eleInRangeXArr.length - 1].props.x + eleInRangeXArr[eleInRangeXArr.length - 1].props.w + 50 - (eleInRangeXArr[0].props.x - 50),
h: eleInRangeYArr[eleInRangeYArr.length - 1].props.y + eleInRangeYArr[eleInRangeYArr.length - 1].props.h + 50 - (eleInRangeYArr[0].props.y - 50)
};
}
}
// 端到端功能 end
@ -1446,7 +1453,7 @@ var Designer = {
// 端到端功能 start
if (methodId == 'process.subprocess' && currentScopeRange){ // 如果是端到端建模方法 并且选中的是范围框
if ((currentScopeRange.x < t.x && t.x < currentScopeRange.x + currentScopeRange.w) || (currentScopeRange.y < t.y && t.y < currentScopeRange.y + currentScopeRange.h)){
$.simpleAlert("当前范围标识框已是最小范围!");
$.simpleAlert("水平或垂直方向上范围已经达到最小,请尝试从垂直或者水平方向上进行范围变更");
return;
}
}

View File

@ -37,21 +37,17 @@ class SubProcess {
});
}
// 图形图标渲染 并绑定节点展开或者关闭事件
// 子流程节点以及范围框 渲染关联文件跳转链接
shapeIconRender(){
let elements = this.Model.define.elements;
for (let shapeId in elements) {
let shape = elements[shapeId];
if (shape.name == 'linker') continue; // 当前元素为连线的话 直接略过
if (shape.name == 'scopeLimitation' || shape.name == 'subProcess'){ // 只有子流程或者范围选择框才有对应的图标渲染
if (shape.name == 'subProcess') { // 当前元素为子流程节点 渲染展开图标 并绑定展开事件
let expandIcon = "<span id='icon_"+shapeId+"' class='iconfont icon-zhankaishousuo' style='position: absolute;cursor: pointer;'></span>";
if (shape.name == 'subProcess' || shape.name == 'scopeLimitation') {
let expandIcon = "<span id='icon_"+shapeId+"' class='iconfont icon-lianjietiaozhuan' style='position: absolute;cursor: pointer;'></span>";
$('#'+shapeId).append(expandIcon);
$('#icon_'+shapeId).on('click', '', {shapeId: shapeId, Model: this.Model, repositoryId: this.repositoryId, sid: this.sid}, this.shapeExpand);
}else { // 当前元素为虚线范围限制框的话 渲染关闭图标 并绑定关闭事件
let closeIcon = "<span id='icon_"+shapeId+"' class='iconfont icon-quanpingshouqi' style='position: absolute;cursor: pointer;'></span>";
$('#'+shapeId).append(closeIcon);
$('#icon_'+shapeId).on('click', '', {shapeId: shapeId, Model: this.Model, repositoryId: this.repositoryId, sid: this.sid}, this.shapeClose);
$('#icon_'+shapeId).on('click', '', {uuid: shape.extendAttr.id, sid: this.sid}, this.subProcessNodeLink);
}
}
}
@ -479,5 +475,12 @@ class SubProcess {
}
}
}
subProcessNodeLink(event) {
let param = event.data;
let url="./w?uuid=" + param.uuid +"&teamId=" + teamId
+ "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer&sid=" + encodeURIComponent($('#sid').val());
window.open(url);
}
}

File diff suppressed because one or more lines are too long