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

View File

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