保存时检查用户任务节点名称是否填写
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
'connection.added',
|
||||
'connection.removed',
|
||||
'connection.changed',
|
||||
'create.end',
|
||||
]"
|
||||
@element-click="elementClick"
|
||||
@init-finished="initModeler"
|
||||
@ -80,7 +81,18 @@ function initModeler(modelerArgv) {
|
||||
}, 10);
|
||||
}
|
||||
function handlerEvent(eventName) {
|
||||
console.log(eventName);
|
||||
|
||||
if (eventName === "connection-added") {
|
||||
// 设置结束节点的默认名称
|
||||
nextTick(() => {
|
||||
if (window?.bpmnInstances?.bpmnElement.type === "bpmn:EndEvent") {
|
||||
window.bpmnInstances.modeling.updateProperties(
|
||||
window.bpmnInstances.bpmnElement,
|
||||
{ name: "结束" }
|
||||
);
|
||||
}
|
||||
});
|
||||
goToFormSelect();
|
||||
}
|
||||
}
|
||||
|
@ -328,6 +328,7 @@ const emit = defineEmits([
|
||||
"connection-added",
|
||||
"connection-removed",
|
||||
"connection-changed",
|
||||
"create-end",
|
||||
]);
|
||||
const defaultZoom = ref(1);
|
||||
const previewModelVisible = ref(false);
|
||||
@ -422,6 +423,19 @@ onBeforeUnmount(() => {
|
||||
bpmnModeler = null;
|
||||
});
|
||||
function onSave() {
|
||||
if (bpmnModeler) {
|
||||
const elementRegistry = bpmnModeler.get("elementRegistry");
|
||||
const userTaskEle = elementRegistry?.find(
|
||||
(el) => el.type === "bpmn:UserTask"
|
||||
);
|
||||
if (!userTaskEle.businessObject.name) {
|
||||
console.log(userTaskEle.businessObject.name);
|
||||
ElMessage.warning("用户任务节点名称必填");
|
||||
const EventBus = bpmnModeler.get("eventBus");
|
||||
EventBus.fire("element.click", { element: userTaskEle });
|
||||
return;
|
||||
}
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
if (bpmnModeler == null) {
|
||||
reject();
|
||||
|
@ -48,7 +48,20 @@ export default function ContextPadProvider(
|
||||
this._autoPlace = injector.get("autoPlace", false);
|
||||
}
|
||||
|
||||
eventBus.on("create.end", 250, function(event) {
|
||||
eventBus.on("create.end", 250, function (event) {
|
||||
console.log(
|
||||
"create.end,contentPadProvider.js",
|
||||
window.bpmnInstances.bpmnElement
|
||||
);
|
||||
|
||||
// TODO:设置开始节点默认名称
|
||||
const bpmnElement = window.bpmnInstances.bpmnElement;
|
||||
if (bpmnElement.type === "bpmn:StartEvent") {
|
||||
window.bpmnInstances.modeling.updateProperties(bpmnElement, {
|
||||
name: "开始",
|
||||
});
|
||||
}
|
||||
|
||||
var context = event.context,
|
||||
shape = context.shape;
|
||||
|
||||
@ -77,10 +90,10 @@ ContextPadProvider.$inject = [
|
||||
"canvas",
|
||||
"rules",
|
||||
"translate",
|
||||
"elementRegistry"
|
||||
"elementRegistry",
|
||||
];
|
||||
|
||||
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
var contextPad = this._contextPad,
|
||||
modeling = this._modeling,
|
||||
elementFactory = this._elementFactory,
|
||||
@ -122,7 +135,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
|
||||
var pos = {
|
||||
x: left,
|
||||
y: top + padRect.height + Y_OFFSET
|
||||
y: top + padRect.height + Y_OFFSET,
|
||||
};
|
||||
|
||||
return pos;
|
||||
@ -147,13 +160,15 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
function appendStart(event, element) {
|
||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
||||
create.start(event, shape, {
|
||||
source: element
|
||||
source: element,
|
||||
});
|
||||
}
|
||||
|
||||
var append = autoPlace
|
||||
? function(event, element) {
|
||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
||||
? function (event, element) {
|
||||
var shape = elementFactory.createShape(
|
||||
assign({ type: type }, options)
|
||||
);
|
||||
|
||||
autoPlace.append(element, shape);
|
||||
}
|
||||
@ -165,13 +180,13 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
title: title,
|
||||
action: {
|
||||
dragstart: appendStart,
|
||||
click: append
|
||||
}
|
||||
click: append,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function splitLaneHandler(count) {
|
||||
return function(event, element) {
|
||||
return function (event, element) {
|
||||
// actual split
|
||||
modeling.splitLane(element, count);
|
||||
|
||||
@ -181,7 +196,10 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
};
|
||||
}
|
||||
|
||||
if (isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) && isExpanded(businessObject)) {
|
||||
if (
|
||||
isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) &&
|
||||
isExpanded(businessObject)
|
||||
) {
|
||||
var childLanes = getChildLanes(element);
|
||||
|
||||
assign(actions, {
|
||||
@ -190,11 +208,11 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
className: "bpmn-icon-lane-insert-above",
|
||||
title: translate("Add Lane above"),
|
||||
action: {
|
||||
click: function(event, element) {
|
||||
click: function (event, element) {
|
||||
modeling.addLane(element, "top");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (childLanes.length < 2) {
|
||||
@ -205,9 +223,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
className: "bpmn-icon-lane-divide-two",
|
||||
title: translate("Divide into two Lanes"),
|
||||
action: {
|
||||
click: splitLaneHandler(2)
|
||||
}
|
||||
}
|
||||
click: splitLaneHandler(2),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -218,9 +236,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
className: "bpmn-icon-lane-divide-three",
|
||||
title: translate("Divide into three Lanes"),
|
||||
action: {
|
||||
click: splitLaneHandler(3)
|
||||
}
|
||||
}
|
||||
click: splitLaneHandler(3),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -231,18 +249,22 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
className: "bpmn-icon-lane-insert-below",
|
||||
title: translate("Add Lane below"),
|
||||
action: {
|
||||
click: function(event, element) {
|
||||
click: function (event, element) {
|
||||
modeling.addLane(element, "bottom");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (is(businessObject, "bpmn:FlowNode")) {
|
||||
if (is(businessObject, "bpmn:EventBasedGateway")) {
|
||||
assign(actions, {
|
||||
"append.receive-task": appendAction("bpmn:ReceiveTask", "bpmn-icon-receive-task", translate("Append ReceiveTask")),
|
||||
"append.receive-task": appendAction(
|
||||
"bpmn:ReceiveTask",
|
||||
"bpmn-icon-receive-task",
|
||||
translate("Append ReceiveTask")
|
||||
),
|
||||
"append.message-intermediate-event": appendAction(
|
||||
"bpmn:IntermediateCatchEvent",
|
||||
"bpmn-icon-intermediate-event-catch-message",
|
||||
@ -266,29 +288,56 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
"bpmn-icon-intermediate-event-catch-signal",
|
||||
translate("Append SignalIntermediateCatchEvent"),
|
||||
{ eventDefinitionType: "bpmn:SignalEventDefinition" }
|
||||
)
|
||||
),
|
||||
});
|
||||
} else if (isEventType(businessObject, "bpmn:BoundaryEvent", "bpmn:CompensateEventDefinition")) {
|
||||
} else if (
|
||||
isEventType(
|
||||
businessObject,
|
||||
"bpmn:BoundaryEvent",
|
||||
"bpmn:CompensateEventDefinition"
|
||||
)
|
||||
) {
|
||||
assign(actions, {
|
||||
"append.compensation-activity": appendAction("bpmn:Task", "bpmn-icon-task", translate("Append compensation activity"), {
|
||||
isForCompensation: true
|
||||
})
|
||||
"append.compensation-activity": appendAction(
|
||||
"bpmn:Task",
|
||||
"bpmn-icon-task",
|
||||
translate("Append compensation activity"),
|
||||
{
|
||||
isForCompensation: true,
|
||||
}
|
||||
),
|
||||
});
|
||||
} else if (
|
||||
!is(businessObject, "bpmn:EndEvent") &&
|
||||
!businessObject.isForCompensation &&
|
||||
!isEventType(businessObject, "bpmn:IntermediateThrowEvent", "bpmn:LinkEventDefinition") &&
|
||||
!isEventType(
|
||||
businessObject,
|
||||
"bpmn:IntermediateThrowEvent",
|
||||
"bpmn:LinkEventDefinition"
|
||||
) &&
|
||||
!isEventSubProcess(businessObject)
|
||||
) {
|
||||
assign(actions, {
|
||||
"append.end-event": appendAction("bpmn:EndEvent", "bpmn-icon-end-event-none", translate("Append EndEvent")),
|
||||
"append.gateway": appendAction("bpmn:ExclusiveGateway", "bpmn-icon-gateway-none", translate("Append Gateway")),
|
||||
"append.append-task": appendAction("bpmn:UserTask", "bpmn-icon-user-task", translate("Append Task")),
|
||||
"append.end-event": appendAction(
|
||||
"bpmn:EndEvent",
|
||||
"bpmn-icon-end-event-none",
|
||||
translate("Append EndEvent")
|
||||
),
|
||||
"append.gateway": appendAction(
|
||||
"bpmn:ExclusiveGateway",
|
||||
"bpmn-icon-gateway-none",
|
||||
translate("Append Gateway")
|
||||
),
|
||||
"append.append-task": appendAction(
|
||||
"bpmn:UserTask",
|
||||
"bpmn-icon-user-task",
|
||||
translate("Append Task")
|
||||
),
|
||||
"append.intermediate-event": appendAction(
|
||||
"bpmn:IntermediateThrowEvent",
|
||||
"bpmn-icon-intermediate-event-none",
|
||||
translate("Append Intermediate/Boundary Event")
|
||||
)
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -301,35 +350,56 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
className: "bpmn-icon-screw-wrench",
|
||||
title: translate("Change type"),
|
||||
action: {
|
||||
click: function(event, element) {
|
||||
click: function (event, element) {
|
||||
var position = assign(getReplaceMenuPosition(element), {
|
||||
cursor: { x: event.x, y: event.y }
|
||||
cursor: { x: event.x, y: event.y },
|
||||
});
|
||||
|
||||
popupMenu.open(element, "bpmn-replace", position);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (isAny(businessObject, ["bpmn:FlowNode", "bpmn:InteractionNode", "bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
|
||||
if (
|
||||
isAny(businessObject, [
|
||||
"bpmn:FlowNode",
|
||||
"bpmn:InteractionNode",
|
||||
"bpmn:DataObjectReference",
|
||||
"bpmn:DataStoreReference",
|
||||
])
|
||||
) {
|
||||
assign(actions, {
|
||||
"append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation"),
|
||||
"append.text-annotation": appendAction(
|
||||
"bpmn:TextAnnotation",
|
||||
"bpmn-icon-text-annotation"
|
||||
),
|
||||
|
||||
connect: {
|
||||
group: "connect",
|
||||
className: "bpmn-icon-connection-multi",
|
||||
title: translate("Connect using " + (businessObject.isForCompensation ? "" : "Sequence/MessageFlow or ") + "Association"),
|
||||
title: translate(
|
||||
"Connect using " +
|
||||
(businessObject.isForCompensation
|
||||
? ""
|
||||
: "Sequence/MessageFlow or ") +
|
||||
"Association"
|
||||
),
|
||||
action: {
|
||||
click: startConnect,
|
||||
dragstart: startConnect
|
||||
}
|
||||
}
|
||||
dragstart: startConnect,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (isAny(businessObject, ["bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
|
||||
if (
|
||||
isAny(businessObject, [
|
||||
"bpmn:DataObjectReference",
|
||||
"bpmn:DataStoreReference",
|
||||
])
|
||||
) {
|
||||
assign(actions, {
|
||||
connect: {
|
||||
group: "connect",
|
||||
@ -337,15 +407,18 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
title: translate("Connect using DataInputAssociation"),
|
||||
action: {
|
||||
click: startConnect,
|
||||
dragstart: startConnect
|
||||
}
|
||||
}
|
||||
dragstart: startConnect,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (is(businessObject, "bpmn:Group")) {
|
||||
assign(actions, {
|
||||
"append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation")
|
||||
"append.text-annotation": appendAction(
|
||||
"bpmn:TextAnnotation",
|
||||
"bpmn-icon-text-annotation"
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
@ -364,9 +437,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
className: "bpmn-icon-trash",
|
||||
title: translate("Remove"),
|
||||
action: {
|
||||
click: removeElement
|
||||
}
|
||||
}
|
||||
click: removeElement,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -380,7 +453,7 @@ function isEventType(eventBo, type, definition) {
|
||||
var isDefinition = false;
|
||||
|
||||
var definitions = eventBo.eventDefinitions || [];
|
||||
forEach(definitions, function(def) {
|
||||
forEach(definitions, function (def) {
|
||||
if (def.$type === definition) {
|
||||
isDefinition = true;
|
||||
}
|
||||
|
@ -84,9 +84,13 @@ function resetBaseInfo() {
|
||||
JSON.stringify(bpmnElement.businessObject)
|
||||
);
|
||||
// if (type.value === "StartEvent") {
|
||||
// elementBaseInfo.value.name = "开始";
|
||||
// window.bpmnInstances.modeling.updateProperties(bpmnElement, {
|
||||
// name: "开始",
|
||||
// });
|
||||
// } else if (type.value === "EndEvent") {
|
||||
// elementBaseInfo.value.name = "结束";
|
||||
// window.bpmnInstances.modeling.updateProperties(bpmnElement, {
|
||||
// name: "结束",
|
||||
// });
|
||||
// }
|
||||
}
|
||||
function updateBaseInfo(key) {
|
||||
|
@ -28,7 +28,6 @@ export function initListenerForm(listener) {
|
||||
}
|
||||
|
||||
export function initListenerType(listener) {
|
||||
// debugger;
|
||||
let listenerType;
|
||||
if (listener.class) listenerType = "classListener";
|
||||
if (listener.expression) listenerType = "expressionListener";
|
||||
|
@ -65,7 +65,6 @@ export function createScriptObject(options, prefix) {
|
||||
|
||||
// 更新元素扩展属性
|
||||
export function updateElementExtensions(element, extensionList) {
|
||||
// debugger;
|
||||
const extensions = window.bpmnInstances.moddle.create(
|
||||
"bpmn:ExtensionElements",
|
||||
{
|
||||
|
@ -572,7 +572,6 @@ function getProcessDetails(procInsId, deployId, taskId) {
|
||||
detailProcess(params).then((res) => {
|
||||
// const data = res.data;
|
||||
const data = JSON.parse(res.msg);
|
||||
// debugger;
|
||||
xmlData.value = data.bpmnXml;
|
||||
processFormList.value = data.processFormList;
|
||||
taskFormOpen.value = data.existTaskForm;
|
||||
|
Reference in New Issue
Block a user