端到端功能 节点展开后 范围标识框交互部分代码提交

This commit is contained in:
qinoy 2023-06-02 15:18:44 +08:00
parent 8a6f6544fb
commit 0c3a58ce1b
3 changed files with 47 additions and 7 deletions

View File

@ -537,13 +537,20 @@ Schema.addShape({name:"method_service_node4", title:"人工任务", text:"人工
]}); ]});
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:100, h:70},
fillStyle:{color:"153,255,255"}, 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:[ path:[
{lineStyle:{lineWidth:"lineWidth", lineStyle:"solid"}, actions:{ref:"roundRectangle"}}, {actions:[
{lineStyle:{lineWidth:1,lineStyle:"solid"},actions:[{action:"move",x:"w*0.5-9",y:"h-22"},{action:"line",x:"w*0.5+9",y:"h-22"},{action:"line",x:"w*0.5+9",y:"h-4"},{action:"line",x:"w*0.5-9",y:"h-4"},{action:"close"}]}, {action:"move", x:"0", y:"0"},
{lineStyle:{lineWidth:1,lineStyle:"solid"},actions:[{action:"move",x:"w*0.5-7",y:"h-13"},{action:"line",x:"w*0.5+7",y:"h-13"}]}, {action:"line", x:"w", y:"0"},
{lineStyle:{lineWidth:1,lineStyle:"solid"},actions:[{action:"move",x:"w*0.5",y:"h-20"},{action:"line",x:"w*0.5",y:"h-6"}]}, {action:"line", x:"w", y:"h"},
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:{ref:"roundRectangle"}} {action:"line", x:"0", y:"h"},
{action:"line", x:"0", y:"0"},
{action:"close"},
{action:"move", x:"Math.min(w/6,20)", y:"0"},
{action:"line", x:"Math.min(w/6,20)", y:"h"},
{action:"move", x:"w- Math.min(w/6,20)", y:"0"},
{action:"line", x:"w- Math.min(w/6,20)", y:"h"}
]}
]}); ]});
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},

View File

@ -455,6 +455,10 @@ var Designer = {
Model.update(M) Model.update(M)
} }
} }
// 如果当前拖拽到画布的图形是子流程 则渲染节点展开图标
if (g.name == 'subProcess') {
window.subProcess.shapeOpenIconRender(g);
}
Utils.unselect(); Utils.unselect();
Utils.selectShape(g.id); Utils.selectShape(g.id);
MessageSource.commit(); MessageSource.commit();

View File

@ -5,7 +5,9 @@ $(function(){
// 1. 子流程展开 事件:获取当前子流程所代表的模型文件 // 1. 子流程展开 事件:获取当前子流程所代表的模型文件
(function (Model, ruuid, sid) { (function (Model, ruuid, sid) {
const subProcess = new SubProcess(Model, ruuid, sid); const subProcess = new SubProcess(Model, ruuid, sid);
subProcess.shapeIconRender();
subProcess.init();
window.subProcess = subProcess; window.subProcess = subProcess;
// 连线框 鼠标指针样式设置 防止因为连线z-index层级较高 会导致节点展开图标点击不到 // 连线框 鼠标指针样式设置 防止因为连线z-index层级较高 会导致节点展开图标点击不到
@ -13,6 +15,7 @@ $(function(){
'pointer-events': 'none' 'pointer-events': 'none'
}); });
})(Model, ruuid, sid); })(Model, ruuid, sid);
}); });
@ -24,6 +27,11 @@ class SubProcess {
this.sid = sid; this.sid = sid;
} }
init(){
this.shapeIconRender();
this.handleScopeShapeEvent();
}
// 图形图标渲染 并绑定节点展开或者关闭事件 // 图形图标渲染 并绑定节点展开或者关闭事件
shapeIconRender(){ shapeIconRender(){
let elements = this.Model.define.elements; let elements = this.Model.define.elements;
@ -44,6 +52,27 @@ class SubProcess {
} }
} }
// 子流程节点拖拽到画布后 渲染展开按钮
shapeOpenIconRender(ele){
if (ele.name != 'subProcess'){
return;
}
let shapeId = ele.id;
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);
}
// 范围选择框的事件绑定处理
handleScopeShapeEvent(){
let d = $("#canvas_container");
let c = $("#designer_canvas");
d.unbind("mousemove.operate").bind("mousemove.operate",function (a) {
let b = Utils.getRelativePos(a.pageX, a.pageY, c);
console.log('应该是当前鼠标指针的位置 ', b);
});
}
// 节点展开事件 // 节点展开事件
shapeExpand(event){ shapeExpand(event){
let param = event.data; let param = event.data;