保存时检查用户任务节点名称是否填写
This commit is contained in:
@ -10,6 +10,7 @@
|
|||||||
'connection.added',
|
'connection.added',
|
||||||
'connection.removed',
|
'connection.removed',
|
||||||
'connection.changed',
|
'connection.changed',
|
||||||
|
'create.end',
|
||||||
]"
|
]"
|
||||||
@element-click="elementClick"
|
@element-click="elementClick"
|
||||||
@init-finished="initModeler"
|
@init-finished="initModeler"
|
||||||
@ -80,7 +81,18 @@ function initModeler(modelerArgv) {
|
|||||||
}, 10);
|
}, 10);
|
||||||
}
|
}
|
||||||
function handlerEvent(eventName) {
|
function handlerEvent(eventName) {
|
||||||
|
console.log(eventName);
|
||||||
|
|
||||||
if (eventName === "connection-added") {
|
if (eventName === "connection-added") {
|
||||||
|
// 设置结束节点的默认名称
|
||||||
|
nextTick(() => {
|
||||||
|
if (window?.bpmnInstances?.bpmnElement.type === "bpmn:EndEvent") {
|
||||||
|
window.bpmnInstances.modeling.updateProperties(
|
||||||
|
window.bpmnInstances.bpmnElement,
|
||||||
|
{ name: "结束" }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
goToFormSelect();
|
goToFormSelect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,6 +328,7 @@ const emit = defineEmits([
|
|||||||
"connection-added",
|
"connection-added",
|
||||||
"connection-removed",
|
"connection-removed",
|
||||||
"connection-changed",
|
"connection-changed",
|
||||||
|
"create-end",
|
||||||
]);
|
]);
|
||||||
const defaultZoom = ref(1);
|
const defaultZoom = ref(1);
|
||||||
const previewModelVisible = ref(false);
|
const previewModelVisible = ref(false);
|
||||||
@ -422,6 +423,19 @@ onBeforeUnmount(() => {
|
|||||||
bpmnModeler = null;
|
bpmnModeler = null;
|
||||||
});
|
});
|
||||||
function onSave() {
|
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) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (bpmnModeler == null) {
|
if (bpmnModeler == null) {
|
||||||
reject();
|
reject();
|
||||||
|
@ -49,6 +49,19 @@ export default function ContextPadProvider(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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,
|
var context = event.context,
|
||||||
shape = context.shape;
|
shape = context.shape;
|
||||||
|
|
||||||
@ -77,7 +90,7 @@ ContextPadProvider.$inject = [
|
|||||||
"canvas",
|
"canvas",
|
||||||
"rules",
|
"rules",
|
||||||
"translate",
|
"translate",
|
||||||
"elementRegistry"
|
"elementRegistry",
|
||||||
];
|
];
|
||||||
|
|
||||||
ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||||
@ -122,7 +135,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
|
|
||||||
var pos = {
|
var pos = {
|
||||||
x: left,
|
x: left,
|
||||||
y: top + padRect.height + Y_OFFSET
|
y: top + padRect.height + Y_OFFSET,
|
||||||
};
|
};
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
@ -147,13 +160,15 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
function appendStart(event, element) {
|
function appendStart(event, element) {
|
||||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
var shape = elementFactory.createShape(assign({ type: type }, options));
|
||||||
create.start(event, shape, {
|
create.start(event, shape, {
|
||||||
source: element
|
source: element,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var append = autoPlace
|
var append = autoPlace
|
||||||
? function (event, element) {
|
? function (event, element) {
|
||||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
var shape = elementFactory.createShape(
|
||||||
|
assign({ type: type }, options)
|
||||||
|
);
|
||||||
|
|
||||||
autoPlace.append(element, shape);
|
autoPlace.append(element, shape);
|
||||||
}
|
}
|
||||||
@ -165,8 +180,8 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
title: title,
|
title: title,
|
||||||
action: {
|
action: {
|
||||||
dragstart: appendStart,
|
dragstart: appendStart,
|
||||||
click: append
|
click: append,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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);
|
var childLanes = getChildLanes(element);
|
||||||
|
|
||||||
assign(actions, {
|
assign(actions, {
|
||||||
@ -192,9 +210,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
action: {
|
action: {
|
||||||
click: function (event, element) {
|
click: function (event, element) {
|
||||||
modeling.addLane(element, "top");
|
modeling.addLane(element, "top");
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (childLanes.length < 2) {
|
if (childLanes.length < 2) {
|
||||||
@ -205,9 +223,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
className: "bpmn-icon-lane-divide-two",
|
className: "bpmn-icon-lane-divide-two",
|
||||||
title: translate("Divide into two Lanes"),
|
title: translate("Divide into two Lanes"),
|
||||||
action: {
|
action: {
|
||||||
click: splitLaneHandler(2)
|
click: splitLaneHandler(2),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,9 +236,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
className: "bpmn-icon-lane-divide-three",
|
className: "bpmn-icon-lane-divide-three",
|
||||||
title: translate("Divide into three Lanes"),
|
title: translate("Divide into three Lanes"),
|
||||||
action: {
|
action: {
|
||||||
click: splitLaneHandler(3)
|
click: splitLaneHandler(3),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,16 +251,20 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
action: {
|
action: {
|
||||||
click: function (event, element) {
|
click: function (event, element) {
|
||||||
modeling.addLane(element, "bottom");
|
modeling.addLane(element, "bottom");
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(businessObject, "bpmn:FlowNode")) {
|
if (is(businessObject, "bpmn:FlowNode")) {
|
||||||
if (is(businessObject, "bpmn:EventBasedGateway")) {
|
if (is(businessObject, "bpmn:EventBasedGateway")) {
|
||||||
assign(actions, {
|
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(
|
"append.message-intermediate-event": appendAction(
|
||||||
"bpmn:IntermediateCatchEvent",
|
"bpmn:IntermediateCatchEvent",
|
||||||
"bpmn-icon-intermediate-event-catch-message",
|
"bpmn-icon-intermediate-event-catch-message",
|
||||||
@ -266,29 +288,56 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
"bpmn-icon-intermediate-event-catch-signal",
|
"bpmn-icon-intermediate-event-catch-signal",
|
||||||
translate("Append SignalIntermediateCatchEvent"),
|
translate("Append SignalIntermediateCatchEvent"),
|
||||||
{ eventDefinitionType: "bpmn:SignalEventDefinition" }
|
{ eventDefinitionType: "bpmn:SignalEventDefinition" }
|
||||||
)
|
),
|
||||||
});
|
});
|
||||||
} else if (isEventType(businessObject, "bpmn:BoundaryEvent", "bpmn:CompensateEventDefinition")) {
|
} else if (
|
||||||
|
isEventType(
|
||||||
|
businessObject,
|
||||||
|
"bpmn:BoundaryEvent",
|
||||||
|
"bpmn:CompensateEventDefinition"
|
||||||
|
)
|
||||||
|
) {
|
||||||
assign(actions, {
|
assign(actions, {
|
||||||
"append.compensation-activity": appendAction("bpmn:Task", "bpmn-icon-task", translate("Append compensation activity"), {
|
"append.compensation-activity": appendAction(
|
||||||
isForCompensation: true
|
"bpmn:Task",
|
||||||
})
|
"bpmn-icon-task",
|
||||||
|
translate("Append compensation activity"),
|
||||||
|
{
|
||||||
|
isForCompensation: true,
|
||||||
|
}
|
||||||
|
),
|
||||||
});
|
});
|
||||||
} else if (
|
} else if (
|
||||||
!is(businessObject, "bpmn:EndEvent") &&
|
!is(businessObject, "bpmn:EndEvent") &&
|
||||||
!businessObject.isForCompensation &&
|
!businessObject.isForCompensation &&
|
||||||
!isEventType(businessObject, "bpmn:IntermediateThrowEvent", "bpmn:LinkEventDefinition") &&
|
!isEventType(
|
||||||
|
businessObject,
|
||||||
|
"bpmn:IntermediateThrowEvent",
|
||||||
|
"bpmn:LinkEventDefinition"
|
||||||
|
) &&
|
||||||
!isEventSubProcess(businessObject)
|
!isEventSubProcess(businessObject)
|
||||||
) {
|
) {
|
||||||
assign(actions, {
|
assign(actions, {
|
||||||
"append.end-event": appendAction("bpmn:EndEvent", "bpmn-icon-end-event-none", translate("Append EndEvent")),
|
"append.end-event": appendAction(
|
||||||
"append.gateway": appendAction("bpmn:ExclusiveGateway", "bpmn-icon-gateway-none", translate("Append Gateway")),
|
"bpmn:EndEvent",
|
||||||
"append.append-task": appendAction("bpmn:UserTask", "bpmn-icon-user-task", translate("Append Task")),
|
"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(
|
"append.intermediate-event": appendAction(
|
||||||
"bpmn:IntermediateThrowEvent",
|
"bpmn:IntermediateThrowEvent",
|
||||||
"bpmn-icon-intermediate-event-none",
|
"bpmn-icon-intermediate-event-none",
|
||||||
translate("Append Intermediate/Boundary Event")
|
translate("Append Intermediate/Boundary Event")
|
||||||
)
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,33 +352,54 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
action: {
|
action: {
|
||||||
click: function (event, element) {
|
click: function (event, element) {
|
||||||
var position = assign(getReplaceMenuPosition(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);
|
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, {
|
assign(actions, {
|
||||||
"append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation"),
|
"append.text-annotation": appendAction(
|
||||||
|
"bpmn:TextAnnotation",
|
||||||
|
"bpmn-icon-text-annotation"
|
||||||
|
),
|
||||||
|
|
||||||
connect: {
|
connect: {
|
||||||
group: "connect",
|
group: "connect",
|
||||||
className: "bpmn-icon-connection-multi",
|
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: {
|
action: {
|
||||||
click: startConnect,
|
click: startConnect,
|
||||||
dragstart: startConnect
|
dragstart: startConnect,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAny(businessObject, ["bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
|
if (
|
||||||
|
isAny(businessObject, [
|
||||||
|
"bpmn:DataObjectReference",
|
||||||
|
"bpmn:DataStoreReference",
|
||||||
|
])
|
||||||
|
) {
|
||||||
assign(actions, {
|
assign(actions, {
|
||||||
connect: {
|
connect: {
|
||||||
group: "connect",
|
group: "connect",
|
||||||
@ -337,15 +407,18 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
title: translate("Connect using DataInputAssociation"),
|
title: translate("Connect using DataInputAssociation"),
|
||||||
action: {
|
action: {
|
||||||
click: startConnect,
|
click: startConnect,
|
||||||
dragstart: startConnect
|
dragstart: startConnect,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(businessObject, "bpmn:Group")) {
|
if (is(businessObject, "bpmn:Group")) {
|
||||||
assign(actions, {
|
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",
|
className: "bpmn-icon-trash",
|
||||||
title: translate("Remove"),
|
title: translate("Remove"),
|
||||||
action: {
|
action: {
|
||||||
click: removeElement
|
click: removeElement,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +84,13 @@ function resetBaseInfo() {
|
|||||||
JSON.stringify(bpmnElement.businessObject)
|
JSON.stringify(bpmnElement.businessObject)
|
||||||
);
|
);
|
||||||
// if (type.value === "StartEvent") {
|
// if (type.value === "StartEvent") {
|
||||||
// elementBaseInfo.value.name = "开始";
|
// window.bpmnInstances.modeling.updateProperties(bpmnElement, {
|
||||||
|
// name: "开始",
|
||||||
|
// });
|
||||||
// } else if (type.value === "EndEvent") {
|
// } else if (type.value === "EndEvent") {
|
||||||
// elementBaseInfo.value.name = "结束";
|
// window.bpmnInstances.modeling.updateProperties(bpmnElement, {
|
||||||
|
// name: "结束",
|
||||||
|
// });
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
function updateBaseInfo(key) {
|
function updateBaseInfo(key) {
|
||||||
|
@ -65,7 +65,6 @@ export function createScriptObject(options, prefix) {
|
|||||||
|
|
||||||
// 更新元素扩展属性
|
// 更新元素扩展属性
|
||||||
export function updateElementExtensions(element, extensionList) {
|
export function updateElementExtensions(element, extensionList) {
|
||||||
// debugger;
|
|
||||||
const extensions = window.bpmnInstances.moddle.create(
|
const extensions = window.bpmnInstances.moddle.create(
|
||||||
"bpmn:ExtensionElements",
|
"bpmn:ExtensionElements",
|
||||||
{
|
{
|
||||||
|
@ -572,7 +572,6 @@ function getProcessDetails(procInsId, deployId, taskId) {
|
|||||||
detailProcess(params).then((res) => {
|
detailProcess(params).then((res) => {
|
||||||
// const data = res.data;
|
// const data = res.data;
|
||||||
const data = JSON.parse(res.msg);
|
const data = JSON.parse(res.msg);
|
||||||
// debugger;
|
|
||||||
xmlData.value = data.bpmnXml;
|
xmlData.value = data.bpmnXml;
|
||||||
processFormList.value = data.processFormList;
|
processFormList.value = data.processFormList;
|
||||||
taskFormOpen.value = data.existTaskForm;
|
taskFormOpen.value = data.existTaskForm;
|
||||||
|
Reference in New Issue
Block a user