From d6e75f8b2c3dfd3fa34b6368ab8a5eeae3c6bb54 Mon Sep 17 00:00:00 2001 From: JooWangi Date: Mon, 15 Jun 2026 13:17:01 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B5=90=EC=B2=B4=20=EB=8C=80?= =?UTF-8?q?=EC=83=81=20PC=20=EA=B5=90=EC=B2=B4=20=EC=88=98=EC=9A=94?= =?UTF-8?q?=EB=A5=BC=20=EB=B3=B4=EA=B8=89=20PC=20=EC=8B=A0=EA=B7=9C=20?= =?UTF-8?q?=EA=B5=AC=EB=A7=A4=20=ED=95=84=EC=9A=94=20=EC=88=98=EB=9F=89?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EC=A0=84=20=ED=95=A9=EC=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Dashboard/HwDashboard.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) 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%)