我一直在开发BPMN编辑器,可以根据上下文菜单修改任务。我使用this来实现它。
因此,每当用户更改任务类型时,都会调用一个类。但是我很难想出来拯救这门课程。因为每当用户更改所选项目时,“当前”项目将会更改,并且将删除之前的类别。我保存了类名但我无法检索。我现在卡住了。谢谢你的帮助。
这是我到目前为止所尝试的:
menu_shape= function(){
$.contextMenu({
selector: '.activity',
trigger: 'left',
callback: function(key, options) {
var m = key;
menu_shape_action(key);
},
items: {
"fold1":{
"name": "Set Task Type",
"items": {
"default":{"name": "Default"},
"business_rule":{"name": "Business Rule"},
"manual":{"name": "Manual"},
"receive":{"name": "Receive"},
"send":{"name": "Send"},
"script":{"name": "Script"},
"service":{"name": "Service"},
"user":{"name": "User"},
}
},
"fold1a": {
"name": "Convert to",
"items": {
"task":{"name": "Task"},
"sub_process": {"name": "Sub-process"},
"global_task": {"name": "Global Task"},
"global_process": {"name": "Global Process"}
}
}
}
});
}
var ctr= null; var task_type=null;
menu_shape_action = function(action){
if( ctr){
task_type.removeClass(ctr);
}
switch(action){
case "default":
$(current).addClass("default");
ctr= "default";
break;
case "business_rule":
task_type = $(current).addClass("business_rule");
ctr= "business_rule";
break;
case "manual":
task_type = $(current).addClass("manual");
ctr= "manual";
break;
case "receive":
task_type = $(current).addClass("receive");
ctr= "receive";
break;
case "send":
task_type = $(current).addClass("send");
ctr= "send";
break;
case "script":
task_type = $(current).addClass("script");
ctr= "script";
break;
case "service":
task_type = $(current).addClass("service");
ctr= "service";
break;
case "user":
task_type = $(current).addClass("user");
ctr= "user";
break;
default:
$(current).addClass("default");
ctr= "default";
break;
}
t_type =task_type.attr("ctr",ctr);
}