Skip to content

Commit 145eabb

Browse files
committed
【工作流】- 新审批界面按钮权限
1 parent 2d16816 commit 145eabb

File tree

3 files changed

+73
-176
lines changed

3 files changed

+73
-176
lines changed

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

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
<template>
22
<div
33
class="h-50px bottom-10 text-14px flex items-center color-#32373c dark:color-#fff font-bold btn-container"
4+
v-if="runningTask.id"
45
>
5-
<el-popover :visible="passVisible" placement="top-end" :width="500" trigger="click">
6+
<el-popover
7+
:visible="passVisible"
8+
placement="top-end"
9+
:width="500"
10+
trigger="click"
11+
v-if="isShowButton(OperationButtonType.APPROVE)"
12+
>
613
<template #reference>
714
<el-button plain type="success" @click="openPopover('1')">
8-
<Icon icon="ep:select" />&nbsp; 通过
15+
<Icon icon="ep:select" />&nbsp; {{ getButtonDisplayName(OperationButtonType.APPROVE) }}
916
</el-button>
1017
</template>
1118
<div class="flex flex-col flex-1 pt-20px px-20px" v-loading="formLoading">
@@ -50,17 +57,23 @@
5057

5158
<el-form-item>
5259
<el-button :disabled="formLoading" type="success" @click="handleAudit(true)">
53-
通过
60+
{{ getButtonDisplayName(OperationButtonType.APPROVE) }}
5461
</el-button>
5562
<el-button @click="passVisible = false"> 取消 </el-button>
5663
</el-form-item>
5764
</el-form>
5865
</div>
5966
</el-popover>
60-
<el-popover :visible="rejectVisible" placement="top-end" :width="500" trigger="click">
67+
<el-popover
68+
:visible="rejectVisible"
69+
placement="top-end"
70+
:width="500"
71+
trigger="click"
72+
v-if="isShowButton(OperationButtonType.REJECT)"
73+
>
6174
<template #reference>
6275
<el-button class="mr-20px" plain type="danger" @click="openPopover('2')">
63-
<Icon icon="ep:close" />&nbsp; 拒绝
76+
<Icon icon="ep:close" />&nbsp; {{ getButtonDisplayName(OperationButtonType.REJECT) }}
6477
</el-button>
6578
</template>
6679
<div class="flex flex-col flex-1 pt-20px px-20px" v-loading="formLoading">
@@ -105,20 +118,26 @@
105118

106119
<el-form-item>
107120
<el-button :disabled="formLoading" type="danger" @click="handleAudit(false)">
108-
拒绝
121+
{{ getButtonDisplayName(OperationButtonType.REJECT) }}
109122
</el-button>
110123
<el-button @click="rejectVisible = false"> 取消 </el-button>
111124
</el-form-item>
112125
</el-form>
113126
</div>
114127
</el-popover>
115128
<div @click="handleSend"> <Icon :size="14" icon="svg-icon:send" />&nbsp;抄送 </div>
116-
<div @click="openTaskUpdateAssigneeForm">
117-
<Icon :size="14" icon="fa:share-square-o" />&nbsp;转交
129+
<div @click="openTaskUpdateAssigneeForm" v-if="isShowButton(OperationButtonType.TRANSFER)">
130+
<Icon :size="14" icon="fa:share-square-o" />&nbsp;{{ getButtonDisplayName(OperationButtonType.TRANSFER) }}
131+
</div>
132+
<div @click="handleDelegate" v-if="isShowButton(OperationButtonType.DELEGATE)">
133+
<Icon :size="14" icon="ep:position" />&nbsp;{{ getButtonDisplayName(OperationButtonType.DELEGATE) }}
134+
</div>
135+
<div @click="handleSign" v-if="isShowButton(OperationButtonType.ADD_SIGN)">
136+
<Icon :size="14" icon="ep:plus" />&nbsp;{{ getButtonDisplayName(OperationButtonType.ADD_SIGN) }}
137+
</div>
138+
<div @click="handleBack" v-if="isShowButton(OperationButtonType.RETURN)">
139+
<Icon :size="14" icon="fa:mail-reply" />&nbsp;{{ getButtonDisplayName(OperationButtonType.RETURN) }}
118140
</div>
119-
<div @click="handleDelegate"> <Icon :size="14" icon="ep:position" />&nbsp;委派 </div>
120-
<div @click="handleSign"> <Icon :size="14" icon="ep:plus" />&nbsp;加签 </div>
121-
<div @click="handleBack"> <Icon :size="14" icon="fa:mail-reply" />&nbsp;退回 </div>
122141
</div>
123142
<!-- </div> -->
124143
<!-- 弹窗:转派审批人 -->
@@ -141,7 +160,10 @@ import TaskDelegateForm from './dialog/TaskDelegateForm.vue'
141160
import TaskTransferForm from './dialog/TaskTransferForm.vue'
142161
import TaskSignCreateForm from './dialog/TaskSignCreateForm.vue'
143162
import { isEmpty } from '@/utils/is'
144-
163+
import {
164+
OperationButtonType,
165+
OPERATION_BUTTON_NAME
166+
} from '@/components/SimpleProcessDesignerV2/src/consts'
145167
defineOptions({ name: 'ProcessInstanceBtnConatiner' })
146168
147169
const userId = useUserStore().getUser.id // 当前登录的编号
@@ -290,6 +312,24 @@ const getDetail = () => {
290312
emit('success')
291313
}
292314
315+
/** 是否显示按钮 */
316+
const isShowButton = (btnType: OperationButtonType): boolean => {
317+
let isShow = true
318+
if (runningTask.value.buttonsSetting && runningTask.value.buttonsSetting[btnType]) {
319+
isShow = runningTask.value.buttonsSetting[btnType].enable
320+
}
321+
return isShow
322+
}
323+
324+
/** 获取按钮的显示名称 */
325+
const getButtonDisplayName = (btnType: OperationButtonType) => {
326+
let diaplayName = OPERATION_BUTTON_NAME.get(btnType)
327+
if (runningTask.value.buttonsSetting && runningTask.value.buttonsSetting[btnType]) {
328+
diaplayName = runningTask.value.buttonsSetting[btnType].displayName
329+
}
330+
return diaplayName
331+
}
332+
293333
defineExpose({ loadRunningTask })
294334
</script>
295335

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

