From 97bf6b514aa333f83f1e24523aa569da22765c87 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 7 Jan 2026 20:17:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AD=90=E4=BB=BB=E5=8A=A1=E7=BB=84?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E4=BD=BF=E7=94=A8=E4=B8=8E=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E8=BD=AE=E7=9B=B8=E5=90=8C=E7=9A=84=E5=AE=A1=E6=A0=B8=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=EF=BC=88=E4=BB=BB=E5=8A=A1=E7=B1=BB=E5=9E=8B=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E3=80=81=E8=AE=BE=E8=AE=A1=E5=B8=88=E9=80=89=E6=8B=A9?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/TaskHall.vue | 159 ++++++++------------------------ 1 file changed, 40 insertions(+), 119 deletions(-) diff --git a/frontend/src/views/TaskHall.vue b/frontend/src/views/TaskHall.vue index cd0a83f..5e02dbf 100644 --- a/frontend/src/views/TaskHall.vue +++ b/frontend/src/views/TaskHall.vue @@ -3153,19 +3153,31 @@ const handleApproveConfirm = async () => { return } - const approvalData: TaskApprovalDTO = { - comment: approveAssignType.value === 'manual' ? - `指定设计师接单` : '审核通过,发布到任务大厅', - assignedReceiverId: approveAssignType.value === 'manual' ? approveDesignerId.value : undefined, - taskUpdates: { - taskTypes: approveTaskTypes.value.map(t => ({ - taskTypeId: t.typeId, - quantity: t.quantity - })) + // 判断是子任务组还是主任务 + const taskData = approveTaskData.value as any + const isTaskGroup = taskData._isTaskGroup === true + + if (isTaskGroup) { + // 子任务组审核 + await taskApi.approveTaskGroup(taskData.id, { + groupNo: taskData._groupNo, + assignedReceiverId: approveAssignType.value === 'manual' ? approveDesignerId.value : undefined + }) + } else { + // 主任务审核 + const approvalData: TaskApprovalDTO = { + comment: approveAssignType.value === 'manual' ? + `指定设计师接单` : '审核通过,发布到任务大厅', + assignedReceiverId: approveAssignType.value === 'manual' ? approveDesignerId.value : undefined, + taskUpdates: { + taskTypes: approveTaskTypes.value.map(t => ({ + taskTypeId: t.typeId, + quantity: t.quantity + })) + } } + await taskApi.approveReceivingLevel(taskData.id!, approvalData) } - - await taskApi.approveReceivingLevel(approveTaskData.value.id!, approvalData) if (approveAssignType.value === 'manual') { const designer = designersList.value.find(d => d.id === approveDesignerId.value) @@ -3176,7 +3188,7 @@ const handleApproveConfirm = async () => { approveModalVisible.value = false // 刷新列表和数量 - loadPendingApprovalTasks() + loadReviewTasks() loadAllTabCounts() loadDashboardStats() } catch (error: any) { @@ -3428,113 +3440,22 @@ const handleApproveTaskGroupFromReview = async (task: any) => { return } - try { - // 获取设计师列表及工作量 - const designersWithWorkload = await userApi.getDesignersWithWorkload() - - let assignType = ref<'auto' | 'manual'>('auto') - let selectedDesignerId = ref(undefined) - - Modal.confirm({ - title: '审核子任务组', - width: 600, - content: h('div', { style: 'padding: 10px 0;' }, [ - h('p', { style: 'margin-bottom: 16px; color: #666; font-size: 13px;' }, - `即将审核通过子任务组"${task.title} - 第${groupData.groupNo}组",共${groupData.itemCount || 0}个子任务。` - ), - h('p', { style: 'margin-bottom: 12px; font-weight: 500;' }, '请选择接单方式:'), - h(RadioGroup, { - value: assignType.value, - onChange: (e: any) => { - assignType.value = e.target.value - if (e.target.value === 'auto') { - selectedDesignerId.value = undefined - } - } - }, () => [ - h(Radio, { value: 'auto', style: { display: 'block', marginBottom: '12px' } }, () => '发布到任务大厅(设计师抢单)'), - h(Radio, { value: 'manual', style: { display: 'block', marginBottom: '12px' } }, () => '指定设计师接单') - ]), - h('div', { - style: { - display: assignType.value === 'manual' ? 'block' : 'none', - marginTop: '16px', - marginLeft: '24px' - } - }, [ - h('p', { style: 'margin-bottom: 8px; font-size: 13px; color: #666;' }, '选择设计师:'), - h(RadioGroup, { - value: selectedDesignerId.value, - onChange: (e: any) => { - selectedDesignerId.value = e.target.value - }, - style: { width: '100%' } - }, () => designersWithWorkload.map(designer => { - const workloadColor = designer.inProgressCount === 0 ? '#52c41a' - : designer.inProgressCount <= 3 ? '#faad14' - : '#f5222d' - - return h(Radio, { - value: designer.id, - style: { - display: 'block', - marginBottom: '8px', - padding: '8px', - border: '1px solid #d9d9d9', - borderRadius: '4px' - } - }, () => h('div', { style: 'display: flex; justify-content: space-between; align-items: center;' }, [ - h('span', {}, `${designer.realName} (${designer.deptName || '未知部门'})`), - h('span', { - style: { - fontSize: '12px', - color: workloadColor - } - }, `当前${designer.inProgressCount}个任务`) - ])) - })) - ]) - ]), - okText: '确认审核', - cancelText: '取消', - onOk: async () => { - if (assignType.value === 'manual' && !selectedDesignerId.value) { - message.warning('请选择设计师') - return Promise.reject() - } - - try { - approvalLoading.value = true - - await taskApi.approveTaskGroup(groupData.taskId, { - groupNo: groupData.groupNo, - assignedReceiverId: assignType.value === 'manual' ? selectedDesignerId.value : undefined - }) - - if (assignType.value === 'manual') { - const designer = designersWithWorkload.find(d => d.id === selectedDesignerId.value) - message.success(`已审核通过并指定给设计师 ${designer?.realName}`) - } else { - message.success('已审核通过,子任务组已发布到任务大厅') - } - - // 刷新列表和数量 - loadReviewTasks() - loadAllTabCounts() - loadDashboardStats() - } catch (error: any) { - console.error('审核失败:', error) - message.error(error.msg || error.message || '审核失败') - return Promise.reject(error) - } finally { - approvalLoading.value = false - } - } - }) - } catch (error: any) { - console.error('获取设计师列表失败:', error) - message.error('获取设计师列表失败') - } + // 将子任务组数据转换为与主任务相同的格式,复用审核弹窗 + const taskForApproval = { + id: groupData.taskId, + title: task.title, + taskNo: task.taskNo, + typeDetails: task.typeDetails, + taskTypeId: task.taskTypeId, + currentApproverRole: 'receiving_leader', + // 标记这是子任务组审核 + _isTaskGroup: true, + _groupNo: groupData.groupNo, + _groupData: groupData + } as any + + // 调用与第一轮相同的审核弹窗 + showAssignDesignerModal(taskForApproval) } // 从待审核任务页面驳回子任务组