fix: 修复子任务分组逻辑,三级分类正确继承二级分类的部门配置

This commit is contained in:
Your Name 2026-01-06 20:51:03 +08:00
parent 311771aca9
commit acec519086

View File

@ -1019,6 +1019,24 @@ const formatDeadline = (date: Date) => {
return `${year}-${month}-${day} ${hour}:${minute}`
}
// 获取任务类型的部门配置(三级分类从二级父类继承)
const getTypeAllowedDeptIds = (typeInfo: any): string => {
// 如果当前类型有配置,直接返回
if (typeInfo.allowedDeptIds) {
return typeInfo.allowedDeptIds
}
// 如果有父级ID,查找父级的配置(三级分类继承二级分类)
if (typeInfo.parentId) {
const parentInfo = findTaskTypeById(typeInfo.parentId, hierarchicalTaskTypes.value)
if (parentInfo && parentInfo.allowedDeptIds) {
return parentInfo.allowedDeptIds
}
}
return ''
}
// 计算流水线分组
const pipelineGroups = computed(() => {
if (formData.taskTypes.length === 0) {
@ -1047,8 +1065,8 @@ const pipelineGroups = computed(() => {
const typeInfo = getTaskTypeInfo(taskType.taskTypeId)
if (!typeInfo) continue
// 获取接单部门配置
const deptIds = typeInfo.allowedDeptIds || ''
// 获取接单部门配置(三级分类从二级父类继承)
const deptIds = getTypeAllowedDeptIds(typeInfo)
const deptName = getDeptNameFromIds(deptIds)
// 判断是否需要创建新分组