Skip to content

Commit bf96e8a

Browse files
committed
【代码评审】BPM:修复流程预测功能的一些变量
1 parent 0d7d2cd commit bf96e8a

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const fApi = ref<ApiAttrs>()
108108
// 指定审批人
109109
const startUserSelectTasks: any = ref([]) // 发起人需要选择审批人或抄送人的任务列表
110110
const startUserSelectAssignees = ref({}) // 发起人选择审批人的数据
111-
const hisStartUserSelectAssignees = ref({}) // 历史发起人选择审批人的数据
111+
const tempStartUserSelectAssignees = ref({}) // 历史发起人选择审批人的数据,用于每次表单变更时,临时保存
112112
const bpmnXML: any = ref(null) // BPMN 数据
113113
const simpleJson = ref<string | undefined>() // Simple 设计器数据 json 格式
114114
@@ -156,17 +156,18 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
156156
}
157157
}
158158
159-
// 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次
159+
/** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次 */
160160
watch(
161161
detailForm.value,
162162
(newValue) => {
163163
if (newValue && Object.keys(newValue.value).length > 0) {
164-
//记录之前的节点审批人
165-
hisStartUserSelectAssignees.value = startUserSelectAssignees.value
164+
// 记录之前的节点审批人
165+
tempStartUserSelectAssignees.value = startUserSelectAssignees.value
166166
startUserSelectAssignees.value = {}
167+
// 加载最新的审批详情
167168
getApprovalDetail({
168169
id: props.selectProcessDefinition.id,
169-
processVariablesStr: newValue.value
170+
processVariablesStr: JSON.stringify(newValue.value) // 解决 GET 无法传递对象的问题,后端 String 再转 JSON
170171
})
171172
}
172173
},
@@ -178,11 +179,11 @@ watch(
178179
/** 获取审批详情 */
179180
const getApprovalDetail = async (row: any) => {
180181
try {
181-
// TODO 获取审批详情,设置 activityId 为发起人节点(为了获取字段权限。暂时只对 Simple 设计器有效)
182+
// TODO 获取审批详情,设置 activityId 为发起人节点(为了获取字段权限。暂时只对 Simple 设计器有效);@jason:这里可以去掉 activityId 么?
182183
const data = await ProcessInstanceApi.getApprovalDetail({
183184
processDefinitionId: row.id,
184185
activityId: NodeId.START_USER_NODE_ID,
185-
processVariablesStr: JSON.stringify(row.processVariablesStr)
186+
processVariablesStr: JSON.stringify(row.processVariablesStr) // 解决 GET 无法传递对象的问题,后端 String 再转 JSON
186187
})
187188
188189
if (!data) {
@@ -196,17 +197,20 @@ const getApprovalDetail = async (row: any) => {
196197
startUserSelectTasks.value = data.activityNodes?.filter(
197198
(node: ApprovalNodeInfo) => CandidateStrategy.START_USER_SELECT === node.candidateStrategy
198199
)
199-
200+
// 恢复之前的选择审批人
200201
if (startUserSelectTasks.value?.length > 0) {
201202
for (const node of startUserSelectTasks.value) {
202-
if (hisStartUserSelectAssignees.value[node.id] && hisStartUserSelectAssignees.value[node.id].length > 0) {
203-
startUserSelectAssignees.value[node.id] = hisStartUserSelectAssignees.value[node.id]
203+
if (
204+
tempStartUserSelectAssignees.value[node.id] &&
205+
tempStartUserSelectAssignees.value[node.id].length > 0
206+
) {
207+
startUserSelectAssignees.value[node.id] = tempStartUserSelectAssignees.value[node.id]
204208
} else {
205209
startUserSelectAssignees.value[node.id] = []
206210
}
207211
}
208212
}
209-
213+
210214
// 获取表单字段权限
211215
const formFieldsPermission = data.formFieldsPermission
212216
// 设置表单字段权限

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,12 +703,13 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
703703
// 校验表单
704704
if (!formRef) return
705705
await formRef.validate()
706-
//校验流程表单必填字段
706+
// 校验流程表单必填字段
707707
const valid = await validateNormalForm()
708708
if (!valid) {
709709
message.warning('表单校验不通过,请先完善表单!!')
710710
return
711711
}
712+
712713
if (pass) {
713714
// 获取修改的流程变量, 暂时只支持流程表单
714715
const variables = getUpdatedProcessInstanceVariables()

0 commit comments

Comments
 (0)