feat(crmGiftApply): 礼品申请支持副总角色判断与变量传递

- 礼品申请流程副总走市场经理审批
- 角色有副总,通过登陆用户角色判断是否副总
dev
zangch@mesnac.com 4 days ago
parent 8950a523c4
commit 924402a16a

@ -229,6 +229,10 @@ const userList = ref<any[]>([]); // 用户列表,用于审批人选择
// ID // ID
const MARKETING_DEPT_ID = 106; const MARKETING_DEPT_ID = 106;
//
const VICE_PRESIDENT_ROLE_KEY = 'FGFZ';
//
const currentUserRoles = ref<string[]>([]);
// //
const initFormData: CrmGiftApplyForm = { const initFormData: CrmGiftApplyForm = {
@ -280,7 +284,7 @@ const rules = reactive({
// //
const showApproverSelector = computed(() => { const showApproverSelector = computed(() => {
return form.value.applicantDeptId !== undefined && form.value.applicantDeptId !== MARKETING_DEPT_ID; return form.value.applicantDeptId !== undefined && form.value.applicantDeptId !== MARKETING_DEPT_ID && !isVicePresident.value;
}); });
// //
@ -288,6 +292,9 @@ const isFormDisabled = computed(() => {
return routeParams.value.type === 'view' || routeParams.value.type === 'approval'; return routeParams.value.type === 'view' || routeParams.value.type === 'approval';
}); });
//
const isVicePresident = computed(() => currentUserRoles.value.includes(VICE_PRESIDENT_ROLE_KEY));
/** 加载客户列表 */ /** 加载客户列表 */
const loadCustomerList = async () => { const loadCustomerList = async () => {
try { try {
@ -330,6 +337,7 @@ const initUserInfo = async () => {
try { try {
const res = await getInfo(); const res = await getInfo();
const user = res.data.user; const user = res.data.user;
currentUserRoles.value = Array.isArray(res.data.roles) ? res.data.roles : [];
form.value.applicantId = user.userId; form.value.applicantId = user.userId;
form.value.applicantName = user.nickName; form.value.applicantName = user.nickName;
form.value.applicantDeptId = user.deptId; form.value.applicantDeptId = user.deptId;
@ -341,6 +349,12 @@ const initUserInfo = async () => {
if (!form.value.variables) { if (!form.value.variables) {
form.value.variables = {}; form.value.variables = {};
} }
// 便
form.value.variables = {
...form.value.variables,
roleKeys: currentUserRoles.value.join(','),
isVicePresident: isVicePresident.value ? '1' : '0'
};
} catch (error) { } catch (error) {
console.error('获取用户信息失败:', error); console.error('获取用户信息失败:', error);
} }
@ -479,8 +493,7 @@ const submitForm = async (status: string) => {
} else { } else {
// //
form.value.flowCode = FLOW_CODE; form.value.flowCode = FLOW_CODE;
// P0-2: deptId deptName //
// approverId
form.value.variables = { form.value.variables = {
...form.value.variables, // approverId approverName ...form.value.variables, // approverId approverName
giftApplyId: form.value.giftApplyId, giftApplyId: form.value.giftApplyId,
@ -489,6 +502,8 @@ const submitForm = async (status: string) => {
applicantName: form.value.applicantName, applicantName: form.value.applicantName,
deptId: form.value.applicantDeptId, deptId: form.value.applicantDeptId,
deptName: form.value.applicantDeptName, deptName: form.value.applicantDeptName,
roleKeys: currentUserRoles.value.join(','),
isVicePresident: isVicePresident.value ? '1' : '0',
totalAmount: form.value.totalAmount, totalAmount: form.value.totalAmount,
customerUnitName: form.value.customerUnitName customerUnitName: form.value.customerUnitName
}; };

Loading…
Cancel
Save