fix: 流程再次发起,预测节点查询
This commit is contained in:
parent
c2e99fb427
commit
3b5a0ae290
@ -117,6 +117,7 @@ const activityNodes = ref<ProcessInstanceApi.ApprovalNodeInfo[]>([]) // 审批
|
|||||||
|
|
||||||
/** 设置表单信息、获取流程图数据 **/
|
/** 设置表单信息、获取流程图数据 **/
|
||||||
const initProcessInfo = async (row: any, formVariables?: any) => {
|
const initProcessInfo = async (row: any, formVariables?: any) => {
|
||||||
|
|
||||||
// 重置指定审批人
|
// 重置指定审批人
|
||||||
startUserSelectTasks.value = []
|
startUserSelectTasks.value = []
|
||||||
startUserSelectAssignees.value = {}
|
startUserSelectAssignees.value = {}
|
||||||
@ -138,9 +139,13 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
|
|||||||
await nextTick()
|
await nextTick()
|
||||||
fApi.value?.btn.show(false) // 隐藏提交按钮
|
fApi.value?.btn.show(false) // 隐藏提交按钮
|
||||||
|
|
||||||
// 获取流程审批信息
|
// 获取流程审批信息,当再次发起时,流程审批节点要根据原始表单参数预测出来
|
||||||
await getApprovalDetail(row)
|
const param = {
|
||||||
|
id: row.id,
|
||||||
|
processVariablesStr: JSON.stringify(formVariables)
|
||||||
|
}
|
||||||
|
await getApprovalDetail(param)
|
||||||
|
// }
|
||||||
// 加载流程图
|
// 加载流程图
|
||||||
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(row.id)
|
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(row.id)
|
||||||
if (processDefinitionDetail) {
|
if (processDefinitionDetail) {
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
:rows="4"
|
:rows="4"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="下一个节点的审批人" prop="nextAssignees" v-if="nextAssigneesVisible">
|
<el-form-item label="下一个节点的审批人" prop="nextAssignees" v-if="nextAssigneesActivityNode.length > 0">
|
||||||
<div class="ml-10px -mt-15px -mb-35px">
|
<div class="ml-10px -mt-15px -mb-35px">
|
||||||
<ProcessInstanceTimeline
|
<ProcessInstanceTimeline
|
||||||
:activity-nodes="nextAssigneesActivityNode"
|
:activity-nodes="nextAssigneesActivityNode"
|
||||||
@ -522,6 +522,7 @@ import { BpmModelFormType, BpmProcessInstanceStatus } from '@/utils/constants'
|
|||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import SignDialog from './SignDialog.vue'
|
import SignDialog from './SignDialog.vue'
|
||||||
import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
|
import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
|
||||||
|
import { isEmpty } from '@/utils/is'
|
||||||
|
|
||||||
defineOptions({ name: 'ProcessInstanceBtnContainer' })
|
defineOptions({ name: 'ProcessInstanceBtnContainer' })
|
||||||
|
|
||||||
@ -565,7 +566,6 @@ const reasonRequire = ref()
|
|||||||
const approveFormRef = ref<FormInstance>()
|
const approveFormRef = ref<FormInstance>()
|
||||||
const signRef = ref()
|
const signRef = ref()
|
||||||
const approveSignFormRef = ref()
|
const approveSignFormRef = ref()
|
||||||
const nextAssigneesVisible = ref(false) // 是否显示下一个节点的审批人
|
|
||||||
const nextAssigneesActivityNode = ref<ProcessInstanceApi.ApprovalNodeInfo[]>([]) // 下一个审批节点信息
|
const nextAssigneesActivityNode = ref<ProcessInstanceApi.ApprovalNodeInfo[]>([]) // 下一个审批节点信息
|
||||||
const approveReasonForm = reactive({
|
const approveReasonForm = reactive({
|
||||||
reason: '',
|
reason: '',
|
||||||
@ -711,7 +711,7 @@ const closePopover = (type: string, formRef: FormInstance | undefined) => {
|
|||||||
formRef.resetFields()
|
formRef.resetFields()
|
||||||
}
|
}
|
||||||
popOverVisible.value[type] = false
|
popOverVisible.value[type] = false
|
||||||
nextAssigneesVisible.value = false
|
nextAssigneesActivityNode.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
|
/** 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
|
||||||
@ -726,23 +726,14 @@ const initNextAssigneesFormField = async () => {
|
|||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
data.forEach((node: any) => {
|
data.forEach((node: any) => {
|
||||||
if (
|
if (
|
||||||
node.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
|
isEmpty(node.tasks) &&
|
||||||
node.candidateUsers && node.task
|
isEmpty(node.candidateUsers) &&
|
||||||
|
(CandidateStrategy.START_USER_SELECT === node.candidateStrategy ||
|
||||||
|
CandidateStrategy.APPROVE_USER_SELECT === node.candidateStrategy)
|
||||||
) {
|
) {
|
||||||
nextAssigneesActivityNode.value.push(node)
|
nextAssigneesActivityNode.value.push(node)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (nextAssigneesActivityNode.value.length > 0) {
|
|
||||||
nextAssigneesVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// // 自选审批人,则弹出选择审批人弹窗
|
|
||||||
// // TODO @小北:需要考虑下,这里的 nextNode 可能是多个节点,需要怎么处理;类似你在后端的处理哈
|
|
||||||
// // TODO @小北:有点纠结,是不是写个预测下一个节点的接口,更合适?
|
|
||||||
// nextAssigneesActivityNode.value = [nextNode]
|
|
||||||
// nextAssigneesVisible.value = true
|
|
||||||
// }
|
|
||||||
// // TODO @小北:情况二:审批人选择的情况
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +758,8 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
|
|||||||
|
|
||||||
if (pass) {
|
if (pass) {
|
||||||
// 如果需要自选审批人,则校验自选审批人
|
// 如果需要自选审批人,则校验自选审批人
|
||||||
if (nextAssigneesVisible.value && Object.keys(approveReasonForm.nextAssignees).length === 0) {
|
if (Object.keys(nextAssigneesActivityNode.value).length > 0
|
||||||
|
&& Object.keys(approveReasonForm.nextAssignees).length === 0) {
|
||||||
message.warning('下一个节点的审批人不能为空!')
|
message.warning('下一个节点的审批人不能为空!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -793,7 +785,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
|
|||||||
}
|
}
|
||||||
await TaskApi.approveTask(data)
|
await TaskApi.approveTask(data)
|
||||||
popOverVisible.value.approve = false
|
popOverVisible.value.approve = false
|
||||||
nextAssigneesVisible.value = false
|
nextAssigneesActivityNode.value = []
|
||||||
message.success('审批通过成功')
|
message.success('审批通过成功')
|
||||||
} else {
|
} else {
|
||||||
// 审批不通过数据
|
// 审批不通过数据
|
||||||
|
Loading…
Reference in New Issue
Block a user