|
|
|
@ -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
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|