【代码评审】BPM:修复流程预测功能的一些变量

This commit is contained in:
YunaiV 2025-02-19 13:21:58 +08:00
parent 0d7d2cd1c3
commit bf96e8aeaf
2 changed files with 17 additions and 12 deletions

View File

@ -108,7 +108,7 @@ const fApi = ref<ApiAttrs>()
// //
const startUserSelectTasks: any = ref([]) // const startUserSelectTasks: any = ref([]) //
const startUserSelectAssignees = ref({}) // const startUserSelectAssignees = ref({}) //
const hisStartUserSelectAssignees = ref({}) // const tempStartUserSelectAssignees = ref({}) //
const bpmnXML: any = ref(null) // BPMN const bpmnXML: any = ref(null) // BPMN
const simpleJson = ref<string | undefined>() // Simple json const simpleJson = ref<string | undefined>() // Simple json
@ -156,17 +156,18 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
} }
} }
// /** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次 */
watch( watch(
detailForm.value, detailForm.value,
(newValue) => { (newValue) => {
if (newValue && Object.keys(newValue.value).length > 0) { if (newValue && Object.keys(newValue.value).length > 0) {
// //
hisStartUserSelectAssignees.value = startUserSelectAssignees.value tempStartUserSelectAssignees.value = startUserSelectAssignees.value
startUserSelectAssignees.value = {} startUserSelectAssignees.value = {}
//
getApprovalDetail({ getApprovalDetail({
id: props.selectProcessDefinition.id, id: props.selectProcessDefinition.id,
processVariablesStr: newValue.value processVariablesStr: JSON.stringify(newValue.value) // GET String JSON
}) })
} }
}, },
@ -178,11 +179,11 @@ watch(
/** 获取审批详情 */ /** 获取审批详情 */
const getApprovalDetail = async (row: any) => { const getApprovalDetail = async (row: any) => {
try { try {
// TODO activityId Simple // TODO activityId Simple @jason activityId
const data = await ProcessInstanceApi.getApprovalDetail({ const data = await ProcessInstanceApi.getApprovalDetail({
processDefinitionId: row.id, processDefinitionId: row.id,
activityId: NodeId.START_USER_NODE_ID, activityId: NodeId.START_USER_NODE_ID,
processVariablesStr: JSON.stringify(row.processVariablesStr) processVariablesStr: JSON.stringify(row.processVariablesStr) // GET String JSON
}) })
if (!data) { if (!data) {
@ -196,11 +197,14 @@ const getApprovalDetail = async (row: any) => {
startUserSelectTasks.value = data.activityNodes?.filter( startUserSelectTasks.value = data.activityNodes?.filter(
(node: ApprovalNodeInfo) => CandidateStrategy.START_USER_SELECT === node.candidateStrategy (node: ApprovalNodeInfo) => CandidateStrategy.START_USER_SELECT === node.candidateStrategy
) )
//
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
for (const node of startUserSelectTasks.value) { for (const node of startUserSelectTasks.value) {
if (hisStartUserSelectAssignees.value[node.id] && hisStartUserSelectAssignees.value[node.id].length > 0) { if (
startUserSelectAssignees.value[node.id] = hisStartUserSelectAssignees.value[node.id] tempStartUserSelectAssignees.value[node.id] &&
tempStartUserSelectAssignees.value[node.id].length > 0
) {
startUserSelectAssignees.value[node.id] = tempStartUserSelectAssignees.value[node.id]
} else { } else {
startUserSelectAssignees.value[node.id] = [] startUserSelectAssignees.value[node.id] = []
} }

View File

@ -709,6 +709,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
message.warning('表单校验不通过,请先完善表单!!') message.warning('表单校验不通过,请先完善表单!!')
return return
} }
if (pass) { if (pass) {
// , // ,
const variables = getUpdatedProcessInstanceVariables() const variables = getUpdatedProcessInstanceVariables()