Skip to content

Commit 81d2a38

Browse files
committed
【功能优化】发起人自选判断优化
1 parent 2aa2b46 commit 81d2a38

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

src/api/bpm/processInstance/index.ts

Lines changed: 2 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-
import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
3+
import { NodeType, CandidateStrategy } from '@/components/SimpleProcessDesignerV2/src/consts'
44
export type Task = {
55
id: string
66
name: string
@@ -43,6 +43,7 @@ export type ApprovalNodeInfo = {
4343
id: number
4444
name: string
4545
nodeType: NodeType
46+
candidateStrategy?: CandidateStrategy
4647
status: number
4748
startTime?: Date
4849
endTime?: Date

src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
ref="timelineRef"
3030
:activity-nodes="activityNodes"
3131
:show-status-icon="false"
32-
:startUserSelectTasks="startUserSelectTasks"
3332
:startUserSelectAssignees="startUserSelectAssignees"
3433
@select-user-confirm="selectUserConfirm"
3534
/>
@@ -78,6 +77,7 @@
7877
<script lang="ts" setup>
7978
import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
8079
import { BpmModelType } from '@/utils/constants'
80+
import { CandidateStrategy } from '@/components/SimpleProcessDesignerV2/src/consts'
8181
import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue'
8282
import ProcessInstanceSimpleViewer from '../detail/ProcessInstanceSimpleViewer.vue'
8383
import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
@@ -103,7 +103,7 @@ const detailForm: any = ref({
103103
}) // 流程表单详情
104104
const fApi = ref<ApiAttrs>()
105105
// 指定审批人
106-
const startUserSelectTasks: any = ref([]) // 发起人需要选择审批人的用户任务列表
106+
const startUserSelectTasks: any = ref([]) // 发起人需要选择审批人或抄送人的任务列表
107107
const startUserSelectAssignees = ref({}) // 发起人选择审批人的数据
108108
const bpmnXML: any = ref(null) // BPMN 数据
109109
const simpleJson = ref<string | undefined>() // Simple 设计器数据 json 格式
@@ -140,14 +140,6 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
140140
if (processDefinitionDetail) {
141141
bpmnXML.value = processDefinitionDetail.bpmnXml
142142
simpleJson.value = processDefinitionDetail.simpleModel
143-
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
144-
// 设置指定审批人
145-
if (startUserSelectTasks.value?.length > 0) {
146-
for (const userTask of startUserSelectTasks.value) {
147-
// 初始化数据
148-
startUserSelectAssignees.value[userTask.id] = []
149-
}
150-
}
151143
}
152144
// 情况二:业务表单
153145
} else if (row.formCustomCreatePath) {
@@ -169,6 +161,12 @@ const getApprovalDetail = async (row: any) => {
169161
message.error('查询不到审批详情信息!')
170162
return
171163
}
164+
// 获取发起人自选的任务
165+
startUserSelectTasks.value = data.activityNodes?.filter(node => CandidateStrategy.START_USER_SELECT === node.candidateStrategy )
166+
for (const node of startUserSelectTasks.value) {
167+
// 初始化数据
168+
startUserSelectAssignees.value[node.id] = []
169+
}
172170
// 获取审批节点,显示 Timeline 的数据
173171
activityNodes.value = data.activityNodes
174172
} finally {
@@ -187,7 +185,7 @@ const submitForm = async () => {
187185
Array.isArray(startUserSelectAssignees.value[userTask.id]) &&
188186
startUserSelectAssignees.value[userTask.id].length === 0
189187
)
190-
return message.warning(`请选择${userTask.name}的审批人`)
188+
return message.warning(`请选择${userTask.name}的候选人`)
191189
}
192190
}
193191

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939
<!-- 需要自定义选择审批人 -->
4040
<div
4141
class="flex flex-wrap gap2 items-center"
42-
v-if="
43-
startUserSelectTasks?.length > 0 && Array.isArray(startUserSelectAssignees[activity.id])
44-
"
42+
v-if="isEmpty(activity.tasks) && isEmpty(activity.candidateUsers) && CandidateStrategy.START_USER_SELECT === activity.candidateStrategy"
4543
>
4644
<!-- && activity.nodeType === NodeType.USER_TASK_NODE -->
4745
<el-button
@@ -156,7 +154,8 @@
156154
import { formatDate } from '@/utils/formatTime'
157155
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
158156
import { TaskStatusEnum } from '@/api/bpm/task'
159-
import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
157+
import { NodeType, CandidateStrategy } from '@/components/SimpleProcessDesignerV2/src/consts'
158+
import { isEmpty } from '@/utils/is'
160159
import { Check, Close, Loading, Clock, Minus, Delete } from '@element-plus/icons-vue'
161160
import starterSvg from '@/assets/svgs/bpm/starter.svg'
162161
import auditorSvg from '@/assets/svgs/bpm/auditor.svg'
@@ -170,12 +169,10 @@ withDefaults(
170169
defineProps<{
171170
activityNodes: ProcessInstanceApi.ApprovalNodeInfo[] // 审批节点信息
172171
showStatusIcon?: boolean // 是否显示头像右下角状态图标
173-
startUserSelectTasks?: any[] // 发起人需要选择审批人的用户任务列表
174172
startUserSelectAssignees?: any // 发起人选择审批人的数据
175173
}>(),
176174
{
177175
showStatusIcon: true, // 默认值为 true
178-
startUserSelectTasks: () => [], // 默认值为空数组
179176
startUserSelectAssignees: () => {}
180177
}
181178
)

0 commit comments

Comments
 (0)