Skip to content

Commit a40866e

Browse files
committed
BPM:完善 task 转派的实现
1 parent 60ddc45 commit a40866e

File tree

6 files changed

+40
-46
lines changed

6 files changed

+40
-46
lines changed

src/api/bpm/task/index.ts

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,20 @@ export const getDoneTaskPage = async (params) => {
1212
return await request.get({ url: '/bpm/task/done-page', params })
1313
}
1414

15-
export const completeTask = async (data) => {
16-
return await request.put({ url: '/bpm/task/complete', data })
17-
}
18-
1915
export const approveTask = async (data) => {
2016
return await request.put({ url: '/bpm/task/approve', data })
2117
}
2218

2319
export const rejectTask = async (data) => {
2420
return await request.put({ url: '/bpm/task/reject', data })
2521
}
26-
export const backTask = async (data) => {
27-
return await request.put({ url: '/bpm/task/back', data })
28-
}
29-
30-
export const updateTaskAssignee = async (data) => {
31-
return await request.put({ url: '/bpm/task/update-assignee', data })
32-
}
3322

3423
export const getTaskListByProcessInstanceId = async (processInstanceId) => {
3524
return await request.get({
3625
url: '/bpm/task/list-by-process-instance-id?processInstanceId=' + processInstanceId
3726
})
3827
}
3928

