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

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

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

Loading…
Cancel
Save