diff --git a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue index d13b7365..e751dbd5 100644 --- a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue +++ b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue @@ -1,37 +1,42 @@ - +const findFromParentNode = ( + nodeList: SimpleFlowNode[], + nodeType: number +) => { + emits('find:recursiveFindParentNode', nodeList, props.parentNode, nodeType) +} + +// 递归从父节点中查询匹配的节点 +const recursiveFindParentNode = ( + nodeList: SimpleFlowNode[], + findNode: SimpleFlowNode, + nodeType: number +) => { + if (!findNode || findNode.type === NodeType.START_EVENT_NODE) { + return + } + + if (findNode.type === nodeType) { + nodeList.push(findNode) + } + emits('find:recursiveFindParentNode', nodeList, props.parentNode, nodeType) +} + + diff --git a/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue b/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue index 76dc9b40..a9cf18d1 100644 --- a/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue +++ b/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue @@ -15,7 +15,7 @@
- +
@@ -55,6 +55,18 @@ const processNodeTree = ref({ } }) +// const rootNode = ref({ +// name: '开始', +// type: NodeType.START_EVENT_NODE, +// id: 'StartEvent_1' +// }) + +// const childNode = ref({ +// id: 'EndEvent_1', +// name: '结束', +// type: NodeType.END_EVENT_NODE +// }) + const errorDialogVisible = ref(false) let errorNodes: SimpleFlowNode[] = [] const saveSimpleFlowModel = async () => { @@ -148,6 +160,8 @@ onMounted(async () => { if (result) { console.log('the result is ', result) processNodeTree.value = result + // rootNode.value = result + // childNode.value = result.childNode } }) diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index 32a9b658..70b201f0 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -62,6 +62,17 @@ export enum TimeUnitType { DAY = 3 } +export enum RejectHandlerType { + /** + * 结束流程 + */ + TERMINATION = 1, + /** + * 驳回到指定节点 + */ + RETURN_PRE_USER_TASK = 2 +} + // 条件配置类型 ( 用于条件节点配置 ) export enum ConditionConfigType { @@ -186,12 +197,6 @@ NODE_DEFAULT_NAME.set(NodeType.USER_TASK_NODE, '审批人') NODE_DEFAULT_NAME.set(NodeType.COPY_TASK_NODE, '抄送人') NODE_DEFAULT_NAME.set(NodeType.CONDITION_NODE, '条件') -export const TIME_UNIT_MAP = new Map() -NODE_DEFAULT_NAME.set(1, 'M') -NODE_DEFAULT_NAME.set(NodeType.COPY_TASK_NODE, '抄送人') -NODE_DEFAULT_NAME.set(NodeType.CONDITION_NODE, '条件') - - export const APPROVE_METHODS: DictDataVO [] = [ { label: '单人审批', value: 1 }, { label: '多人会签(需所有审批人同意)', value: 2 }, @@ -216,6 +221,10 @@ export const TIMEOUT_HANDLER_ACTION_TYPES: DictDataVO [] = [ { label: '自动同意', value: 2 }, { label: '自动拒绝', value: 3 }, ] +export const REJECT_HANDLER_TYPES: DictDataVO [] = [ + { label: '结束流程', value: RejectHandlerType.TERMINATION }, + { label: '驳回到指定节点', value: RejectHandlerType.RETURN_PRE_USER_TASK } +] // 比较运算符 export const COMPARISON_OPERATORS : DictDataVO = [ diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index 49d22874..5815d176 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -131,7 +131,6 @@ /> - -
@@ -163,8 +161,35 @@
- - + 审批人拒绝时 + + + + + + + + + + + + 审批人超时未处理时 + () const notAllowedMultiApprovers = ref(false) const currentNode = ref(props.flowNode) @@ -316,7 +346,7 @@ const deptTreeOptions = inject('deptTree') // 部门树 const formType = inject('formType') // 表单类型 const formFields = inject>('formFields') const candidateParamArray = ref([]) - +const returnTaskList = ref([]) const closeDrawer = () => { settingVisible.value = false } @@ -443,6 +473,10 @@ const setCurrentNode = (node: SimpleFlowNode) => { timeDuration.value = parseInt(parseTime) timeUnit.value = convertTimeUnit(parseTimeUnit) } + // 查找可以驳回的用户节点 + const matchNodeList = []; + emits('find:returnTaskNodes', matchNodeList); + returnTaskList.value = matchNodeList; } defineExpose({ open, setCurrentNode }) // 暴露方法给父组件 @@ -483,6 +517,12 @@ const blurEvent = () => { currentNode.value.name = currentNode.value.name || (NODE_DEFAULT_NAME.get(NodeType.USER_TASK_NODE) as string) } +const rejectHandlerTypeChange = () => { + if (currentNode.value.attributes?.rejectHandler.type === RejectHandlerType.RETURN_PRE_USER_TASK) { + + console.log('nodeList is {}', returnTaskList.value); + } +} // 默认 6小时 const timeDuration = ref(6) const timeUnit = ref(TimeUnitType.HOUR) diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue index d25ffc94..e2e5a92c 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue @@ -57,7 +57,11 @@ - + @@ -76,6 +80,10 @@ defineOptions({ name: 'ExclusiveNode' }) const props = defineProps({ + // parentNode : { + // type: Object as () => SimpleFlowNode, + // required: true + // }, flowNode: { type: Object as () => SimpleFlowNode, required: true @@ -83,7 +91,9 @@ const props = defineProps({ }) // 定义事件,更新父组件 const emits = defineEmits<{ - 'update:modelValue': [node: SimpleFlowNode | undefined] + 'update:modelValue': [node: SimpleFlowNode | undefined], + 'find:parentNode': [nodeList: SimpleFlowNode[], nodeType: number], + 'find:recursiveFindParentNode': [nodeList: SimpleFlowNode[], curentNode: SimpleFlowNode, nodeType: number] }>() const currentNode = ref(props.flowNode) @@ -156,7 +166,21 @@ const moveNode = (index: number, to: number) => { } } - +// 递归从父节点中查询匹配的节点 +const recursiveFindParentNode = ( + nodeList: SimpleFlowNode[], + node: SimpleFlowNode, + nodeType: number +) => { + if (!node || node.type === NodeType.START_EVENT_NODE) { + return + } + if (node.type === nodeType) { + nodeList.push(node) + } + // 条件节点 (NodeType.CONDITION_NODE) 比较特殊。需要调用其父节点条件分支节点(NodeType.EXCLUSIVE_NODE) 继续查找 + emits('find:parentNode', nodeList, nodeType) +} diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue index c0b678a6..bf2027fb 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue @@ -38,6 +38,7 @@ v-if="currentNode" ref="nodeSetting" :flow-node="currentNode" + @find:return-task-nodes="findReturnTaskNodes" />