From 8d8ada17514a73bb0e693082f145b576d3442da3 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Mar 2025 17:29:22 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91BPM=EF=BC=9A=E4=B8=8B=E4=B8=80=E4=B8=AA=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/UserTaskCustomConfig.vue | 29 ++++-- .../detail/ProcessInstanceOperationButton.vue | 94 +++++++++---------- .../bpm/processInstance/detail/index.vue | 2 + 3 files changed, 69 insertions(+), 56 deletions(-) diff --git a/src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTaskCustomConfig.vue b/src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTaskCustomConfig.vue index 74e070a0..3c748ff6 100644 --- a/src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTaskCustomConfig.vue +++ b/src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTaskCustomConfig.vue @@ -147,8 +147,9 @@ size="large" :label="FieldPermissionType.READ" @change="updateElementExtensions" - > + > + +
+ > + +
+ > + +
@@ -174,12 +177,22 @@ 是否需要签名 - + 审批意见 - + diff --git a/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue b/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue index 137d91bd..9e6dbc69 100644 --- a/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue +++ b/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue @@ -44,17 +44,14 @@ :rows="4" /> - - + +
+ +
{{ getButtonDisplayName(OperationButtonType.APPROVE) }} - 取消 + 取消 @@ -123,7 +120,7 @@ > {{ getButtonDisplayName(OperationButtonType.REJECT) }} - 取消 + 取消
@@ -181,7 +178,7 @@ {{ getButtonDisplayName(OperationButtonType.COPY) }} - 取消 + 取消 @@ -233,7 +230,7 @@ {{ getButtonDisplayName(OperationButtonType.TRANSFER) }} - 取消 + 取消 @@ -285,7 +282,7 @@ {{ getButtonDisplayName(OperationButtonType.DELEGATE) }} - 取消 + 取消 @@ -340,7 +337,7 @@ 向后{{ getButtonDisplayName(OperationButtonType.ADD_SIGN) }} - 取消 + 取消 @@ -391,7 +388,7 @@ 减签 - 取消 + 取消 @@ -443,7 +440,7 @@ {{ getButtonDisplayName(OperationButtonType.RETURN) }} - 取消 + 取消 @@ -487,7 +484,7 @@ 确认 - 取消 + 取消 @@ -562,14 +559,14 @@ const runningTask = ref() // 运行中的任务 const approveForm = ref({}) // 审批通过时,额外的补充信息 const approveFormFApi = ref({}) // approveForms 的 fAPi const nodeTypeName = ref('审批') // 节点类型名称 -const activityNodes = ref([]) // 审批节点信息 -const dialogVisibleSelectApproveUser = ref(false) // 是否显示节点审批人选择框 // 审批通过意见表单 const reasonRequire = ref() const approveFormRef = ref() const signRef = ref() const approveSignFormRef = ref() +const nextAssigneesVisible = ref(false) // 是否显示下一个节点的审批人 +const nextAssigneesActivityNode = ref([]) // 下一个审批节点信息 const approveReasonForm = reactive({ reason: '', signPicUrl: '', @@ -584,6 +581,7 @@ const approveReasonRule = computed(() => { nextAssignees: [{ required: true, message: '审批人不能为空', trigger: 'blur' }] } }) + // 拒绝表单 const rejectFormRef = ref() const rejectReasonForm = reactive({ @@ -681,11 +679,6 @@ watch( } ) -/** 选择下一个节点的审批人 */ -const selectUserConfirm = (id: string, userList: any[]) => { - approveReasonForm.nextAssignees[id] = userList?.map((item: any) => item.id) -} - /** 弹出气泡卡 */ const openPopover = async (type: string) => { if (type === 'approve') { @@ -695,7 +688,7 @@ const openPopover = async (type: string) => { message.warning('表单校验不通过,请先完善表单!!') return } - initNextTaskSelectAssigneeFormField() + initNextAssigneesFormField() } if (type === 'return') { // 获取退回节点 @@ -713,41 +706,49 @@ const openPopover = async (type: string) => { } /** 关闭气泡卡 */ -const closePropover = (type: string, formRef: FormInstance | undefined) => { +const closePopover = (type: string, formRef: FormInstance | undefined) => { if (formRef) { formRef.resetFields() } popOverVisible.value[type] = false - dialogVisibleSelectApproveUser.value = false + nextAssigneesVisible.value = false } -/** // 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */ -const initNextTaskSelectAssigneeFormField = async () => { +/** 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */ +const initNextAssigneesFormField = async () => { // 获取修改的流程变量, 暂时只支持流程表单 const variables = getUpdatedProcessInstanceVariables() - const param = { + const data = await ProcessInstanceApi.getApprovalDetail({ processInstanceId: props.processInstance.id, processVariablesStr: JSON.stringify(variables) - } - const res = await ProcessInstanceApi.getApprovalDetail(param) - //当前待审批节点id - const activityId = res.todoTask?.taskDefinitionKey - if (res.activityNodes && res.activityNodes.length > 0) { + }) + + const activityId = data.todoTask?.taskDefinitionKey + if (data.activityNodes && data.activityNodes.length > 0) { // 找到当前节点的索引 - const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId) - const nextNode = res.activityNodes[currentNodeIndex + 1] + const currentNodeIndex = data.activityNodes.findIndex((node: any) => node.id === activityId) + const nextNode = data.activityNodes[currentNodeIndex + 1] + // 情况一:发起人选择审批人:此时一般是因为条件发生变化,需要当前审批人补充选择 if ( nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT && !nextNode.tasks && nextNode.candidateUsers?.length === 0 ) { // 自选审批人,则弹出选择审批人弹窗 - activityNodes.value = [nextNode] - dialogVisibleSelectApproveUser.value = true + // TODO @小北:需要考虑下,这里的 nextNode 可能是多个节点,需要怎么处理;类似你在后端的处理哈 + // TODO @小北:有点纠结,是不是写个预测下一个节点的接口,更合适? + nextAssigneesActivityNode.value = [nextNode] + nextAssigneesVisible.value = true } + // TODO @小北:情况二:审批人选择的情况 } } +/** 选择下一个节点的审批人 */ +const selectNextAssigneesConfirm = (id: string, userList: any[]) => { + approveReasonForm.nextAssignees[id] = userList?.map((item: any) => item.id) +} + /** 处理审批通过和不通过的操作 */ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) => { formLoading.value = true @@ -764,10 +765,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) => if (pass) { // 如果需要自选审批人,则校验自选审批人 - if ( - dialogVisibleSelectApproveUser.value && - Object.keys(approveReasonForm.nextAssignees).length === 0 - ) { + if (nextAssigneesVisible.value && Object.keys(approveReasonForm.nextAssignees).length === 0) { message.warning('下一个节点的审批人不能为空!') return } @@ -778,7 +776,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) => reason: approveReasonForm.reason, variables, // 审批通过, 把修改的字段值赋于流程实例变量 nextAssignees: approveReasonForm.nextAssignees // 下个自选节点选择的审批人信息 - } + } as any // 签名 if (runningTask.value.signEnable) { data.signPicUrl = approveReasonForm.signPicUrl @@ -793,7 +791,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) => } await TaskApi.approveTask(data) popOverVisible.value.approve = false - dialogVisibleSelectApproveUser.value = false + nextAssigneesVisible.value = false message.success('审批通过成功') } else { // 审批不通过数据 diff --git a/src/views/bpm/processInstance/detail/index.vue b/src/views/bpm/processInstance/detail/index.vue index 46ecaaee..c3f83cf0 100644 --- a/src/views/bpm/processInstance/detail/index.vue +++ b/src/views/bpm/processInstance/detail/index.vue @@ -178,7 +178,9 @@ const writableFields: Array = [] // 表单可以编辑的字段 /** 获得详情 */ const getDetail = () => { + // 获得审批详情 getApprovalDetail() + // 获得流程模型视图 getProcessModelView() }