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 75f32ca8..72c830fe 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/method/process.subprocess/diagram.schema.tpl b/com.actionsoft.apps.coe.method.process.subprocess/method/process.subprocess/diagram.schema.tpl index 67a1fa03..7c15a6fa 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/method/process.subprocess/diagram.schema.tpl +++ b/com.actionsoft.apps.coe.method.process.subprocess/method/process.subprocess/diagram.schema.tpl @@ -546,7 +546,7 @@ path:[ {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"}, path:[ {lineStyle:{lineWidth:1, lineStyle:"dashed",lineColor:"184,184,184"}, actions:{ref:"roundRectangle"}}, 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 107ceb96..ca4a35d2 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 @@ -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 @@ -143,4 +129,10 @@ public class SubProcessController { 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(); + } + } 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 new file mode 100644 index 00000000..be455b1c --- /dev/null +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphNodeExpandHandle.java @@ -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 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; + } +} 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 d8bb5c4a..d98d09ae 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 @@ -243,6 +243,15 @@ public class SubProcessWeb extends ActionWeb { 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{ // 忽略独立的节点 @@ -285,12 +294,58 @@ public class SubProcessWeb extends ActionWeb { CoeProcessLevelDaoFacotory.createCoeProcessLevel().insert(model); GraphRender graphRender = new GraphRender(model, nodeList, graphLayout.getCanvasWidth(), graphLayout.getCanvasHeight()); - // 连线渲染 - graphRender.handShapeLinkerRender(linkers); + // 节点渲染 graphRender.handleShapeNodeRender(position); + // 连线渲染 + graphRender.handShapeLinkerRender(linkers); + + } + public void shapeNodeExpand(String repositoryId, String shapeId){ + + /* + * 以当前节点展开涉及到动作拆分: + * + * 0、判断当前节点是否展开过了,初次展开的话去源文件中找,否则去备份的文件中找 + * + * 1、准备范围限制框元素,该元素坐标与当前被展开的节点坐标一致,宽度与高度与子流程标识的模型画布-边距的宽度、高度一致 + * 同时,子流程标识的模型内的所有元素 以当前被展开的节点坐标为准,下移、右移 被展开节点坐标距离原点的距离 + * + * 2、找到x大于等于、y大于等于当前被展开节点的所有子流程节点,将这些节点下移、右移到范围框之外 + * + * 3、根据与当前节点的连线,找到总图中所有与当前被展开节点的相连的前置节点与后置节点 + * + * 4、将子流程模型备份一份,为后续对展开后的节点做删除等操作 + * + * */ + + // 获取子流程标识的文件存储信息 + List 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"); } diff --git a/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml b/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml index 5afc1f7f..fd2d64bd 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml +++ b/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml @@ -27,4 +27,8 @@ + + + + \ No newline at end of file diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.css b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.css new file mode 100644 index 00000000..e899c001 --- /dev/null +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.css @@ -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"; +} + diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.js new file mode 100644 index 00000000..e3fe5b58 --- /dev/null +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.js @@ -0,0 +1 @@ +window._iconfont_svg_string_3589612='',function(l){var t=(t=document.getElementsByTagName("script"))[t.length-1],e=t.getAttribute("data-injectcss"),t=t.getAttribute("data-disable-injectsvg");if(!t){var a,i,n,o,c,h=function(t,e){e.parentNode.insertBefore(t,e)};if(e&&!l.__iconfont__svg__cssinject__){l.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(t){console&&console.log(t)}}a=function(){var t,e=document.createElement("div");e.innerHTML=l._iconfont_svg_string_3589612,(e=e.getElementsByTagName("svg")[0])&&(e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.width=0,e.style.height=0,e.style.overflow="hidden",e=e,(t=document.body).firstChild?h(e,t.firstChild):t.appendChild(e))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(a,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),a()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(n=a,o=l.document,c=!1,s(),o.onreadystatechange=function(){"complete"==o.readyState&&(o.onreadystatechange=null,d())})}function d(){c||(c=!0,n())}function s(){try{o.documentElement.doScroll("left")}catch(t){return void setTimeout(s,50)}d()}}(window); \ No newline at end of file diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.json b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.json new file mode 100644 index 00000000..5969f973 --- /dev/null +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.json @@ -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 + } + ] +} diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.ttf b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.ttf new file mode 100644 index 00000000..bb97297b Binary files /dev/null and b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.ttf differ diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.woff b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.woff new file mode 100644 index 00000000..bcb0f4c4 Binary files /dev/null and b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.woff differ diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.woff2 b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.woff2 new file mode 100644 index 00000000..bafda043 Binary files /dev/null and b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/css/subprocess/iconfont.woff2 differ 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 new file mode 100644 index 00000000..fc7fc945 --- /dev/null +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.method.subprocess.js @@ -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 = ""; + $('#'+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); + } + } + } + + // 节点展开事件 + 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') + } +} +