diff --git a/src/api/oa/crm/businessTripApply/types.ts b/src/api/oa/crm/businessTripApply/types.ts index 04e382f..cb5a53a 100644 --- a/src/api/oa/crm/businessTripApply/types.ts +++ b/src/api/oa/crm/businessTripApply/types.ts @@ -263,6 +263,11 @@ export interface BusinessTripApplyForm extends BaseEntity { * 流程编码 */ flowCode?: string; + + /** + * 抄送人员ID列表 + */ + copyUserIds?: string | string[]; } export interface BusinessTripApplyQuery extends PageQuery { diff --git a/src/views/oa/crm/businessTripApply/edit.vue b/src/views/oa/crm/businessTripApply/edit.vue index f3bce39..b116506 100644 --- a/src/views/oa/crm/businessTripApply/edit.vue +++ b/src/views/oa/crm/businessTripApply/edit.vue @@ -91,33 +91,11 @@ - + - - - - - - - - - - @@ -132,17 +110,6 @@ - - - - - @@ -214,7 +181,7 @@ - + + + + + + + + @@ -260,6 +233,7 @@ import ProjectSelect from '@/components/ProjectSelect/index.vue'; import { CodeRuleEnum, FlowCodeEnum } from '@/enums/OAEnum'; import { getInfo } from '@/api/login'; import { listUser } from '@/api/system/user'; // 导入用户列表API +import { allListDept } from '@/api/system/dept'; // 导入部门列表API import { ProjectInfoVO } from '@/api/oa/erp/projectInfo/types'; import dayjs from 'dayjs'; @@ -281,6 +255,10 @@ const projectSelectRef = ref>(); // const userSelectRef = ref>(); // 审批人选择 ref const userList = ref([]); // 用户列表 +const deptInfoList = ref([]); // 部门列表 + +// 默认抄送人员的昵称列表 +const defaultCopyUserNames = ['米兰', '于洋', '张兰艳', '张东辉', '冯俊杰']; // 流程相关数据 const submitFormData = ref({ @@ -316,7 +294,8 @@ const initFormData: BusinessTripApplyForm = { flowStatus: 'draft', remark: undefined, ossId: undefined, - variables: {} // 初始化 variables + variables: {}, // 初始化 variables + copyUserIds: [] as string[] // 抄送人员ID列表 }; const data = reactive({ @@ -360,15 +339,40 @@ onMounted(async () => { routeParams.value = route.query; const id = routeParams.value.id; + // 加载用户列表 (用于审批人选择和抄送人员选择) + const userRes = await listUser({ pageNum: 1, pageSize: 1000 }); + userList.value = userRes.rows; + + // 加载部门列表 (用于获取部门负责人和分管副总) + const deptRes = await allListDept({ deptCategory: '03' } as any); + deptInfoList.value = deptRes.data || []; + // 自动填充申请人信息 if (!id) { try { - const userRes = await getInfo(); - if (userRes.data?.user) { - form.value.applicantId = userRes.data.user.userId; - form.value.applicantName = userRes.data.user.nickName; - form.value.deptId = userRes.data.user.deptId; - form.value.deptName = userRes.data.user.deptName; + const infoRes = await getInfo(); + 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; + + // 根据部门ID获取部门负责人和分管副总 + const deptInfo = deptInfoList.value.find((d: any) => d.deptId === infoRes.data.user.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])]; + } } } catch (e) { console.error('获取用户信息失败', e); @@ -379,14 +383,38 @@ onMounted(async () => { } } - // 加载用户列表 (用于审批人选择) - listUser({ pageNum: 1, pageSize: 1000 }).then((res: any) => { - userList.value = res.rows; - }); - if (id && (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval')) { const res = await getBusinessTripApply(id); Object.assign(form.value, res.data); + // 将抄送人员字符串转换为数组 + 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 = {}; + } } }); }); @@ -459,9 +487,12 @@ const executeSubmit = async (status: string, mode: boolean) => { // 提交审批 form.value.tripStatus = '2'; // 审批中 form.value.flowStatus = 'waiting'; + // 将抄送人员ID数组转换为逗号分隔字符串 + const copyUserIdsStr = Array.isArray(form.value.copyUserIds) ? form.value.copyUserIds.join(',') : form.value.copyUserIds || ''; form.value.variables = { ...form.value.variables, - tripType: form.value.tripType + tripType: form.value.tripType, + businessTripCopyUsers: copyUserIdsStr }; form.value.bizExt = { businessTitle: '出差申请', diff --git a/src/views/oa/crm/businessTripApply/index.vue b/src/views/oa/crm/businessTripApply/index.vue index a5c9dd9..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 @@ - + + + @@ -107,7 +113,11 @@ - + + + @@ -120,7 +130,7 @@ - + diff --git a/src/views/oa/erp/afterSales/edit.vue b/src/views/oa/erp/afterSales/edit.vue index 9505de4..8a48538 100644 --- a/src/views/oa/erp/afterSales/edit.vue +++ b/src/views/oa/erp/afterSales/edit.vue @@ -15,7 +15,7 @@ - + @@ -119,7 +119,10 @@ - + + +
+
- - - - - - - +
+
+
+ +
+ + + + + +
@@ -461,6 +475,9 @@ const editingIndex = ref(-1); // 材料表编辑索引 (-1 为新增) const checkedLabor = ref([]); // 人员表选中项 const checkedMaterial = ref([]); // 材料表选中项 +// 项目管理角色用户昵称列表(抄送对象) +const projectMgrUserNames = ['于洋']; + // 流程相关变量 const submitFormData = ref({ businessId: '', flowCode: '', variables: {}, bizExt: {} }); const taskVariables = ref>({}); @@ -929,10 +946,13 @@ const executeSubmit = async (status: string, mode: boolean) => { if (status !== 'draft') { // --- 提交审批 --- submitData.flowCode = FlowCodeEnum.AFTER_SALES_KEY; + // 根据昵称匹配项目管理角色用户作为抄送对象 + const copyUserIds = userList.value.filter((u: any) => projectMgrUserNames.includes(u.nickName)).map((u: any) => String(u.userId)); submitData.variables = { afterSalesId: submitData.afterSalesId, totalCost: submitData.totalCost || 0, - startUserId: useUserStore().userId + startUserId: useUserStore().userId, + afterSalesCopyUsers: copyUserIds.join(',') }; submitData.bizExt = { businessTitle: `售后申请:${submitData.afterSalesSubject}`, @@ -1001,4 +1021,34 @@ const submitCallback = async () => { .mt-2 { margin-top: 10px; } + +/* 问题描述和附件区域容器 - 使用 flexbox */ +.problem-attachment-row { + display: flex; + margin: 0; +} + +.problem-col { + flex: 0 0 50%; + max-width: 50%; + padding-right: 10px; +} + +.attachment-col { + flex: 0 0 50%; + max-width: 50%; + padding-left: 10px; +} + +/* 附件区域使用负 margin 拉到问题描述同行 */ +.file-upload-row { + margin-top: -95px; /* 向上拉到与问题描述同行 */ + margin-left: 50%; /* 偏移到右侧,与上方表单字段对齐 */ + padding-left: 10px; + padding-right: 10px; +} + +.file-upload-content { + /* 无需额外样式 */ +} diff --git a/src/views/oa/erp/afterSales/index.vue b/src/views/oa/erp/afterSales/index.vue index 4d6ef0a..ee8e67a 100644 --- a/src/views/oa/erp/afterSales/index.vue +++ b/src/views/oa/erp/afterSales/index.vue @@ -131,7 +131,7 @@ - + @@ -382,7 +382,9 @@ const handleExport = () => { proxy?.download( 'oa/erp/afterSales/export', { - ...queryParams.value + ...queryParams.value, + // 如果选中了数据,则只导出选中的数据 + afterSalesIds: ids.value.length > 0 ? ids.value.join(',') : undefined }, `afterSales_${new Date().getTime()}.xlsx` ); diff --git a/src/views/oa/erp/timesheetInfo/index.vue b/src/views/oa/erp/timesheetInfo/index.vue index 9c389ed..42d9f87 100644 --- a/src/views/oa/erp/timesheetInfo/index.vue +++ b/src/views/oa/erp/timesheetInfo/index.vue @@ -4,8 +4,15 @@
- - + + + + + + + + + @@ -102,6 +109,10 @@