diff --git a/src/api/oa/crm/businessTripApply/types.ts b/src/api/oa/crm/businessTripApply/types.ts index cb5a53a..274ba31 100644 --- a/src/api/oa/crm/businessTripApply/types.ts +++ b/src/api/oa/crm/businessTripApply/types.ts @@ -117,6 +117,16 @@ export interface BusinessTripApplyVO { * 附件ID(多个用逗号分隔) */ ossId: string | number; + + /** + * 创建人 + */ + createBy?: string | number; + + /** + * 交流过程与反馈 + */ + exchangeFeedback?: string; } export interface BusinessTripApplyForm extends BaseEntity { @@ -268,6 +278,16 @@ export interface BusinessTripApplyForm extends BaseEntity { * 抄送人员ID列表 */ copyUserIds?: string | string[]; + + /** + * 交流过程与反馈 + */ + exchangeFeedback?: string; + + /** + * 行程明细列表 + */ + crmBusinessTripDetailsList?: any[]; } export interface BusinessTripApplyQuery extends PageQuery { diff --git a/src/views/oa/crm/businessTripApply/edit.vue b/src/views/oa/crm/businessTripApply/edit.vue index b9b7e85..264b1fd 100644 --- a/src/views/oa/crm/businessTripApply/edit.vue +++ b/src/views/oa/crm/businessTripApply/edit.vue @@ -432,30 +432,15 @@ const submitFormData = ref({ }); const taskVariables = ref>({}); -// 业务方向负责人ID映射 -const BUSINESS_DIRECTION_LEADER_MAP: Record = { - 1: '1985254821554475009', - 2: '1985258519835889666', - 3: '1985251968270127105', - 4: '1985257496048226305', - 5: '1985254145713688578' -}; - -// 交流过程与反馈字段可见性:仅申请人、业务方向负责人、陈海军、张东辉可查看 +// 用户角色列表 +const userRoles = ref([]); +// "市场交流反馈查看"角色:拥有此角色的用户可查看交流过程与反馈 +const hasTripCommViewRole = computed(() => userRoles.value?.some((role) => role === 'tripCommView')); +// 交流过程与反馈字段可见性:拥有角色 或 申请人本人 const canViewFeedback = computed(() => { + if (hasTripCommViewRole.value) return true; const currentUserId = String(useUserStore().userId); - // 1. 申请人本人 if (form.value.applicantId && currentUserId === String(form.value.applicantId)) return true; - // 2. 陈海军、张东辉(通过 userList 匹配) - const fixedNames = ['陈海军', '张东辉']; - const fixedIds = fixedNames - .map((name) => userList.value.find((u: any) => u.nickName === name)) - .filter(Boolean) - .map((u: any) => String(u.userId)); - if (fixedIds.includes(currentUserId)) return true; - // 3. 当前单据的业务方向负责人 - const bd = Number(form.value.businessDirection); - if (bd && BUSINESS_DIRECTION_LEADER_MAP[bd] && currentUserId === BUSINESS_DIRECTION_LEADER_MAP[bd]) return true; return false; }); @@ -591,19 +576,25 @@ onMounted(async () => { const customerRes = await getCrmCustomerInfoList({}); customerList.value = customerRes.data || []; - // 自动填充申请人信息 - if (!id) { - try { - const infoRes = await getInfo(); + // 始终获取当前用户角色(用于反馈字段可见性判断) + try { + const infoRes = await getInfo(); + userRoles.value = infoRes.data?.roles || []; + // 新增时自动填充申请人信息 + if (!id) { if (infoRes.data?.user) { form.value.applicantId = infoRes.data.user.userId; form.value.applicantName = infoRes.data.user.nickName; form.value.deptId = infoRes.data.user.deptId; form.value.deptName = infoRes.data.user.deptName; } - } catch (e) { - console.error('获取用户信息失败', e); } + } catch (e) { + console.error('获取用户信息失败', e); + userRoles.value = []; + } + + if (!id) { // 从 index 页面传来 tripType if (routeParams.value.tripType) { form.value.tripType = routeParams.value.tripType; @@ -635,7 +626,7 @@ onMounted(async () => { confirmCopyIds.push(String(matchedUser.userId)); } }); - + // 追加:业务方向负责人的ID映射(与后台 SpelRuleComponent.java 保持一致) const BUSINESS_DIRECTION_TO_USERNAME: Record = { 1: '1985254821554475009', @@ -648,7 +639,7 @@ onMounted(async () => { if (bd && BUSINESS_DIRECTION_TO_USERNAME[bd]) { confirmCopyIds.push(BUSINESS_DIRECTION_TO_USERNAME[bd]); } - + // 兼容原有的手工可选抄送并做个去重合并 form.value.copyUserIds = Array.from(new Set([...(form.value.copyUserIds || []), ...confirmCopyIds])); // 关键挂载:将整理完的抄送群放入该次提交时的全局工作流上下文引擎变量中 @@ -728,7 +719,7 @@ const projectInfoSelectCallBack = (data: ProjectInfoVO[]) => { } form.value.variables.approverId = String(selectedProject.managerId); handleApproverSelectChange(String(selectedProject.managerId)); - proxy?.$modal.msgSuccess('已关联项目经理作为下一步审批人'); + // proxy?.$modal.msgSuccess('已关联项目经理作为下一步审批人'); } } } @@ -948,7 +939,7 @@ const approvalVerifyOpen = async () => { if (!isValid) return; if (!aggregateDetailsToForm()) return; - + buttonLoading.value = true; try { if (form.value.tripId) { diff --git a/src/views/oa/crm/businessTripApply/index.vue b/src/views/oa/crm/businessTripApply/index.vue index d59bd7c..c8c25da 100644 --- a/src/views/oa/crm/businessTripApply/index.vue +++ b/src/views/oa/crm/businessTripApply/index.vue @@ -120,7 +120,14 @@ - +