44
44
:rows =" 4"
45
45
/>
46
46
</el-form-item >
47
- <el-form-item label =" 下一个节点的审批人" prop =" nextAssignees" v-if =" nextAssigneesActivityNode.length > 0" >
47
+ <el-form-item
48
+ label =" 下一个节点的审批人"
49
+ prop =" nextAssignees"
50
+ v-if =" nextAssigneesActivityNode.length > 0"
51
+ >
48
52
<div class =" ml-10px -mt-15px -mb-35px" >
49
53
<ProcessInstanceTimeline
50
54
:activity-nodes =" nextAssigneesActivityNode"
@@ -725,11 +729,12 @@ const initNextAssigneesFormField = async () => {
725
729
})
726
730
if (data && data .length > 0 ) {
727
731
data .forEach ((node : any ) => {
732
+ // 如果是发起人自选,并且没有审批人 或者 是审批人自选
728
733
if (
729
- isEmpty (node .tasks ) &&
730
- isEmpty (node .candidateUsers ) &&
731
- ( CandidateStrategy .START_USER_SELECT === node .candidateStrategy ||
732
- CandidateStrategy .APPROVE_USER_SELECT === node .candidateStrategy )
734
+ ( isEmpty (node .tasks ) &&
735
+ isEmpty (node .candidateUsers ) &&
736
+ CandidateStrategy .START_USER_SELECT === node .candidateStrategy ) ||
737
+ CandidateStrategy .APPROVE_USER_SELECT === node .candidateStrategy
733
738
) {
734
739
nextAssigneesActivityNode .value .push (node )
735
740
}
@@ -741,6 +746,20 @@ const initNextAssigneesFormField = async () => {
741
746
const selectNextAssigneesConfirm = (id : string , userList : any []) => {
742
747
approveReasonForm .nextAssignees [id ] = userList ?.map ((item : any ) => item .id )
743
748
}
749
+ /** 审批通过时,校验每个自选审批人的节点是否都已配置了审批人 */
750
+ const validateNextAssignees = () => {
751
+ // 如果需要自选审批人,则校验自选审批人
752
+ if (Object .keys (nextAssigneesActivityNode .value ).length > 0 ) {
753
+ // 校验每个节点是否都已配置审批人
754
+ for (const item of nextAssigneesActivityNode .value ) {
755
+ if (isEmpty (approveReasonForm .nextAssignees [item .id ])) {
756
+ message .warning (' 下一个节点的审批人不能为空!' )
757
+ return false
758
+ }
759
+ }
760
+ }
761
+ return true
762
+ }
744
763
745
764
/** 处理审批通过和不通过的操作 */
746
765
const handleAudit = async (pass : boolean , formRef : FormInstance | undefined ) => {
@@ -757,12 +776,8 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
757
776
}
758
777
759
778
if (pass ) {
760
- // 如果需要自选审批人,则校验自选审批人
761
- if (Object .keys (nextAssigneesActivityNode .value ).length > 0
762
- && Object .keys (approveReasonForm .nextAssignees ).length === 0 ) {
763
- message .warning (' 下一个节点的审批人不能为空!' )
764
- return
765
- }
779
+ const nextAssigneesValid = validateNextAssignees ()
780
+ if (! nextAssigneesValid ) return
766
781
const variables = getUpdatedProcessInstanceVariables ()
767
782
// 审批通过数据
768
783
const data = {
0 commit comments