merge: 공동작업자 HW_Dashboard 브랜치 병합 (대시보드 UI 및 가독성 개선 사항 병합)
This commit is contained in:
@@ -6,10 +6,58 @@ import { createIcons, Laptop, Cpu, Shield, Zap, Monitor, AlertTriangle, ChevronR
|
||||
|
||||
declare var Chart: any;
|
||||
|
||||
let jobChartInstance: any = null;
|
||||
let donutChartInstance: any = null;
|
||||
|
||||
export function renderHwDashboard(container: HTMLElement) {
|
||||
// 전역 툴팁 헬퍼 함수 등록
|
||||
(window as any).showSpecTooltip = function(event: MouseEvent, element: HTMLElement, type: string, count: number) {
|
||||
const container = element.closest('.spec-bar-container');
|
||||
if (!container) return;
|
||||
const tooltip = container.querySelector('.spec-tooltip') as HTMLElement;
|
||||
if (!tooltip) return;
|
||||
const textSpan = tooltip.querySelector('.tooltip-text') as HTMLElement;
|
||||
if (textSpan) {
|
||||
let color = '';
|
||||
let label = '';
|
||||
if (type === 'under') {
|
||||
color = '#EF4444';
|
||||
label = '부족';
|
||||
} else if (type === 'normal') {
|
||||
color = '#10B981';
|
||||
label = '적정';
|
||||
} else if (type === 'over') {
|
||||
color = '#F59E0B';
|
||||
label = '오버';
|
||||
} else if (type === 'win11') {
|
||||
color = '#7928ca';
|
||||
label = '윈도우 11 불가';
|
||||
}
|
||||
textSpan.innerHTML = `<span style="color: ${color}; font-weight: 800;">${label} ${count}대</span>`;
|
||||
}
|
||||
tooltip.style.left = event.clientX + 'px';
|
||||
tooltip.style.top = event.clientY + 'px';
|
||||
tooltip.style.opacity = '1';
|
||||
};
|
||||
|
||||
(window as any).updateSpecTooltipPos = function(event: MouseEvent, element: HTMLElement) {
|
||||
const container = element.closest('.spec-bar-container');
|
||||
if (!container) return;
|
||||
const tooltip = container.querySelector('.spec-tooltip') as HTMLElement;
|
||||
if (tooltip) {
|
||||
tooltip.style.left = event.clientX + 'px';
|
||||
tooltip.style.top = event.clientY + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
(window as any).hideSpecTooltip = function(element: HTMLElement) {
|
||||
const container = element.closest('.spec-bar-container');
|
||||
if (!container) return;
|
||||
const tooltip = container.querySelector('.spec-tooltip') as HTMLElement;
|
||||
if (tooltip) {
|
||||
tooltip.style.opacity = '0';
|
||||
}
|
||||
};
|
||||
|
||||
// 1. 개인용 PC 데이터 추출 (유형이 '개인PC'이거나 상태가 '재고' 또는 '대기' 상태인 PC 집계)
|
||||
const pcs = (state.masterData.pc || []).filter((a: any) =>
|
||||
a.asset_type === '개인PC' ||
|
||||
@@ -18,7 +66,7 @@ export function renderHwDashboard(container: HTMLElement) {
|
||||
|
||||
// 2. 1페이지 매거진 리포트(제목바 제거, '| 제목' 미니멀리즘 스타일) HTML 빌드
|
||||
container.innerHTML = `
|
||||
<div class="view-container" style="overflow: hidden; padding: 0.4rem 1.2rem; background-color: #F8FAFC; height: calc(100vh - var(--header-height) - 48px); box-sizing: border-box; display: flex; flex-direction: column; gap: 0.5rem; font-family: 'Pretendard', sans-serif; color: #1E293B;">
|
||||
<div class="view-container" style="overflow: hidden; padding: 0; background-color: #ffffff; height: calc(100vh - var(--header-height) - 48px); box-sizing: border-box; display: flex; flex-direction: column; gap: 0; font-family: 'Pretendard', sans-serif; color: #1E293B;">
|
||||
|
||||
<!-- 대시보드 타이틀 및 사용조직 필터 -->
|
||||
<div style="display: flex; justify-content: space-between; align-items: flex-end; flex-shrink: 0; padding-bottom: 0.4rem;">
|
||||
@@ -43,168 +91,108 @@ export function renderHwDashboard(container: HTMLElement) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 메인 2단 컬럼 레이아웃 (5:5 비율) -->
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; flex: 1; min-height: 0; margin-bottom: 0.1rem;">
|
||||
<!-- 상단 섹션 (전체 높이의 약 35% 차지, stat-card와 donut/aging 나열) -->
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 0; height: 33%; min-height: 0; flex-shrink: 0; padding: 0.5rem 0;">
|
||||
|
||||
<!-- 좌측 컬럼 (Left Column) -->
|
||||
<div style="display: flex; flex-direction: column; gap: 0.5rem; min-height: 0;">
|
||||
|
||||
<!-- 핵심 지표 카드 -->
|
||||
<div class="stat-card" style="background: transparent; border-radius: 0; padding: 0.75rem 0.25rem; border: none; border-bottom: 1px solid #E2E8F0; display: grid !important; grid-template-columns: 1fr 1fr; gap: 0.6rem 0.9rem; flex-shrink: 0;">
|
||||
<!-- 상단 좌측: 핵심 지표 4개 격자 그리드 -->
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 0; height: 100%;">
|
||||
|
||||
<!-- 1. 보유 자산 수량 -->
|
||||
<div style="border-right: 1px solid #EEF2F6; border-bottom: 1px solid #EEF2F6; padding-bottom: 0.65rem; padding-right: 1.0rem;">
|
||||
<div style="border-left: 4px solid #1E5149; padding-left: 8px; margin-bottom: 0.5rem; display: flex; align-items: center; line-height: 1;">
|
||||
<span style="font-size: 1.15rem; font-weight: 800; color: #1E293B; white-space: nowrap;">보유 자산 수량</span>
|
||||
</div>
|
||||
<div class="flex items-end justify-between">
|
||||
<div>
|
||||
<div id="metric-total-pcs" style="font-size: 2.3rem; font-weight: 900; color: #1E5149; line-height: 1; margin-bottom: 0.35rem;">0대</div>
|
||||
<span style="font-size: 1.05rem; color: #64748B; font-weight: 700; white-space: nowrap;">전사 보유 개인용 PC</span>
|
||||
</div>
|
||||
<div id="metric-card-total" style="background: #ffffff; padding: 1.5rem; display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; position: relative; overflow: hidden; transition: background-color 0.15s ease;"
|
||||
onmouseover="this.style.backgroundColor='#F8FAFC';"
|
||||
onmouseout="this.style.backgroundColor='#ffffff';">
|
||||
<div style="display: flex; align-items: center; z-index: 1; border-left: 4px solid #1E5149; padding-left: 8px; height: 1.4rem;">
|
||||
<span style="font-size: 1.1rem; font-weight: 850; color: #1E293B; letter-spacing: -0.3px;">보유 자산 수량</span>
|
||||
</div>
|
||||
<div id="metric-total-pcs" style="font-size: 2.1rem; font-weight: 900; color: #1E5149; line-height: 1.1; z-index: 1; margin-right: 2rem; margin-top: 1.8rem;">0대</div>
|
||||
</div>
|
||||
|
||||
<!-- 2. 사양 부족 -->
|
||||
<div id="card-under-spec" style="border-bottom: 1px solid #EEF2F6; padding-bottom: 0.65rem; padding-left: 1.0rem; cursor: pointer; transition: opacity 0.2s;" onmouseover="this.style.opacity='0.7'" onmouseout="this.style.opacity='1'">
|
||||
<div style="border-left: 4px solid #EF4444; padding-left: 8px; margin-bottom: 0.5rem; display: flex; align-items: center; line-height: 1;">
|
||||
<span style="font-size: 1.15rem; font-weight: 800; color: #1E293B; white-space: nowrap;">사양 부족</span>
|
||||
</div>
|
||||
<div class="flex items-end justify-between">
|
||||
<div>
|
||||
<div id="metric-under-spec" style="font-size: 2.3rem; font-weight: 900; color: #EF4444; line-height: 1; margin-bottom: 0.35rem;">0대</div>
|
||||
<span style="font-size: 1.05rem; color: #64748B; font-weight: 700; white-space: nowrap;">사양 교체 권고 자산</span>
|
||||
</div>
|
||||
<div id="card-under-spec" style="background: #ffffff; padding: 1.5rem; display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; position: relative; overflow: hidden; cursor: pointer; transition: background-color 0.15s ease;">
|
||||
<div style="display: flex; align-items: center; z-index: 1; border-left: 4px solid #EF4444; padding-left: 8px; height: 1.4rem;">
|
||||
<span style="font-size: 1.1rem; font-weight: 850; color: #1E293B; letter-spacing: -0.3px;">사양 부족</span>
|
||||
</div>
|
||||
<div id="metric-under-spec" style="font-size: 2.1rem; font-weight: 900; color: #EF4444; line-height: 1.1; z-index: 1; margin-right: 2rem; margin-top: 1.8rem;">0대</div>
|
||||
</div>
|
||||
|
||||
<!-- 3. 오버 스펙 -->
|
||||
<div id="card-over-spec" style="border-right: 1px solid #EEF2F6; padding-top: 0.65rem; padding-right: 1.0rem; cursor: pointer; transition: opacity 0.2s;" onmouseover="this.style.opacity='0.7'" onmouseout="this.style.opacity='1'">
|
||||
<div style="border-left: 4px solid #F59E0B; padding-left: 8px; margin-bottom: 0.5rem; display: flex; align-items: center; line-height: 1;">
|
||||
<span style="font-size: 1.15rem; font-weight: 800; color: #1E293B; white-space: nowrap;">오버 스펙</span>
|
||||
</div>
|
||||
<div class="flex items-end justify-between">
|
||||
<div>
|
||||
<div id="metric-over-spec" style="font-size: 2.3rem; font-weight: 900; color: #F59E0B; line-height: 1; margin-bottom: 0.35rem;">0대</div>
|
||||
<span style="font-size: 1.05rem; color: #64748B; font-weight: 700; white-space: nowrap;">사양 회수 권고 자산</span>
|
||||
</div>
|
||||
<div id="card-over-spec" style="background: #ffffff; padding: 1.5rem; display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; position: relative; overflow: hidden; cursor: pointer; transition: background-color 0.15s ease;">
|
||||
<div style="display: flex; align-items: center; z-index: 1; border-left: 4px solid #F59E0B; padding-left: 8px; height: 1.4rem;">
|
||||
<span style="font-size: 1.1rem; font-weight: 850; color: #1E293B; letter-spacing: -0.3px;">오버 스펙</span>
|
||||
</div>
|
||||
<div id="metric-over-spec" style="font-size: 2.1rem; font-weight: 900; color: #F59E0B; line-height: 1.1; z-index: 1; margin-right: 2rem; margin-top: 1.8rem;">0대</div>
|
||||
</div>
|
||||
|
||||
<!-- 4. 윈도우 11 불가 PC -->
|
||||
<div id="card-win11-incompatible" style="padding-top: 0.65rem; padding-left: 1.0rem; cursor: pointer; transition: opacity 0.2s;" onmouseover="this.style.opacity='0.7'" onmouseout="this.style.opacity='1'">
|
||||
<div style="border-left: 4px solid #3B82F6; padding-left: 8px; margin-bottom: 0.5rem; display: flex; align-items: center; line-height: 1;">
|
||||
<span style="font-size: 1.15rem; font-weight: 800; color: #1E293B; white-space: nowrap;">윈도우 11 불가 PC</span>
|
||||
</div>
|
||||
<div class="flex items-end justify-between">
|
||||
<div>
|
||||
<div id="metric-win11-incompatible" style="font-size: 2.3rem; font-weight: 900; color: #3B82F6; line-height: 1; margin-bottom: 0.35rem;">0대</div>
|
||||
<span style="font-size: 1.05rem; color: #64748B; font-weight: 700; white-space: nowrap;">업데이트 미지원 하드웨어</span>
|
||||
</div>
|
||||
<div id="card-win11-incompatible" style="background: #ffffff; padding: 1.5rem; display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; position: relative; overflow: hidden; cursor: pointer; transition: background-color 0.15s ease;">
|
||||
<div style="display: flex; align-items: center; z-index: 1; border-left: 4px solid #7928ca; padding-left: 8px; height: 1.4rem;">
|
||||
<span style="font-size: 1.1rem; font-weight: 850; color: #1E293B; letter-spacing: -0.3px;">윈도우 11 불가</span>
|
||||
</div>
|
||||
<div id="metric-win11-incompatible" style="font-size: 2.1rem; font-weight: 900; color: #7928ca; line-height: 1.1; z-index: 1; margin-right: 2rem; margin-top: 1.8rem;">0대</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 상단 우측: 등급별 보유 비율 도넛 & 연도별 PC 노후도 통합 배치 (두 개의 개별 레이아웃으로 배치) -->
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 0; min-height: 0; height: 100%;">
|
||||
|
||||
<!-- 등급별 자산 종합 현황 (좌측 하단 단독 배치 및 크기 확대) -->
|
||||
<div style="background: transparent; border-radius: 0; padding: 0.75rem 0.25rem; border: none; border-bottom: 1px solid #E2E8F0; display: flex; flex-direction: column; flex: 1.0; min-height: 0;">
|
||||
|
||||
<div style="display: flex; flex-direction: column; gap: 0.9rem; justify-content: flex-start; padding-left: 0.5rem; height: 100%;">
|
||||
<!-- 메인 제목 -->
|
||||
<div style="border-left: 4px solid #1E5149; padding-left: 8px; margin-bottom: 0.4rem; display: flex; align-items: center; line-height: 1; height: 1.7rem; flex-shrink: 0;">
|
||||
<span style="font-size: 1.25rem; font-weight: 850; color: #1E293B;">등급별 자산 종합 현황</span>
|
||||
</div>
|
||||
|
||||
<!-- 종합 매트릭스 테이블 (폰트 크기 1.25rem 으로 확대 및 꽉 채우기) -->
|
||||
<div style="width: 100%; overflow-x: auto; flex: 1; display: flex; align-items: stretch;">
|
||||
<table style="width: 100%; border-collapse: collapse; text-align: left; font-size: 1.25rem; height: 100%;">
|
||||
<thead>
|
||||
<tr style="border-bottom: 2px solid #1E5149; color: #475569; font-weight: 850;">
|
||||
<th style="padding: 14px 10px; width: 32%; font-size: 1.25rem;">구분 (등급)</th>
|
||||
<th style="padding: 14px 10px; text-align: center; width: 17%; font-size: 1.25rem;">보유량</th>
|
||||
<th style="padding: 14px 10px; text-align: center; width: 17%; font-size: 1.25rem;">운영중</th>
|
||||
<th style="padding: 14px 10px; text-align: center; width: 17%; font-size: 1.25rem;">재고</th>
|
||||
<th style="padding: 14px 10px; text-align: center; width: 17%; color: #EF4444; font-size: 1.25rem;">구매 필요</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="pc-grade-matrix-tbody">
|
||||
<!-- Dynamic Matrix Contents -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 우측 컬럼 (Right Column) -->
|
||||
<div style="display: flex; flex-direction: column; gap: 0.5rem; min-height: 0;">
|
||||
|
||||
<!-- 직무별 사양 적정성 분석 차트 카드 -->
|
||||
<div style="background: transparent; border-radius: 0; padding: 0.7rem 0.25rem; border: none; border-bottom: 1px solid #E2E8F0; display: flex; flex-direction: column; flex: 1.0; min-height: 0;">
|
||||
<div style="border-left: 4px solid #1E5149; padding-left: 8px; margin-bottom: 0.5rem; display: flex; align-items: center; line-height: 1; flex-shrink: 0;">
|
||||
<span style="font-size: 1.25rem; font-weight: 850; color: #1E293B;">직무별 사양 적정성 분석</span>
|
||||
</div>
|
||||
<div style="flex: 1; min-height: 0; width: 100%; position: relative;">
|
||||
<canvas id="chart-job-scores" style="width: 100%; height: 100%;"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 우측 하단: 등급별 보유 비율 도넛 & 연도별 PC 노후도 통합 배치 (너비 축소) -->
|
||||
<div style="background: transparent; border-radius: 0; padding: 0.7rem 0.25rem; border: none; border-bottom: 1px solid #E2E8F0; display: grid; grid-template-columns: 1.15fr 1.25fr; gap: 0.8rem; flex: 1.0; min-height: 0;">
|
||||
|
||||
<!-- 1열: 등급별 보유 비율 도넛 영역 -->
|
||||
<div style="display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.7rem; padding-top: 0.1rem; min-height: 0; height: 100%;">
|
||||
<!-- 1열: 조직별 사용 비율 도넛 영역 -->
|
||||
<div style="background: #ffffff; padding: 1.5rem; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.3rem; min-height: 0; height: 100%;">
|
||||
<!-- 서브 제목 -->
|
||||
<div style="width: 100%; border-left: 4px solid #1E5149; padding-left: 8px; margin-bottom: 0.5rem; display: flex; align-items: center; line-height: 1; flex-shrink: 0; height: 1.5rem;">
|
||||
<span style="font-size: 1.25rem; font-weight: 850; color: #1E293B;">등급별 보유 비율</span>
|
||||
<div style="width: 100%; border-left: 4px solid #1E5149; padding-left: 8px; margin-bottom: 0.15rem; display: flex; align-items: center; line-height: 1; flex-shrink: 0; height: 1.4rem;">
|
||||
<span style="font-size: 1.1rem; font-weight: 850; color: #1E293B;">조직별 사용 비율</span>
|
||||
</div>
|
||||
|
||||
<!-- 도넛 그래프 (크기 조절 및 수직 가운데 정렬) -->
|
||||
<!-- 도넛 그래프 -->
|
||||
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; width: 100%; min-height: 0;">
|
||||
<div style="width: 180px; height: 180px; position: relative;">
|
||||
<div style="width: 170px; height: 170px; position: relative;">
|
||||
<canvas id="chart-overall-donut"></canvas>
|
||||
</div>
|
||||
<!-- 커스텀 범례 (폰트 최적화) -->
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; justify-content: center; align-items: center; margin-top: 10px; font-size: 1.05rem; font-weight: 700; color: #475569; width: 100%;">
|
||||
<div style="display: flex; align-items: center; gap: 4px;">
|
||||
<span style="display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #11302B;"></span>
|
||||
<span>최상급</span>
|
||||
<!-- 커스텀 범례 -->
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 0.15rem 0.35rem; justify-content: center; align-items: center; margin-top: 6px; font-size: 0.8rem; font-weight: 800; color: #64748B; width: 100%;">
|
||||
<div style="display: flex; align-items: center; gap: 3px;">
|
||||
<span style="display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #D02121;"></span>
|
||||
<span>한맥</span>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center; gap: 4px;">
|
||||
<span style="display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #1E8E7C;"></span>
|
||||
<span>상급</span>
|
||||
<div style="display: flex; align-items: center; gap: 3px;">
|
||||
<span style="display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #F58120;"></span>
|
||||
<span>삼안</span>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center; gap: 4px;">
|
||||
<span style="display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10B981;"></span>
|
||||
<span>중급</span>
|
||||
<div style="display: flex; align-items: center; gap: 3px;">
|
||||
<span style="display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #3889C7;"></span>
|
||||
<span>장헌</span>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center; gap: 4px;">
|
||||
<span style="display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #F59E0B;"></span>
|
||||
<span>보급</span>
|
||||
<div style="display: flex; align-items: center; gap: 3px;">
|
||||
<span style="display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #79B2D9;"></span>
|
||||
<span>한라</span>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center; gap: 4px;">
|
||||
<span style="display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #EF4444;"></span>
|
||||
<span>교체 대상</span>
|
||||
<div style="display: flex; align-items: center; gap: 3px;">
|
||||
<span style="display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #10B981;"></span>
|
||||
<span>기술개발센터</span>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center; gap: 3px;">
|
||||
<span style="display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #133D84;"></span>
|
||||
<span>총괄기획실</span>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center; gap: 3px;">
|
||||
<span style="display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #94A3B8;"></span>
|
||||
<span>기타</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 2열: 연도별 PC 노후도 및 교체 주기 예측 카드 (너비 줄임) -->
|
||||
<div style="display: flex; flex-direction: column; min-height: 0;">
|
||||
<div style="border-left: 4px solid #1E5149; padding-left: 8px; margin-bottom: 0.5rem; display: flex; align-items: center; line-height: 1; flex-shrink: 0; height: 1.5rem;">
|
||||
<span style="font-size: 1.25rem; font-weight: 850; color: #1E293B; white-space: nowrap;">연도별 PC 노후도 및 예측</span>
|
||||
<!-- 2열: PC 노후도 영역 (표 잘림 방지를 위해 아래 패딩을 줄이고 overflow auto 설정) -->
|
||||
<div style="background: #ffffff; padding: 1.5rem 1.5rem 0.5rem 1.5rem; display: flex; flex-direction: column; min-height: 0; height: 100%;">
|
||||
<div style="border-left: 4px solid #1E5149; padding-left: 8px; margin-bottom: 0.35rem; display: flex; align-items: center; line-height: 1; flex-shrink: 0; height: 1.4rem;">
|
||||
<span style="font-size: 1.1rem; font-weight: 850; color: #1E293B; white-space: nowrap;">PC 노후도</span>
|
||||
</div>
|
||||
<div style="flex: 1; overflow: hidden; min-height: 0; padding-right: 0.2rem;">
|
||||
<table style="width: 100%; border-collapse: collapse; text-align: left; font-size: 1.15rem;">
|
||||
<div style="flex: 1; overflow-y: auto; min-height: 0; padding-right: 0.1rem;">
|
||||
<table style="width: 100%; border-collapse: collapse; text-align: left; font-size: 1.05rem;">
|
||||
<thead style="position: sticky; top: 0; background: white; z-index: 5;">
|
||||
<tr style="border-bottom: 2px solid #1E5149; color: #475569; font-weight: 850;">
|
||||
<th style="padding: 12px 10px; width: 45%; font-size: 1.15rem;">구분 (연한)</th>
|
||||
<th style="padding: 12px 10px; text-align: center; width: 25%; font-size: 1.15rem;">보유</th>
|
||||
<th style="padding: 12px 10px; text-align: center; width: 30%; font-size: 1.15rem;">권장 조치</th>
|
||||
<th style="padding: 6px 8px; width: 70%; font-size: 1.02rem; background: white;">구분 (연한)</th>
|
||||
<th style="padding: 6px 8px; text-align: center; width: 30%; font-size: 1.02rem; background: white;">보유</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="pc-aging-tbody">
|
||||
@@ -213,11 +201,40 @@ export function renderHwDashboard(container: HTMLElement) {
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 하단 섹션 (등급별 자산 종합 현황 및 사양 적정성 분석 영역 - 높이 비율 65%로 확대) -->
|
||||
<div style="background: #ffffff; padding: 1.5rem 0; display: flex; flex-direction: column; height: 65%; min-height: 0;">
|
||||
<div style="display: flex; flex-direction: column; gap: 0.6rem; justify-content: flex-start; height: 100%;">
|
||||
<!-- 메인 제목 -->
|
||||
<div style="border-left: 4px solid #1E5149; padding-left: 8px; margin-bottom: 0.1rem; display: flex; align-items: center; line-height: 1; height: 1.6rem; flex-shrink: 0;">
|
||||
<span style="font-size: 1.25rem; font-weight: 850; color: #1E293B;">등급별 자산 종합현황</span>
|
||||
</div>
|
||||
|
||||
<!-- 종합 매트릭스 테이블 -->
|
||||
<div style="width: 100%; overflow-y: hidden; flex: 1; border-radius: 0;">
|
||||
<table style="width: 100%; border-collapse: collapse; text-align: left; font-size: 1.05rem;">
|
||||
<thead style="position: sticky; top: 0; background: #F8FAFC; z-index: 10;">
|
||||
<tr style="border-bottom: 2px solid #E2E8F0; color: #475569; font-weight: 850;">
|
||||
<th style="padding: 16px 10px; width: 18%; font-size: 1.05rem; background: #F8FAFC; border-bottom: 2px solid #1E5149;">구분 (등급)</th>
|
||||
<th style="padding: 16px 10px; text-align: center; width: 8%; font-size: 1.05rem; background: #F8FAFC; border-bottom: 2px solid #1E5149;">보유량</th>
|
||||
<th style="padding: 16px 10px; text-align: center; width: 8%; font-size: 1.05rem; background: #F8FAFC; border-bottom: 2px solid #1E5149;">운영중</th>
|
||||
<th style="padding: 16px 10px; text-align: center; width: 8%; font-size: 1.05rem; background: #F8FAFC; border-bottom: 2px solid #1E5149;">재고</th>
|
||||
<th style="padding: 16px 10px; text-align: center; width: 8%; color: #EF4444; font-size: 1.05rem; background: #F8FAFC; border-bottom: 2px solid #1E5149;">부족분</th>
|
||||
<th style="padding: 16px 10px; text-align: center; width: 50%; font-size: 1.05rem; background: #F8FAFC; border-bottom: 2px solid #1E5149;">사양 적정성</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="pc-grade-matrix-tbody">
|
||||
<!-- Dynamic Matrix Contents -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<style>
|
||||
.dept-filter-btn { padding: 6px 14px; font-size: 0.85rem; font-weight: 700; border-radius: 6px; border: none; background: transparent; color: var(--mute); cursor: pointer; transition: all 0.2s; }
|
||||
@@ -246,7 +263,16 @@ export function renderHwDashboard(container: HTMLElement) {
|
||||
});
|
||||
|
||||
btn.classList.add('active');
|
||||
btn.style.background = '#1E5149';
|
||||
const dept = btn.getAttribute('data-dept') || '';
|
||||
let bgColor = '#1E5149';
|
||||
if (dept === '한맥') bgColor = '#D02121';
|
||||
else if (dept === '삼안') bgColor = '#F58120';
|
||||
else if (dept === '장헌') bgColor = '#3889C7';
|
||||
else if (dept === '한라') bgColor = '#79B2D9';
|
||||
else if (dept === '기술개발센터') bgColor = '#10B981';
|
||||
else if (dept === '총괄기획실') bgColor = '#133D84';
|
||||
|
||||
btn.style.background = bgColor;
|
||||
btn.style.color = 'white';
|
||||
|
||||
const selectedDept = btn.getAttribute('data-dept') || '';
|
||||
@@ -272,13 +298,31 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
});
|
||||
|
||||
// 3. DB 기준 사양 데이터 맵핑 (state.masterData.jobSpecs 이용)
|
||||
const jobSpecsMap: Record<string, number> = {};
|
||||
const jobSpecsMap: Record<string, string> = {};
|
||||
if (state.masterData.jobSpecs) {
|
||||
state.masterData.jobSpecs.forEach((s: any) => {
|
||||
jobSpecsMap[s.job_name] = s.min_score;
|
||||
jobSpecsMap[s.job_name] = s.required_grade || '중급';
|
||||
});
|
||||
}
|
||||
|
||||
// 사용자 이름 → 세부 직무 맵 생성 (system_users.position 기준, 더 정확한 직무 구분)
|
||||
const userPositionMap: Record<string, string> = {};
|
||||
if (state.masterData.users) {
|
||||
state.masterData.users.forEach((u: any) => {
|
||||
if (u.user_name && u.position) {
|
||||
userPositionMap[u.user_name.trim()] = u.position.trim();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const GRADE_RANK: Record<string, number> = {
|
||||
'premium': 4, '최상급': 4,
|
||||
'high': 3, '상급': 3,
|
||||
'normal': 2, '중급': 2,
|
||||
'entry': 1, '보급': 1,
|
||||
'replace': 0, '교체 대상': 0
|
||||
};
|
||||
|
||||
const jobScores: Record<string, { totalScore: number; count: number; avg: number }> = {};
|
||||
pcs.forEach((p: any) => {
|
||||
const score = calculatePcScoreDeductive(p.cpu, p.ram, p.gpu, p.purchase_date);
|
||||
@@ -326,7 +370,7 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
currentGradeKey = 'high';
|
||||
} else if (score >= 40) {
|
||||
currentGradeKey = 'normal';
|
||||
} else if (score >= 20 && !win11Incompatible) {
|
||||
} else if (score >= 20) {
|
||||
currentGradeKey = 'entry';
|
||||
} else {
|
||||
currentGradeKey = 'replace';
|
||||
@@ -343,23 +387,32 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
currentTarget.active++;
|
||||
currentTarget.activePcs.push(p);
|
||||
|
||||
// 직무 적정성 계산 (재직 중이고 실 사용자 매핑 자산만 검토 대상)
|
||||
const job = p[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
const standardScore = jobSpecsMap[job] !== undefined ? jobSpecsMap[job] : (jobScores[job]?.avg || 0);
|
||||
// 직무 적정성 계산: system_users.position 우선 조회 → asset_core.user_position fallback
|
||||
const userName = (p[ASSET_SCHEMA.CURRENT_USER.key] || '').trim();
|
||||
const job = userPositionMap[userName] || p[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
const requiredGrade = jobSpecsMap[job] || jobSpecsMap[p[ASSET_SCHEMA.USER_POSITION.key]] || '중급'; // 세부 직무 우선, 없으면 일반 직무, 없으면 기본 중급
|
||||
|
||||
// 미니 모달 표시용으로 해석된 세부 직무명 저장
|
||||
p._resolved_position = job;
|
||||
|
||||
const actualGrade = currentGradeKey; // premium, high, normal, entry, replace 중 하나
|
||||
|
||||
const reqRank = GRADE_RANK[requiredGrade] !== undefined ? GRADE_RANK[requiredGrade] : 2; // '중급' rank
|
||||
const actRank = GRADE_RANK[actualGrade] !== undefined ? GRADE_RANK[actualGrade] : 0;
|
||||
|
||||
let isUnder = false;
|
||||
|
||||
if (standardScore > 0 && job !== '재고PC') {
|
||||
if (score < standardScore * 0.6) {
|
||||
if (job !== '재고PC') {
|
||||
if (win11Incompatible) {
|
||||
isUnder = true;
|
||||
p._spec_status = '사양 부족';
|
||||
} else if (score > standardScore * 1.5 && !win11Incompatible) {
|
||||
} else if (actRank < reqRank) {
|
||||
isUnder = true;
|
||||
p._spec_status = '사양 부족';
|
||||
} else if (actRank > reqRank) {
|
||||
p._spec_status = '오버스펙';
|
||||
criticalList.push(p);
|
||||
overSpecCount++;
|
||||
} else if (win11Incompatible) {
|
||||
isUnder = true;
|
||||
p._spec_status = '사양 부족';
|
||||
} else {
|
||||
p._spec_status = '적정';
|
||||
}
|
||||
@@ -377,16 +430,11 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
underSpecCount++;
|
||||
|
||||
// 2. 사양 부족 시 교체받아야 할 직무별 권장 목표 등급 판정
|
||||
let targetGradeKey: keyof typeof matrix;
|
||||
if (standardScore >= 85) {
|
||||
targetGradeKey = 'premium';
|
||||
} else if (standardScore >= 70) {
|
||||
targetGradeKey = 'high';
|
||||
} else if (standardScore >= 40) {
|
||||
targetGradeKey = 'normal';
|
||||
} else {
|
||||
targetGradeKey = 'entry'; // 교체 대상은 최소 보급형 사양으로 교체
|
||||
}
|
||||
let targetGradeKey: keyof typeof matrix = 'normal';
|
||||
if (requiredGrade === '최상급') targetGradeKey = 'premium';
|
||||
else if (requiredGrade === '상급') targetGradeKey = 'high';
|
||||
else if (requiredGrade === '중급') targetGradeKey = 'normal';
|
||||
else if (requiredGrade === '보급') targetGradeKey = 'entry';
|
||||
|
||||
const targetGrade = matrix[targetGradeKey];
|
||||
targetGrade.under++;
|
||||
@@ -409,20 +457,79 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
// 6. 종합 매트릭스 테이블 렌더링 및 바인딩
|
||||
const matrixTbody = document.getElementById('pc-grade-matrix-tbody')!;
|
||||
|
||||
const getSpecStatusCounts = (activePcsList: any[]) => {
|
||||
let win11 = 0;
|
||||
let under = 0;
|
||||
let normal = 0;
|
||||
let over = 0;
|
||||
activePcsList.forEach(p => {
|
||||
if (isWindows11Incompatible(p.cpu, p.ram)) win11++;
|
||||
else if (p._spec_status === '사양 부족') under++;
|
||||
else if (p._spec_status === '오버스펙') over++;
|
||||
else normal++;
|
||||
});
|
||||
return { win11, under, normal, over };
|
||||
};
|
||||
|
||||
const maxTotal = Math.max(
|
||||
matrix.premium.total,
|
||||
matrix.high.total,
|
||||
matrix.normal.total,
|
||||
matrix.entry.total,
|
||||
matrix.replace.total
|
||||
);
|
||||
|
||||
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 cellStyle = `padding: 22px 8px; text-align: center; font-weight: 700; cursor: pointer; transition: background 0.2s; font-size: 1.05rem;`;
|
||||
const hoverEvents = `onmouseover="this.style.background='#F1F5F9'" onmouseout="this.style.background='none'"`;
|
||||
|
||||
// 사양 적정성 분석 데이터 계산 (운영중인 자산만)
|
||||
const { win11, under, normal, over } = getSpecStatusCounts(data.activePcs);
|
||||
const activeCount = data.active;
|
||||
|
||||
const win11Pct = activeCount > 0 ? (win11 / activeCount) * 100 : 0;
|
||||
const underPct = activeCount > 0 ? (under / activeCount) * 100 : 0;
|
||||
const normalPct = activeCount > 0 ? (normal / activeCount) * 100 : 0;
|
||||
const overPct = activeCount > 0 ? (over / activeCount) * 100 : 0;
|
||||
|
||||
const rowTotal = data.total;
|
||||
const barWidthPct = maxTotal > 0 ? (rowTotal / maxTotal) * 100 : 0;
|
||||
|
||||
let barGraphHtml = '';
|
||||
if (activeCount > 0) {
|
||||
barGraphHtml = `
|
||||
<div style="position: relative; display: inline-block; width: 100%; max-width: 100%; text-align: left;" class="spec-bar-container">
|
||||
<!-- 게이지 바 (보유량 비례) -->
|
||||
<div class="spec-bar-wrapper" style="display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #EEF2F6; width: ${barWidthPct}%; min-width: 15px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.06); cursor: pointer;">
|
||||
${win11 > 0 ? `<div style="width: ${win11Pct}%; background: #7928ca; border-right: 2px solid #ffffff; cursor: pointer; transition: opacity 0.15s;" title="윈도우 11 불가: ${win11}대" class="spec-segment-btn" data-grade="${gradeKey}" data-spec-status="윈도우 11 불가" onmouseover="showSpecTooltip(event, this, 'win11', ${win11}); this.style.opacity='0.85';" onmousemove="updateSpecTooltipPos(event, this);" onmouseout="hideSpecTooltip(this); this.style.opacity='1';"></div>` : ''}
|
||||
${under > 0 ? `<div style="width: ${underPct}%; background: #EF4444; border-right: 2px solid #ffffff; cursor: pointer; transition: opacity 0.15s;" title="사양 부족: ${under}대" class="spec-segment-btn" data-grade="${gradeKey}" data-spec-status="사양 부족" onmouseover="showSpecTooltip(event, this, 'under', ${under}); this.style.opacity='0.85';" onmousemove="updateSpecTooltipPos(event, this);" onmouseout="hideSpecTooltip(this); this.style.opacity='1';"></div>` : ''}
|
||||
${normal > 0 ? `<div style="width: ${normalPct}%; background: #1E5149; border-right: 2px solid #ffffff; cursor: pointer; transition: opacity 0.15s;" title="적정 사양: ${normal}대" class="spec-segment-btn" data-grade="${gradeKey}" data-spec-status="적정" onmouseover="showSpecTooltip(event, this, 'normal', ${normal}); this.style.opacity='0.85';" onmousemove="updateSpecTooltipPos(event, this);" onmouseout="hideSpecTooltip(this); this.style.opacity='1';"></div>` : ''}
|
||||
${over > 0 ? `<div style="width: ${overPct}%; background: #F59E0B; cursor: pointer; transition: opacity 0.15s;" title="오버 스펙: ${over}대" class="spec-segment-btn" data-grade="${gradeKey}" data-spec-status="오버스펙" onmouseover="showSpecTooltip(event, this, 'over', ${over}); this.style.opacity='0.85';" onmousemove="updateSpecTooltipPos(event, this);" onmouseout="hideSpecTooltip(this); this.style.opacity='1';"></div>` : ''}
|
||||
</div>
|
||||
<!-- 마우스 오버 시 나타날 커스텀 말풍선 툴팁 -->
|
||||
<div class="spec-tooltip" style="position: fixed; transform: translate(-50%, -100%); margin-top: -10px; background: #1E293B; color: #ffffff; padding: 6px 10px; border-radius: 6px; font-size: 11px; white-space: nowrap; box-shadow: 0 4px 6px rgba(0,0,0,0.15); opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 9999; display: flex; gap: 8px; align-items: center;">
|
||||
<span class="tooltip-text"></span>
|
||||
<div style="position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1E293B;"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
barGraphHtml = `<span style="font-size: 0.88rem; color: #94A3B8; font-weight: 550;">운영중 자산 없음</span>`;
|
||||
}
|
||||
|
||||
return `
|
||||
<tr style="border-bottom: 1px solid #F1F5F9;">
|
||||
<td style="padding: 14px 12px; font-weight: 800; color: ${color}; font-size: 1.25rem;">${label}</td>
|
||||
<td class="matrix-cell" data-grade="${gradeKey}" data-type="total" style="${cellStyle}" ${hoverEvents}>${data.total}대 <span style="font-size:1.0rem; color:#64748B; font-weight:500;">(${totalRate}%)</span></td>
|
||||
<tr style="border-bottom: 1px solid #E2E8F0;">
|
||||
<td style="padding: 22px 10px; font-weight: 800; color: ${color}; font-size: 1.05rem;">${label}</td>
|
||||
<td class="matrix-cell" data-grade="${gradeKey}" data-type="total" style="${cellStyle}" ${hoverEvents}>${data.total}대 <span style="font-size:0.88rem; color:#64748B; font-weight:500;">(${totalRate}%)</span></td>
|
||||
<td class="matrix-cell" data-grade="${gradeKey}" data-type="active" style="${cellStyle}" ${hoverEvents}>${data.active}대</td>
|
||||
<td class="matrix-cell" data-grade="${gradeKey}" data-type="stock" style="${cellStyle}" ${hoverEvents}>${data.stock}대</td>
|
||||
<td class="matrix-cell" data-grade="${gradeKey}" data-type="under" style="${cellStyle} color: #EF4444;" ${hoverEvents}>${shortage}대</td>
|
||||
<td style="padding: 22px 8px; text-align: center; font-weight: 700; font-size: 1.05rem; vertical-align: middle;">
|
||||
${barGraphHtml}
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
};
|
||||
@@ -443,7 +550,34 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
|
||||
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 totalActivePcs = filtered.filter(p => !isStock(p));
|
||||
const { win11: totWin11, under: totUnder, normal: totNormal, over: totOver } = getSpecStatusCounts(totalActivePcs);
|
||||
const totUnderPct = totalActive > 0 ? (totUnder / totalActive) * 100 : 0;
|
||||
const totNormalPct = totalActive > 0 ? (totNormal / totalActive) * 100 : 0;
|
||||
const totOverPct = totalActive > 0 ? (totOver / totalActive) * 100 : 0;
|
||||
|
||||
let totBarGraphHtml = '';
|
||||
if (totalActive > 0) {
|
||||
totBarGraphHtml = `
|
||||
<div style="position: relative; display: inline-block; width: 100%; max-width: 100%; text-align: left;" class="spec-bar-container">
|
||||
<!-- 게이지 바 (합계는 100% 너비) -->
|
||||
<div class="spec-bar-wrapper" style="display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #EEF2F6; width: 100%; box-shadow: inset 0 1px 2px rgba(0,0,0,0.06); cursor: pointer;">
|
||||
${totUnder > 0 ? `<div style="width: ${totUnderPct}%; background: #EF4444; border-right: 2px solid #ffffff; cursor: pointer; transition: opacity 0.15s;" title="사양 부족: ${totUnder}대" class="spec-segment-btn" data-grade="all" data-spec-status="사양 부족" onmouseover="showSpecTooltip(event, this, 'under', ${totUnder}); this.style.opacity='0.85';" onmousemove="updateSpecTooltipPos(event, this);" onmouseout="hideSpecTooltip(this); this.style.opacity='1';"></div>` : ''}
|
||||
${totNormal > 0 ? `<div style="width: ${totNormalPct}%; background: #1E5149; border-right: 2px solid #ffffff; cursor: pointer; transition: opacity 0.15s;" title="적정 사양: ${totNormal}대" class="spec-segment-btn" data-grade="all" data-spec-status="적정" onmouseover="showSpecTooltip(event, this, 'normal', ${totNormal}); this.style.opacity='0.85';" onmousemove="updateSpecTooltipPos(event, this);" onmouseout="hideSpecTooltip(this); this.style.opacity='1';"></div>` : ''}
|
||||
${totOver > 0 ? `<div style="width: ${totOverPct}%; background: #F59E0B; cursor: pointer; transition: opacity 0.15s;" title="오버 스펙: ${totOver}대" class="spec-segment-btn" data-grade="all" data-spec-status="오버스펙" onmouseover="showSpecTooltip(event, this, 'over', ${totOver}); this.style.opacity='0.85';" onmousemove="updateSpecTooltipPos(event, this);" onmouseout="hideSpecTooltip(this); this.style.opacity='1';"></div>` : ''}
|
||||
</div>
|
||||
<!-- 마우스 오버 시 나타날 커스텀 말풍선 툴팁 -->
|
||||
<div class="spec-tooltip" style="position: fixed; transform: translate(-50%, -100%); margin-top: -10px; background: #1E293B; color: #ffffff; padding: 6px 10px; border-radius: 6px; font-size: 11px; white-space: nowrap; box-shadow: 0 4px 6px rgba(0,0,0,0.15); opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 9999; display: flex; gap: 8px; align-items: center;">
|
||||
<span class="tooltip-text"></span>
|
||||
<div style="position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1E293B;"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
totBarGraphHtml = `<span style="font-size: 0.88rem; color: #94A3B8; font-weight: 550;">운영중 자산 없음</span>`;
|
||||
}
|
||||
|
||||
const cellStyleHeader = `padding: 12px 10px; text-align: center; font-weight: 800; cursor: pointer; transition: background 0.2s; background: #F8FAFC; font-size: 1.05rem;`;
|
||||
const hoverEventsHeader = `onmouseover="this.style.background='#EEF2F6'" onmouseout="this.style.background='#F8FAFC'"`;
|
||||
|
||||
matrixTbody.innerHTML = `
|
||||
@@ -451,14 +585,7 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
${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)}
|
||||
<tr style="background: #F8FAFC; border-top: 2px solid #E2E8F0; font-weight: 800;">
|
||||
<td style="padding: 14px 12px; color: #1E293B; font-weight: 800; font-size: 1.25rem;">합계 (Total)</td>
|
||||
<td class="matrix-cell" data-grade="all" data-type="total" style="${cellStyleHeader}" ${hoverEventsHeader}>${totalPcs}대 <span style="font-size:1.125rem; color:#64748B; font-weight:600;">(100%)</span></td>
|
||||
<td class="matrix-cell" data-grade="all" data-type="active" style="${cellStyleHeader}" ${hoverEventsHeader}>${totalActive}대</td>
|
||||
<td class="matrix-cell" data-grade="all" data-type="stock" style="${cellStyleHeader}" ${hoverEventsHeader}>${totalStock}대</td>
|
||||
<td class="matrix-cell" data-grade="all" data-type="under" style="${cellStyleHeader} color: #EF4444;" ${hoverEventsHeader}>${totalShortage}대</td>
|
||||
</tr>
|
||||
${renderMatrixRow('replace', '교체 대상 PC (20점 미만)', '#EF4444', replaceShortage)}
|
||||
`;
|
||||
|
||||
// 셀별 동적 클릭 리스너 바인딩
|
||||
@@ -483,7 +610,7 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
if (t === 'total') return '보유';
|
||||
if (t === 'active') return '운영중';
|
||||
if (t === 'stock') return '재고';
|
||||
if (t === 'under') return '구매 필요';
|
||||
if (t === 'under') return '부족분';
|
||||
return '';
|
||||
};
|
||||
|
||||
@@ -515,6 +642,48 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
});
|
||||
});
|
||||
|
||||
// 바그래프 세그먼트 또는 텍스트 클릭 리스너 설정
|
||||
const handleSpecClick = (e: Event) => {
|
||||
e.stopPropagation();
|
||||
const target = e.currentTarget as HTMLElement;
|
||||
const grade = target.getAttribute('data-grade')!;
|
||||
const status = target.getAttribute('data-spec-status')!;
|
||||
|
||||
let targetPcs: any[] = [];
|
||||
const filterFn = (p: any) => {
|
||||
if (status === '윈도우 11 불가') {
|
||||
return isWindows11Incompatible(p.cpu, p.ram);
|
||||
} else if (status === '사양 부족') {
|
||||
return !isWindows11Incompatible(p.cpu, p.ram) && p._spec_status === '사양 부족';
|
||||
} else {
|
||||
return p._spec_status === status;
|
||||
}
|
||||
};
|
||||
|
||||
if (grade === 'all') {
|
||||
targetPcs = filtered.filter(p => !isStock(p) && filterFn(p));
|
||||
} else {
|
||||
const data = matrix[grade as keyof typeof matrix];
|
||||
targetPcs = data.activePcs.filter(filterFn);
|
||||
}
|
||||
|
||||
const getGradeLabel = (g: string) => {
|
||||
if (g === 'premium') return '최상급 PC';
|
||||
if (g === 'high') return '상급 PC';
|
||||
if (g === 'normal') return '중급 PC';
|
||||
if (g === 'entry') return '보급 PC';
|
||||
if (g === 'replace') return '교체 대상 PC';
|
||||
return '전체 PC';
|
||||
};
|
||||
|
||||
const title = `${getGradeLabel(grade)} - ${status} 자산 목록`;
|
||||
showMiniListModal(title, targetPcs);
|
||||
};
|
||||
|
||||
matrixTbody.querySelectorAll('.spec-segment-btn, .spec-text-btn').forEach(btn => {
|
||||
btn.addEventListener('click', handleSpecClick);
|
||||
});
|
||||
|
||||
// 7. 연도별 PC 노후도 집계 및 렌더링
|
||||
const agingCounts = {
|
||||
immediate: [] as any[], // 7년 이상
|
||||
@@ -538,23 +707,20 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
|
||||
const agingTbody = document.getElementById('pc-aging-tbody')!;
|
||||
|
||||
const renderAgingRow = (label: string, list: any[], badgeText: string, badgeStyle: string, ageGroupKey: string) => {
|
||||
const renderAgingRow = (label: string, list: any[], ageGroupKey: string) => {
|
||||
return `
|
||||
<tr style="border-bottom:1px solid #F1F5F9; cursor:pointer; transition: background 0.2s;" class="aging-row" data-group="${ageGroupKey}" onmouseover="this.style.background='#F8FAFC'" onmouseout="this.style.background='none'">
|
||||
<td style="padding:10px 10px; font-weight:700; color:#334155; font-size: 1.15rem;">${label}</td>
|
||||
<td style="padding:10px 10px; text-align:center; font-weight:700; color:#334155; font-size: 1.15rem;">${list.length}대</td>
|
||||
<td style="padding:10px 10px; text-align:center;">
|
||||
<span style="padding:2px 8px; border-radius:4px; font-size:14px; font-weight:800; ${badgeStyle}">${badgeText}</span>
|
||||
</td>
|
||||
<td style="padding:5px 8px; font-weight:700; color:#334155; font-size: 1.05rem;">${label}</td>
|
||||
<td style="padding:5px 8px; text-align:center; font-weight:700; color:#334155; font-size: 1.05rem;">${list.length}대</td>
|
||||
</tr>
|
||||
`;
|
||||
};
|
||||
|
||||
agingTbody.innerHTML = `
|
||||
${renderAgingRow('즉시 교체 (7년 이상)', agingCounts.immediate, '즉시 교체', 'background:#FFF1F2; color:#EF4444; border:1px solid #FCA5A5;', 'immediate')}
|
||||
${renderAgingRow('교체 검토 (3년 ~ 7년)', agingCounts.review, '교체 검토', 'background:#FFF7ED; color:#D97706; border:1px solid #FCD34D;', 'review')}
|
||||
${renderAgingRow('정상 운용 (1년 ~ 3년)', agingCounts.normal, '정상 운용', 'background:#ECFDF5; color:#059669; border:1px solid #A7F3D0;', 'normal')}
|
||||
${renderAgingRow('최신 도입 (1년 미만)', agingCounts.fresh, '최신 도입', 'background:#F0FDF4; color:#16A34A; border:1px solid #BBF7D0;', 'fresh')}
|
||||
${renderAgingRow('즉시 교체 (7년 이상)', agingCounts.immediate, 'immediate')}
|
||||
${renderAgingRow('교체 검토 (3년 ~ 7년)', agingCounts.review, 'review')}
|
||||
${renderAgingRow('정상 운용 (1년 ~ 3년)', agingCounts.normal, 'normal')}
|
||||
${renderAgingRow('최신 도입 (1년 미만)', agingCounts.fresh, 'fresh')}
|
||||
`;
|
||||
|
||||
agingTbody.querySelectorAll('.aging-row').forEach(row => {
|
||||
@@ -572,14 +738,14 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
});
|
||||
|
||||
// 8. 요약 지표 카드 클릭 리스너 설정
|
||||
const bindCardClick = (id: string, gradeTitle: string, filterFn: (p: any) => boolean) => {
|
||||
const bindCardClick = (id: string, gradeTitle: string, filterFn: (p: any) => boolean, hoverBgColor: string) => {
|
||||
const card = document.getElementById(id)!;
|
||||
if (!card) return;
|
||||
card.style.cursor = 'pointer';
|
||||
card.style.transition = 'opacity 0.2s';
|
||||
card.style.transition = 'background-color 0.15s ease';
|
||||
|
||||
card.onmouseover = () => { card.style.opacity = '0.7'; };
|
||||
card.onmouseout = () => { card.style.opacity = '1'; };
|
||||
card.onmouseover = () => { card.style.backgroundColor = hoverBgColor; };
|
||||
card.onmouseout = () => { card.style.backgroundColor = '#ffffff'; };
|
||||
|
||||
card.onclick = () => {
|
||||
const pcsInGrade = filtered.filter(filterFn);
|
||||
@@ -588,54 +754,51 @@ function updateDashboardData(pcs: any[], selectedDept: string) {
|
||||
};
|
||||
|
||||
// 사양 부족 / 오버 스펙 / 윈도우 11 불가 클릭 리스너 설정
|
||||
bindCardClick('card-under-spec', '사양 부족 대상', p => p._spec_status === '사양 부족');
|
||||
bindCardClick('card-over-spec', '오버 스펙 대상', p => p._spec_status === '오버스펙');
|
||||
bindCardClick('card-win11-incompatible', '윈도우 11 업그레이드 불가 PC', p => isWindows11Incompatible(p.cpu, p.ram));
|
||||
bindCardClick('card-under-spec', '사양 부족 대상', p => p._spec_status === '사양 부족', '#FEF2F2');
|
||||
bindCardClick('card-over-spec', '오버 스펙 대상', p => p._spec_status === '오버스펙', '#FFFBEB');
|
||||
bindCardClick('card-win11-incompatible', '윈도우 11 업그레이드 불가 PC', p => isWindows11Incompatible(p.cpu, p.ram), '#F5F3FF');
|
||||
|
||||
// 9. 직무별 사양 적정성 대수 연산 및 차트 데이터 셋 구성 (누적 막대 그래프화)
|
||||
const activeJobs = Array.from(
|
||||
new Set(filtered.map((p: any) => p[ASSET_SCHEMA.USER_POSITION.key] || '미분류').filter(j => j !== '재고PC'))
|
||||
).sort();
|
||||
// 9. 조직별 사용 비율 집계 (전체 개인용 PC 기준)
|
||||
const deptCounts: Record<string, number> = {
|
||||
'한맥': 0,
|
||||
'삼안': 0,
|
||||
'장헌': 0,
|
||||
'한라': 0,
|
||||
'기술개발센터': 0,
|
||||
'총괄기획실': 0,
|
||||
'기타': 0
|
||||
};
|
||||
|
||||
const underData: number[] = [];
|
||||
const normalData: number[] = [];
|
||||
const overData: number[] = [];
|
||||
|
||||
activeJobs.forEach(job => {
|
||||
const jobPcs = filtered.filter((p: any) => (p[ASSET_SCHEMA.USER_POSITION.key] || '미분류') === job);
|
||||
const totalCount = jobPcs.length;
|
||||
if (totalCount === 0) {
|
||||
underData.push(0);
|
||||
normalData.push(0);
|
||||
overData.push(0);
|
||||
return;
|
||||
pcs.forEach((p: any) => {
|
||||
const dept = String(p[ASSET_SCHEMA.CURRENT_DEPT.key] || '').trim();
|
||||
let matched = false;
|
||||
for (const key of Object.keys(deptCounts)) {
|
||||
if (key !== '기타' && dept.includes(key)) {
|
||||
deptCounts[key]++;
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
let under = 0;
|
||||
let normal = 0;
|
||||
let over = 0;
|
||||
|
||||
jobPcs.forEach(p => {
|
||||
const stockYn = isStock(p);
|
||||
if (!stockYn) {
|
||||
if (p._spec_status === '사양 부족') { under++; }
|
||||
else if (p._spec_status === '오버스펙') { over++; }
|
||||
else { normal++; }
|
||||
} else {
|
||||
normal++; // 예외 폴백
|
||||
}
|
||||
if (!matched) {
|
||||
deptCounts['기타']++;
|
||||
}
|
||||
});
|
||||
|
||||
underData.push(under);
|
||||
normalData.push(normal);
|
||||
overData.push(over);
|
||||
});
|
||||
const deptChartData = [
|
||||
{ label: '한맥', count: deptCounts['한맥'], color: '#D02121' },
|
||||
{ label: '삼안', count: deptCounts['삼안'], color: '#F58120' },
|
||||
{ label: '장헌', count: deptCounts['장헌'], color: '#3889C7' },
|
||||
{ label: '한라', count: deptCounts['한라'], color: '#79B2D9' },
|
||||
{ label: '기술개발센터', count: deptCounts['기술개발센터'], color: '#10B981' },
|
||||
{ label: '총괄기획실', count: deptCounts['총괄기획실'], color: '#133D84' },
|
||||
{ label: '기타', count: deptCounts['기타'], color: '#94A3B8' }
|
||||
];
|
||||
|
||||
// 10. 차트들 렌더링 호출
|
||||
renderChart(activeJobs, underData, normalData, overData, filtered);
|
||||
renderDonutChart(matrix.premium.total, matrix.high.total, matrix.normal.total, matrix.entry.total, matrix.replace.total);
|
||||
// 10. 도넛 차트 렌더링 호출
|
||||
renderDonutChart(deptChartData);
|
||||
|
||||
// 전역 상태 등록
|
||||
state.activeCharts = [jobChartInstance, donutChartInstance];
|
||||
state.activeCharts = [donutChartInstance];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -701,7 +864,7 @@ function showMiniListModal(title: string, list: any[]) {
|
||||
return `
|
||||
<tr style="border-bottom: 1px solid #F1F5F9; cursor: pointer; transition: background 0.2s;" class="mini-modal-row" data-id="${pc.id}" onmouseover="this.style.background='#F8FAFC'" onmouseout="this.style.background='none'">
|
||||
<td style="padding: 12px 4px; font-weight: 700; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="${user}">${user}</td>
|
||||
<td style="padding: 12px 4px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="${pc.current_dept || '-'} (${pc.user_position || '-'})">${pc.current_dept || '-'} (${pc.user_position || '-'})</td>
|
||||
<td style="padding: 12px 4px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="${pc.current_dept || '-'} (${pc._resolved_position || pc.user_position || '-'})">${pc.current_dept || '-'} (${pc._resolved_position || pc.user_position || '-'})</td>
|
||||
<td style="padding: 12px 4px; color: #64748B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="${spec}">${spec}</td>
|
||||
<td style="padding: 12px 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${badgeHTML}${scoreHTML}</td>
|
||||
<td style="padding: 12px 4px; font-family: monospace; color: #475569; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" title="${pc.asset_code || '-'}">${pc.asset_code || '-'}</td>
|
||||
@@ -752,144 +915,12 @@ function showMiniListModal(title: string, list: any[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Chart.js 가로형 100% 스택 막대 차트 (라이트 테마 튜닝)
|
||||
*/
|
||||
function renderChart(labels: string[], underData: number[], normalData: number[], overData: number[], currentFiltered: any[]) {
|
||||
const ctx = document.getElementById('chart-job-scores') as HTMLCanvasElement;
|
||||
if (!ctx || typeof Chart === 'undefined') return;
|
||||
|
||||
if (jobChartInstance) {
|
||||
jobChartInstance.destroy();
|
||||
jobChartInstance = null;
|
||||
}
|
||||
|
||||
jobChartInstance = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [
|
||||
{
|
||||
label: '사양 부족',
|
||||
data: underData,
|
||||
backgroundColor: 'rgba(239, 68, 68, 0.85)', // Rose Red
|
||||
borderColor: 'rgb(239, 68, 68)',
|
||||
borderWidth: 1,
|
||||
borderRadius: 4,
|
||||
barPercentage: 0.45,
|
||||
categoryPercentage: 0.8
|
||||
},
|
||||
{
|
||||
label: '적정 사양',
|
||||
data: normalData,
|
||||
backgroundColor: 'rgba(30, 81, 73, 0.85)', // Hanmac Green
|
||||
borderColor: 'rgb(30, 81, 73)',
|
||||
borderWidth: 1,
|
||||
borderRadius: 4,
|
||||
barPercentage: 0.45,
|
||||
categoryPercentage: 0.8
|
||||
},
|
||||
{
|
||||
label: '오버 스펙',
|
||||
data: overData,
|
||||
backgroundColor: 'rgba(217, 119, 6, 0.85)', // Amber Orange
|
||||
borderColor: 'rgb(217, 119, 6)',
|
||||
borderWidth: 1,
|
||||
borderRadius: 4,
|
||||
barPercentage: 0.45,
|
||||
categoryPercentage: 0.8
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
indexAxis: 'y',
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
onHover: (event: any, activeElements: any[]) => {
|
||||
event.chart.canvas.style.cursor = activeElements.length ? 'pointer' : 'default';
|
||||
},
|
||||
onClick: (event: any, activeElements: any[]) => {
|
||||
if (activeElements && activeElements.length > 0) {
|
||||
const activeElement = activeElements[0];
|
||||
const datasetIndex = activeElement.datasetIndex; // 0: 사양 부족, 1: 적정 사양, 2: 오버스펙
|
||||
const index = activeElement.index; // 직무군 인덱스
|
||||
|
||||
const clickedJob = labels[index];
|
||||
const statusLabels = ['사양 부족', '적정', '오버스펙'];
|
||||
const clickedStatus = statusLabels[datasetIndex] || '적정';
|
||||
|
||||
// 해당 직무군과 사양 상태가 매칭되는 자산 목록 필터링
|
||||
const matchedPcs = currentFiltered.filter((p: any) => {
|
||||
const job = p[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
if (job !== clickedJob) return false;
|
||||
|
||||
const stockYn = p.hw_status === '재고' ||
|
||||
p.hw_status === '대기' ||
|
||||
!(p.user_current || '').trim();
|
||||
|
||||
let specStatus = '적정';
|
||||
if (!stockYn) {
|
||||
specStatus = p._spec_status || '적정';
|
||||
}
|
||||
return specStatus === clickedStatus;
|
||||
});
|
||||
|
||||
showMiniListModal(`${clickedJob} - ${clickedStatus === '적정' ? '적정 사양' : (clickedStatus === '오버스펙' ? '오버 스펙' : clickedStatus)} 자산`, matchedPcs);
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'top',
|
||||
align: 'end',
|
||||
labels: {
|
||||
font: { family: 'Pretendard', size: 16, weight: '700' },
|
||||
color: '#475569',
|
||||
boxWidth: 12,
|
||||
boxHeight: 12,
|
||||
usePointStyle: true
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
titleFont: { family: 'Pretendard', size: 12, weight: '700' },
|
||||
bodyFont: { family: 'Pretendard', size: 12 },
|
||||
callbacks: {
|
||||
label: function (context: any) {
|
||||
const datasetLabel = context.dataset.label;
|
||||
const value = context.raw; // 실제 대수
|
||||
const total = context.chart.data.datasets.reduce((sum: number, dataset: any) => sum + dataset.data[context.dataIndex], 0);
|
||||
const percentage = total > 0 ? Math.round((value / total) * 100) : 0;
|
||||
return `${datasetLabel}: ${value}대 (${percentage}%)`;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
stacked: true,
|
||||
ticks: {
|
||||
callback: (val: any) => `${val}대`,
|
||||
font: { family: 'Pretendard', size: 14, weight: '600' },
|
||||
color: '#64748B'
|
||||
},
|
||||
grid: { color: '#EEF2F6' }
|
||||
},
|
||||
y: {
|
||||
stacked: true,
|
||||
ticks: {
|
||||
font: { family: 'Pretendard', size: 16, weight: '700' },
|
||||
color: '#475569'
|
||||
},
|
||||
grid: { display: false }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 실시간 사양 적정률 원형 도넛 그래프 (Active Spec Rate)
|
||||
*/
|
||||
function renderDonutChart(premium: number, high: number, normal: number, entry: number, replace: number) {
|
||||
function renderDonutChart(deptData: { label: string; count: number; color: string }[]) {
|
||||
const ctx = document.getElementById('chart-overall-donut') as HTMLCanvasElement;
|
||||
if (!ctx || typeof Chart === 'undefined') return;
|
||||
|
||||
@@ -898,21 +929,15 @@ function renderDonutChart(premium: number, high: number, normal: number, entry:
|
||||
donutChartInstance = null;
|
||||
}
|
||||
|
||||
const total = premium + high + normal + entry + replace;
|
||||
const total = deptData.reduce((sum, d) => sum + d.count, 0);
|
||||
|
||||
donutChartInstance = new Chart(ctx, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
labels: ['최상급', '상급', '중급', '보급', '교체 대상'],
|
||||
labels: deptData.map(d => d.label),
|
||||
datasets: [{
|
||||
data: [premium, high, normal, entry, replace],
|
||||
backgroundColor: [
|
||||
'#11302B', // premium (Hanmac Dark Green)
|
||||
'#1E8E7C', // high (Hanmac Teal)
|
||||
'#10B981', // normal (Hanmac Mint)
|
||||
'#F59E0B', // entry (Yellow-Orange)
|
||||
'#EF4444' // replace (Red)
|
||||
],
|
||||
data: deptData.map(d => d.count),
|
||||
backgroundColor: deptData.map(d => d.color),
|
||||
borderColor: '#ffffff',
|
||||
borderWidth: 2
|
||||
}]
|
||||
|
||||
@@ -153,6 +153,7 @@ export interface ListViewConfig {
|
||||
showField?: boolean;
|
||||
showType?: boolean;
|
||||
showStatus?: boolean;
|
||||
showPosition?: boolean;
|
||||
};
|
||||
columns: ColumnDef[];
|
||||
onRowClick?: (asset: any) => void;
|
||||
@@ -450,35 +451,63 @@ export function createListView(container: HTMLElement, config: ListViewConfig) {
|
||||
});
|
||||
|
||||
// DB 기준 사양 데이터 맵핑 (state.masterData.jobSpecs 이용)
|
||||
const jobSpecsMap: Record<string, number> = {};
|
||||
const jobSpecsMap: Record<string, string> = {};
|
||||
if (state.masterData.jobSpecs) {
|
||||
state.masterData.jobSpecs.forEach((s: any) => {
|
||||
jobSpecsMap[s.job_name] = s.min_score;
|
||||
jobSpecsMap[s.job_name] = s.required_grade || '중급';
|
||||
});
|
||||
}
|
||||
|
||||
// 사용자 이름 → 세부 직무 맵 생성 (system_users.position 기준)
|
||||
const userPositionMap: Record<string, string> = {};
|
||||
if (state.masterData.users) {
|
||||
state.masterData.users.forEach((u: any) => {
|
||||
if (u.user_name && u.position) {
|
||||
userPositionMap[u.user_name.trim()] = u.position.trim();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const GRADE_RANK: Record<string, number> = {
|
||||
'premium': 4, '최상급': 4,
|
||||
'high': 3, '상급': 3,
|
||||
'normal': 2, '중급': 2,
|
||||
'entry': 1, '보급': 1,
|
||||
'replace': 0, '교체 대상': 0
|
||||
};
|
||||
|
||||
// 기준 대비 사양 부족/오버스펙 분류
|
||||
const criticalPcList: any[] = [];
|
||||
pcs.forEach((pc: any) => {
|
||||
const job = pc[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
const userName = (pc[ASSET_SCHEMA.CURRENT_USER.key] || '').trim();
|
||||
const job = userPositionMap[userName] || pc[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
const score = pc['_pc_score'];
|
||||
const standardScore = jobSpecsMap[job] !== undefined ? jobSpecsMap[job] : (jobScores[job]?.avg || 0);
|
||||
const requiredGrade = jobSpecsMap[job] || jobSpecsMap[pc[ASSET_SCHEMA.USER_POSITION.key]] || '중급';
|
||||
|
||||
const cpu = pc[ASSET_SCHEMA.CPU.key] || '';
|
||||
const ram = pc[ASSET_SCHEMA.RAM.key] || '';
|
||||
const win11Incompatible = isWindows11Incompatible(cpu, ram);
|
||||
|
||||
let actualGrade = 'replace';
|
||||
if (score >= 85) actualGrade = 'premium';
|
||||
else if (score >= 70) actualGrade = 'high';
|
||||
else if (score >= 40) actualGrade = 'normal';
|
||||
else if (score >= 20) actualGrade = 'entry';
|
||||
|
||||
const reqRank = GRADE_RANK[requiredGrade] !== undefined ? GRADE_RANK[requiredGrade] : 2;
|
||||
const actRank = GRADE_RANK[actualGrade] !== undefined ? GRADE_RANK[actualGrade] : 0;
|
||||
|
||||
let isUnder = false;
|
||||
if (standardScore > 0) {
|
||||
if (score < standardScore * 0.6) {
|
||||
if (job !== '재고PC') {
|
||||
if (win11Incompatible) {
|
||||
isUnder = true;
|
||||
pc['_spec_status'] = '사양 부족';
|
||||
} else if (score > standardScore * 1.5 && !win11Incompatible) {
|
||||
} else if (actRank < reqRank) {
|
||||
isUnder = true;
|
||||
pc['_spec_status'] = '사양 부족';
|
||||
} else if (actRank > reqRank) {
|
||||
pc['_spec_status'] = '오버스펙';
|
||||
criticalPcList.push(pc);
|
||||
} else if (win11Incompatible) {
|
||||
isUnder = true;
|
||||
pc['_spec_status'] = '사양 부족';
|
||||
} else {
|
||||
pc['_spec_status'] = '적정';
|
||||
}
|
||||
@@ -496,16 +525,38 @@ export function createListView(container: HTMLElement, config: ListViewConfig) {
|
||||
}
|
||||
});
|
||||
|
||||
// 정렬: 기준 점수 대비 사양 부족이 심한 순(비율이 낮은 순)으로 정렬
|
||||
// 정렬: 요구 등급 대비 실제 성능이 많이 부족한 순(등급 편차가 큰 순)으로 정렬
|
||||
criticalPcList.sort((a: any, b: any) => {
|
||||
const jobA = a[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
const jobB = b[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
const stdA = jobSpecsMap[jobA] !== undefined ? jobSpecsMap[jobA] : (jobScores[jobA]?.avg || 0);
|
||||
const stdB = jobSpecsMap[jobB] !== undefined ? jobSpecsMap[jobB] : (jobScores[jobB]?.avg || 0);
|
||||
const userNameA = (a[ASSET_SCHEMA.CURRENT_USER.key] || '').trim();
|
||||
const userNameB = (b[ASSET_SCHEMA.CURRENT_USER.key] || '').trim();
|
||||
const jobA = userPositionMap[userNameA] || a[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
const jobB = userPositionMap[userNameB] || b[ASSET_SCHEMA.USER_POSITION.key] || '미분류';
|
||||
|
||||
const ratioA = stdA > 0 ? a['_pc_score'] / stdA : 1;
|
||||
const ratioB = stdB > 0 ? b['_pc_score'] / stdB : 1;
|
||||
return ratioA - ratioB;
|
||||
const reqA = jobSpecsMap[jobA] || jobSpecsMap[a[ASSET_SCHEMA.USER_POSITION.key]] || '중급';
|
||||
const reqB = jobSpecsMap[jobB] || jobSpecsMap[b[ASSET_SCHEMA.USER_POSITION.key]] || '중급';
|
||||
|
||||
const scoreA = a['_pc_score'];
|
||||
const scoreB = b['_pc_score'];
|
||||
|
||||
let actA = 'replace';
|
||||
if (scoreA >= 85) actA = 'premium';
|
||||
else if (scoreA >= 70) actA = 'high';
|
||||
else if (scoreA >= 40) actA = 'normal';
|
||||
else if (scoreA >= 20) actA = 'entry';
|
||||
|
||||
let actB = 'replace';
|
||||
if (scoreB >= 85) actB = 'premium';
|
||||
else if (scoreB >= 70) actB = 'high';
|
||||
else if (scoreB >= 40) actB = 'normal';
|
||||
else if (scoreB >= 20) actB = 'entry';
|
||||
|
||||
const devA = (GRADE_RANK[reqA] || 2) - (GRADE_RANK[actA] || 0);
|
||||
const devB = (GRADE_RANK[reqB] || 2) - (GRADE_RANK[actB] || 0);
|
||||
|
||||
if (devA !== devB) {
|
||||
return devB - devA; // 편차가 큰 것(더 많이 부족한 것)이 먼저 정렬됨
|
||||
}
|
||||
return scoreA - scoreB; // 편차가 같으면 성능 점수가 낮은 순
|
||||
});
|
||||
|
||||
if (criticalPcList.length === 0) {
|
||||
@@ -709,7 +760,6 @@ export function createListView(container: HTMLElement, config: ListViewConfig) {
|
||||
<td class="text-center">${asset[ASSET_SCHEMA.LOC_DETAIL.key] || '-'}</td>
|
||||
</tr>`;
|
||||
}).join('');
|
||||
|
||||
tbody.querySelectorAll('.mini-row').forEach(row => {
|
||||
row.addEventListener('click', () => {
|
||||
tbody.querySelectorAll('.mini-row').forEach(r => r.classList.remove('active'));
|
||||
@@ -806,7 +856,7 @@ export function createListView(container: HTMLElement, config: ListViewConfig) {
|
||||
</button>
|
||||
` : ''}
|
||||
<button id="btn-add-asset" class="btn btn-primary">
|
||||
<i data-lucide="plus" class="icon-sm"></i> 자산 추가
|
||||
<i data-lucide="plus" class="icon-sm"></i> ${config.title === '직무별 기준 사양' ? '기준 사양 추가' : (config.title === '부품 마스터' ? '표준 부품 추가' : '자산 추가')}
|
||||
</button>
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user