Skip to content

Commit a383363

Browse files
committed
feat: 新增获取下一个执行的流程节点接口
1 parent 986d1cd commit a383363

File tree

3 files changed

+30
-18
lines changed

3 files changed

+30
-18
lines changed

src/api/bpm/processInstance/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,8 @@ export const getFormFieldsPermission = async (params: any) => {
102102
export const getProcessInstanceBpmnModelView = async (id: string) => {
103103
return await request.get({ url: '/bpm/process-instance/get-bpmn-model-view?id=' + id })
104104
}
105+
106+
// 获取下一个执行的流程节点
107+
export const getNextFlowNodes = async (params: any) => {
108+
return await request.get({ url: '/bpm/process-instance/get-next-flow-nodes', params })
109+
}

src/components/SimpleProcessDesignerV2/src/consts.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ export enum CandidateStrategy {
162162
* 指定用户
163163
*/
164164
USER = 30,
165+
/**
166+
* 审批人自选
167+
*/
168+
APPROVE_USER_SELECT = 34,
165169
/**
166170
* 发起人自选
167171
*/
@@ -542,6 +546,7 @@ export const CANDIDATE_STRATEGY: DictDataVO[] = [
542546
{ label: '连续多级部门负责人', value: CandidateStrategy.MULTI_LEVEL_DEPT_LEADER },
543547
{ label: '指定岗位', value: CandidateStrategy.MULTI_LEVEL_DEPT_LEADER },
544548
{ label: '发起人自选', value: CandidateStrategy.START_USER_SELECT },
549+
{ label: '审批人自选', value: CandidateStrategy.APPROVE_USER_SELECT },
545550
{ label: '发起人本人', value: CandidateStrategy.START_USER },
546551
{ label: '发起人部门负责人', value: CandidateStrategy.START_USER_DEPT_LEADER },
547552
{ label: '发起人连续部门负责人', value: CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER },

src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -718,29 +718,31 @@ const closePopover = (type: string, formRef: FormInstance | undefined) => {
718718
const initNextAssigneesFormField = async () => {
719719
// 获取修改的流程变量, 暂时只支持流程表单
720720
const variables = getUpdatedProcessInstanceVariables()
721-
const data = await ProcessInstanceApi.getApprovalDetail({
721+
const data = await ProcessInstanceApi.getNextFlowNodes({
722722
processInstanceId: props.processInstance.id,
723+
taskId: runningTask.value.id,
723724
processVariablesStr: JSON.stringify(variables)
724725
})
725-
726-
const activityId = data.todoTask?.taskDefinitionKey
727-
if (data.activityNodes && data.activityNodes.length > 0) {
728-
// 找到当前节点的索引
729-
const currentNodeIndex = data.activityNodes.findIndex((node: any) => node.id === activityId)
730-
const nextNode = data.activityNodes[currentNodeIndex + 1]
731-
// 情况一:发起人选择审批人:此时一般是因为条件发生变化,需要当前审批人补充选择
732-
if (
733-
nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
734-
!nextNode.tasks &&
735-
nextNode.candidateUsers?.length === 0
736-
) {
737-
// 自选审批人,则弹出选择审批人弹窗
738-
// TODO @小北:需要考虑下,这里的 nextNode 可能是多个节点,需要怎么处理;类似你在后端的处理哈
739-
// TODO @小北:有点纠结,是不是写个预测下一个节点的接口,更合适?
740-
nextAssigneesActivityNode.value = [nextNode]
726+
if (data && data.length > 0) {
727+
data.forEach((node: any) => {
728+
if (
729+
node.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
730+
node.candidateUsers && node.task
731+
) {
732+
nextAssigneesActivityNode.value.push(node)
733+
}
734+
})
735+
if (nextAssigneesActivityNode.value.length > 0) {
741736
nextAssigneesVisible.value = true
742737
}
743-
// TODO @小北:情况二:审批人选择的情况
738+
739+
// // 自选审批人,则弹出选择审批人弹窗
740+
// // TODO @小北:需要考虑下,这里的 nextNode 可能是多个节点,需要怎么处理;类似你在后端的处理哈
741+
// // TODO @小北:有点纠结,是不是写个预测下一个节点的接口,更合适?
742+
// nextAssigneesActivityNode.value = [nextNode]
743+
// nextAssigneesVisible.value = true
744+
// }
745+
// // TODO @小北:情况二:审批人选择的情况
744746
}
745747
}
746748

0 commit comments

Comments
 (0)