Skip to content

Commit 619491b

Browse files
committed
【代码评审】工作流:新审批界面
1 parent dd4c481 commit 619491b

File tree

3 files changed

+90
-55
lines changed

3 files changed

+90
-55
lines changed

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

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
class="h-50px bottom-10 text-14px flex items-center color-#32373c dark:color-#fff font-bold btn-container"
44
v-if="runningTask.id"
55
>
6+
<!-- 【通过】按钮 -->
67
<el-popover
78
:visible="passVisible"
89
placement="top-end"
@@ -15,6 +16,7 @@
1516
<Icon icon="ep:select" />&nbsp; {{ getButtonDisplayName(OperationButtonType.APPROVE) }}
1617
</el-button>
1718
</template>
19+
<!-- 审批表单 -->
1820
<div class="flex flex-col flex-1 pt-20px px-20px" v-loading="formLoading">
1921
<el-form
2022
label-position="top"
@@ -64,6 +66,8 @@
6466
</el-form>
6567
</div>
6668
</el-popover>
69+
70+
<!-- 【拒绝】按钮 -->
6771
<el-popover
6872
:visible="rejectVisible"
6973
placement="top-end"
@@ -76,6 +80,7 @@
7680
<Icon icon="ep:close" />&nbsp; {{ getButtonDisplayName(OperationButtonType.REJECT) }}
7781
</el-button>
7882
</template>
83+
<!-- 审批表单 -->
7984
<div class="flex flex-col flex-1 pt-20px px-20px" v-loading="formLoading">
8085
<el-form
8186
label-position="top"
@@ -125,21 +130,39 @@
125130
</el-form>
126131
</div>
127132
</el-popover>
133+
134+
<!-- 【抄送】按钮 -->
128135
<div @click="handleSend"> <Icon :size="14" icon="svg-icon:send" />&nbsp;抄送 </div>
136+
137+
<!-- 【转交】按钮 -->
129138
<div @click="openTaskUpdateAssigneeForm" v-if="isShowButton(OperationButtonType.TRANSFER)">
130-
<Icon :size="14" icon="fa:share-square-o" />&nbsp;{{ getButtonDisplayName(OperationButtonType.TRANSFER) }}
139+
<Icon :size="14" icon="fa:share-square-o" />&nbsp;
140+
{{ getButtonDisplayName(OperationButtonType.TRANSFER) }}
131141
</div>
142+
143+
<!-- 【委托】按钮 -->
132144
<div @click="handleDelegate" v-if="isShowButton(OperationButtonType.DELEGATE)">
133-
<Icon :size="14" icon="ep:position" />&nbsp;{{ getButtonDisplayName(OperationButtonType.DELEGATE) }}
145+
<Icon :size="14" icon="ep:position" />&nbsp;
146+
{{ getButtonDisplayName(OperationButtonType.DELEGATE) }}
134147
</div>
148+
149+
<!-- 【加签】 -->
135150
<div @click="handleSign" v-if="isShowButton(OperationButtonType.ADD_SIGN)">
136-
<Icon :size="14" icon="ep:plus" />&nbsp;{{ getButtonDisplayName(OperationButtonType.ADD_SIGN) }}
151+
<Icon :size="14" icon="ep:plus" />&nbsp;
152+
{{ getButtonDisplayName(OperationButtonType.ADD_SIGN) }}
137153
</div>
154+
<!-- TODO @jason:减签 -->
155+
156+
<!-- 【退回】按钮 -->
138157
<div @click="handleBack" v-if="isShowButton(OperationButtonType.RETURN)">
139-
<Icon :size="14" icon="fa:mail-reply" />&nbsp;{{ getButtonDisplayName(OperationButtonType.RETURN) }}
158+
<Icon :size="14" icon="fa:mail-reply" />&nbsp;
159+
{{ getButtonDisplayName(OperationButtonType.RETURN) }}
140160
</div>
161+
162+
<!--TODO @jason:撤回 -->
163+
<!--TODO @jason:再次发起 -->
141164
</div>
142-
<!-- </div> -->
165+
143166
<!-- 弹窗:转派审批人 -->
144167
<TaskTransferForm ref="taskTransferFormRef" @success="getDetail" />
145168
<!-- 弹窗:回退节点 -->
@@ -149,7 +172,6 @@
149172
<!-- 弹窗:加签,当前任务审批人为A,向前加签选了一个C,则需要C先审批,然后再是A审批,向后加签B,A审批完,需要B再审批完,才算完成这个任务节点 -->
150173
<TaskSignCreateForm ref="taskSignCreateFormRef" @success="getDetail" />
151174
</template>
152-
153175
<script lang="ts" setup>
154176
import { setConfAndFields2 } from '@/utils/formCreate'
155177
import { useUserStore } from '@/store/modules/user'
@@ -198,15 +220,17 @@ watch(
198220
deep: true
199221
}
200222
)
223+
224+
// TODO @jaosn:具体的审批任务,要不改成后端返回。让前端弱化下
201225
/**
202226
* 设置 runningTasks 中的任务
203227
*/
204-
const loadRunningTask = (tasks) => {
228+
const loadRunningTask = (tasks: any[]) => {
205229
runningTask.value = {}
206230
auditForm.value = {}
207231
approveForm.value = {}
208232
approveFormFApi.value = {}
209-
tasks.forEach((task) => {
233+
tasks.forEach((task: any) => {
210234
if (!isEmpty(task.children)) {
211235
loadRunningTask(task.children)
212236
}
@@ -237,7 +261,7 @@ const loadRunningTask = (tasks) => {
237261
}
238262
239263
/** 处理审批通过和不通过的操作 */
240-
const handleAudit = async (pass) => {
264+
const handleAudit = async (pass: any) => {
241265
formLoading.value = true
242266
try {
243267
const auditFormRef = proxy.$refs['formRef']
@@ -277,6 +301,7 @@ const handleAudit = async (pass) => {
277301
/* 抄送 TODO */
278302
const handleSend = () => {}
279303
304+
// TODO 代码优化:这里 flag 改成 approve: boolean 。因为 flag 目前就只有 1 和 2
280305
const openPopover = (flag) => {
281306
passVisible.value = false
282307
rejectVisible.value = false
@@ -323,11 +348,11 @@ const isShowButton = (btnType: OperationButtonType): boolean => {
323348
324349
/** 获取按钮的显示名称 */
325350
const getButtonDisplayName = (btnType: OperationButtonType) => {
326-
let diaplayName = OPERATION_BUTTON_NAME.get(btnType)
351+
let displayName = OPERATION_BUTTON_NAME.get(btnType)
327352
if (runningTask.value.buttonsSetting && runningTask.value.buttonsSetting[btnType]) {
328-
diaplayName = runningTask.value.buttonsSetting[btnType].displayName
353+
displayName = runningTask.value.buttonsSetting[btnType].displayName
329354
}
330-
return diaplayName
355+
return displayName
331356
}
332357
333358
defineExpose({ loadRunningTask })

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

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
<!-- 审批详情的右侧:审批流 -->
12
<template>
23
<el-timeline class="pt-20px">
4+
<!-- 遍历每个审批节点 -->
35
<el-timeline-item
46
v-for="(activity, index) in approveNodes"
57
:key="index"
@@ -10,25 +12,28 @@
1012
<div class="flex flex-col items-start">
1113
<div class="font-bold"> {{ activity.name }}</div>
1214
<div class="flex items-center mt-1">
15+
<!-- 情况一:遍历每个审批节点下的【进行中】task 任务 -->
1316
<div v-for="(task, idx) in activity.tasks" :key="idx" class="flex items-center">
1417
<div class="flex items-center flex-col pr-2">
1518
<div class="position-relative" v-if="task.assigneeUser || task.ownerUser">
19+
<!-- 信息:头像 -->
1620
<el-avatar
1721
:size="36"
1822
v-if="task.assigneeUser && task.assigneeUser.avatar"
1923
:src="task.assigneeUser.avatar"
2024
/>
2125
<el-avatar v-else-if="task.assigneeUser && task.assigneeUser.nickname">
22-
{{ task.assigneeUser.nickname.substring(0, 1) }}</el-avatar
23-
>
26+
{{ task.assigneeUser.nickname.substring(0, 1) }}
27+
</el-avatar>
2428
<el-avatar
2529
v-else-if="task.ownerUser && task.ownerUser.avatar"
2630
:src="task.ownerUser.avatar"
2731
/>
2832
<el-avatar v-else-if="task.ownerUser && task.ownerUser.nickname">
29-
{{ task.ownerUser.nickname.substring(0, 1) }}</el-avatar
30-
>
31-
<div
33+
{{ task.ownerUser.nickname.substring(0, 1) }}
34+
</el-avatar>
35+
<!-- 信息:任务 ICON -->
36+
<div
3237
class="position-absolute top-26px left-26px bg-#fff rounded-full flex items-center p-2px"
3338
>
3439
<Icon
@@ -39,32 +44,38 @@
3944
</div>
4045
</div>
4146
<div class="flex flex-col mt-1">
47+
<!-- 信息:昵称 -->
4248
<div
4349
v-if="task.assigneeUser && task.assigneeUser.nickname"
4450
class="text-10px text-align-center"
45-
>{{ task.assigneeUser.nickname }}</div
4651
>
52+
{{ task.assigneeUser.nickname }}
53+
</div>
4754
<div
4855
v-else-if="task.ownerUser && task.ownerUser.nickname"
4956
class="text-10px text-align-center"
5057
>
51-
{{ task.ownerUser.nickname }}</div
52-
>
58+
{{ task.ownerUser.nickname }}
59+
</div>
60+
<!-- TODO @jason:审批意见,要展示哈。 -->
5361
<!-- <div v-if="task.reason" :title="task.reason" class="text-13px text-truncate w-150px mt-1"> 审批意见: {{ task.reason }}</div> -->
5462
</div>
5563
</div>
5664
</div>
65+
<!-- 情况二:遍历每个审批节点下的【候选的】task 任务。例如说,1)依次审批,2)未来的审批任务等 -->
5766
<div
5867
v-for="(user, idx1) in activity.candidateUserList"
5968
:key="idx1"
6069
class="flex items-center"
6170
>
6271
<div class="flex items-center flex-col pr-2">
6372
<div class="position-relative">
73+
<!-- 信息:头像 -->
6474
<el-avatar :size="36" v-if="user.avatar" :src="user.avatar" />
6575
<el-avatar v-else-if="user.nickname && user.nickname">
66-
{{ user.nickname.substring(0, 1) }}</el-avatar
67-
>
76+
{{ user.nickname.substring(0, 1) }}
77+
</el-avatar>
78+
<!-- 信息:任务 ICON -->
6879
<div
6980
class="position-absolute top-26px left-26px bg-#fff rounded-full flex items-center p-2px"
7081
>
@@ -76,18 +87,24 @@
7687
</div>
7788
</div>
7889
<div class="flex flex-col mt-1">
79-
<div v-if="user.nickname" class="text-10px text-align-center">{{
80-
user.nickname
81-
}}</div>
90+
<!-- 信息:昵称 -->
91+
<div v-if="user.nickname" class="text-10px text-align-center">
92+
{{ user.nickname }}
93+
</div>
8294
<!-- <div v-if="task.reason" :title="task.reason" class="text-13px text-truncate w-150px mt-1"> 审批意见: {{ task.reason }}</div> -->
8395
</div>
8496
</div>
8597
</div>
8698
</div>
87-
<div v-if="activity.status !== TaskStatusEnum.NOT_START" class="text-#a5a5a5 text-13px mt-1">
99+
<!-- 信息:时间 -->
100+
<div
101+
v-if="activity.status !== TaskStatusEnum.NOT_START"
102+
class="text-#a5a5a5 text-13px mt-1"
103+
>
88104
{{ getApprovalNodeTime(activity) }}
89105
</div>
90-
106+
107+
<!-- TODO @jason:审批意见,要展示哈。 -->
91108
<!-- <div class="color-#a1a6ae text-12px mb-10px"> {{ activity.assigneeUser.nickname }}</div>
92109
<div v-if="activity.opinion" class="text-#a5a5a5 text-12px w-100%">
93110
<div class="mb-5px">审批意见:</div>
@@ -136,7 +153,7 @@ const statusIconMap2 = {
136153
// 待审批
137154
'0': { color: '#e5e7ec', icon: 'ep:loading' },
138155
// 审批中
139-
'1': { color: '#448ef7', icon: 'ep:loading'},
156+
'1': { color: '#448ef7', icon: 'ep:loading' },
140157
// 审批通过
141158
'2': { color: '#00b32a', icon: 'ep:circle-check-filled' },
142159
// 审批不通过
@@ -148,8 +165,7 @@ const statusIconMap2 = {
148165
// 委派中
149166
'6': { color: '#448ef7', icon: 'ep:loading' },
150167
// 审批通过中
151-
'7': { color: '#00b32a', icon: 'ep:circle-check-filled' },
152-
168+
'7': { color: '#00b32a', icon: 'ep:circle-check-filled' }
153169
}
154170
155171
const statusIconMap = {
@@ -165,11 +181,11 @@ const statusIconMap = {
165181
// 已取消
166182
'4': { color: '#cccccc', icon: Delete },
167183
// 回退
168-
'5' : { color: '#f46b6c', icon: Minus },
184+
'5': { color: '#f46b6c', icon: Minus },
169185
// 委派中
170186
'6': { color: '#448ef7', icon: Loading },
171187
// 审批通过中
172-
'7': { color: '#00b32a', icon: Check },
188+
'7': { color: '#00b32a', icon: Check }
173189
}
174190
175191
/** 获得审批详情 */
@@ -181,42 +197,37 @@ const getApprovalDetail = async () => {
181197
approveNodes.value = data.approveNodes
182198
}
183199
184-
const getApprovalNodeIcon = (taskStatus: number , nodeType: NodeType) => {
185-
186-
if(taskStatus == TaskStatusEnum.NOT_START) {
200+
const getApprovalNodeIcon = (taskStatus: number, nodeType: NodeType) => {
201+
if (taskStatus == TaskStatusEnum.NOT_START) {
187202
return statusIconMap[taskStatus]?.icon
188203
}
189204
190205
if (nodeType === NodeType.START_USER_NODE || nodeType === NodeType.USER_TASK_NODE) {
191206
return statusIconMap[taskStatus]?.icon
192207
}
193-
194208
}
195209
196210
const getApprovalNodeColor = (taskStatus: number) => {
197211
return statusIconMap[taskStatus]?.color
198212
}
199213
200214
const getApprovalNodeTime = (node: ProcessInstanceApi.ApprovalNodeInfo) => {
201-
202-
if(node.endTime) {
215+
if (node.endTime) {
203216
return `结束时间:${formatDate(node.endTime)}`
204217
}
205-
if(node.startTime) {
218+
if (node.startTime) {
206219
return `创建时间:${formatDate(node.startTime)}`
207220
}
208221
}
209222
210-
/**
211-
* 重新刷新审批详情
212-
*/
213-
const refresh = () => {
223+
/** 重新刷新审批详情 */
224+
const refresh = () => {
214225
getApprovalDetail()
215226
}
216227
217228
defineExpose({ refresh })
218229
219230
onMounted(async () => {
220-
getApprovalDetail()
231+
await getApprovalDetail()
221232
})
222233
</script>

0 commit comments

Comments
 (0)