Compare commits
7 Commits
d94be9a494
...
3c28c664da
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c28c664da | |||
| c14eff8278 | |||
| c83fa1cc5a | |||
| 818beae0df | |||
| 3c98ce948a | |||
| 7860edd8d0 | |||
| 77563994e9 |
192
index.html
192
index.html
@@ -6,7 +6,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>ITAM 자산관리 ERP</title>
|
<title>ITAM 자산관리 ERP</title>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css" />
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css" />
|
||||||
<link rel="stylesheet" href="/src/style.css" />
|
<link rel="stylesheet" href="/src/styles/common.css" />
|
||||||
|
<link rel="stylesheet" href="/src/styles/modal.css" />
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2.0.0"></script>
|
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2.0.0"></script>
|
||||||
</head>
|
</head>
|
||||||
@@ -209,12 +210,14 @@
|
|||||||
|
|
||||||
<!-- PC Asset Modal -->
|
<!-- PC Asset Modal -->
|
||||||
<div id="pc-asset-modal" class="modal-overlay hidden">
|
<div id="pc-asset-modal" class="modal-overlay hidden">
|
||||||
<div class="modal-content" style="max-width: 600px; max-height: 90vh; display: flex; flex-direction: column;">
|
<div class="modal-content wide">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2 id="pc-modal-title">개인PC 상세 정보</h2>
|
<h2 id="pc-modal-title">개인PC 상세 정보</h2>
|
||||||
<button id="btn-close-pc-modal" class="btn-icon" aria-label="닫기"><i data-lucide="x"></i></button>
|
<button id="btn-close-pc-modal" class="btn-icon" aria-label="닫기"><i data-lucide="x"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" style="overflow-y: auto; flex: 1;">
|
<div class="modal-body">
|
||||||
|
<div class="modal-body-split">
|
||||||
|
<div class="modal-form-area">
|
||||||
<form id="pc-asset-form" class="grid-form">
|
<form id="pc-asset-form" class="grid-form">
|
||||||
<input type="hidden" id="pc-asset-id" />
|
<input type="hidden" id="pc-asset-id" />
|
||||||
<input type="hidden" id="pc-asset-type" value="개인PC" />
|
<input type="hidden" id="pc-asset-type" value="개인PC" />
|
||||||
@@ -224,26 +227,96 @@
|
|||||||
<option value="한맥">한맥 (HM)</option><option value="삼안">삼안 (SM)</option><option value="바론">바론 (BR)</option>
|
<option value="한맥">한맥 (HM)</option><option value="삼안">삼안 (SM)</option><option value="바론">바론 (BR)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group"><label for="pc-자산코드">자산코드</label><input type="text" id="pc-자산코드" required /></div>
|
|
||||||
<div class="form-group"><label for="pc-사용자">사용자</label><input type="text" id="pc-사용자" required /></div>
|
<div class="form-group">
|
||||||
<div class="form-group"><label for="pc-위치">위치</label><input type="text" id="pc-위치" /></div>
|
<label for="pc-자산코드">자산코드</label>
|
||||||
<div class="form-group"><label for="pc-CPU">CPU</label><input type="text" id="pc-CPU" /></div>
|
<input type="text" id="pc-자산코드" placeholder="ex) HM-PC-2018-001" required />
|
||||||
<div class="form-group"><label for="pc-GPU">GPU</label><input type="text" id="pc-GPU" /></div>
|
</div>
|
||||||
<div class="form-group"><label for="pc-RAM">RAM</label><input type="text" id="pc-RAM" /></div>
|
|
||||||
<div class="form-group"><label for="pc-SSD1">SSD1</label><input type="text" id="pc-SSD1" /></div>
|
<div class="form-group">
|
||||||
<div class="form-group"><label for="pc-SSD2">SSD2</label><input type="text" id="pc-SSD2" /></div>
|
<label for="pc-사용자">사용자</label>
|
||||||
<div class="form-group"><label for="pc-HDD1">HDD1</label><input type="text" id="pc-HDD1" /></div>
|
<input type="text" id="pc-사용자" required />
|
||||||
<div class="form-group"><label for="pc-HDD2">HDD2</label><input type="text" id="pc-HDD2" /></div>
|
</div>
|
||||||
<div class="form-group"><label for="pc-구매일">구매일</label><input type="text" id="pc-구매일" /></div>
|
|
||||||
<div class="form-group"><label for="pc-금액">금액</label><input type="text" id="pc-금액" oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')" /></div>
|
<div class="form-group">
|
||||||
<div class="form-group"><label for="pc-납품업체">납품업체</label><input type="text" id="pc-납품업체" /></div>
|
<label for="pc-위치">위치</label>
|
||||||
|
<input type="text" id="pc-위치" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-CPU">CPU</label>
|
||||||
|
<input type="text" id="pc-CPU" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-GPU">GPU</label>
|
||||||
|
<input type="text" id="pc-GPU" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-RAM">RAM</label>
|
||||||
|
<input type="text" id="pc-RAM" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-SSD1">SSD1</label>
|
||||||
|
<input type="text" id="pc-SSD1" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-SSD2">SSD2</label>
|
||||||
|
<input type="text" id="pc-SSD2" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-HDD1">HDD1</label>
|
||||||
|
<input type="text" id="pc-HDD1" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-HDD2">HDD2</label>
|
||||||
|
<input type="text" id="pc-HDD2" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-구매일">구매일</label>
|
||||||
|
<input type="text" id="pc-구매일" placeholder="ex) 2024-01-01" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-금액">금액</label>
|
||||||
|
<input type="text" id="pc-금액" placeholder="ex) 1,000,000" oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ',')" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pc-납품업체">납품업체</label>
|
||||||
|
<input type="text" id="pc-납품업체" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group full-width">
|
||||||
|
<label style="font-size:0.875rem;">품의서 (파일)</label>
|
||||||
|
<div style="display:flex; align-items:center; gap:0.5rem;">
|
||||||
|
<input type="file" id="pc-품의서" style="font-size:0.875rem;" />
|
||||||
|
<span id="pc-품의서명" style="font-size:0.75rem; color:var(--text-light)"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-history-area">
|
||||||
|
<div class="history-header">
|
||||||
|
<h3><i data-lucide="history" style="width:16px; height:16px;"></i> 수정 이력</h3>
|
||||||
|
</div>
|
||||||
|
<div id="pc-history-list" class="history-timeline">
|
||||||
|
<div class="empty-history">이력이 없습니다.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button id="btn-delete-pc-asset" class="btn btn-danger">삭제</button>
|
<button id="btn-delete-pc-asset" class="btn btn-outline btn-danger">삭제</button>
|
||||||
<div class="footer-actions">
|
<div class="footer-actions">
|
||||||
<button id="btn-cancel-pc-modal" class="btn btn-outline">닫기</button>
|
<button id="btn-cancel-pc-modal" class="btn btn-outline">취소</button>
|
||||||
<button id="btn-save-pc-asset" class="btn btn-primary">수정</button>
|
<button id="btn-save-pc-asset" class="btn btn-primary">저장</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -292,14 +365,79 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-body" style="overflow-y: auto; flex: 1;">
|
<div class="modal-body" style="overflow-y: auto; flex: 1;">
|
||||||
<form id="sw-asset-form" class="grid-form">
|
<form id="sw-asset-form" class="grid-form">
|
||||||
<input type="hidden" id="sw-asset-id" /><input type="hidden" id="sw-asset-type" />
|
<input type="hidden" id="sw-asset-id" />
|
||||||
<div class="form-group"><label for="sw-법인">법인</label><input type="text" id="sw-법인" required /></div>
|
<input type="hidden" id="sw-asset-type" />
|
||||||
<div class="form-group"><label for="sw-제품명">제품명</label><input type="text" id="sw-제품명" required /></div>
|
|
||||||
<div class="form-group"><label for="sw-구매일">구매일</label><input type="text" id="sw-구매일" /></div>
|
<div class="form-group">
|
||||||
<div class="form-group" id="sw-구독일-group"><label for="sw-구독일">구독일</label><input type="text" id="sw-구독일" /></div>
|
<label for="sw-분야">분야</label>
|
||||||
<div class="form-group"><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>
|
<select id="sw-분야" required style="width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 0.875rem;">
|
||||||
<div class="form-group"><label for="sw-수량">수량</label><input type="number" id="sw-수량" min="1" /></div>
|
<option value="업무공통">업무공통</option>
|
||||||
<div class="form-group"><label for="sw-비고">비고</label><input type="text" id="sw-비고" /></div>
|
<option value="개발S/W">개발S/W</option>
|
||||||
|
<option value="디자인">디자인</option>
|
||||||
|
<option value="설계S/W">설계S/W</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-법인">법인</label>
|
||||||
|
<select id="sw-법인" required style="width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 0.875rem;">
|
||||||
|
<option value="한맥">한맥 (HM)</option>
|
||||||
|
<option value="삼안">삼안 (SM)</option>
|
||||||
|
<option value="바론">바론 (BR)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-부서">부서</label>
|
||||||
|
<input type="text" id="sw-부서" placeholder="ex) 경영지원팀" required />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-제품명">제품명</label>
|
||||||
|
<input type="text" id="sw-제품명" required />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-구매일">구매일</label>
|
||||||
|
<input type="text" id="sw-구매일" placeholder="ex) 2024-01-01" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" id="sw-구독일-group">
|
||||||
|
<label for="sw-구독일">구독일(시작~끝)</label>
|
||||||
|
<input type="text" id="sw-구독일" placeholder="ex) 2024-01-01 ~ 2024-12-31" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" id="sw-유지보수-group" style="display:none;">
|
||||||
|
<label for="sw-유지보수여부">유지보수 여부</label>
|
||||||
|
<label style="display:flex; align-items:center; gap:0.5rem; height: 38px;">
|
||||||
|
<input type="checkbox" id="sw-유지보수여부" /> 대상 여부
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-금액">금액</label>
|
||||||
|
<input type="text" id="sw-금액" placeholder="ex) 1,000,000" oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-수량">수량 (보유량)</label>
|
||||||
|
<input type="number" id="sw-수량" min="1" value="1" style="width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 0.875rem;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-계정명">계정명</label>
|
||||||
|
<input type="text" id="sw-계정명" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-납품업체">납품업체</label>
|
||||||
|
<input type="text" id="sw-납품업체" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sw-비고">비고</label>
|
||||||
|
<input type="text" id="sw-비고" />
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { state } from '../../state';
|
import { state } from '../../state';
|
||||||
import { HardwareAsset } from '../../excelHandler';
|
import { HardwareAsset, HardwareLog } from '../../excelHandler';
|
||||||
import { openModal } from './BaseModal';
|
import { openModal } from './BaseModal';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 개인PC 모달 초기화 및 로직 제어
|
* 개인PC 모달 초기화 및 로직 제어
|
||||||
*/
|
*/
|
||||||
export function initPCModal(renderContent: () => void, closeModals: () => void) {
|
export function initPCModal(renderContent: () => void, closeModals: () => void) {
|
||||||
const pcModal = document.getElementById('pc-asset-modal') as HTMLDivElement;
|
|
||||||
const pcForm = document.getElementById('pc-asset-form') as HTMLFormElement;
|
const pcForm = document.getElementById('pc-asset-form') as HTMLFormElement;
|
||||||
const btnSavePc = document.getElementById('btn-save-pc-asset') as HTMLButtonElement;
|
const btnSavePc = document.getElementById('btn-save-pc-asset') as HTMLButtonElement;
|
||||||
const btnDeletePc = document.getElementById('btn-delete-pc-asset') as HTMLButtonElement;
|
const btnDeletePc = document.getElementById('btn-delete-pc-asset') as HTMLButtonElement;
|
||||||
@@ -48,7 +47,27 @@ export function initPCModal(renderContent: () => void, closeModals: () => void)
|
|||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
const idx = state.masterData.hw.findIndex(a => a.id === id);
|
const idx = state.masterData.hw.findIndex(a => a.id === id);
|
||||||
if(idx !== -1) state.masterData.hw[idx] = newAsset;
|
if(idx !== -1) {
|
||||||
|
const oldAsset = state.masterData.hw[idx];
|
||||||
|
const changes = getChangeDetails(oldAsset, newAsset);
|
||||||
|
|
||||||
|
if (changes) {
|
||||||
|
// 로그인 기능이 없으므로 '관리자'가 로그인한 것으로 가정
|
||||||
|
const modifier = '관리자';
|
||||||
|
|
||||||
|
const log: HardwareLog = {
|
||||||
|
id: Math.random().toString(36).substring(2, 9),
|
||||||
|
assetId: id,
|
||||||
|
date: new Date().toLocaleString(),
|
||||||
|
details: changes,
|
||||||
|
user: modifier
|
||||||
|
};
|
||||||
|
|
||||||
|
state.masterData.logs.push(log);
|
||||||
|
}
|
||||||
|
|
||||||
|
state.masterData.hw[idx] = newAsset;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
state.masterData.hw.push(newAsset);
|
state.masterData.hw.push(newAsset);
|
||||||
}
|
}
|
||||||
@@ -63,6 +82,7 @@ export function initPCModal(renderContent: () => void, closeModals: () => void)
|
|||||||
const id = (document.getElementById('pc-asset-id') as HTMLInputElement).value;
|
const id = (document.getElementById('pc-asset-id') as HTMLInputElement).value;
|
||||||
if (confirm('삭제하시겠습니까?')) {
|
if (confirm('삭제하시겠습니까?')) {
|
||||||
state.masterData.hw = state.masterData.hw.filter(a => a.id !== id);
|
state.masterData.hw = state.masterData.hw.filter(a => a.id !== id);
|
||||||
|
// 관련 로그도 삭제할지 여부는 정책에 따라 (여기서는 유지)
|
||||||
closeModals();
|
closeModals();
|
||||||
renderContent();
|
renderContent();
|
||||||
}
|
}
|
||||||
@@ -71,12 +91,11 @@ export function initPCModal(renderContent: () => void, closeModals: () => void)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 개인PC 상세 모달 열기
|
* 개인PC 상세 모달 열기
|
||||||
* @param asset 수정 시 자산 데이터, 신규 시 undefined
|
|
||||||
*/
|
*/
|
||||||
export function openPcModal(asset?: HardwareAsset) {
|
export function openPcModal(asset?: HardwareAsset) {
|
||||||
const pcModal = document.getElementById('pc-asset-modal') as HTMLDivElement;
|
|
||||||
const pcForm = document.getElementById('pc-asset-form') as HTMLFormElement;
|
const pcForm = document.getElementById('pc-asset-form') as HTMLFormElement;
|
||||||
const deleteBtn = document.getElementById('btn-delete-pc-asset')!;
|
const deleteBtn = document.getElementById('btn-delete-pc-asset')!;
|
||||||
|
const historyArea = document.querySelector('.modal-history-area') as HTMLElement;
|
||||||
|
|
||||||
openModal('pc-asset-modal');
|
openModal('pc-asset-modal');
|
||||||
pcForm.reset();
|
pcForm.reset();
|
||||||
@@ -84,6 +103,7 @@ export function openPcModal(asset?: HardwareAsset) {
|
|||||||
if (asset) {
|
if (asset) {
|
||||||
document.getElementById('pc-modal-title')!.textContent = '개인PC 상세 정보 수정';
|
document.getElementById('pc-modal-title')!.textContent = '개인PC 상세 정보 수정';
|
||||||
deleteBtn.style.display = 'block';
|
deleteBtn.style.display = 'block';
|
||||||
|
if (historyArea) historyArea.style.display = 'flex';
|
||||||
|
|
||||||
(document.getElementById('pc-asset-id') as HTMLInputElement).value = asset.id;
|
(document.getElementById('pc-asset-id') as HTMLInputElement).value = asset.id;
|
||||||
(document.getElementById('pc-법인') as HTMLSelectElement).value = asset.법인;
|
(document.getElementById('pc-법인') as HTMLSelectElement).value = asset.법인;
|
||||||
@@ -98,14 +118,78 @@ export function openPcModal(asset?: HardwareAsset) {
|
|||||||
(document.getElementById('pc-HDD1') as HTMLInputElement).value = asset.HDD1 || '';
|
(document.getElementById('pc-HDD1') as HTMLInputElement).value = asset.HDD1 || '';
|
||||||
(document.getElementById('pc-HDD2') as HTMLInputElement).value = asset.HDD2 || '';
|
(document.getElementById('pc-HDD2') as HTMLInputElement).value = asset.HDD2 || '';
|
||||||
(document.getElementById('pc-구매일') as HTMLInputElement).value = asset.구매일 || '';
|
(document.getElementById('pc-구매일') as HTMLInputElement).value = asset.구매일 || '';
|
||||||
(document.getElementById('pc-금액') as HTMLInputElement).value = asset.금액 ? Number(asset.금액.replace(/,/g, '')).toLocaleString() : '';
|
(document.getElementById('pc-금액') as HTMLInputElement).value = asset.금액 ? asset.금액.replace(/,/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ',') : '';
|
||||||
(document.getElementById('pc-납품업체') as HTMLInputElement).value = asset.납품업체 || '';
|
(document.getElementById('pc-납품업체') as HTMLInputElement).value = asset.납품업체 || '';
|
||||||
(document.getElementById('pc-품의서명') as HTMLElement).innerText = asset.품의서명 ? `📎${asset.품의서명}` : '';
|
(document.getElementById('pc-품의서명') as HTMLElement).innerText = asset.품의서명 ? `📎${asset.품의서명}` : '';
|
||||||
|
|
||||||
|
renderHistory(asset.id);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('pc-modal-title')!.textContent = '새 개인PC 자산 추가';
|
document.getElementById('pc-modal-title')!.textContent = '새 개인PC 자산 추가';
|
||||||
deleteBtn.style.display = 'none';
|
deleteBtn.style.display = 'none';
|
||||||
|
if (historyArea) historyArea.style.display = 'none'; // 신규 시 이력 숨김
|
||||||
|
|
||||||
(document.getElementById('pc-asset-id') as HTMLInputElement).value = '';
|
(document.getElementById('pc-asset-id') as HTMLInputElement).value = '';
|
||||||
(document.getElementById('pc-법인') as HTMLSelectElement).value = '한맥';
|
(document.getElementById('pc-법인') as HTMLSelectElement).value = '한맥';
|
||||||
(document.getElementById('pc-품의서명') as HTMLElement).innerText = '';
|
(document.getElementById('pc-품의서명') as HTMLElement).innerText = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 변경 사항 감지 및 문자열 생성
|
||||||
|
*/
|
||||||
|
function getChangeDetails(oldAsset: HardwareAsset, newAsset: HardwareAsset): string {
|
||||||
|
const changes: string[] = [];
|
||||||
|
const fields = [
|
||||||
|
{ key: '법인', label: '법인' },
|
||||||
|
{ key: '자산코드', label: '자산코드' },
|
||||||
|
{ key: '사용자', label: '사용자' },
|
||||||
|
{ key: '위치', label: '위치' },
|
||||||
|
{ key: 'CPU', label: 'CPU' },
|
||||||
|
{ key: 'GPU', label: 'GPU' },
|
||||||
|
{ key: 'RAM', label: 'RAM' },
|
||||||
|
{ key: 'SSD1', label: 'SSD1' },
|
||||||
|
{ key: 'SSD2', label: 'SSD2' },
|
||||||
|
{ key: 'HDD1', label: 'HDD1' },
|
||||||
|
{ key: 'HDD2', label: 'HDD2' },
|
||||||
|
{ key: '구매일', label: '구매일' },
|
||||||
|
{ key: '금액', label: '금액' },
|
||||||
|
{ key: '납품업체', label: '납품업체' },
|
||||||
|
{ key: '품의서명', label: '품의서' },
|
||||||
|
];
|
||||||
|
|
||||||
|
fields.forEach(field => {
|
||||||
|
const oldVal = (oldAsset as any)[field.key] || '';
|
||||||
|
const newVal = (newAsset as any)[field.key] || '';
|
||||||
|
|
||||||
|
if (oldVal !== newVal) {
|
||||||
|
changes.push(`${field.label}: ${oldVal || '없음'} → ${newVal || '없음'}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return changes.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 이력 리스트 렌더링
|
||||||
|
*/
|
||||||
|
function renderHistory(assetId: string) {
|
||||||
|
const historyList = document.getElementById('pc-history-list');
|
||||||
|
if (!historyList) return;
|
||||||
|
|
||||||
|
const logs = state.masterData.logs
|
||||||
|
.filter(l => l.assetId === assetId)
|
||||||
|
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
||||||
|
|
||||||
|
if (logs.length === 0) {
|
||||||
|
historyList.innerHTML = '<div class="empty-history">이력이 없습니다.</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
historyList.innerHTML = logs.map(log => `
|
||||||
|
<div class="history-item">
|
||||||
|
<div class="history-date">${log.date}</div>
|
||||||
|
<div class="history-user">수정자: ${log.user}</div>
|
||||||
|
<div class="history-details">${log.details.replace(/\n/g, '<br>')}</div>
|
||||||
|
</div>
|
||||||
|
`).join('');
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ export function initSWModal(renderContent: () => void, closeModals: () => void)
|
|||||||
const newAsset: SoftwareAsset = {
|
const newAsset: SoftwareAsset = {
|
||||||
id: id || Math.random().toString(36).substring(2, 9),
|
id: id || Math.random().toString(36).substring(2, 9),
|
||||||
type: (document.getElementById('sw-asset-type') as HTMLInputElement).value,
|
type: (document.getElementById('sw-asset-type') as HTMLInputElement).value,
|
||||||
|
분야: (document.getElementById('sw-분야') as HTMLSelectElement).value,
|
||||||
법인: (document.getElementById('sw-법인') as HTMLSelectElement).value,
|
법인: (document.getElementById('sw-법인') as HTMLSelectElement).value,
|
||||||
|
부서: (document.getElementById('sw-부서') as HTMLInputElement).value,
|
||||||
제품명: (document.getElementById('sw-제품명') as HTMLInputElement).value,
|
제품명: (document.getElementById('sw-제품명') as HTMLInputElement).value,
|
||||||
구매일: (document.getElementById('sw-구매일') as HTMLInputElement).value,
|
구매일: (document.getElementById('sw-구매일') as HTMLInputElement).value,
|
||||||
구독일: (document.getElementById('sw-구독일') as HTMLInputElement).value,
|
구독일: (document.getElementById('sw-구독일') as HTMLInputElement).value,
|
||||||
@@ -82,7 +84,9 @@ export function openSwModal(asset?: SoftwareAsset) {
|
|||||||
|
|
||||||
(document.getElementById('sw-asset-id') as HTMLInputElement).value = asset.id;
|
(document.getElementById('sw-asset-id') as HTMLInputElement).value = asset.id;
|
||||||
(document.getElementById('sw-asset-type') as HTMLInputElement).value = asset.type;
|
(document.getElementById('sw-asset-type') as HTMLInputElement).value = asset.type;
|
||||||
|
(document.getElementById('sw-분야') as HTMLSelectElement).value = asset.분야 || '업무공통';
|
||||||
(document.getElementById('sw-법인') as HTMLSelectElement).value = asset.법인;
|
(document.getElementById('sw-법인') as HTMLSelectElement).value = asset.법인;
|
||||||
|
(document.getElementById('sw-부서') as HTMLInputElement).value = asset.부서 || '';
|
||||||
(document.getElementById('sw-제품명') as HTMLInputElement).value = asset.제품명;
|
(document.getElementById('sw-제품명') as HTMLInputElement).value = asset.제품명;
|
||||||
(document.getElementById('sw-구매일') as HTMLInputElement).value = asset.구매일 || '';
|
(document.getElementById('sw-구매일') as HTMLInputElement).value = asset.구매일 || '';
|
||||||
(document.getElementById('sw-구독일') as HTMLInputElement).value = asset.구독일 || '';
|
(document.getElementById('sw-구독일') as HTMLInputElement).value = asset.구독일 || '';
|
||||||
@@ -97,6 +101,8 @@ export function openSwModal(asset?: SoftwareAsset) {
|
|||||||
deleteBtn.style.display = 'none';
|
deleteBtn.style.display = 'none';
|
||||||
(document.getElementById('sw-asset-id') as HTMLInputElement).value = '';
|
(document.getElementById('sw-asset-id') as HTMLInputElement).value = '';
|
||||||
(document.getElementById('sw-asset-type') as HTMLInputElement).value = state.activeSubTab;
|
(document.getElementById('sw-asset-type') as HTMLInputElement).value = state.activeSubTab;
|
||||||
|
(document.getElementById('sw-분야') as HTMLSelectElement).value = '업무공통';
|
||||||
(document.getElementById('sw-법인') as HTMLSelectElement).value = '한맥';
|
(document.getElementById('sw-법인') as HTMLSelectElement).value = '한맥';
|
||||||
|
(document.getElementById('sw-부서') as HTMLInputElement).value = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export function generateDummyData(): MasterAssetData {
|
|||||||
|
|
||||||
// 1. 개인PC 50개
|
// 1. 개인PC 50개
|
||||||
for (let i = 1; i <= 50; i++) {
|
for (let i = 1; i <= 50; i++) {
|
||||||
const purchaseYear = Math.floor(Math.random() * 8) + 2017; // 2017~2024
|
const purchaseYear = Math.floor(Math.random() * 10) + 2017; // 2017~2026
|
||||||
hw.push({
|
hw.push({
|
||||||
id: Math.random().toString(36).substring(2, 9),
|
id: Math.random().toString(36).substring(2, 9),
|
||||||
type: '개인PC',
|
type: '개인PC',
|
||||||
@@ -43,7 +43,7 @@ export function generateDummyData(): MasterAssetData {
|
|||||||
HDD1: rand(['-', '1TB', '2TB']),
|
HDD1: rand(['-', '1TB', '2TB']),
|
||||||
HDD2: '',
|
HDD2: '',
|
||||||
구매일: randDate(purchaseYear, purchaseYear),
|
구매일: randDate(purchaseYear, purchaseYear),
|
||||||
금액: String(Math.floor(Math.random()*100 + 50) * 10000).replace(/\\B(?=(\\d{3})+(?!\\d))/g, ','),
|
금액: String(Math.floor(Math.random()*100 + 50) * 10000).replace(/\B(?=(\d{3})+(?!\d))/g, ','),
|
||||||
납품업체: rand(['다나와', '컴퓨존', '오피스디포']),
|
납품업체: rand(['다나와', '컴퓨존', '오피스디포']),
|
||||||
품의서명: '',
|
품의서명: '',
|
||||||
관리자: '', IP주소: '', MACaddress: '', OS: '', HW사양: ''
|
관리자: '', IP주소: '', MACaddress: '', OS: '', HW사양: ''
|
||||||
@@ -52,7 +52,7 @@ export function generateDummyData(): MasterAssetData {
|
|||||||
|
|
||||||
// 2. 서버 20개
|
// 2. 서버 20개
|
||||||
for (let i = 1; i <= 20; i++) {
|
for (let i = 1; i <= 20; i++) {
|
||||||
const purchaseYear = Math.floor(Math.random() * 8) + 2017; // 2017~2024
|
const purchaseYear = Math.floor(Math.random() * 10) + 2017; // 2017~2026
|
||||||
hw.push({
|
hw.push({
|
||||||
id: Math.random().toString(36).substring(2, 9),
|
id: Math.random().toString(36).substring(2, 9),
|
||||||
type: '서버',
|
type: '서버',
|
||||||
@@ -88,7 +88,7 @@ export function generateDummyData(): MasterAssetData {
|
|||||||
|
|
||||||
// 3. 스토리지 20개
|
// 3. 스토리지 20개
|
||||||
for (let i = 1; i <= 20; i++) {
|
for (let i = 1; i <= 20; i++) {
|
||||||
const purchaseYear = Math.floor(Math.random() * 8) + 2017; // 2017~2024
|
const purchaseYear = Math.floor(Math.random() * 10) + 2017; // 2017~2026
|
||||||
hw.push({
|
hw.push({
|
||||||
id: Math.random().toString(36).substring(2, 9),
|
id: Math.random().toString(36).substring(2, 9),
|
||||||
type: '스토리지',
|
type: '스토리지',
|
||||||
@@ -119,7 +119,7 @@ export function generateDummyData(): MasterAssetData {
|
|||||||
];
|
];
|
||||||
equips.forEach((eq) => {
|
equips.forEach((eq) => {
|
||||||
for (let i = 1; i <= 5; i++) {
|
for (let i = 1; i <= 5; i++) {
|
||||||
const purchaseYear = Math.floor(Math.random() * 6) + 2019; // 2019~2024
|
const purchaseYear = Math.floor(Math.random() * 8) + 2019; // 2019~2026
|
||||||
hw.push({
|
hw.push({
|
||||||
id: Math.random().toString(36).substring(2, 9),
|
id: Math.random().toString(36).substring(2, 9),
|
||||||
type: '전산비품',
|
type: '전산비품',
|
||||||
@@ -141,6 +141,7 @@ export function generateDummyData(): MasterAssetData {
|
|||||||
// 5. 구독형 S/W 40개
|
// 5. 구독형 S/W 40개
|
||||||
for (let i = 1; i <= 40; i++) {
|
for (let i = 1; i <= 40; i++) {
|
||||||
const swId = Math.random().toString(36).substring(2, 9);
|
const swId = Math.random().toString(36).substring(2, 9);
|
||||||
|
const purchaseYear = Math.random() < 0.3 ? 2026 : 2024;
|
||||||
|
|
||||||
let isExpiring = Math.random() < 0.25;
|
let isExpiring = Math.random() < 0.25;
|
||||||
let endDt = new Date();
|
let endDt = new Date();
|
||||||
@@ -154,16 +155,19 @@ export function generateDummyData(): MasterAssetData {
|
|||||||
sw.push({
|
sw.push({
|
||||||
id: swId,
|
id: swId,
|
||||||
type: '구독SW',
|
type: '구독SW',
|
||||||
|
분야: rand(['업무공통', '개발S/W', '디자인', '설계S/W']),
|
||||||
법인: rand(corps),
|
법인: rand(corps),
|
||||||
|
부서: rand(depts),
|
||||||
제품명: rand(['Adobe CC All Apps', 'Microsoft 365', 'Slack Pro', 'Notion Team']),
|
제품명: rand(['Adobe CC All Apps', 'Microsoft 365', 'Slack Pro', 'Notion Team']),
|
||||||
구매일: '2024-01-01',
|
구매일: `${purchaseYear}-01-01`,
|
||||||
구독일: `2024.01.01 ~ ${endStr}`,
|
구독일: `${purchaseYear}.01.01 ~ ${endStr}`,
|
||||||
금액: '600,000',
|
금액: String(Math.floor(Math.random() * 100 + 10) * 10000).replace(/\B(?=(\d{3})+(?!\d))/g, ','),
|
||||||
수량: Math.floor(Math.random() * 5) + 3, // 3~7
|
수량: Math.floor(Math.random() * 5) + 3, // 3~7
|
||||||
계정명: `user${i}@hm.com`,
|
계정명: `user${i}@hm.com`,
|
||||||
납품업체: '총판',
|
납품업체: '총판',
|
||||||
비고: '연간구독'
|
비고: '연간구독'
|
||||||
});
|
});
|
||||||
|
// ... rest unchanged
|
||||||
const assignCount = Math.floor(Math.random() * 2) + 1;
|
const assignCount = Math.floor(Math.random() * 2) + 1;
|
||||||
for (let j=0; j<assignCount; j++) {
|
for (let j=0; j<assignCount; j++) {
|
||||||
swUsers.push({
|
swUsers.push({
|
||||||
@@ -196,7 +200,9 @@ export function generateDummyData(): MasterAssetData {
|
|||||||
sw.push({
|
sw.push({
|
||||||
id: swId,
|
id: swId,
|
||||||
type: '영구SW',
|
type: '영구SW',
|
||||||
|
분야: rand(['업무공통', '개발S/W', '디자인', '설계S/W']),
|
||||||
법인: rand(corps),
|
법인: rand(corps),
|
||||||
|
부서: rand(depts),
|
||||||
제품명: rand(['AutoCAD 2024', 'Windows 10 Pro', '한컴오피스 2022', 'Visual Studio 2022']),
|
제품명: rand(['AutoCAD 2024', 'Windows 10 Pro', '한컴오피스 2022', 'Visual Studio 2022']),
|
||||||
구매일: '2020-05-15',
|
구매일: '2020-05-15',
|
||||||
유지보수여부: true,
|
유지보수여부: true,
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ export interface HardwareAsset {
|
|||||||
export interface SoftwareAsset {
|
export interface SoftwareAsset {
|
||||||
id: string;
|
id: string;
|
||||||
type: string; // '구독SW', '영구SW'
|
type: string; // '구독SW', '영구SW'
|
||||||
|
분야?: string;
|
||||||
법인: string;
|
법인: string;
|
||||||
|
부서?: string;
|
||||||
제품명: string;
|
제품명: string;
|
||||||
구매일: string;
|
구매일: string;
|
||||||
구독일?: string;
|
구독일?: string;
|
||||||
@@ -65,10 +67,19 @@ export interface SWUser {
|
|||||||
신청서명: string;
|
신청서명: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface HardwareLog {
|
||||||
|
id: string;
|
||||||
|
assetId: string;
|
||||||
|
date: string;
|
||||||
|
details: string;
|
||||||
|
user: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface MasterAssetData {
|
export interface MasterAssetData {
|
||||||
hw: HardwareAsset[];
|
hw: HardwareAsset[];
|
||||||
sw: SoftwareAsset[];
|
sw: SoftwareAsset[];
|
||||||
swUsers: SWUser[];
|
swUsers: SWUser[];
|
||||||
|
logs: HardwareLog[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const HW_TABS = ['개인PC', '서버', '스토리지', '전산비품'];
|
const HW_TABS = ['개인PC', '서버', '스토리지', '전산비품'];
|
||||||
@@ -78,9 +89,10 @@ const HW_HEADERS = ['법인', '자산코드', '명칭', '위치', '관리자', '
|
|||||||
const PC_HEADERS = ['법인', '자산코드', '사용자', '위치', 'CPU', 'GPU', 'RAM', 'SSD1', 'SSD2', 'HDD1', 'HDD2', '구매일', '금액', '납품업체', '품의서명'];
|
const PC_HEADERS = ['법인', '자산코드', '사용자', '위치', 'CPU', 'GPU', 'RAM', 'SSD1', 'SSD2', 'HDD1', 'HDD2', '구매일', '금액', '납품업체', '품의서명'];
|
||||||
const SERVER_HEADERS = ['법인', '자산번호', '유형', '용도', '설치위치', '담당자(정)', '담당자(부)', 'IP 주소', '원격접속', '모델명', 'OS', 'CPU', 'RAM', 'GPU', 'Storage1', 'Storage2', 'Storage3', '모니터링', '비고'];
|
const SERVER_HEADERS = ['법인', '자산번호', '유형', '용도', '설치위치', '담당자(정)', '담당자(부)', 'IP 주소', '원격접속', '모델명', 'OS', 'CPU', 'RAM', 'GPU', 'Storage1', 'Storage2', 'Storage3', '모니터링', '비고'];
|
||||||
const STORAGE_HEADERS = ['법인', '유형', '자산코드', '명칭', '위치', '모델명', '용량', '담당자(정)', '담당자(부)', 'IP주소', 'MAC주소', '구매일', '금액', '납품업체', '품의서명'];
|
const STORAGE_HEADERS = ['법인', '유형', '자산코드', '명칭', '위치', '모델명', '용량', '담당자(정)', '담당자(부)', 'IP주소', 'MAC주소', '구매일', '금액', '납품업체', '품의서명'];
|
||||||
const SUB_SW_HEADERS = ['ID', '법인', '제품명', '구매일', '구독일', '금액', '수량', '계정명', '납품업체', '비고'];
|
const SUB_SW_HEADERS = ['ID', '분야', '법인', '부서', '제품명', '구매일', '구독일', '금액', '수량', '계정명', '납품업체', '비고'];
|
||||||
const PERM_SW_HEADERS = ['ID', '법인', '제품명', '구매일', '유지보수여부', '금액', '수량', '계정명', '납품업체', '비고'];
|
const PERM_SW_HEADERS = ['ID', '분야', '법인', '부서', '제품명', '구매일', '유지보수여부', '금액', '수량', '계정명', '납품업체', '비고'];
|
||||||
const SW_USER_HEADERS = ['id', 'swId', '법인', '부서', '팀', '직위', '이름', '사용기간', '신청서명'];
|
const SW_USER_HEADERS = ['id', 'swId', '법인', '부서', '팀', '직위', '이름', '사용기간', '신청서명'];
|
||||||
|
const HISTORY_HEADERS = ['id', 'assetId', 'date', 'details', 'user'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 템플릿 엑셀 다중 시트로 다운로드
|
* 템플릿 엑셀 다중 시트로 다운로드
|
||||||
@@ -116,7 +128,7 @@ export function downloadTemplate() {
|
|||||||
SW_TABS.forEach(tab => {
|
SW_TABS.forEach(tab => {
|
||||||
let hd = tab === '구독SW' ? SUB_SW_HEADERS : PERM_SW_HEADERS;
|
let hd = tab === '구독SW' ? SUB_SW_HEADERS : PERM_SW_HEADERS;
|
||||||
const ws = XLSX.utils.aoa_to_sheet([hd]);
|
const ws = XLSX.utils.aoa_to_sheet([hd]);
|
||||||
ws['!cols'] = [{wch:15}, {wch:15}, {wch:30}, {wch:15}, {wch:20}, {wch:15}, {wch:10}, {wch:20}, {wch:20}, {wch:30}];
|
ws['!cols'] = [{wch:15}, {wch:15}, {wch:15}, {wch:20}, {wch:30}, {wch:15}, {wch:20}, {wch:15}, {wch:10}, {wch:20}, {wch:20}, {wch:30}];
|
||||||
XLSX.utils.book_append_sheet(wb, ws, tab);
|
XLSX.utils.book_append_sheet(wb, ws, tab);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -124,6 +136,11 @@ export function downloadTemplate() {
|
|||||||
swUserWs['!cols'] = [{wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:20}, {wch:25}];
|
swUserWs['!cols'] = [{wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:20}, {wch:25}];
|
||||||
XLSX.utils.book_append_sheet(wb, swUserWs, 'SW_사용자');
|
XLSX.utils.book_append_sheet(wb, swUserWs, 'SW_사용자');
|
||||||
|
|
||||||
|
// History 시트 (템플릿에도 포함)
|
||||||
|
const historyWs = XLSX.utils.aoa_to_sheet([HISTORY_HEADERS]);
|
||||||
|
historyWs['!cols'] = [{wch:15}, {wch:20}, {wch:20}, {wch:50}, {wch:15}];
|
||||||
|
XLSX.utils.book_append_sheet(wb, historyWs, 'History');
|
||||||
|
|
||||||
XLSX.writeFile(wb, 'itam_assets_template.xlsx');
|
XLSX.writeFile(wb, 'itam_assets_template.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,16 +194,16 @@ export function exportToExcel(masterData: MasterAssetData) {
|
|||||||
if (tab === '구독SW') {
|
if (tab === '구독SW') {
|
||||||
wsData = [
|
wsData = [
|
||||||
SUB_SW_HEADERS,
|
SUB_SW_HEADERS,
|
||||||
...targetAssets.map(a => [a.id, a.법인, a.제품명, a.구매일, a.구독일, a.금액, a.수량, a.계정명, a.납품업체, a.비고])
|
...targetAssets.map(a => [a.id, a.분야||'', a.법인, a.부서||'', a.제품명, a.구매일, a.구독일, a.금액, a.수량, a.계정명, a.납품업체, a.비고])
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
wsData = [
|
wsData = [
|
||||||
PERM_SW_HEADERS,
|
PERM_SW_HEADERS,
|
||||||
...targetAssets.map(a => [a.id, a.법인, a.제품명, a.구매일, a.유지보수여부 ? 'Y' : 'N', a.금액, a.수량, a.계정명, a.납품업체, a.비고])
|
...targetAssets.map(a => [a.id, a.분야||'', a.법인, a.부서||'', a.제품명, a.구매일, a.유지보수여부 ? 'Y' : 'N', a.금액, a.수량, a.계정명, a.납품업체, a.비고])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
const ws = XLSX.utils.aoa_to_sheet(wsData);
|
const ws = XLSX.utils.aoa_to_sheet(wsData);
|
||||||
ws['!cols'] = [{wch:15}, {wch:15}, {wch:30}, {wch:15}, {wch:20}, {wch:15}, {wch:10}, {wch:20}, {wch:20}, {wch:30}];
|
ws['!cols'] = [{wch:15}, {wch:15}, {wch:15}, {wch:20}, {wch:30}, {wch:15}, {wch:20}, {wch:15}, {wch:10}, {wch:20}, {wch:20}, {wch:30}];
|
||||||
XLSX.utils.book_append_sheet(wb, ws, tab);
|
XLSX.utils.book_append_sheet(wb, ws, tab);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -199,6 +216,15 @@ export function exportToExcel(masterData: MasterAssetData) {
|
|||||||
swUserWs['!cols'] = [{wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:20}, {wch:25}];
|
swUserWs['!cols'] = [{wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:15}, {wch:20}, {wch:25}];
|
||||||
XLSX.utils.book_append_sheet(wb, swUserWs, 'SW_사용자');
|
XLSX.utils.book_append_sheet(wb, swUserWs, 'SW_사용자');
|
||||||
|
|
||||||
|
// History
|
||||||
|
const historyWsData = [
|
||||||
|
HISTORY_HEADERS,
|
||||||
|
...masterData.logs.map(l => [l.id, l.assetId, l.date, l.details, l.user])
|
||||||
|
];
|
||||||
|
const historyWs = XLSX.utils.aoa_to_sheet(historyWsData);
|
||||||
|
historyWs['!cols'] = [{wch:15}, {wch:20}, {wch:20}, {wch:50}, {wch:15}];
|
||||||
|
XLSX.utils.book_append_sheet(wb, historyWs, 'History');
|
||||||
|
|
||||||
const dateStr = new Date().toISOString().split('T')[0];
|
const dateStr = new Date().toISOString().split('T')[0];
|
||||||
XLSX.writeFile(wb, `itam_assets_master_${dateStr}.xlsx`);
|
XLSX.writeFile(wb, `itam_assets_master_${dateStr}.xlsx`);
|
||||||
}
|
}
|
||||||
@@ -218,6 +244,7 @@ export async function parseExcel(file: File): Promise<MasterAssetData> {
|
|||||||
const hwAssets: HardwareAsset[] = [];
|
const hwAssets: HardwareAsset[] = [];
|
||||||
const swAssets: SoftwareAsset[] = [];
|
const swAssets: SoftwareAsset[] = [];
|
||||||
const swUsers: SWUser[] = [];
|
const swUsers: SWUser[] = [];
|
||||||
|
const logs: HardwareLog[] = [];
|
||||||
|
|
||||||
workbook.SheetNames.forEach(sheetName => {
|
workbook.SheetNames.forEach(sheetName => {
|
||||||
const worksheet = workbook.Sheets[sheetName];
|
const worksheet = workbook.Sheets[sheetName];
|
||||||
@@ -333,7 +360,9 @@ export async function parseExcel(file: File): Promise<MasterAssetData> {
|
|||||||
swAssets.push({
|
swAssets.push({
|
||||||
id: row['ID'] ? String(row['ID']) : Math.random().toString(36).substring(2, 9),
|
id: row['ID'] ? String(row['ID']) : Math.random().toString(36).substring(2, 9),
|
||||||
type: sheetName,
|
type: sheetName,
|
||||||
|
분야: row['분야'] || '',
|
||||||
법인: row['법인'] || '',
|
법인: row['법인'] || '',
|
||||||
|
부서: row['부서'] || '',
|
||||||
제품명: row['제품명'] || '',
|
제품명: row['제품명'] || '',
|
||||||
구매일: row['구매일'] || '',
|
구매일: row['구매일'] || '',
|
||||||
구독일: row['구독일'] || '',
|
구독일: row['구독일'] || '',
|
||||||
@@ -362,9 +391,21 @@ export async function parseExcel(file: File): Promise<MasterAssetData> {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sheetName === 'History') {
|
||||||
|
json.forEach(row => {
|
||||||
|
logs.push({
|
||||||
|
id: row['id'] ? String(row['id']) : Math.random().toString(36).substring(2, 9),
|
||||||
|
assetId: row['assetId'] ? String(row['assetId']) : '',
|
||||||
|
date: row['date'] || '',
|
||||||
|
details: row['details'] || '',
|
||||||
|
user: row['user'] || '',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve({ hw: hwAssets, sw: swAssets, swUsers });
|
resolve({ hw: hwAssets, sw: swAssets, swUsers, logs });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2 } from 'lucide';
|
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History } from 'lucide';
|
||||||
import { downloadTemplate, exportToExcel, parseExcel } from './excelHandler';
|
import { downloadTemplate, exportToExcel, parseExcel } from './excelHandler';
|
||||||
import { state } from './state';
|
import { state } from './state';
|
||||||
import { initSidebar } from './components/Sidebar';
|
import { initSidebar } from './components/Sidebar';
|
||||||
@@ -22,7 +22,7 @@ const btnExport = document.getElementById('btn-export-excel') as HTMLButtonEleme
|
|||||||
|
|
||||||
// Initialize Icons
|
// Initialize Icons
|
||||||
createIcons({
|
createIcons({
|
||||||
icons: { Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2 }
|
icons: { Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize Components
|
// Initialize Components
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ const mergedHw = [
|
|||||||
export const state: AppState = {
|
export const state: AppState = {
|
||||||
masterData: {
|
masterData: {
|
||||||
...dummy,
|
...dummy,
|
||||||
hw: mergedHw
|
hw: mergedHw,
|
||||||
|
logs: [] // 공동작업자의 수정 이력 배열 추가
|
||||||
},
|
},
|
||||||
activeCategory: 'hw',
|
activeCategory: 'hw',
|
||||||
activeSubTab: '대시보드',
|
activeSubTab: '대시보드',
|
||||||
|
|||||||
@@ -316,55 +316,66 @@ tbody tr:last-child td { border-bottom: none; }
|
|||||||
tbody tr:hover { background-color: var(--bg-color); }
|
tbody tr:hover { background-color: var(--bg-color); }
|
||||||
.empty-row td { text-align: center; padding: 3rem; color: var(--text-muted); }
|
.empty-row td { text-align: center; padding: 3rem; color: var(--text-muted); }
|
||||||
|
|
||||||
/* Modal */
|
.sw-table td {
|
||||||
.modal-overlay {
|
text-align: center;
|
||||||
position: fixed;
|
|
||||||
top: 0; left: 0; right: 0; bottom: 0;
|
|
||||||
background-color: rgba(0, 0, 0, 0.4);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 1000;
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
transition: opacity 0.2s ease, visibility 0.2s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
|
/* Search Filter Bar */
|
||||||
.modal-content {
|
.search-bar {
|
||||||
background-color: var(--white);
|
|
||||||
width: 100%; max-width: 600px;
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
|
|
||||||
transform: translateY(20px);
|
|
||||||
transition: transform 0.2s ease;
|
|
||||||
}
|
|
||||||
.modal-overlay:not(.hidden) .modal-content { transform: translateY(0); }
|
|
||||||
.modal-header {
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
color: var(--white);
|
|
||||||
padding: 1rem 1.5rem;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
gap: 1rem;
|
||||||
|
background-color: var(--white);
|
||||||
|
padding: 1.25rem;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
.modal-header h2 { font-size: 1.125rem; font-weight: 500; }
|
|
||||||
.modal-body { padding: 1.5rem; }
|
.search-item {
|
||||||
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
display: flex;
|
||||||
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
|
flex-direction: column;
|
||||||
.form-group.full-width { grid-column: span 2; }
|
gap: 0.5rem;
|
||||||
.form-group label { font-size: 0.875rem; font-weight: 500; }
|
min-width: 180px;
|
||||||
.form-group input, .form-group textarea {
|
}
|
||||||
padding: 0.625rem;
|
|
||||||
|
.search-item.flex-1 {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-item label {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-muted);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-item input,
|
||||||
|
.search-item select {
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-family: inherit; font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
outline: none; transition: border-color 0.2s;
|
outline: none;
|
||||||
|
transition: all 0.2s;
|
||||||
|
background-color: var(--white);
|
||||||
}
|
}
|
||||||
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary-color); }
|
|
||||||
.modal-footer {
|
.search-item input:focus,
|
||||||
padding: 1rem 1.5rem; border-top: 1px solid var(--border-color);
|
.search-item select:focus {
|
||||||
display: flex; justify-content: space-between; align-items: center;
|
border-color: var(--primary-color);
|
||||||
|
box-shadow: 0 0 0 2px rgba(30, 81, 73, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-reset {
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 1rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: var(--text-muted);
|
||||||
}
|
}
|
||||||
.footer-actions { display: flex; gap: 0.5rem; }
|
|
||||||
161
src/styles/modal.css
Normal file
161
src/styles/modal.css
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
/* Modal */
|
||||||
|
.modal-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0; left: 0; right: 0; bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 1000;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
transition: opacity 0.2s ease, visibility 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
background-color: var(--white);
|
||||||
|
width: 100%; max-width: 600px;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
|
||||||
|
transform: translateY(20px);
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-overlay:not(.hidden) .modal-content { transform: translateY(0); }
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
color: var(--white);
|
||||||
|
padding: 1rem 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h2 { font-size: 1.125rem; font-weight: 500; }
|
||||||
|
|
||||||
|
.modal-body { padding: 1.5rem; }
|
||||||
|
|
||||||
|
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
||||||
|
|
||||||
|
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
|
||||||
|
|
||||||
|
.form-group.full-width { grid-column: span 2; }
|
||||||
|
|
||||||
|
.form-group label { font-size: 0.875rem; font-weight: 500; }
|
||||||
|
|
||||||
|
.form-group input, .form-group textarea {
|
||||||
|
padding: 0.625rem;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: 4px;
|
||||||
|
font-family: inherit; font-size: 0.875rem;
|
||||||
|
outline: none; transition: border-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary-color); }
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
padding: 1rem 1.5rem; border-top: 1px solid var(--border-color);
|
||||||
|
display: flex; justify-content: space-between; align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-actions { display: flex; gap: 0.5rem; }
|
||||||
|
|
||||||
|
/* Wide Modal for History */
|
||||||
|
.modal-content.wide {
|
||||||
|
max-width: 950px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body-split {
|
||||||
|
display: flex;
|
||||||
|
gap: 2rem;
|
||||||
|
min-height: 480px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-form-area {
|
||||||
|
flex: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-history-area {
|
||||||
|
flex: 0.8;
|
||||||
|
border-left: 1px solid var(--border-color);
|
||||||
|
padding-left: 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-header {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-header h3 {
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
font-weight: 600;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
color: var(--text-main);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-timeline {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 500px;
|
||||||
|
padding-right: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-item {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 1.25rem;
|
||||||
|
padding-bottom: 1.5rem;
|
||||||
|
border-left: 2px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-item::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: -7px;
|
||||||
|
top: 0;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--white);
|
||||||
|
border: 2px solid var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-item:last-child {
|
||||||
|
border-left: 2px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-date {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-user {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--primary-color);
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-details {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
color: var(--text-main);
|
||||||
|
line-height: 1.4;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-history {
|
||||||
|
padding: 2rem 0;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { state } from '../state';
|
import { state } from '../state';
|
||||||
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2 } from 'lucide';
|
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, RefreshCcw } from 'lucide';
|
||||||
import { openPcModal } from '../components/Modal/PCModal';
|
import { openPcModal } from '../components/Modal/PCModal';
|
||||||
import { openHwModal } from '../components/Modal/HWModal';
|
import { openHwModal } from '../components/Modal/HWModal';
|
||||||
import { openStorageModal } from '../components/Modal/StorageModal';
|
import { openStorageModal } from '../components/Modal/StorageModal';
|
||||||
@@ -11,7 +11,7 @@ import { openSwUserModal } from '../components/Modal/SWUserModal';
|
|||||||
*/
|
*/
|
||||||
export function renderTable(mainContent: HTMLElement) {
|
export function renderTable(mainContent: HTMLElement) {
|
||||||
const container = document.createElement('div');
|
const container = document.createElement('div');
|
||||||
container.className = 'table-container';
|
container.className = 'view-container';
|
||||||
const table = document.createElement('table');
|
const table = document.createElement('table');
|
||||||
|
|
||||||
if (state.activeCategory === 'hw') {
|
if (state.activeCategory === 'hw') {
|
||||||
@@ -28,10 +28,13 @@ export function renderTable(mainContent: HTMLElement) {
|
|||||||
|
|
||||||
function renderHwTable(table: HTMLTableElement, container: HTMLElement, mainContent: HTMLElement) {
|
function renderHwTable(table: HTMLTableElement, container: HTMLElement, mainContent: HTMLElement) {
|
||||||
const list = state.masterData.hw.filter(a => a.type === state.activeSubTab);
|
const list = state.masterData.hw.filter(a => a.type === state.activeSubTab);
|
||||||
|
const tableWrapper = document.createElement('div');
|
||||||
|
tableWrapper.className = 'table-container';
|
||||||
|
|
||||||
if (state.activeSubTab === '개인PC') {
|
if (state.activeSubTab === '개인PC') {
|
||||||
table.innerHTML = `<thead><tr><th>No</th><th>법인</th><th>자산코드</th><th>사용자</th><th>위치</th><th>CPU</th><th>GPU</th><th>RAM</th><th>SSD1</th><th>SSD2</th><th>HDD1</th><th>HDD2</th><th>구매일</th><th>금액</th><th>납품업체</th><th>품의서</th><th>관리</th></tr></thead><tbody id="dynamic-tbody"></tbody>`;
|
table.innerHTML = `<thead><tr><th>No</th><th>법인</th><th>자산코드</th><th>사용자</th><th>위치</th><th>CPU</th><th>GPU</th><th>RAM</th><th>SSD1</th><th>SSD2</th><th>HDD1</th><th>HDD2</th><th>구매일</th><th>금액</th><th>납품업체</th><th>품의서</th><th>관리</th></tr></thead><tbody id="dynamic-tbody"></tbody>`;
|
||||||
container.appendChild(table);
|
tableWrapper.appendChild(table);
|
||||||
|
container.appendChild(tableWrapper);
|
||||||
mainContent.appendChild(container);
|
mainContent.appendChild(container);
|
||||||
const tbody = document.getElementById('dynamic-tbody')!;
|
const tbody = document.getElementById('dynamic-tbody')!;
|
||||||
if (list.length === 0) { tbody.innerHTML = `<tr><td colspan="17">등록된 자산이 없습니다.</td></tr>`; return; }
|
if (list.length === 0) { tbody.innerHTML = `<tr><td colspan="17">등록된 자산이 없습니다.</td></tr>`; return; }
|
||||||
@@ -45,7 +48,8 @@ function renderHwTable(table: HTMLTableElement, container: HTMLElement, mainCont
|
|||||||
});
|
});
|
||||||
} else if (state.activeSubTab === '스토리지') {
|
} else if (state.activeSubTab === '스토리지') {
|
||||||
table.innerHTML = `<thead><tr><th>No</th><th>법인</th><th>유형</th><th>자산코드</th><th>명칭</th><th>위치</th><th>모델명</th><th>용량</th><th>담당자(정)</th><th>IP주소</th><th>구매일</th><th>금액</th><th>관리</th></tr></thead><tbody id="dynamic-tbody"></tbody>`;
|
table.innerHTML = `<thead><tr><th>No</th><th>법인</th><th>유형</th><th>자산코드</th><th>명칭</th><th>위치</th><th>모델명</th><th>용량</th><th>담당자(정)</th><th>IP주소</th><th>구매일</th><th>금액</th><th>관리</th></tr></thead><tbody id="dynamic-tbody"></tbody>`;
|
||||||
container.appendChild(table);
|
tableWrapper.appendChild(table);
|
||||||
|
container.appendChild(tableWrapper);
|
||||||
mainContent.appendChild(container);
|
mainContent.appendChild(container);
|
||||||
const tbody = document.getElementById('dynamic-tbody')!;
|
const tbody = document.getElementById('dynamic-tbody')!;
|
||||||
if (list.length === 0) { tbody.innerHTML = `<tr><td colspan="13">등록된 자산이 없습니다.</td></tr>`; return; }
|
if (list.length === 0) { tbody.innerHTML = `<tr><td colspan="13">등록된 자산이 없습니다.</td></tr>`; return; }
|
||||||
@@ -58,6 +62,7 @@ function renderHwTable(table: HTMLTableElement, container: HTMLElement, mainCont
|
|||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// 서버 또는 전산비품
|
||||||
if (state.activeSubTab === '서버') {
|
if (state.activeSubTab === '서버') {
|
||||||
table.innerHTML = `
|
table.innerHTML = `
|
||||||
<thead>
|
<thead>
|
||||||
@@ -84,7 +89,8 @@ function renderHwTable(table: HTMLTableElement, container: HTMLElement, mainCont
|
|||||||
table.innerHTML = `<thead><tr><th>No</th><th>법인</th>${state.activeSubTab === '전산비품' ? '<th>유형</th>' : ''}<th>자산코드</th><th>명칭</th><th>위치</th><th>관리자</th><th>구매일</th><th>금액</th><th>관리</th></tr></thead><tbody id="dynamic-tbody"></tbody>`;
|
table.innerHTML = `<thead><tr><th>No</th><th>법인</th>${state.activeSubTab === '전산비품' ? '<th>유형</th>' : ''}<th>자산코드</th><th>명칭</th><th>위치</th><th>관리자</th><th>구매일</th><th>금액</th><th>관리</th></tr></thead><tbody id="dynamic-tbody"></tbody>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
container.appendChild(table);
|
tableWrapper.appendChild(table);
|
||||||
|
container.appendChild(tableWrapper);
|
||||||
mainContent.appendChild(container);
|
mainContent.appendChild(container);
|
||||||
const tbody = document.getElementById('dynamic-tbody')!;
|
const tbody = document.getElementById('dynamic-tbody')!;
|
||||||
const colCount = state.activeSubTab === '서버' ? 15 : (state.activeSubTab === '전산비품' ? 11 : 10);
|
const colCount = state.activeSubTab === '서버' ? 15 : (state.activeSubTab === '전산비품' ? 11 : 10);
|
||||||
@@ -129,7 +135,7 @@ function renderHwTable(table: HTMLTableElement, container: HTMLElement, mainCont
|
|||||||
}
|
}
|
||||||
const remoteHtml = remoteItems.join(' / ');
|
const remoteHtml = remoteItems.join(' / ');
|
||||||
|
|
||||||
// IP 및 Storage (기존 유지)
|
// IP 및 Storage
|
||||||
const ipInfo = [asset.IP주소, asset.IP2].filter(v => v && v !== '').join(' / ');
|
const ipInfo = [asset.IP주소, asset.IP2].filter(v => v && v !== '').join(' / ');
|
||||||
const storageInfo = [asset.SSD1, asset.SSD2].filter(v => v && v !== '').join(' / ');
|
const storageInfo = [asset.SSD1, asset.SSD2].filter(v => v && v !== '').join(' / ');
|
||||||
|
|
||||||
@@ -150,32 +156,128 @@ function renderHwTable(table: HTMLTableElement, container: HTMLElement, mainCont
|
|||||||
<td class="text-nowrap">${formatInline(asset.RAM)}</td>
|
<td class="text-nowrap">${formatInline(asset.RAM)}</td>
|
||||||
<td class="text-nowrap">${formatInline(storageInfo)}</td>
|
<td class="text-nowrap">${formatInline(storageInfo)}</td>
|
||||||
`;
|
`;
|
||||||
|
tr.addEventListener('click', (e) => { if (!(e.target as HTMLElement).closest('button')) openHwModal(asset); });
|
||||||
} else {
|
} else {
|
||||||
tr.innerHTML = `<td>${idx+1}</td><td>${asset.법인}</td>${state.activeSubTab === '전산비품' ? `<td>${asset.비품유형||'-'}</td>` : ''}<td>${asset.자산코드}</td><td>${asset.명칭}</td><td>${asset.위치}</td><td>${asset.관리자}</td><td>${asset.구매일||''}</td><td>${asset.금액||''}</td><td><button class="btn-outline btn-edit">수정</button></td>`;
|
tr.innerHTML = `<td>${idx+1}</td><td>${asset.법인}</td>${state.activeSubTab === '전산비품' ? `<td>${asset.비품유형||'-'}</td>` : ''}<td>${asset.자산코드}</td><td>${asset.명칭}</td><td>${asset.위치}</td><td>${asset.관리자}</td><td>${asset.구매일||''}</td><td>${asset.금액||''}</td><td><button class="btn-outline btn-edit">수정</button></td>`;
|
||||||
}
|
|
||||||
|
|
||||||
tr.addEventListener('click', (e) => { if (!(e.target as HTMLElement).closest('button')) openHwModal(asset); });
|
tr.addEventListener('click', (e) => { if (!(e.target as HTMLElement).closest('button')) openHwModal(asset); });
|
||||||
|
}
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderSwTable(table: HTMLTableElement, container: HTMLElement, mainContent: HTMLElement) {
|
function renderSwTable(table: HTMLTableElement, container: HTMLElement, mainContent: HTMLElement) {
|
||||||
const list = state.masterData.sw.filter(a => a.type === state.activeSubTab);
|
const fullList = state.masterData.sw.filter(a => a.type === state.activeSubTab);
|
||||||
table.innerHTML = `<thead><tr><th>No</th><th>법인</th><th>제품명</th><th>구매일</th><th>수량</th><th>사용가능</th><th>관리</th></tr></thead><tbody id="dynamic-tbody"></tbody>`;
|
const isSub = state.activeSubTab === '구독SW';
|
||||||
container.appendChild(table);
|
|
||||||
|
// 0. Container 준비 (조회 바 + 테이블)
|
||||||
|
container.innerHTML = '';
|
||||||
|
|
||||||
|
// 1. 조회 바 (Filter Bar) 생성
|
||||||
|
const filterBar = document.createElement('div');
|
||||||
|
filterBar.className = 'search-bar';
|
||||||
|
filterBar.innerHTML = `
|
||||||
|
<div class="search-item flex-1">
|
||||||
|
<label>통합 검색 (제품명/부서)</label>
|
||||||
|
<input type="text" id="filter-keyword" placeholder="검색어를 입력하세요..." autocomplete="off">
|
||||||
|
</div>
|
||||||
|
<div class="search-item">
|
||||||
|
<label>분야</label>
|
||||||
|
<select id="filter-field">
|
||||||
|
<option value="">전체 분야</option>
|
||||||
|
<option value="업무공통">업무공통</option>
|
||||||
|
<option value="개발S/W">개발S/W</option>
|
||||||
|
<option value="디자인">디자인</option>
|
||||||
|
<option value="설계S/W">설계S/W</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="search-item">
|
||||||
|
<label>법인</label>
|
||||||
|
<select id="filter-corp">
|
||||||
|
<option value="">전체 법인</option>
|
||||||
|
<option value="한맥">한맥</option>
|
||||||
|
<option value="삼안">삼안</option>
|
||||||
|
<option value="바론">바론</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<button id="btn-reset-filters" class="btn btn-outline btn-reset" title="검색 조건 초기화">
|
||||||
|
<i data-lucide="refresh-ccw" style="width:14px; height:14px;"></i> 필터 초기화
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
container.appendChild(filterBar);
|
||||||
|
|
||||||
|
// 2. 테이블 기본 구조 생성
|
||||||
|
const tableWrapper = document.createElement('div');
|
||||||
|
tableWrapper.className = 'table-container';
|
||||||
|
table.classList.add('sw-table');
|
||||||
|
table.innerHTML = `<thead><tr><th style="text-align:center;">No.</th><th style="text-align:center;">분야</th><th style="text-align:center;">법인</th><th style="text-align:center;">부서</th><th style="text-align:center;">제품명</th><th style="text-align:center;">구매일</th>${isSub ? '<th style="text-align:center;">구독일</th>' : ''}<th style="text-align:center;">금액</th><th style="text-align:center;">수량</th><th style="text-align:center;">사용가능</th><th style="text-align:center;">관리</th></tr></thead><tbody id="dynamic-tbody"></tbody>`;
|
||||||
|
|
||||||
|
tableWrapper.appendChild(table);
|
||||||
|
container.appendChild(tableWrapper);
|
||||||
mainContent.appendChild(container);
|
mainContent.appendChild(container);
|
||||||
|
|
||||||
const tbody = document.getElementById('dynamic-tbody')!;
|
const tbody = document.getElementById('dynamic-tbody')!;
|
||||||
if (list.length === 0) { tbody.innerHTML = `<tr><td colspan="7">정보가 없습니다.</td></tr>`; return; }
|
|
||||||
list.forEach((asset, idx) => {
|
// 3. 필터링 및 테이블 업데이트 로직
|
||||||
|
const updateTable = () => {
|
||||||
|
const keyword = (document.getElementById('filter-keyword') as HTMLInputElement).value.toLowerCase().trim();
|
||||||
|
const field = (document.getElementById('filter-field') as HTMLSelectElement).value;
|
||||||
|
const corp = (document.getElementById('filter-corp') as HTMLSelectElement).value;
|
||||||
|
|
||||||
|
const filtered = fullList.filter(asset => {
|
||||||
|
const matchKeyword = !keyword ||
|
||||||
|
(asset.제품명 || '').toLowerCase().includes(keyword) ||
|
||||||
|
(asset.부서 || '').toLowerCase().includes(keyword);
|
||||||
|
const matchField = !field || asset.분야 === field;
|
||||||
|
const matchCorp = !corp || asset.법인 === corp;
|
||||||
|
return matchKeyword && matchField && matchCorp;
|
||||||
|
});
|
||||||
|
|
||||||
|
tbody.innerHTML = '';
|
||||||
|
if (filtered.length === 0) {
|
||||||
|
tbody.innerHTML = `<tr><td colspan="${isSub ? 11 : 10}" style="text-align:center; padding: 3rem; color: var(--text-muted);">검색 결과가 없습니다.</td></tr>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
filtered.forEach((asset, idx) => {
|
||||||
const assigned = state.masterData.swUsers.filter(u => u.swId === asset.id).length;
|
const assigned = state.masterData.swUsers.filter(u => u.swId === asset.id).length;
|
||||||
const avail = asset.수량 - assigned;
|
const avail = (typeof asset.수량 === 'number' ? asset.수량 : parseInt(asset.수량||'0', 10)) - assigned;
|
||||||
const tr = document.createElement('tr');
|
const tr = document.createElement('tr');
|
||||||
tr.style.cursor = 'pointer';
|
tr.style.cursor = 'pointer';
|
||||||
tr.innerHTML = `<td>${idx+1}</td><td>${asset.법인}</td><td>${asset.제품명}</td><td>${asset.구매일||''}</td><td>${asset.수량}</td><td><strong style="color: ${avail > 0 ? 'var(--primary)' : 'var(--danger)'}">${avail}</strong></td><td style="display:flex; gap:0.25rem;"><button class="btn-outline btn-edit">수정</button><button class="btn-outline btn-users"><i data-lucide="users" style="width:14px; height:14px;"></i></button></td>`;
|
tr.innerHTML = `<td>${idx+1}</td><td>${asset.분야||''}</td><td>${asset.법인}</td><td>${asset.부서||''}</td><td>${asset.제품명}</td><td>${asset.구매일||''}</td>${isSub ? `<td>${asset.구독일||''}</td>` : ''}<td>${asset.금액||'0'}</td><td>${asset.수량}</td><td><strong style="color: ${avail > 0 ? 'var(--primary-color)' : 'var(--danger)'}">${avail}</strong></td><td style="display:flex; justify-content:center; align-items:center; gap:0.5rem;"><button type="button" class="btn-icon btn-edit" title="수정" style="color: var(--text-muted);"><i data-lucide="edit-2" style="width:18px; height:18px;"></i></button><button type="button" class="btn-icon btn-users" title="사용자 관리" style="color: var(--primary-color);"><i data-lucide="users" style="width:18px; height:18px;"></i></button></td>`;
|
||||||
tr.addEventListener('click', (e) => { if (!(e.target as HTMLElement).closest('button')) openSwModal(asset); });
|
tr.addEventListener('click', (e) => { if (!(e.target as HTMLElement).closest('button')) openSwModal(asset); });
|
||||||
tr.querySelector('.btn-edit')?.addEventListener('click', () => openSwModal(asset));
|
tr.querySelector('.btn-edit')?.addEventListener('click', () => openSwModal(asset));
|
||||||
tr.querySelector('.btn-users')?.addEventListener('click', () => openSwUserModal(asset));
|
tr.querySelector('.btn-users')?.addEventListener('click', () => openSwUserModal(asset));
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 버튼 내 아이콘 다시 그리기
|
||||||
|
createIcons({
|
||||||
|
icons: { Edit2, Users, RefreshCcw }
|
||||||
|
});
|
||||||
|
// 초기화 버튼 아이콘은 별도로
|
||||||
|
createIcons({
|
||||||
|
scope: filterBar
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 4. 이벤트 바인딩
|
||||||
|
const keywordInput = document.getElementById('filter-keyword') as HTMLInputElement;
|
||||||
|
const fieldSelect = document.getElementById('filter-field') as HTMLSelectElement;
|
||||||
|
const corpSelect = document.getElementById('filter-corp') as HTMLSelectElement;
|
||||||
|
const resetBtn = document.getElementById('btn-reset-filters') as HTMLButtonElement;
|
||||||
|
|
||||||
|
keywordInput.addEventListener('input', updateTable);
|
||||||
|
fieldSelect.addEventListener('change', updateTable);
|
||||||
|
corpSelect.addEventListener('change', updateTable);
|
||||||
|
|
||||||
|
resetBtn.addEventListener('click', () => {
|
||||||
|
keywordInput.value = '';
|
||||||
|
fieldSelect.value = '';
|
||||||
|
corpSelect.value = '';
|
||||||
|
updateTable();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 초기 실행
|
||||||
|
updateTable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { state } from '../state';
|
import { state } from '../state';
|
||||||
import { HardwareAsset, SoftwareAsset } from '../excelHandler';
|
import { HardwareAsset, SoftwareAsset } from '../excelHandler';
|
||||||
|
|
||||||
|
declare var Chart: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 대시보드 렌더링 메인 함수
|
* 대시보드 렌더링 메인 함수
|
||||||
*/
|
*/
|
||||||
@@ -8,7 +10,9 @@ export function renderDashboard(mainContent: HTMLElement) {
|
|||||||
mainContent.innerHTML = '';
|
mainContent.innerHTML = '';
|
||||||
|
|
||||||
// 기존 차트 리소스 해제
|
// 기존 차트 리소스 해제
|
||||||
state.activeCharts.forEach(c => c.destroy());
|
state.activeCharts.forEach(c => {
|
||||||
|
if (c && typeof c.destroy === 'function') c.destroy();
|
||||||
|
});
|
||||||
state.activeCharts = [];
|
state.activeCharts = [];
|
||||||
|
|
||||||
if (state.activeCategory === 'hw') {
|
if (state.activeCategory === 'hw') {
|
||||||
@@ -120,9 +124,20 @@ function renderSwDashboard(container: HTMLElement) {
|
|||||||
let subQty = 0, subUsed = 0, subExp = 0, subTotal = 0;
|
let subQty = 0, subUsed = 0, subExp = 0, subTotal = 0;
|
||||||
let permQty = 0, permUsed = 0, permExp = 0, permTotal = 0;
|
let permQty = 0, permUsed = 0, permExp = 0, permTotal = 0;
|
||||||
|
|
||||||
|
const currentYear = new Date().getFullYear().toString();
|
||||||
|
const corps = ['한맥', '삼안', '바론'];
|
||||||
|
const categories = ['업무공통', '개발S/W', '디자인', '설계S/W'];
|
||||||
|
|
||||||
|
const costByCorp: Record<string, number> = { '한맥': 0, '삼안': 0, '바론': 0 };
|
||||||
|
const costByCat: Record<string, number> = {};
|
||||||
|
categories.forEach(c => costByCat[c] = 0);
|
||||||
|
|
||||||
state.masterData.sw.forEach(sw => {
|
state.masterData.sw.forEach(sw => {
|
||||||
const assigned = state.masterData.swUsers.filter(u => u.swId === sw.id).length;
|
const assigned = state.masterData.swUsers.filter(u => u.swId === sw.id).length;
|
||||||
const qty = typeof sw.수량 === 'number' ? sw.수량 : parseInt(sw.수량||'0', 10);
|
const qty = typeof sw.수량 === 'number' ? sw.수량 : parseInt(sw.수량||'0', 10);
|
||||||
|
const priceStr = sw.금액 ? sw.금액.replace(/,/g, '') : '0';
|
||||||
|
const price = parseInt(priceStr, 10) || 0;
|
||||||
|
|
||||||
if (sw.type === '구독SW') {
|
if (sw.type === '구독SW') {
|
||||||
subQty += qty; subUsed += assigned; subTotal++;
|
subQty += qty; subUsed += assigned; subTotal++;
|
||||||
if (isSWExpiring(sw)) subExp++;
|
if (isSWExpiring(sw)) subExp++;
|
||||||
@@ -130,6 +145,12 @@ function renderSwDashboard(container: HTMLElement) {
|
|||||||
permQty += qty; permUsed += assigned; permTotal++;
|
permQty += qty; permUsed += assigned; permTotal++;
|
||||||
if (isSWExpiring(sw)) permExp++;
|
if (isSWExpiring(sw)) permExp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 오늘이 속해있는 년도(2026)의 사용 금액 합계
|
||||||
|
if (sw.구매일 && sw.구매일.startsWith(currentYear)) {
|
||||||
|
if (costByCorp[sw.법인] !== undefined) costByCorp[sw.법인] += price;
|
||||||
|
if (sw.분야 && costByCat[sw.분야] !== undefined) costByCat[sw.분야] += price;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const subPer = subQty > 0 ? Math.round((subUsed/subQty)*100) : 0;
|
const subPer = subQty > 0 ? Math.round((subUsed/subQty)*100) : 0;
|
||||||
@@ -160,24 +181,127 @@ function renderSwDashboard(container: HTMLElement) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dashboard-layout-2col">
|
|
||||||
<div class="dashboard-card" data-action="sub-exp" style="padding: 1.25rem 1.5rem; cursor:pointer; display:flex; justify-content:space-between; align-items:center;">
|
<div class="dashboard-layout-2col" style="margin-bottom: 1.5rem;">
|
||||||
<div>
|
<div class="dashboard-card" data-action="sub-exp" style="padding: 1.25rem 1.5rem; flex-direction:row; justify-content:space-between; align-items:center; cursor:pointer;">
|
||||||
|
<div style="flex:1;">
|
||||||
|
<div style="display:flex; align-items:center; gap: 0.5rem; margin-bottom: 0.5rem;">
|
||||||
<span style="font-size:1rem; font-weight:700; color:var(--text-main);">구독 SW 만료 예정</span>
|
<span style="font-size:1rem; font-weight:700; color:var(--text-main);">구독 SW 만료 예정</span>
|
||||||
<div style="font-size: 0.8125rem; color:var(--text-muted);">${subExp}개 만료 예정</div>
|
<span style="font-size:0.75rem; color:#bfbfbf; background:#f9f9f9; padding:2px 6px; border-radius:4px;">30일 이내</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 60px; height: 60px; border-radius: 50%; background: conic-gradient(var(--dash-danger) ${subExpPer}%, var(--border-color) 0);"></div>
|
<div style="font-size: 0.8125rem; color:var(--text-muted); margin-bottom: 1.25rem;">
|
||||||
|
전체 ${subTotal}개 제품 중 ${subExp}개 만료 예정
|
||||||
</div>
|
</div>
|
||||||
<div class="dashboard-card" data-action="perm-exp" style="padding: 1.25rem 1.5rem; cursor:pointer; display:flex; justify-content:space-between; align-items:center;">
|
<div style="font-size: 1.5rem; font-weight:700; color:${subExp > 0 ? 'var(--dash-danger)' : 'var(--text-main)'};">${subExp}개</div>
|
||||||
<div>
|
</div>
|
||||||
|
<div style="width: 80px; height: 80px; border-radius: 50%; background: conic-gradient(var(--dash-danger) ${subExpPer}%, var(--border-color) 0); display:flex; justify-content:center; align-items:center;">
|
||||||
|
<div style="width: 64px; height: 64px; border-radius: 50%; background: var(--white); display:flex; justify-content:center; align-items:center;">
|
||||||
|
<span style="font-size: 1rem; color:var(--text-muted); font-weight:600;">${subExpPer}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dashboard-card" data-action="perm-exp" style="padding: 1.25rem 1.5rem; flex-direction:row; justify-content:space-between; align-items:center; cursor:pointer;">
|
||||||
|
<div style="flex:1;">
|
||||||
|
<div style="display:flex; align-items:center; gap: 0.5rem; margin-bottom: 0.5rem;">
|
||||||
<span style="font-size:1rem; font-weight:700; color:var(--text-main);">유지보수 만료 예정</span>
|
<span style="font-size:1rem; font-weight:700; color:var(--text-main);">유지보수 만료 예정</span>
|
||||||
<div style="font-size: 0.8125rem; color:var(--text-muted);">${permExp}개 만료 예정</div>
|
<span style="font-size:0.75rem; color:#bfbfbf; background:#f9f9f9; padding:2px 6px; border-radius:4px;">30일 이내</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 60px; height: 60px; border-radius: 50%; background: conic-gradient(var(--dash-danger) ${permExpPer}%, var(--border-color) 0);"></div>
|
<div style="font-size: 0.8125rem; color:var(--text-muted); margin-bottom: 1.25rem;">
|
||||||
|
전체 ${permTotal}개 제품 중 ${permExp}개 만료 예정
|
||||||
|
</div>
|
||||||
|
<div style="font-size: 1.5rem; font-weight:700; color:${permExp > 0 ? 'var(--dash-danger)' : 'var(--text-main)'};">${permExp}개</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 80px; height: 80px; border-radius: 50%; background: conic-gradient(var(--dash-danger) ${permExpPer}%, var(--border-color) 0); display:flex; justify-content:center; align-items:center;">
|
||||||
|
<div style="width: 64px; height: 64px; border-radius: 50%; background: var(--white); display:flex; justify-content:center; align-items:center;">
|
||||||
|
<span style="font-size: 1rem; color:var(--text-muted); font-weight:600;">${permExpPer}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 style="margin: 0 0 1rem 0; font-size: 1.125rem; color: var(--text-main);">${currentYear}년 소프트웨어 도입 비용</h3>
|
||||||
|
<div class="dashboard-layout-2col">
|
||||||
|
<div class="dashboard-card" style="padding: 1.5rem;">
|
||||||
|
<h4 style="margin: 0 0 1rem 0; font-size: 0.9375rem; color: var(--text-main);">법인별 도입 금액 (원)</h4>
|
||||||
|
<canvas id="chart-cost-corp" style="max-height: 250px;"></canvas>
|
||||||
|
</div>
|
||||||
|
<div class="dashboard-card" style="padding: 1.5rem;">
|
||||||
|
<h4 style="margin: 0 0 1rem 0; font-size: 0.9375rem; color: var(--text-main);">분야별 도입 금액 (원)</h4>
|
||||||
|
<canvas id="chart-cost-cat" style="max-height: 250px;"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
// 차트 생성
|
||||||
|
setTimeout(() => {
|
||||||
|
const ctxCorp = (document.getElementById('chart-cost-corp') as HTMLCanvasElement)?.getContext('2d');
|
||||||
|
const ctxCat = (document.getElementById('chart-cost-cat') as HTMLCanvasElement)?.getContext('2d');
|
||||||
|
|
||||||
|
if (ctxCorp && typeof Chart !== 'undefined') {
|
||||||
|
const chartCorp = new Chart(ctxCorp, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: corps,
|
||||||
|
datasets: [{
|
||||||
|
label: '도입 금액',
|
||||||
|
data: corps.map(c => costByCorp[c]),
|
||||||
|
backgroundColor: '#3b82f6',
|
||||||
|
borderRadius: 4,
|
||||||
|
barThickness: 20 // 막대 두께 줄임
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: false,
|
||||||
|
plugins: { legend: { display: false } },
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
beginAtZero: true,
|
||||||
|
ticks: { callback: (v: any) => v.toLocaleString() },
|
||||||
|
grid: { display: false } // 가로줄 삭제
|
||||||
|
},
|
||||||
|
x: {
|
||||||
|
grid: { display: false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
state.activeCharts.push(chartCorp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxCat && typeof Chart !== 'undefined') {
|
||||||
|
const chartCat = new Chart(ctxCat, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: categories,
|
||||||
|
datasets: [{
|
||||||
|
label: '도입 금액',
|
||||||
|
data: categories.map(c => costByCat[c]),
|
||||||
|
backgroundColor: '#10b981',
|
||||||
|
borderRadius: 4,
|
||||||
|
barThickness: 20 // 막대 두께 줄임
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: false,
|
||||||
|
plugins: { legend: { display: false } },
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
beginAtZero: true,
|
||||||
|
ticks: { callback: (v: any) => v.toLocaleString() },
|
||||||
|
grid: { display: false } // 가로줄 삭제
|
||||||
|
},
|
||||||
|
x: {
|
||||||
|
grid: { display: false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
state.activeCharts.push(chartCat);
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
|
||||||
// 클릭 이벤트 바인딩
|
// 클릭 이벤트 바인딩
|
||||||
container.querySelector('[data-action="sub-usage"]')?.addEventListener('click', () => {
|
container.querySelector('[data-action="sub-usage"]')?.addEventListener('click', () => {
|
||||||
openSwUsageDetail('구독 소프트웨어 사용 목록', state.masterData.sw.filter(sw => sw.type === '구독SW'));
|
openSwUsageDetail('구독 소프트웨어 사용 목록', state.masterData.sw.filter(sw => sw.type === '구독SW'));
|
||||||
@@ -285,3 +409,5 @@ function openSwUsageDetail(title: string, list: SoftwareAsset[]) {
|
|||||||
});
|
});
|
||||||
modal.classList.remove('hidden');
|
modal.classList.remove('hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user