feat: 增加案例流程,业务表单发起时选择审批人

This commit is contained in:
lizhixian 2025-03-21 10:24:16 +08:00
parent 4b554204a7
commit a5c533bff0

View File

@ -1,4 +1,5 @@
<template>
<ContentWrap :bodyStyle="{ padding: '10px 20px 0' }">
<el-row :gutter="20">
<el-col :span="16"
><el-form
@ -44,6 +45,7 @@
</el-form-item>
</el-form></el-col
>
<!-- 新增 ====== begin ======== -->
<el-col :span="8"
><!-- 流程时间线 -->
<ProcessInstanceTimeline
@ -53,18 +55,21 @@
@select-user-confirm="selectUserConfirm"
/>
</el-col>
<!-- 新增 ====== end ======== -->
</el-row>
</ContentWrap>
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as LeaveApi from '@/api/bpm/leave'
import { useTagsViewStore } from '@/store/modules/tagsView'
import * as DefinitionApi from '@/api/bpm/definition'
// ====== begin ========
import ProcessInstanceTimeline from '../../processInstance/detail/ProcessInstanceTimeline.vue'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import { CandidateStrategy, NodeId } from '@/components/SimpleProcessDesignerV2/src/consts'
import { ApprovalNodeInfo } from '@/api/bpm/processInstance'
// ====== end ========
defineOptions({ name: 'BpmOALeaveCreate' })
const message = useMessage() //
@ -90,10 +95,11 @@ const formRef = ref() // 表单 Ref
const processDefineKey = 'oa_leave' // Key
const startUserSelectTasks = ref([]) //
const startUserSelectAssignees = ref({}) //
// ====== begin ========
const tempStartUserSelectAssignees = ref({}) //
const activityNodes = ref<ProcessInstanceApi.ApprovalNodeInfo[]>([]) //
const processDefinitionId = ref('')
// ====== end ========
/** 提交表单 */
const submitForm = async () => {
//
@ -130,32 +136,14 @@ const submitForm = async () => {
}
}
/** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次 */
watch(
formData.value,
(newValue) => {
// if (newValue && Object.keys(newValue.value).length > 0) {
// //
// tempStartUserSelectAssignees.value = startUserSelectAssignees.value
// startUserSelectAssignees.value = {}
// //
// getApprovalDetail({
// id: processDefinitionId,
// processVariablesStr: JSON.stringify(newValue.value) // GET String JSON
// })
// }
},
{
immediate: true
}
)
// ====== begin ========
/** 获取审批详情 */
const getApprovalDetail = async (row: any) => {
try {
const data = await ProcessInstanceApi.getApprovalDetail({
processDefinitionId: row.id,
activityId: NodeId.START_USER_NODE_ID
activityId: NodeId.START_USER_NODE_ID,
processVariablesStr: row.processVariablesStr // GET String JSON
})
if (!data) {
@ -190,6 +178,7 @@ const getApprovalDetail = async (row: any) => {
const selectUserConfirm = (id: string, userList: any[]) => {
startUserSelectAssignees.value[id] = userList?.map((item: any) => item.id)
}
// ====== end ========
/** 初始化 */
onMounted(async () => {
@ -204,6 +193,36 @@ onMounted(async () => {
}
processDefinitionId.value = processDefinitionDetail.id
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
getApprovalDetail({ id: processDefinitionId.value, processVariablesStr: JSON.stringify(formData.value) })
// ====== begin ========
//
getApprovalDetail({
id: processDefinitionId.value,
processVariablesStr: JSON.stringify(formData.value)
})
// ====== end ========
})
// ====== begin ========
/** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次 */
watch(
formData.value,
(newValue, oldValue) => {
if (!oldValue) {
return
}
if (newValue && Object.keys(newValue).length > 0) {
//
tempStartUserSelectAssignees.value = startUserSelectAssignees.value
startUserSelectAssignees.value = {}
//
getApprovalDetail({
id: processDefinitionId.value,
processVariablesStr: JSON.stringify(newValue) // GET String JSON
})
}
},
{
immediate: true
}
// ====== end ========
)
</script>