40-
// 导出任务
41-
export const exportTask = async (params) => {
42-
return await request.download({ url: '/bpm/task/export', params })
43-
}
44-
4529
// 获取所有可回退的节点
4630
export const getTaskListByReturn = async (id: string) => {
4731
return await request.get({ url: '/bpm/task/list-by-return', params: { id } })
@@ -52,13 +36,16 @@ export const returnTask = async (data: any) => {
5236
return await request.put({ url: '/bpm/task/return', data })
5337
}
5438

55-
/**
56-
* 委派
57-
*/
58-
export const delegateTask = async (data) => {
39+
// 委派
40+
export const delegateTask = async (data: any) => {
5941
return await request.put({ url: '/bpm/task/delegate', data })
6042
}
6143

44+
// 转派
45+
export const transferTask = async (data: any) => {
46+
return await request.put({ url: '/bpm/task/transfer', data })
47+
}
48+
6249
/**
6350
* 加签
6451
*/

src/views/bpm/processInstance/detail/ProcessInstanceTaskList.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
<label v-if="item.durationInMillis" style="font-weight: normal; color: #8a909c">
4545
{{ formatPast2(item?.durationInMillis) }}
4646
</label>
47-
<p v-if="item.reason">
48-
<el-tag :type="getTimelineItemType(item)">{{ item.reason }}</el-tag>
49-
</p>
47+
<p v-if="item.reason"> 审批建议:{{ item.reason }} </p>
5048
</el-card>
5149
</el-timeline-item>
5250
</el-timeline>

src/views/bpm/processInstance/detail/TaskDelegateForm.vue renamed to src/views/bpm/processInstance/detail/dialog/TaskDelegateForm.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ const dialogVisible = ref(false) // 弹窗的是否展示
3737
const formLoading = ref(false) // 表单的加载中
3838
const formData = ref({
3939
id: '',
40-
delegateUserId: undefined
40+
delegateUserId: undefined,
41+
reason: ''
4142
})
4243
const formRules = ref({
43-
delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }]
44+
delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }],
45+
reason: [{ required: true, message: '委派理由不能为空', trigger: 'blur' }]
4446
})
4547
4648
const formRef = ref() // 表单 Ref
@@ -79,7 +81,8 @@ const submitForm = async () => {
7981
const resetForm = () => {
8082
formData.value = {
8183
id: '',
82-
delegateUserId: undefined
84+
delegateUserId: undefined,
85+
reason: ''
8386
}
8487
formRef.value?.resetFields()
8588
}

src/views/bpm/processInstance/detail/TaskReturnDialogForm.vue renamed to src/views/bpm/processInstance/detail/dialog/TaskReturnForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Dialog v-model="dialogVisible" title="回退" width="500">
2+
<Dialog v-model="dialogVisible" title="回退任务" width="500">
33
<el-form
44
ref="formRef"
55
v-loading="formLoading"

src/views/bpm/processInstance/detail/TaskUpdateAssigneeForm.vue renamed to src/views/bpm/processInstance/detail/dialog/TaskTransferForm.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Dialog v-model="dialogVisible" title="转派审批人" width="500">
2+
<Dialog v-model="dialogVisible" title="转派任务" width="500">
33
<el-form
44
ref="formRef"
55
v-loading="formLoading"
@@ -17,6 +17,9 @@
1717
/>
1818
</el-select>
1919
</el-form-item>
20+
<el-form-item label="转派理由" prop="reason">
21+
<el-input v-model="formData.reason" clearable placeholder="请输入转派理由" />
22+
</el-form-item>
2023
</el-form>
2124
<template #footer>
2225
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
@@ -28,16 +31,18 @@
2831
import * as TaskApi from '@/api/bpm/task'
2932
import * as UserApi from '@/api/system/user'
3033
31-
defineOptions({ name: 'BpmTaskUpdateAssigneeForm' })
34+
defineOptions({ name: 'TaskTransferForm' })
3235
3336
const dialogVisible = ref(false) // 弹窗的是否展示
3437
const formLoading = ref(false) // 表单的加载中
3538
const formData = ref({
3639
id: '',
37-
assigneeUserId: undefined
40+
assigneeUserId: undefined,
41+
reason: ''
3842
})
3943
const formRules = ref({
40-
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }]
44+
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }],
45+
reason: [{ required: true, message: '转派理由不能为空', trigger: 'blur' }]
4146
})
4247
4348
const formRef = ref() // 表单 Ref
@@ -63,7 +68,7 @@ const submitForm = async () => {
6368
// 提交请求
6469
formLoading.value = true
6570
try {
66-
await TaskApi.updateTaskAssignee(formData.value)
71+
await TaskApi.transferTask(formData.value)
6772
dialogVisible.value = false
6873
// 发送操作成功的事件
6974
emit('success')
@@ -76,7 +81,8 @@ const submitForm = async () => {
7681
const resetForm = () => {
7782
formData.value = {
7883
id: '',
79-
assigneeUserId: undefined
84+
assigneeUserId: undefined,
85+
reason: ''
8086
}
8187
formRef.value?.resetFields()
8288
}

src/views/bpm/processInstance/detail/index.vue

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@
104104
/>
105105

106106
<!-- 弹窗:转派审批人 -->
107-
<TaskUpdateAssigneeForm ref="taskUpdateAssigneeFormRef" @success="getDetail" />
108-
<!-- 弹窗回退节点 -->
109-
<TaskReturnDialog ref="taskReturnDialogRef" @success="getDetail" />
110-
<!-- 委派,将任务委派给别人处理,处理完成后,会重新回到原审批人手中-->
107+
<TaskTransferForm ref="taskTransferFormRef" @success="getDetail" />
108+
<!-- 弹窗回退节点 -->
109+
<TaskReturnForm ref="taskReturnFormRef" @success="getDetail" />
110+
<!-- 弹窗:委派,将任务委派给别人处理,处理完成后,会重新回到原审批人手中-->
111111
<TaskDelegateForm ref="taskDelegateForm" @success="getDetail" />
112-
<!-- 加签,当前任务审批人为A,向前加签选了一个C,则需要C先审批,然后再是A审批,向后加签B,A审批完,需要B再审批完,才算完成这个任务节点 -->
112+
<!-- 弹窗:加签,当前任务审批人为A,向前加签选了一个C,则需要C先审批,然后再是A审批,向后加签B,A审批完,需要B再审批完,才算完成这个任务节点 -->
113113
<TaskAddSignDialogForm ref="taskAddSignDialogForm" @success="getDetail" />
114114
</ContentWrap>
115115
</template>
@@ -120,11 +120,11 @@ import type { ApiAttrs } from '@form-create/element-ui/types/config'
120120
import * as DefinitionApi from '@/api/bpm/definition'
121121
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
122122
import * as TaskApi from '@/api/bpm/task'
123-
import TaskUpdateAssigneeForm from './TaskUpdateAssigneeForm.vue'
124123
import ProcessInstanceBpmnViewer from './ProcessInstanceBpmnViewer.vue'
125124
import ProcessInstanceTaskList from './ProcessInstanceTaskList.vue'
126-
import TaskReturnDialog from './TaskReturnDialogForm.vue'
127-
import TaskDelegateForm from './TaskDelegateForm.vue'
125+
import TaskReturnForm from './dialog/TaskReturnForm.vue'
126+
import TaskDelegateForm from './dialog/TaskDelegateForm.vue'
127+
import TaskTransferForm from './dialog/TaskTransferForm.vue'
128128
import TaskAddSignDialogForm from './TaskAddSignDialogForm.vue'
129129
import { registerComponent } from '@/utils/routerHelper'
130130
import { isEmpty } from '@/utils/is'
@@ -187,9 +187,9 @@ const handleAudit = async (task, pass) => {
187187
}
188188
189189
/** 转派审批人 */
190-
const taskUpdateAssigneeFormRef = ref()
190+
const taskTransferFormRef = ref()
191191
const openTaskUpdateAssigneeForm = (id: string) => {
192-
taskUpdateAssigneeFormRef.value.open(id)
192+
taskTransferFormRef.value.open(id)
193193
}
194194
195195
/** 处理审批退回的操作 */
@@ -199,9 +199,9 @@ const handleDelegate = async (task) => {
199199
}
200200
201201
/** 处理审批退回的操作 */
202-
const taskReturnDialogRef = ref()
203-
const handleBack = async (task) => {
204-
taskReturnDialogRef.value.open(task.id)
202+
const taskReturnFormRef = ref()
203+
const handleBack = async (task: any) => {
204+
taskReturnFormRef.value.open(task.id)
205205
}
206206
207207
/** 处理审批加签的操作 */

0 commit comments

Comments
 (0)