fix:监听输入变量值,预测节点轨迹。导致节点配置审批人错误问题

This commit is contained in:
smallNorthLee 2025-02-18 22:40:47 +08:00
parent 7467b0b4e0
commit b53bfbd49e

View File

@ -108,6 +108,7 @@ const fApi = ref<ApiAttrs>()
// //
const startUserSelectTasks: any = ref([]) // const startUserSelectTasks: any = ref([]) //
const startUserSelectAssignees = ref({}) // const startUserSelectAssignees = ref({}) //
const hisStartUserSelectAssignees = 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
@ -154,13 +155,15 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
// Tab // Tab
} }
} }
// //
watch( watch(
detailForm.value, detailForm.value,
(newValue) => { (newValue) => {
if (newValue && Object.keys(newValue.value).length > 0) { if (newValue && Object.keys(newValue.value).length > 0) {
// startUserSelectTasks.value = [] //
// startUserSelectAssignees.value = [] hisStartUserSelectAssignees.value = startUserSelectAssignees.value
startUserSelectAssignees.value = {}
getApprovalDetail({ getApprovalDetail({
id: props.selectProcessDefinition.id, id: props.selectProcessDefinition.id,
processVariablesStr: newValue.value processVariablesStr: newValue.value
@ -186,19 +189,24 @@ const getApprovalDetail = async (row: any) => {
message.error('查询不到审批详情信息!') message.error('查询不到审批详情信息!')
return return
} }
// Timeline
activityNodes.value = data.activityNodes
// //
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) {
startUserSelectAssignees.value[node.id] = [] if (hisStartUserSelectAssignees.value[node.id] && hisStartUserSelectAssignees.value[node.id].length > 0) {
startUserSelectAssignees.value[node.id] = hisStartUserSelectAssignees.value[node.id]
} else {
startUserSelectAssignees.value[node.id] = []
}
} }
} }
// Timeline
activityNodes.value = data.activityNodes
// //
const formFieldsPermission = data.formFieldsPermission const formFieldsPermission = data.formFieldsPermission
// //
@ -236,7 +244,6 @@ const submitForm = async () => {
} }
// //
await fApi.value.validate() await fApi.value.validate()
// debugger
// //
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
for (const userTask of startUserSelectTasks.value) { for (const userTask of startUserSelectTasks.value) {