feat: 자산 관리 시스템 고도화 및 데이터 구조 최적화
- 모바일 자산(Mobile) 카테고리 추가 및 엑셀 업로드/다운로드 지원 - 클라우드 자산(Cloud) 및 변경 이력(Logs) 테이블 및 API 구현 - 데이터베이스 초기화 로직 개선 및 테이블 자동 생성 기능 추가 - 하드웨어 저장 로직 통합 및 카테고리 판별 자동화 - SW 대시보드 사용량 산출 방식 개선 (sw_id 기반 맵핑) - 수동 모달(Storage)을 통합 하드웨어 모달(HWModal)로 통합 및 정리
This commit is contained in:
26
src/main.ts
26
src/main.ts
@@ -6,14 +6,13 @@ import { downloadTemplate, exportToExcel, parseExcel, HardwareAsset, SoftwareAss
|
||||
import { initBaseModal } from './components/Modal/BaseModal';
|
||||
import { initPcModal } from './components/Modal/PCModal';
|
||||
import { initHwModal, openHwModal } from './components/Modal/HWModal';
|
||||
import { initStorageModal } from './components/Modal/StorageModal';
|
||||
import { initSwModal, openSwModal } from './components/Modal/SWModal';
|
||||
import { initCloudModal, openCloudModal } from './components/Modal/CloudModal';
|
||||
import { initSwUserModal } from './components/Modal/SWUserModal';
|
||||
import { initDashboardDetailModal } from './components/Modal/DashboardDetailModal';
|
||||
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History, RefreshCcw } from 'lucide';
|
||||
|
||||
// --- DB 저장을 위한 세분화된 헬퍼 함수들 ---
|
||||
// --- DB 저장을 위한 세분화된 헬퍼 함수들 (setting 브랜치 기반) ---
|
||||
async function apiBatchSave(url: string, data: any[], label: string) {
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
@@ -65,10 +64,9 @@ function initApp() {
|
||||
}
|
||||
});
|
||||
|
||||
// 동료의 새로운 UI 방식(renderSWTable)과 우리의 통합 저장 로직 결합
|
||||
// 모달 초기화: StorageModal은 HWModal에 통합됨
|
||||
initPcModal(() => { saveAllHardwareToDB(); renderSWTable(mainContent); }, closeAllModals);
|
||||
initHwModal(() => { saveAllHardwareToDB(); renderSWTable(mainContent); }, closeAllModals);
|
||||
initStorageModal(() => { saveAllHardwareToDB(); renderSWTable(mainContent); }, closeAllModals);
|
||||
|
||||
initSwModal(() => {
|
||||
if (state.activeSubTab === '구독SW') saveSubSwToDB();
|
||||
@@ -77,7 +75,7 @@ function initApp() {
|
||||
}, closeAllModals);
|
||||
|
||||
initCloudModal(() => {
|
||||
// 클라우드 저장 로직 추가 필요시 여기에 구현
|
||||
// 클라우드 저장 로직 (필요 시 API 추가 구현 가능)
|
||||
renderSWTable(mainContent);
|
||||
}, closeAllModals);
|
||||
|
||||
@@ -86,8 +84,10 @@ function initApp() {
|
||||
initDashboardDetailModal();
|
||||
} catch (e) { console.error('❌ Initialization failed:', e); }
|
||||
|
||||
// 초기 로드 시 대시보드 렌더링
|
||||
renderDashboard(mainContent);
|
||||
|
||||
// DB에서 데이터 로드 후 화면 갱신
|
||||
loadMasterDataFromDB().then((success) => {
|
||||
if (success) {
|
||||
if (state.activeSubTab === '대시보드') renderDashboard(mainContent);
|
||||
@@ -95,6 +95,7 @@ function initApp() {
|
||||
}
|
||||
});
|
||||
|
||||
// 버튼 이벤트 바인딩
|
||||
document.getElementById('btn-download-template')?.addEventListener('click', () => downloadTemplate());
|
||||
document.getElementById('btn-export-excel')?.addEventListener('click', () => exportToExcel(state.masterData));
|
||||
|
||||
@@ -113,16 +114,17 @@ function initApp() {
|
||||
});
|
||||
|
||||
document.getElementById('btn-add-asset')?.addEventListener('click', () => {
|
||||
if (['개인PC', '서버', '전산비품', '스토리지'].includes(state.activeSubTab)) {
|
||||
const tab = state.activeSubTab;
|
||||
if (['개인PC', '서버', '전산비품', '스토리지', '모바일기기'].includes(tab)) {
|
||||
openHwModal({
|
||||
id: Math.random().toString(36).substring(2, 9),
|
||||
type: state.activeSubTab,
|
||||
type: tab,
|
||||
법인: '한맥', 자산코드: '', 명칭: '', 위치: '', 관리자: '', IP주소: '', MACaddress: '', HW사양: '', OS: '', 납품업체: '', 품의서명: ''
|
||||
} as any, 'add');
|
||||
} else if (state.activeSubTab === '클라우드') {
|
||||
openCloudModal({ type: '클라우드', 제품명: '', 금액: '', 수량: 1, 계정명: '', 납품업체: '', 비고: '', 법인: '한맥', 플랫폼명: '' } as any);
|
||||
} else if (state.activeSubTab === '구독SW' || state.activeSubTab === '영구SW') {
|
||||
openSwModal({ type: state.activeSubTab, 제품명: '', 금액: '', 수량: 1, 계정명: '', 납품업체: '', 비고: '', 법인: '한맥' } as any);
|
||||
} else if (tab === '클라우드') {
|
||||
openCloudModal({ type: '클라우드', 플랫폼명: '', 법인: '한맥', 부서: '', 제품명: '', 계정명: '', 결제수단: '', 결제일: '', 연결카드번호: '', 당월청구액: '', 비고: '' } as any);
|
||||
} else if (tab === '구독SW' || tab === '영구SW') {
|
||||
openSwModal({ type: tab, 제품명: '', 금액: '', 수량: 1, 계정명: '', 납품업체: '', 비고: '', 법인: '한맥' } as any);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -131,4 +133,4 @@ function initApp() {
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initApp);
|
||||
document.addEventListener('DOMContentLoaded', initApp);
|
||||
Reference in New Issue
Block a user