From e147b1a191ad47283f2a50a604d6b5073ea0e866 Mon Sep 17 00:00:00 2001 From: Taehoon Date: Thu, 23 Apr 2026 10:21:08 +0900 Subject: [PATCH] Fix merge conflicts in HWModal.ts and restore optimized structure --- src/components/Modal/HWModal.ts | 273 +++++++++----------------------- 1 file changed, 76 insertions(+), 197 deletions(-) diff --git a/src/components/Modal/HWModal.ts b/src/components/Modal/HWModal.ts index aa6235d..a735836 100644 --- a/src/components/Modal/HWModal.ts +++ b/src/components/Modal/HWModal.ts @@ -19,23 +19,23 @@ import { let currentAsset: HardwareAsset | null = null; let isEditMode = false; -const STATUS_LIST = ['대여중', '보관중', '수리중', '기타']; +const STATUS_LIST = ['사용중', '보관중', '수리중', '폐기예정', '기타']; -// 필드 ID ↔ 데이터 Key 매핑 (유지보수 시 이 부분만 수정) +// 필드 ID ↔ 데이터 Key 매핑 const HW_FIELD_MAP: Record = { '유형': 'type', '법인': '법인', '자산코드': '자산코드', - '현사용조직': '현사용조직', + '현사용조직': '실사용조직', '이전사용조직': '이전사용조직', - '상세용도': '상세용도', + '상세용도': '서버용도', '모델명': '모델명', '명칭': '명칭', '보관위치': '보관위치', - '현재상태': '현재상태', + '현재상태': '상태', 'IP주소': 'IP주소', 'IP2': 'IP2', - '원격접속': '원격접속', + '원격접속': '원격방법', '서버ID': '서버ID', '서버PW': '서버PW', '모니터링': '모니터링', @@ -45,16 +45,14 @@ const HW_FIELD_MAP: Record = { 'SSD1': 'SSD1', 'SSD2': 'SSD2', 'HW사양': 'HW사양', - '담당자_정': '담당자_정', - '담당자_부': '담당자_부', - '구매일': '구매연월', - '금액': '금액', + '담당자_정': '관리조직', + '구매일': '도입일', + '금액': '구매가', '비고': '비고', '사용자': '사용자' }; const HW_FORM_HTML = ` -
기본 정보 (Identity)
@@ -72,7 +70,7 @@ const HW_FORM_HTML = `
- +
@@ -80,15 +78,17 @@ const HW_FORM_HTML = `
- +
-
- + @@ -105,40 +105,31 @@ const HW_FORM_HTML = `
네트워크 정보 (Connectivity)
-
+
-
+
-
시스템 사양 (Specifications)
+
하드웨어 사양 (Specifications)
-
+
설치 위치 및 관리
-
-
+
+
-
-
-
-
+
+
+
-
- -
- - -
-
`; -<<<<<<< HEAD function renderHwHistory(assetId: string) { const container = document.getElementById('hw-history-list'); if (!container) return; @@ -151,27 +142,6 @@ function renderHwHistory(assetId: string) {
${l.details.replace(/\n/g, '
')}
`).join(''); -======= -export function openHwModal(asset: HardwareAsset, mode: 'view' | 'add' | 'edit' = 'view') { - currentAsset = asset; - const modal = document.getElementById('hw-asset-modal')!; - - // 1. 잠금 상태 통합 제어 (데이터 유무가 아닌 호출 mode에만 의존) - setEditLock('hw-asset-form', mode, { - saveBtnId: 'btn-save-hw-asset', - revertBtnId: 'btn-revert-hw-edit', - generateBtnId: 'btn-generate-hw-code' - }); - - isEditMode = (mode === 'add' || mode === 'edit'); - - // 2. 데이터 바인딩 - fillHwFormData(asset); - - modal.classList.remove('hidden'); - applyTypeSpecificUI(asset.type); - createIcons({ icons: { Paperclip } }); ->>>>>>> origin/SW_Table } function applyTypeSpecificUI(type: string) { @@ -199,68 +169,39 @@ function applyTypeSpecificUI(type: string) { const opOnly = document.querySelectorAll('.op-only'); const standardLoc = document.querySelectorAll('.loc-standard'); - // 초기화 serverOnly.forEach(el => (el as HTMLElement).style.display = 'none'); nonServer.forEach(el => (el as HTMLElement).style.display = 'none'); opOnly.forEach(el => (el as HTMLElement).style.display = 'none'); standardLoc.forEach(el => (el as HTMLElement).style.display = 'flex'); Object.values(groups).forEach(g => { if (g) g.style.display = 'none'; }); - const osLabel = document.querySelector('label[for="hw-OS"]') as HTMLElement; - const ramLabel = document.querySelector('label[for="hw-RAM"]') as HTMLElement; - const modelLabel = document.querySelector('label[for="hw-모델명"]') as HTMLElement; - if (osLabel) osLabel.innerText = '운영체제 (OS)'; - if (ramLabel) ramLabel.innerText = 'RAM 용량'; - if (modelLabel) modelLabel.innerText = '모델명'; - + const isServer = upperType.includes('서버') || upperType.includes('SERVER'); const isMobileGroup = ['모바일', '태블릿', '휴대폰'].some(t => upperType.includes(t)); const isEquipGroup = ['CPU', 'RAM', 'HDD', 'GPU'].some(t => upperType.includes(t)) || upperType.includes('비품'); const isOpType = isMobileGroup || isEquipGroup; const isPcType = upperType === 'PC' || upperType === '개인PC' || upperType === '노트북'; - if (groups.opTitle) groups.opTitle.style.display = isOpType ? 'flex' : 'none'; - - if (isOpType) { + if (isServer) { + serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex'); + if (groups.detailPurpose) groups.detailPurpose.style.display = 'flex'; + if (groups.networkTitle) groups.networkTitle.style.display = 'flex'; + if (groups.specTitle) groups.specTitle.style.display = 'flex'; + ['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'monitoring'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; }); + } else if (isPcType) { + if (groups.user) groups.user.style.display = 'flex'; + if (groups.specTitle) groups.specTitle.style.display = 'flex'; + nonServer.forEach(el => (el as HTMLElement).style.display = 'flex'); + ['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'hwSpec'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; }); + } else if (isOpType) { opOnly.forEach(el => (el as HTMLElement).style.display = 'flex'); standardLoc.forEach(el => (el as HTMLElement).style.display = 'none'); if (groups.specTitle) groups.specTitle.style.display = 'flex'; if (groups.model) groups.model.style.display = 'flex'; - - if (['CPU', 'GPU'].some(t => upperType.includes(t))) { - if (groups.os && osLabel) { osLabel.innerText = '출시연월'; groups.os.style.display = 'flex'; } - } else if (['RAM', 'HDD'].some(t => upperType.includes(t))) { - if (groups.ram && ramLabel) { ramLabel.innerText = '용량'; groups.ram.style.display = 'flex'; } - if (upperType.includes('HDD') && modelLabel) modelLabel.innerText = 'S/N'; - } else { - if (groups.hwSpec) groups.hwSpec.style.display = 'flex'; - } - } - else if (isPcType) { - if (groups.user) groups.user.style.display = 'flex'; + if (groups.hwSpec) groups.hwSpec.style.display = 'flex'; + } else { + nonServer.forEach(el => (el as HTMLElement).style.display = 'flex'); if (groups.specTitle) groups.specTitle.style.display = 'flex'; - - // 노트북은 상세유형 선택창 숨김 - if (upperType === '노트북') { - if (groups.detailPurpose) groups.detailPurpose.style.display = 'none'; - nonServer.forEach(el => (el as HTMLElement).style.display = 'flex'); - ['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'hwSpec'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; }); - } else { - if (groups.detailPurpose) groups.detailPurpose.style.display = 'flex'; - if (detailPurpose === '서버') { - serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex'); - if (groups.networkTitle) groups.networkTitle.style.display = 'flex'; - ['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'monitoring'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; }); - } else { - nonServer.forEach(el => (el as HTMLElement).style.display = 'flex'); - ['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'hwSpec'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; }); - } - } - } - else { - serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex'); - if (groups.networkTitle) groups.networkTitle.style.display = 'flex'; - if (groups.specTitle) groups.specTitle.style.display = 'flex'; - ['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'monitoring'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; }); + ['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'hwSpec'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; }); } } @@ -276,12 +217,7 @@ export function openHwModal(asset: HardwareAsset, mode: 'view' | 'add' = 'view') }); isEditMode = (mode === 'add'); - - // 데이터 채우기 (자동 매핑) autoFillForm('hw', asset, HW_FIELD_MAP); - setFieldValue('hw-명칭', asset.명칭 || asset.모델명); - if (!asset.구매연월 && asset.구매일) setFieldValue('hw-구매일', asset.구매일); - parseAndSetLocation(asset.위치, 'hw-위치-빌딩', 'hw-위치-상세', 'hw-위치-기타-group', 'hw-위치-기타'); applyTypeSpecificUI(asset.type); renderHwHistory(asset.id); @@ -293,12 +229,11 @@ export function openHwModal(asset: HardwareAsset, mode: 'view' | 'add' = 'view') export function initHwModal(onSave: () => void, closeModalsCb: () => void) { if (!document.getElementById('hw-asset-modal')) { const html = createModalFrameHTML('hw', '자산 상세 정보', HW_FORM_HTML, { - historyTitle: '분출 및 변경 이력', + historyTitle: '유지보수 및 변경 이력', addLogBtnId: 'btn-add-hw-log' }); document.body.insertAdjacentHTML('beforeend', html); - // 이력 추가 모달 HTML도 함께 추가 const logModalHTML = `