端到端功能 节点展开相关代码提交
This commit is contained in:
parent
75bc7cb791
commit
f087279d5e
Binary file not shown.
@ -546,7 +546,7 @@ path:[
|
|||||||
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:{ref:"roundRectangle"}}
|
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:{ref:"roundRectangle"}}
|
||||||
]});
|
]});
|
||||||
|
|
||||||
Schema.addShape({name:"scopeLimitation", title:"", text:"", category:"process_subprocess", groupName:"", props:{w:100, h:70},
|
Schema.addShape({name:"scopeLimitation", title:"展开范围标注", text:"", category:"process_subprocess", groupName:"", props:{w:100, h:70},
|
||||||
fillStyle:{type:"none"},
|
fillStyle:{type:"none"},
|
||||||
path:[
|
path:[
|
||||||
{lineStyle:{lineWidth:1, lineStyle:"dashed",lineColor:"184,184,184"}, actions:{ref:"roundRectangle"}},
|
{lineStyle:{lineWidth:1, lineStyle:"dashed",lineColor:"184,184,184"}, actions:{ref:"roundRectangle"}},
|
||||||
|
|||||||
@ -113,20 +113,6 @@ public class SubProcessController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成图->前置处理
|
|
||||||
* 前置流程或后置流程是否在所选的范围内
|
|
||||||
* @param uc
|
|
||||||
* @param processIdJsonArr
|
|
||||||
* @param excludeProcessIdJsonArr
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Mapping("com.actionsoft.apps.coe.method.process.subprocess.lead_rear_node_pre_handle")
|
|
||||||
public String vertexPreHandle2(UserContext uc, String processIdJsonArr, String excludeProcessIdJsonArr){
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能->生成图
|
* 功能->生成图
|
||||||
* @param uc
|
* @param uc
|
||||||
@ -143,4 +129,10 @@ public class SubProcessController {
|
|||||||
return ResponseObject.newOkResponse().toString();
|
return ResponseObject.newOkResponse().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mapping("com.actionsoft.apps.coe.method.process.subprocess.shape_expand")
|
||||||
|
public String shapeExpand(UserContext uc, String repositoryId, String shapeId){
|
||||||
|
|
||||||
|
return ResponseObject.newOkResponse("展开成功").toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,59 @@
|
|||||||
|
package com.actionsoft.apps.coe.method.process.subprocess.graph;
|
||||||
|
|
||||||
|
import com.actionsoft.apps.coe.method.process.subprocess.constant.SubProcessConst;
|
||||||
|
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.designer.relation.cache.DesignerShapeRelationCache;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil;
|
||||||
|
import com.actionsoft.bpms.util.UtilString;
|
||||||
|
import com.actionsoft.exception.AWSException;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图节点展开处理
|
||||||
|
*/
|
||||||
|
public class GraphNodeExpandHandle {
|
||||||
|
|
||||||
|
private String repositoryId;
|
||||||
|
private String shapeId;
|
||||||
|
private CoeDesignerAPIManager apiManager;
|
||||||
|
private String childProcessDefine;
|
||||||
|
|
||||||
|
public GraphNodeExpandHandle(String repositoryId, String shapeId) {
|
||||||
|
this.repositoryId = repositoryId;
|
||||||
|
this.shapeId = shapeId;
|
||||||
|
|
||||||
|
apiManager = CoeDesignerAPIManager.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readChildProcessDefine() throws AWSException{
|
||||||
|
List<DesignerShapeRelationModel> childProcessModelList = DesignerShapeRelationCache.getListByAttrId(repositoryId, shapeId, SubProcessConst.CHILD_PROCESS);
|
||||||
|
DesignerShapeRelationModel relationModel = childProcessModelList.stream().findFirst().orElse(null);
|
||||||
|
if (relationModel == null)
|
||||||
|
throw new AWSException("未找到当前节点所标识的子流程文件信息");
|
||||||
|
String relationFileId = relationModel.getRelationFileId();
|
||||||
|
childProcessDefine = apiManager.getChildProcessDefine(repositoryId, 0, relationFileId);
|
||||||
|
if (UtilString.isEmpty(childProcessDefine)){ // 初次展开 去源文件目录读取
|
||||||
|
BaseModel childProcessBaseModel = apiManager.getDefinition(relationFileId, 0);
|
||||||
|
childProcessDefine = childProcessBaseModel.getDefinition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组装范围限制框
|
||||||
|
* @return 范围限制框
|
||||||
|
*/
|
||||||
|
public JSONObject toAssembleScopeLimitationShape(){
|
||||||
|
JSONObject scopeLimitationShape = ShapeUtil.getProcessShapeDefinition(SubProcessConst.SUB_PROCESS_METHOD_ID, "展开范围标注");
|
||||||
|
JSONObject childProcessDefineObj = JSONObject.parseObject(childProcessDefine);
|
||||||
|
JSONObject childProcessPage = childProcessDefineObj.getJSONObject("page");
|
||||||
|
// 当前节点所标识的子流程文件的 画布宽度与高度 减去边距
|
||||||
|
double childProcessPageWidth = childProcessPage.getDoubleValue("width") - childProcessPage.getDoubleValue("padding") * 2;
|
||||||
|
double childProcessPageHeight = childProcessPage.getDoubleValue("height") - childProcessPage.getDoubleValue("padding") * 2;
|
||||||
|
|
||||||
|
return scopeLimitationShape;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -243,6 +243,15 @@ public class SubProcessWeb extends ActionWeb {
|
|||||||
return (JSONObject) JSON.toJSON(vertexPreHandle.collectIndependentNode(processIdList));
|
return (JSONObject) JSON.toJSON(vertexPreHandle.collectIndependentNode(processIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成图
|
||||||
|
* @param processIdJsonArr 选择的子流程
|
||||||
|
* @param locationId 位置
|
||||||
|
* @param direction 排布方向
|
||||||
|
* @param modelName 总图名称
|
||||||
|
* @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 modelName, String excludeProcessIdArr) throws AWSException{
|
||||||
|
|
||||||
// 忽略独立的节点
|
// 忽略独立的节点
|
||||||
@ -285,12 +294,58 @@ public class SubProcessWeb extends ActionWeb {
|
|||||||
CoeProcessLevelDaoFacotory.createCoeProcessLevel().insert(model);
|
CoeProcessLevelDaoFacotory.createCoeProcessLevel().insert(model);
|
||||||
|
|
||||||
GraphRender graphRender = new GraphRender(model, nodeList, graphLayout.getCanvasWidth(), graphLayout.getCanvasHeight());
|
GraphRender graphRender = new GraphRender(model, nodeList, graphLayout.getCanvasWidth(), graphLayout.getCanvasHeight());
|
||||||
// 连线渲染
|
|
||||||
graphRender.handShapeLinkerRender(linkers);
|
|
||||||
// 节点渲染
|
// 节点渲染
|
||||||
graphRender.handleShapeNodeRender(position);
|
graphRender.handleShapeNodeRender(position);
|
||||||
|
// 连线渲染
|
||||||
|
graphRender.handShapeLinkerRender(linkers);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void shapeNodeExpand(String repositoryId, String shapeId){
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 以当前节点展开涉及到动作拆分:
|
||||||
|
*
|
||||||
|
* 0、判断当前节点是否展开过了,初次展开的话去源文件中找,否则去备份的文件中找
|
||||||
|
*
|
||||||
|
* 1、准备范围限制框元素,该元素坐标与当前被展开的节点坐标一致,宽度与高度与子流程标识的模型画布-边距的宽度、高度一致
|
||||||
|
* 同时,子流程标识的模型内的所有元素 以当前被展开的节点坐标为准,下移、右移 被展开节点坐标距离原点的距离
|
||||||
|
*
|
||||||
|
* 2、找到x大于等于、y大于等于当前被展开节点的所有子流程节点,将这些节点下移、右移到范围框之外
|
||||||
|
*
|
||||||
|
* 3、根据与当前节点的连线,找到总图中所有与当前被展开节点的相连的前置节点与后置节点
|
||||||
|
*
|
||||||
|
* 4、将子流程模型备份一份,为后续对展开后的节点做删除等操作
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
// 获取子流程标识的文件存储信息
|
||||||
|
List<DesignerShapeRelationModel> childProcessModelList = DesignerShapeRelationCache.getListByAttrId(repositoryId, shapeId, SubProcessConst.CHILD_PROCESS);
|
||||||
|
DesignerShapeRelationModel relationModel = childProcessModelList.stream().findFirst().orElse(null);
|
||||||
|
if (relationModel == null)
|
||||||
|
throw new AWSException("未找到当前节点所标识的子流程文件信息");
|
||||||
|
String relationFileId = relationModel.getRelationFileId();
|
||||||
|
CoeDesignerAPIManager apiManager = CoeDesignerAPIManager.getInstance();
|
||||||
|
BaseModel childProcessBaseModel = apiManager.getDefinition(relationFileId, 0);
|
||||||
|
String childProcessDefinition = childProcessBaseModel.getDefinition();
|
||||||
|
JSONObject childProcessDefineObj = JSONObject.parseObject(childProcessDefinition);
|
||||||
|
JSONObject childProcessPage = childProcessDefineObj.getJSONObject("page");
|
||||||
|
// 当前节点所标识的子流程文件的 画布宽度与高度 减去边距
|
||||||
|
double childProcessPageWidth = childProcessPage.getDoubleValue("width") - childProcessPage.getDoubleValue("padding") * 2;
|
||||||
|
double childProcessPageHeight = childProcessPage.getDoubleValue("height") - childProcessPage.getDoubleValue("padding") * 2;
|
||||||
|
|
||||||
|
// 获取总图的存储数据
|
||||||
|
BaseModel baseModel = CoeDesignerAPIManager.getInstance().getDefinition(repositoryId, 0);
|
||||||
|
String definition = baseModel.getDefinition();
|
||||||
|
JSONObject defineJsonObj = JSONObject.parseObject(definition);
|
||||||
|
JSONObject elements = defineJsonObj.getJSONObject("elements");
|
||||||
|
JSONObject shapeObj = elements.getJSONObject(shapeId);
|
||||||
|
JSONObject shapeProps = shapeObj.getJSONObject("props");
|
||||||
|
// 当前节点的坐标
|
||||||
|
double x = shapeProps.getDoubleValue("x");
|
||||||
|
double y = shapeProps.getDoubleValue("y");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,4 +27,8 @@
|
|||||||
<param name="modelName"/>
|
<param name="modelName"/>
|
||||||
<param name="excludeProcessIdArr"/>
|
<param name="excludeProcessIdArr"/>
|
||||||
</cmd-bean>
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.method.process.subprocess.shape_expand">
|
||||||
|
<param name="repositoryId"/>
|
||||||
|
<param name="shapeId"/>
|
||||||
|
</cmd-bean>
|
||||||
</aws-actions>
|
</aws-actions>
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
@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');
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconfont {
|
||||||
|
font-family: "iconfont" !important;
|
||||||
|
font-size: 16px;
|
||||||
|
font-style: normal;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-zhankaishousuo:before {
|
||||||
|
content: "\e6cb";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-ICON-:before {
|
||||||
|
content: "\e664";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-icon_list_shouqi:before {
|
||||||
|
content: "\e61c";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-quanpingshouqi:before {
|
||||||
|
content: "\e66f";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-shuzhuangtu_o:before {
|
||||||
|
content: "\ebb3";
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"id": "3589612",
|
||||||
|
"name": "炎黄",
|
||||||
|
"font_family": "iconfont",
|
||||||
|
"css_prefix_text": "icon-",
|
||||||
|
"description": "",
|
||||||
|
"glyphs": [
|
||||||
|
{
|
||||||
|
"icon_id": "1057312",
|
||||||
|
"name": "展开收缩",
|
||||||
|
"font_class": "zhankaishousuo",
|
||||||
|
"unicode": "e6cb",
|
||||||
|
"unicode_decimal": 59083
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "1760316",
|
||||||
|
"name": "收起",
|
||||||
|
"font_class": "ICON-",
|
||||||
|
"unicode": "e664",
|
||||||
|
"unicode_decimal": 58980
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "14197982",
|
||||||
|
"name": "收起",
|
||||||
|
"font_class": "icon_list_shouqi",
|
||||||
|
"unicode": "e61c",
|
||||||
|
"unicode_decimal": 58908
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "29519761",
|
||||||
|
"name": "全屏收起",
|
||||||
|
"font_class": "quanpingshouqi",
|
||||||
|
"unicode": "e66f",
|
||||||
|
"unicode_decimal": 58991
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "5388006",
|
||||||
|
"name": "树状图_o",
|
||||||
|
"font_class": "shuzhuangtu_o",
|
||||||
|
"unicode": "ebb3",
|
||||||
|
"unicode_decimal": 60339
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,79 @@
|
|||||||
|
$(function(){
|
||||||
|
// 1. 子流程展开 事件:获取当前子流程所代表的模型文件
|
||||||
|
(function (Model, ruuid, sid) {
|
||||||
|
const subProcess = new SubProcess(Model, ruuid, sid);
|
||||||
|
subProcess.shapeIconRender();
|
||||||
|
|
||||||
|
$('.shape_box.linker_box').css({
|
||||||
|
'pointer-events': 'none'
|
||||||
|
});
|
||||||
|
|
||||||
|
})(Model, ruuid, sid);
|
||||||
|
});
|
||||||
|
|
||||||
|
class SubProcess {
|
||||||
|
// 构造函数
|
||||||
|
constructor(Model, ruuid, sid){
|
||||||
|
this.Model = Model;
|
||||||
|
this.repositoryId = ruuid;
|
||||||
|
this.sid = sid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 图形图标渲染 并绑定节点展开或者关闭事件
|
||||||
|
shapeIconRender(){
|
||||||
|
let elements = this.Model.define.elements;
|
||||||
|
for (let shapeId in elements) {
|
||||||
|
let shape = elements[shapeId];
|
||||||
|
if (shape.name == 'linker') continue; // 当前元素为连线的话 直接略过
|
||||||
|
if (shape.name == 'subProcess') { // 当前元素为子流程节点 渲染展开图标 并绑定展开事件
|
||||||
|
let expandIcon = "<span id='icon_"+shapeId+"' class='iconfont icon-zhankaishousuo' 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 节点展开事件
|
||||||
|
shapeExpand(event){
|
||||||
|
let param = event.data;
|
||||||
|
alert('节点展开事件 ' + param.Model.define.elements[event.data.shapeId].text);
|
||||||
|
// 1、同时只能支持一个子流程节点展开
|
||||||
|
let elements = param.Model.define.elements;
|
||||||
|
for (let key in elements) {
|
||||||
|
let shape = elements[key];
|
||||||
|
if (shape.name == 'linker') continue;
|
||||||
|
if (shape.name == 'scopeLimitation') {
|
||||||
|
$.simpleAlert("同一时间仅支持一个子流程节点展开", "warning");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 2、传递当前模型文件ID、子流程节点ID
|
||||||
|
awsui.ajax.request({
|
||||||
|
url: './jd',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
cmd: 'com.actionsoft.apps.coe.method.process.subprocess.shape_expand',
|
||||||
|
sid: param.sid,
|
||||||
|
repositoryId: param.repositoryId,
|
||||||
|
shapeId: param.shapeId
|
||||||
|
},
|
||||||
|
ok: function(r){
|
||||||
|
console.log(r);
|
||||||
|
},
|
||||||
|
err: function(r){
|
||||||
|
$.simpleAlert(r.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 3、刷新当前画布
|
||||||
|
}
|
||||||
|
|
||||||
|
// 节点关闭事件
|
||||||
|
shapeClose(event){
|
||||||
|
console.log('sss')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user