diff --git a/src/views/oa/crm/businessTripApply/edit.vue b/src/views/oa/crm/businessTripApply/edit.vue index a48a465..b116506 100644 --- a/src/views/oa/crm/businessTripApply/edit.vue +++ b/src/views/oa/crm/businessTripApply/edit.vue @@ -91,7 +91,7 @@ - + @@ -390,6 +390,31 @@ onMounted(async () => { if (form.value.copyUserIds && typeof form.value.copyUserIds === 'string') { form.value.copyUserIds = (form.value.copyUserIds as string).split(',').filter((id) => id); } + + // 编辑模式下,如果抄送人员为空,重新设置默认抄送人员 + if (routeParams.value.type === 'update' && (!form.value.copyUserIds || form.value.copyUserIds.length === 0)) { + // 根据部门ID获取部门负责人和分管副总 + const deptInfo = deptInfoList.value.find((d: any) => d.deptId === form.value.deptId); + if (deptInfo) { + const deptLeaderId = deptInfo.leader; + const vicePresidentId = deptInfo.vicePresident; + // 将部门负责人和分管副总加入默认抄送人员 + const deptCopyIds: string[] = []; + if (deptLeaderId) deptCopyIds.push(String(deptLeaderId)); + if (vicePresidentId) deptCopyIds.push(String(vicePresidentId)); + + // 根据昵称匹配默认抄送人员 + const defaultCopyIds = userList.value.filter((u: any) => defaultCopyUserNames.includes(u.nickName)).map((u: any) => String(u.userId)); + + // 合并默认抄送人员和部门负责人/分管副总(去重) + form.value.copyUserIds = [...new Set([...defaultCopyIds, ...deptCopyIds])]; + } + } + + // 确保 variables 对象存在 + if (!form.value.variables) { + form.value.variables = {}; + } } }); }); diff --git a/src/views/oa/crm/businessTripApply/index.vue b/src/views/oa/crm/businessTripApply/index.vue index 04931cb..414ddc7 100644 --- a/src/views/oa/crm/businessTripApply/index.vue +++ b/src/views/oa/crm/businessTripApply/index.vue @@ -12,11 +12,15 @@ - - + + + + - - + + + + @@ -28,7 +32,9 @@ - + + + @@ -192,6 +198,10 @@