diff --git a/src/views/Dashboard/HwDashboard.ts b/src/views/Dashboard/HwDashboard.ts index d18856c..3b8e88d 100644 --- a/src/views/Dashboard/HwDashboard.ts +++ b/src/views/Dashboard/HwDashboard.ts @@ -378,15 +378,13 @@ function updateDashboardData(pcs: any[], selectedDept: string) { // 6. 종합 매트릭스 테이블 렌더링 및 바인딩 const matrixTbody = document.getElementById('pc-grade-matrix-tbody')!; - const renderMatrixRow = (gradeKey: keyof typeof matrix, label: string, color: string) => { + const renderMatrixRow = (gradeKey: keyof typeof matrix, label: string, color: string, shortage: number) => { const data = matrix[gradeKey]; const totalRate = filtered.length > 0 ? Math.round((data.total / filtered.length) * 100) : 0; const cellStyle = `padding: 14px 12px; text-align: center; font-weight: 700; cursor: pointer; transition: background 0.2s; font-size: 1.25rem;`; const hoverEvents = `onmouseover="this.style.background='#F1F5F9'" onmouseout="this.style.background='none'"`; - const shortage = Math.max(0, data.under - data.stock); - return ` ${label} @@ -405,19 +403,24 @@ function updateDashboardData(pcs: any[], selectedDept: string) { const premiumShortage = Math.max(0, matrix.premium.under - matrix.premium.stock); const highShortage = Math.max(0, matrix.high.under - matrix.high.stock); const normalShortage = Math.max(0, matrix.normal.under - matrix.normal.stock); - const entryShortage = Math.max(0, matrix.entry.under - matrix.entry.stock); - const replaceShortage = Math.max(0, matrix.replace.under - matrix.replace.stock); + + // 보급 PC 구매 필요 = (보급 under + 교체대상 under) - 보급 stock (교체 대상을 위해 최소 보급 PC 사양을 구매한다는 논리 적용) + const entryShortage = Math.max(0, (matrix.entry.under + matrix.replace.under) - matrix.entry.stock); + + // 교체 대상 PC 자체는 새로 구매하는 기종이 아니므로 구매 필요 0대 + const replaceShortage = 0; + const totalShortage = premiumShortage + highShortage + normalShortage + entryShortage + replaceShortage; const cellStyleHeader = `padding: 14px 12px; text-align: center; font-weight: 800; cursor: pointer; transition: background 0.2s; background: #F8FAFC; font-size: 1.25rem;`; const hoverEventsHeader = `onmouseover="this.style.background='#EEF2F6'" onmouseout="this.style.background='#F8FAFC'"`; matrixTbody.innerHTML = ` - ${renderMatrixRow('premium', '최상급 PC (85점 이상)', '#11302B')} - ${renderMatrixRow('high', '상급 PC (70점 ~ 85점)', '#1E8E7C')} - ${renderMatrixRow('normal', '중급 PC (40점 ~ 70점)', '#10B981')} - ${renderMatrixRow('entry', '보급 PC (20점 ~ 40점)', '#F59E0B')} - ${renderMatrixRow('replace', '교체 대상 PC (20점 미만 또는 Win11 불가)', '#EF4444')} + ${renderMatrixRow('premium', '최상급 PC (85점 이상)', '#11302B', premiumShortage)} + ${renderMatrixRow('high', '상급 PC (70점 ~ 85점)', '#1E8E7C', highShortage)} + ${renderMatrixRow('normal', '중급 PC (40점 ~ 70점)', '#10B981', normalShortage)} + ${renderMatrixRow('entry', '보급 PC (20점 ~ 40점)', '#F59E0B', entryShortage)} + ${renderMatrixRow('replace', '교체 대상 PC (20점 미만 또는 Win11 불가)', '#EF4444', replaceShortage)} 합계 (Total) ${totalPcs}대 (100%)