feat: 견적 산출 UI 개선 및 에러 메시지 상세화
- LocationDetailPanel: 제작사이즈(W1xH1), 산출중량(K kg), 산출면적(M m²) 표시 - actions.ts: BOM 계산 실패 시 상세 검증 에러 메시지 표시 - 오타 수정: 제적사이즈 → 제작사이즈
This commit is contained in:
@@ -480,18 +480,28 @@ export function LocationDetailPanel({
|
||||
{/* 3행: 제작사이즈, 산출중량, 산출면적, 수량 */}
|
||||
<div className="grid grid-cols-4 gap-3 text-sm pt-2 border-t border-gray-200">
|
||||
<div>
|
||||
<span className="text-xs text-gray-500">제적사이즈</span>
|
||||
<span className="text-xs text-gray-500">제작사이즈</span>
|
||||
<p className="font-semibold">
|
||||
{location.manufactureWidth || location.openWidth + 280}X{location.manufactureHeight || location.openHeight + 280}
|
||||
{location.bomResult?.variables?.W1 || location.manufactureWidth || "-"}
|
||||
X
|
||||
{location.bomResult?.variables?.H1 || location.manufactureHeight || "-"}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-xs text-gray-500">-</span>
|
||||
<p className="font-semibold">kg</p>
|
||||
<span className="text-xs text-gray-500">산출중량</span>
|
||||
<p className="font-semibold">
|
||||
{location.bomResult?.variables?.K
|
||||
? `${Number(location.bomResult.variables.K).toFixed(2)} kg`
|
||||
: "-"}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-xs text-gray-500">-</span>
|
||||
<p className="font-semibold">m²</p>
|
||||
<span className="text-xs text-gray-500">산출면적</span>
|
||||
<p className="font-semibold">
|
||||
{location.bomResult?.variables?.M
|
||||
? `${Number(location.bomResult.variables.M).toFixed(2)} m²`
|
||||
: "-"}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-end">
|
||||
<Button
|
||||
|
||||
@@ -988,10 +988,23 @@ export async function calculateBomBulk(items: BomCalculateItem[]): Promise<{
|
||||
console.log('[QuoteActions] POST calculate BOM bulk response:', result);
|
||||
|
||||
if (!response.ok || !result.success) {
|
||||
// 검증 에러의 상세 메시지 추출
|
||||
let errorMessage = result.message || 'BOM 계산에 실패했습니다.';
|
||||
|
||||
// error.details에 상세 검증 에러가 있는 경우
|
||||
if (result.error?.details && typeof result.error.details === 'object') {
|
||||
const detailMessages = Object.values(result.error.details)
|
||||
.flat()
|
||||
.filter((msg): msg is string => typeof msg === 'string');
|
||||
if (detailMessages.length > 0) {
|
||||
errorMessage = detailMessages.join(', ');
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success: false,
|
||||
data: null,
|
||||
error: result.message || 'BOM 계산에 실패했습니다.',
|
||||
error: errorMessage,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user