Skip to content

Commit 9994059

Browse files
committed
【代码评审】BPM:子流程的多实例配置
1 parent 5f2a220 commit 9994059

File tree

4 files changed

+92
-69
lines changed

4 files changed

+92
-69
lines changed

src/components/SimpleProcessDesignerV2/src/consts.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,13 @@ export const TRIGGER_TYPES: DictDataVO[] = [
815815
export type ChildProcessSetting = {
816816
calledProcessDefinitionKey: string
817817
calledProcessDefinitionName: string
818-
async: boolean,
819-
inVariables?: IOParameter[],
820-
outVariables?: IOParameter[],
821-
skipStartUserNode: boolean,
822-
startUserSetting: StartUserSetting,
823-
timeoutSetting: TimeoutSetting,
824-
multiInstanceSetting: MultiInstanceSetting,
818+
async: boolean
819+
inVariables?: IOParameter[]
820+
outVariables?: IOParameter[]
821+
skipStartUserNode: boolean
822+
startUserSetting: StartUserSetting
823+
timeoutSetting: TimeoutSetting
824+
multiInstanceSetting: MultiInstanceSetting
825825
}
826826
export type IOParameter = {
827827
source: string
@@ -833,16 +833,16 @@ export type StartUserSetting = {
833833
emptyType?: ChildProcessStartUserEmptyTypeEnum
834834
}
835835
export type TimeoutSetting = {
836-
enable: boolean,
837-
type?: DelayTypeEnum,
838-
timeExpression?: string,
836+
enable: boolean
837+
type?: DelayTypeEnum
838+
timeExpression?: string
839839
}
840840
export type MultiInstanceSetting = {
841-
enable: boolean,
842-
sequential?: boolean,
843-
completeRatio?: number,
844-
sourceType?: ChildProcessMultiInstanceSourceTypeEnum,
845-
source?: string,
841+
enable: boolean
842+
sequential?: boolean
843+
completeRatio?: number
844+
sourceType?: ChildProcessMultiInstanceSourceTypeEnum
845+
source?: string
846846
}
847847
export enum ChildProcessStartUserTypeEnum {
848848
/**
@@ -852,7 +852,7 @@ export enum ChildProcessStartUserTypeEnum {
852852
/**
853853
* 表单
854854
*/
855-
FROM_FORM = 2,
855+
FROM_FORM = 2
856856
}
857857
export const CHILD_PROCESS_START_USER_TYPE = [
858858
{ label: '同主流程发起人', value: ChildProcessStartUserTypeEnum.MAIN_PROCESS_START_USER },
@@ -870,7 +870,7 @@ export enum ChildProcessStartUserEmptyTypeEnum {
870870
/**
871871
* 主流程管理员
872872
*/
873-
MAIN_PROCESS_ADMIN = 3,
873+
MAIN_PROCESS_ADMIN = 3
874874
}
875875
export const CHILD_PROCESS_START_USER_EMPTY_TYPE = [
876876
{ label: '同主流程发起人', value: ChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_START_USER },
@@ -889,10 +889,10 @@ export enum ChildProcessMultiInstanceSourceTypeEnum {
889889
/**
890890
* 多项表单
891891
*/
892-
MULTI_FORM = 3,
892+
MULTI_FORM = 3
893893
}
894894
export const CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE = [
895895
{ label: '固定数量', value: ChildProcessMultiInstanceSourceTypeEnum.FIXED_QUANTITY },
896-
{ label: '数字表单', value: ChildProcessMultiInstanceSourceTypeEnum.DIGITAL_FORM },
897-
{ label: '多项表单', value: ChildProcessMultiInstanceSourceTypeEnum.MULTI_FORM }
896+
{ label: '数字表单', value: ChildProcessMultiInstanceSourceTypeEnum.DIGITAL_FORM }, // TODO @lesan:DIGITAL 改成 NUMBER,和 Element plus 更接近?
897+
{ label: '多项表单', value: ChildProcessMultiInstanceSourceTypeEnum.MULTI_FORM } // TODO @lesan:多选表单?multiple 是这个解释。另外 MULTI => MULTIPLE
898898
]

src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@
166166
:key="item.value"
167167
:value="item.value"
168168
>
169-
{{ item.label }}</el-radio
170-
>
169+
{{ item.label }}
170+
</el-radio>
171171
</el-radio-group>
172172
</el-form-item>
173173
<el-form-item
174-
v-if="configForm.startUserType === 2"
174+
v-if="configForm.startUserType === ChildProcessStartUserTypeEnum.FROM_FORM"
175175
label="当子流程发起人为空时"
176176
prop="startUserType"
177177
>
@@ -181,8 +181,8 @@
181181
:key="item.value"
182182
:value="item.value"
183183
>
184-
{{ item.label }}</el-radio
185-
>
184+
{{ item.label }}
185+
</el-radio>
186186
</el-radio-group>
187187
</el-form-item>
188188
<el-form-item
@@ -282,7 +282,11 @@
282282
</el-form-item>
283283
<el-form-item prop="multiInstanceSourceType">
284284
<el-text>多实例来源</el-text>
285-
<el-select class="ml-10px w-200px!" v-model="configForm.multiInstanceSourceType" @change="handleMultiInstanceSourceTypeChange">
285+
<el-select
286+
class="ml-10px w-200px!"
287+
v-model="configForm.multiInstanceSourceType"
288+
@change="handleMultiInstanceSourceTypeChange"
289+
>
286290
<el-option
287291
v-for="item in CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE"
288292
:key="item.value"
@@ -291,6 +295,7 @@
291295
/>
292296
</el-select>
293297
</el-form-item>
298+
<!-- TODO @lesan:枚举 -->
294299
<el-form-item v-if="configForm.multiInstanceSourceType === 1">
295300
<el-input-number v-model="configForm.multiInstanceSource" :min="1" />
296301
</el-form-item>
@@ -483,7 +488,8 @@ const saveConfig = async () => {
483488
enable: configForm.value.multiInstanceEnable
484489
}
485490
if (configForm.value.multiInstanceEnable) {
486-
currentNode.value.childProcessSetting.multiInstanceSetting.sequential = configForm.value.sequential
491+
currentNode.value.childProcessSetting.multiInstanceSetting.sequential =
492+
configForm.value.sequential
487493
currentNode.value.childProcessSetting.multiInstanceSetting.completeRatio =
488494
configForm.value.completeRatio
489495
currentNode.value.childProcessSetting.multiInstanceSetting.sourceType =
@@ -538,11 +544,15 @@ const showChildProcessNodeConfig = (node: SimpleFlowNode) => {
538544
configForm.value.multiInstanceEnable =
539545
node.childProcessSetting.multiInstanceSetting.enable ?? false
540546
if (configForm.value.multiInstanceEnable) {
541-
configForm.value.sequential = node.childProcessSetting.multiInstanceSetting.sequential ?? false
542-
configForm.value.completeRatio = node.childProcessSetting.multiInstanceSetting.completeRatio ?? 100
547+
configForm.value.sequential =
548+
node.childProcessSetting.multiInstanceSetting.sequential ?? false
549+
configForm.value.completeRatio =
550+
node.childProcessSetting.multiInstanceSetting.completeRatio ?? 100
543551
configForm.value.multiInstanceSourceType =
544-
node.childProcessSetting.multiInstanceSetting.sourceType ?? ChildProcessMultiInstanceSourceTypeEnum.FIXED_QUANTITY
545-
configForm.value.multiInstanceSource = node.childProcessSetting.multiInstanceSetting.source ?? ''
552+
node.childProcessSetting.multiInstanceSetting.sourceType ??
553+
ChildProcessMultiInstanceSourceTypeEnum.FIXED_QUANTITY
554+
configForm.value.multiInstanceSource =
555+
node.childProcessSetting.multiInstanceSetting.source ?? ''
546556
}
547557
}
548558
loadFormInfo()

src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import { getDefaultConditionNodeName } from '../utils'
4848
import { useFormFieldsAndStartUser, getConditionShowText } from '../node'
4949
import Condition from './components/Condition.vue'
5050
import { cloneDeep } from 'lodash-es'
51-
const message = useMessage() // 消息弹窗
51+
5252
defineOptions({
5353
name: 'ConditionNodeConfig'
5454
})
@@ -69,14 +69,18 @@ const condition = ref<any>({
6969
conditionExpression: '',
7070
conditionGroups: {
7171
and: true,
72-
conditions: [{
73-
and: true,
74-
rules: [{
75-
opCode: '==',
76-
leftSide: '',
77-
rightSide: ''
78-
}]
79-
}]
72+
conditions: [
73+
{
74+
and: true,
75+
rules: [
76+
{
77+
opCode: '==',
78+
leftSide: '',
79+
rightSide: ''
80+
}
81+
]
82+
}
83+
]
8084
}
8185
})
8286
const open = () => {
@@ -90,14 +94,18 @@ const open = () => {
9094
conditionExpression: '',
9195
conditionGroups: {
9296
and: true,
93-
conditions: [{
94-
and: true,
95-
rules: [{
96-
opCode: '==',
97-
leftSide: '',
98-
rightSide: ''
99-
}]
100-
}]
97+
conditions: [
98+
{
99+
and: true,
100+
rules: [
101+
{
102+
opCode: '==',
103+
leftSide: '',
104+
rightSide: ''
105+
}
106+
]
107+
}
108+
]
101109
}
102110
}
103111
}
@@ -162,8 +170,14 @@ const saveConfig = async () => {
162170
currentNode.value.conditionSetting = cloneDeep({
163171
...currentNode.value.conditionSetting,
164172
conditionType: condition.value?.conditionType,
165-
conditionExpression: condition.value?.conditionType === ConditionType.EXPRESSION ? condition.value?.conditionExpression : undefined,
166-
conditionGroups: condition.value?.conditionType === ConditionType.RULE ? condition.value?.conditionGroups : undefined
173+
conditionExpression:
174+
condition.value?.conditionType === ConditionType.EXPRESSION
175+
? condition.value?.conditionExpression
176+
: undefined,
177+
conditionGroups:
178+
condition.value?.conditionType === ConditionType.RULE
179+
? condition.value?.conditionGroups
180+
: undefined
167181
})
168182
}
169183
settingVisible.value = false

src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -157,25 +157,24 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
157157
}
158158
159159
/** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次 */
160-
// TODO @芋艿:这里我执行填写表单的时候不知道为啥一直报错,先注释了 @lesan:可以和群里的小北说下
161-
// watch(
162-
// detailForm.value,
163-
// (newValue) => {
164-
// if (newValue && Object.keys(newValue.value).length > 0) {
165-
// // 记录之前的节点审批人
166-
// tempStartUserSelectAssignees.value = startUserSelectAssignees.value
167-
// startUserSelectAssignees.value = {}
168-
// // 加载最新的审批详情
169-
// getApprovalDetail({
170-
// id: props.selectProcessDefinition.id,
171-
// processVariablesStr: JSON.stringify(newValue.value) // 解决 GET 无法传递对象的问题,后端 String 再转 JSON
172-
// })
173-
// }
174-
// },
175-
// {
176-
// immediate: true
177-
// }
178-
// )
160+
watch(
161+
detailForm.value,
162+
(newValue) => {
163+
if (newValue && Object.keys(newValue.value).length > 0) {
164+
// 记录之前的节点审批人
165+
tempStartUserSelectAssignees.value = startUserSelectAssignees.value
166+
startUserSelectAssignees.value = {}
167+
// 加载最新的审批详情
168+
getApprovalDetail({
169+
id: props.selectProcessDefinition.id,
170+
processVariablesStr: JSON.stringify(newValue.value) // 解决 GET 无法传递对象的问题,后端 String 再转 JSON
171+
})
172+
}
173+
},
174+
{
175+
immediate: true
176+
}
177+
)
179178
180179
/** 获取审批详情 */
181180
const getApprovalDetail = async (row: any) => {

0 commit comments

Comments
 (0)