From 92314ee9457ad6f9f6f0548780d286b93bd92073 Mon Sep 17 00:00:00 2001
From: GoldenZqqq <1361001127@qq.com>
Date: Wed, 6 Nov 2024 17:17:44 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=AE=9A=E4=B9=89=E9=80=89?=
=?UTF-8?q?=E6=8B=A9=E5=AE=A1=E6=89=B9=E4=BA=BA=E9=80=BB=E8=BE=91TODO?=
=?UTF-8?q?=EF=BC=8C=E9=80=89=E6=8B=A9=E7=94=A8=E6=88=B7=E5=BC=B9=E7=AA=97?=
=?UTF-8?q?=E7=BB=98=E5=88=B6=E4=B8=8E=E9=80=89=E6=8B=A9=E4=BA=A4=E4=BA=92?=
=?UTF-8?q?=E9=80=BB=E8=BE=91=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/UserSelectForm/index.vue | 92 +++++++++++++++++++
.../create/ProcessDefinitionDetail.vue | 50 +++++-----
src/views/bpm/processInstance/create/mock.ts | 86 +++++++++++++++++
.../detail/ProcessInstanceTimeline.vue | 26 +++++-
4 files changed, 228 insertions(+), 26 deletions(-)
create mode 100644 src/components/UserSelectForm/index.vue
create mode 100644 src/views/bpm/processInstance/create/mock.ts
diff --git a/src/components/UserSelectForm/index.vue b/src/components/UserSelectForm/index.vue
new file mode 100644
index 00000000..2dc94587
--- /dev/null
+++ b/src/components/UserSelectForm/index.vue
@@ -0,0 +1,92 @@
+
+
+
+
diff --git a/src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue b/src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue
index 35044965..442cfffc 100644
--- a/src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue
+++ b/src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue
@@ -20,7 +20,7 @@
:option="detailForm.option"
@submit="submitForm"
>
-
+
@@ -61,7 +61,7 @@
ref="timelineRef"
:activity-nodes="activityNodes"
:show-status-icon="false"
- candidateField="candidateUserList"
+ :startUserSelectTasks="startUserSelectTasks"
/>
@@ -104,7 +104,8 @@ import type { ApiAttrs } from '@form-create/element-ui/types/config'
import { useTagsViewStore } from '@/store/modules/tagsView'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import * as DefinitionApi from '@/api/bpm/definition'
-import * as UserApi from '@/api/system/user'
+// import * as UserApi from '@/api/system/user'
+import { activityNodes as aN, startUserSelectTasks as sUs } from './mock'
defineOptions({ name: 'ProcessDefinitionDetail' })
const props = defineProps<{
@@ -125,7 +126,7 @@ const startUserSelectAssigneesFormRef = ref() // 发起人选择审批人的表
const startUserSelectTasks: any = ref([]) // 发起人需要选择审批人的用户任务列表
const startUserSelectAssignees = ref({}) // 发起人选择审批人的数据
const startUserSelectAssigneesFormRules = ref({}) // 发起人选择审批人的表单 Rules
-const userList = ref([]) // 用户列表
+// const userList = ref([]) // 用户列表
const bpmnXML: any = ref(null) // BPMN 数据
/** 当前的Tab */
const activeTab = ref('form')
@@ -163,25 +164,25 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
if (processDefinitionDetail) {
bpmnXML.value = processDefinitionDetail.bpmnXml
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
-
+ startUserSelectTasks.value = sUs
// 设置指定审批人
- if (startUserSelectTasks.value?.length > 0) {
- detailForm.value.rule.push({
- type: 'startUserSelect',
- props: {
- title: '指定审批人'
- }
- })
- // 设置校验规则
- for (const userTask of startUserSelectTasks.value) {
- startUserSelectAssignees.value[userTask.id] = []
- startUserSelectAssigneesFormRules.value[userTask.id] = [
- { required: true, message: '请选择审批人', trigger: 'blur' }
- ]
- }
- // 加载用户列表
- userList.value = await UserApi.getSimpleUserList()
- }
+ // if (startUserSelectTasks.value?.length > 0) {
+ // detailForm.value.rule.push({
+ // type: 'startUserSelect',
+ // props: {
+ // title: '指定审批人'
+ // }
+ // })
+ // // 设置校验规则
+ // for (const userTask of startUserSelectTasks.value) {
+ // startUserSelectAssignees.value[userTask.id] = []
+ // startUserSelectAssigneesFormRules.value[userTask.id] = [
+ // { required: true, message: '请选择审批人', trigger: 'blur' }
+ // ]
+ // }
+ // // 加载用户列表
+ // userList.value = await UserApi.getSimpleUserList()
+ // }
}
// 情况二:业务表单
} else if (row.formCustomCreatePath) {
@@ -205,6 +206,7 @@ const getApprovalDetail = async (row: any) => {
}
// 获取审批节点,显示 Timeline 的数据
activityNodes.value = data.activityNodes
+ activityNodes.value = aN
} finally {
}
}
@@ -250,7 +252,7 @@ defineExpose({ initProcessInfo })
$wrap-padding-height: 20px;
$wrap-margin-height: 15px;
$button-height: 51px;
-$process-header-height: 194px;
+$process-header-height: 105px;
.processInstance-wrap-main {
height: calc(
diff --git a/src/views/bpm/processInstance/create/mock.ts b/src/views/bpm/processInstance/create/mock.ts
new file mode 100644
index 00000000..2cb1394c
--- /dev/null
+++ b/src/views/bpm/processInstance/create/mock.ts
@@ -0,0 +1,86 @@
+import { ProcessInstanceVO, User, ApprovalTaskInfo, ApprovalNodeInfo } from '@/api/bpm/processInstance';
+import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
+
+const users: User[] = [
+ { id: 1, nickname: 'Alice', avatar: 'https://picsum.photos/200?r=1' },
+ { id: 2, nickname: 'Bob', avatar: 'https://picsum.photos/200?r=2' },
+ { id: 3, nickname: 'Charlie', avatar: 'https://picsum.photos/200?r=3' },
+ { id: 4, nickname: 'David', avatar: 'https://picsum.photos/200?r=4' }
+];
+
+const approvalTask1: ApprovalTaskInfo = {
+ id: 1,
+ ownerUser: users[0], // Alice is the owner (initiator)
+ assigneeUser: users[1], // Bob is the assignee
+ status: 1, // In Progress
+ reason: 'Please review and approve the request.'
+};
+
+const approvalTask2: ApprovalTaskInfo = {
+ id: 2,
+ ownerUser: users[1], // Bob is the owner (approver)
+ assigneeUser: users[2], // Charlie is the assignee
+ status: 0, // Pending approval
+ reason: 'Awaiting Bob’s decision.'
+};
+
+const approvalTask3: ApprovalTaskInfo = {
+ id: 3,
+ ownerUser: users[2], // Charlie is the owner (approver)
+ assigneeUser: users[3], // David is the assignee
+ status: 0, // Pending approval
+ reason: 'Awaiting Charlie’s decision.'
+};
+
+const approvalNode1: ApprovalNodeInfo = {
+ id: 101,
+ name: 'Start Review',
+ nodeType: NodeType.START_USER_NODE,
+ status: 1, // In Progress
+ startTime: new Date('2024-11-01T10:00:00Z'),
+ tasks: [approvalTask1]
+};
+
+const approvalNode2: ApprovalNodeInfo = {
+ id: 102,
+ name: 'First Review',
+ nodeType: NodeType.USER_TASK_NODE,
+ status: 0, // Pending approval
+ startTime: new Date('2024-11-01T11:00:00Z'),
+ tasks: [approvalTask2],
+ candidateUsers: [users[2], users[3]] // Candidate users: Charlie and David
+};
+
+const approvalNode3: ApprovalNodeInfo = {
+ id: 103,
+ name: 'Second Review',
+ nodeType: NodeType.USER_TASK_NODE,
+ status: 0, // Pending approval
+ startTime: new Date('2024-11-01T12:00:00Z'),
+ tasks: [approvalTask3],
+ candidateUsers: [users[1], users[3]] // Candidate users: Bob and David
+};
+
+const processInstance: ProcessInstanceVO = {
+ id: 1001,
+ name: 'Request Approval Process',
+ processDefinitionId: 'proc-2024-001',
+ category: 'Approval Process',
+ result: 0, // Ongoing
+ tasks: [{ id: '1', name: 'Start Review' }, { id: '2', name: 'First Review' }, { id: '3', name: 'Second Review' }],
+ fields: ['field1', 'field2'],
+ status: 1, // In Progress
+ remark: 'This is a sample approval process.',
+ businessKey: 'BUS-12345',
+ createTime: '2024-11-01T09:00:00Z',
+ endTime: '',
+ processDefinition: undefined // Not populated in this example
+};
+
+// 模拟的 activityNodes 数据,传递给 ProcessInstanceTimeline 组件
+const activityNodes: ApprovalNodeInfo[] = [approvalNode1, approvalNode2, approvalNode3];
+
+export { processInstance, activityNodes, users };
+
+
+export const startUserSelectTasks = users.map(user => ({id: user.id,name:user.nickname}))
diff --git a/src/views/bpm/processInstance/detail/ProcessInstanceTimeline.vue b/src/views/bpm/processInstance/detail/ProcessInstanceTimeline.vue
index 3eb071ed..1d3e7a1c 100644
--- a/src/views/bpm/processInstance/detail/ProcessInstanceTimeline.vue
+++ b/src/views/bpm/processInstance/detail/ProcessInstanceTimeline.vue
@@ -36,7 +36,15 @@
{{ getApprovalNodeTime(activity) }}
-