Fix: Excel upload logic, field mapping for servers, and date format synchronization
This commit is contained in:
23
server.js
23
server.js
@@ -56,7 +56,7 @@ async function ensureTables() {
|
|||||||
manager_main VARCHAR(100), manager_sub VARCHAR(100), ip_address VARCHAR(50),
|
manager_main VARCHAR(100), manager_sub VARCHAR(100), ip_address VARCHAR(50),
|
||||||
remote_tool VARCHAR(100), server_id VARCHAR(100), server_pw VARCHAR(100),
|
remote_tool VARCHAR(100), server_id VARCHAR(100), server_pw VARCHAR(100),
|
||||||
model_name VARCHAR(255), mainboard VARCHAR(255), os VARCHAR(100), cpu VARCHAR(100), ram VARCHAR(100), gpu VARCHAR(100),
|
model_name VARCHAR(255), mainboard VARCHAR(255), os VARCHAR(100), cpu VARCHAR(100), ram VARCHAR(100), gpu VARCHAR(100),
|
||||||
storage1 VARCHAR(100), storage2 VARCHAR(100), storage3 VARCHAR(100), monitoring VARCHAR(100), price VARCHAR(100), remarks TEXT,
|
storage1 VARCHAR(100), storage2 VARCHAR(100), storage3 VARCHAR(100), monitoring VARCHAR(100), price VARCHAR(100), vendor VARCHAR(100), remarks TEXT,
|
||||||
storage_location VARCHAR(255), status VARCHAR(50)
|
storage_location VARCHAR(255), status VARCHAR(50)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
`);
|
`);
|
||||||
@@ -102,6 +102,14 @@ async function ensureTables() {
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
// 기존 테이블들에 vendor 컬럼이 없는 경우 추가 (Migration)
|
||||||
|
const [cols] = await pool.query("SHOW COLUMNS FROM pc_assets LIKE 'vendor'");
|
||||||
|
if (cols.length === 0) {
|
||||||
|
for (const table of ['pc_assets', 'server_assets', 'storage_assets', 'equip_assets', 'mobile_assets']) {
|
||||||
|
await pool.query(`ALTER TABLE ${table} ADD COLUMN vendor VARCHAR(100) AFTER price`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log('✅ All ITAM tables ensured.');
|
console.log('✅ All ITAM tables ensured.');
|
||||||
} finally {
|
} finally {
|
||||||
connection.release();
|
connection.release();
|
||||||
@@ -121,6 +129,7 @@ async function batchSave(tableName, assets, getQuery) {
|
|||||||
await connection.commit();
|
await connection.commit();
|
||||||
return { success: true, count: assets.length };
|
return { success: true, count: assets.length };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error(`❌ Batch Save Error (${tableName}):`, err.message);
|
||||||
await connection.rollback();
|
await connection.rollback();
|
||||||
throw err;
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
@@ -134,16 +143,16 @@ const hardwareInsertSQL = (table) => `
|
|||||||
id, corp, asset_code, purchase_date, type, detail_purpose, purpose, details,
|
id, corp, asset_code, purchase_date, type, detail_purpose, purpose, details,
|
||||||
current_org, prev_org, location, manager_main, manager_sub, ip_address,
|
current_org, prev_org, location, manager_main, manager_sub, ip_address,
|
||||||
remote_tool, server_id, server_pw, model_name, mainboard, os, cpu, ram, gpu,
|
remote_tool, server_id, server_pw, model_name, mainboard, os, cpu, ram, gpu,
|
||||||
storage1, storage2, storage3, monitoring, price, remarks,
|
storage1, storage2, storage3, monitoring, price, vendor, remarks,
|
||||||
storage_location, status
|
storage_location, status
|
||||||
) VALUES ?
|
) VALUES ?
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const getHardwareValues = (a) => [
|
const getHardwareValues = (a) => [
|
||||||
a.id, a.법인||'', a.자산코드||'', a.구매연월||'', a.type||'', a.상세용도||'', a.용도||'', a.상세||'',
|
a.id, a.법인||'', a.자산코드||'', a.구매연월||'', a.type||'', a.상세용도||'', a['사용자']||a.용도||'', a.상세||'',
|
||||||
a.현사용조직||'', a.이전사용조직||'', a.위치||'', a.담당자_정||'', a.담당자_부||'', a.IP주소||'',
|
a.현사용조직||'', a.이전사용조직||'', a.위치||'', a.담당자_정||'', a.담당자_부||'', a.IP주소||'',
|
||||||
a.원격접속||'', a.서버ID||'', a.서버PW||'', a.모델명||'', a.메인보드||'', a.OS||'', a.CPU||'', a.RAM||'', a.GPU||'',
|
a.원격접속||'', a.서버ID||'', a.서버PW||'', a.모델명||'', a.메인보드||'', a.OS||'', a.CPU||'', a.RAM||'', a.GPU||'',
|
||||||
a.SSD1||'', a.SSD2||'', a.HDD1||'', a.모니터링||'', a.금액||'', a.비고||'',
|
a.SSD1||'', a.SSD2||'', a.SSD3||'', a.모니터링||'', a.금액||'', a.납품업체||a.vendor||'', a.비고||'',
|
||||||
a.보관위치||'', a.현재상태||''
|
a.보관위치||'', a.현재상태||''
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -157,7 +166,8 @@ const mapHardware = (r, defaultType) => {
|
|||||||
구매일: r.purchase_date,
|
구매일: r.purchase_date,
|
||||||
type: type,
|
type: type,
|
||||||
상세용도: (type !== '개인PC' && !r.detail_purpose) ? type : r.detail_purpose,
|
상세용도: (type !== '개인PC' && !r.detail_purpose) ? type : r.detail_purpose,
|
||||||
용도: r.purpose,
|
용도: (type !== '개인PC' && !r.detail_purpose) ? type : r.detail_purpose,
|
||||||
|
사용자: r.purpose,
|
||||||
상세: r.details,
|
상세: r.details,
|
||||||
현사용조직: r.current_org,
|
현사용조직: r.current_org,
|
||||||
이전사용조직: r.prev_org,
|
이전사용조직: r.prev_org,
|
||||||
@@ -176,9 +186,10 @@ const mapHardware = (r, defaultType) => {
|
|||||||
GPU: r.gpu,
|
GPU: r.gpu,
|
||||||
SSD1: r.storage1,
|
SSD1: r.storage1,
|
||||||
SSD2: r.storage2,
|
SSD2: r.storage2,
|
||||||
HDD1: r.storage3,
|
SSD3: r.storage3,
|
||||||
모니터링: r.monitoring,
|
모니터링: r.monitoring,
|
||||||
금액: r.price,
|
금액: r.price,
|
||||||
|
납품업체: r.vendor,
|
||||||
비고: r.remarks,
|
비고: r.remarks,
|
||||||
보관위치: r.storage_location,
|
보관위치: r.storage_location,
|
||||||
현재상태: r.status
|
현재상태: r.status
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { state } from '../../core/state';
|
import { state } from '../../core/state';
|
||||||
import { closeModals, openModal } from './BaseModal';
|
import { closeModals, openModal } from './BaseModal';
|
||||||
import { CORP_LIST } from './SharedData';
|
import { CORP_LIST } from './SharedData';
|
||||||
import { generateOptionsHTML } from './ModalUtils';
|
import { generateOptionsHTML, setEditLock } from './ModalUtils';
|
||||||
import { createIcons, X, Save, Database, CalendarClock, Edit2 } from 'lucide';
|
import { createIcons, X, Save, Database, CalendarClock, Edit2 } from 'lucide';
|
||||||
|
import { formatExcelDate } from '../../core/excelHandler';
|
||||||
|
|
||||||
let currentItem: any = null;
|
let currentItem: any = null;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ const DOMAIN_MODAL_HTML = `
|
|||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2 id="domain-modal-title">도메인 정보</h2>
|
<h2 id="domain-modal-title">도메인 정보</h2>
|
||||||
<div style="display:flex; gap:0.5rem; align-items:center;">
|
<div style="display:flex; gap:0.5rem; align-items:center;">
|
||||||
|
<button id="btn-edit-domain-header" class="btn-icon header-edit-btn" title="수정"><i data-lucide="edit-2"></i></button>
|
||||||
<button id="btn-close-domain-modal" class="btn-icon"><i data-lucide="x"></i></button>
|
<button id="btn-close-domain-modal" class="btn-icon"><i data-lucide="x"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -86,19 +88,23 @@ const DOMAIN_MODAL_HTML = `
|
|||||||
<!-- Group 3: 기타 (Additional) -->
|
<!-- Group 3: 기타 (Additional) -->
|
||||||
<div class="form-section-title" style="display:flex; align-items:center; gap:0.5rem; margin-top:1.5rem;">
|
<div class="form-section-title" style="display:flex; align-items:center; gap:0.5rem; margin-top:1.5rem;">
|
||||||
<i data-lucide="edit-2" style="width:16px; height:16px; color:var(--primary-color);"></i>
|
<i data-lucide="edit-2" style="width:16px; height:16px; color:var(--primary-color);"></i>
|
||||||
기타 사항
|
구매 정보
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group full-width">
|
<div class="form-group full-width">
|
||||||
<label>비고</label>
|
<label>구매업체</label>
|
||||||
<textarea id="domain-remarks" rows="3" style="width:100%; border:1px solid var(--border-color); border-radius:4px; padding:0.625rem;"></textarea>
|
<textarea id="domain-remarks" rows="1" style="width:100%; border:1px solid var(--border-color); border-radius:4px; padding:0.625rem;"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button id="btn-cancel-domain" class="btn btn-outline">취소</button>
|
<button id="btn-delete-domain" class="btn btn-outline btn-danger">삭제</button>
|
||||||
<button id="btn-save-domain" class="btn btn-primary"><i data-lucide="save"></i> 저장하기</button>
|
<div class="footer-actions">
|
||||||
|
<button id="btn-revert-domain" class="btn btn-outline hidden">수정 취소</button>
|
||||||
|
<button id="btn-cancel-domain" class="btn btn-outline">닫기</button>
|
||||||
|
<button id="btn-save-domain" class="btn btn-primary"><i data-lucide="save"></i> 저장하기</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,15 +118,47 @@ export function initDomainModal() {
|
|||||||
const modal = document.getElementById('domain-asset-modal')!;
|
const modal = document.getElementById('domain-asset-modal')!;
|
||||||
document.getElementById('btn-close-domain-modal')?.addEventListener('click', () => closeModals());
|
document.getElementById('btn-close-domain-modal')?.addEventListener('click', () => closeModals());
|
||||||
document.getElementById('btn-cancel-domain')?.addEventListener('click', () => closeModals());
|
document.getElementById('btn-cancel-domain')?.addEventListener('click', () => closeModals());
|
||||||
document.getElementById('btn-save-domain')?.addEventListener('click', () => saveDomain());
|
|
||||||
|
const saveBtn = document.getElementById('btn-save-domain');
|
||||||
|
const revertBtn = document.getElementById('btn-revert-domain');
|
||||||
|
const deleteBtn = document.getElementById('btn-delete-domain');
|
||||||
|
const headerEditBtn = document.getElementById('btn-edit-domain-header');
|
||||||
|
|
||||||
|
saveBtn?.addEventListener('click', () => {
|
||||||
|
if (!currentItem) return;
|
||||||
|
if (saveBtn.textContent === '수정') {
|
||||||
|
setEditLock('domain-asset-form', 'edit', { saveBtnId: 'btn-save-domain', revertBtnId: 'btn-revert-domain' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
saveDomain();
|
||||||
|
});
|
||||||
|
|
||||||
|
headerEditBtn?.addEventListener('click', () => {
|
||||||
|
setEditLock('domain-asset-form', 'edit', { saveBtnId: 'btn-save-domain', revertBtnId: 'btn-revert-domain' });
|
||||||
|
});
|
||||||
|
|
||||||
|
revertBtn?.addEventListener('click', () => {
|
||||||
|
setEditLock('domain-asset-form', 'view', { saveBtnId: 'btn-save-domain', revertBtnId: 'btn-revert-domain' });
|
||||||
|
if (currentItem) openDomainModal(currentItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteBtn?.addEventListener('click', () => {
|
||||||
|
if (currentItem && confirm('정말 삭제하시겠습니까?')) {
|
||||||
|
state.masterData.domain = state.masterData.domain.filter(d => d.id !== currentItem.id);
|
||||||
|
saveDomainBatch();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openDomainModal(item: any = null) {
|
export function openDomainModal(item: any = null) {
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
const isEdit = !!item;
|
const isEdit = !!item;
|
||||||
|
const mode = isEdit ? 'view' : 'add';
|
||||||
|
|
||||||
const titleEl = document.getElementById('domain-modal-title');
|
const titleEl = document.getElementById('domain-modal-title');
|
||||||
if (titleEl) titleEl.textContent = isEdit ? '도메인 정보 수정' : '신규 도메인 등록';
|
if (titleEl) titleEl.textContent = isEdit ? '도메인 정보 상세' : '신규 도메인 등록';
|
||||||
|
|
||||||
|
setEditLock('domain-asset-form', mode, { saveBtnId: 'btn-save-domain', revertBtnId: 'btn-revert-domain' });
|
||||||
|
|
||||||
const setVal = (id: string, val: any) => {
|
const setVal = (id: string, val: any) => {
|
||||||
const el = document.getElementById(id) as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
const el = document.getElementById(id) as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
||||||
@@ -131,17 +169,40 @@ export function openDomainModal(item: any = null) {
|
|||||||
setVal('domain-corp', item?.corp || '');
|
setVal('domain-corp', item?.corp || '');
|
||||||
setVal('domain-service-name', item?.service_name || '');
|
setVal('domain-service-name', item?.service_name || '');
|
||||||
setVal('domain-name', item?.domain_name || '');
|
setVal('domain-name', item?.domain_name || '');
|
||||||
setVal('domain-start-date', item?.start_date || '');
|
setVal('domain-start-date', formatExcelDate(item?.start_date));
|
||||||
setVal('domain-expiry-date', item?.expiry_date || '');
|
setVal('domain-expiry-date', formatExcelDate(item?.expiry_date));
|
||||||
setVal('domain-price', item?.price || '');
|
setVal('domain-price', item?.price || '');
|
||||||
setVal('domain-manager-main', item?.manager_main || '');
|
setVal('domain-manager-main', item?.manager_main || '');
|
||||||
setVal('domain-manager-sub', item?.manager_sub || '');
|
setVal('domain-manager-sub', item?.manager_sub || '');
|
||||||
setVal('domain-remarks', item?.remarks || '');
|
setVal('domain-remarks', item?.remarks || '');
|
||||||
|
|
||||||
|
const deleteBtn = document.getElementById('btn-delete-domain');
|
||||||
|
if (deleteBtn) deleteBtn.style.display = isEdit ? 'block' : 'none';
|
||||||
|
|
||||||
openModal('domain-asset-modal');
|
openModal('domain-asset-modal');
|
||||||
createIcons({ icons: { X, Save, Database, CalendarClock, Edit2 } });
|
createIcons({ icons: { X, Save, Database, CalendarClock, Edit2 } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function saveDomainBatch() {
|
||||||
|
try {
|
||||||
|
const response = await fetch(`http://${location.hostname}:3000/api/ops/domain/batch`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(state.masterData.domain)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
closeModals();
|
||||||
|
window.dispatchEvent(new CustomEvent('refresh-view'));
|
||||||
|
} else {
|
||||||
|
throw new Error('DB 저장 실패');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
alert('저장 중 오류가 발생했습니다.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function saveDomain() {
|
async function saveDomain() {
|
||||||
const getVal = (id: string) => (document.getElementById(id) as HTMLInputElement)?.value || '';
|
const getVal = (id: string) => (document.getElementById(id) as HTMLInputElement)?.value || '';
|
||||||
|
|
||||||
@@ -164,29 +225,17 @@ async function saveDomain() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentItem) {
|
if (currentItem && currentItem.id.startsWith('DOM-')) {
|
||||||
|
// 신규 추가 후 바로 수정하는 경우 등 대응
|
||||||
|
const idx = state.masterData.domain.findIndex(d => d.id === currentItem.id);
|
||||||
|
if (idx > -1) state.masterData.domain[idx] = newDomain;
|
||||||
|
else state.masterData.domain.push(newDomain);
|
||||||
|
} else if (currentItem) {
|
||||||
const idx = state.masterData.domain.findIndex(d => d.id === currentItem.id);
|
const idx = state.masterData.domain.findIndex(d => d.id === currentItem.id);
|
||||||
if (idx > -1) state.masterData.domain[idx] = newDomain;
|
if (idx > -1) state.masterData.domain[idx] = newDomain;
|
||||||
} else {
|
} else {
|
||||||
state.masterData.domain.push(newDomain);
|
state.masterData.domain.push(newDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
await saveDomainBatch();
|
||||||
const response = await fetch(`http://${location.hostname}:3000/api/ops/domain/batch`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify(state.masterData.domain)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
// alert('성공적으로 저장되었습니다.');
|
|
||||||
closeModals();
|
|
||||||
window.dispatchEvent(new CustomEvent('refresh-view'));
|
|
||||||
} else {
|
|
||||||
throw new Error('DB 저장 실패');
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
alert('저장 중 오류가 발생했습니다.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,14 +45,17 @@ const HW_FIELD_MAP: Record<string, string> = {
|
|||||||
'모니터링': '모니터링',
|
'모니터링': '모니터링',
|
||||||
'OS': ASSET_SCHEMA.OS.key,
|
'OS': ASSET_SCHEMA.OS.key,
|
||||||
'CPU': ASSET_SCHEMA.CPU.key,
|
'CPU': ASSET_SCHEMA.CPU.key,
|
||||||
|
'GPU': ASSET_SCHEMA.GPU.key,
|
||||||
'RAM': ASSET_SCHEMA.RAM.key,
|
'RAM': ASSET_SCHEMA.RAM.key,
|
||||||
'SSD1': ASSET_SCHEMA.STORAGE1.key,
|
'SSD1': ASSET_SCHEMA.STORAGE1.key,
|
||||||
'SSD2': ASSET_SCHEMA.STORAGE2.key,
|
'SSD2': ASSET_SCHEMA.STORAGE2.key,
|
||||||
|
'SSD3': ASSET_SCHEMA.STORAGE3.key,
|
||||||
'HW사양': 'HW사양',
|
'HW사양': 'HW사양',
|
||||||
'담당자_정': ASSET_SCHEMA.MANAGER_MAIN.key,
|
'담당자_정': ASSET_SCHEMA.MANAGER_MAIN.key,
|
||||||
'담당자_부': ASSET_SCHEMA.MANAGER_SUB.key,
|
'담당자_부': ASSET_SCHEMA.MANAGER_SUB.key,
|
||||||
'구매일': ASSET_SCHEMA.PURCHASE_YM.key,
|
'구매일': ASSET_SCHEMA.PURCHASE_YM.key,
|
||||||
'금액': ASSET_SCHEMA.PRICE.key,
|
'금액': ASSET_SCHEMA.PRICE.key,
|
||||||
|
'납품업체': ASSET_SCHEMA.VENDOR.key,
|
||||||
'비고': ASSET_SCHEMA.REMARKS.key,
|
'비고': ASSET_SCHEMA.REMARKS.key,
|
||||||
'사용자': ASSET_SCHEMA.USER.key
|
'사용자': ASSET_SCHEMA.USER.key
|
||||||
};
|
};
|
||||||
@@ -118,9 +121,11 @@ const HW_FORM_HTML = `
|
|||||||
<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 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-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-cpu-group"><label for="hw-CPU">${ASSET_SCHEMA.CPU.ui}</label><input type="text" id="hw-CPU" /></div>
|
||||||
|
<div class="form-group" id="hw-gpu-group"><label for="hw-GPU">${ASSET_SCHEMA.GPU.ui}</label><input type="text" id="hw-GPU" /></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-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-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" id="hw-ssd2-group"><label for="hw-SSD2">${ASSET_SCHEMA.STORAGE2.ui}</label><input type="text" id="hw-SSD2" /></div>
|
||||||
|
<div class="form-group" id="hw-ssd3-group"><label for="hw-SSD3">${ASSET_SCHEMA.STORAGE3.ui}</label><input type="text" id="hw-SSD3" /></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 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>
|
<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>
|
||||||
|
|
||||||
@@ -132,6 +137,7 @@ const HW_FORM_HTML = `
|
|||||||
<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.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.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"><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" id="hw-vendor-group"><label for="hw-납품업체">${ASSET_SCHEMA.VENDOR.ui}</label><input type="text" id="hw-납품업체" /></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 for="hw-비고">${ASSET_SCHEMA.REMARKS.ui}</label><textarea id="hw-비고" rows="2"></textarea></div>
|
||||||
<div class="form-group full-width">
|
<div class="form-group full-width">
|
||||||
<label>${ASSET_SCHEMA.DOC_NAME.ui} (파일 증빙)</label>
|
<label>${ASSET_SCHEMA.DOC_NAME.ui} (파일 증빙)</label>
|
||||||
@@ -170,10 +176,13 @@ function applyTypeSpecificUI(type: string) {
|
|||||||
os: document.getElementById('hw-os-group'),
|
os: document.getElementById('hw-os-group'),
|
||||||
cpu: document.getElementById('hw-cpu-group'),
|
cpu: document.getElementById('hw-cpu-group'),
|
||||||
ram: document.getElementById('hw-ram-group'),
|
ram: document.getElementById('hw-ram-group'),
|
||||||
|
gpu: document.getElementById('hw-gpu-group'),
|
||||||
ssd1: document.getElementById('hw-ssd1-group'),
|
ssd1: document.getElementById('hw-ssd1-group'),
|
||||||
ssd2: document.getElementById('hw-ssd2-group'),
|
ssd2: document.getElementById('hw-ssd2-group'),
|
||||||
|
ssd3: document.getElementById('hw-ssd3-group'),
|
||||||
hwSpec: document.getElementById('hw-hwspec-group'),
|
hwSpec: document.getElementById('hw-hwspec-group'),
|
||||||
monitoring: document.getElementById('hw-monitoring-group'),
|
monitoring: document.getElementById('hw-monitoring-group'),
|
||||||
|
vendor: document.getElementById('hw-vendor-group'),
|
||||||
user: document.querySelector('.pc-only') as HTMLElement
|
user: document.querySelector('.pc-only') as HTMLElement
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -224,16 +233,16 @@ function applyTypeSpecificUI(type: string) {
|
|||||||
if (upperType === '노트북') {
|
if (upperType === '노트북') {
|
||||||
if (groups.detailPurpose) groups.detailPurpose.style.display = 'none';
|
if (groups.detailPurpose) groups.detailPurpose.style.display = 'none';
|
||||||
nonServer.forEach(el => (el as HTMLElement).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'; });
|
['model', 'os', 'cpu', 'gpu', 'ram', 'ssd1', 'ssd2', 'ssd3', 'hwSpec', 'vendor'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; });
|
||||||
} else {
|
} else {
|
||||||
if (groups.detailPurpose) groups.detailPurpose.style.display = 'flex';
|
if (groups.detailPurpose) groups.detailPurpose.style.display = 'flex';
|
||||||
if (detailPurpose === '서버') {
|
if (detailPurpose === '서버') {
|
||||||
serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex');
|
serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex');
|
||||||
if (groups.networkTitle) groups.networkTitle.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'; });
|
['model', 'os', 'cpu', 'gpu', 'ram', 'ssd1', 'ssd2', 'ssd3', 'monitoring', 'vendor'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; });
|
||||||
} else {
|
} else {
|
||||||
nonServer.forEach(el => (el as HTMLElement).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'; });
|
['model', 'os', 'cpu', 'gpu', 'ram', 'ssd1', 'ssd2', 'ssd3', 'hwSpec', 'vendor'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +250,7 @@ function applyTypeSpecificUI(type: string) {
|
|||||||
serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex');
|
serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex');
|
||||||
if (groups.networkTitle) groups.networkTitle.style.display = 'flex';
|
if (groups.networkTitle) groups.networkTitle.style.display = 'flex';
|
||||||
if (groups.specTitle) groups.specTitle.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', 'gpu', 'ram', 'ssd1', 'ssd2', 'ssd3', 'monitoring', 'vendor'].forEach(k => { if (groups[k]) groups[k]!.style.display = 'flex'; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,12 +210,22 @@ async function confirmUpload() {
|
|||||||
else if (tab === '도메인') endpoint = `${API_BASE}/api/ops/domain/batch`;
|
else if (tab === '도메인') endpoint = `${API_BASE}/api/ops/domain/batch`;
|
||||||
|
|
||||||
if (endpoint) {
|
if (endpoint) {
|
||||||
const response = await fetch(endpoint, {
|
try {
|
||||||
method: 'POST',
|
const response = await fetch(endpoint, {
|
||||||
headers: { 'Content-Type': 'application/json' },
|
method: 'POST',
|
||||||
body: JSON.stringify(data)
|
headers: { 'Content-Type': 'application/json' },
|
||||||
});
|
body: JSON.stringify(data)
|
||||||
if (response.ok) successCount++;
|
});
|
||||||
|
if (response.ok) {
|
||||||
|
successCount++;
|
||||||
|
} else {
|
||||||
|
const errRes = await response.json();
|
||||||
|
throw new Error(`[${tab}] ${errRes.error || '저장 실패'}`);
|
||||||
|
}
|
||||||
|
} catch (e: any) {
|
||||||
|
alert(`카테고리 '${tab}' 저장 중 오류: ${e.message}`);
|
||||||
|
throw e; // Stop processing further tabs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,7 +238,7 @@ async function confirmUpload() {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
alert('업로드 중 오류가 발생했습니다.');
|
// 상세 에러는 내부 catch에서 이미 alert으로 띄움
|
||||||
} finally {
|
} finally {
|
||||||
if (confirmBtn) {
|
if (confirmBtn) {
|
||||||
confirmBtn.disabled = false;
|
confirmBtn.disabled = false;
|
||||||
@@ -274,7 +284,7 @@ async function generateBulkCodes() {
|
|||||||
for (const prefix in groups) {
|
for (const prefix in groups) {
|
||||||
const rows = groups[prefix];
|
const rows = groups[prefix];
|
||||||
// Fetch current next code for this prefix
|
// Fetch current next code for this prefix
|
||||||
const res = await fetch(`http://172.16.40.100:3000/api/generate-asset-code?prefix=${prefix}`);
|
const res = await fetch(`http://${location.hostname}:3000/api/generate-asset-code?prefix=${prefix}`);
|
||||||
const result = await res.json();
|
const result = await res.json();
|
||||||
if (result.nextCode) {
|
if (result.nextCode) {
|
||||||
let baseNum = parseInt(result.nextCode.replace(prefix, ''));
|
let baseNum = parseInt(result.nextCode.replace(prefix, ''));
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ export interface MasterAssetData {
|
|||||||
logs: HardwareLog[];
|
logs: HardwareLog[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const PC_HEADERS = ['법인', '자산코드', '사용자', '위치', '모델명', '메인보드', 'CPU', 'GPU', 'RAM', 'SSD1', 'SSD2', 'HDD1', 'HDD2', 'IP주소', 'HW사양', '구매연월', '금액', '납품업체', '품의서명', '비고'];
|
const PC_HEADERS = ['법인', '자산코드', '구매연월', '사용자', '현사용조직', '이전사용조직', '위치', '담당자(정)', '담당자(부)', '모델명', 'OS', 'CPU', 'GPU', 'RAM', 'SSD1', 'SSD2', 'SSD3', '메인보드', 'IP주소', '금액', '납품업체', '품의서명', '비고'];
|
||||||
const SERVER_HEADERS = ['법인', '자산코드', '구매연월', '유형', '용도', '상세내용', '현사용조직', '이전사용조직', '위치', '담당자(정)', '담당자(부)', 'IP 주소 1', 'IP 주소 2', '원격도구', '서버 ID', '서버 PW', '모델명', 'OS', 'CPU', 'RAM', 'GPU', 'Storage 1', 'Storage 2', 'Storage 3', '모니터링', '비고'];
|
const SERVER_HEADERS = ['법인', '자산코드', '구매연월', '유형', '용도', '상세내용', '현사용조직', '이전사용조직', '위치', '담당자(정)', '담당자(부)', 'IP 주소 1', 'IP 주소 2', '원격도구', '서버 ID', '서버 PW', '모델명', 'OS', 'CPU', 'RAM', 'GPU', 'Storage 1', 'Storage 2', 'Storage 3', '모니터링', '금액', '납품업체', '품의서명', '비고'];
|
||||||
const STORAGE_HEADERS = ['법인', '유형', '자산코드', '명칭', '위치', '모델명', '용량', '담당자(정)', '담당자(부)', 'IP주소', 'MAC주소', '구매연월', '금액', '납품업체', '품의서명', '비고'];
|
const STORAGE_HEADERS = ['법인', '유형', '자산코드', '명칭', '위치', '모델명', '용량', '담당자(정)', '담당자(부)', 'IP주소', 'MAC주소', '구매연월', '금액', '납품업체', '품의서명', '비고'];
|
||||||
const EQUIP_HEADERS = ['법인', '비품유형', '자산코드', '명칭', '위치', '관리자', 'IP주소', 'MACaddress', 'HW사양', 'OS', '구매연월', '금액', '납품업체', '품의서명', '비고'];
|
const EQUIP_HEADERS = ['법인', '비품유형', '자산코드', '명칭', '위치', '관리자', 'IP주소', 'MACaddress', 'HW사양', 'OS', '구매연월', '금액', '납품업체', '품의서명', '비고'];
|
||||||
const MOBILE_HEADERS = ['법인', '자산코드', '명칭', '위치', '관리자', '기기유형', 'OS', '구매연월', '금액', '납품업체', '품의서명', '비고'];
|
const MOBILE_HEADERS = ['법인', '자산코드', '명칭', '위치', '관리자', '기기유형', 'OS', '구매연월', '금액', '납품업체', '품의서명', '비고'];
|
||||||
@@ -98,9 +98,19 @@ export function downloadTemplate() {
|
|||||||
{ name: '도메인', headers: DOMAIN_HEADERS }
|
{ name: '도메인', headers: DOMAIN_HEADERS }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const sampleData: Record<string, any[]> = {
|
||||||
|
'개인PC': ['(주)에이치엠', 'PC-24001', '202401', '홍길동', '기술팀', '-', '서울본사 7층', '김관리', '이부관', 'LG Gram 16', 'Windows 11', 'i7-1360P', 'RTX 3050', '16GB', '512GB', '-', '-', 'LG Mainboard', '192.168.0.10', '1500000', 'LG전자', '2024_상반기_PC구매.pdf', '신규 입사자 지급용'],
|
||||||
|
'서버': ['(주)에이치엠', 'SRV-24001', '202401', '물리', '웹서버', '운영 웹 서버', '인프라팀', '-', 'IDC 센터 1-A', '박서버', '최백업', '10.0.0.1', '10.0.0.2', 'RDP', 'admin', '********', 'Dell PowerEdge R750', 'Ubuntu 22.04', 'Xeon Gold 6330', '128GB', '-', '1TB SSD', '1TB SSD', '2TB HDD', 'Zabbix', '8500000', '델테크놀로지스', '2024_IDC_확장품의.pdf', '운영 환경 전용'],
|
||||||
|
'도메인': ['도메인', '(주)에이치엠', '대표홈페이지', 'hm-corp.com', '2024-01-01', '2025-01-01', '55000', '홍길동', '이부관', '가비아 자동갱신']
|
||||||
|
};
|
||||||
|
|
||||||
tabConfigs.forEach(config => {
|
tabConfigs.forEach(config => {
|
||||||
const ws = XLSX.utils.aoa_to_sheet([config.headers]);
|
const data = [config.headers];
|
||||||
ws['!cols'] = Array(config.headers.length).fill({ wch: 18 });
|
if (sampleData[config.name]) {
|
||||||
|
data.push(sampleData[config.name]);
|
||||||
|
}
|
||||||
|
const ws = XLSX.utils.aoa_to_sheet(data);
|
||||||
|
ws['!cols'] = Array(config.headers.length).fill({ wch: 20 });
|
||||||
XLSX.utils.book_append_sheet(wb, ws, config.name);
|
XLSX.utils.book_append_sheet(wb, ws, config.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -110,11 +120,11 @@ export function downloadTemplate() {
|
|||||||
export function exportToExcel(masterData: MasterAssetData) {
|
export function exportToExcel(masterData: MasterAssetData) {
|
||||||
const wb = XLSX.utils.book_new();
|
const wb = XLSX.utils.book_new();
|
||||||
const exportMap = [
|
const exportMap = [
|
||||||
{ tab: '개인PC', list: masterData.pc, headers: PC_HEADERS, map: (a: any) => [a.법인, a.자산코드, a.사용자, a.위치, a.모델명, a.메인보드, a.CPU, a.GPU, a.RAM, a.SSD1, a.SSD2, a.HDD1, a.HDD2, a.IP주소, a.HW사양, a.구매연월, a.금액, a.납품업체, a.품의서명, a.비고] },
|
{ tab: '개인PC', list: masterData.pc, headers: PC_HEADERS, map: (a: any) => [a.법인, a.자산코드, a.구매연월, a.사용자, a.현사용조직, a.이전사용조직, a.위치, a.담당자_정, a.담당자_부, a.모델명, a.OS, a.CPU, a.GPU, a.RAM, a.SSD1, a.SSD2, a.SSD3, a.메인보드, a.IP주소, a.금액, a.납품업체, a.품의서명, a.비고] },
|
||||||
{ tab: '서버', list: masterData.server, headers: SERVER_HEADERS, map: (a: any) => [a.법인, a.자산코드, a.구매연월, a.storage유형, a.용도, a.상세, a.현사용조직, a.이전사용조직, a.위치, a.담당자_정, a.담당자_부, a.IP주소, a.IP2, a.원격접속, a.서버ID, a.서버PW, a.모델명, a.OS, a.CPU, a.RAM, a.GPU, a.SSD1, a.SSD2, a.HDD1, a.모니터링, a.비고] },
|
{ tab: '서버', list: masterData.server, headers: SERVER_HEADERS, map: (a: any) => [a.법인, a.자산코드, a.구매연월, a.type, a.상세용도, a.상세, a.현사용조직, a.이전사용조직, a.위치, a.담당자_정, a.담당자_부, a.IP주소, a.IP2, a.원격접속, a.서버ID, a.서버PW, a.모델명, a.OS, a.CPU, a.RAM, a.GPU, a.SSD1, a.SSD2, a.SSD3, a.모니터링, a.금액, a.납품업체, a.품의서명, a.비고] },
|
||||||
{ tab: '스토리지', list: masterData.storage, headers: STORAGE_HEADERS, map: (a: any) => [a.법인, a.storage유형, a.자산코드, a.명칭, a.위치, a.모델명, a.용량, a.담당자_정, a.담당자_부, a.IP주소, a.MACaddress, a.구매연월, a.금액, a.납품업체, a.품의서명, a.비고] },
|
{ tab: '스토리지', list: masterData.storage, headers: STORAGE_HEADERS, map: (a: any) => [a.법인, a.상세용도, a.자산코드, a.명칭, a.위치, a.모델명, a.용량, a.담당자_정, a.담당자_부, a.IP주소, a.MACaddress, a.구매연월, a.금액, a.납품업체, a.품의서명, a.비고] },
|
||||||
{ tab: '전산비품', list: masterData.equip, headers: EQUIP_HEADERS, map: (a: any) => [a.법인, a.비품유형, a.자산코드, a.명칭, a.위치, a.관리자, a.IP주소, a.MACaddress, a.HW사양, a.OS, a.구매연월, a.금액, a.납품업체, a.품의서명, a.비고] },
|
{ tab: '전산비품', list: masterData.equip, headers: EQUIP_HEADERS, map: (a: any) => [a.법인, a.상세용도, a.자산코드, a.명칭, a.위치, a.관리자, a.IP주소, a.MACaddress, a.HW사양, a.OS, a.구매연월, a.금액, a.납품업체, a.품의서명, a.비고] },
|
||||||
{ tab: '모바일기기', list: masterData.mobile, headers: MOBILE_HEADERS, map: (a: any) => [a.법인, a.자산코드, a.명칭, a.위치, a.관리자, a.type, a.OS, a.구매연월, a.금액, a.납품업체, a.품의서명, a.비고] },
|
{ tab: '모바일기기', list: masterData.mobile, headers: MOBILE_HEADERS, map: (a: any) => [a.법인, a.자산코드, a.명칭, a.위치, a.관리자, a.상세용도, a.OS, a.구매연월, a.금액, a.납품업체, a.품의서명, a.비고] },
|
||||||
{ tab: '구독SW', list: masterData.subSw, headers: SUB_SW_HEADERS, map: (a: any) => [a.분야, a.법인, a.제품명, a.부서, a.수량, a.금액, a.구매일, a.납품업체, a.시작일, a.만료일, a.라이선스유형, a.계정명, a.비고] },
|
{ tab: '구독SW', list: masterData.subSw, headers: SUB_SW_HEADERS, map: (a: any) => [a.분야, a.법인, a.제품명, a.부서, a.수량, a.금액, a.구매일, a.납품업체, a.시작일, a.만료일, a.라이선스유형, a.계정명, a.비고] },
|
||||||
{ tab: '영구SW', list: masterData.permSw, headers: PERM_SW_HEADERS, map: (a: any) => [a.분야, a.법인, a.제품명, a.부서, a.수량, a.금액, a.구매일, a.납품업체, a.시작일, a.만료일, a.라이선스키, a.계정명, a.비고] },
|
{ tab: '영구SW', list: masterData.permSw, headers: PERM_SW_HEADERS, map: (a: any) => [a.분야, a.법인, a.제품명, a.부서, a.수량, a.금액, a.구매일, a.납품업체, a.시작일, a.만료일, a.라이선스키, a.계정명, a.비고] },
|
||||||
{ tab: '클라우드', list: masterData.cloud, headers: CLOUD_HEADERS, map: (a: any) => [a.플랫폼명, a.법인, a.제품명, a.부서, a.계정명, a.결제수단, a.결제일, a.연결카드번호, a.당월청구액, a.비고] },
|
{ tab: '클라우드', list: masterData.cloud, headers: CLOUD_HEADERS, map: (a: any) => [a.플랫폼명, a.법인, a.제품명, a.부서, a.계정명, a.결제수단, a.결제일, a.연결카드번호, a.당월청구액, a.비고] },
|
||||||
@@ -131,7 +141,7 @@ export function exportToExcel(masterData: MasterAssetData) {
|
|||||||
/**
|
/**
|
||||||
* 엑셀 날짜 데이터(숫자 또는 문자열)를 YYYY-MM-DD 형식의 문자열로 변환
|
* 엑셀 날짜 데이터(숫자 또는 문자열)를 YYYY-MM-DD 형식의 문자열로 변환
|
||||||
*/
|
*/
|
||||||
function formatExcelDate(val: any): string {
|
export function formatExcelDate(val: any): string {
|
||||||
if (!val) return '';
|
if (!val) return '';
|
||||||
if (typeof val === 'number') {
|
if (typeof val === 'number') {
|
||||||
// 엑셀 날짜 숫자 (1899-12-30 기준 일수)
|
// 엑셀 날짜 숫자 (1899-12-30 기준 일수)
|
||||||
@@ -142,7 +152,7 @@ function formatExcelDate(val: any): string {
|
|||||||
if (typeof val === 'string') {
|
if (typeof val === 'string') {
|
||||||
return val.replace(/\./g, '-').trim();
|
return val.replace(/\./g, '-').trim();
|
||||||
}
|
}
|
||||||
return String(val);
|
return val ? String(val) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function parseExcel(file: File): Promise<any> {
|
export async function parseExcel(file: File): Promise<any> {
|
||||||
@@ -150,25 +160,36 @@ export async function parseExcel(file: File): Promise<any> {
|
|||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
try {
|
try {
|
||||||
const workbook = XLSX.read(e.target?.result, { type: 'binary' });
|
const workbook = XLSX.read(e.target?.result, { type: 'array' });
|
||||||
const parsedData: any = {};
|
const parsedData: any = {};
|
||||||
|
|
||||||
workbook.SheetNames.forEach(sheetName => {
|
workbook.SheetNames.forEach(rawSheetName => {
|
||||||
const rows = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]) as any[];
|
const sheetName = rawSheetName.trim();
|
||||||
|
const ws = workbook.Sheets[rawSheetName];
|
||||||
|
const rows = XLSX.utils.sheet_to_json(ws, { defval: "" }) as any[];
|
||||||
const list: any[] = [];
|
const list: any[] = [];
|
||||||
|
|
||||||
rows.forEach(r => {
|
rows.forEach(rawR => {
|
||||||
|
// 헤더명에 공백이 포함된 경우 대비하여 키 정리 (trim)
|
||||||
|
const r: any = {};
|
||||||
|
Object.keys(rawR).forEach(k => { r[k.trim()] = rawR[k]; });
|
||||||
|
|
||||||
const common = { id: Math.random().toString(36).substring(2, 9) };
|
const common = { id: Math.random().toString(36).substring(2, 9) };
|
||||||
if (sheetName === '개인PC') {
|
if (sheetName === '개인PC') {
|
||||||
list.push({ ...common, type: '개인PC', 법인: r['법인']||'', 자산코드: r['자산코드']||'', 사용자: r['사용자']||'', 위치: r['위치']||'', 모델명: r['모델명']||'', 메인보드: r['메인보드']||'', CPU: r['CPU']||'', GPU: r['GPU']||'', RAM: r['RAM']||'', SSD1: r['SSD1']||'', SSD2: r['SSD2']||'', HDD1: r['HDD1']||'', HDD2: r['HDD2']||'', IP주소: r['IP주소']||'', HW사양: r['HW사양']||'', 구매연월: formatExcelDate(r['구매연월']), 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'' });
|
const purchaseYM = formatExcelDate(r['구매연월']).replace(/-/g, '').substring(0, 6);
|
||||||
|
list.push({ ...common, type: '개인PC', 법인: r['법인']||'', 자산코드: r['자산코드']||'', 구매연월: purchaseYM, 사용자: r['사용자']||'', 현사용조직: r['현사용조직']||'', 이전사용조직: r['이전사용조직']||'', 위치: r['위치']||'', 담당자_정: r['담당자(정)']||'', 담당자_부: r['담당자(부)']||'', 모델명: r['모델명']||'', OS: r['OS']||'', CPU: r['CPU']||'', GPU: r['GPU']||'', RAM: r['RAM']||'', SSD1: r['SSD1']||'', SSD2: r['SSD2']||'', SSD3: r['SSD3']||'', 메인보드: r['메인보드']||'', IP주소: r['IP주소']||'', 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'' });
|
||||||
} else if (sheetName === '서버') {
|
} else if (sheetName === '서버') {
|
||||||
list.push({ ...common, type: '서버', 법인: r['법인']||'', 자산코드: r['자산코드']||'', 구매연월: formatExcelDate(r['구매연월']), storage유형: r['유형']||'물리', 용도: r['용도']||'', 상세: r['상세내용']||'', 현사용조직: r['현사용조직']||'', 이전사용조직: r['이전사용조직']||'', 위치: r['위치']||'', 담당자_정: r['담당자(정)']||'', 담당자_부: r['담당자(부)']||'', IP주소: r['IP 주소 1']||'', IP2: r['IP 주소 2']||'', 원격접속: r['원격도구']||'', 서버ID: r['서버 ID']||'', 서버PW: r['서버 PW']||'', 모델명: r['모델명']||'', OS: r['OS']||'', CPU: r['CPU']||'', RAM: r['RAM']||'', GPU: r['GPU']||'', SSD1: r['Storage 1']||'', SSD2: r['Storage 2']||'', HDD1: r['Storage 3']||'', 모니터링: r['모니터링']||'', 비고: r['비고']||'' });
|
const purchaseYM = formatExcelDate(r['구매연월']).replace(/-/g, '').substring(0, 6);
|
||||||
|
list.push({ ...common, type: '서버', 법인: r['법인']||'', 자산코드: r['자산코드']||'', 구매연월: purchaseYM, 상세용도: r['용도']||'', 상세: r['상세내용']||'', 현사용조직: r['현사용조직']||'', 이전사용조직: r['이전사용조직']||'', 위치: r['위치']||'', 담당자_정: r['담당자(정)']||'', 담당자_부: r['담당자(부)']||'', IP주소: r['IP 주소 1']||'', IP2: r['IP 주소 2']||'', 원격접속: r['원격도구']||'', 서버ID: r['서버 ID']||'', 서버PW: r['서버 PW']||'', 모델명: r['모델명']||'', OS: r['OS']||'', CPU: r['CPU']||'', RAM: r['RAM']||'', GPU: r['GPU']||'', SSD1: r['Storage 1']||'', SSD2: r['Storage 2']||'', SSD3: r['Storage 3']||'', 모니터링: r['모니터링']||'', 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'', type2: r['유형']||'물리' });
|
||||||
} else if (sheetName === '스토리지') {
|
} else if (sheetName === '스토리지') {
|
||||||
list.push({ ...common, type: '스토리지', 법인: r['법인']||'', storage유형: r['유형']||'', 자산코드: r['자산코드']||'', 명칭: r['명칭']||'', 위치: r['위치']||'', 모델명: r['모델명']||'', 용량: r['용량']||'', 담당자_정: r['담당자(정)']||'', 담당자_부: r['담당자(부)']||'', IP주소: r['IP주소']||'', MACaddress: r['MAC주소']||'', 구매연월: formatExcelDate(r['구매연월']), 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'' });
|
const purchaseYM = formatExcelDate(r['구매연월']).replace(/-/g, '').substring(0, 6);
|
||||||
|
list.push({ ...common, type: '스토리지', 법인: r['법인']||'', storage유형: r['유형']||'', 자산코드: r['자산코드']||'', 명칭: r['명칭']||'', 위치: r['위치']||'', 모델명: r['모델명']||'', 용량: r['용량']||'', 담당자_정: r['담당자(정)']||'', 담당자_부: r['담당자(부)']||'', IP주소: r['IP주소']||'', MACaddress: r['MAC주소']||'', 구매연월: purchaseYM, 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'' });
|
||||||
} else if (sheetName === '전산비품') {
|
} else if (sheetName === '전산비품') {
|
||||||
list.push({ ...common, type: '전산비품', 법인: r['법인']||'', 비품유형: r['비품유형']||'', 자산코드: r['자산코드']||'', 명칭: r['명칭']||'', 위치: r['위치']||'', 관리자: r['관리자']||'', IP주소: r['IP주소']||'', MACaddress: r['MACaddress']||'', HW사양: r['HW사양']||'', OS: r['OS']||'', 구매연월: formatExcelDate(r['구매연월']), 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'' });
|
const purchaseYM = formatExcelDate(r['구매연월']).replace(/-/g, '').substring(0, 6);
|
||||||
|
list.push({ ...common, type: '전산비품', 법인: r['법인']||'', 비품유형: r['비품유형']||'', 자산코드: r['자산코드']||'', 명칭: r['명칭']||'', 위치: r['위치']||'', 관리자: r['관리자']||'', IP주소: r['IP주소']||'', MACaddress: r['MACaddress']||'', HW사양: r['HW사양']||'', OS: r['OS']||'', 구매연월: purchaseYM, 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'' });
|
||||||
} else if (sheetName === '모바일기기') {
|
} else if (sheetName === '모바일기기') {
|
||||||
list.push({ ...common, type: '모바일기기', 법인: r['법인']||'', 자산코드: r['자산코드']||'', 명칭: r['명칭']||'', 위치: r['위치']||'', 관리자: r['관리자']||'', 기기유형: r['기기유형']||'', OS: r['OS']||'', 구매연월: formatExcelDate(r['구매연월']), 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'' });
|
const purchaseYM = formatExcelDate(r['구매연월']).replace(/-/g, '').substring(0, 6);
|
||||||
|
list.push({ ...common, type: '모바일기기', 법인: r['법인']||'', 자산코드: r['자산코드']||'', 명칭: r['명칭']||'', 위치: r['위치']||'', 관리자: r['관리자']||'', 기기유형: r['기기유형']||'', OS: r['OS']||'', 구매연월: purchaseYM, 금액: r['금액']||'', 납품업체: r['납품업체']||'', 품의서명: r['품의서명']||'', 비고: r['비고']||'' });
|
||||||
} else if (sheetName === '구독SW') {
|
} else if (sheetName === '구독SW') {
|
||||||
list.push({ ...common, type: '구독SW', 분야: r['분야']||'', 법인: r['법인']||'', 부서: r['부서']||'', 제품명: r['제품명']||'', 구매일: formatExcelDate(r['구매일']), 시작일: formatExcelDate(r['시작일']), 만료일: formatExcelDate(r['만료일']), 라이선스유형: r['라이선스유형']||'', 금액: r['금액']||'', 수량: parseInt(r['수량']||'1'), 계정명: r['계정명']||'', 납품업체: r['납품업체']||'', 비고: r['비고']||'' });
|
list.push({ ...common, type: '구독SW', 분야: r['분야']||'', 법인: r['법인']||'', 부서: r['부서']||'', 제품명: r['제품명']||'', 구매일: formatExcelDate(r['구매일']), 시작일: formatExcelDate(r['시작일']), 만료일: formatExcelDate(r['만료일']), 라이선스유형: r['라이선스유형']||'', 금액: r['금액']||'', 수량: parseInt(r['수량']||'1'), 계정명: r['계정명']||'', 납품업체: r['납품업체']||'', 비고: r['비고']||'' });
|
||||||
} else if (sheetName === '영구SW') {
|
} else if (sheetName === '영구SW') {
|
||||||
@@ -184,6 +205,6 @@ export async function parseExcel(file: File): Promise<any> {
|
|||||||
resolve(parsedData);
|
resolve(parsedData);
|
||||||
} catch (err) { reject(err); }
|
} catch (err) { reject(err); }
|
||||||
};
|
};
|
||||||
reader.readAsBinaryString(file);
|
reader.readAsArrayBuffer(file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export const ASSET_SCHEMA = {
|
|||||||
VENDOR: { key: '납품업체', db: 'vendor', ui: '납품업체' },
|
VENDOR: { key: '납품업체', db: 'vendor', ui: '납품업체' },
|
||||||
DOC_NAME: { key: '품의서명', db: 'doc_name', ui: '품의서' },
|
DOC_NAME: { key: '품의서명', db: 'doc_name', ui: '품의서' },
|
||||||
REMARKS: { key: '비고', db: 'remarks', ui: '비고' },
|
REMARKS: { key: '비고', db: 'remarks', ui: '비고' },
|
||||||
|
DETAIL_PURPOSE: { key: '상세용도', db: 'detail_purpose', ui: '용도' },
|
||||||
|
|
||||||
// ─── 하드웨어 상세 (Hardware) ───
|
// ─── 하드웨어 상세 (Hardware) ───
|
||||||
USER: { key: '사용자', db: 'purpose', ui: '사용자' },
|
USER: { key: '사용자', db: 'purpose', ui: '사용자' },
|
||||||
@@ -35,6 +36,8 @@ export const ASSET_SCHEMA = {
|
|||||||
IP_ADDR: { key: 'IP주소', db: 'ip_address', ui: 'IP 주소 1' },
|
IP_ADDR: { key: 'IP주소', db: 'ip_address', ui: 'IP 주소 1' },
|
||||||
IP_ADDR2: { key: 'IP2', db: 'ip2', ui: 'IP 주소 2' },
|
IP_ADDR2: { key: 'IP2', db: 'ip2', ui: 'IP 주소 2' },
|
||||||
MAC_ADDR: { key: 'MACaddress', db: 'mac_address', ui: 'MAC 주소' },
|
MAC_ADDR: { key: 'MACaddress', db: 'mac_address', ui: 'MAC 주소' },
|
||||||
|
GPU: { key: 'GPU', db: 'gpu', ui: 'GPU' },
|
||||||
|
STORAGE3: { key: 'SSD3', db: 'storage3', ui: 'Storage 3' },
|
||||||
STATUS: { key: '현재상태', db: 'status', ui: '현재상태' },
|
STATUS: { key: '현재상태', db: 'status', ui: '현재상태' },
|
||||||
STORE_LOC: { key: '보관위치', db: 'storage_location',ui: '보관위치' },
|
STORE_LOC: { key: '보관위치', db: 'storage_location',ui: '보관위치' },
|
||||||
|
|
||||||
|
|||||||
@@ -174,6 +174,10 @@ function initApp() {
|
|||||||
createIcons({
|
createIcons({
|
||||||
icons: { Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History, RefreshCcw, BookOpen, Settings }
|
icons: { Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History, RefreshCcw, BookOpen, Settings }
|
||||||
});
|
});
|
||||||
|
window.addEventListener('refresh-view', () => {
|
||||||
|
console.log('🔄 Refreshing view due to event');
|
||||||
|
refreshView();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', initApp);
|
document.addEventListener('DOMContentLoaded', initApp);
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
import { state } from '../../core/state';
|
import { state } from '../../core/state';
|
||||||
import { formatPrice, dynamicSort } from '../../core/utils';
|
import { formatPrice, dynamicSort, createBadge } from '../../core/utils';
|
||||||
import { createIcons, Plus, Edit2, Trash2 } from 'lucide';
|
import { createIcons, Plus, Edit2, Trash2 } from 'lucide';
|
||||||
import { openDomainModal } from '../../components/Modal/DomainModal';
|
import { openDomainModal } from '../../components/Modal/DomainModal';
|
||||||
import { setupTableSorting, SortState } from '../../core/tableHandler';
|
import { setupTableSorting, SortState } from '../../core/tableHandler';
|
||||||
|
import { formatExcelDate } from '../../core/excelHandler';
|
||||||
|
|
||||||
|
// 정렬 상태를 모듈 수준에서 관리하여 화면 갱신 시에도 유지되도록 함
|
||||||
|
let persistentSortState: SortState = { key: '', direction: 'asc' };
|
||||||
|
|
||||||
export function renderDomainList(container: HTMLElement) {
|
export function renderDomainList(container: HTMLElement) {
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
|
|
||||||
let sortState: SortState = { key: '', direction: 'asc' };
|
|
||||||
const fullList = state.masterData.domain;
|
const fullList = state.masterData.domain;
|
||||||
|
|
||||||
const header = document.createElement('div');
|
const header = document.createElement('div');
|
||||||
@@ -30,12 +33,11 @@ export function renderDomainList(container: HTMLElement) {
|
|||||||
<th style="text-align:center;" data-sort="corp">법인</th>
|
<th style="text-align:center;" data-sort="corp">법인</th>
|
||||||
<th style="text-align:left;" data-sort="service_name">서비스명</th>
|
<th style="text-align:left;" data-sort="service_name">서비스명</th>
|
||||||
<th style="text-align:left;" data-sort="domain_name">관리도메인</th>
|
<th style="text-align:left;" data-sort="domain_name">관리도메인</th>
|
||||||
|
<th style="text-align:left;" data-sort="remarks">구매업체</th>
|
||||||
<th style="text-align:center;" data-sort="start_date">시작일</th>
|
<th style="text-align:center;" data-sort="start_date">시작일</th>
|
||||||
<th style="text-align:center;" data-sort="expiry_date">만료일</th>
|
<th style="text-align:center;" data-sort="expiry_date">만료일</th>
|
||||||
<th style="text-align:right;" data-sort="price">금액</th>
|
<th style="text-align:right;" data-sort="price">금액</th>
|
||||||
<th style="text-align:center;" data-sort="manager_main">담당자</th>
|
<th style="text-align:center;" data-sort="manager_main">담당자(정/부)</th>
|
||||||
<th style="text-align:center;" data-sort="manager_sub">담당자(부)</th>
|
|
||||||
<th style="text-align:left;">비고</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="dynamic-tbody"></tbody>
|
<tbody id="dynamic-tbody"></tbody>
|
||||||
@@ -48,13 +50,13 @@ export function renderDomainList(container: HTMLElement) {
|
|||||||
const updateTable = () => {
|
const updateTable = () => {
|
||||||
let filtered = [...fullList];
|
let filtered = [...fullList];
|
||||||
|
|
||||||
if (sortState.key) {
|
if (persistentSortState.key) {
|
||||||
filtered = dynamicSort(filtered, sortState.key, sortState.direction);
|
filtered = dynamicSort(filtered, persistentSortState.key, persistentSortState.direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
tbody.innerHTML = '';
|
tbody.innerHTML = '';
|
||||||
if (filtered.length === 0) {
|
if (filtered.length === 0) {
|
||||||
tbody.innerHTML = `<tr><td colspan="11" style="text-align:center; padding: 3rem; color: var(--text-muted);">등록된 도메인 정보가 없습니다.</td></tr>`;
|
tbody.innerHTML = `<tr><td colspan="10" style="text-align:center; padding: 3rem; color: var(--text-muted);">등록된 도메인 정보가 없습니다.</td></tr>`;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,25 +64,32 @@ export function renderDomainList(container: HTMLElement) {
|
|||||||
const tr = document.createElement('tr');
|
const tr = document.createElement('tr');
|
||||||
tr.className = 'domain-row';
|
tr.className = 'domain-row';
|
||||||
tr.style.cursor = 'pointer';
|
tr.style.cursor = 'pointer';
|
||||||
|
const managerHtml = [
|
||||||
|
item.manager_main ? `${createBadge('정', 'primary')} ${item.manager_main}` : '',
|
||||||
|
item.manager_sub ? `${createBadge('부', 'muted')} ${item.manager_sub}` : ''
|
||||||
|
].filter(v => v !== '').join(' / ');
|
||||||
|
|
||||||
tr.innerHTML = `
|
tr.innerHTML = `
|
||||||
<td style="text-align:center;">${idx + 1}</td>
|
<td style="text-align:center;">${idx + 1}</td>
|
||||||
<td style="text-align:center;"><span class="badge badge-${item.type}">${item.type}</span></td>
|
<td style="text-align:center;"><span class="badge badge-${item.type}">${item.type}</span></td>
|
||||||
<td style="text-align:center;">${item.corp || ''}</td>
|
<td style="text-align:center;">${item.corp || ''}</td>
|
||||||
<td>${item.service_name || ''}</td>
|
<td>${item.service_name || ''}</td>
|
||||||
<td>${item.domain_name || ''}</td>
|
<td>${item.domain_name || ''}</td>
|
||||||
<td style="text-align:center;">${item.start_date || ''}</td>
|
<td>${item.remarks || ''}</td>
|
||||||
<td style="text-align:center;">${item.expiry_date || ''}</td>
|
<td style="text-align:center;">${formatExcelDate(item.start_date)}</td>
|
||||||
|
<td style="text-align:center;">${formatExcelDate(item.expiry_date)}</td>
|
||||||
<td style="text-align:right;">${formatPrice(item.price)}</td>
|
<td style="text-align:right;">${formatPrice(item.price)}</td>
|
||||||
<td style="text-align:center;">${item.manager_main || ''}</td>
|
<td style="text-align:center;">${managerHtml || '-'}</td>
|
||||||
<td style="text-align:center;">${item.manager_sub || ''}</td>
|
|
||||||
<td class="text-truncate" style="max-width:200px;">${item.remarks || ''}</td>
|
|
||||||
`;
|
`;
|
||||||
tr.addEventListener('click', () => openDomainModal(item));
|
tr.addEventListener('click', (e) => {
|
||||||
|
console.log('Row clicked:', item.domain_name);
|
||||||
|
openDomainModal(item);
|
||||||
|
});
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
});
|
});
|
||||||
|
|
||||||
setupTableSorting(table, sortState, (key, dir) => {
|
setupTableSorting(table, persistentSortState, (key, dir) => {
|
||||||
sortState = { key, direction: dir };
|
persistentSortState = { key, direction: dir };
|
||||||
updateTable();
|
updateTable();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ export function renderPcList(container: HTMLElement) {
|
|||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.ORG.key}">${ASSET_SCHEMA.ORG.ui}</th>
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.ORG.key}">${ASSET_SCHEMA.ORG.ui}</th>
|
||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.ASSET_CODE.key}">${ASSET_SCHEMA.ASSET_CODE.ui}</th>
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.ASSET_CODE.key}">${ASSET_SCHEMA.ASSET_CODE.ui}</th>
|
||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.USER.key}">${ASSET_SCHEMA.USER.ui}</th>
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.USER.key}">${ASSET_SCHEMA.USER.ui}</th>
|
||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.LOCATION.key}">${ASSET_SCHEMA.LOCATION.ui}</th>
|
|
||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.MANAGER_MAIN.key}">담당자(정/부)</th>
|
|
||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.MAINBOARD.key}">${ASSET_SCHEMA.MAINBOARD.ui}</th>
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.MAINBOARD.key}">${ASSET_SCHEMA.MAINBOARD.ui}</th>
|
||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.CPU.key}">${ASSET_SCHEMA.CPU.ui}</th>
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.CPU.key}">${ASSET_SCHEMA.CPU.ui}</th>
|
||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.RAM.key}">${ASSET_SCHEMA.RAM.ui}</th>
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.RAM.key}">${ASSET_SCHEMA.RAM.ui}</th>
|
||||||
@@ -53,6 +51,7 @@ export function renderPcList(container: HTMLElement) {
|
|||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.PURCHASE_YM.key}">${ASSET_SCHEMA.PURCHASE_YM.ui}</th>
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.PURCHASE_YM.key}">${ASSET_SCHEMA.PURCHASE_YM.ui}</th>
|
||||||
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.PRICE.key}">${ASSET_SCHEMA.PRICE.ui}</th>
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.PRICE.key}">${ASSET_SCHEMA.PRICE.ui}</th>
|
||||||
<th style="text-align:center;">${ASSET_SCHEMA.DOC_NAME.ui}</th>
|
<th style="text-align:center;">${ASSET_SCHEMA.DOC_NAME.ui}</th>
|
||||||
|
<th style="text-align:center;" data-sort="${ASSET_SCHEMA.MANAGER_MAIN.key}">담당자(정/부)</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="dynamic-tbody"></tbody>
|
<tbody id="dynamic-tbody"></tbody>
|
||||||
@@ -85,7 +84,7 @@ export function renderPcList(container: HTMLElement) {
|
|||||||
|
|
||||||
tbody.innerHTML = '';
|
tbody.innerHTML = '';
|
||||||
if (filtered.length === 0) {
|
if (filtered.length === 0) {
|
||||||
tbody.innerHTML = `<tr><td colspan="14" style="text-align:center; padding: 3rem; color: var(--text-muted);">${UI_TEXT.MESSAGES.NO_DATA}</td></tr>`;
|
tbody.innerHTML = `<tr><td colspan="13" style="text-align:center; padding: 3rem; color: var(--text-muted);">${UI_TEXT.MESSAGES.NO_DATA}</td></tr>`;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,8 +107,6 @@ export function renderPcList(container: HTMLElement) {
|
|||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.ORG.key]||'-'}</td>
|
<td style="text-align:center;">${asset[ASSET_SCHEMA.ORG.key]||'-'}</td>
|
||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.ASSET_CODE.key]}</td>
|
<td style="text-align:center;">${asset[ASSET_SCHEMA.ASSET_CODE.key]}</td>
|
||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.USER.key]||''}</td>
|
<td style="text-align:center;">${asset[ASSET_SCHEMA.USER.key]||''}</td>
|
||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.LOCATION.key]||''}</td>
|
|
||||||
<td style="text-align:center;">${managerHtml || '-'}</td>
|
|
||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.MAINBOARD.key]||'-'}</td>
|
<td style="text-align:center;">${asset[ASSET_SCHEMA.MAINBOARD.key]||'-'}</td>
|
||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.CPU.key]||''}</td>
|
<td style="text-align:center;">${asset[ASSET_SCHEMA.CPU.key]||''}</td>
|
||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.RAM.key]||''}</td>
|
<td style="text-align:center;">${asset[ASSET_SCHEMA.RAM.key]||''}</td>
|
||||||
@@ -117,6 +114,7 @@ export function renderPcList(container: HTMLElement) {
|
|||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.PURCHASE_YM.key] || ''}</td>
|
<td style="text-align:center;">${asset[ASSET_SCHEMA.PURCHASE_YM.key] || ''}</td>
|
||||||
<td style="text-align:right;">${Number(asset[ASSET_SCHEMA.PRICE.key]||0).toLocaleString()}</td>
|
<td style="text-align:right;">${Number(asset[ASSET_SCHEMA.PRICE.key]||0).toLocaleString()}</td>
|
||||||
<td style="text-align:center;">${asset[ASSET_SCHEMA.DOC_NAME.key] ? '<i data-lucide="paperclip" class="text-primary"></i>' : '-'}</td>
|
<td style="text-align:center;">${asset[ASSET_SCHEMA.DOC_NAME.key] ? '<i data-lucide="paperclip" class="text-primary"></i>' : '-'}</td>
|
||||||
|
<td style="text-align:center;">${managerHtml || '-'}</td>
|
||||||
`;
|
`;
|
||||||
tr.addEventListener('click', () => openHwModal(asset, 'view'));
|
tr.addEventListener('click', () => openHwModal(asset, 'view'));
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export function renderServerList(container: HTMLElement) {
|
|||||||
<th class="text-center" data-sort="${ASSET_SCHEMA.CORP.key}">${ASSET_SCHEMA.CORP.ui}</th>
|
<th class="text-center" data-sort="${ASSET_SCHEMA.CORP.key}">${ASSET_SCHEMA.CORP.ui}</th>
|
||||||
<th class="text-center" data-sort="${ASSET_SCHEMA.ORG.key}">${ASSET_SCHEMA.ORG.ui}</th>
|
<th class="text-center" data-sort="${ASSET_SCHEMA.ORG.key}">${ASSET_SCHEMA.ORG.ui}</th>
|
||||||
<th class="text-center" data-sort="${ASSET_SCHEMA.ASSET_CODE.key}">${ASSET_SCHEMA.ASSET_CODE.ui}</th>
|
<th class="text-center" data-sort="${ASSET_SCHEMA.ASSET_CODE.key}">${ASSET_SCHEMA.ASSET_CODE.ui}</th>
|
||||||
<th data-sort="용도">용도</th>
|
<th data-sort="${ASSET_SCHEMA.DETAIL_PURPOSE.key}">${ASSET_SCHEMA.DETAIL_PURPOSE.ui}</th>
|
||||||
<th data-sort="상세">상세</th>
|
<th data-sort="상세">상세</th>
|
||||||
<th class="text-center" data-sort="${ASSET_SCHEMA.LOCATION.key}">${ASSET_SCHEMA.LOCATION.ui}</th>
|
<th class="text-center" data-sort="${ASSET_SCHEMA.LOCATION.key}">${ASSET_SCHEMA.LOCATION.ui}</th>
|
||||||
<th class="text-center" data-sort="${ASSET_SCHEMA.MANAGER_MAIN.key}">담당자(정/부)</th>
|
<th class="text-center" data-sort="${ASSET_SCHEMA.MANAGER_MAIN.key}">담당자(정/부)</th>
|
||||||
@@ -106,7 +106,7 @@ export function renderServerList(container: HTMLElement) {
|
|||||||
<td class="text-center">${asset[ASSET_SCHEMA.CORP.key]}</td>
|
<td class="text-center">${asset[ASSET_SCHEMA.CORP.key]}</td>
|
||||||
<td class="text-center">${asset[ASSET_SCHEMA.ORG.key]||'-'}</td>
|
<td class="text-center">${asset[ASSET_SCHEMA.ORG.key]||'-'}</td>
|
||||||
<td class="text-center">${asset[ASSET_SCHEMA.ASSET_CODE.key]}</td>
|
<td class="text-center">${asset[ASSET_SCHEMA.ASSET_CODE.key]}</td>
|
||||||
<td>${formatInline(asset.용도)}</td>
|
<td>${formatInline(asset[ASSET_SCHEMA.DETAIL_PURPOSE.key])}</td>
|
||||||
<td>${formatInline(asset.상세)}</td>
|
<td>${formatInline(asset.상세)}</td>
|
||||||
<td class="text-center">${formatInline(asset[ASSET_SCHEMA.LOCATION.key])}</td>
|
<td class="text-center">${formatInline(asset[ASSET_SCHEMA.LOCATION.key])}</td>
|
||||||
<td class="text-center">${managerHtml || '-'}</td>
|
<td class="text-center">${managerHtml || '-'}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user