diff --git a/frontend/src/views/CreateTask.vue b/frontend/src/views/CreateTask.vue index faa217b..94200f0 100644 --- a/frontend/src/views/CreateTask.vue +++ b/frontend/src/views/CreateTask.vue @@ -1610,10 +1610,13 @@ const handleSubmit = async () => { const attachmentUrl = attachmentUrls.length > 0 ? attachmentUrls.join(',') : formData.attachmentUrl console.log('[提交任务] 最终attachmentUrl:', attachmentUrl) + // 判断是否是一级需求部门用户且不填写任务明细 + const isPrimaryDeptWithoutDetail = isPrimaryDeptUser.value && !shouldShowTaskDetail.value + // 流水线任务(固定使用顺序流水线模式) const pipelineData = { title: formData.title, - isPipeline: true, + isPipeline: !isPrimaryDeptWithoutDetail, // 一级需求部门不填明细时,不标记为流水线任务 pipelineMode: 'sequential', // 固定为顺序流水线 items: validTaskTypes.map((item, index) => ({ taskTypeId: item.taskTypeId!, @@ -1654,13 +1657,42 @@ const handleSubmit = async () => { } } else { // 新建模式 - response = await taskApi.createPipelineTask(pipelineData) + if (isPrimaryDeptWithoutDetail) { + // 一级需求部门不填写任务明细时,使用普通任务创建接口 + // 任务明细将由需求部门在审核时填写 + const taskData = { + title: formData.title, + brandId: formData.brandId, + platformId: formData.platformId, + categoryId: formData.categoryId, + spuInfo: formData.spuInfo, + taskSubType: formData.taskSubType, + attachmentUrl: attachmentUrl, + remark: formData.remark || '', + priority: formData.isUrgent ? 3 : 1, + releaseType: formData.releaseType, + productBarcodes: formData.productBarcodes, + previewImage: formData.previewImage, + isPrimaryDeptTask: true // 标记为一级需求部门任务 + } + response = await taskApi.createTask(taskData as any) + + if (response.code === 200) { + message.success('任务已提交,等待需求部门完善明细') + setTimeout(() => { + router.push('/tasks') + }, 1000) + } + } else { + // 普通流水线任务 + response = await taskApi.createPipelineTask(pipelineData) - if (response.code === 200) { - message.success('流水线任务创建成功') - setTimeout(() => { - router.push('/tasks') - }, 1000) + if (response.code === 200) { + message.success('流水线任务创建成功') + setTimeout(() => { + router.push('/tasks') + }, 1000) + } } } } catch (error: any) {