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 }) 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) => { export const approveTask = async (data) => {
return await request.put({ url: '/bpm/task/approve', data }) return await request.put({ url: '/bpm/task/approve', data })
} }
@ -23,13 +19,6 @@ export const approveTask = async (data) => {
export const rejectTask = async (data) => { export const rejectTask = async (data) => {
return await request.put({ url: '/bpm/task/reject', 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) => { export const getTaskListByProcessInstanceId = async (processInstanceId) => {
return await request.get({ 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) => { export const getTaskListByReturn = async (id: string) => {
return await request.get({ url: '/bpm/task/list-by-return', params: { id } }) 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 }) return await request.put({ url: '/bpm/task/return', data })
} }
/** // 委派
* export const delegateTask = async (data: any) => {
*/
export const delegateTask = async (data) => {
return await request.put({ url: '/bpm/task/delegate', data }) 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"> <label v-if="item.durationInMillis" style="font-weight: normal; color: #8a909c">
{{ formatPast2(item?.durationInMillis) }} {{ formatPast2(item?.durationInMillis) }}
</label> </label>
<p v-if="item.reason"> <p v-if="item.reason"> 审批建议{{ item.reason }} </p>
<el-tag :type="getTimelineItemType(item)">{{ item.reason }}</el-tag>
</p>
</el-card> </el-card>
</el-timeline-item> </el-timeline-item>
</el-timeline> </el-timeline>

View File

@ -37,10 +37,12 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // const formLoading = ref(false) //
const formData = ref({ const formData = ref({
id: '', id: '',
delegateUserId: undefined delegateUserId: undefined,
reason: ''
}) })
const formRules = ref({ 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 const formRef = ref() // Ref
@ -79,7 +81,8 @@ const submitForm = async () => {
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: '', id: '',
delegateUserId: undefined delegateUserId: undefined,
reason: ''
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

View File

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

View File

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

View File

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