feat: Implement Excel bulk upload with review modal and domain support
This commit is contained in:
18
src/main.ts
18
src/main.ts
@@ -8,6 +8,7 @@ import { initHwModal, openHwModal } from './components/Modal/HWModal';
|
||||
import { initSwModal, openSwModal } from './components/Modal/SWModal';
|
||||
import { initSwUserModal } from './components/Modal/SWUserModal';
|
||||
import { initDomainModal, openDomainModal } from './components/Modal/DomainModal';
|
||||
import { initUploadPreviewModal, openUploadPreview } from './components/Modal/UploadPreviewModal';
|
||||
import { initDashboardDetailModal } from './components/Modal/DashboardDetailModal';
|
||||
import { initGuide } from './components/Guide';
|
||||
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History, RefreshCcw, BookOpen, Settings } from 'lucide';
|
||||
@@ -111,6 +112,10 @@ function initApp() {
|
||||
|
||||
initDashboardDetailModal();
|
||||
initDomainModal();
|
||||
initUploadPreviewModal(async () => {
|
||||
await loadMasterDataFromDB();
|
||||
refreshView();
|
||||
});
|
||||
initGuide();
|
||||
|
||||
// DB 데이터 로드 및 초기 화면 렌더링
|
||||
@@ -129,10 +134,15 @@ function initApp() {
|
||||
uploadInput?.addEventListener('change', async (e) => {
|
||||
const file = (e.target as HTMLInputElement).files?.[0];
|
||||
if (file) {
|
||||
const data = await parseExcel(file);
|
||||
state.masterData = { ...state.masterData, ...data };
|
||||
await Promise.all([saveAllHardwareToDB(), saveAllSoftwareToDB()]);
|
||||
refreshView();
|
||||
try {
|
||||
const data = await parseExcel(file);
|
||||
openUploadPreview(data);
|
||||
// Clear input so same file can be selected again
|
||||
uploadInput.value = '';
|
||||
} catch (err) {
|
||||
alert('엑셀 파일을 읽는 중 오류가 발생했습니다.');
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user