44
44
:rows =" 4"
45
45
/>
46
46
</el-form-item >
47
- <el-form-item label =" 下一个节点的审批人" prop =" nextAssignees" v-if =" nextAssigneesVisible " >
47
+ <el-form-item label =" 下一个节点的审批人" prop =" nextAssignees" v-if =" nextAssigneesActivityNode.length > 0 " >
48
48
<div class =" ml-10px -mt-15px -mb-35px" >
49
49
<ProcessInstanceTimeline
50
50
:activity-nodes =" nextAssigneesActivityNode"
@@ -522,6 +522,7 @@ import { BpmModelFormType, BpmProcessInstanceStatus } from '@/utils/constants'
522
522
import type { FormInstance , FormRules } from ' element-plus'
523
523
import SignDialog from ' ./SignDialog.vue'
524
524
import ProcessInstanceTimeline from ' ../detail/ProcessInstanceTimeline.vue'
525
+ import { isEmpty } from ' @/utils/is'
525
526
526
527
defineOptions ({ name: ' ProcessInstanceBtnContainer' })
527
528
@@ -565,7 +566,6 @@ const reasonRequire = ref()
565
566
const approveFormRef = ref <FormInstance >()
566
567
const signRef = ref ()
567
568
const approveSignFormRef = ref ()
568
- const nextAssigneesVisible = ref (false ) // 是否显示下一个节点的审批人
569
569
const nextAssigneesActivityNode = ref <ProcessInstanceApi .ApprovalNodeInfo []>([]) // 下一个审批节点信息
570
570
const approveReasonForm = reactive ({
571
571
reason: ' ' ,
@@ -711,7 +711,7 @@ const closePopover = (type: string, formRef: FormInstance | undefined) => {
711
711
formRef .resetFields ()
712
712
}
713
713
popOverVisible .value [type ] = false
714
- nextAssigneesVisible .value = false
714
+ nextAssigneesActivityNode .value = []
715
715
}
716
716
717
717
/** 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
@@ -726,23 +726,14 @@ const initNextAssigneesFormField = async () => {
726
726
if (data && data .length > 0 ) {
727
727
data .forEach ((node : any ) => {
728
728
if (
729
- node .candidateStrategy === CandidateStrategy .START_USER_SELECT &&
730
- node .candidateUsers && node .task
729
+ isEmpty (node .tasks ) &&
730
+ isEmpty (node .candidateUsers ) &&
731
+ (CandidateStrategy .START_USER_SELECT === node .candidateStrategy ||
732
+ CandidateStrategy .APPROVE_USER_SELECT === node .candidateStrategy )
731
733
) {
732
734
nextAssigneesActivityNode .value .push (node )
733
735
}
734
736
})
735
- if (nextAssigneesActivityNode .value .length > 0 ) {
736
- nextAssigneesVisible .value = true
737
- }
738
-
739
- // // 自选审批人,则弹出选择审批人弹窗
740
- // // TODO @小北:需要考虑下,这里的 nextNode 可能是多个节点,需要怎么处理;类似你在后端的处理哈
741
- // // TODO @小北:有点纠结,是不是写个预测下一个节点的接口,更合适?
742
- // nextAssigneesActivityNode.value = [nextNode]
743
- // nextAssigneesVisible.value = true
744
- // }
745
- // // TODO @小北:情况二:审批人选择的情况
746
737
}
747
738
}
748
739
@@ -767,7 +758,8 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
767
758
768
759
if (pass ) {
769
760
// 如果需要自选审批人,则校验自选审批人
770
- if (nextAssigneesVisible .value && Object .keys (approveReasonForm .nextAssignees ).length === 0 ) {
761
+ if (Object .keys (nextAssigneesActivityNode .value ).length > 0
762
+ && Object .keys (approveReasonForm .nextAssignees ).length === 0 ) {
771
763
message .warning (' 下一个节点的审批人不能为空!' )
772
764
return
773
765
}
@@ -793,7 +785,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
793
785
}
794
786
await TaskApi .approveTask (data )
795
787
popOverVisible .value .approve = false
796
- nextAssigneesVisible .value = false
788
+ nextAssigneesActivityNode .value = []
797
789
message .success (' 审批通过成功' )
798
790
} else {
799
791
// 审批不通过数据
0 commit comments