BPM:完善 task 转派的实现

This commit is contained in:
YunaiV 2024-03-18 20:45:39 +08:00
parent 60ddc45b9b
commit a40866e27f
6 changed files with 40 additions and 46 deletions

View File

@ -12,10 +12,6 @@ export const getDoneTaskPage = async (params) => {
return await request.get({ url: '/bpm/task/done-page', params })
}
export const completeTask = async (data) => {
return await request.put({ url: '/bpm/task/complete', data })
}
export const approveTask = async (data) => {
return await request.put({ url: '/bpm/task/approve', data })
}
@ -23,13 +19,6 @@ export const approveTask = async (data) => {
export const rejectTask = async (data) => {
return await request.put({ url: '/bpm/task/reject', data })
}
export const backTask = async (data) => {
return await request.put({ url: '/bpm/task/back', data })
}
export const updateTaskAssignee = async (data) => {
return await request.put({ url: '/bpm/task/update-assignee', data })
}
export const getTaskListByProcessInstanceId = async (processInstanceId) => {
return await request.get({
@ -37,11 +26,6 @@ export const getTaskListByProcessInstanceId = async (processInstanceId) => {
})
}
// 导出任务
export const exportTask = async (params) => {
return await request.download({ url: '/bpm/task/export', params })
}
// 获取所有可回退的节点
export const getTaskListByReturn = async (id: string) => {
return await request.get({ url: '/bpm/task/list-by-return', params: { id } })
@ -52,13 +36,16 @@ export const returnTask = async (data: any) => {
return await request.put({ url: '/bpm/task/return', data })
}
/**
*
*/
export const delegateTask = async (data) => {
// 委派
export const delegateTask = async (data: any) => {
return await request.put({ url: '/bpm/task/delegate', data })
}
// 转派
export const transferTask = async (data: any) => {
return await request.put({ url: '/bpm/task/transfer', data })
}
/**
*
*/

View File

@ -44,9 +44,7 @@
<label v-if="item.durationInMillis" style="font-weight: normal; color: #8a909c">
{{ formatPast2(item?.durationInMillis) }}
</label>
<p v-if="item.reason">
<el-tag :type="getTimelineItemType(item)">{{ item.reason }}</el-tag>
</p>
<p v-if="item.reason"> 审批建议{{ item.reason }} </p>
</el-card>
</el-timeline-item>
</el-timeline>

View File

@ -37,10 +37,12 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) //
const formData = ref({
id: '',
delegateUserId: undefined
delegateUserId: undefined,
reason: ''
})
const formRules = ref({
delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }]
delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }],
reason: [{ required: true, message: '委派理由不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
@ -79,7 +81,8 @@ const submitForm = async () => {
const resetForm = () => {
formData.value = {
id: '',
delegateUserId: undefined
delegateUserId: undefined,
reason: ''
}
formRef.value?.resetFields()
}

View File

@ -1,5 +1,5 @@
<template>
<Dialog v-model="dialogVisible" title="回退" width="500">
<Dialog v-model="dialogVisible" title="回退任务" width="500">
<el-form
ref="formRef"
v-loading="formLoading"

View File

@ -1,5 +1,5 @@
<template>
<Dialog v-model="dialogVisible" title="转派审批人" width="500">
<Dialog v-model="dialogVisible" title="转派任务" width="500">
<el-form
ref="formRef"
v-loading="formLoading"
@ -17,6 +17,9 @@
/>
</el-select>
</el-form-item>
<el-form-item label="转派理由" prop="reason">
<el-input v-model="formData.reason" clearable placeholder="请输入转派理由" />
</el-form-item>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
@ -28,16 +31,18 @@
import * as TaskApi from '@/api/bpm/task'
import * as UserApi from '@/api/system/user'
defineOptions({ name: 'BpmTaskUpdateAssigneeForm' })
defineOptions({ name: 'TaskTransferForm' })
const dialogVisible = ref(false) //
const formLoading = ref(false) //
const formData = ref({
id: '',
assigneeUserId: undefined
assigneeUserId: undefined,
reason: ''
})
const formRules = ref({
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }]
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }],
reason: [{ required: true, message: '转派理由不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
@ -63,7 +68,7 @@ const submitForm = async () => {
//
formLoading.value = true
try {
await TaskApi.updateTaskAssignee(formData.value)
await TaskApi.transferTask(formData.value)
dialogVisible.value = false
//
emit('success')
@ -76,7 +81,8 @@ const submitForm = async () => {
const resetForm = () => {
formData.value = {
id: '',
assigneeUserId: undefined
assigneeUserId: undefined,
reason: ''
}
formRef.value?.resetFields()
}

View File

@ -104,12 +104,12 @@
/>
<!-- 弹窗转派审批人 -->
<TaskUpdateAssigneeForm ref="taskUpdateAssigneeFormRef" @success="getDetail" />
<!-- 弹窗回退节点 -->
<TaskReturnDialog ref="taskReturnDialogRef" @success="getDetail" />
<!-- 委派将任务委派给别人处理处理完成后会重新回到原审批人手中-->
<TaskTransferForm ref="taskTransferFormRef" @success="getDetail" />
<!-- 弹窗回退节点 -->
<TaskReturnForm ref="taskReturnFormRef" @success="getDetail" />
<!-- 弹窗委派将任务委派给别人处理处理完成后会重新回到原审批人手中-->
<TaskDelegateForm ref="taskDelegateForm" @success="getDetail" />
<!-- 加签当前任务审批人为A向前加签选了一个C则需要C先审批然后再是A审批向后加签BA审批完需要B再审批完才算完成这个任务节点 -->
<!-- 弹窗加签当前任务审批人为A向前加签选了一个C则需要C先审批然后再是A审批向后加签BA审批完需要B再审批完才算完成这个任务节点 -->
<TaskAddSignDialogForm ref="taskAddSignDialogForm" @success="getDetail" />
</ContentWrap>
</template>
@ -120,11 +120,11 @@ import type { ApiAttrs } from '@form-create/element-ui/types/config'
import * as DefinitionApi from '@/api/bpm/definition'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import * as TaskApi from '@/api/bpm/task'
import TaskUpdateAssigneeForm from './TaskUpdateAssigneeForm.vue'
import ProcessInstanceBpmnViewer from './ProcessInstanceBpmnViewer.vue'
import ProcessInstanceTaskList from './ProcessInstanceTaskList.vue'
import TaskReturnDialog from './TaskReturnDialogForm.vue'
import TaskDelegateForm from './TaskDelegateForm.vue'
import TaskReturnForm from './dialog/TaskReturnForm.vue'
import TaskDelegateForm from './dialog/TaskDelegateForm.vue'
import TaskTransferForm from './dialog/TaskTransferForm.vue'
import TaskAddSignDialogForm from './TaskAddSignDialogForm.vue'
import { registerComponent } from '@/utils/routerHelper'
import { isEmpty } from '@/utils/is'
@ -187,9 +187,9 @@ const handleAudit = async (task, pass) => {
}
/** 转派审批人 */
const taskUpdateAssigneeFormRef = ref()
const taskTransferFormRef = ref()
const openTaskUpdateAssigneeForm = (id: string) => {
taskUpdateAssigneeFormRef.value.open(id)
taskTransferFormRef.value.open(id)
}
/** 处理审批退回的操作 */
@ -199,9 +199,9 @@ const handleDelegate = async (task) => {
}
/** 处理审批退回的操作 */
const taskReturnDialogRef = ref()
const handleBack = async (task) => {
taskReturnDialogRef.value.open(task.id)
const taskReturnFormRef = ref()
const handleBack = async (task: any) => {
taskReturnFormRef.value.open(task.id)
}
/** 处理审批加签的操作 */