diff --git a/src/modules/inbounds/components/InboundTaskList.test.ts b/src/modules/inbounds/components/InboundTaskList.test.ts index 4af8e042..153c2093 100644 --- a/src/modules/inbounds/components/InboundTaskList.test.ts +++ b/src/modules/inbounds/components/InboundTaskList.test.ts @@ -26,6 +26,8 @@ describe('InboundTaskList measurement scope', () => { expect(source).toContain('批量审核通过') expect(source).toContain('getMeasurementReviewDetail') expect(source).toContain('approveMeasurement') + expect(source).toContain('approval.initialPricingSucceeded') + expect(source).toContain('费用初算未生成,可补价后重新计算') }) it('uses the inbound tenant isolation key for measurement and review requests', () => { diff --git a/src/modules/inbounds/components/InboundTaskList.vue b/src/modules/inbounds/components/InboundTaskList.vue index 7508d4af..c50cea29 100644 --- a/src/modules/inbounds/components/InboundTaskList.vue +++ b/src/modules/inbounds/components/InboundTaskList.vue @@ -208,14 +208,20 @@ async function batchApproveMeasurements() { let successCount = 0 let failureCount = 0 const failures: string[] = [] + const pricingWarnings: string[] = [] for (const row of selected) { try { const detail = await getMeasurementReviewDetail(String(row.tenantId), String(row.id)) - await approveMeasurement(String(row.tenantId), String(row.id), { + const approval = await approveMeasurement(String(row.tenantId), String(row.id), { measurementId: detail.measurementId, expectedVersion: detail.version, }) successCount += 1 + if (!approval.initialPricingSucceeded) { + pricingWarnings.push( + `${row.inboundCode || row.id}:${approval.initialPricingMessage || '费用初算未生成'}`, + ) + } } catch (error) { failureCount += 1 failures.push(getApiErrorDetails(error, `${row.inboundCode || row.id} 审核失败`).message) @@ -223,7 +229,9 @@ async function batchApproveMeasurements() { } await loadTasks() const reason = [...new Set(failures.filter(Boolean))].slice(0, 3).join(';') - if (!failureCount) ElMessage.success(`已批量审核通过 ${successCount} 条测量数据`) + const pricingReason = [...new Set(pricingWarnings.filter(Boolean))].slice(0, 3).join(';') + if (!failureCount && !pricingWarnings.length) ElMessage.success(`已批量审核通过 ${successCount} 条测量数据,费用初算已生成`) + else if (!failureCount) ElMessage.warning(`已批量审核通过 ${successCount} 条测量数据;其中 ${pricingWarnings.length} 条费用初算未生成,可补价后重新计算${pricingReason ? `。${pricingReason}` : ''}`) else if (successCount) ElMessage.warning(`批量审核完成:成功 ${successCount} 条,失败 ${failureCount} 条${reason ? `。${reason}` : ''}`) else ElMessage.error(`批量审核失败:${failureCount} 条测量数据未通过${reason ? `。${reason}` : ''}`) } catch (error) {