feat: implement unified schema mapper, enhance UI/UX with responsive design, and optimize asset log logic
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createIcons, BookOpen, X, ChevronDown, ChevronRight, RefreshCw } from 'lucide';
|
||||
import { state } from '../core/state';
|
||||
|
||||
// ─── 자산별 가이드 콘텐츠 정의 ───
|
||||
// ─── 자산별 가이드 콘텐츠 정의 (SW_Table 브랜치 전체 복구) ───
|
||||
interface GuideTabConfig {
|
||||
id: string;
|
||||
label: string;
|
||||
@@ -46,6 +47,21 @@ const GUIDE_TABS: GuideTabConfig[] = [
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="guide-section">
|
||||
<h3>시스템 기본 사용방법</h3>
|
||||
<table class="guide-info-table">
|
||||
<thead><tr><th>기능</th><th>방법</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><strong>자산 조회</strong></td><td>상단 카테고리(하드웨어/소프트웨어) 및 하위 탭 선택 후 데이터 조회</td></tr>
|
||||
<tr><td><strong>자산 등록</strong></td><td>[자산 추가] 버튼 클릭 후 상세 정보 입력 및 저장</td></tr>
|
||||
<tr><td><strong>정보 수정</strong></td><td>목록 행 클릭 후 나타나는 모달에서 내용 변경 및 저장</td></tr>
|
||||
<tr><td><strong>엑셀 업로드</strong></td><td>[업로드] 버튼 선택 후 표준 양식의 .xlsx 파일 선택</td></tr>
|
||||
<tr><td><strong>전체 엑셀저장</strong></td><td>[엑셀저장] 버튼 클릭 시 현재 전체 자산 데이터를 Excel로 백업</td></tr>
|
||||
<tr><td><strong>표준 양식</strong></td><td>[양식] 버튼 클릭 시 데이터 업로드용 빈 양식 다운로드</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
`
|
||||
},
|
||||
{
|
||||
@@ -55,7 +71,7 @@ const GUIDE_TABS: GuideTabConfig[] = [
|
||||
<section class="guide-section">
|
||||
<h3>개인PC 관리 가이드</h3>
|
||||
<p class="guide-text">
|
||||
개인PC는 임직원에게 지급되는 데스크톱 및 노트북을 관리합니다. 자산의 지급, 교체, 반납까지의 전체 생애주기를 시스템에서 추적합니다.
|
||||
임직원에게 지급되는 데스크톱 및 노트북을 관리합니다. 자산의 지급, 교체, 반납까지의 전체 생애주기를 시스템에서 추적합니다.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
@@ -70,33 +86,63 @@ const GUIDE_TABS: GuideTabConfig[] = [
|
||||
<span class="flow-arrow-right"><i data-lucide="chevron-right"></i></span>
|
||||
<div class="flow-step">
|
||||
<span class="step-number">2</span>
|
||||
<div><span class="step-label">자산 등록</span><p class="step-desc">자산코드 부여, 사양(CPU/RAM/Storage) 등록</p></div>
|
||||
<div><span class="step-label">자산 등록</span><p class="step-desc">자산번호 부여, 상세 사양 등록</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<i data-lucide="chevron-down" class="flow-arrow"></i>
|
||||
<div class="flow-row">
|
||||
<div class="flow-step">
|
||||
<span class="step-number">3</span>
|
||||
<div><span class="step-label">사용자 지급</span><p class="step-desc">사용자·사용조직 지정, 설치위치 기록</p></div>
|
||||
<div><span class="step-label">사용자 지급</span><p class="step-desc">사용자 지정 및 설치위치 기록</p></div>
|
||||
</div>
|
||||
<span class="flow-arrow-right"><i data-lucide="chevron-right"></i></span>
|
||||
<div class="flow-step">
|
||||
<span class="step-number">4</span>
|
||||
<div><span class="step-label">운영 관리</span><p class="step-desc">OS 업데이트, 보안 점검, 품의서 관리</p></div>
|
||||
<div><span class="step-label">운영 관리</span><p class="step-desc">보안 점검 및 수리 이력 관리</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<i data-lucide="chevron-down" class="flow-arrow"></i>
|
||||
<div class="flow-row">
|
||||
<div class="flow-step">
|
||||
<span class="step-number">5</span>
|
||||
<div><span class="step-label">교체/반납</span><p class="step-desc">장비 회수 및 데이터 소거</p></div>
|
||||
</div>
|
||||
<span class="flow-arrow-right"><i data-lucide="chevron-right"></i></span>
|
||||
<div class="flow-step">
|
||||
<span class="step-number">6</span>
|
||||
<div><span class="step-label">폐기 처리</span><p class="step-desc">불용 처리 및 매각/폐기 등록</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="guide-section">
|
||||
<h3>주요 관리 항목</h3>
|
||||
<table class="guide-info-table">
|
||||
<thead><tr><th>항목</th><th>설명</th><th>관리 주기</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>구매법인</td><td>자산의 소유 법인</td><td>등록 시</td></tr>
|
||||
<tr><td>사용자/조직</td><td>실제 사용자 및 소속 부서</td><td>변동 시</td></tr>
|
||||
<tr><td>자산번호</td><td>고유 식별 번호 (바코드)</td><td>등록 시</td></tr>
|
||||
<tr><td>모델명/사양</td><td>제조사 모델 및 CPU/RAM 등</td><td>등록 시</td></tr>
|
||||
<tr><td>도입금액</td><td>구매 비용 (부가세 포함)</td><td>등록 시</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<div class="guide-tip">
|
||||
<strong>관리 팁:</strong> 자산 이력에서 '분출'과 '반납' 로그를 꼼꼼히 기록하면 자산의 실제 위치를 정확히 파악할 수 있습니다.
|
||||
</div>
|
||||
`
|
||||
},
|
||||
{
|
||||
id: 'server',
|
||||
label: '🖥️ 서버',
|
||||
label: '🖥️ 서버/스토리지',
|
||||
content: `
|
||||
<section class="guide-section">
|
||||
<h3>서버 관리 가이드</h3>
|
||||
<h3>인프라 자산 관리 가이드</h3>
|
||||
<p class="guide-text">
|
||||
물리 서버와 가상 서버를 포함한 서버급 자산을 관리합니다. 안정적인 서비스 운영을 위해 체계적인 관리가 필요합니다.
|
||||
서버실 및 IDC에 설치된 물리 서버와 스토리지 장비를 관리합니다. 고가의 자산이므로 담당자(정/부) 지정이 필수입니다.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
@@ -106,21 +152,66 @@ const GUIDE_TABS: GuideTabConfig[] = [
|
||||
<div class="flow-row">
|
||||
<div class="flow-step">
|
||||
<span class="step-number">1</span>
|
||||
<div><span class="step-label">도입 계획</span><p class="step-desc">용도 정의, 사양 산정, 구매 승인</p></div>
|
||||
<div><span class="step-label">도입 계획</span><p class="step-desc">사양 확정 및 구매 승인</p></div>
|
||||
</div>
|
||||
<span class="flow-arrow-right"><i data-lucide="chevron-right"></i></span>
|
||||
<div class="flow-step">
|
||||
<span class="step-number">2</span>
|
||||
<div><span class="step-label">설치 및 등록</span><p class="step-desc">랙 배치, 네트워크 설정, 자산 등록</p></div>
|
||||
<div><span class="step-label">설치 및 등록</span><p class="step-desc">네트워크 설정 및 자산번호 부여</p></div>
|
||||
</div>
|
||||
<span class="flow-arrow-right"><i data-lucide="chevron-right"></i></span>
|
||||
<div class="flow-step">
|
||||
<span class="step-number">3</span>
|
||||
<div><span class="step-label">운영 관리</span><p class="step-desc">모니터링, 패치 적용, 장애 대응</p></div>
|
||||
<div><span class="step-label">운영 관리</span><p class="step-desc">정기 점검 및 장애 이력 관리</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="guide-section">
|
||||
<h3>필수 입력 항목</h3>
|
||||
<table class="guide-info-table">
|
||||
<thead><tr><th>항목</th><th>중요성</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><strong>IP 주소</strong></td><td>서버 접속 및 모니터링을 위한 필수 정보</td></tr>
|
||||
<tr><td><strong>설치위치</strong></td><td>IDC 또는 서버실 내의 정확한 랙 위치</td></tr>
|
||||
<tr><td><strong>담당자(정/부)</strong></td><td>비상 시 연락 가능한 관리 책임자</td></tr>
|
||||
<tr><td><strong>용도/상세</strong></td><td>운영 중인 서비스 및 상세 업무 설명</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<div class="guide-warn">
|
||||
<strong>주의 사항:</strong> 서버 자산의 IP가 변경될 경우 시스템에 즉시 반영하여 네트워크 관리 대장과의 정합성을 유지해야 합니다.
|
||||
</div>
|
||||
`
|
||||
},
|
||||
{
|
||||
id: 'software',
|
||||
label: '💾 소프트웨어',
|
||||
content: `
|
||||
<section class="guide-section">
|
||||
<h3>소프트웨어 자산 관리 가이드</h3>
|
||||
<p class="guide-text">
|
||||
구독형(SaaS) 및 영구형 라이선스를 관리합니다. 불법 소프트웨어 사용 방지와 비용 최적화가 주 목적입니다.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="guide-section">
|
||||
<h3>라이선스 관리 포인트</h3>
|
||||
<table class="guide-info-table">
|
||||
<thead><tr><th>구분</th><th>관리 내용</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><strong>구독형(Sub)</strong></td><td>구독 만료일 도래 전 갱신 여부 결정 및 비용 정산</td></tr>
|
||||
<tr><td><strong>영구형(Perm)</strong></td><td>보유 수량 대비 실제 설치 수량 매핑 (초과 사용 금지)</td></tr>
|
||||
<tr><td><strong>운영서비스</strong></td><td>도메인, 메일 등 매월 또는 매년 발생하는 비용 추적</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<div class="guide-tip">
|
||||
<strong>팁:</strong> 소프트웨어 상세 페이지의 [사용자 할당] 기능을 활용하여 누가 어떤 라이선스를 사용하는지 체계적으로 관리하세요.
|
||||
</div>
|
||||
`
|
||||
}
|
||||
];
|
||||
@@ -131,7 +222,7 @@ export function initGuide() {
|
||||
if (document.getElementById('guide-overlay')) return;
|
||||
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'guide-overlay';
|
||||
overlay.className = 'modal-overlay hidden';
|
||||
overlay.id = 'guide-overlay';
|
||||
|
||||
const tabsHtml = GUIDE_TABS.map((tab, i) =>
|
||||
@@ -143,32 +234,33 @@ export function initGuide() {
|
||||
).join('');
|
||||
|
||||
overlay.innerHTML = `
|
||||
<div class="guide-modal" id="guide-modal">
|
||||
<div class="guide-header">
|
||||
<h2><i data-lucide="book-open"></i> IT 자산관리 프로세스 가이드</h2>
|
||||
<button class="btn-close-guide" id="btn-close-guide">
|
||||
<div class="modal-content wide" id="guide-modal" style="height: 90vh;">
|
||||
<div class="modal-header">
|
||||
<h2><i data-lucide="book-open"></i> 자산관리 프로세스 가이드 (Standard)</h2>
|
||||
<button class="btn-icon" id="btn-close-guide">
|
||||
<i data-lucide="x"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="guide-tabs">${tabsHtml}</div>
|
||||
<div class="guide-body">${panelsHtml}</div>
|
||||
<div class="guide-tabs-container">
|
||||
<div class="guide-tabs">${tabsHtml}</div>
|
||||
</div>
|
||||
<div class="modal-body" style="padding-top: 0;">
|
||||
<div class="guide-body">${panelsHtml}</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
body.appendChild(overlay);
|
||||
|
||||
const openGuide = () => {
|
||||
console.log('📖 Opening Guide Modal...');
|
||||
overlay.classList.add('active');
|
||||
console.log('📖 Opening Full Guide Modal...');
|
||||
overlay.classList.remove('hidden');
|
||||
};
|
||||
const closeGuide = () => overlay.classList.remove('active');
|
||||
const closeGuide = () => overlay.classList.add('hidden');
|
||||
|
||||
const triggerBtn = document.getElementById('btn-open-guide-header');
|
||||
if (triggerBtn) {
|
||||
console.log('✅ Guide trigger button found and bound.');
|
||||
triggerBtn.addEventListener('click', openGuide);
|
||||
} else {
|
||||
console.warn('⚠️ Guide trigger button (#btn-open-guide-header) not found in DOM.');
|
||||
}
|
||||
|
||||
overlay.addEventListener('click', (e) => { if (e.target === overlay) closeGuide(); });
|
||||
@@ -187,5 +279,5 @@ export function initGuide() {
|
||||
});
|
||||
});
|
||||
|
||||
createIcons({ icons: { BookOpen, X, ChevronDown, ChevronRight, RefreshCw }, nameAttr: 'data-lucide' });
|
||||
createIcons({ icons: { BookOpen, X, ChevronDown, ChevronRight, RefreshCw } });
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ export function initCloudModal(renderContent: () => void, closeModals: () => voi
|
||||
id: Math.random().toString(36).substring(2, 9),
|
||||
assetId: newAsset.id,
|
||||
date: `${now.getFullYear()}-${String(now.getMonth()+1).padStart(2,'0')}-${String(now.getDate()).padStart(2,'0')}`,
|
||||
user: '관리자',
|
||||
user: '담당자',
|
||||
details: '신규 등록'
|
||||
});
|
||||
}
|
||||
@@ -271,7 +271,7 @@ export function initCloudModal(renderContent: () => void, closeModals: () => voi
|
||||
id: Math.random().toString(36).substring(2, 9),
|
||||
assetId: id,
|
||||
date,
|
||||
user: '관리자',
|
||||
user: '담당자',
|
||||
details
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { state, saveHardwareAsset, deleteHardwareAsset } from '../../core/state';
|
||||
import { HardwareAsset, HardwareLog } from '../../core/excelHandler';
|
||||
import { HardwareAsset } from '../../core/excelHandler';
|
||||
import { closeModals } from './BaseModal';
|
||||
import { ASSET_SCHEMA, UI_TEXT } from '../../core/schema';
|
||||
import { createIcons, History, Plus, X, Save, Edit2, RotateCcw, Paperclip } from 'lucide';
|
||||
import { CORP_LIST, ORG_LIST, HW_TYPE_LIST, LOCATION_DATA, TYPE_PREFIX_MAP } from './SharedData';
|
||||
import {
|
||||
@@ -21,62 +22,64 @@ let isEditMode = false;
|
||||
|
||||
const STATUS_LIST = ['대여중', '보관중', '수리중', '기타'];
|
||||
|
||||
// 필드 ID ↔ 데이터 Key 매핑 (유지보수 시 이 부분만 수정)
|
||||
/**
|
||||
* 하드웨어 필드 매핑 (통합 스키마 기반)
|
||||
*/
|
||||
const HW_FIELD_MAP: Record<string, string> = {
|
||||
'유형': 'type',
|
||||
'법인': '법인',
|
||||
'자산코드': '자산코드',
|
||||
'현사용조직': '현사용조직',
|
||||
'이전사용조직': '이전사용조직',
|
||||
'상세용도': '상세용도',
|
||||
'모델명': '모델명',
|
||||
'명칭': '명칭',
|
||||
'보관위치': '보관위치',
|
||||
'현재상태': '현재상태',
|
||||
'IP주소': 'IP주소',
|
||||
'IP2': 'IP2',
|
||||
'원격접속': '원격접속',
|
||||
'서버ID': '서버ID',
|
||||
'서버PW': '서버PW',
|
||||
'모니터링': '모니터링',
|
||||
'OS': 'OS',
|
||||
'CPU': 'CPU',
|
||||
'RAM': 'RAM',
|
||||
'SSD1': 'SSD1',
|
||||
'SSD2': 'SSD2',
|
||||
'HW사양': 'HW사양',
|
||||
'담당자_정': '담당자_정',
|
||||
'담당자_부': '담당자_부',
|
||||
'구매일': '구매연월',
|
||||
'금액': '금액',
|
||||
'비고': '비고',
|
||||
'사용자': '사용자'
|
||||
'유형': ASSET_SCHEMA.TYPE.key,
|
||||
'법인': ASSET_SCHEMA.CORP.key,
|
||||
'자산코드': ASSET_SCHEMA.ASSET_CODE.key,
|
||||
'현사용조직': ASSET_SCHEMA.ORG.key,
|
||||
'이전사용조직': ASSET_SCHEMA.PREV_ORG.key,
|
||||
'상세용도': '상세용도',
|
||||
'모델명': ASSET_SCHEMA.MODEL.key,
|
||||
'메인보드': ASSET_SCHEMA.MAINBOARD.key,
|
||||
'명칭': '명칭',
|
||||
'보관위치': ASSET_SCHEMA.STORE_LOC.key,
|
||||
'현재상태': ASSET_SCHEMA.STATUS.key,
|
||||
'IP주소': ASSET_SCHEMA.IP_ADDR.key,
|
||||
'IP2': ASSET_SCHEMA.IP_ADDR2.key,
|
||||
'원격접속': '원격접속',
|
||||
'서버ID': '서버ID',
|
||||
'서버PW': '서버PW',
|
||||
'모니터링': '모니터링',
|
||||
'OS': ASSET_SCHEMA.OS.key,
|
||||
'CPU': ASSET_SCHEMA.CPU.key,
|
||||
'RAM': ASSET_SCHEMA.RAM.key,
|
||||
'SSD1': ASSET_SCHEMA.STORAGE1.key,
|
||||
'SSD2': ASSET_SCHEMA.STORAGE2.key,
|
||||
'HW사양': 'HW사양',
|
||||
'담당자_정': ASSET_SCHEMA.MANAGER_MAIN.key,
|
||||
'담당자_부': ASSET_SCHEMA.MANAGER_SUB.key,
|
||||
'구매일': ASSET_SCHEMA.PURCHASE_YM.key,
|
||||
'금액': ASSET_SCHEMA.PRICE.key,
|
||||
'비고': ASSET_SCHEMA.REMARKS.key,
|
||||
'사용자': ASSET_SCHEMA.USER.key
|
||||
};
|
||||
|
||||
const HW_FORM_HTML = `
|
||||
<!-- Group 1: 기본 정보 -->
|
||||
<div class="form-section-title">기본 정보 (Identity)</div>
|
||||
<div class="form-group">
|
||||
<label for="hw-법인">구매법인</label>
|
||||
<label for="hw-법인">${ASSET_SCHEMA.CORP.ui}</label>
|
||||
<select id="hw-법인" required>${generateOptionsHTML(CORP_LIST)}</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="hw-자산코드">자산번호</label>
|
||||
<label for="hw-자산코드">${ASSET_SCHEMA.ASSET_CODE.ui}</label>
|
||||
<div class="input-with-btn">
|
||||
<input type="text" id="hw-자산코드" readonly class="is-readonly-field" placeholder="번호 생성을 클릭하세요" required />
|
||||
<button type="button" id="btn-generate-hw-code" class="btn btn-outline btn-sm">생성</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group pc-only">
|
||||
<label for="hw-사용자">사용자</label>
|
||||
<label for="hw-사용자">${ASSET_SCHEMA.USER.ui}</label>
|
||||
<input type="text" id="hw-사용자" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="hw-현사용조직">현 사용조직</label>
|
||||
<label for="hw-현사용조직">${ASSET_SCHEMA.ORG.ui}</label>
|
||||
<select id="hw-현사용조직">${generateOptionsHTML(ORG_LIST)}</select>
|
||||
</div>
|
||||
<div class="form-group" id="hw-이전사용조직-group">
|
||||
<label for="hw-이전사용조직">이전 사용조직</label>
|
||||
<label for="hw-이전사용조직">${ASSET_SCHEMA.PREV_ORG.ui}</label>
|
||||
<input type="text" id="hw-이전사용조직" readonly />
|
||||
</div>
|
||||
<div class="form-group" id="hw-유형-group">
|
||||
@@ -94,29 +97,30 @@ const HW_FORM_HTML = `
|
||||
|
||||
<div class="form-section-title op-only" id="hw-op-title">운영 및 상태 관리</div>
|
||||
<div class="form-group op-only">
|
||||
<label for="hw-보관위치">보관위치</label>
|
||||
<label for="hw-보관위치">${ASSET_SCHEMA.STORE_LOC.ui}</label>
|
||||
<input type="text" id="hw-보관위치" placeholder="예: 7층 비품창고" />
|
||||
</div>
|
||||
<div class="form-group op-only">
|
||||
<label for="hw-현재상태">현재상태</label>
|
||||
<label for="hw-현재상태">${ASSET_SCHEMA.STATUS.ui}</label>
|
||||
<select id="hw-현재상태">${generateOptionsHTML(STATUS_LIST)}</select>
|
||||
</div>
|
||||
|
||||
<div class="form-section-title server-only" id="hw-network-title">네트워크 정보 (Connectivity)</div>
|
||||
<div class="form-group server-only" id="hw-ip-group"><label for="hw-IP주소">IP 주소 1</label><input type="text" id="hw-IP주소" /></div>
|
||||
<div class="form-group server-only" id="hw-ip2-group"><label for="hw-IP2">IP 주소 2</label><input type="text" id="hw-IP2" /></div>
|
||||
<div class="form-group server-only" id="hw-ip-group"><label for="hw-IP주소">${ASSET_SCHEMA.IP_ADDR.ui}</label><input type="text" id="hw-IP주소" /></div>
|
||||
<div class="form-group server-only" id="hw-ip2-group"><label for="hw-IP2">${ASSET_SCHEMA.IP_ADDR2.ui}</label><input type="text" id="hw-IP2" /></div>
|
||||
<div class="form-group server-only" id="hw-remote-group"><label for="hw-원격접속">원격 도구</label><input type="text" id="hw-원격접속" /></div>
|
||||
<div class="form-group server-only" id="hw-server-id-group"><label for="hw-서버ID">서버 ID</label><input type="text" id="hw-서버ID" /></div>
|
||||
<div class="form-group server-only" id="hw-server-pw-group"><label for="hw-서버PW">서버 PW</label><input type="text" id="hw-서버PW" /></div>
|
||||
<div class="form-group non-server" id="hw-ip-non-server-group"><label for="hw-IP주소-non-server">IP 주소</label><input type="text" id="hw-IP주소-non-server" /></div>
|
||||
<div class="form-group non-server" id="hw-ip-non-server-group"><label for="hw-IP주소-non-server">${ASSET_SCHEMA.IP_ADDR.ui}</label><input type="text" id="hw-IP주소-non-server" /></div>
|
||||
|
||||
<div class="form-section-title" id="hw-spec-title">시스템 사양 (Specifications)</div>
|
||||
<div class="form-group" id="hw-model-group"><label for="hw-모델명">모델명</label><input type="text" id="hw-모델명" /></div>
|
||||
<div class="form-group" id="hw-os-group"><label for="hw-OS">운영체제 (OS)</label><input type="text" id="hw-OS" /></div>
|
||||
<div class="form-group" id="hw-cpu-group"><label for="hw-CPU">CPU 사양</label><input type="text" id="hw-CPU" /></div>
|
||||
<div class="form-group" id="hw-ram-group"><label for="hw-RAM">RAM 용량</label><input type="text" id="hw-RAM" /></div>
|
||||
<div class="form-group" id="hw-ssd1-group"><label for="hw-SSD1">Storage 1 (SSD/HDD)</label><input type="text" id="hw-SSD1" /></div>
|
||||
<div class="form-group" id="hw-ssd2-group"><label for="hw-SSD2">Storage 2 (SSD/HDD)</label><input type="text" id="hw-SSD2" /></div>
|
||||
<div class="form-group" id="hw-model-group"><label for="hw-모델명">${ASSET_SCHEMA.MODEL.ui}</label><input type="text" id="hw-모델명" /></div>
|
||||
<div class="form-group pc-only" id="hw-mainboard-group"><label for="hw-메인보드">${ASSET_SCHEMA.MAINBOARD.ui}</label><input type="text" id="hw-메인보드" /></div>
|
||||
<div class="form-group" id="hw-os-group"><label for="hw-OS">${ASSET_SCHEMA.OS.ui}</label><input type="text" id="hw-OS" /></div>
|
||||
<div class="form-group" id="hw-cpu-group"><label for="hw-CPU">${ASSET_SCHEMA.CPU.ui}</label><input type="text" id="hw-CPU" /></div>
|
||||
<div class="form-group" id="hw-ram-group"><label for="hw-RAM">${ASSET_SCHEMA.RAM.ui}</label><input type="text" id="hw-RAM" /></div>
|
||||
<div class="form-group" id="hw-ssd1-group"><label for="hw-SSD1">${ASSET_SCHEMA.STORAGE1.ui}</label><input type="text" id="hw-SSD1" /></div>
|
||||
<div class="form-group" id="hw-ssd2-group"><label for="hw-SSD2">${ASSET_SCHEMA.STORAGE2.ui}</label><input type="text" id="hw-SSD2" /></div>
|
||||
<div class="form-group server-only" id="hw-monitoring-group"><label for="hw-모니터링">모니터링 여부</label><input type="text" id="hw-모니터링" /></div>
|
||||
<div class="form-group full-width non-server" id="hw-hwspec-group"><label for="hw-HW사양">사양 상세</label><textarea id="hw-HW사양" rows="2"></textarea></div>
|
||||
|
||||
@@ -124,13 +128,13 @@ const HW_FORM_HTML = `
|
||||
<div class="form-group loc-standard"><label for="hw-위치-빌딩">설치위치 (건물)</label><select id="hw-위치-빌딩">${generateOptionsHTML(Object.keys(LOCATION_DATA))}</select></div>
|
||||
<div class="form-group loc-standard"><label for="hw-위치-상세">상세 위치</label><select id="hw-위치-상세"><option value="">선택</option></select></div>
|
||||
<div class="form-group" id="hw-위치-기타-group" style="display:none;"><label for="hw-위치-기타">직접 입력 (기타)</label><input type="text" id="hw-위치-기타" /></div>
|
||||
<div class="form-group"><label for="hw-담당자_정">담당자(정)</label><input type="text" id="hw-담당자_정" /></div>
|
||||
<div class="form-group"><label for="hw-담당자_부">담당자(부)</label><input type="text" id="hw-담당자_부" /></div>
|
||||
<div class="form-group"><label for="hw-구매일">구매연월</label><input type="text" id="hw-구매일" placeholder="YYYYMM" maxlength="6" /></div>
|
||||
<div class="form-group"><label for="hw-금액">금액</label><input type="text" id="hw-금액" oninput="this.value=this.value.replace(/[^0-9]/g,'').replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g,',')" /></div>
|
||||
<div class="form-group full-width"><label for="hw-비고">비고</label><textarea id="hw-비고" rows="2"></textarea></div>
|
||||
<div class="form-group"><label for="hw-담당자_정">${ASSET_SCHEMA.MANAGER_MAIN.ui}</label><input type="text" id="hw-담당자_정" /></div>
|
||||
<div class="form-group"><label for="hw-담당자_부">${ASSET_SCHEMA.MANAGER_SUB.ui}</label><input type="text" id="hw-담당자_부" /></div>
|
||||
<div class="form-group"><label for="hw-구매일">${ASSET_SCHEMA.PURCHASE_YM.ui}</label><input type="text" id="hw-구매일" placeholder="YYYYMM" maxlength="6" /></div>
|
||||
<div class="form-group"><label for="hw-금액">${ASSET_SCHEMA.PRICE.ui}</label><input type="text" id="hw-금액" oninput="this.value=this.value.replace(/[^0-9]/g,'').replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g,',')" /></div>
|
||||
<div class="form-group full-width"><label for="hw-비고">${ASSET_SCHEMA.REMARKS.ui}</label><textarea id="hw-비고" rows="2"></textarea></div>
|
||||
<div class="form-group full-width">
|
||||
<label>품의서 (파일 증빙)</label>
|
||||
<label>${ASSET_SCHEMA.DOC_NAME.ui} (파일 증빙)</label>
|
||||
<div style="display:flex; align-items:center; gap:0.5rem;">
|
||||
<input type="file" id="hw-품의서" />
|
||||
<span id="hw-품의서명" style="font-size:0.75rem; color:var(--text-light)"></span>
|
||||
@@ -162,6 +166,7 @@ function applyTypeSpecificUI(type: string) {
|
||||
specTitle: document.getElementById('hw-spec-title'),
|
||||
opTitle: document.getElementById('hw-op-title'),
|
||||
model: document.getElementById('hw-model-group'),
|
||||
mainboard: document.getElementById('hw-mainboard-group'),
|
||||
os: document.getElementById('hw-os-group'),
|
||||
cpu: document.getElementById('hw-cpu-group'),
|
||||
ram: document.getElementById('hw-ram-group'),
|
||||
@@ -177,7 +182,6 @@ 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');
|
||||
@@ -187,9 +191,9 @@ function applyTypeSpecificUI(type: string) {
|
||||
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 = '모델명';
|
||||
if (osLabel) osLabel.innerText = ASSET_SCHEMA.OS.ui;
|
||||
if (ramLabel) ramLabel.innerText = ASSET_SCHEMA.RAM.ui;
|
||||
if (modelLabel) modelLabel.innerText = ASSET_SCHEMA.MODEL.ui;
|
||||
|
||||
const isMobileGroup = ['모바일', '태블릿', '휴대폰'].some(t => upperType.includes(t));
|
||||
const isEquipGroup = ['CPU', 'RAM', 'HDD', 'GPU'].some(t => upperType.includes(t)) || upperType.includes('비품');
|
||||
@@ -208,7 +212,6 @@ function applyTypeSpecificUI(type: string) {
|
||||
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';
|
||||
}
|
||||
@@ -216,8 +219,8 @@ function applyTypeSpecificUI(type: string) {
|
||||
else if (isPcType) {
|
||||
if (groups.user) groups.user.style.display = 'flex';
|
||||
if (groups.specTitle) groups.specTitle.style.display = 'flex';
|
||||
if (groups.mainboard) groups.mainboard.style.display = 'flex';
|
||||
|
||||
// 노트북은 상세유형 선택창 숨김
|
||||
if (upperType === '노트북') {
|
||||
if (groups.detailPurpose) groups.detailPurpose.style.display = 'none';
|
||||
nonServer.forEach(el => (el as HTMLElement).style.display = 'flex');
|
||||
@@ -254,13 +257,11 @@ 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.구매일);
|
||||
setFieldValue('hw-명칭', asset.명칭 || asset[ASSET_SCHEMA.MODEL.key]);
|
||||
if (!asset[ASSET_SCHEMA.PURCHASE_YM.key] && asset.구매일) setFieldValue('hw-구매일', asset.구매일);
|
||||
|
||||
parseAndSetLocation(asset.위치, 'hw-위치-빌딩', 'hw-위치-상세', 'hw-위치-기타-group', 'hw-위치-기타');
|
||||
parseAndSetLocation(asset[ASSET_SCHEMA.LOCATION.key], 'hw-위치-빌딩', 'hw-위치-상세', 'hw-위치-기타-group', 'hw-위치-기타');
|
||||
applyTypeSpecificUI(asset.type);
|
||||
renderHwHistory(asset.id);
|
||||
|
||||
@@ -276,18 +277,17 @@ export function initHwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
});
|
||||
document.body.insertAdjacentHTML('beforeend', html);
|
||||
|
||||
// 이력 추가 모달 HTML도 함께 추가
|
||||
const logModalHTML = `
|
||||
<div id="hw-log-modal" class="modal-overlay hidden" style="z-index: 1100;">
|
||||
<div class="modal-content" style="max-width: 400px;">
|
||||
<div class="modal-header"><h2>이력 추가</h2><button id="btn-close-hw-log" class="btn-icon"><i data-lucide="x"></i></button></div>
|
||||
<div class="modal-header"><h2>${UI_TEXT.ACTION.HISTORY_ADD}</h2><button id="btn-close-hw-log" class="btn-icon"><i data-lucide="x"></i></button></div>
|
||||
<div class="modal-body">
|
||||
<div class="grid-form" style="grid-template-columns: 1fr;">
|
||||
<div class="form-group"><label>날짜</label><input type="date" id="new-hw-log-date" /></div>
|
||||
<div class="form-group"><label>변경/분출 내용</label><textarea id="new-hw-log-details" rows="3" placeholder="예: [분출] 기술팀 홍길동, [수리] 배터리 교체 등"></textarea></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer"><div></div><div class="footer-actions"><button id="btn-cancel-hw-log" class="btn btn-outline">취소</button><button id="btn-confirm-hw-log" class="btn btn-primary">추가</button></div></div>
|
||||
<div class="modal-footer"><div></div><div class="footer-actions"><button id="btn-cancel-hw-log" class="btn btn-outline">${UI_TEXT.ACTION.CANCEL}</button><button id="btn-confirm-hw-log" class="btn btn-primary">추가</button></div></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -338,15 +338,12 @@ export function initHwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
} catch (err) { alert('자산번호 생성에 실패했습니다.'); }
|
||||
});
|
||||
|
||||
// YYYYMM 입력 제한 로직 (숫자 6자리)
|
||||
['hw-구매일', 'hw-OS'].forEach(id => {
|
||||
const el = document.getElementById(id) as HTMLInputElement;
|
||||
el?.addEventListener('input', (e) => {
|
||||
const target = e.target as HTMLInputElement;
|
||||
const label = document.querySelector(`label[for="${id}"]`) as HTMLElement;
|
||||
// OS 필드의 경우 라벨이 '출시연월'일 때만 숫자 제한 적용
|
||||
if (id === 'hw-OS' && label?.innerText !== '출시연월') return;
|
||||
|
||||
target.value = target.value.replace(/[^0-9]/g, '').substring(0, 6);
|
||||
});
|
||||
});
|
||||
@@ -365,10 +362,8 @@ export function initHwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 데이터 추출 (자동 매핑)
|
||||
const extracted = autoExtractForm('hw', HW_FIELD_MAP);
|
||||
|
||||
if (!extracted.자산코드) {
|
||||
if (!extracted[ASSET_SCHEMA.ASSET_CODE.key]) {
|
||||
alert('자산번호가 없습니다. [생성] 버튼을 눌러 자산번호를 먼저 부여해주세요.');
|
||||
return;
|
||||
}
|
||||
@@ -376,51 +371,52 @@ export function initHwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
const upperType = (extracted.type || '').toUpperCase();
|
||||
const isOpType = ['CPU', 'RAM', 'HDD', 'GPU'].some(t => upperType.includes(t)) || upperType.includes('비품') || ['모바일', '태블릿', '휴대폰'].some(t => upperType.includes(t));
|
||||
|
||||
// --- 자동 변경 이력 생성 로직 ---
|
||||
// 모든 하드웨어 유형에 대해 자동 로깅 적용
|
||||
if (HW_TYPE_LIST.includes(extracted.type) || extracted.type === '개인PC') {
|
||||
const diffLogs: string[] = [];
|
||||
const compareFields = [
|
||||
{ key: '현사용조직', label: '현사용조직' },
|
||||
{ key: '위치', label: '설치위치' },
|
||||
{ key: '관리자', label: '담당자' },
|
||||
{ key: '현재상태', label: '상태' },
|
||||
{ key: 'IP주소', label: 'IP' },
|
||||
{ key: ASSET_SCHEMA.ORG.key, label: ASSET_SCHEMA.ORG.ui },
|
||||
{ key: ASSET_SCHEMA.LOCATION.key, label: ASSET_SCHEMA.LOCATION.ui },
|
||||
{ key: ASSET_SCHEMA.MANAGER_MAIN.key, label: '담당자' },
|
||||
{ key: ASSET_SCHEMA.STATUS.key, label: ASSET_SCHEMA.STATUS.ui },
|
||||
{ key: ASSET_SCHEMA.IP_ADDR.key, label: ASSET_SCHEMA.IP_ADDR.ui },
|
||||
{ key: '상세용도', label: '상세유형' },
|
||||
{ key: '모델명', label: '모델명' }
|
||||
{ key: ASSET_SCHEMA.MODEL.key, label: ASSET_SCHEMA.MODEL.ui }
|
||||
];
|
||||
|
||||
const currentIp = currentAsset.IP주소 || '';
|
||||
const newIp = getFieldValue('hw-IP주소') || getFieldValue('hw-IP주소-non-server');
|
||||
const currentLocation = currentAsset.위치 || '';
|
||||
const newLocation = isOpType ? extracted.보관위치 : getCombinedLocation('hw-위치-빌딩', 'hw-위치-상세', 'hw-위치-기타');
|
||||
const isNewAsset = !currentAsset || !currentAsset.자산코드;
|
||||
|
||||
compareFields.forEach(f => {
|
||||
let oldVal = '';
|
||||
let newVal = '';
|
||||
if (isNewAsset) {
|
||||
diffLogs.push('자산 신규 등록');
|
||||
} else {
|
||||
const newIp = String(getFieldValue('hw-IP주소') || getFieldValue('hw-IP주소-non-server') || '').trim();
|
||||
const newLocation = String(isOpType ? extracted[ASSET_SCHEMA.STORE_LOC.key] : getCombinedLocation('hw-위치-빌딩', 'hw-위치-상세', 'hw-위치-기타') || '').trim();
|
||||
|
||||
if (f.key === 'IP주소') {
|
||||
oldVal = currentIp;
|
||||
newVal = newIp;
|
||||
} else if (f.key === '위치') {
|
||||
oldVal = currentLocation;
|
||||
newVal = newLocation;
|
||||
} else if (f.key === '관리자') {
|
||||
oldVal = currentAsset.담당자_정 || '';
|
||||
newVal = extracted.담당자_정 || '';
|
||||
} else if (f.key === '상세용도') {
|
||||
oldVal = currentAsset.상세용도 || '';
|
||||
// 비 PC 자산은 유형을 상세유형으로 간주
|
||||
newVal = (extracted.type !== 'PC' && extracted.type !== '개인PC') ? extracted.type : (extracted.상세용도 || '');
|
||||
} else {
|
||||
oldVal = (currentAsset as any)[f.key] || '';
|
||||
newVal = extracted[f.key] || '';
|
||||
}
|
||||
compareFields.forEach(f => {
|
||||
let oldVal = '';
|
||||
let newVal = '';
|
||||
|
||||
if (oldVal !== newVal) {
|
||||
diffLogs.push(`${f.label}: ${oldVal || '(없음)'} → ${newVal || '(없음)'}`);
|
||||
}
|
||||
});
|
||||
if (f.key === ASSET_SCHEMA.IP_ADDR.key) {
|
||||
oldVal = String(currentAsset[ASSET_SCHEMA.IP_ADDR.key] || '').trim();
|
||||
newVal = newIp;
|
||||
} else if (f.key === ASSET_SCHEMA.LOCATION.key) {
|
||||
oldVal = String(currentAsset[ASSET_SCHEMA.LOCATION.key] || '').trim();
|
||||
newVal = newLocation;
|
||||
} else if (f.key === ASSET_SCHEMA.MANAGER_MAIN.key) {
|
||||
oldVal = String(currentAsset[ASSET_SCHEMA.MANAGER_MAIN.key] || '').trim();
|
||||
newVal = String(extracted[ASSET_SCHEMA.MANAGER_MAIN.key] || '').trim();
|
||||
} else if (f.key === '상세용도') {
|
||||
oldVal = String(currentAsset.상세용도 || '').trim();
|
||||
newVal = String((extracted.type !== 'PC' && extracted.type !== '개인PC') ? extracted.type : (extracted.상세용도 || '')).trim();
|
||||
} else {
|
||||
oldVal = String((currentAsset as any)[f.key] || '').trim();
|
||||
newVal = String(extracted[f.key] || '').trim();
|
||||
}
|
||||
|
||||
if (oldVal !== newVal) {
|
||||
diffLogs.push(`${f.label}: ${oldVal || '(없음)'} → ${newVal || '(없음)'}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (diffLogs.length > 0) {
|
||||
state.masterData.logs = state.masterData.logs || [];
|
||||
@@ -428,44 +424,31 @@ export function initHwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
id: Math.random().toString(36).substring(2, 9),
|
||||
assetId: currentAsset.id,
|
||||
date: new Date().toISOString().split('T')[0],
|
||||
user: '관리자',
|
||||
user: '담당자',
|
||||
details: diffLogs.join('\n')
|
||||
});
|
||||
}
|
||||
}
|
||||
// ----------------------------
|
||||
|
||||
const updated: any = {
|
||||
...currentAsset,
|
||||
...extracted,
|
||||
IP주소: getFieldValue('hw-IP주소') || getFieldValue('hw-IP주소-non-server'),
|
||||
관리자: extracted.담당자_정,
|
||||
위치: isOpType ? extracted.보관위치 : getCombinedLocation('hw-위치-빌딩', 'hw-위치-상세', 'hw-위치-기타')
|
||||
[ASSET_SCHEMA.IP_ADDR.key]: getFieldValue('hw-IP주소') || getFieldValue('hw-IP주소-non-server'),
|
||||
위치: isOpType ? extracted[ASSET_SCHEMA.STORE_LOC.key] : getCombinedLocation('hw-위치-빌딩', 'hw-위치-상세', 'hw-위치-기타')
|
||||
};
|
||||
|
||||
// 현 사용조직 변경 시 이전 사용조직 자동 업데이트
|
||||
if (currentAsset.현사용조직 && currentAsset.현사용조직 !== extracted.현사용조직) {
|
||||
updated.이전사용조직 = currentAsset.현사용조직;
|
||||
if (currentAsset[ASSET_SCHEMA.ORG.key] && currentAsset[ASSET_SCHEMA.ORG.key] !== extracted[ASSET_SCHEMA.ORG.key]) {
|
||||
updated[ASSET_SCHEMA.PREV_ORG.key] = currentAsset[ASSET_SCHEMA.ORG.key];
|
||||
}
|
||||
|
||||
// 비 PC 자산에 대해 상세유형(상세용도)을 유형과 동기화
|
||||
if (updated.type !== 'PC') {
|
||||
updated.상세용도 = updated.type;
|
||||
}
|
||||
|
||||
if (updated.type !== 'PC') { updated.상세용도 = updated.type; }
|
||||
saveHardwareAsset(updated);
|
||||
onSave();
|
||||
setEditLock('hw-asset-form', 'view', {
|
||||
saveBtnId: 'btn-save-hw-asset',
|
||||
revertBtnId: 'btn-revert-hw-edit',
|
||||
generateBtnId: 'btn-generate-hw-code',
|
||||
addLogBtnId: 'btn-add-hw-log'
|
||||
});
|
||||
setEditLock('hw-asset-form', 'view', { saveBtnId: 'btn-save-hw-asset', revertBtnId: 'btn-revert-hw-edit', generateBtnId: 'btn-generate-hw-code', addLogBtnId: 'btn-add-hw-log' });
|
||||
isEditMode = false;
|
||||
});
|
||||
|
||||
deleteBtn.addEventListener('click', () => {
|
||||
if (currentAsset && confirm('정말로 삭제하시겠습니까?')) {
|
||||
if (currentAsset && confirm(UI_TEXT.MESSAGES.CONFIRM_DELETE)) {
|
||||
deleteHardwareAsset(currentAsset.id);
|
||||
onSave();
|
||||
closeModalAction();
|
||||
@@ -486,7 +469,7 @@ export function initHwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
const details = (document.getElementById('new-hw-log-details') as HTMLTextAreaElement).value;
|
||||
if (!date || !details) return;
|
||||
state.masterData.logs = state.masterData.logs || [];
|
||||
state.masterData.logs.push({ id: Math.random().toString(36).substring(2, 9), assetId: currentAsset.id, date, user: '관리자', details });
|
||||
state.masterData.logs.push({ id: Math.random().toString(36).substring(2, 9), assetId: currentAsset.id, date, user: '담당자', details });
|
||||
logModal.classList.add('hidden');
|
||||
renderHwHistory(currentAsset.id);
|
||||
});
|
||||
|
||||
@@ -2,8 +2,9 @@ import { state } from '../../core/state';
|
||||
import { SoftwareAsset } from '../../core/excelHandler';
|
||||
import { closeModals } from './BaseModal';
|
||||
import { openSwUserModal } from './SWUserModal';
|
||||
import { ASSET_SCHEMA, UI_TEXT } from '../../core/schema';
|
||||
import { createIcons, History, Plus, X, Save, Edit2, RotateCcw } from 'lucide';
|
||||
import { CORP_LIST, TYPE_PREFIX_MAP } from './SharedData';
|
||||
import { CORP_LIST } from './SharedData';
|
||||
import {
|
||||
generateOptionsHTML,
|
||||
setFieldValue,
|
||||
@@ -17,67 +18,63 @@ import {
|
||||
let currentSwAsset: SoftwareAsset | null = null;
|
||||
let isEditMode = false;
|
||||
|
||||
/**
|
||||
* 소프트웨어 필드 매핑 (통합 스키마 기반)
|
||||
* 소프트웨어는 자산번호를 사용하지 않으므로 제거함
|
||||
*/
|
||||
const SW_FIELD_MAP: Record<string, string> = {
|
||||
'법인': '법인',
|
||||
'자산번호': '자산번호',
|
||||
'제품명': '제품명',
|
||||
'수량': '수량',
|
||||
'금액': '금액',
|
||||
'구매일': '구매일',
|
||||
'납품업체': '납품업체',
|
||||
'비고': '비고',
|
||||
'플랫폼명': '플랫폼명',
|
||||
'부서': '부서',
|
||||
'계정명': '계정명',
|
||||
'결제수단': '결제수단',
|
||||
'연결카드번호': '연결카드번호',
|
||||
'결제일': '결제일',
|
||||
'당월청구액': '당월청구액',
|
||||
'라이선스유형': '라이선스유형',
|
||||
'만료일': '만료일',
|
||||
'라이선스키': '라이선스키'
|
||||
'법인': ASSET_SCHEMA.CORP.key,
|
||||
'제품명': ASSET_SCHEMA.PRODUCT.key,
|
||||
'수량': ASSET_SCHEMA.QTY.key,
|
||||
'금액': ASSET_SCHEMA.PRICE.key,
|
||||
'구매일': ASSET_SCHEMA.PURCHASE_YM.key,
|
||||
'납품업체': ASSET_SCHEMA.VENDOR.key,
|
||||
'비고': ASSET_SCHEMA.REMARKS.key,
|
||||
'플랫폼명': ASSET_SCHEMA.PLATFORM.key,
|
||||
'부서': '부서',
|
||||
'계정명': ASSET_SCHEMA.ACCOUNT.key,
|
||||
'결제수단': ASSET_SCHEMA.PAY_METHOD.key,
|
||||
'연결카드번호': ASSET_SCHEMA.CARD_NUM.key,
|
||||
'결제일': ASSET_SCHEMA.PAY_DAY.key,
|
||||
'당월청구액': ASSET_SCHEMA.BILLING.key,
|
||||
'라이선스유형': ASSET_SCHEMA.LICENSE_TYPE.key,
|
||||
'만료일': ASSET_SCHEMA.EXPIRY.key,
|
||||
'라이선스키': ASSET_SCHEMA.LICENSE_KEY.key
|
||||
};
|
||||
|
||||
const SW_FORM_HTML = `
|
||||
<!-- Group 1: 기본 정보 -->
|
||||
<div class="form-section-title">기본 정보 (Identity)</div>
|
||||
<div class="form-group">
|
||||
<label for="sw-법인">구매법인</label>
|
||||
<label for="sw-법인">${ASSET_SCHEMA.CORP.ui}</label>
|
||||
<select id="sw-법인" required>${generateOptionsHTML(CORP_LIST)}</select>
|
||||
</div>
|
||||
<div class="form-group sw-standard-field">
|
||||
<label for="sw-자산번호">자산번호</label>
|
||||
<div class="input-with-btn">
|
||||
<input type="text" id="sw-자산번호" readonly class="is-readonly-field" placeholder="번호 생성을 클릭하세요" />
|
||||
<button type="button" id="btn-generate-sw-code" class="btn btn-outline btn-sm">생성</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group full-width">
|
||||
<label for="sw-제품명">제품명 / 서비스명</label>
|
||||
<label for="sw-제품명">${ASSET_SCHEMA.PRODUCT.ui}</label>
|
||||
<input type="text" id="sw-제품명" required />
|
||||
</div>
|
||||
<div class="form-group cloud-only"><label for="sw-플랫폼명">플랫폼명</label><input type="text" id="sw-플랫폼명" placeholder="예: AWS, Cafe24" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-플랫폼명">${ASSET_SCHEMA.PLATFORM.ui}</label><input type="text" id="sw-플랫폼명" placeholder="예: AWS, Cafe24" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-부서">담당부서</label><input type="text" id="sw-부서" /></div>
|
||||
|
||||
<!-- Group 2: 라이선스 및 계약 -->
|
||||
<div class="form-section-title">라이선스 및 계약 정보</div>
|
||||
<div class="form-group sw-standard-field" id="sw-license-type-group"><label for="sw-라이선스유형">라이선스 유형</label><input type="text" id="sw-라이선스유형" /></div>
|
||||
<div class="form-group sw-standard-field" id="sw-license-key-group"><label for="sw-라이선스키">라이선스 키</label><input type="text" id="sw-라이선스키" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-수량">보유 수량</label><input type="number" id="sw-수량" min="0" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-금액">도입 금액</label><input type="text" id="sw-금액" oninput="this.value=this.value.replace(/[^0-9]/g,'').replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g,',')" /></div>
|
||||
<div class="form-group sw-standard-field" id="sw-license-type-group"><label for="sw-라이선스유형">${ASSET_SCHEMA.LICENSE_TYPE.ui}</label><input type="text" id="sw-라이선스유형" /></div>
|
||||
<div class="form-group sw-standard-field" id="sw-license-key-group"><label for="sw-라이선스키">${ASSET_SCHEMA.LICENSE_KEY.ui}</label><input type="text" id="sw-라이선스키" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-수량">${ASSET_SCHEMA.QTY.ui}</label><input type="number" id="sw-수량" min="0" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-금액">${ASSET_SCHEMA.PRICE.ui}</label><input type="text" id="sw-금액" oninput="this.value=this.value.replace(/[^0-9]/g,'').replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g,',')" /></div>
|
||||
|
||||
<div class="form-group cloud-only"><label for="sw-계정명">계정명 (이메일)</label><input type="text" id="sw-계정명" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-결제수단">결제수단</label><select id="sw-결제수단"><option value="">선택안함</option><option value="법인카드">법인카드</option><option value="인보이스">인보이스</option></select></div>
|
||||
<div class="form-group cloud-only"><label for="sw-연결카드번호">연결카드번호(뒷4자리)</label><input type="text" id="sw-연결카드번호" maxlength="4" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-결제일">결제일 (기준일)</label><input type="number" id="sw-결제일" min="1" max="31" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-당월청구액">당월 청구액(원)</label><input type="text" id="sw-당월청구액" oninput="this.value=this.value.replace(/[^0-9]/g,'').replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g,',')" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-계정명">${ASSET_SCHEMA.ACCOUNT.ui}</label><input type="text" id="sw-계정명" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-결제수단">${ASSET_SCHEMA.PAY_METHOD.ui}</label><select id="sw-결제수단"><option value="">선택안함</option><option value="법인카드">법인카드</option><option value="인보이스">인보이스</option></select></div>
|
||||
<div class="form-group cloud-only"><label for="sw-연결카드번호">${ASSET_SCHEMA.CARD_NUM.ui}</label><input type="text" id="sw-연결카드번호" maxlength="4" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-결제일">${ASSET_SCHEMA.PAY_DAY.ui}</label><input type="number" id="sw-결제일" min="1" max="31" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-당월청구액">${ASSET_SCHEMA.BILLING.ui}</label><input type="text" id="sw-당월청구액" oninput="this.value=this.value.replace(/[^0-9]/g,'').replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g,',')" /></div>
|
||||
|
||||
<!-- Group 4: 관리 정보 -->
|
||||
<div class="form-section-title">관리 및 비고</div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-구매일">구매연월</label><input type="text" id="sw-구매일" placeholder="YYYYMM" maxlength="6" /></div>
|
||||
<div class="form-group sw-standard-field" id="sw-expiry-group"><label for="sw-만료일">만료일 (구독)</label><input type="text" id="sw-만료일" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-납품업체">납품업체</label><input type="text" id="sw-납품업체" /></div>
|
||||
<div class="form-group full-width"><label for="sw-비고">비고</label><textarea id="sw-비고" rows="2"></textarea></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-구매일">${ASSET_SCHEMA.PURCHASE_YM.ui}</label><input type="text" id="sw-구매일" placeholder="YYYYMM" maxlength="6" /></div>
|
||||
<div class="form-group sw-standard-field" id="sw-expiry-group"><label for="sw-만료일">${ASSET_SCHEMA.EXPIRY.ui}</label><input type="text" id="sw-만료일" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-납품업체">${ASSET_SCHEMA.VENDOR.ui}</label><input type="text" id="sw-납품업체" /></div>
|
||||
<div class="form-group full-width"><label for="sw-비고">${ASSET_SCHEMA.REMARKS.ui}</label><textarea id="hw-비고" rows="2"></textarea></div>
|
||||
|
||||
<div id="sw-user-section" class="user-management-section" style="margin-top: 2rem;">
|
||||
<div class="section-header" style="display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem;">
|
||||
@@ -149,7 +146,6 @@ export function openSwModal(asset: SoftwareAsset, mode: 'view' | 'add' = 'view')
|
||||
setEditLock('sw-asset-form', mode, {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit',
|
||||
generateBtnId: 'btn-generate-sw-code',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
});
|
||||
isEditMode = (mode === 'add');
|
||||
@@ -171,9 +167,9 @@ export function initSwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
const logModalHTML = `
|
||||
<div id="sw-log-modal" class="modal-overlay hidden" style="z-index: 1100;">
|
||||
<div class="modal-content" style="max-width: 400px;">
|
||||
<div class="modal-header"><h2>업데이트 내역 추가</h2><button id="btn-close-sw-log" class="btn-icon"><i data-lucide="x"></i></button></div>
|
||||
<div class="modal-header"><h2>${UI_TEXT.ACTION.HISTORY_ADD}</h2><button id="btn-close-sw-log" class="btn-icon"><i data-lucide="x"></i></button></div>
|
||||
<div class="modal-body"><div class="grid-form" style="grid-template-columns: 1fr;"><div class="form-group"><label>날짜</label><input type="date" id="new-log-date" /></div><div class="form-group"><label>상세 내용</label><textarea id="new-log-details" rows="3"></textarea></div></div></div>
|
||||
<div class="modal-footer"><div></div><div class="footer-actions"><button id="btn-cancel-sw-log" class="btn btn-outline">취소</button><button id="btn-confirm-sw-log" class="btn btn-primary">추가</button></div></div>
|
||||
<div class="modal-footer"><div></div><div class="footer-actions"><button id="btn-cancel-sw-log" class="btn btn-outline">${UI_TEXT.ACTION.CANCEL}</button><button id="btn-confirm-sw-log" class="btn btn-primary">추가</button></div></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -196,27 +192,12 @@ export function initSwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
setEditLock('sw-asset-form', 'view', {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit',
|
||||
generateBtnId: 'btn-generate-sw-code',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
});
|
||||
isEditMode = false;
|
||||
if (currentSwAsset) openSwModal(currentSwAsset, 'view');
|
||||
});
|
||||
|
||||
document.getElementById('btn-generate-sw-code')?.addEventListener('click', async () => {
|
||||
const typeValue = getFieldValue('sw-asset-type');
|
||||
const purchaseDate = getFieldValue('sw-구매일');
|
||||
const typeCode = TYPE_PREFIX_MAP[typeValue] || 'SW';
|
||||
const dateStr = purchaseDate.replace(/[^0-9]/g, '');
|
||||
if (dateStr.length < 6) { alert('올바른 구매연월(YYYYMM)을 입력해주세요.'); return; }
|
||||
const prefix = `${typeCode}-${dateStr.substring(0, 6)}-`;
|
||||
try {
|
||||
const res = await fetch(`http://172.16.40.100:3000/api/generate-asset-code?prefix=${prefix}`);
|
||||
const data = await res.json();
|
||||
if (data.nextCode) setFieldValue('sw-자산번호', data.nextCode);
|
||||
} catch (err) { alert('자산번호 생성에 실패했습니다.'); }
|
||||
});
|
||||
|
||||
// YYYYMM 입력 제한 로직 (숫자 6자리)
|
||||
document.getElementById('sw-구매일')?.addEventListener('input', (e) => {
|
||||
const target = e.target as HTMLInputElement;
|
||||
@@ -229,14 +210,13 @@ export function initSwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
setEditLock('sw-asset-form', 'edit', {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit',
|
||||
generateBtnId: 'btn-generate-sw-code',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
addLogBtnId: 'btn-add-hw-log'
|
||||
});
|
||||
isEditMode = true;
|
||||
return;
|
||||
}
|
||||
const extracted = autoExtractForm('sw', SW_FIELD_MAP);
|
||||
const updated = { ...currentSwAsset, ...extracted, 수량: parseInt(extracted.수량 || '0') };
|
||||
const updated = { ...currentSwAsset, ...extracted, 수량: parseInt(extracted[ASSET_SCHEMA.QTY.key] || '0') };
|
||||
|
||||
let targetList: SoftwareAsset[] = [];
|
||||
if (updated.type === '구독SW') targetList = state.masterData.subSw;
|
||||
@@ -250,14 +230,13 @@ export function initSwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
setEditLock('sw-asset-form', 'view', {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit',
|
||||
generateBtnId: 'btn-generate-sw-code',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
});
|
||||
isEditMode = false;
|
||||
});
|
||||
|
||||
deleteBtn.addEventListener('click', () => {
|
||||
if (currentSwAsset && confirm('삭제하시겠습니까?')) {
|
||||
if (currentSwAsset && confirm(UI_TEXT.MESSAGES.CONFIRM_DELETE)) {
|
||||
const type = currentSwAsset.type;
|
||||
if (type === '구독SW') state.masterData.subSw = state.masterData.subSw.filter(a => a.id !== currentSwAsset!.id);
|
||||
else if (type === '영구SW') state.masterData.permSw = state.masterData.permSw.filter(a => a.id !== currentSwAsset!.id);
|
||||
@@ -279,7 +258,7 @@ export function initSwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
const details = (document.getElementById('new-log-details') as HTMLTextAreaElement).value;
|
||||
if (!date || !details) return;
|
||||
state.masterData.logs = state.masterData.logs || [];
|
||||
state.masterData.logs.push({ id: Math.random().toString(36).substring(2, 9), assetId: currentSwAsset.id, date, user: '관리자', details });
|
||||
state.masterData.logs.push({ id: Math.random().toString(36).substring(2, 9), assetId: currentSwAsset.id, date, user: '담당자', details });
|
||||
logModal.classList.add('hidden'); renderSwHistory(currentSwAsset.id);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ const MENU_CONFIG = {
|
||||
},
|
||||
sw: {
|
||||
label: '소프트웨어',
|
||||
tabs: ['대시보드', '구독SW', '영구SW', '클라우드']
|
||||
tabs: ['대시보드', '구독SW', '영구SW']
|
||||
},
|
||||
ops: {
|
||||
label: '운영 서비스',
|
||||
tabs: ['대시보드', '서비스현황', '백업관리', '보안점검']
|
||||
tabs: ['도메인', '메일', '메신저', '청구비용']
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@ export function renderNavigation(onTabChange: (tab: string) => void) {
|
||||
const render = () => {
|
||||
navContainer.innerHTML = '';
|
||||
|
||||
// 기존 메뉴 렌더링
|
||||
(Object.keys(MENU_CONFIG) as Array<keyof typeof MENU_CONFIG>).forEach(catKey => {
|
||||
const config = MENU_CONFIG[catKey];
|
||||
const isActive = state.activeCategory === catKey;
|
||||
@@ -29,7 +30,6 @@ export function renderNavigation(onTabChange: (tab: string) => void) {
|
||||
const group = document.createElement('div');
|
||||
group.className = `nav-group ${isActive ? 'active is-showing-shelf' : ''}`;
|
||||
|
||||
// 메인 카테고리 트리거
|
||||
const trigger = document.createElement('div');
|
||||
trigger.className = 'gnb-trigger';
|
||||
trigger.textContent = config.label;
|
||||
@@ -45,7 +45,6 @@ export function renderNavigation(onTabChange: (tab: string) => void) {
|
||||
});
|
||||
group.appendChild(trigger);
|
||||
|
||||
// 하위 탭 선반 (Shelf)
|
||||
const shelf = document.createElement('div');
|
||||
shelf.className = 'lnb-shelf';
|
||||
|
||||
@@ -58,21 +57,34 @@ export function renderNavigation(onTabChange: (tab: string) => void) {
|
||||
e.stopPropagation();
|
||||
state.activeCategory = catKey;
|
||||
state.activeSubTab = tab;
|
||||
|
||||
if (btnAddAsset) {
|
||||
btnAddAsset.classList.remove('hidden');
|
||||
}
|
||||
|
||||
if (btnAddAsset) btnAddAsset.classList.remove('hidden');
|
||||
render();
|
||||
onTabChange(tab);
|
||||
});
|
||||
shelf.appendChild(item);
|
||||
});
|
||||
group.appendChild(shelf);
|
||||
|
||||
// 마우스 오버 시 다른 그룹의 선반은 가리고 내 것만 보여주는 스타일은 CSS에서 처리함
|
||||
navContainer.appendChild(group);
|
||||
});
|
||||
|
||||
// ─── '관리자' 메뉴 별도 추가 (GNB 스타일) ───
|
||||
const adminGroup = document.createElement('div');
|
||||
adminGroup.className = 'nav-group';
|
||||
|
||||
const adminTrigger = document.createElement('div');
|
||||
adminTrigger.className = 'gnb-trigger';
|
||||
adminTrigger.innerHTML = '관리자';
|
||||
adminTrigger.style.color = 'var(--text-muted)';
|
||||
adminTrigger.style.borderLeft = '1px solid var(--border-color)';
|
||||
adminTrigger.style.marginLeft = '1rem';
|
||||
adminTrigger.style.paddingLeft = '1.5rem';
|
||||
|
||||
adminTrigger.addEventListener('click', () => {
|
||||
alert('준비중입니다.');
|
||||
});
|
||||
|
||||
adminGroup.appendChild(adminTrigger);
|
||||
navContainer.appendChild(adminGroup);
|
||||
};
|
||||
|
||||
render();
|
||||
|
||||
Reference in New Issue
Block a user