修复:审核一级需求任务时优先使用需求部门(demand)而非接单部门(receiving)

This commit is contained in:
Your Name 2026-01-20 14:46:13 +08:00
parent 8d4d8e0539
commit 58be180740
2 changed files with 27 additions and 7 deletions

Binary file not shown.

View File

@ -5427,16 +5427,36 @@ const handleApprovePrimaryTask = async (task: Task) => {
try {
const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
// 优先使用用户管理的部门(作为负责人的部门),而不是用户所在的部门
// 优先使用用户管理的需求部门(dept_type = 'demand'),而不是接单部门
let deptId = userInfo.deptId
let selectedDeptName = ''
// 如果用户有管理的部门,使用第一个管理的部门
// 从管理的部门中找需求部门(demand类型)
if (managedDepartments.value.length > 0) {
deptId = managedDepartments.value[0].deptId
console.log(`使用用户管理的部门: ${managedDepartments.value[0].deptName} (ID: ${deptId})`)
// 优先找需求部门
const demandDept = managedDepartments.value.find(d => d.deptType === 'demand')
if (demandDept) {
deptId = demandDept.deptId
selectedDeptName = demandDept.deptName
console.log(`使用用户管理的需求部门: ${selectedDeptName} (ID: ${deptId})`)
} else {
// 没有需求部门,使用第一个部门
deptId = managedDepartments.value[0].deptId
selectedDeptName = managedDepartments.value[0].deptName
console.log(`没有找到需求部门,使用第一个管理的部门: ${selectedDeptName} (ID: ${deptId})`)
}
} else if (userInfo.managedDepartments && userInfo.managedDepartments.length > 0) {
deptId = userInfo.managedDepartments[0].deptId
console.log(`使用userInfo中管理的部门: ${userInfo.managedDepartments[0].deptName} (ID: ${deptId})`)
// 优先找需求部门
const demandDept = userInfo.managedDepartments.find((d: any) => d.deptType === 'demand')
if (demandDept) {
deptId = demandDept.deptId
selectedDeptName = demandDept.deptName
console.log(`使用userInfo中管理的需求部门: ${selectedDeptName} (ID: ${deptId})`)
} else {
deptId = userInfo.managedDepartments[0].deptId
selectedDeptName = userInfo.managedDepartments[0].deptName
console.log(`没有找到需求部门,使用userInfo中第一个管理的部门: ${selectedDeptName} (ID: ${deptId})`)
}
}
if (!deptId) {
@ -5444,7 +5464,7 @@ const handleApprovePrimaryTask = async (task: Task) => {
return
}
console.log(`查询部门 ${deptId} 的成员(包含子部门)`)
console.log(`查询部门 ${deptId} (${selectedDeptName}) 的成员(包含子部门)`)
// 获取部门成员(包含所有子部门)
const response = await userApi.getUserList(1, 1000, undefined, deptId, 1, true)