Skip to content

Commit 27d24cd

Browse files
committed
【工作流】- 流程实例新界面修改
1 parent 4680a7d commit 27d24cd

File tree

7 files changed

+498
-152
lines changed

7 files changed

+498
-152
lines changed

src/api/bpm/processInstance/index.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import request from '@/config/axios'
22
import { ProcessDefinitionVO } from '@/api/bpm/model'
3-
3+
import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
44
export type Task = {
55
id: string
66
name: string
@@ -22,6 +22,35 @@ export type ProcessInstanceVO = {
2222
processDefinition?: ProcessDefinitionVO
2323
}
2424

25+
// 用户信息
26+
export type User = {
27+
id: number,
28+
nickname: string,
29+
avatar: string
30+
}
31+
32+
// 审批任务信息
33+
export type ApprovalTaskInfo = {
34+
id: number,
35+
ownerUser: User,
36+
assigneeUser: User,
37+
status: number,
38+
reason: string
39+
40+
}
41+
42+
// 审批节点信息
43+
export type ApprovalNodeInfo = {
44+
id : number
45+
name: string
46+
nodeType: NodeType
47+
status: number
48+
startTime?: Date
49+
endTime?: Date
50+
candidateUserList?: User[]
51+
tasks: ApprovalTaskInfo[]
52+
}
53+
2554
export const getProcessInstanceMyPage = async (params: any) => {
2655
return await request.get({ url: '/bpm/process-instance/my-page', params })
2756
}
@@ -57,3 +86,8 @@ export const getProcessInstance = async (id: string) => {
5786
export const getProcessInstanceCopyPage = async (params: any) => {
5887
return await request.get({ url: '/bpm/process-instance/copy/page', params })
5988
}
89+
90+
export const getApprovalDetail = async (processInstanceId?:string, processDefinitionId?:string) => {
91+
const param = processInstanceId ? '?processInstanceId='+ processInstanceId : '?processDefinitionId='+ processDefinitionId
92+
return await request.get({ url: 'bpm/process-instance/get-approval-detail'+ param })
93+
}

src/api/bpm/task/index.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
11
import request from '@/config/axios'
22

3+
/**
4+
* 任务状态枚举
5+
*/
6+
export enum TaskStatusEnum {
7+
/**
8+
* 未开始
9+
*/
10+
NOT_START = -1,
11+
12+
/**
13+
* 待审批
14+
*/
15+
WAIT = 0,
16+
/**
17+
* 审批中
18+
*/
19+
RUNNING = 1,
20+
/**
21+
* 审批通过
22+
*/
23+
APPROVE = 2,
24+
25+
/**
26+
* 审批不通过
27+
*/
28+
REJECT = 3,
29+
30+
/**
31+
* 已取消
32+
*/
33+
CANCEL = 4,
34+
/**
35+
* 已退回
36+
*/
37+
RETURN = 5,
38+
/**
39+
* 委派中
40+
*/
41+
DELEGATE = 6,
42+
/**
43+
* 审批通过中
44+
*/
45+
APPROVING = 7,
46+
47+
}
48+
349
export type TaskVO = {
450
id: number
551
}

src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div class="simple-flow-canvas">
3-
<div class="simple-flow-container">
2+
<div class="simple-flow-canvas" v-loading="loading">
3+
<div class="simple-flow-container" >
44
<div class="top-area-container">
55
<div class="top-actions">
66
<div class="canvas-control">
@@ -15,7 +15,10 @@
1515
</div>
1616
</div>
1717
<div class="scale-container" :style="`transform: scale(${scaleValue / 100});`">
18-
<ProcessNodeTree v-if="processNodeTree" v-model:flow-node="processNodeTree" />
18+
<ProcessNodeTree
19+
v-if="processNodeTree"
20+
v-model:flow-node="processNodeTree"
21+
/>
1922
</div>
2023
</div>
2124
<Dialog v-model="errorDialogVisible" title="保存失败" width="400" :fullscreen="false">
@@ -46,6 +49,7 @@ import * as DeptApi from '@/api/system/dept'
4649
import * as PostApi from '@/api/system/post'
4750
import * as UserApi from '@/api/system/user'
4851
import * as UserGroupApi from '@/api/bpm/userGroup'
52+
import { fa } from 'element-plus/es/locale'
4953
defineOptions({
5054
name: 'SimpleProcessDesigner'
5155
})
@@ -56,7 +60,7 @@ const props = defineProps({
5660
required: true
5761
}
5862
})
59-
63+
const loading = ref(true)
6064
const formFields = ref<string[]>([])
6165
const formType = ref(20)
6266
const roleOptions = ref<RoleApi.RoleVO[]>([]) // 角色列表
@@ -163,44 +167,49 @@ const zoomIn = () => {
163167
}
164168
165169
onMounted(async () => {
166-
// 获取表单字段
167-
const bpmnModel = await getModel(props.modelId)
168-
if (bpmnModel) {
169-
formType.value = bpmnModel.formType
170-
if (formType.value === 10) {
171-
const bpmnForm = (await getForm(bpmnModel.formId)) as unknown as FormVO
172-
formFields.value = bpmnForm?.fields
170+
try {
171+
loading.value = true
172+
// 获取表单字段
173+
const bpmnModel = await getModel(props.modelId)
174+
if (bpmnModel) {
175+
formType.value = bpmnModel.formType
176+
if (formType.value === 10) {
177+
const bpmnForm = (await getForm(bpmnModel.formId)) as unknown as FormVO
178+
formFields.value = bpmnForm?.fields
179+
}
173180
}
174-
}
175-
// 获得角色列表
176-
roleOptions.value = await RoleApi.getSimpleRoleList()
177-
// 获得岗位列表
178-
postOptions.value = await PostApi.getSimplePostList()
179-
// 获得用户列表
180-
userOptions.value = await UserApi.getSimpleUserList()
181-
// 获得部门列表
182-
deptOptions.value = await DeptApi.getSimpleDeptList()
181+
// 获得角色列表
182+
roleOptions.value = await RoleApi.getSimpleRoleList()
183+
// 获得岗位列表
184+
postOptions.value = await PostApi.getSimplePostList()
185+
// 获得用户列表
186+
userOptions.value = await UserApi.getSimpleUserList()
187+
// 获得部门列表
188+
deptOptions.value = await DeptApi.getSimpleDeptList()
183189
184-
deptTreeOptions.value = handleTree(deptOptions.value as DeptApi.DeptVO[], 'id')
185-
// 获取用户组列表
186-
userGroupOptions.value = await UserGroupApi.getUserGroupSimpleList()
190+
deptTreeOptions.value = handleTree(deptOptions.value as DeptApi.DeptVO[], 'id')
191+
// 获取用户组列表
192+
userGroupOptions.value = await UserGroupApi.getUserGroupSimpleList()
187193
188-
// 获取 SIMPLE 设计器模型
189-
const result = await getBpmSimpleModel(props.modelId)
190-
if (result) {
191-
processNodeTree.value = result
192-
} else {
193-
// 初始值
194-
processNodeTree.value = {
195-
name: '发起人',
196-
type: NodeType.START_USER_NODE,
197-
id: NodeId.START_USER_NODE_ID,
198-
childNode: {
199-
id: NodeId.END_EVENT_NODE_ID,
200-
name: '结束',
201-
type: NodeType.END_EVENT_NODE
194+
// 获取 SIMPLE 设计器模型
195+
const result = await getBpmSimpleModel(props.modelId)
196+
if (result) {
197+
processNodeTree.value = result
198+
} else {
199+
// 初始值
200+
processNodeTree.value = {
201+
name: '发起人',
202+
type: NodeType.START_USER_NODE,
203+
id: NodeId.START_USER_NODE_ID,
204+
childNode: {
205+
id: NodeId.END_EVENT_NODE_ID,
206+
name: '结束',
207+
type: NodeType.END_EVENT_NODE
208+
}
202209
}
203210
}
211+
} finally {
212+
loading.value = false
204213
}
205214
})
206215
</script>

src/router/modules/remaining.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
292292
},
293293
{
294294
path: 'process-instance/detail',
295-
component: () => import('@/views/bpm/processInstance/detail/index.vue'),
295+
component: () => import('@/views/bpm/processInstance/detail/index_new.vue'),
296296
name: 'BpmProcessInstanceDetail',
297297
meta: {
298298
noCache: true,

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div
3-
class="h-50px position-fixed bottom-10 text-14px flex items-center color-#32373c dark:color-#fff font-bold btn-container"
3+
class="h-50px bottom-10 text-14px flex items-center color-#32373c dark:color-#fff font-bold btn-container"
44
>
55
<el-popover :visible="passVisible" placement="top-end" :width="500" trigger="click">
66
<template #reference>
@@ -120,6 +120,7 @@
120120
<div @click="handleSign"> <Icon :size="14" icon="ep:plus" />&nbsp;加签 </div>
121121
<div @click="handleBack"> <Icon :size="14" icon="fa:mail-reply" />&nbsp;退回 </div>
122122
</div>
123+
<!-- </div> -->
123124
<!-- 弹窗:转派审批人 -->
124125
<TaskTransferForm ref="taskTransferFormRef" @success="getDetail" />
125126
<!-- 弹窗:回退节点 -->
@@ -299,10 +300,11 @@ defineExpose({ loadRunningTask })
299300
300301
.btn-container {
301302
> div {
303+
display: flex;
302304
margin: 0 15px;
303305
cursor: pointer;
304-
display: flex;
305306
align-items: center;
307+
306308
&:hover {
307309
color: #6db5ff;
308310
}

0 commit comments

Comments
 (0)