Lines changed: 8 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -207,168 +207,14 @@ const getApprovalNodeTime = (node: ProcessInstanceApi.ApprovalNodeInfo) => {
207207
}
208208
}
209209
210-
const mockData: any = [
211-
{
212-
id: 'fe1190ee-68c3-11ef-9c7d-00a6181404fd',
213-
name: '发起人',
214-
createTime: 1725237646192,
215-
endTime: null,
216-
durationInMillis: null,
217-
status: 1,
218-
reason: null,
219-
ownerUser: null,
220-
assigneeUser: {
221-
id: 104,
222-
nickname: '测试号',
223-
deptId: 107,
224-
deptName: '运维部门'
225-
},
226-
taskDefinitionKey: 'task-01',
227-
processInstanceId: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
228-
processInstance: {
229-
id: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
230-
name: 'oa_leave',
231-
createTime: null,
232-
processDefinitionId: 'oa_leave:1:6e5ac269-5f87-11ef-bdb6-00a6181404fd',
233-
startUser: null
234-
},
235-
parentTaskId: null,
236-
children: null,
237-
formId: null,
238-
formName: null,
239-
formConf: null,
240-
formFields: null,
241-
formVariables: null
242-
},
243-
{
244-
id: 'fe1190ee-68c3-11ef-9c7d-00a6181404fd',
245-
name: '领导审批',
246-
createTime: 1725237646192,
247-
endTime: null,
248-
durationInMillis: null,
249-
status: 2,
250-
reason: null,
251-
ownerUser: null,
252-
assigneeUser: {
253-
id: 104,
254-
nickname: '领导',
255-
deptId: 107,
256-
deptName: '运维部门'
257-
},
258-
taskDefinitionKey: 'task-01',
259-
processInstanceId: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
260-
processInstance: {
261-
id: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
262-
name: 'oa_leave',
263-
createTime: null,
264-
processDefinitionId: 'oa_leave:1:6e5ac269-5f87-11ef-bdb6-00a6181404fd',
265-
startUser: null
266-
},
267-
parentTaskId: null,
268-
children: null,
269-
formId: null,
270-
formName: null,
271-
formConf: null,
272-
formFields: null,
273-
formVariables: null
274-
},
275-
{
276-
id: 'fe1190ee-68c3-11ef-9c7d-00a6181404fd',
277-
name: '财务总监审核',
278-
createTime: 1725237646192,
279-
endTime: null,
280-
durationInMillis: null,
281-
status: 3,
282-
reason: null,
283-
ownerUser: null,
284-
assigneeUser: {
285-
id: 104,
286-
nickname: '财务总监',
287-
deptId: 107,
288-
deptName: '运维部门'
289-
},
290-
taskDefinitionKey: 'task-01',
291-
processInstanceId: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
292-
processInstance: {
293-
id: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
294-
name: 'oa_leave',
295-
createTime: null,
296-
processDefinitionId: 'oa_leave:1:6e5ac269-5f87-11ef-bdb6-00a6181404fd',
297-
startUser: null
298-
},
299-
parentTaskId: null,
300-
children: null,
301-
formId: null,
302-
formName: null,
303-
formConf: null,
304-
formFields: null,
305-
formVariables: null
306-
},
307-
{
308-
id: 'fe1190ee-68c3-11ef-9c7d-00a6181404fd',
309-
name: '领导审批',
310-
createTime: 1725237646192,
311-
endTime: null,
312-
durationInMillis: null,
313-
status: 2,
314-
reason: null,
315-
ownerUser: null,
316-
assigneeUser: {
317-
id: 104,
318-
nickname: '领导',
319-
deptId: 107,
320-
deptName: '运维部门'
321-
},
322-
taskDefinitionKey: 'task-01',
323-
processInstanceId: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
324-
processInstance: {
325-
id: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
326-
name: 'oa_leave',
327-
createTime: null,
328-
processDefinitionId: 'oa_leave:1:6e5ac269-5f87-11ef-bdb6-00a6181404fd',
329-
startUser: null
330-
},
331-
parentTaskId: null,
332-
children: null,
333-
formId: null,
334-
formName: null,
335-
formConf: null,
336-
formFields: null,
337-
formVariables: null
338-
},
339-
{
340-
id: 'fe1190ee-68c3-11ef-9c7d-00a6181404fd',
341-
name: '财务总监审核',
342-
createTime: 1725237646192,
343-
endTime: null,
344-
durationInMillis: null,
345-
status: 3,
346-
reason: null,
347-
ownerUser: null,
348-
assigneeUser: {
349-
id: 104,
350-
nickname: '财务总监',
351-
deptId: 107,
352-
deptName: '运维部门'
353-
},
354-
taskDefinitionKey: 'task-01',
355-
processInstanceId: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
356-
processInstance: {
357-
id: 'fe0c60c6-68c3-11ef-9c7d-00a6181404fd',
358-
name: 'oa_leave',
359-
createTime: null,
360-
processDefinitionId: 'oa_leave:1:6e5ac269-5f87-11ef-bdb6-00a6181404fd',
361-
startUser: null
362-
},
363-
parentTaskId: null,
364-
children: null,
365-
formId: null,
366-
formName: null,
367-
formConf: null,
368-
formFields: null,
369-
formVariables: null
370-
}
371-
]
210+
/**
211+
* 重新刷新审批详情
212+
*/
213+
const refresh = () => {
214+
getApprovalDetail()
215+
}
216+
217+
defineExpose({ refresh })
372218
373219
onMounted(async () => {
374220
getApprovalDetail()

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</el-col>
5959
<el-col :span="6">
6060
<!-- 审批记录时间线 -->
61-
<ProcessInstanceTimeline :process-instance-id="id" />
61+
<ProcessInstanceTimeline ref="timelineRef" :process-instance-id="id" />
6262
</el-col>
6363
</el-row>
6464
</el-scrollbar>
@@ -97,7 +97,7 @@
9797
ref="operationButtonRef"
9898
:processInstance="processInstance"
9999
:userOptions="userOptions"
100-
@success="getDetail"
100+
@success="refresh"
101101
/>
102102
</div>
103103
</el-scrollbar>
@@ -133,6 +133,7 @@ const message = useMessage() // 消息弹窗
133133
const processInstanceLoading = ref(false) // 流程实例的加载中
134134
const processInstance = ref<any>({}) // 流程实例
135135
const operationButtonRef = ref()
136+
const timelineRef = ref()
136137
const bpmnXml = ref('') // BPMN XML
137138
const tasksLoad = ref(true) // 任务的加载中
138139
const tasks = ref<any[]>([]) // 任务列表
@@ -260,6 +261,16 @@ const getTaskList = async () => {
260261
}
261262
}
262263
264+
/**
265+
* 操作成功后刷新
266+
*/
267+
const refresh = () => {
268+
// 重新获取详情
269+
getDetail()
270+
// 刷新审批详情 Timeline
271+
timelineRef.value?.refresh();
272+
}
273+
263274
/** 当前的Tab */
264275
const activeTab = ref('form')
265276

0 commit comments

Comments
 (0)