feat: [bpm][antd] bpm设计器 多人审批方式优化
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<!-- eslint-disable unused-imports/no-unused-vars -->
|
<!-- eslint-disable no-unused-vars -->
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject, nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue';
|
import { inject, nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue';
|
||||||
|
|
||||||
@@ -73,6 +73,7 @@ declare global {
|
|||||||
|
|
||||||
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
const bpmnInstances = () => (window as any)?.bpmnInstances;
|
||||||
|
|
||||||
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||||
const getElementLoop = (businessObject: any): void => {
|
const getElementLoop = (businessObject: any): void => {
|
||||||
if (!businessObject.loopCharacteristics) {
|
if (!businessObject.loopCharacteristics) {
|
||||||
loopCharacteristics.value = 'Null';
|
loopCharacteristics.value = 'Null';
|
||||||
@@ -278,6 +279,8 @@ const approveRatio = ref<number>(100);
|
|||||||
const otherExtensions = ref<any[]>([]);
|
const otherExtensions = ref<any[]>([]);
|
||||||
const getElementLoopNew = (): void => {
|
const getElementLoopNew = (): void => {
|
||||||
if (props.type === 'UserTask') {
|
if (props.type === 'UserTask') {
|
||||||
|
const loopCharacteristics =
|
||||||
|
bpmnElement.value.businessObject?.loopCharacteristics;
|
||||||
const extensionElements =
|
const extensionElements =
|
||||||
bpmnElement.value.businessObject?.extensionElements ??
|
bpmnElement.value.businessObject?.extensionElements ??
|
||||||
bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] });
|
bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] });
|
||||||
@@ -294,10 +297,25 @@ const getElementLoopNew = (): void => {
|
|||||||
approveMethod.value = ApproveMethodType.SEQUENTIAL_APPROVE;
|
approveMethod.value = ApproveMethodType.SEQUENTIAL_APPROVE;
|
||||||
updateLoopCharacteristics();
|
updateLoopCharacteristics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果是按比例会签,从现有 completionCondition 中解析比例,反推到 approveRatio
|
||||||
|
if (
|
||||||
|
approveMethod.value === ApproveMethodType.APPROVE_BY_RATIO &&
|
||||||
|
loopCharacteristics?.completionCondition?.body
|
||||||
|
) {
|
||||||
|
const body = loopCharacteristics.completionCondition.body as string;
|
||||||
|
// 形如 "${ nrOfCompletedInstances/nrOfInstances >= 0.9 }"
|
||||||
|
const match = body.match(/>=\s*(\d+(?:\.\d+)?)/);
|
||||||
|
if (match) {
|
||||||
|
const ratio = Number(match[1]);
|
||||||
|
if (!Number.isNaN(ratio)) {
|
||||||
|
approveRatio.value = ratio * 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onApproveMethodChange = (): void => {
|
const onApproveMethodChange = (): void => {
|
||||||
approveRatio.value = 100;
|
|
||||||
updateLoopCharacteristics();
|
updateLoopCharacteristics();
|
||||||
};
|
};
|
||||||
const onApproveRatioChange = (): void => {
|
const onApproveRatioChange = (): void => {
|
||||||
@@ -393,31 +411,29 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="panel-tab__content">
|
<div class="-mx-2 px-2">
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
v-if="type === 'UserTask'"
|
v-if="type === 'UserTask'"
|
||||||
v-model:value="approveMethod"
|
v-model:value="approveMethod"
|
||||||
@change="onApproveMethodChange"
|
@change="onApproveMethodChange"
|
||||||
>
|
>
|
||||||
<div class="flex-col">
|
<div class="flex flex-col gap-3">
|
||||||
<div v-for="(item, index) in APPROVE_METHODS" :key="index">
|
<div v-for="(item, index) in APPROVE_METHODS" :key="index">
|
||||||
<Radio :value="item.value">
|
<Radio :value="item.value">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</Radio>
|
</Radio>
|
||||||
<FormItem prop="approveRatio">
|
<InputNumber
|
||||||
<InputNumber
|
v-if="
|
||||||
v-model:value="approveRatio"
|
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
|
||||||
:min="10"
|
approveMethod === ApproveMethodType.APPROVE_BY_RATIO
|
||||||
:max="100"
|
"
|
||||||
:step="10"
|
v-model:value="approveRatio"
|
||||||
size="small"
|
:min="10"
|
||||||
v-if="
|
:max="100"
|
||||||
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
|
:step="10"
|
||||||
approveMethod === ApproveMethodType.APPROVE_BY_RATIO
|
size="small"
|
||||||
"
|
@change="onApproveRatioChange"
|
||||||
@change="onApproveRatioChange"
|
/>
|
||||||
/>
|
|
||||||
</FormItem>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user