feat: 为新建流程加入一个用于回退的起草节点,并提示不能删除

This commit is contained in:
gaoyunqi
2024-03-23 12:16:42 +08:00
parent 6340b2ee9f
commit 2b72d7077c
2 changed files with 43 additions and 2 deletions

View File

@ -3,6 +3,9 @@
<NodeHead class="mb-3" :nodeName="nodeName" /> <NodeHead class="mb-3" :nodeName="nodeName" />
<a-tabs> <a-tabs>
<a-tab-pane key="1" :tab="t('基础配置')"> <a-tab-pane key="1" :tab="t('基础配置')">
<div style="color: #c00" v-if="formInfo.id === 'Activity_draft'">
草稿节点只能改名不能删除且审批人必须为发起人否则会导致流程审批异常
</div>
<FormItem :required="formInfo.type !== 'bpmn:SequenceFlow'" :label="t('节点名称:')"> <FormItem :required="formInfo.type !== 'bpmn:SequenceFlow'" :label="t('节点名称:')">
<a-input <a-input
v-model:value="formInfo.name" v-model:value="formInfo.name"

View File

@ -32,6 +32,7 @@ export const getLabelName = (type: InfoType) => {
export const initStartProperties = () => { export const initStartProperties = () => {
const bpmnStore = useBpmnStore(); const bpmnStore = useBpmnStore();
initProperties(getStartNodeId, BpmnNodeKey.START, t('开始节点'), bpmnStore.processInfo.processId); initProperties(getStartNodeId, BpmnNodeKey.START, t('开始节点'), bpmnStore.processInfo.processId);
initProperties('Activity_draft', BpmnNodeKey.USER, '发起审批', bpmnStore.processInfo.processId);
}; };
// 修改流程属性 // 修改流程属性
export const changeProcessProperties = async (processConfig: ProcessConfig) => { export const changeProcessProperties = async (processConfig: ProcessConfig) => {
@ -74,7 +75,27 @@ export const initProperties = (id: InfoId, type: InfoType, name: string, parentI
properties.noHandler = processInfo.noHandler; properties.noHandler = processInfo.noHandler;
properties.isPrevChooseNext = processInfo.isPrevChooseNext; properties.isPrevChooseNext = processInfo.isPrevChooseNext;
} }
if (id === 'Activity_draft') {
// 将草稿节点的审批人设置为流程发起者
properties.approverConfigs = [{
checked:false,
id: 'Event_start_node',
memberType: 3,
name: '开始节点'
}];
properties.countersignConfig = {
addOrRemove: 1,
finishType: 0,
multipleInstancesType: 0,
percentage: 0,
countersignList: [{
checked: false,
id: 'Event_start_node',
memberType: 3,
name: '开始节点'
}]
}
}
setProperties(id, properties); setProperties(id, properties);
}; };
// 移除节点信息缓存 // 移除节点信息缓存
@ -142,13 +163,30 @@ export const getInitializeXml = (resourceId: string) => {
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1u51epq" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.2.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0"> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1u51epq" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.2.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:process id="${resourceId}" name="${resourceId}" isExecutable="true"> <bpmn:process id="${resourceId}" name="${resourceId}" isExecutable="true">
<bpmn:startEvent id="${getStartNodeId}" name="开始节点" /> <bpmn:startEvent id="${getStartNodeId}" name="开始节点">
<bpmn:outgoing>Flow_line_draft</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:userTask id="Activity_draft" name="发起审批">
<bpmn:incoming>Flow_line_draft</bpmn:incoming>
</bpmn:userTask>
<bpmn:sequenceFlow id="Flow_line_draft" name="流程线" sourceRef="${getStartNodeId}" targetRef="Activity_draft" />
</bpmn:process> </bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1m1pmsz"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1m1pmsz">
<bpmndi:BPMNShape id="${getStartNodeId}_di" bpmnElement="${getStartNodeId}"> <bpmndi:BPMNShape id="${getStartNodeId}_di" bpmnElement="${getStartNodeId}">
<dc:Bounds x="159" y="359" width="36" height="36" /> <dc:Bounds x="159" y="359" width="36" height="36" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_draft_di" bpmnElement="Activity_draft">
<dc:Bounds x="290" y="337" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="edge_line_draft" bpmnElement="Flow_line_draft">
<di:waypoint x="195" y="377" />
<di:waypoint x="290" y="377" />
<bpmndi:BPMNLabel>
<dc:Bounds x="226" y="359" width="34" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane> </bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram> </bpmndi:BPMNDiagram>
</bpmn:definitions> </bpmn:definitions>